From b5b3a63ca7e7b0fd0784182ff6be7878328068b7 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 29 Jul 2023 20:57:14 -0400 Subject: [PATCH] Remove legacy permissions support. In the long ago, a share could have one user/permissions pair. That's really limited, of course, so support for _n_ user/permissions pairs was added. In the move to WiX v4, support for that single, legacy user was removed from the extension side but not the custom action side. Remove that support. Fixes https://github.com/wixtoolset/issues/issues/7632. --- src/ext/Util/ca/scasmb.h | 3 -- src/ext/Util/ca/scasmbsched.cpp | 50 +++------------------------------ 2 files changed, 4 insertions(+), 49 deletions(-) diff --git a/src/ext/Util/ca/scasmb.h b/src/ext/Util/ca/scasmb.h index f2a4b53cd..7169cf2b8 100644 --- a/src/ext/Util/ca/scasmb.h +++ b/src/ext/Util/ca/scasmb.h @@ -23,14 +23,11 @@ struct SCA_SMB // hungarian ss WCHAR wzDirectory[MAX_PATH + 1]; int nUserPermissionCount; - int nPermissions; SCA_SMB_EX_USER_PERMS* pExUserPerms; INSTALLSTATE isInstalled, isAction; BOOL fUseIntegratedAuth; - BOOL fLegacyUserProvided; - struct SCA_USER scau; struct SCA_SMB* pssNext; }; diff --git a/src/ext/Util/ca/scasmbsched.cpp b/src/ext/Util/ca/scasmbsched.cpp index 53e8400da..fefd4781b 100644 --- a/src/ext/Util/ca/scasmbsched.cpp +++ b/src/ext/Util/ca/scasmbsched.cpp @@ -92,17 +92,14 @@ void ScaExUserPermsSmbFreeList(SCA_SMB_EX_USER_PERMS* pExUserPermsList) } // sql query constants -LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Description`, `Directory_`, " - L"`Component_`, `User_`, `Permissions` FROM `Wix4FileShare`"; +LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Component_`, `Description`, `Directory_` FROM `Wix4FileShare`"; enum eSmbQuery { ssqFileShare = 1, ssqShareName, + ssqComponent, ssqDescription, ssqDirectory, - ssqComponent, - ssqUser, - ssqPermissions }; @@ -173,31 +170,11 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList) hr = ::StringCchCopyW(pss->wzDescription, countof(pss->wzDescription), pwzData); ExitOnFailure(hr, "Failed to copy description string to smb object"); - // get user info from the user table - hr = WcaGetRecordFormattedString(hRec, ssqUser, &pwzData); - ExitOnFailure(hr, "Failed to get Wix4User record for Wix4FileShare: '%ls'", pss->wzShareName); - // get component install state er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pss->wzComponent, &pss->isInstalled, &pss->isAction); hr = HRESULT_FROM_WIN32(er); ExitOnFailure(hr, "Failed to get Component state for Wix4FileShare"); - // if a user was specified - if (*pwzData) - { - pss->fUseIntegratedAuth = FALSE; - pss->fLegacyUserProvided = TRUE; - hr = ScaGetUser(pwzData, &pss->scau); - ExitOnFailure(hr, "Failed to get user information for fileshare: '%ls'", pss->wzShareName); - } - else - { - pss->fLegacyUserProvided = FALSE; - // TODO: figure out whether this is useful still - //pss->fUseIntegratedAuth = TRUE; - // integrated authorization doesn't have a User record - } - // get the share's directory hr = WcaGetRecordString(hRec, ssqDirectory, &pwzData); ExitOnFailure(hr, "Failed to get directory for Wix4FileShare: '%ls'", pss->wzShareName); @@ -235,9 +212,6 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList) hr = ::StringCchCopyW(pss->wzDirectory, countof(pss->wzDirectory), wzPath); ExitOnFailure(hr, "Failed to copy directory string to smb object"); - hr = WcaGetRecordInteger(hRec, ssqPermissions, &pss->nPermissions); - ExitOnFailure(hr, "Failed to get Wix4FileShare.Permissions"); - // Check to see if additional user & permissions are specified for this share if (bUserPermissionsTableExists) { @@ -378,24 +352,8 @@ HRESULT SchedCreateSmb(SCA_SMB* pss) hr = WcaWriteStringToCaData(pss->fUseIntegratedAuth ? L"1" : L"0", &pwzCustomActionData); ExitOnFailure(hr, "Failed to add server name to CustomActionData"); - if (pss->fLegacyUserProvided) - { - hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount + 1, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData"); - - hr = UserBuildDomainUserName(wzDomainUser, countof(wzDomainUser), pss->scau.wzName, pss->scau.wzDomain); - ExitOnFailure(hr, "Failed to build user and domain name for CustomActionData"); - hr = WcaWriteStringToCaData(wzDomainUser, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add server Domain\\UserName to CustomActionData"); - - hr = WcaWriteIntegerToCaData(pss->nPermissions, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add permissions to CustomActionData"); - } - else - { - hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount, &pwzCustomActionData); - ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData"); - } + hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount, &pwzCustomActionData); + ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData"); if (pss->nUserPermissionCount > 0) {