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.
Bob Arnson committed
Jul 29, 2023 at 20:57 UTC
6d5c4be037087420dff69d8f3ed6c7b528e4125e
2 files changed
+4
-49
src/ext/Util/ca/scasmb.h
-3
@@ -23,14 +23,11 @@ struct SCA_SMB // hungarian ss
23
WCHAR wzDirectory[MAX_PATH + 1];
24
25
int nUserPermissionCount;
26
- int nPermissions;
26
SCA_SMB_EX_USER_PERMS* pExUserPerms;
27
28
INSTALLSTATE isInstalled, isAction;
29
30
BOOL fUseIntegratedAuth;
32
- BOOL fLegacyUserProvided;
33
- struct SCA_USER scau;
31
32
struct SCA_SMB* pssNext;
33
};
src/ext/Util/ca/scasmbsched.cpp
+4
-46
@@ -92,17 +92,14 @@ void ScaExUserPermsSmbFreeList(SCA_SMB_EX_USER_PERMS* pExUserPermsList)
92
}
93
94
// sql query constants
95
-LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Description`, `Directory_`, "
96
- L"`Component_`, `User_`, `Permissions` FROM `Wix4FileShare`";
95
+LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Component_`, `Description`, `Directory_` FROM `Wix4FileShare`";
96
97
enum eSmbQuery {
98
ssqFileShare = 1,
99
ssqShareName,
100
+ ssqComponent,
101
ssqDescription,
102
ssqDirectory,
103
- ssqComponent,
104
- ssqUser,
105
- ssqPermissions
103
};
104
105
@@ -173,31 +170,11 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
170
hr = ::StringCchCopyW(pss->wzDescription, countof(pss->wzDescription), pwzData);
171
ExitOnFailure(hr, "Failed to copy description string to smb object");
172
176
- // get user info from the user table
177
- hr = WcaGetRecordFormattedString(hRec, ssqUser, &pwzData);
178
- ExitOnFailure(hr, "Failed to get Wix4User record for Wix4FileShare: '%ls'", pss->wzShareName);
179
-
173
// get component install state
174
er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pss->wzComponent, &pss->isInstalled, &pss->isAction);
175
hr = HRESULT_FROM_WIN32(er);
176
ExitOnFailure(hr, "Failed to get Component state for Wix4FileShare");
177
185
- // if a user was specified
186
- if (*pwzData)
187
- {
188
- pss->fUseIntegratedAuth = FALSE;
189
- pss->fLegacyUserProvided = TRUE;
190
- hr = ScaGetUser(pwzData, &pss->scau);
191
- ExitOnFailure(hr, "Failed to get user information for fileshare: '%ls'", pss->wzShareName);
192
- }
193
- else
194
- {
195
- pss->fLegacyUserProvided = FALSE;
196
- // TODO: figure out whether this is useful still
197
- //pss->fUseIntegratedAuth = TRUE;
198
- // integrated authorization doesn't have a User record
199
- }
200
-
178
// get the share's directory
179
hr = WcaGetRecordString(hRec, ssqDirectory, &pwzData);
180
ExitOnFailure(hr, "Failed to get directory for Wix4FileShare: '%ls'", pss->wzShareName);
@@ -235,9 +212,6 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
212
hr = ::StringCchCopyW(pss->wzDirectory, countof(pss->wzDirectory), wzPath);
213
ExitOnFailure(hr, "Failed to copy directory string to smb object");
214
238
- hr = WcaGetRecordInteger(hRec, ssqPermissions, &pss->nPermissions);
239
- ExitOnFailure(hr, "Failed to get Wix4FileShare.Permissions");
240
-
215
// Check to see if additional user & permissions are specified for this share
216
if (bUserPermissionsTableExists)
217
{
@@ -378,24 +352,8 @@ HRESULT SchedCreateSmb(SCA_SMB* pss)
352
hr = WcaWriteStringToCaData(pss->fUseIntegratedAuth ? L"1" : L"0", &pwzCustomActionData);
353
ExitOnFailure(hr, "Failed to add server name to CustomActionData");
354
381
- if (pss->fLegacyUserProvided)
382
- {
383
- hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount + 1, &pwzCustomActionData);
384
- ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData");
385
-
386
- hr = UserBuildDomainUserName(wzDomainUser, countof(wzDomainUser), pss->scau.wzName, pss->scau.wzDomain);
387
- ExitOnFailure(hr, "Failed to build user and domain name for CustomActionData");
388
- hr = WcaWriteStringToCaData(wzDomainUser, &pwzCustomActionData);
389
- ExitOnFailure(hr, "Failed to add server Domain\\UserName to CustomActionData");
390
-
391
- hr = WcaWriteIntegerToCaData(pss->nPermissions, &pwzCustomActionData);
392
- ExitOnFailure(hr, "Failed to add permissions to CustomActionData");
393
- }
394
- else
395
- {
396
- hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount, &pwzCustomActionData);
397
- ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData");
398
- }
355
+ hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount, &pwzCustomActionData);
356
+ ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData");
357
358
if (pss->nUserPermissionCount > 0)
359
{