mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
Windows: avoid GetComputerNameW call for all ioctl
Cache the value of GetComputerNameW() to avoid repeated calls for each and every redirector ioctl request. Change-Id: I4476db982897a631510eba7d859385268b16ce34 Reviewed-on: http://gerrit.openafs.org/6708 Tested-by: BuildBot <buildbot@rampaginggeek.com> Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com> Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
This commit is contained in:
parent
12e2a3abe7
commit
da17eb6c86
@ -178,17 +178,19 @@ RDR_SetInitParams( OUT AFSRedirectorInitInfo **ppRedirInitInfo, OUT DWORD * pRed
|
||||
return 0;
|
||||
}
|
||||
|
||||
static wchar_t cname[MAX_COMPUTERNAME_LENGTH+1] = L"";
|
||||
|
||||
cm_user_t *
|
||||
RDR_GetLocalSystemUser( void)
|
||||
{
|
||||
smb_username_t *unp;
|
||||
cm_user_t *userp = NULL;
|
||||
wchar_t cname[MAX_COMPUTERNAME_LENGTH+1];
|
||||
int cnamelen = MAX_COMPUTERNAME_LENGTH+1;
|
||||
|
||||
GetComputerNameW(cname, &cnamelen);
|
||||
_wcsupr(cname);
|
||||
|
||||
if ( cname[0] == '\0') {
|
||||
int len = MAX_COMPUTERNAME_LENGTH+1;
|
||||
GetComputerNameW(cname, &len);
|
||||
_wcsupr(cname);
|
||||
}
|
||||
unp = smb_FindUserByName(NTSID_LOCAL_SYSTEM, cname, SMB_FLAG_CREATE);
|
||||
lock_ObtainMutex(&unp->mx);
|
||||
if (!unp->userp)
|
||||
@ -220,14 +222,15 @@ RDR_UserFromAuthGroup( IN GUID *pGuid)
|
||||
smb_username_t *unp;
|
||||
cm_user_t * userp = NULL;
|
||||
RPC_WSTR UuidString = NULL;
|
||||
wchar_t cname[MAX_COMPUTERNAME_LENGTH+1];
|
||||
int cnamelen = MAX_COMPUTERNAME_LENGTH+1;
|
||||
|
||||
if (UuidToStringW((UUID *)pGuid, &UuidString) != RPC_S_OK)
|
||||
goto done;
|
||||
|
||||
GetComputerNameW(cname, &cnamelen);
|
||||
_wcsupr(cname);
|
||||
if ( cname[0] == '\0') {
|
||||
int len = MAX_COMPUTERNAME_LENGTH+1;
|
||||
GetComputerNameW(cname, &len);
|
||||
_wcsupr(cname);
|
||||
}
|
||||
|
||||
unp = smb_FindUserByName(UuidString, cname, SMB_FLAG_CREATE);
|
||||
lock_ObtainMutex(&unp->mx);
|
||||
|
@ -924,17 +924,19 @@ RDR_IoctlSetToken(struct RDR_ioctl *ioctlp, struct cm_user *userp, afs_uint32 pf
|
||||
|
||||
#if defined(NO_AUTH_GROUPS)
|
||||
if ((pflags & AFSCALL_FLAG_LOCAL_SYSTEM) && (flags & PIOCTL_LOGON)) {
|
||||
wchar_t cname[MAX_COMPUTERNAME_LENGTH+1];
|
||||
int cnamelen = MAX_COMPUTERNAME_LENGTH+1;
|
||||
PSID pSid = NULL;
|
||||
DWORD dwSize1, dwSize2;
|
||||
wchar_t *pszRefDomain = NULL;
|
||||
SID_NAME_USE snu = SidTypeGroup;
|
||||
clientchar_t * secSidString = NULL;
|
||||
DWORD gle;
|
||||
static wchar_t cname[MAX_COMPUTERNAME_LENGTH+1] = L"";
|
||||
|
||||
GetComputerNameW(cname, &cnamelen);
|
||||
wcsupr(cname);
|
||||
if ( cname[0] == '\0') {
|
||||
int len = MAX_COMPUTERNAME_LENGTH+1;
|
||||
GetComputerNameW(cname, &len);
|
||||
_wcsupr(cname);
|
||||
}
|
||||
|
||||
/*
|
||||
* The input name is probably not a SID for the user which is how
|
||||
|
Loading…
Reference in New Issue
Block a user