mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 23:40:13 +00:00
STABLE14-windows-misc-20040907
replace QWORD with DWORD
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
add expanded registry string support to Submounts
====================
Correct a 64-bit time_t error
(cherry picked from commit f31658317a
)
This commit is contained in:
parent
8660663e6a
commit
e0e9832c9b
@ -28,7 +28,7 @@ Variable: LANadapter
|
|||||||
name will be 'AFS'.
|
name will be 'AFS'.
|
||||||
|
|
||||||
Value : CacheSize
|
Value : CacheSize
|
||||||
Type : QWORD
|
Type : DWORD
|
||||||
Default : 20480 (CM_CONFIGDEFAULT_CACHESIZE)
|
Default : 20480 (CM_CONFIGDEFAULT_CACHESIZE)
|
||||||
Variable: cm_initParams.cacheSize
|
Variable: cm_initParams.cacheSize
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ Variable: numSvThreads
|
|||||||
smb_Server in smb.c).
|
smb_Server in smb.c).
|
||||||
|
|
||||||
Value : Stats
|
Value : Stats
|
||||||
Type : QWORD
|
Type : DWORD
|
||||||
Default : 1000 (CM_CONFIGDEFAULT_STATS)
|
Default : 1000 (CM_CONFIGDEFAULT_STATS)
|
||||||
Variable: cm_initParams.nStatCaches
|
Variable: cm_initParams.nStatCaches
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ Variable: smb_LogoffTokenTransfer
|
|||||||
that the tokens remain valid until the profile save is complete.
|
that the tokens remain valid until the profile save is complete.
|
||||||
|
|
||||||
Value : LogoffTokenTransferTimeout
|
Value : LogoffTokenTransferTimeout
|
||||||
Type : QWORD
|
Type : DWORD
|
||||||
Default : 10
|
Default : 10
|
||||||
Variable: smb_LogoffTokenTransferTimeout
|
Variable: smb_LogoffTokenTransferTimeout
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ Variable: reportSessionStartups
|
|||||||
or various error types to be logged.
|
or various error types to be logged.
|
||||||
|
|
||||||
Value : TraceBufferSize
|
Value : TraceBufferSize
|
||||||
Type : QWORD
|
Type : DWORD
|
||||||
Default : 5000 (CM_CONFIGDEFAULT_TRACEBUFSIZE)
|
Default : 5000 (CM_CONFIGDEFAULT_TRACEBUFSIZE)
|
||||||
Variable: traceBufSize
|
Variable: traceBufSize
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ int afsd_InitCM(char **reasonP)
|
|||||||
code = RegQueryValueEx(parmKey, "CachePath", NULL, ®Type,
|
code = RegQueryValueEx(parmKey, "CachePath", NULL, ®Type,
|
||||||
buf, &dummyLen);
|
buf, &dummyLen);
|
||||||
if (code == ERROR_SUCCESS && buf[0]) {
|
if (code == ERROR_SUCCESS && buf[0]) {
|
||||||
if(regType == REG_EXPAND_SZ) {
|
if (regType == REG_EXPAND_SZ) {
|
||||||
dummyLen = ExpandEnvironmentStrings(buf, cm_CachePath, sizeof(cm_CachePath));
|
dummyLen = ExpandEnvironmentStrings(buf, cm_CachePath, sizeof(cm_CachePath));
|
||||||
if(dummyLen > sizeof(cm_CachePath)) {
|
if(dummyLen > sizeof(cm_CachePath)) {
|
||||||
afsi_log("Cache path [%s] longer than %d after expanding env strings", buf, sizeof(cm_CachePath));
|
afsi_log("Cache path [%s] longer than %d after expanding env strings", buf, sizeof(cm_CachePath));
|
||||||
|
@ -65,7 +65,7 @@ main(int argc, char **argv) {
|
|||||||
else
|
else
|
||||||
mountstring = argv[2];
|
mountstring = argv[2];
|
||||||
|
|
||||||
if (RegSetValueEx(hkSubmounts, argv[1], 0, REG_SZ, mountstring, strlen(mountstring)+1)) {
|
if (RegSetValueEx(hkSubmounts, argv[1], 0, REG_EXPAND_SZ, mountstring, strlen(mountstring)+1)) {
|
||||||
fprintf(stderr,"Submount Set failure for [%s]: %lX",
|
fprintf(stderr,"Submount Set failure for [%s]: %lX",
|
||||||
argv[1], GetLastError());
|
argv[1], GetLastError());
|
||||||
RegCloseKey(hkSubmounts);
|
RegCloseKey(hkSubmounts);
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cm_rpc.h"
|
#include "cm_rpc.h"
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
@ -1991,32 +1992,32 @@ long cm_IoctlDelAllToken(struct smb_ioctl *ioctlp, struct cm_user *userp)
|
|||||||
|
|
||||||
long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp)
|
long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp)
|
||||||
{
|
{
|
||||||
char afspath[MAX_PATH];
|
char afspath[MAX_PATH];
|
||||||
char *submountreqp;
|
char *submountreqp;
|
||||||
int nextAutoSubmount;
|
int nextAutoSubmount;
|
||||||
HKEY hkSubmounts;
|
HKEY hkSubmounts;
|
||||||
DWORD dwType, dwSize;
|
DWORD dwType, dwSize;
|
||||||
DWORD status;
|
DWORD status;
|
||||||
DWORD dwIndex;
|
DWORD dwIndex;
|
||||||
DWORD dwSubmounts;
|
DWORD dwSubmounts;
|
||||||
|
|
||||||
cm_SkipIoctlPath(ioctlp);
|
cm_SkipIoctlPath(ioctlp);
|
||||||
|
|
||||||
/* Serialize this one, to prevent simultaneous mods
|
/* Serialize this one, to prevent simultaneous mods
|
||||||
* to afsdsbmt.ini
|
* to afsdsbmt.ini
|
||||||
*/
|
*/
|
||||||
lock_ObtainMutex(&cm_Afsdsbmt_Lock);
|
lock_ObtainMutex(&cm_Afsdsbmt_Lock);
|
||||||
|
|
||||||
/* Parse the input parameters--first the required afs path,
|
/* Parse the input parameters--first the required afs path,
|
||||||
* then the requested submount name (which may be "").
|
* then the requested submount name (which may be "").
|
||||||
*/
|
*/
|
||||||
cm_NormalizeAfsPath (afspath, ioctlp->inDatap);
|
cm_NormalizeAfsPath (afspath, ioctlp->inDatap);
|
||||||
submountreqp = ioctlp->inDatap + (strlen(ioctlp->inDatap)+1);
|
submountreqp = ioctlp->inDatap + (strlen(ioctlp->inDatap)+1);
|
||||||
|
|
||||||
/* If the caller supplied a suggested submount name, see if
|
/* If the caller supplied a suggested submount name, see if
|
||||||
* that submount name is in use... if so, the submount's path
|
* that submount name is in use... if so, the submount's path
|
||||||
* has to match our path.
|
* has to match our path.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
||||||
"SOFTWARE\\OpenAFS\\Client\\Submounts",
|
"SOFTWARE\\OpenAFS\\Client\\Submounts",
|
||||||
@ -2029,22 +2030,22 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp)
|
|||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
if (submountreqp && *submountreqp) {
|
if (submountreqp && *submountreqp) {
|
||||||
char submountPathNormalized[MAX_PATH];
|
char submountPathNormalized[MAX_PATH];
|
||||||
char submountPath[MAX_PATH];
|
char submountPath[MAX_PATH];
|
||||||
|
|
||||||
dwSize = sizeof(submountPath);
|
dwSize = sizeof(submountPath);
|
||||||
status = RegQueryValueEx( hkSubmounts, submountreqp, 0,
|
status = RegQueryValueEx( hkSubmounts, submountreqp, 0,
|
||||||
&dwType, submountPath, &dwSize);
|
&dwType, submountPath, &dwSize);
|
||||||
|
|
||||||
if (status != ERROR_SUCCESS) {
|
if (status != ERROR_SUCCESS) {
|
||||||
|
|
||||||
/* The suggested submount name isn't in use now--
|
/* The suggested submount name isn't in use now--
|
||||||
* so we can safely map the requested submount name
|
* so we can safely map the requested submount name
|
||||||
* to the supplied path. Remember not to write the
|
* to the supplied path. Remember not to write the
|
||||||
* leading "/afs" when writing out the submount.
|
* leading "/afs" when writing out the submount.
|
||||||
*/
|
*/
|
||||||
RegSetValueEx( hkSubmounts, submountreqp, 0,
|
RegSetValueEx( hkSubmounts, submountreqp, 0,
|
||||||
REG_SZ,
|
REG_EXPAND_SZ,
|
||||||
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
||||||
&afspath[strlen(cm_mountRoot)]:"/",
|
&afspath[strlen(cm_mountRoot)]:"/",
|
||||||
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
||||||
@ -2055,106 +2056,113 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp)
|
|||||||
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
||||||
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The suggested submount name is already in use--if the
|
/* The suggested submount name is already in use--if the
|
||||||
* supplied path matches the submount's path, we can still
|
* supplied path matches the submount's path, we can still
|
||||||
* use the suggested submount name.
|
* use the suggested submount name.
|
||||||
*/
|
*/
|
||||||
cm_NormalizeAfsPath (submountPathNormalized, submountPath);
|
cm_NormalizeAfsPath (submountPathNormalized, submountPath);
|
||||||
if (!strcmp (submountPathNormalized, afspath)) {
|
if (!strcmp (submountPathNormalized, afspath)) {
|
||||||
strcpy(ioctlp->outDatap, submountreqp);
|
strcpy(ioctlp->outDatap, submountreqp);
|
||||||
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
||||||
RegCloseKey( hkSubmounts );
|
RegCloseKey( hkSubmounts );
|
||||||
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RegQueryInfoKey( hkSubmounts,
|
RegQueryInfoKey( hkSubmounts,
|
||||||
NULL, /* lpClass */
|
NULL, /* lpClass */
|
||||||
NULL, /* lpcClass */
|
NULL, /* lpcClass */
|
||||||
NULL, /* lpReserved */
|
NULL, /* lpReserved */
|
||||||
NULL, /* lpcSubKeys */
|
NULL, /* lpcSubKeys */
|
||||||
NULL, /* lpcMaxSubKeyLen */
|
NULL, /* lpcMaxSubKeyLen */
|
||||||
NULL, /* lpcMaxClassLen */
|
NULL, /* lpcMaxClassLen */
|
||||||
&dwSubmounts, /* lpcValues */
|
&dwSubmounts, /* lpcValues */
|
||||||
NULL, /* lpcMaxValueNameLen */
|
NULL, /* lpcMaxValueNameLen */
|
||||||
NULL, /* lpcMaxValueLen */
|
NULL, /* lpcMaxValueLen */
|
||||||
NULL, /* lpcbSecurityDescriptor */
|
NULL, /* lpcbSecurityDescriptor */
|
||||||
NULL /* lpftLastWriteTime */
|
NULL /* lpftLastWriteTime */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/* Having obtained a list of all available submounts, start
|
/* Having obtained a list of all available submounts, start
|
||||||
* searching that list for a path which matches the requested
|
* searching that list for a path which matches the requested
|
||||||
* AFS path. We'll also keep track of the highest "auto15"/"auto47"
|
* AFS path. We'll also keep track of the highest "auto15"/"auto47"
|
||||||
* submount, in case we need to add a new one later.
|
* submount, in case we need to add a new one later.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nextAutoSubmount = 1;
|
nextAutoSubmount = 1;
|
||||||
|
|
||||||
for ( dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) {
|
for ( dwIndex = 0; dwIndex < dwSubmounts; dwIndex ++ ) {
|
||||||
char submountPathNormalized[MAX_PATH];
|
char submountPathNormalized[MAX_PATH];
|
||||||
char submountPath[MAX_PATH] = "";
|
char submountPath[MAX_PATH] = "";
|
||||||
DWORD submountPathLen = sizeof(submountPath);
|
DWORD submountPathLen = sizeof(submountPath);
|
||||||
char submountName[256];
|
char submountName[MAX_PATH];
|
||||||
DWORD submountNameLen = sizeof(submountName);
|
DWORD submountNameLen = sizeof(submountName);
|
||||||
|
|
||||||
|
dwType = 0;
|
||||||
RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
|
RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
|
||||||
&dwType, submountPath, &submountPathLen);
|
&dwType, submountPath, &submountPathLen);
|
||||||
|
if (dwType == REG_EXPAND_SZ) {
|
||||||
|
char buf[MAX_PATH];
|
||||||
|
StringCbCopyA(buf, MAX_PATH, submountPath);
|
||||||
|
submountPathLen = ExpandEnvironmentStrings(buf, submountPath, MAX_PATH);
|
||||||
|
if (submountPathLen > MAX_PATH)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* If this is an Auto### submount, remember its ### value */
|
/* If this is an Auto### submount, remember its ### value */
|
||||||
|
if ((!strnicmp (submountName, "auto", 4)) &&
|
||||||
|
(isdigit (submountName[strlen("auto")]))) {
|
||||||
|
int thisAutoSubmount;
|
||||||
|
thisAutoSubmount = atoi (&submountName[strlen("auto")]);
|
||||||
|
nextAutoSubmount = max (nextAutoSubmount,
|
||||||
|
thisAutoSubmount+1);
|
||||||
|
}
|
||||||
|
|
||||||
if ((!strnicmp (submountName, "auto", 4)) &&
|
if ((submountPathLen == 0) ||
|
||||||
(isdigit (submountName[strlen("auto")]))) {
|
(submountPathLen == sizeof(submountPath) - 1)) {
|
||||||
int thisAutoSubmount;
|
continue;
|
||||||
thisAutoSubmount = atoi (&submountName[strlen("auto")]);
|
}
|
||||||
nextAutoSubmount = max (nextAutoSubmount,
|
|
||||||
thisAutoSubmount+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((submountPathLen == 0) ||
|
/* See if the path for this submount matches the path
|
||||||
(submountPathLen == sizeof(submountPath) - 1)) {
|
* that our caller specified. If so, we can return
|
||||||
continue;
|
* this submount.
|
||||||
}
|
*/
|
||||||
|
cm_NormalizeAfsPath (submountPathNormalized, submountPath);
|
||||||
/* See if the path for this submount matches the path
|
if (!strcmp (submountPathNormalized, afspath)) {
|
||||||
* that our caller specified. If so, we can return
|
strcpy(ioctlp->outDatap, submountName);
|
||||||
* this submount.
|
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
||||||
*/
|
|
||||||
cm_NormalizeAfsPath (submountPathNormalized, submountPath);
|
|
||||||
if (!strcmp (submountPathNormalized, afspath)) {
|
|
||||||
strcpy(ioctlp->outDatap, submountName);
|
|
||||||
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
|
||||||
RegCloseKey(hkSubmounts);
|
RegCloseKey(hkSubmounts);
|
||||||
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've been through the entire list of existing submounts, and
|
/* We've been through the entire list of existing submounts, and
|
||||||
* didn't find any which matched the specified path. So, we'll
|
* didn't find any which matched the specified path. So, we'll
|
||||||
* just have to add one. Remember not to write the leading "/afs"
|
* just have to add one. Remember not to write the leading "/afs"
|
||||||
* when writing out the submount.
|
* when writing out the submount.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount);
|
sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount);
|
||||||
|
|
||||||
RegSetValueEx( hkSubmounts,
|
RegSetValueEx( hkSubmounts,
|
||||||
ioctlp->outDatap,
|
ioctlp->outDatap,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_EXPAND_SZ,
|
||||||
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
||||||
&afspath[strlen(cm_mountRoot)]:"/",
|
&afspath[strlen(cm_mountRoot)]:"/",
|
||||||
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
(strlen(&afspath[strlen(cm_mountRoot)])) ?
|
||||||
strlen(&afspath[strlen(cm_mountRoot)])+1:2);
|
strlen(&afspath[strlen(cm_mountRoot)])+1:2);
|
||||||
|
|
||||||
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
|
||||||
RegCloseKey(hkSubmounts);
|
RegCloseKey(hkSubmounts);
|
||||||
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long cm_IoctlGetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp)
|
long cm_IoctlGetRxkcrypt(smb_ioctl_t *ioctlp, cm_user_t *userp)
|
||||||
|
@ -26,6 +26,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#include <osilog.h>
|
#include <osilog.h>
|
||||||
#include <lanahelper.h>
|
#include <lanahelper.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
extern void Config_GetLanAdapter (ULONG *pnLanAdapter);
|
extern void Config_GetLanAdapter (ULONG *pnLanAdapter);
|
||||||
|
|
||||||
@ -75,6 +76,28 @@ WriteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs)
|
|||||||
return (status == ERROR_SUCCESS);
|
return (status == ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
WriteExpandedRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs)
|
||||||
|
{
|
||||||
|
HKEY hkSub = NULL;
|
||||||
|
RegCreateKeyEx( key,
|
||||||
|
subkey,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
REG_OPTION_NON_VOLATILE,
|
||||||
|
KEY_WRITE,
|
||||||
|
NULL,
|
||||||
|
&hkSub,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
DWORD status = RegSetValueEx( hkSub, lhs, 0, REG_EXPAND_SZ, (const BYTE *)rhs, strlen(rhs)+1 );
|
||||||
|
|
||||||
|
if ( hkSub )
|
||||||
|
RegCloseKey( hkSub );
|
||||||
|
|
||||||
|
return (status == ERROR_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
ReadRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs, DWORD * size)
|
ReadRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs, DWORD * size)
|
||||||
{
|
{
|
||||||
@ -89,8 +112,19 @@ ReadRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs, DWORD * siz
|
|||||||
&hkSub,
|
&hkSub,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
DWORD dwType;
|
DWORD dwType = 0;
|
||||||
DWORD status = RegQueryValueEx( hkSub, lhs, 0, &dwType, (LPBYTE)rhs, size );
|
DWORD localSize = *size;
|
||||||
|
|
||||||
|
DWORD status = RegQueryValueEx( hkSub, lhs, 0, &dwType, (LPBYTE)rhs, &localSize);
|
||||||
|
if (status == 0 && dwType == REG_EXPAND_SZ) {
|
||||||
|
TCHAR * buf = (TCHAR *)malloc((*size) * sizeof(TCHAR));
|
||||||
|
memcpy(buf, rhs, (*size) * sizeof(TCHAR));
|
||||||
|
localSize = ExpandEnvironmentStrings(buf, rhs, *size);
|
||||||
|
free(buf);
|
||||||
|
if ( localSize > *size )
|
||||||
|
status = !ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
*size = localSize;
|
||||||
|
|
||||||
if ( hkSub )
|
if ( hkSub )
|
||||||
RegCloseKey( hkSub );
|
RegCloseKey( hkSub );
|
||||||
@ -112,7 +146,6 @@ DeleteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs)
|
|||||||
&hkSub,
|
&hkSub,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
DWORD dwType;
|
|
||||||
DWORD status = RegDeleteValue( hkSub, lhs );
|
DWORD status = RegDeleteValue( hkSub, lhs );
|
||||||
|
|
||||||
if ( hkSub )
|
if ( hkSub )
|
||||||
@ -385,7 +418,7 @@ void QueryDriveMapList_ReadSubmounts (PDRIVEMAPLIST pList)
|
|||||||
HKEY hkSubmounts;
|
HKEY hkSubmounts;
|
||||||
|
|
||||||
RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
RegCreateKeyEx( HKEY_LOCAL_MACHINE,
|
||||||
"SOFTWARE\\OpenAFS\\Client\\Submounts",
|
cszSECTION_SUBMOUNTS,
|
||||||
0,
|
0,
|
||||||
"AFS",
|
"AFS",
|
||||||
REG_OPTION_NON_VOLATILE,
|
REG_OPTION_NON_VOLATILE,
|
||||||
@ -414,11 +447,19 @@ void QueryDriveMapList_ReadSubmounts (PDRIVEMAPLIST pList)
|
|||||||
DWORD submountPathLen = MAX_PATH;
|
DWORD submountPathLen = MAX_PATH;
|
||||||
TCHAR submountName[MAX_PATH];
|
TCHAR submountName[MAX_PATH];
|
||||||
DWORD submountNameLen = MAX_PATH;
|
DWORD submountNameLen = MAX_PATH;
|
||||||
DWORD dwType;
|
DWORD dwType = 0;
|
||||||
|
|
||||||
RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
|
RegEnumValue( hkSubmounts, dwIndex, submountName, &submountNameLen, NULL,
|
||||||
&dwType, (LPBYTE)submountPath, &submountPathLen);
|
&dwType, (LPBYTE)submountPath, &submountPathLen);
|
||||||
|
|
||||||
|
if (dwType == REG_EXPAND_SZ) {
|
||||||
|
char buf[MAX_PATH];
|
||||||
|
StringCbCopyA(buf, MAX_PATH, submountPath);
|
||||||
|
submountPathLen = ExpandEnvironmentStrings(buf, submountPath, MAX_PATH);
|
||||||
|
if (submountPathLen > MAX_PATH)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SUBMOUNT Submount;
|
SUBMOUNT Submount;
|
||||||
memset (&Submount, 0x00, sizeof(SUBMOUNT));
|
memset (&Submount, 0x00, sizeof(SUBMOUNT));
|
||||||
lstrcpy (Submount.szSubmount, submountName);
|
lstrcpy (Submount.szSubmount, submountName);
|
||||||
@ -805,7 +846,7 @@ void AddSubMount (LPTSTR pszSubmount, LPTSTR pszMapping)
|
|||||||
if (!szRHS[0])
|
if (!szRHS[0])
|
||||||
lstrcpy (szRHS, TEXT("/"));
|
lstrcpy (szRHS, TEXT("/"));
|
||||||
|
|
||||||
WriteRegistryString(HKEY_LOCAL_MACHINE, cszSECTION_SUBMOUNTS, pszSubmount, szRHS);
|
WriteExpandedRegistryString(HKEY_LOCAL_MACHINE, cszSECTION_SUBMOUNTS, pszSubmount, szRHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -304,13 +304,13 @@ ObtainTokensFromUserIfNeeded(HWND hWnd)
|
|||||||
strcpy(aserver.name, "afs");
|
strcpy(aserver.name, "afs");
|
||||||
strcpy(aserver.cell, rootcell);
|
strcpy(aserver.cell, rootcell);
|
||||||
|
|
||||||
|
GetLocalTime (&stNow);
|
||||||
|
SystemTimeToFileTime (&stNow, &ftNow);
|
||||||
|
llNow = (((LONGLONG)ftNow.dwHighDateTime) << 32) + (LONGLONG)(ftNow.dwLowDateTime);
|
||||||
|
llNow /= c100ns1SECOND;
|
||||||
|
|
||||||
rc = ktc_GetToken(&aserver, &atoken, sizeof(atoken), &aclient);
|
rc = ktc_GetToken(&aserver, &atoken, sizeof(atoken), &aclient);
|
||||||
if ( rc == 0 ) {
|
if ( rc == 0 ) {
|
||||||
GetLocalTime (&stNow);
|
|
||||||
SystemTimeToFileTime (&stNow, &ftNow);
|
|
||||||
llNow = (((LONGLONG)ftNow.dwHighDateTime) << 32) + (LONGLONG)(ftNow.dwLowDateTime);
|
|
||||||
llNow /= c100ns1SECOND;
|
|
||||||
|
|
||||||
TimeToSystemTime (&stExpires, atoken.endTime);
|
TimeToSystemTime (&stExpires, atoken.endTime);
|
||||||
SystemTimeToFileTime (&stExpires, &ftExpires);
|
SystemTimeToFileTime (&stExpires, &ftExpires);
|
||||||
llExpires = (((LONGLONG)ftExpires.dwHighDateTime) << 32) + (LONGLONG)(ftExpires.dwLowDateTime);
|
llExpires = (((LONGLONG)ftExpires.dwHighDateTime) << 32) + (LONGLONG)(ftExpires.dwLowDateTime);
|
||||||
@ -371,14 +371,15 @@ ObtainTokensFromUserIfNeeded(HWND hWnd)
|
|||||||
KFW_AFS_renew_token_for_cell(rootcell);
|
KFW_AFS_renew_token_for_cell(rootcell);
|
||||||
|
|
||||||
rc = ktc_GetToken(&aserver, &atoken, sizeof(atoken), &aclient);
|
rc = ktc_GetToken(&aserver, &atoken, sizeof(atoken), &aclient);
|
||||||
|
if ( rc == 0 ) {
|
||||||
TimeToSystemTime (&stExpires, atoken.endTime);
|
TimeToSystemTime (&stExpires, atoken.endTime);
|
||||||
SystemTimeToFileTime (&stExpires, &ftExpires);
|
SystemTimeToFileTime (&stExpires, &ftExpires);
|
||||||
llExpires = (((LONGLONG)ftExpires.dwHighDateTime) << 32) + (LONGLONG)(ftExpires.dwLowDateTime);
|
llExpires = (((LONGLONG)ftExpires.dwHighDateTime) << 32) + (LONGLONG)(ftExpires.dwLowDateTime);
|
||||||
llExpires /= c100ns1SECOND;
|
llExpires /= c100ns1SECOND;
|
||||||
|
|
||||||
if (!rc && (llNow < llExpires))
|
if (llNow < llExpires)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(hWnd, WM_OBTAIN_TOKENS, FALSE, (long)rootcell);
|
SendMessage(hWnd, WM_OBTAIN_TOKENS, FALSE, (long)rootcell);
|
||||||
|
Loading…
Reference in New Issue
Block a user