Skip to content

Commit

Permalink
Remove legacy permissions support.
Browse files Browse the repository at this point in the history
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 wixtoolset/issues#7632.
  • Loading branch information
barnson authored and robmen committed Aug 7, 2023
1 parent 023aa61 commit b5b3a63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 49 deletions.
3 changes: 0 additions & 3 deletions src/ext/Util/ca/scasmb.h
Expand Up @@ -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;
};
Expand Down
50 changes: 4 additions & 46 deletions src/ext/Util/ca/scasmbsched.cpp
Expand Up @@ -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
};


Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit b5b3a63

Please sign in to comment.