/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
/* AFSIFS portions copyright (c) 2005
* the regents of the university of michigan
* all rights reserved
- *
+ *
* permission is granted to use, copy, create derivative works and
* redistribute this software and such derivative works for any purpose,
* so long as no fee is charged, and so long as the copyright notice
* michigan is not used in any advertising or publicity pertaining
* to the use or distribution of this software without specific, written
* prior authorization.
- *
+ *
* this software is provided as is, without representation from the
* university of michigan as to its fitness for any purpose, and without
* warranty by the university of michigan of any kind, either express
static TCHAR cszLANMANDEVICE[] = TEXT("\\Device\\LanmanRedirector\\");
-static BOOL
+static BOOL
WriteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs)
{
HKEY hkSub = NULL;
return (status == ERROR_SUCCESS);
}
-static BOOL
+static BOOL
WriteExpandedRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs)
{
HKEY hkSub = NULL;
return (status == ERROR_SUCCESS);
}
-static BOOL
+static BOOL
ReadRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs, LPTSTR rhs, DWORD * size)
{
HKEY hkSub = NULL;
return (status == ERROR_SUCCESS);
}
-static BOOL
+static BOOL
DeleteRegistryString(HKEY key, TCHAR * subkey, LPTSTR lhs)
{
HKEY hkSub = NULL;
{
HKEY hkSubmounts;
- RegCreateKeyEx( HKEY_LOCAL_MACHINE,
+ RegCreateKeyEx( HKEY_LOCAL_MACHINE,
cszSECTION_SUBMOUNTS,
- 0,
- "AFS",
+ 0,
+ "AFS",
REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_QUERY_VALUE,
- NULL,
+ NULL,
&hkSubmounts,
NULL );
HKEY hkMappings;
RegCreateKeyEx( HKEY_CURRENT_USER,
cszSECTION_MAPPINGS,
- 0,
- "AFS",
+ 0,
+ "AFS",
REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_QUERY_VALUE,
- NULL,
+ NULL,
&hkMappings,
NULL );
void WriteDriveMappings (PDRIVEMAPLIST pList)
{
HKEY hkMappings;
- RegCreateKeyEx( HKEY_CURRENT_USER,
+ RegCreateKeyEx( HKEY_CURRENT_USER,
cszSECTION_MAPPINGS,
- 0,
- "AFS",
+ 0,
+ "AFS",
REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_QUERY_VALUE|KEY_WRITE,
- NULL,
+ NULL,
&hkMappings,
NULL );
BOOL bIsGlobal = (RegQueryValueEx (hKey, szValueName, NULL, NULL, (PBYTE)szValue, &dwSize) == ERROR_SUCCESS);
RegCloseKey (hKey);
-
+
return bIsGlobal;
}
continue;
// Okay, we know that drive {chDrive} is mapped to afs path {szAfsPath}.
- // If this drive is a global afs drive, then reject it. Otherwise, look
- // at pList->aDriveMap, to see if this drive mapping is already in our
+ // If this drive is a global afs drive, then reject it. Otherwise, look
+ // at pList->aDriveMap, to see if this drive mapping is already in our
// list. If not, add it and set pfFoundNew.
//
if (DriveIsGlobalAfsDrive(chDrive))
continue;
-
+
size_t iDrive = chDrive - chDRIVE_A;
if (lstrcmpi (pList->aDriveMap[ iDrive ].szMapping, szAfsPath))
{
return FALSE;
LPTSTR pszSubmount = szMapping;
-
+
TCHAR szNetBiosName[32];
memset(szNetBiosName, '\0', sizeof(szNetBiosName));
GetClientNetbiosName(szNetBiosName);
*(pszSubmount) > '9')
return FALSE;
++pszSubmount;
-#else
+#else
if (IsWindows2000())
{
if (*(pszSubmount) != TEXT(';'))
return FALSE;
- } else
+ } else
--pszSubmount;
if (toupper(*(++pszSubmount)) != chDrive)
void SetBitLogonOption(BOOL set,DWORD value)
{
- RWLogonOption(FALSE,((set)?value | RWLogonOption(TRUE,0):RWLogonOption(TRUE,0) & ~value) );
+ RWLogonOption(FALSE,((set)?value | RWLogonOption(TRUE,0):RWLogonOption(TRUE,0) & ~value) );
}
DWORD RWLogonOption(BOOL read,DWORD value)
DWORD dwDisp;
DWORD LSPtype, LSPsize;
DWORD rval;
-
+
if (read)
{
rval=0;
RegCloseKey (hk);
}
return TRUE;
- }
+ }
}
void MapShareName(char *pszCmdLineA)
return TRUE;
}
dwOldState=SERVICE_RUNNING;
- if (RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY))
- return (DoMapShare() && GlobalMountDrive());
return GlobalMountDrive();
}
void TestAndDoUnMapShare()
{
- if (!RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY))
- return;
- DoUnMapShare(FALSE);
+ return;
}
-void DoUnMapShare(BOOL drivemap) //disconnect drivemap
+void DoUnMapShare(BOOL drivemap) //disconnect drivemap
{
TCHAR szMachine[MAX_PATH],szPath[MAX_PATH];
DWORD rc=28;
if (drivemap) {
DisMountDOSDrive(*lpnrLocal[i].lpLocalName);
DEBUG_EVENT1("AFS DriveUnMap","UnMap-Local=%x",res);
- }
+ }
} else {
DisMountDOSDriveFull(lpnrLocal[i].lpRemoteName);
DEBUG_EVENT1("AFS DriveUnMap","UnMap-Remote=%x",res);
if (strstr(_strlwr(lpnrLocal[i].lpRemoteName),szPath)==NULL)
continue; //only look at real afs mappings
CHAR * pSubmount=strrchr(lpnrLocal[i].lpRemoteName,'\\')+1;
- if (lstrcmpi(pSubmount,"all")==0)
+ if (lstrcmpi(pSubmount,"all")==0)
continue; // do not remove 'all'
for (DWORD j=0;j<List.cSubmounts;j++)
{
if ((List.aSubmounts[j].szSubmount[0]) &&
(lstrcmpi(List.aSubmounts[j].szSubmount,pSubmount)==0)
- )
+ )
{
- List.aSubmounts[j].fInUse=TRUE;
+ List.aSubmounts[j].fInUse=TRUE;
goto nextname;
}
}
DWORD cbUser=MAXRANDOMNAMELEN-1;
CHAR szUser[MAXRANDOMNAMELEN];
CHAR * pUser = NULL;
- if (WNetGetUser(szPath,(LPSTR)szUser,&cbUser)!=NO_ERROR) {
- if (RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY)) {
- if (!pUserName[0]) {
- GenRandomName(szUser,MAXRANDOMNAMELEN-1);
- pUser = szUser;
- } else {
- pUser = pUserName;
- }
- }
- } else {
+ if (WNetGetUser(szPath,(LPSTR)szUser,&cbUser)==NO_ERROR) {
if ((pUser=strchr(szUser,'\\'))!=NULL)
pUser++;
}
DWORD cbUser=MAXRANDOMNAMELEN-1;
CHAR szUser[MAXRANDOMNAMELEN];
CHAR * pUser = NULL;
- if (WNetGetUser(szPath,(LPSTR)szUser,&cbUser)!=NO_ERROR) {
- if (RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY)) {
- if (!pUserName[0]) {
- GenRandomName(szUser,MAXRANDOMNAMELEN-1);
- pUser = szUser;
- } else {
- pUser = pUserName;
- }
- }
- } else {
+ if (WNetGetUser(szPath,(LPSTR)szUser,&cbUser)==NO_ERROR) {
if ((pUser=strchr(szUser,'\\'))!=NULL)
pUser++;
}
continue;
BOOL fPersistent = List.aDriveMap[chDrive-chDRIVE_A].fPersistent;
- if (RWLogonOption(TRUE,LOGON_OPTION_HIGHSECURITY))
- fPersistent = FALSE;
DWORD res=MountDOSDrive(chDrive
,szSubmount
,fPersistent,pUser);
if (!GetComputerName(cm_HostName, &dwType))
return TRUE;
sprintf(szKeyName, "%s\\GlobalAutoMapper", AFSREG_CLT_SVC_PARAM_SUBKEY);
-
+
dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE,
&hKey);
if (dwResult != ERROR_SUCCESS)
return TRUE;
-
+
while (1) {
dwDriveSize = sizeof(szDriveToMapTo);
dwSubMountSize = sizeof(szSubMount);
- dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize,
+ dwResult = RegEnumValue(hKey, dwIndex++, szDriveToMapTo, &dwDriveSize,
0, &dwType, szSubMount, &dwSubMountSize);
if (dwResult != ERROR_MORE_DATA) {
if (dwResult != ERROR_SUCCESS) {
#ifdef AFSIFS
int pathCount, currPos, lastPos, x;
-
+
pathCount = 0;
pathCount = 0;