aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ext/Util/ca/scasmb.h3
-rw-r--r--src/ext/Util/ca/scasmbsched.cpp50
2 files changed, 4 insertions, 49 deletions
diff --git a/src/ext/Util/ca/scasmb.h b/src/ext/Util/ca/scasmb.h
index f2a4b53c..7169cf2b 100644
--- a/src/ext/Util/ca/scasmb.h
+++ b/src/ext/Util/ca/scasmb.h
@@ -23,14 +23,11 @@ struct SCA_SMB // hungarian ss
23 WCHAR wzDirectory[MAX_PATH + 1]; 23 WCHAR wzDirectory[MAX_PATH + 1];
24 24
25 int nUserPermissionCount; 25 int nUserPermissionCount;
26 int nPermissions;
27 SCA_SMB_EX_USER_PERMS* pExUserPerms; 26 SCA_SMB_EX_USER_PERMS* pExUserPerms;
28 27
29 INSTALLSTATE isInstalled, isAction; 28 INSTALLSTATE isInstalled, isAction;
30 29
31 BOOL fUseIntegratedAuth; 30 BOOL fUseIntegratedAuth;
32 BOOL fLegacyUserProvided;
33 struct SCA_USER scau;
34 31
35 struct SCA_SMB* pssNext; 32 struct SCA_SMB* pssNext;
36}; 33};
diff --git a/src/ext/Util/ca/scasmbsched.cpp b/src/ext/Util/ca/scasmbsched.cpp
index 53e8400d..fefd4781 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)
92} 92}
93 93
94// sql query constants 94// sql query constants
95LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Description`, `Directory_`, " 95LPCWSTR vcsSmbQuery = L"SELECT `FileShare`, `ShareName`, `Component_`, `Description`, `Directory_` FROM `Wix4FileShare`";
96 L"`Component_`, `User_`, `Permissions` FROM `Wix4FileShare`";
97 96
98enum eSmbQuery { 97enum eSmbQuery {
99 ssqFileShare = 1, 98 ssqFileShare = 1,
100 ssqShareName, 99 ssqShareName,
100 ssqComponent,
101 ssqDescription, 101 ssqDescription,
102 ssqDirectory, 102 ssqDirectory,
103 ssqComponent,
104 ssqUser,
105 ssqPermissions
106 }; 103 };
107 104
108 105
@@ -173,31 +170,11 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
173 hr = ::StringCchCopyW(pss->wzDescription, countof(pss->wzDescription), pwzData); 170 hr = ::StringCchCopyW(pss->wzDescription, countof(pss->wzDescription), pwzData);
174 ExitOnFailure(hr, "Failed to copy description string to smb object"); 171 ExitOnFailure(hr, "Failed to copy description string to smb object");
175 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
180 // get component install state 173 // get component install state
181 er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pss->wzComponent, &pss->isInstalled, &pss->isAction); 174 er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pss->wzComponent, &pss->isInstalled, &pss->isAction);
182 hr = HRESULT_FROM_WIN32(er); 175 hr = HRESULT_FROM_WIN32(er);
183 ExitOnFailure(hr, "Failed to get Component state for Wix4FileShare"); 176 ExitOnFailure(hr, "Failed to get Component state for Wix4FileShare");
184 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
201 // get the share's directory 178 // get the share's directory
202 hr = WcaGetRecordString(hRec, ssqDirectory, &pwzData); 179 hr = WcaGetRecordString(hRec, ssqDirectory, &pwzData);
203 ExitOnFailure(hr, "Failed to get directory for Wix4FileShare: '%ls'", pss->wzShareName); 180 ExitOnFailure(hr, "Failed to get directory for Wix4FileShare: '%ls'", pss->wzShareName);
@@ -235,9 +212,6 @@ HRESULT ScaSmbRead(SCA_SMB** ppssList)
235 hr = ::StringCchCopyW(pss->wzDirectory, countof(pss->wzDirectory), wzPath); 212 hr = ::StringCchCopyW(pss->wzDirectory, countof(pss->wzDirectory), wzPath);
236 ExitOnFailure(hr, "Failed to copy directory string to smb object"); 213 ExitOnFailure(hr, "Failed to copy directory string to smb object");
237 214
238 hr = WcaGetRecordInteger(hRec, ssqPermissions, &pss->nPermissions);
239 ExitOnFailure(hr, "Failed to get Wix4FileShare.Permissions");
240
241 // Check to see if additional user & permissions are specified for this share 215 // Check to see if additional user & permissions are specified for this share
242 if (bUserPermissionsTableExists) 216 if (bUserPermissionsTableExists)
243 { 217 {
@@ -378,24 +352,8 @@ HRESULT SchedCreateSmb(SCA_SMB* pss)
378 hr = WcaWriteStringToCaData(pss->fUseIntegratedAuth ? L"1" : L"0", &pwzCustomActionData); 352 hr = WcaWriteStringToCaData(pss->fUseIntegratedAuth ? L"1" : L"0", &pwzCustomActionData);
379 ExitOnFailure(hr, "Failed to add server name to CustomActionData"); 353 ExitOnFailure(hr, "Failed to add server name to CustomActionData");
380 354
381 if (pss->fLegacyUserProvided) 355 hr = WcaWriteIntegerToCaData(pss->nUserPermissionCount, &pwzCustomActionData);
382 { 356 ExitOnFailure(hr, "Failed to add additional user permission count to CustomActionData");
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 }
399 357
400 if (pss->nUserPermissionCount > 0) 358 if (pss->nUserPermissionCount > 0)
401 { 359 {