<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Index: openafs/src/ntbuild.bat
diff -c openafs/src/ntbuild.bat:1.14 openafs/src/ntbuild.bat:1.16
*** openafs/src/ntbuild.bat:1.14	Fri Feb 27 01:02:18 2004
--- openafs/src/ntbuild.bat	Mon Aug  9 00:20:12 2004
***************
*** 11,21 ****
  REM ########################################################################
  
  REM ########################################################################
- REM
- REM NOTE: You should run NTLANG.REG before attempting to build localized
- REM language files! Failure to do so will cause the resource compiler
- REM and message-catalog compiler to choke when they hit unknown code pages.
- REM
  REM NOTE: You will need to copy the NLS files into your windows\system32 
  REM directory prior to building non-english files.
  REM
--- 11,16 ----
***************
*** 35,41 ****
  REM ########################################################################
  REM Location of base folder where source lies, build directory
  REM e.g. AFSROOT\SRC is source directory of the build tree (8.3 short name)
! set AFSROOT=D:\Dev\AfsSorce\OpenAF~2.2
  
  REM ########################################################################
  REM NTMakefile required definitions:
--- 30,36 ----
  REM ########################################################################
  REM Location of base folder where source lies, build directory
  REM e.g. AFSROOT\SRC is source directory of the build tree (8.3 short name)
! set AFSROOT=C:\SRC\OpenAFS
  
  REM ########################################################################
  REM NTMakefile required definitions:
***************
*** 43,49 ****
  REM                  "1200" for VC6
  REM                  "1300" for VC7 (.NET)
  REM                  "1310" for .NET 2003
! set AFSVER_CL=1200
  
  REM Location of Microsoft Visual C++ development folder (8.3 short name)
  set MSVCDIR=c:\progra~1\micros~2\vc98
--- 38,45 ----
  REM                  "1200" for VC6
  REM                  "1300" for VC7 (.NET)
  REM                  "1310" for .NET 2003
! REM                  "1400" for VC8
! set AFSVER_CL=1310
  
  REM Location of Microsoft Visual C++ development folder (8.3 short name)
  set MSVCDIR=c:\progra~1\micros~2\vc98
***************
*** 106,117 ****
--- 102,115 ----
  set AFSDEV_BUILDTYPE=%AFSBLD_TYPE%
  
  set AFSDEV_INCLUDE=%MSSDKDIR%\include;%MSVCDIR%\include
+ IF "%AFSVER_CL%" == "1400" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include
  IF "%AFSVER_CL%" == "1310" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include
  IF "%AFSVER_CL%" == "1300" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atlmfc\include
  IF "%AFSVER_CL%" == "1200" set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%MSVCDIR%\atl\include;%MSVCDIR%\mfc\include
  set AFSDEV_INCLUDE=%AFSDEV_INCLUDE%;%NTDDKDIR%\include;%W9XDDKDIR%\include
  
  set AFSDEV_LIB=%MSSDKDIR%\lib;%MSVCDIR%\lib
+ IF "%AFSVER_CL%" == "1400" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\atlmfc\lib
  IF "%AFSVER_CL%" == "1310" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\atlmfc\lib
  IF "%AFSVER_CL%" == "1300" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\atlmfc\lib
  IF "%AFSVER_CL%" == "1200" set AFSDEV_LIB=%AFSDEV_LIB%;%MSVCDIR%\mfc\lib
Index: openafs/src/WINNT/afsd/NTMakefile
diff -c openafs/src/WINNT/afsd/NTMakefile:1.26 openafs/src/WINNT/afsd/NTMakefile:1.27
*** openafs/src/WINNT/afsd/NTMakefile:1.26	Thu Jul 22 18:15:47 2004
--- openafs/src/WINNT/afsd/NTMakefile	Thu Aug  5 12:31:34 2004
***************
*** 172,178 ****
      $(DESTDIR)\lib\afs\afsreg.lib
  
  $(CONF_DLLFILE): $(CONFOBJS) $(OUT)\libafsconf.res $(CONF_DLLLIBS)
! 	$(DLLGUILINK) -def:libafsconf.def dnsapi.lib
  	$(DLLPREP)
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
--- 172,178 ----
      $(DESTDIR)\lib\afs\afsreg.lib
  
  $(CONF_DLLFILE): $(CONFOBJS) $(OUT)\libafsconf.res $(CONF_DLLLIBS)
! 	$(DLLGUILINK) -def:libafsconf.def dnsapi.lib mpr.lib
  	$(DLLPREP)
  	$(COPY) $*.lib $(ILIBDIR)
  	$(DEL) $*.lib $*.exp
***************
*** 221,227 ****
      $(AFSKFWLIB)
  
  LOGON_DLLSDKLIBS =\
! 	dnsapi.lib \
  	advapi32.lib \
  	secur32.lib \
  	strsafe.lib \
--- 221,227 ----
      $(AFSKFWLIB)
  
  LOGON_DLLSDKLIBS =\
! 	dnsapi.lib mpr.lib \
  	advapi32.lib \
  	secur32.lib \
  	strsafe.lib \
***************
*** 251,257 ****
  	$(DESTDIR)\lib\libafsconf.lib
  
  $(LOG95_DLLFILE): $(LOG95_DLLOBJS) $(LOG95_DLLLIBS)
! 	$(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslog95.def dnsapi.lib
  	$(DLLPREP)
  	$(COPY) $*.lib $(DESTDIR)\lib
  	$(DEL) $*.lib $*.exp
--- 251,257 ----
  	$(DESTDIR)\lib\libafsconf.lib
  
  $(LOG95_DLLFILE): $(LOG95_DLLOBJS) $(LOG95_DLLLIBS)
! 	$(DLLGUILINK) $(LOGONLINKFLAGS) -def:afslog95.def dnsapi.lib mpr.lib
  	$(DLLPREP)
  	$(COPY) $*.lib $(DESTDIR)\lib
  	$(DEL) $*.lib $*.exp
***************
*** 318,334 ****
  
  # klog.exe
  $(EXEDIR)\klog.exe: $(OUT)\cklog.obj $(OUT)\klog.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  # tokens.exe
  $(EXEDIR)\tokens.exe: $(OUT)\ctokens.obj $(OUT)\tokens.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  # unlog.exe
  $(EXEDIR)\unlog.exe: $(OUT)\cunlog.obj $(OUT)\unlog.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  # afsd.exe
--- 318,334 ----
  
  # klog.exe
  $(EXEDIR)\klog.exe: $(OUT)\cklog.obj $(OUT)\klog.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  # tokens.exe
  $(EXEDIR)\tokens.exe: $(OUT)\ctokens.obj $(OUT)\tokens.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  # unlog.exe
  $(EXEDIR)\unlog.exe: $(OUT)\cunlog.obj $(OUT)\unlog.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  # afsd.exe
***************
*** 337,343 ****
  AFSD_SDKLIBS =\
  	largeint.lib \
  	netapi32.lib \
!     dnsapi.lib \
  	rpcrt4.lib \
  	user32.lib \
      Dbghelp.lib \
--- 337,343 ----
  AFSD_SDKLIBS =\
  	largeint.lib \
  	netapi32.lib \
!     dnsapi.lib mpr.lib \
  	rpcrt4.lib \
  	user32.lib \
      Dbghelp.lib \
***************
*** 369,380 ****
  
  # fs.exe
  $(EXEDIR)\fs.exe: $(FSOBJS) $(OUT)\fs.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  # symlink.exe
  $(EXEDIR)\symlink.exe: $(SLOBJS) $(OUT)\symlink.res  $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  # afsshare.exe
--- 369,380 ----
  
  # fs.exe
  $(EXEDIR)\fs.exe: $(FSOBJS) $(OUT)\fs.res $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  # symlink.exe
  $(EXEDIR)\symlink.exe: $(SLOBJS) $(OUT)\symlink.res  $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  # afsshare.exe
Index: openafs/src/WINNT/afsd/afsd_init.c
diff -c openafs/src/WINNT/afsd/afsd_init.c:1.37 openafs/src/WINNT/afsd/afsd_init.c:1.40.2.1
*** openafs/src/WINNT/afsd/afsd_init.c:1.37	Sun Jul 25 16:53:12 2004
--- openafs/src/WINNT/afsd/afsd_init.c	Mon Aug  9 16:57:11 2004
***************
*** 17,23 ****
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;winsock2.h&gt;
- #include &lt;strsafe.h&gt;
  
  #include &lt;osi.h&gt;
  #include "afsd.h"
--- 17,22 ----
***************
*** 29,34 ****
--- 28,34 ----
  #include "smb.h"
  #include "cm_rpc.h"
  #include "lanahelper.h"
+ #include &lt;strsafe.h&gt;
  #include "afsicf.h"
  
  extern int RXAFSCB_ExecuteRequest(struct rx_call *z_call);
***************
*** 69,75 ****
  char cm_HostName[200];
  long cm_HostAddr;
  
! char cm_NetbiosName[MAX_NB_NAME_LENGTH];
  
  char cm_CachePath[200];
  DWORD cm_CachePathLen;
--- 69,75 ----
  char cm_HostName[200];
  long cm_HostAddr;
  
! char cm_NetbiosName[MAX_NB_NAME_LENGTH] = "";
  
  char cm_CachePath[200];
  DWORD cm_CachePathLen;
***************
*** 100,107 ****
  int cm_dnsEnabled = 1;
  #endif
  
- char cm_NetBiosName[32];
- 
  extern initUpperCaseTable();
  void afsd_initUpperCaseTable() 
  {
--- 100,105 ----
***************
*** 369,374 ****
--- 367,373 ----
      long maxcpus;
  	long ltt, ltto;
      long rx_mtu, rx_nojumbo;
+     long virtualCache;
  	char rootCellName[256];
  	struct rx_service *serverp;
  	static struct rx_securityClass *nullServerSecurityClassp;
***************
*** 377,382 ****
--- 376,382 ----
  	char buf[200];
  	HKEY parmKey;
  	DWORD dummyLen;
+     DWORD regType;
  	long code;
  	/*int freelanceEnabled;*/
  	WSADATA WSAjunk;
***************
*** 587,604 ****
  		/* Don't log */
  	}
  
! 	dummyLen = sizeof(cm_CachePath);
! 	code = RegQueryValueEx(parmKey, "CachePath", NULL, NULL,
! 				cm_CachePath, &amp;dummyLen);
! 	if (code == ERROR_SUCCESS)
  		afsi_log("Cache path %s", cm_CachePath);
! 	else {
  		GetWindowsDirectory(cm_CachePath, sizeof(cm_CachePath));
  		cm_CachePath[2] = 0;	/* get drive letter only */
  		StringCbCatA(cm_CachePath, sizeof(cm_CachePath), "\\AFSCache");
  		afsi_log("Default cache path %s", cm_CachePath);
  	}
  
  	dummyLen = sizeof(traceOnPanic);
  	code = RegQueryValueEx(parmKey, "TrapOnPanic", NULL, NULL,
  				(BYTE *) &amp;traceOnPanic, &amp;dummyLen);
--- 587,623 ----
  		/* Don't log */
  	}
  
! 	dummyLen = sizeof(buf);
! 	code = RegQueryValueEx(parmKey, "CachePath", NULL, &amp;regType,
! 				buf, &amp;dummyLen);
!     if (code == ERROR_SUCCESS &amp;&amp; buf[0]) {
!         if(regType == REG_EXPAND_SZ) {
!             dummyLen = ExpandEnvironmentStrings(buf, cm_CachePath, sizeof(cm_CachePath));
!             if(dummyLen &gt; sizeof(cm_CachePath)) {
!                 afsi_log("Cache path [%s] longer than %d after expanding env strings", buf, sizeof(cm_CachePath));
!                 osi_panic("CachePath too long", __FILE__, __LINE__);
!             }
!         } else {
!             StringCbCopyA(cm_CachePath, sizeof(cm_CachePath), buf);
!         }
  		afsi_log("Cache path %s", cm_CachePath);
!     } else {
  		GetWindowsDirectory(cm_CachePath, sizeof(cm_CachePath));
  		cm_CachePath[2] = 0;	/* get drive letter only */
  		StringCbCatA(cm_CachePath, sizeof(cm_CachePath), "\\AFSCache");
  		afsi_log("Default cache path %s", cm_CachePath);
  	}
  
+     dummyLen = sizeof(virtualCache);
+     code = RegQueryValueEx(parmKey, "NonPersistentCaching", NULL, NULL,
+         &amp;virtualCache, &amp;dummyLen);
+     if (code == ERROR_SUCCESS &amp;&amp; virtualCache) {
+         buf_cacheType = CM_BUF_CACHETYPE_VIRTUAL;
+     } else {
+         buf_cacheType = CM_BUF_CACHETYPE_FILE;
+     }
+     afsi_log("Cache type is %s", ((buf_cacheType == CM_BUF_CACHETYPE_FILE)?"FILE":"VIRTUAL"));
+ 
  	dummyLen = sizeof(traceOnPanic);
  	code = RegQueryValueEx(parmKey, "TrapOnPanic", NULL, NULL,
  				(BYTE *) &amp;traceOnPanic, &amp;dummyLen);
***************
*** 677,697 ****
  	}
  #endif /* AFS_FREELANCE_CLIENT */
  
      dummyLen = sizeof(buf);
      code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL,
                             (BYTE *) &amp;buf, &amp;dummyLen);
      if (code == ERROR_SUCCESS) {
!         DWORD len = ExpandEnvironmentStrings(buf, cm_NetBiosName, MAX_NB_NAME_LENGTH);
          if ( len &gt; 0 &amp;&amp; len &lt;= MAX_NB_NAME_LENGTH ) {
!             afsi_log("Explicit NetBios name is used %s", cm_NetBiosName);
          } else {
              afsi_log("Unable to Expand Explicit NetBios name: %s", buf);
!             cm_NetBiosName[0] = 0;  /* turn it off */
          }
      }
      else {
!         cm_NetBiosName[0] = 0;   /* default off */
      }
  
      dummyLen = sizeof(smb_hideDotFiles);
      code = RegQueryValueEx(parmKey, "HideDotFiles", NULL, NULL,
--- 696,719 ----
  	}
  #endif /* AFS_FREELANCE_CLIENT */
  
+ #ifdef COMMENT
+     /* The netbios name is looked up in lana_GetUNCServerNameEx */
      dummyLen = sizeof(buf);
      code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL,
                             (BYTE *) &amp;buf, &amp;dummyLen);
      if (code == ERROR_SUCCESS) {
!         DWORD len = ExpandEnvironmentStrings(buf, cm_NetbiosName, MAX_NB_NAME_LENGTH);
          if ( len &gt; 0 &amp;&amp; len &lt;= MAX_NB_NAME_LENGTH ) {
!             afsi_log("Explicit NetBios name is used %s", cm_NetbiosName);
          } else {
              afsi_log("Unable to Expand Explicit NetBios name: %s", buf);
!             cm_NetbiosName[0] = 0;  /* turn it off */
          }
      }
      else {
!         cm_NetbiosName[0] = 0;   /* default off */
      }
+ #endif
  
      dummyLen = sizeof(smb_hideDotFiles);
      code = RegQueryValueEx(parmKey, "HideDotFiles", NULL, NULL,
Index: openafs/src/WINNT/afsd/afslogon.c
diff -c openafs/src/WINNT/afsd/afslogon.c:1.23 openafs/src/WINNT/afsd/afslogon.c:1.24.2.1
*** openafs/src/WINNT/afsd/afslogon.c:1.23	Mon Jul 26 19:14:42 2004
--- openafs/src/WINNT/afsd/afslogon.c	Mon Aug  9 23:46:24 2004
***************
*** 63,68 ****
--- 63,109 ----
  	va_end(marker);
  }
  
+ static HANDLE hInitMutex = NULL;
+ static BOOL bInit = FALSE;
+ 
+ BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved)
+ {
+ 	hDLL = dll;
+ 	switch (reason) {
+     case DLL_PROCESS_ATTACH:
+         /* Initialization Mutex */
+         hInitMutex = CreateMutex(NULL, FALSE, NULL);
+         break;
+ 
+     case DLL_PROCESS_DETACH:
+         CloseHandle(hInitMutex);
+         break;
+ 
+     case DLL_THREAD_ATTACH:
+     case DLL_THREAD_DETACH:
+     default:
+ 		/* Everything else succeeds but does nothing. */
+         break;
+ 	}
+ 
+ 	return TRUE;
+ }
+ 
+ void AfsLogonInit(void)
+ {
+     if ( bInit == FALSE ) {
+          if ( WaitForSingleObject( hInitMutex, INFINITE ) == WAIT_OBJECT_0 ) {
+              if ( bInit == FALSE ) {
+                  rx_Init(0);
+                  initAFSDirPath();
+                  ka_Init(0);
+                  bInit = TRUE;
+              }
+              ReleaseMutex(hInitMutex);
+          }
+     }
+ }
+ 
  CHAR *GenRandomName(CHAR *pbuf)
  {
  	int i;
***************
*** 139,166 ****
  	}
  }
  
- BOOLEAN APIENTRY DllEntryPoint(HANDLE dll, DWORD reason, PVOID reserved)
- {
- 	hDLL = dll;
- 	switch (reason) {
- 		case DLL_PROCESS_ATTACH:
- 			/* Initialize AFS libraries */
- 			rx_Init(0);
-             initAFSDirPath();
- 			ka_Init(0);
- 			break;
- 
- 		/* Everything else succeeds but does nothing. */
- 		case DLL_PROCESS_DETACH:
- 		case DLL_THREAD_ATTACH:
- 		case DLL_THREAD_DETACH:
- 		default:
- 			break;
- 	}
- 
- 	return TRUE;
- }
- 
  DWORD APIENTRY NPGetCaps(DWORD index)
  {
  	switch (index) {
--- 180,185 ----
***************
*** 551,556 ****
--- 570,578 ----
  	int retryInterval;
  	int sleepInterval;
  
+     /* Make sure the AFS Libraries are initialized */
+     AfsLogonInit();
+ 
      /* Initialize Logon Script to none */
  	*lpLogonScript=NULL;
      
***************
*** 772,777 ****
--- 794,802 ----
  	LPVOID StationHandle,
  	DWORD dwChangeInfo)
  {
+     /* Make sure the AFS Libraries are initialized */
+     AfsLogonInit();
+ 
  	DebugEvent0("AFS AfsLogon - NPPasswordChangeNotify");
  	return 0;
  }
***************
*** 815,820 ****
--- 840,848 ----
  	DWORD LSPtype, LSPsize;
  	HKEY NPKey;
  
+     /* Make sure the AFS Libraries are initialized */
+     AfsLogonInit();
+ 
      (void) RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_CLIENT_PARMS_KEY,
                          0, KEY_QUERY_VALUE, &amp;NPKey);
  	LSPsize=sizeof(TraceOption);
***************
*** 834,839 ****
--- 862,870 ----
      DWORD  retLen;
      HANDLE hToken;
  
+     /* Make sure the AFS Libraries are initialized */
+     AfsLogonInit();
+ 
      DebugEvent0("AFS_Logoff_Event - Starting");
  
      if (!GetTokenInformation(pInfo-&gt;hToken, TokenUser, NULL, 0, &amp;retLen))
***************
*** 853,859 ****
       */
      if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser-&gt;User.Sid, pInfo-&gt;Domain)) {
          WCHAR Domain[64]=L"";
!         GetLocalShortDomain(Domain);
          if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser-&gt;User.Sid, Domain))
              GetUserProfileDirectory(pInfo-&gt;hToken, profileDir, &amp;len);
      }
--- 884,890 ----
       */
      if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser-&gt;User.Sid, pInfo-&gt;Domain)) {
          WCHAR Domain[64]=L"";
!         GetLocalShortDomain(Domain, sizeof(Domain));
          if (QueryAdHomePathFromSid( profileDir, sizeof(profileDir), tokenUser-&gt;User.Sid, Domain))
              GetUserProfileDirectory(pInfo-&gt;hToken, profileDir, &amp;len);
      }
Index: openafs/src/WINNT/afsd/afslogon.h
diff -c openafs/src/WINNT/afsd/afslogon.h:1.4 openafs/src/WINNT/afsd/afslogon.h:1.5
*** openafs/src/WINNT/afsd/afslogon.h:1.4	Thu Jul 22 18:15:47 2004
--- openafs/src/WINNT/afsd/afslogon.h	Wed Aug  4 15:30:03 2004
***************
*** 120,126 ****
  DWORD GetFileCellName(char * path, char * cell, size_t cellLen);
  DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt);
  DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain);
! BOOL GetLocalShortDomain(PWSTR Domain);
  
  #ifdef __cplusplus
  }
--- 120,126 ----
  DWORD GetFileCellName(char * path, char * cell, size_t cellLen);
  DWORD GetAdHomePath(char * homePath, size_t homePathLen, PLUID lpLogonId, LogonOptions_t * opt);
  DWORD QueryAdHomePathFromSid(char * homePath, size_t homePathLen, PSID psid, PWSTR domain);
! BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain);
  
  #ifdef __cplusplus
  }
Index: openafs/src/WINNT/afsd/cm_buf.c
diff -c openafs/src/WINNT/afsd/cm_buf.c:1.12 openafs/src/WINNT/afsd/cm_buf.c:1.13
*** openafs/src/WINNT/afsd/cm_buf.c:1.12	Sun May 30 10:39:05 2004
--- openafs/src/WINNT/afsd/cm_buf.c	Thu Jul 29 10:34:21 2004
***************
*** 75,80 ****
--- 75,81 ----
  long buf_nOrigBuffers;
  long buf_bufferSize = CM_BUF_SIZE;
  long buf_hashSize = CM_BUF_HASHSIZE;
+ int buf_cacheType = CM_BUF_CACHETYPE_FILE;
  
  #ifndef DJGPP
  static
***************
*** 295,300 ****
--- 296,302 ----
  		sectorSize = 1;
  
  #ifndef DJGPP
+         if(buf_cacheType == CM_BUF_CACHETYPE_FILE) {
  		/* Reserve buffer space by mapping cache file */
  		psa = CreateCacheFileSA();
  		hf = CreateFile(cm_CachePath,
***************
*** 309,314 ****
--- 311,319 ----
  			return CM_ERROR_INVAL;
  		}
  		FreeCacheFileSA(psa);
+         } else { /* buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL */
+             hf = INVALID_HANDLE_VALUE;
+         }
  		CacheHandle = hf;
  		hm = CreateFileMapping(hf,
  			NULL,
***************
*** 327,333 ****
  			0, 0,
  			buf_nbuffers * buf_bufferSize);
  		if (data == NULL) {
! 			CloseHandle(hf);
  			CloseHandle(hm);
  			return CM_ERROR_INVAL;
  		}
--- 332,338 ----
  			0, 0,
  			buf_nbuffers * buf_bufferSize);
  		if (data == NULL) {
! 			if(hf != INVALID_HANDLE_VALUE) CloseHandle(hf);
  			CloseHandle(hm);
  			return CM_ERROR_INVAL;
  		}
***************
*** 404,409 ****
--- 409,423 ----
      afsi_log("%d buffers being added to the existing cache of size %d",
                nbuffers, buf_nbuffers);
  
+     if (buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL) {
+         /* The size of a virtual cache cannot be changed after it has
+          * been created.  Subsequent calls to MapViewofFile() with
+          * an existing mapping object name would not allow the 
+          * object to be resized.  Return failure immediately.
+ 	 */
+         return CM_ERROR_INVAL;
+     }
+ 
  	/*
  	 * Cache file mapping constrained by
  	 * system allocation granularity;
Index: openafs/src/WINNT/afsd/cm_buf.h
diff -c openafs/src/WINNT/afsd/cm_buf.h:1.3 openafs/src/WINNT/afsd/cm_buf.h:1.4
*** openafs/src/WINNT/afsd/cm_buf.h:1.3	Mon Apr 30 02:48:03 2001
--- openafs/src/WINNT/afsd/cm_buf.h	Thu Jul 29 10:34:21 2004
***************
*** 32,37 ****
--- 32,42 ----
  #define CM_BUF_HASHSIZE	1024
  extern long buf_hashSize;
  
+ /* cache type */
+ #define CM_BUF_CACHETYPE_FILE 1
+ #define CM_BUF_CACHETYPE_VIRTUAL 2
+ extern int buf_cacheType;
+ 
  /* force it to be signed so that mod comes out positive or 0 */
  #define BUF_HASH(fidp,offsetp) ((((fidp)-&gt;vnode+((fidp)-&gt;unique &lt;&lt; 5)	\
  				+(fidp)-&gt;volume+(fidp)-&gt;cell		\
Index: openafs/src/WINNT/afsd/cm_callback.c
diff -c openafs/src/WINNT/afsd/cm_callback.c:1.15 openafs/src/WINNT/afsd/cm_callback.c:1.20
*** openafs/src/WINNT/afsd/cm_callback.c:1.15	Mon Jul 26 15:08:42 2004
--- openafs/src/WINNT/afsd/cm_callback.c	Tue Aug  3 16:10:36 2004
***************
*** 73,78 ****
--- 73,82 ----
  	cm_racingRevokes_t *rp;
  
  	lock_ObtainWrite(&amp;cm_callbackLock);
+ 
+     osi_Log3(afsd_logp, "RecordRacingRevoke Volume %d Flags %lX activeCalls %d",
+              fidp-&gt;volume, cancelFlags, cm_activeCallbackGrantingCalls);
+ 
  	if (cm_activeCallbackGrantingCalls &gt; 0) {
  		rp = malloc(sizeof(*rp));
  	        memset(rp, 0, sizeof(*rp));
***************
*** 89,94 ****
--- 93,101 ----
   */
  void cm_CallbackNotifyChange(cm_scache_t *scp)
  {
+     osi_Log2(afsd_logp, "CallbackNotifyChange FileType %d Flags %lX",
+               scp-&gt;fileType, scp-&gt;flags);
+ 
  	if (scp-&gt;fileType == CM_SCACHETYPE_DIRECTORY) {
  		if (scp-&gt;flags &amp; CM_SCACHEFLAG_ANYWATCH)
  			smb_NotifyChange(0,
***************
*** 134,140 ****
          tfid.unique = fidp-&gt;Unique;
          hash = CM_SCACHE_HASH(&amp;tfid);
  
! 	osi_Log3(afsd_logp, "Revoke callback vol %d vn %d un %d",
  		 fidp-&gt;Volume, fidp-&gt;Vnode, fidp-&gt;Unique);
          
  	/* do this first, so that if we're executing a callback granting call
--- 141,147 ----
          tfid.unique = fidp-&gt;Unique;
          hash = CM_SCACHE_HASH(&amp;tfid);
  
!     osi_Log3(afsd_logp, "RevokeCallback vol %d vn %d un %d",
  		 fidp-&gt;Volume, fidp-&gt;Vnode, fidp-&gt;Unique);
          
  	/* do this first, so that if we're executing a callback granting call
***************
*** 154,160 ****
                          scp-&gt;fid.unique == tfid.unique) {
  			scp-&gt;refCount++;
  			lock_ReleaseWrite(&amp;cm_scacheLock);
! 			osi_Log1(afsd_logp, "Revoke scp %x", scp);
                          lock_ObtainMutex(&amp;scp-&gt;mx);
  			cm_DiscardSCache(scp);
                          lock_ReleaseMutex(&amp;scp-&gt;mx);
--- 161,167 ----
                          scp-&gt;fid.unique == tfid.unique) {
  			scp-&gt;refCount++;
  			lock_ReleaseWrite(&amp;cm_scacheLock);
!             osi_Log1(afsd_logp, "Discarding SCache scp %x", scp);
                          lock_ObtainMutex(&amp;scp-&gt;mx);
  			cm_DiscardSCache(scp);
                          lock_ReleaseMutex(&amp;scp-&gt;mx);
***************
*** 177,182 ****
--- 184,191 ----
          cm_scache_t *scp;
          cm_fid_t tfid;
  
+     osi_Log1(afsd_logp, "RevokeVolumeCallback %d", fidp-&gt;Volume);
+ 
  	/* do this first, so that if we're executing a callback granting call
           * at this moment, we kill it before it can be merged in.  Otherwise,
           * it could complete while we're doing the scan below, and get missed
***************
*** 186,192 ****
          tfid.volume = fidp-&gt;Volume;
          cm_RecordRacingRevoke(&amp;tfid, CM_RACINGFLAG_CANCELVOL);
  
- 	osi_Log1(afsd_logp, "Revoke Volume %d", fidp-&gt;Volume);
  
          lock_ObtainWrite(&amp;cm_scacheLock);
  	for(hash = 0; hash &lt; cm_hashTableSize; hash++) {
--- 195,200 ----
***************
*** 195,200 ****
--- 203,209 ----
  				scp-&gt;refCount++;
  	                        lock_ReleaseWrite(&amp;cm_scacheLock);
  	                        lock_ObtainMutex(&amp;scp-&gt;mx);
+                 osi_Log1(afsd_logp, "Discarding SCache scp %x", scp);
  				cm_DiscardSCache(scp);
  				lock_ReleaseMutex(&amp;scp-&gt;mx);
  				cm_CallbackNotifyChange(scp);
***************
*** 215,227 ****
          int i;
          AFSFid *tfidp;
          
          for(i=0; i &lt; (long) fidsArrayp-&gt;AFSCBFids_len; i++) {
  		tfidp = &amp;fidsArrayp-&gt;AFSCBFids_val[i];
                  
!                 if (tfidp-&gt;Volume == 0) continue;	/* means don't do anything */
                  else if (tfidp-&gt;Vnode == 0)
                  	cm_RevokeVolumeCallback(callp, tfidp);
! 		else cm_RevokeCallback(callp, tfidp);
          }
  
  	return 0;
--- 224,240 ----
          int i;
          AFSFid *tfidp;
          
+     osi_Log0(afsd_logp, "SRXAFSCB_CallBack");
+ 
          for(i=0; i &lt; (long) fidsArrayp-&gt;AFSCBFids_len; i++) {
  		tfidp = &amp;fidsArrayp-&gt;AFSCBFids_val[i];
                  
!         if (tfidp-&gt;Volume == 0)
!             continue;   /* means don't do anything */
                  else if (tfidp-&gt;Vnode == 0)
                  	cm_RevokeVolumeCallback(callp, tfidp);
!         else
!             cm_RevokeCallback(callp, tfidp);
          }
  
  	return 0;
***************
*** 239,244 ****
--- 252,259 ----
      int hash;
      int discarded;
  
+     osi_Log0(afsd_logp, "SRXAFSCB_InitCallBackState");
+ 
      if ((rx_ConnectionOf(callp)) &amp;&amp; (rx_PeerOf(rx_ConnectionOf(callp)))) {
  	taddr.sin_family = AF_INET;
  	taddr.sin_addr.s_addr = rx_HostOf(rx_PeerOf(rx_ConnectionOf(callp)));
***************
*** 281,286 ****
--- 296,302 ----
  			if (scp-&gt;cbServerp != NULL) {
  				/* we have a callback, now decide if we should clear it */
  				if (scp-&gt;cbServerp == tsp || tsp == NULL) {
+                         osi_Log1(afsd_logp, "Discarding SCache scp %x", scp);
  					cm_DiscardSCache(scp);
  					discarded = 1;
  				}
***************
*** 305,310 ****
--- 321,327 ----
  /* just returns if we're up */
  SRXAFSCB_Probe(struct rx_call *callp)
  {
+     osi_Log0(afsd_logp, "SRXAFSCB_Probe - not implemented");
  	return 0;
  }
  
***************
*** 312,317 ****
--- 329,335 ----
  SRXAFSCB_GetCE64(struct rx_call *callp, long index, AFSDBCacheEntry *cep)
  {
      /* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_GetCE64 - not implemented");
      return RXGEN_OPCODE;
  }
  
***************
*** 319,324 ****
--- 337,343 ----
  SRXAFSCB_GetLock(struct rx_call *callp, long index, AFSDBLock *lockp)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_GetLock - not implemented");
  	return RXGEN_OPCODE;
  }
  
***************
*** 326,331 ****
--- 345,351 ----
  SRXAFSCB_GetCE(struct rx_call *callp, long index, AFSDBCacheEntry *cep)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_GetCE - not implemented");
  	return RXGEN_OPCODE;
  }
  
***************
*** 333,338 ****
--- 353,359 ----
  SRXAFSCB_XStatsVersion(struct rx_call *callp, long *vp)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_XStatsVersion - not implemented");
  	*vp = -1;
  	return RXGEN_OPCODE;
  }
***************
*** 342,347 ****
--- 363,369 ----
  	AFSCB_CollData *datap)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_GetXStats - not implemented");
  	return RXGEN_OPCODE;
  }
  
***************
*** 349,354 ****
--- 371,377 ----
  SRXAFSCB_InitCallBackState2(struct rx_call *callp, struct interfaceAddr* addr)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_InitCallBackState2 - not implemented");
  	return RXGEN_OPCODE;
  }
  
***************
*** 356,361 ****
--- 379,385 ----
  SRXAFSCB_WhoAreYou(struct rx_call *callp, struct interfaceAddr* addr)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_WhoAreYou - not implemented");
  	return RXGEN_OPCODE;
  }
  
***************
*** 363,368 ****
--- 387,393 ----
  SRXAFSCB_InitCallBackState3(struct rx_call *callp, afsUUID* serverUuid)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_InitCallBackState3 - not implemented");
  	return RXGEN_OPCODE;
  }
  
***************
*** 370,375 ****
--- 395,401 ----
  SRXAFSCB_ProbeUuid(struct rx_call *callp, afsUUID* clientUuid)
  {
  	/* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_ProbeUuid - not implemented");
  	return RXGEN_OPCODE;
  }
  
***************
*** 401,406 ****
--- 427,434 ----
      afs_int32 *a_srvr_addr,
      afs_int32 *a_srvr_rank)
  {
+     osi_Log0(afsd_logp, "SRXAFSCB_GetServerPrefs - not implemented");
+ 
      *a_srvr_addr = 0xffffffff;
      *a_srvr_rank = 0xffffffff;
      return 0;
***************
*** 436,441 ****
--- 464,471 ----
  {
      char *t_name;
  
+     osi_Log0(afsd_logp, "SRXAFSCB_GetCellServDB - not implemented");
+ 
      t_name = (char *)malloc(AFSNAMEMAX);
      t_name[0] = '\0';
      *a_name = t_name;
***************
*** 469,474 ****
--- 499,506 ----
  {
      char *t_name;
  
+     osi_Log0(afsd_logp, "SRXAFSCB_GetLocalCell");
+ 
      if (cm_rootCellp) {
  	t_name = (char *)malloc(strlen(cm_rootCellp-&gt;namep)+1);
          strcpy(t_name, cm_rootCellp-&gt;namep);
***************
*** 554,559 ****
--- 586,593 ----
      size_t allocsize;
      extern cm_initparams_v1 cm_initParams;
  
+     osi_Log0(afsd_logp, "SRXAFSCB_GetCacheConfig - version 1 only");
+ 
      /*
       * Currently only support version 1
       */
***************
*** 616,622 ****
--- 650,658 ----
  	    } else if (fdc==2 &amp;&amp; !fgc) { 	// we're in good shape
  		if (cm_getLocalMountPointChange()) {	// check for changes
  		    cm_clearLocalMountPointChange(); // clear the changefile
+             lock_ReleaseMutex(&amp;scp-&gt;mx);      // this is re-locked in reInitLocalMountPoints
  		    cm_reInitLocalMountPoints();	// start reinit
+             lock_ObtainMutex(&amp;scp-&gt;mx);      // now get the lock back 
  		    return 0;
  		}
  		return 1;			// no change
***************
*** 703,710 ****
                   */
                  if (scp &amp;&amp; cbrp-&gt;callbackCount != cm_callbackCount
                         	&amp;&amp; revp-&gt;callbackCount &gt; cbrp-&gt;callbackCount
!                        	&amp;&amp; (
!                         	(scp-&gt;fid.volume == revp-&gt;fid.volume &amp;&amp;
                                   scp-&gt;fid.vnode == revp-&gt;fid.vnode &amp;&amp;
                                   scp-&gt;fid.unique == revp-&gt;fid.unique)
                              ||
--- 739,745 ----
                   */
                  if (scp &amp;&amp; cbrp-&gt;callbackCount != cm_callbackCount
                         	&amp;&amp; revp-&gt;callbackCount &gt; cbrp-&gt;callbackCount
!              &amp;&amp; (( scp-&gt;fid.volume == revp-&gt;fid.volume &amp;&amp;
                                   scp-&gt;fid.vnode == revp-&gt;fid.vnode &amp;&amp;
                                   scp-&gt;fid.unique == revp-&gt;fid.unique)
                              ||
***************
*** 753,793 ****
      long sflags;
      cm_fid_t sfid;
  
  #ifdef AFS_FREELANCE_CLIENT
- 	// yj
  	// The case where a callback is needed on /afs is handled
  	// specially. We need to fetch the status by calling
  	// cm_MergeStatus and mark that cm_fakeDirCallback is 2
! 	if (cm_freelanceEnabled &amp;&amp;
!         scp-&gt;fid.cell==AFS_FAKE_ROOT_CELL_ID &amp;&amp;
! 		scp-&gt;fid.volume==AFS_FAKE_ROOT_VOL_ID &amp;&amp;
! 		scp-&gt;fid.unique==0x1 &amp;&amp;
! 		scp-&gt;fid.vnode==0x1) {
! 		// Start by indicating that we're in the process
! 		// of fetching the callback
! 
!         lock_ObtainMutex(&amp;cm_Freelance_Lock);
! 		cm_fakeGettingCallback = 1;
! 		lock_ReleaseMutex(&amp;cm_Freelance_Lock);
! 
! 		// Fetch the status info 
! 		cm_MergeStatus(scp, &amp;afsStatus, &amp;volSync, userp, 0);
! 
! 		// Indicate that the callback is not done
! 		lock_ObtainMutex(&amp;cm_Freelance_Lock);
! 		cm_fakeDirCallback = 2;
! 		// Indicate that we're no longer fetching the callback
! 		cm_fakeGettingCallback = 0;
! 		lock_ReleaseMutex(&amp;cm_Freelance_Lock);
  
! 		return 0;
! 	}
  
! 	if (scp-&gt;fid.cell==0x1 &amp;&amp; scp-&gt;fid.volume==AFS_FAKE_ROOT_VOL_ID) {
! 		osi_Log0(afsd_logp,"cm_getcallback should NEVER EVER get here... ");
! 	}
! 	// yj: end of getcallback modifications  ---------------
! 		
  #endif /* AFS_FREELANCE_CLIENT */
  	
  	mustCall = (flags &amp; 1);
--- 788,828 ----
      long sflags;
      cm_fid_t sfid;
  
+     osi_Log2(afsd_logp, "GetCallback scp %x flags %lX", scp, flags);
+ 
  #ifdef AFS_FREELANCE_CLIENT
  	// The case where a callback is needed on /afs is handled
  	// specially. We need to fetch the status by calling
  	// cm_MergeStatus and mark that cm_fakeDirCallback is 2
! 	if (cm_freelanceEnabled) {
!         if (scp-&gt;fid.cell==AFS_FAKE_ROOT_CELL_ID &amp;&amp;
!              scp-&gt;fid.volume==AFS_FAKE_ROOT_VOL_ID &amp;&amp;
!              scp-&gt;fid.unique==0x1 &amp;&amp;
!              scp-&gt;fid.vnode==0x1) {
!             // Start by indicating that we're in the process
!             // of fetching the callback
! 
!             lock_ObtainMutex(&amp;cm_Freelance_Lock);
!             cm_fakeGettingCallback = 1;
!             lock_ReleaseMutex(&amp;cm_Freelance_Lock);
  
!             // Fetch the status info 
!             cm_MergeStatus(scp, &amp;afsStatus, &amp;volSync, userp, 0);
  
!             // Indicate that the callback is not done
!             lock_ObtainMutex(&amp;cm_Freelance_Lock);
!             cm_fakeDirCallback = 2;
!             // Indicate that we're no longer fetching the callback
!             cm_fakeGettingCallback = 0;
!             lock_ReleaseMutex(&amp;cm_Freelance_Lock);
! 
!             return 0;
!         }
! 
!         if (scp-&gt;fid.cell==AFS_FAKE_ROOT_CELL_ID &amp;&amp; scp-&gt;fid.volume==AFS_FAKE_ROOT_VOL_ID) {
!             osi_Log0(afsd_logp,"cm_getcallback should NEVER EVER get here... ");
!         }
!     }
  #endif /* AFS_FREELANCE_CLIENT */
  	
  	mustCall = (flags &amp; 1);
***************
*** 814,820 ****
              code = RXAFS_FetchStatus(connp-&gt;callp, &amp;tfid,
                                       &amp;afsStatus, &amp;callback, &amp;volSync);
  
! 		} while (cm_Analyze(connp, userp, reqp, &amp;sfid, &amp;volSync,
                              &amp;cbr, code));
          code = cm_MapRPCError(code, reqp);
  		osi_Log0(afsd_logp, "CALL FetchStatus DONE");
--- 849,855 ----
              code = RXAFS_FetchStatus(connp-&gt;callp, &amp;tfid,
                                       &amp;afsStatus, &amp;callback, &amp;volSync);
  
! 		} while (cm_Analyze(connp, userp, reqp, &amp;sfid, &amp;volSync, NULL,
                              &amp;cbr, code));
          code = cm_MapRPCError(code, reqp);
  		osi_Log0(afsd_logp, "CALL FetchStatus DONE");
***************
*** 840,845 ****
--- 875,882 ----
          cm_scache_t *scp;
          long now;
          
+     osi_Log0(afsd_logp, "CheckCBExpiration");
+ 
  	now = osi_Time();
  	lock_ObtainWrite(&amp;cm_scacheLock);
          for(i=0; i&lt;cm_hashTableSize; i++) {
***************
*** 848,853 ****
--- 885,891 ----
  			lock_ReleaseWrite(&amp;cm_scacheLock);
  			lock_ObtainMutex(&amp;scp-&gt;mx);
  			if (scp-&gt;cbServerp &amp;&amp; now &gt; scp-&gt;cbExpires) {
+                 osi_Log1(afsd_logp, "Discarding SCache scp %x", scp);
  				cm_DiscardSCache(scp);
                          }
  			lock_ReleaseMutex(&amp;scp-&gt;mx);
***************
*** 863,868 ****
--- 901,907 ----
  			  char **a_name, serverList *a_hosts)
  {
      /* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_GetCellByNum - not implemented");
      return RXGEN_OPCODE;
  }
  
***************
*** 871,875 ****
--- 910,915 ----
                            char **a_name, serverList *a_hosts)
  {
      /* XXXX */
+     osi_Log0(afsd_logp, "SRXAFSCB_TellMeAboutYourself - not implemented");
      return RXGEN_OPCODE;
  }
Index: openafs/src/WINNT/afsd/cm_cell.c
diff -c openafs/src/WINNT/afsd/cm_cell.c:1.12 openafs/src/WINNT/afsd/cm_cell.c:1.14
*** openafs/src/WINNT/afsd/cm_cell.c:1.12	Mon Jul 19 18:40:12 2004
--- openafs/src/WINNT/afsd/cm_cell.c	Wed Aug  4 11:52:56 2004
***************
*** 45,56 ****
  			tsp-&gt;cellp = cellp;
  	}
  	else
!         	tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp);
  
  	/* Insert the vlserver into a sorted list, sorted by server rank */
  	tsrp = cm_NewServerRef(tsp);
  	cm_InsertServerList(&amp;cellp-&gt;vlServersp, tsrp);
! 
  	return 0;
  }
  
--- 45,59 ----
  			tsp-&gt;cellp = cellp;
  	}
  	else
!         tsp = cm_NewServer(addrp, CM_SERVER_VLDB, cellp);
  
  	/* Insert the vlserver into a sorted list, sorted by server rank */
  	tsrp = cm_NewServerRef(tsp);
  	cm_InsertServerList(&amp;cellp-&gt;vlServersp, tsrp);
!     /* drop the allocation reference */
!     lock_ObtainWrite(&amp;cm_serverLock);
!     tsrp-&gt;refCount--;
!     lock_ReleaseWrite(&amp;cm_serverLock);
  	return 0;
  }
  
***************
*** 94,101 ****
--- 97,106 ----
          else {
              dns_expired = 1;
              /* must empty cp-&gt;vlServersp */
+             lock_ObtainWrite(&amp;cp-&gt;mx);
              cm_FreeServerList(&amp;cp-&gt;vlServersp);
              cp-&gt;vlServersp = NULL;
+             lock_ReleaseWrite(&amp;cp-&gt;mx);
          }
  
          code = cm_SearchCellFile(namep, fullname, cm_AddCellProc, cp);
Index: openafs/src/WINNT/afsd/cm_cell.h
diff -c openafs/src/WINNT/afsd/cm_cell.h:1.5 openafs/src/WINNT/afsd/cm_cell.h:1.6
*** openafs/src/WINNT/afsd/cm_cell.h:1.5	Sat Jun  5 02:02:39 2004
--- openafs/src/WINNT/afsd/cm_cell.h	Sat Jul 31 20:16:37 2004
***************
*** 17,23 ****
  	long cellID;			/* cell ID */
  	struct cm_cell *nextp;		/* locked by cm_cellLock */
          char *namep;			/* cell name; never changes */
!         struct cm_serverRef *vlServersp;	/* locked by cm_serverLock */
          osi_mutex_t mx;			/* mutex locking fields (flags) */
          long flags;			/* locked by mx */
          long timeout;                   /* if dns, time at which the server addrs expire */
--- 17,23 ----
  	long cellID;			/* cell ID */
  	struct cm_cell *nextp;		/* locked by cm_cellLock */
          char *namep;			/* cell name; never changes */
!         cm_serverRef_t *vlServersp;     /* locked by cm_serverLock */
          osi_mutex_t mx;			/* mutex locking fields (flags) */
          long flags;			/* locked by mx */
          long timeout;                   /* if dns, time at which the server addrs expire */
Index: openafs/src/WINNT/afsd/cm_config.h
diff -c openafs/src/WINNT/afsd/cm_config.h:1.5 openafs/src/WINNT/afsd/cm_config.h:1.6
*** openafs/src/WINNT/afsd/cm_config.h:1.5	Wed Jul 21 10:06:11 2004
--- openafs/src/WINNT/afsd/cm_config.h	Tue Aug  3 13:27:52 2004
***************
*** 13,21 ****
  #define CM_CONFIGDEFAULT_CACHESIZE	20480
  #define CM_CONFIGDEFAULT_BLOCKSIZE	4096
  #define CM_CONFIGDEFAULT_STATS		1000
! #define CM_CONFIGDEFAULT_CHUNKSIZE	15
  #define CM_CONFIGDEFAULT_DAEMONS	2
! #define CM_CONFIGDEFAULT_SVTHREADS	4
  #define CM_CONFIGDEFAULT_TRACEBUFSIZE	5000
  
  #ifndef __CM_CONFIG_INTERFACES_ONLY__
--- 13,21 ----
  #define CM_CONFIGDEFAULT_CACHESIZE	20480
  #define CM_CONFIGDEFAULT_BLOCKSIZE	4096
  #define CM_CONFIGDEFAULT_STATS		1000
! #define CM_CONFIGDEFAULT_CHUNKSIZE	17
  #define CM_CONFIGDEFAULT_DAEMONS	2
! #define CM_CONFIGDEFAULT_SVTHREADS	25
  #define CM_CONFIGDEFAULT_TRACEBUFSIZE	5000
  
  #ifndef __CM_CONFIG_INTERFACES_ONLY__
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.20 openafs/src/WINNT/afsd/cm_conn.c:1.25
*** openafs/src/WINNT/afsd/cm_conn.c:1.20	Sun Jul 25 22:48:47 2004
--- openafs/src/WINNT/afsd/cm_conn.c	Wed Aug  4 11:52:56 2004
***************
*** 97,132 ****
   
  }
  
! long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp,
! 	struct cm_req *reqp, cm_serverRef_t **serverspp)
  {
  	long code;
!         cm_volume_t *volp = NULL;
!         cm_serverRef_t *serversp = NULL;
!         cm_cell_t *cellp = NULL;
  
!         if (!fidp) {
! 		*serverspp = NULL;
  		return 0;
  	}
  
  	cellp = cm_FindCellByID(fidp-&gt;cell);
!         if (!cellp) return CM_ERROR_NOSUCHCELL;
  
!         code = cm_GetVolumeByID(cellp, fidp-&gt;volume, userp, reqp, &amp;volp);
!         if (code) return code;
!         
! 	if (fidp-&gt;volume == volp-&gt;rwID)
!         	serversp = volp-&gt;rwServersp;
! 	else if (fidp-&gt;volume == volp-&gt;roID)
!         	serversp = volp-&gt;roServersp;
! 	else if (fidp-&gt;volume == volp-&gt;bkID)
!         	serversp = volp-&gt;bkServersp;
! 	else
! 		serversp = NULL;
  
!         cm_PutVolume(volp);
! 	*serverspp = serversp;
  	return 0;
  }
  
--- 97,123 ----
   
  }
  
! static long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp,
! 	struct cm_req *reqp, cm_serverRef_t ***serversppp)
  {
  	long code;
!     cm_volume_t *volp = NULL;
!     cm_cell_t *cellp = NULL;
  
!     if (!fidp) {
! 		*serversppp = NULL;
  		return 0;
  	}
  
  	cellp = cm_FindCellByID(fidp-&gt;cell);
!     if (!cellp) return CM_ERROR_NOSUCHCELL;
  
!     code = cm_GetVolumeByID(cellp, fidp-&gt;volume, userp, reqp, &amp;volp);
!     if (code) return code;
!     
!     *serversppp = cm_GetVolServers(volp, fidp-&gt;volume);
  
!     cm_PutVolume(volp);
  	return 0;
  }
  
***************
*** 148,161 ****
   */
  int
  cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
! 	struct cm_fid *fidp,
! 	AFSVolSync *volSyncp, cm_callbackRequest_t *cbrp, long errorCode)
  {
  	cm_server_t *serverp;
! 	cm_serverRef_t *serversp, *tsrp;
  	cm_ucell_t *ucellp;
!         int retry = 0;
  	int dead_session;
          
  	osi_Log2(afsd_logp, "cm_Analyze connp 0x%x, code %d",
  		 (long) connp, errorCode);
--- 139,157 ----
   */
  int
  cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
! 	struct cm_fid *fidp, 
! 	AFSVolSync *volSyncp, 
! 	cm_serverRef_t * serversp,
! 	cm_callbackRequest_t *cbrp, long errorCode)
  {
  	cm_server_t *serverp;
!     cm_serverRef_t **serverspp = 0;
! 	cm_serverRef_t *tsrp;
  	cm_ucell_t *ucellp;
!     int retry = 0;
!     int free_svr_list = 0;
  	int dead_session;
+     long timeUsed, timeLeft;
          
  	osi_Log2(afsd_logp, "cm_Analyze connp 0x%x, code %d",
  		 (long) connp, errorCode);
***************
*** 167,183 ****
  		serverp = connp-&gt;serverp;
  
  	/* Update callback pointer */
!         if (cbrp &amp;&amp; errorCode == 0) cbrp-&gt;serverp = connp-&gt;serverp;
  
  	/* If not allowed to retry, don't */
  	if (reqp-&gt;flags &amp; CM_REQ_NORETRY)
  		goto out;
  
  	/* if timeout - check that it did not exceed the SMB timeout
! 	   and retry */
! 	if (errorCode == CM_ERROR_TIMEDOUT)
!     {
! 	    long timeUsed, timeLeft;
  	    /* timeleft - get if from reqp the same way as cmXonnByMServers does */
  #ifndef DJGPP
  	    timeUsed = (GetCurrentTime() - reqp-&gt;startTime) / 1000;
--- 163,178 ----
  		serverp = connp-&gt;serverp;
  
  	/* Update callback pointer */
!     if (cbrp &amp;&amp; errorCode == 0) 
!         cbrp-&gt;serverp = connp-&gt;serverp;
  
  	/* If not allowed to retry, don't */
  	if (reqp-&gt;flags &amp; CM_REQ_NORETRY)
  		goto out;
  
  	/* if timeout - check that it did not exceed the SMB timeout
!      * and retry */
!     
  	    /* timeleft - get if from reqp the same way as cmXonnByMServers does */
  #ifndef DJGPP
  	    timeUsed = (GetCurrentTime() - reqp-&gt;startTime) / 1000;
***************
*** 188,203 ****
  	    
  	    /* leave 5 seconds margin for sleep */
  	    timeLeft = RDRtimeout - timeUsed;
! 	    if (timeLeft &gt; 5)
!         {
              thrd_Sleep(3000);
              cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL);
              retry = 1;
          } 
-     }
  
      /* if all servers are offline, mark them non-busy and start over */
! 	if (errorCode == CM_ERROR_ALLOFFLINE) {
  	    osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLOFFLINE.");
  	    thrd_Sleep(5000);
  	    /* cm_ForceUpdateVolume marks all servers as non_busy */
--- 183,197 ----
  	    
  	    /* leave 5 seconds margin for sleep */
  	    timeLeft = RDRtimeout - timeUsed;
! 
!     if (errorCode == CM_ERROR_TIMEDOUT &amp;&amp; timeLeft &gt; 5 ) {
              thrd_Sleep(3000);
              cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL);
              retry = 1;
          } 
  
      /* if all servers are offline, mark them non-busy and start over */
!     if (errorCode == CM_ERROR_ALLOFFLINE &amp;&amp; timeLeft &gt; 7) {
  	    osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLOFFLINE.");
  	    thrd_Sleep(5000);
  	    /* cm_ForceUpdateVolume marks all servers as non_busy */
***************
*** 205,211 ****
  		 * the servers are marked as DOWN.  So clear the DOWN
  		 * flag and reset the busy state as well.
  		 */
! 		cm_GetServerList(fidp, userp, reqp, &amp;serversp);
          if (serversp) {
              lock_ObtainWrite(&amp;cm_serverLock);
              for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
--- 199,209 ----
  		 * the servers are marked as DOWN.  So clear the DOWN
  		 * flag and reset the busy state as well.
  		 */
!         if (!serversp) {
!             cm_GetServerList(fidp, userp, reqp, &amp;serverspp);
!             serversp = *serverspp;
!             free_svr_list = 1;
!         }
          if (serversp) {
              lock_ObtainWrite(&amp;cm_serverLock);
              for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
***************
*** 214,220 ****
                      tsrp-&gt;status = not_busy;
              }
              lock_ReleaseWrite(&amp;cm_serverLock);
! 
              retry = 1;
          }
  
--- 212,221 ----
                      tsrp-&gt;status = not_busy;
              }
              lock_ReleaseWrite(&amp;cm_serverLock);
!             if (free_svr_list) {
!                 cm_FreeServerList(&amp;serversp);
!                 *serverspp = serversp;
!             }
              retry = 1;
          }
  
***************
*** 223,243 ****
  	}
  
  	/* if all servers are busy, mark them non-busy and start over */
! 	if (errorCode == CM_ERROR_ALLBUSY) {
! 		cm_GetServerList(fidp, userp, reqp, &amp;serversp);
  		lock_ObtainWrite(&amp;cm_serverLock);
  		for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
  			if (tsrp-&gt;status == busy)
  				tsrp-&gt;status = not_busy;
  		}
          lock_ReleaseWrite(&amp;cm_serverLock);
! 		thrd_Sleep(5000);
  		retry = 1;
  	}
  
  	/* special codes:  VBUSY and VRESTARTING */
  	if (errorCode == VBUSY || errorCode == VRESTARTING) {
! 		cm_GetServerList(fidp, userp, reqp, &amp;serversp);
  		lock_ObtainWrite(&amp;cm_serverLock);
  		for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
  			if (tsrp-&gt;server == serverp
--- 224,256 ----
  	}
  
  	/* if all servers are busy, mark them non-busy and start over */
!     if (errorCode == CM_ERROR_ALLBUSY &amp;&amp; timeLeft &gt; 7) {
!         thrd_Sleep(5000);
!         if (!serversp) {
!             cm_GetServerList(fidp, userp, reqp, &amp;serverspp);
!             serversp = *serverspp;
!             free_svr_list = 1;
!         }
  		lock_ObtainWrite(&amp;cm_serverLock);
  		for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
  			if (tsrp-&gt;status == busy)
  				tsrp-&gt;status = not_busy;
  		}
          lock_ReleaseWrite(&amp;cm_serverLock);
!         if (free_svr_list) {
!             cm_FreeServerList(&amp;serversp);
!             *serverspp = serversp;
!         }
  		retry = 1;
  	}
  
  	/* special codes:  VBUSY and VRESTARTING */
  	if (errorCode == VBUSY || errorCode == VRESTARTING) {
!         if (!serversp) {
!             cm_GetServerList(fidp, userp, reqp, &amp;serverspp);
!             serversp = *serverspp;
!             free_svr_list = 1;
!         }
  		lock_ObtainWrite(&amp;cm_serverLock);
  		for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
  			if (tsrp-&gt;server == serverp
***************
*** 247,252 ****
--- 260,269 ----
  			}
  		}
          lock_ReleaseWrite(&amp;cm_serverLock);
+         if (free_svr_list) {
+             cm_FreeServerList(&amp;serversp);
+             *serverspp = serversp;
+         }
  		retry = 1;
  	}
  
***************
*** 278,289 ****
  		}
  
  		/* Mark server offline for this volume */
! 		cm_GetServerList(fidp, userp, reqp, &amp;serversp);
! 
  		for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
  			if (tsrp-&gt;server == serverp)
  				tsrp-&gt;status = offline;
  		}
  		retry = 1;
  	}
  
--- 295,314 ----
  		}
  
  		/* Mark server offline for this volume */
!         if (!serversp) {
!             cm_GetServerList(fidp, userp, reqp, &amp;serverspp);
!             serversp = *serverspp;
!             free_svr_list = 1;
!         }
  		for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
  			if (tsrp-&gt;server == serverp)
  				tsrp-&gt;status = offline;
  		}
+         if (free_svr_list) {
+             cm_FreeServerList(&amp;serversp);
+             *serverspp = serversp;
+         }
+         if ( timeLeft &gt; 2 )
  		retry = 1;
  	}
  
***************
*** 312,321 ****
  	else if (errorCode &gt;= -64 &amp;&amp; errorCode &lt; 0) {
  		/* mark server as down */
  		lock_ObtainMutex(&amp;serverp-&gt;mx);
!                 serverp-&gt;flags |= CM_SERVERFLAG_DOWN;
  		lock_ReleaseMutex(&amp;serverp-&gt;mx);
!                 retry = 1;
!         }
  
  	if (errorCode == RXKADEXPIRED &amp;&amp; !dead_session) {
  		lock_ObtainMutex(&amp;userp-&gt;mx);
--- 337,347 ----
  	else if (errorCode &gt;= -64 &amp;&amp; errorCode &lt; 0) {
  		/* mark server as down */
  		lock_ObtainMutex(&amp;serverp-&gt;mx);
!         serverp-&gt;flags |= CM_SERVERFLAG_DOWN;
  		lock_ReleaseMutex(&amp;serverp-&gt;mx);
!             if ( timeLeft &gt; 2 )
!         retry = 1;
!     }
  
  	if (errorCode == RXKADEXPIRED &amp;&amp; !dead_session) {
  		lock_ObtainMutex(&amp;userp-&gt;mx);
***************
*** 327,332 ****
--- 353,359 ----
  		ucellp-&gt;flags &amp;= ~CM_UCELLFLAG_RXKAD;
  		ucellp-&gt;gen++;
  		lock_ReleaseMutex(&amp;userp-&gt;mx);
+             if ( timeLeft &gt; 2 )
  		retry = 1;
  	}
  
***************
*** 347,367 ****
  {
  	long code;
  	cm_serverRef_t *tsrp;
!         cm_server_t *tsp;
!         long firstError = 0;
  	int someBusy = 0, someOffline = 0, allBusy = 1, allDown = 1;
  	long timeUsed, timeLeft, hardTimeLeft;
  #ifdef DJGPP
!         struct timeval now;
  #endif /* DJGPP */        
  
!         *connpp = NULL;
  
  #ifndef DJGPP
  	timeUsed = (GetCurrentTime() - reqp-&gt;startTime) / 1000;
  #else
!         gettimeofday(&amp;now, NULL);
!         timeUsed = sub_time(now, reqp-&gt;startTime) / 1000;
  #endif
          
  	/* leave 5 seconds margin of safety */
--- 374,394 ----
  {
  	long code;
  	cm_serverRef_t *tsrp;
!     cm_server_t *tsp;
!     long firstError = 0;
  	int someBusy = 0, someOffline = 0, allBusy = 1, allDown = 1;
  	long timeUsed, timeLeft, hardTimeLeft;
  #ifdef DJGPP
!     struct timeval now;
  #endif /* DJGPP */        
  
!     *connpp = NULL;
  
  #ifndef DJGPP
  	timeUsed = (GetCurrentTime() - reqp-&gt;startTime) / 1000;
  #else
!     gettimeofday(&amp;now, NULL);
!     timeUsed = sub_time(now, reqp-&gt;startTime) / 1000;
  #endif
          
  	/* leave 5 seconds margin of safety */
***************
*** 369,376 ****
  	hardTimeLeft = HardDeadtimeout - timeUsed - 5;
  
  	lock_ObtainWrite(&amp;cm_serverLock);
! 
!     for(tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
          tsp = tsrp-&gt;server;
          tsp-&gt;refCount++;
          lock_ReleaseWrite(&amp;cm_serverLock);
--- 396,402 ----
  	hardTimeLeft = HardDeadtimeout - timeUsed - 5;
  
  	lock_ObtainWrite(&amp;cm_serverLock);
!     for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
          tsp = tsrp-&gt;server;
          tsp-&gt;refCount++;
          lock_ReleaseWrite(&amp;cm_serverLock);
***************
*** 393,402 ****
                          hardTimeLeft = HardDeadtimeout;
  
                      lock_ObtainMutex(&amp;(*connpp)-&gt;mx);
!                     rx_SetConnDeadTime((*connpp)-&gt;callp,
!                                         timeLeft);
!                     rx_SetConnHardDeadTime((*connpp)-&gt;callp, 
!                                             (u_short) hardTimeLeft);
                      lock_ReleaseMutex(&amp;(*connpp)-&gt;mx);
  
                      return 0;
--- 419,426 ----
                          hardTimeLeft = HardDeadtimeout;
  
                      lock_ObtainMutex(&amp;(*connpp)-&gt;mx);
!                     rx_SetConnDeadTime((*connpp)-&gt;callp, timeLeft);
!                     rx_SetConnHardDeadTime((*connpp)-&gt;callp, (u_short) hardTimeLeft);
                      lock_ReleaseMutex(&amp;(*connpp)-&gt;mx);
  
                      return 0;
***************
*** 420,425 ****
--- 444,450 ----
  		else
  			firstError = CM_ERROR_TIMEDOUT;
  	}
+ 
  	osi_Log1(afsd_logp, "cm_ConnByMServers returning %x", firstError);
      return firstError;
  }
***************
*** 547,560 ****
  {
  	long code;
  
! 	cm_serverRef_t *serversp;
  
! 	code = cm_GetServerList(fidp, userp, reqp, &amp;serversp);
  	if (code) {
  		*connpp = NULL;
  		return code;
  	}
  
! 	code = cm_ConnByMServers(serversp, userp, reqp, connpp);
!         return code;
  }
--- 572,586 ----
  {
  	long code;
  
! 	cm_serverRef_t **serverspp;
  
! 	code = cm_GetServerList(fidp, userp, reqp, &amp;serverspp);
  	if (code) {
  		*connpp = NULL;
  		return code;
  	}
  
! 	code = cm_ConnByMServers(*serverspp, userp, reqp, connpp);
!     cm_FreeServerList(serverspp);
!     return code;
  }
Index: openafs/src/WINNT/afsd/cm_conn.h
diff -c openafs/src/WINNT/afsd/cm_conn.h:1.6 openafs/src/WINNT/afsd/cm_conn.h:1.8
*** openafs/src/WINNT/afsd/cm_conn.h:1.6	Sat Jun  5 14:57:58 2004
--- openafs/src/WINNT/afsd/cm_conn.h	Sat Jul 31 20:16:37 2004
***************
*** 91,96 ****
--- 91,97 ----
  extern int cm_Analyze(cm_conn_t *connp, struct cm_user *up, struct cm_req *reqp,
  	struct cm_fid *fidp,
  	struct AFSVolSync *volInfop,
+         cm_serverRef_t * serversp,
  	struct cm_callbackRequest *cbrp, long code);
  
  extern long cm_ConnByMServers(struct cm_serverRef *, struct cm_user *,
Index: openafs/src/WINNT/afsd/cm_dcache.c
diff -c openafs/src/WINNT/afsd/cm_dcache.c:1.9 openafs/src/WINNT/afsd/cm_dcache.c:1.11
*** openafs/src/WINNT/afsd/cm_dcache.c:1.9	Sun Jul 25 16:53:12 2004
--- openafs/src/WINNT/afsd/cm_dcache.c	Sat Aug  7 01:44:05 2004
***************
*** 173,179 ****
          code = rx_EndCall(callp, code);
          osi_Log0(afsd_logp, "CALL StoreData DONE");
                  
! 	} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync, NULL, code));
      code = cm_MapRPCError(code, reqp);
          
      /* now, clean up our state */
--- 173,179 ----
          code = rx_EndCall(callp, code);
          osi_Log0(afsd_logp, "CALL StoreData DONE");
                  
! 	} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync, NULL, NULL, code));
      code = cm_MapRPCError(code, reqp);
          
      /* now, clean up our state */
***************
*** 266,272 ****
  		if (code == 0)
  			code = EndRXAFS_StoreData(callp, &amp;outStatus, &amp;volSync);
          code = rx_EndCall(callp, code);
! 	} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync, NULL, code));
      code = cm_MapRPCError(code, reqp);
          
      /* now, clean up our state */
--- 266,272 ----
  		if (code == 0)
  			code = EndRXAFS_StoreData(callp, &amp;outStatus, &amp;volSync);
          code = rx_EndCall(callp, code);
! 	} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync, NULL, NULL, code));
      code = cm_MapRPCError(code, reqp);
          
      /* now, clean up our state */
***************
*** 1186,1193 ****
  		afsStatus.ParentVnode = 0x1;
  		afsStatus.ParentUnique = 0x1;
  		afsStatus.ResidencyMask = 0;
! 		afsStatus.ClientModTime = 0x3b49f6e2;
! 		afsStatus.ServerModTime = 0x3b49f6e2;
  		afsStatus.Group = 0;
  		afsStatus.SyncCounter = 0;
  		afsStatus.dataVersionHigh = 0;
--- 1186,1193 ----
  		afsStatus.ParentVnode = 0x1;
  		afsStatus.ParentUnique = 0x1;
  		afsStatus.ResidencyMask = 0;
! 		afsStatus.ClientModTime = FakeFreelanceModTime;
! 		afsStatus.ServerModTime = FakeFreelanceModTime;
  		afsStatus.Group = 0;
  		afsStatus.SyncCounter = 0;
  		afsStatus.dataVersionHigh = 0;
***************
*** 1345,1351 ****
              osi_Log0(afsd_logp, "CALL EndCall returns RXKADUNKNOWNKEY");
          osi_Log0(afsd_logp, "CALL FetchData DONE");
  
! 	} while (cm_Analyze(connp, up, reqp, &amp;scp-&gt;fid, &amp;volSync, NULL, code));
  
    fetchingcompleted:
      code = cm_MapRPCError(code, reqp);
--- 1345,1351 ----
              osi_Log0(afsd_logp, "CALL EndCall returns RXKADUNKNOWNKEY");
          osi_Log0(afsd_logp, "CALL FetchData DONE");
  
! 	} while (cm_Analyze(connp, up, reqp, &amp;scp-&gt;fid, &amp;volSync, NULL, NULL, code));
  
    fetchingcompleted:
      code = cm_MapRPCError(code, reqp);
Index: openafs/src/WINNT/afsd/cm_freelance.c
diff -c openafs/src/WINNT/afsd/cm_freelance.c:1.14 openafs/src/WINNT/afsd/cm_freelance.c:1.15
*** openafs/src/WINNT/afsd/cm_freelance.c:1.14	Tue Jul 27 17:34:46 2004
--- openafs/src/WINNT/afsd/cm_freelance.c	Sat Aug  7 01:44:05 2004
***************
*** 30,41 ****
  osi_mutex_t cm_Freelance_Lock;
  int cm_localMountPointChangeFlag = 0;
  int cm_freelanceEnabled = 0;
  
  void cm_InitFakeRootDir();
  
  void cm_InitFreelance() {
  	lock_InitializeMutex(&amp;cm_Freelance_Lock, "Freelance Lock");
!   
  	// yj: first we make a call to cm_initLocalMountPoints
  	// to read all the local mount points from an ini file
  	cm_InitLocalMountPoints();
--- 30,88 ----
  osi_mutex_t cm_Freelance_Lock;
  int cm_localMountPointChangeFlag = 0;
  int cm_freelanceEnabled = 0;
+ afs_uint32    FakeFreelanceModTime = 0x3b49f6e2;
  
  void cm_InitFakeRootDir();
  
+ #if !defined(DJGPP)
+ void cm_FreelanceChangeNotifier(void * parmp) {
+     HANDLE hFreelanceChangeEvent = 0;
+     HKEY   hkFreelance = 0;
+ 
+     if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
+                       "SOFTWARE\\OpenAFS\\Client\\Freelance",
+                       0,
+                       KEY_NOTIFY,
+                       &amp;hkFreelance) == ERROR_SUCCESS) {
+ 
+         hFreelanceChangeEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+         if (hFreelanceChangeEvent == NULL) {
+             RegCloseKey(hkFreelance);
+             return;
+         }
+     }
+ 
+     while ( TRUE ) {
+     /* check hFreelanceChangeEvent to see if it is set. 
+      * if so, call cm_noteLocalMountPointChange()
+      */
+         if (RegNotifyChangeKeyValue( hkFreelance,   /* hKey */
+                                      FALSE,         /* bWatchSubtree */
+                                      REG_NOTIFY_CHANGE_LAST_SET, /* dwNotifyFilter */
+                                      hFreelanceChangeEvent, /* hEvent */
+                                      TRUE          /* fAsynchronous */
+                                      ) != ERROR_SUCCESS) {
+             RegCloseKey(hkFreelance);
+             CloseHandle(hFreelanceChangeEvent);
+             return;
+         }
+ 
+         if (WaitForSingleObject(hFreelanceChangeEvent, INFINITE) == WAIT_OBJECT_0)
+         {
+             cm_noteLocalMountPointChange();
+         }
+     }
+ }
+ #endif
+ 
  void cm_InitFreelance() {
+ #if !defined(DJGPP)
+     thread_t phandle;
+     int lpid;
+ #endif
+ 
  	lock_InitializeMutex(&amp;cm_Freelance_Lock, "Freelance Lock");
! 
  	// yj: first we make a call to cm_initLocalMountPoints
  	// to read all the local mount points from an ini file
  	cm_InitLocalMountPoints();
***************
*** 43,50 ****
  	// then we make a call to InitFakeRootDir to create
  	// a fake root directory based on the local mount points
  	cm_InitFakeRootDir();
- 
  	// --- end of yj code
  }
  
  /* yj: Initialization of the fake root directory */
--- 90,104 ----
  	// then we make a call to InitFakeRootDir to create
  	// a fake root directory based on the local mount points
  	cm_InitFakeRootDir();
  	// --- end of yj code
+ 
+ #if !defined(DJGPP)
+     /* Start the registry monitor */
+     phandle = thrd_Create(NULL, 65536, (ThreadFunc) cm_FreelanceChangeNotifier,
+                           NULL, 0, &amp;lpid, "cm_FreelanceChangeNotifier");
+ 	osi_assert(phandle != NULL);
+ 	thrd_CloseHandle(phandle);
+ #endif
  }
  
  /* yj: Initialization of the fake root directory */
***************
*** 232,261 ****
        return 0;
  }
    
! int cm_getLocalMountPointChange() {
!   return cm_localMountPointChangeFlag;
  }
  
! int cm_clearLocalMountPointChange() {
!   cm_localMountPointChangeFlag = 0;
!   return 0;
  }
  
! /* called directly from ioctl */
! /* called while not holding freelance lock */
! int cm_noteLocalMountPointChange() {
!   lock_ObtainMutex(&amp;cm_Freelance_Lock);
!   cm_fakeDirVersion++;
!   cm_localMountPointChangeFlag = 1;
!   lock_ReleaseMutex(&amp;cm_Freelance_Lock);
!   return 1;
  }
  
  int cm_reInitLocalMountPoints() {
  	cm_fid_t aFid;
  	int i, hash;
  	cm_scache_t *scp, **lscpp, *tscp;
- 
  	
  	osi_Log0(afsd_logp,"----- freelance reinitialization starts ----- ");
  
--- 286,314 ----
        return 0;
  }
    
! /* called directly from ioctl */
! /* called while not holding freelance lock */
! int cm_noteLocalMountPointChange() {
!     lock_ObtainMutex(&amp;cm_Freelance_Lock);
!     cm_fakeDirVersion++;
!     cm_localMountPointChangeFlag = 1;
!     lock_ReleaseMutex(&amp;cm_Freelance_Lock);
!     return 1;
  }
  
! int cm_getLocalMountPointChange() {
!     return cm_localMountPointChangeFlag;
  }
  
! int cm_clearLocalMountPointChange() {
!     cm_localMountPointChangeFlag = 0;
!     return 0;
  }
  
  int cm_reInitLocalMountPoints() {
  	cm_fid_t aFid;
  	int i, hash;
  	cm_scache_t *scp, **lscpp, *tscp;
  	
  	osi_Log0(afsd_logp,"----- freelance reinitialization starts ----- ");
  
***************
*** 339,346 ****
  /* to be called while holding freelance lock unless during init. */
  long cm_InitLocalMountPoints() {
  	FILE *fp;
  	char line[512];
- 	int i;
  	char* t;
  	cm_localMountPoint_t* aLocalMountPoint;
  	char hdir[120];
--- 392,399 ----
  /* to be called while holding freelance lock unless during init. */
  long cm_InitLocalMountPoints() {
  	FILE *fp;
+     int i;
  	char line[512];
  	char* t;
  	cm_localMountPoint_t* aLocalMountPoint;
  	char hdir[120];
***************
*** 351,356 ****
--- 404,411 ----
      DWORD dwType, dwSize;
      DWORD dwMountPoints;
      DWORD dwIndex;
+     FILETIME ftLastWriteTime;
+     afs_uint32 unixTime;
  #endif
  
  #if !defined(DJGPP)
***************
*** 371,379 ****
                           NULL,  /* lpcMaxValueNameLen */
                           NULL,  /* lpcMaxValueLen */
                           NULL,  /* lpcbSecurityDescriptor */
!                          NULL   /* lpftLastWriteTime */
                           );
  
          if ( dwMountPoints == 0 ) {
              sprintf(line,"%s#%s:root.cell.\n",rootCellName,rootCellName);
              dwType = REG_SZ;
--- 426,436 ----
                           NULL,  /* lpcMaxValueNameLen */
                           NULL,  /* lpcMaxValueLen */
                           NULL,  /* lpcbSecurityDescriptor */
!                          &amp;ftLastWriteTime /* lpftLastWriteTime */
                           );
  
+         smb_UnixTimeFromLargeSearchTime(&amp;FakeFreelanceModTime, &amp;ftLastWriteTime);
+ 
          if ( dwMountPoints == 0 ) {
              sprintf(line,"%s#%s:root.cell.\n",rootCellName,rootCellName);
              dwType = REG_SZ;
***************
*** 413,421 ****
                  t = strchr(line, '%');
              // make sure that there is a '#' or '%' separator in the line
              if (!t) {
!                 afsi_log("error occurred while parsing entry in %s: no # or %% separator in line %d", AFS_FREELANCE_INI, i);
!                 fprintf(stderr, "error occurred while parsing entry in afs_freelance.ini: no # or %% separator in line %d", i);
!                 return -1;
              }
              aLocalMountPoint-&gt;namep=malloc(t-line+1);
              memcpy(aLocalMountPoint-&gt;namep, line, t-line);
--- 470,479 ----
                  t = strchr(line, '%');
              // make sure that there is a '#' or '%' separator in the line
              if (!t) {
!                 afsi_log("error occurred while parsing entry in %s: no # or %% separator in line %d", AFS_FREELANCE_INI, dwIndex);
!                 fprintf(stderr, "error occurred while parsing entry in afs_freelance.ini: no # or %% separator in line %d", dwIndex);
!                 cm_noLocalMountPoints--;
!                 continue;
              }
              aLocalMountPoint-&gt;namep=malloc(t-line+1);
              memcpy(aLocalMountPoint-&gt;namep, line, t-line);
***************
*** 437,442 ****
--- 495,503 ----
      }
  #endif
  
+     /* What follows is the old code to read freelance mount points 
+      * out of a text file modified to copy the data into the registry
+      */
  	cm_GetConfigDir(hdir);
  	strcat(hdir, AFS_FREELANCE_INI);
  	// open the ini file for reading
***************
*** 462,468 ****
  	// we successfully opened the file
  	osi_Log0(afsd_logp,"opened afs_freelance.ini");
  	
- 
  #if !defined(DJGPP)
      RegCreateKeyEx( HKEY_LOCAL_MACHINE, 
                      "SOFTWARE\\OpenAFS\\Client\\Freelance",
--- 523,528 ----
***************
*** 584,593 ****
         don't add the mount point.
         allow partial matches as a means of poor man's alias. */
      /* major performance issue? */
!     osi_Log3(afsd_logp,"Freelance Add Mount request: filename=%s cellname=%s volume=%s %s",
                osi_LogSaveString(afsd_logp,filename), 
                osi_LogSaveString(afsd_logp,cellname), 
!               osi_LogSaveString(afsd_logp,volume), rw ? "rw" : "ro");
      if (cellname[0] == '.') {
          if (!cm_GetCell_Gen(&amp;cellname[1], fullname, CM_FLAG_CREATE))
              return -1;
--- 644,654 ----
         don't add the mount point.
         allow partial matches as a means of poor man's alias. */
      /* major performance issue? */
!     osi_Log4(afsd_logp,"Freelance Add Mount request: filename=%s cellname=%s volume=%s %s",
                osi_LogSaveString(afsd_logp,filename), 
                osi_LogSaveString(afsd_logp,cellname), 
!               osi_LogSaveString(afsd_logp,volume), 
!               rw ? "rw" : "ro");
      if (cellname[0] == '.') {
          if (!cm_GetCell_Gen(&amp;cellname[1], fullname, CM_FLAG_CREATE))
              return -1;
Index: openafs/src/WINNT/afsd/cm_freelance.h
diff -c openafs/src/WINNT/afsd/cm_freelance.h:1.4 openafs/src/WINNT/afsd/cm_freelance.h:1.6
*** openafs/src/WINNT/afsd/cm_freelance.h:1.4	Mon Jul 26 15:08:42 2004
--- openafs/src/WINNT/afsd/cm_freelance.h	Sat Aug  7 01:44:05 2004
***************
*** 16,23 ****
--- 16,27 ----
  extern void cm_InitFreelance();
  extern long cm_FreelanceRemoveMount(char *toremove);
  extern long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, cm_fid_t *fidp);
+ extern int cm_clearLocalMountPointChange();
+ 
  
  #define AFS_FREELANCE_INI "afs_freelance.ini"
  #define AFS_FAKE_ROOT_CELL_ID 0xFFFFFFFF
  #define AFS_FAKE_ROOT_VOL_ID  0xFFFFFFFF
+ 
+ extern afs_uint32 FakeFreelanceModTime;
  #endif // _CM_FREELANCE_H
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.30 openafs/src/WINNT/afsd/cm_ioctl.c:1.33
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.30	Thu Jul 15 23:38:31 2004
--- openafs/src/WINNT/afsd/cm_ioctl.c	Wed Aug  4 11:52:56 2004
***************
*** 419,426 ****
                  if (code) continue;
                  
                  code = RXAFS_FetchACL(connp-&gt;callp, &amp;fid, &amp;acl, &amp;fileStatus, &amp;volSync);
! 	} while (cm_Analyze(connp, userp, &amp;req, &amp;scp-&gt;fid,
! 			    &amp;volSync, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  	cm_ReleaseSCache(scp);
          
--- 419,425 ----
                  if (code) continue;
                  
                  code = RXAFS_FetchACL(connp-&gt;callp, &amp;fid, &amp;acl, &amp;fileStatus, &amp;volSync);
! 	} while (cm_Analyze(connp, userp, &amp;req, &amp;scp-&gt;fid, &amp;volSync, NULL, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  	cm_ReleaseSCache(scp);
          
***************
*** 485,492 ****
                  if (code) continue;
                  
                  code = RXAFS_StoreACL(connp-&gt;callp, &amp;fid, &amp;acl, &amp;fileStatus, &amp;volSync);
! 	} while (cm_Analyze(connp, userp, &amp;req, &amp;scp-&gt;fid,
! 			    &amp;volSync, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  
  	/* invalidate cache info, since we just trashed the ACL cache */
--- 484,490 ----
                  if (code) continue;
                  
                  code = RXAFS_StoreACL(connp-&gt;callp, &amp;fid, &amp;acl, &amp;fileStatus, &amp;volSync);
! 	} while (cm_Analyze(connp, userp, &amp;req, &amp;scp-&gt;fid, &amp;volSync, NULL, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  
  	/* invalidate cache info, since we just trashed the ACL cache */
***************
*** 611,617 ****
  
  		code = RXAFS_SetVolumeStatus(tcp-&gt;callp, scp-&gt;fid.volume,
  			&amp;storeStat, volName, offLineMsg, motd);
! 	} while (cm_Analyze(tcp, userp, &amp;req, &amp;scp-&gt;fid, NULL, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  
  	/* return on failure */
--- 609,615 ----
  
  		code = RXAFS_SetVolumeStatus(tcp-&gt;callp, scp-&gt;fid.volume,
  			&amp;storeStat, volName, offLineMsg, motd);
! 	} while (cm_Analyze(tcp, userp, &amp;req, &amp;scp-&gt;fid, NULL, NULL, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  
  	/* return on failure */
***************
*** 669,675 ****
  
  		code = RXAFS_GetVolumeStatus(tcp-&gt;callp, scp-&gt;fid.volume,
  			&amp;volStat, &amp;Name, &amp;OfflineMsg, &amp;MOTD);
! 	} while (cm_Analyze(tcp, userp, &amp;req, &amp;scp-&gt;fid, NULL, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  
  	cm_ReleaseSCache(scp);
--- 667,673 ----
  
  		code = RXAFS_GetVolumeStatus(tcp-&gt;callp, scp-&gt;fid.volume,
  			&amp;volStat, &amp;Name, &amp;OfflineMsg, &amp;MOTD);
! 	} while (cm_Analyze(tcp, userp, &amp;req, &amp;scp-&gt;fid, NULL, NULL, NULL, code));
  	code = cm_MapRPCError(code, &amp;req);
  
  	cm_ReleaseSCache(scp);
***************
*** 695,737 ****
  long cm_IoctlWhereIs(struct smb_ioctl *ioctlp, struct cm_user *userp)
  {
  	long code;
!         cm_scache_t *scp;
!         cm_cell_t *cellp;
!         cm_volume_t *tvp;
! 	cm_serverRef_t *tsrp;
!         cm_server_t *tsp;
!         unsigned long volume;
!         char *cp;
!         cm_req_t req;
  
  	cm_InitReq(&amp;req);
  
!         code = cm_ParseIoctlPath(ioctlp, userp, &amp;req, &amp;scp);
!         if (code) return code;
          
  	volume = scp-&gt;fid.volume;
  
  	cellp = cm_FindCellByID(scp-&gt;fid.cell);
!         osi_assert(cellp);
  
!         cm_ReleaseSCache(scp);
  
  	code = cm_GetVolumeByID(cellp, volume, userp, &amp;req, &amp;tvp);
!         if (code) return code;
  	
!         cp = ioctlp-&gt;outDatap;
          
  	lock_ObtainMutex(&amp;tvp-&gt;mx);
! 	tsrp = cm_GetVolServers(tvp, volume);
  	lock_ObtainRead(&amp;cm_serverLock);
! 	while(tsrp) {
! 		tsp = tsrp-&gt;server;
  		memcpy(cp, (char *)&amp;tsp-&gt;addr.sin_addr.s_addr, sizeof(long));
  		cp += sizeof(long);
-                 tsrp = tsrp-&gt;next;
  	}
  	lock_ReleaseRead(&amp;cm_serverLock);
!         lock_ReleaseMutex(&amp;tvp-&gt;mx);
  
  	/* still room for terminating NULL, add it on */
  	volume = 0;	/* reuse vbl */
--- 693,735 ----
  long cm_IoctlWhereIs(struct smb_ioctl *ioctlp, struct cm_user *userp)
  {
  	long code;
!     cm_scache_t *scp;
!     cm_cell_t *cellp;
!     cm_volume_t *tvp;
! 	cm_serverRef_t **tsrpp, *current;
!     cm_server_t *tsp;
!     unsigned long volume;
!     char *cp;
!     cm_req_t req;
  
  	cm_InitReq(&amp;req);
  
!     code = cm_ParseIoctlPath(ioctlp, userp, &amp;req, &amp;scp);
!     if (code) return code;
          
  	volume = scp-&gt;fid.volume;
  
  	cellp = cm_FindCellByID(scp-&gt;fid.cell);
!     osi_assert(cellp);
  
!     cm_ReleaseSCache(scp);
  
  	code = cm_GetVolumeByID(cellp, volume, userp, &amp;req, &amp;tvp);
!     if (code) return code;
  	
!     cp = ioctlp-&gt;outDatap;
          
  	lock_ObtainMutex(&amp;tvp-&gt;mx);
! 	tsrpp = cm_GetVolServers(tvp, volume);
  	lock_ObtainRead(&amp;cm_serverLock);
! 	for (current = *tsrpp; current; current = current-&gt;next) {
! 		tsp = current-&gt;server;
  		memcpy(cp, (char *)&amp;tsp-&gt;addr.sin_addr.s_addr, sizeof(long));
  		cp += sizeof(long);
  	}
  	lock_ReleaseRead(&amp;cm_serverLock);
!     cm_FreeServerList(tsrpp);
!     lock_ReleaseMutex(&amp;tvp-&gt;mx);
  
  	/* still room for terminating NULL, add it on */
  	volume = 0;	/* reuse vbl */
***************
*** 1007,1020 ****
  long cm_IoctlGetCell(struct smb_ioctl *ioctlp, struct cm_user *userp)
  {
  	long whichCell;
!         long magic = 0;
  	cm_cell_t *tcellp;
  	cm_serverRef_t *serverRefp;
!         cm_server_t *serverp;
  	long i;
!         char *cp;
!         char *tp;
!         char *basep;
  
  	cm_SkipIoctlPath(ioctlp);
  
--- 1005,1018 ----
  long cm_IoctlGetCell(struct smb_ioctl *ioctlp, struct cm_user *userp)
  {
  	long whichCell;
!     long magic = 0;
  	cm_cell_t *tcellp;
  	cm_serverRef_t *serverRefp;
!     cm_server_t *serverp;
  	long i;
!     char *cp;
!     char *tp;
!     char *basep;
  
  	cm_SkipIoctlPath(ioctlp);
  
***************
*** 1028,1034 ****
  		memcpy((char *)&amp;magic, tp, sizeof(long));
  	}
  
!         lock_ObtainRead(&amp;cm_cellLock);
  	for(tcellp = cm_allCellsp; tcellp; tcellp = tcellp-&gt;nextp) {
  		if (whichCell == 0) break;
  		whichCell--;
--- 1026,1032 ----
  		memcpy((char *)&amp;magic, tp, sizeof(long));
  	}
  
!     lock_ObtainRead(&amp;cm_cellLock);
  	for(tcellp = cm_allCellsp; tcellp; tcellp = tcellp-&gt;nextp) {
  		if (whichCell == 0) break;
  		whichCell--;
***************
*** 1044,1058 ****
  			max = 13;
  		}
  		memset(cp, 0, max * sizeof(long));
!                 basep = cp;
  		lock_ObtainRead(&amp;cm_serverLock);	/* for going down server list */
  		serverRefp = tcellp-&gt;vlServersp;
  		for(i=0; i&lt;max; i++) {
  			if (!serverRefp) break;
  			serverp = serverRefp-&gt;server;
  			memcpy(cp, &amp;serverp-&gt;addr.sin_addr.s_addr, sizeof(long));
  			cp += sizeof(long);
!                         serverRefp = serverRefp-&gt;next;
  		}
  		lock_ReleaseRead(&amp;cm_serverLock);
  		cp = basep + max * sizeof(afs_int32);
--- 1042,1057 ----
  			max = 13;
  		}
  		memset(cp, 0, max * sizeof(long));
!         basep = cp;
  		lock_ObtainRead(&amp;cm_serverLock);	/* for going down server list */
+         /* jaltman - do the reference counts to serverRefp contents need to be increased? */
  		serverRefp = tcellp-&gt;vlServersp;
  		for(i=0; i&lt;max; i++) {
  			if (!serverRefp) break;
  			serverp = serverRefp-&gt;server;
  			memcpy(cp, &amp;serverp-&gt;addr.sin_addr.s_addr, sizeof(long));
  			cp += sizeof(long);
!             serverRefp = serverRefp-&gt;next;
  		}
  		lock_ReleaseRead(&amp;cm_serverLock);
  		cp = basep + max * sizeof(afs_int32);
***************
*** 1691,1699 ****
          if (flags &amp; PIOCTL_LOGON) {
  		  /* SMB user name with which to associate tokens */
  		  smbname = tp;
!           osi_Log1(smb_logp,"cm_IoctlSetToken for user [%s]",osi_LogSaveString(smb_logp,smbname));		  
            fprintf(stderr, "SMB name = %s\n", smbname);
  		  tp += strlen(tp) + 1;
          }
  
  #ifndef DJGPP   /* for win95, session key is back in pioctl */
--- 1690,1702 ----
          if (flags &amp; PIOCTL_LOGON) {
  		  /* SMB user name with which to associate tokens */
  		  smbname = tp;
!           osi_Log2(smb_logp,"cm_IoctlSetToken for user [%s] smbname [%s]",
!                     osi_LogSaveString(smb_logp,uname), osi_LogSaveString(smb_logp,smbname));
            fprintf(stderr, "SMB name = %s\n", smbname);
  		  tp += strlen(tp) + 1;
+         } else {
+             osi_Log1(smb_logp,"cm_IoctlSetToken for user [%s]",
+                       osi_LogSaveString(smb_logp,uname));
          }
  
  #ifndef DJGPP   /* for win95, session key is back in pioctl */
***************
*** 1702,1709 ****
  		if (!cm_FindTokenEvent(uuid, sessionKey))
  			return CM_ERROR_INVAL;
  #endif /* !DJGPP */
! 	} else
  		cellp = cm_rootCellp;
  
  	if (flags &amp; PIOCTL_LOGON) {
            userp = smb_FindCMUserByName(smbname, ioctlp-&gt;fidp-&gt;vcp-&gt;rname);
--- 1705,1714 ----
  		if (!cm_FindTokenEvent(uuid, sessionKey))
  			return CM_ERROR_INVAL;
  #endif /* !DJGPP */
! 	} else {
  		cellp = cm_rootCellp;
+         osi_Log0(smb_logp,"cm_IoctlSetToken - no name specified");
+     }
  
  	if (flags &amp; PIOCTL_LOGON) {
            userp = smb_FindCMUserByName(smbname, ioctlp-&gt;fidp-&gt;vcp-&gt;rname);
***************
*** 1712,1717 ****
--- 1717,1723 ----
  	/* store the token */
  	lock_ObtainMutex(&amp;userp-&gt;mx);
  	ucellp = cm_GetUCell(userp, cellp);
+     osi_Log1(smb_logp,"cm_IoctlSetToken ucellp %lx", ucellp);
  	ucellp-&gt;ticketLen = ticketLen;
  	if (ucellp-&gt;ticketp)
  		free(ucellp-&gt;ticketp);	/* Discard old token if any */
***************
*** 1946,1951 ****
--- 1952,1959 ----
  		return CM_ERROR_NOMORETOKENS;
  	}
  
+     osi_Log1(smb_logp,"cm_IoctlDelToken ucellp %lx", ucellp);
+ 
  	if (ucellp-&gt;ticketp) {
  		free(ucellp-&gt;ticketp);
  		ucellp-&gt;ticketp = NULL;
***************
*** 1966,1972 ****
  
  	lock_ObtainMutex(&amp;userp-&gt;mx);
  
! 	for (ucellp = userp-&gt;cellInfop; ucellp; ucellp = ucellp-&gt;nextp) {
  		ucellp-&gt;flags &amp;= ~CM_UCELLFLAG_RXKAD;
  		ucellp-&gt;gen++;
  	}
--- 1974,1981 ----
  
  	lock_ObtainMutex(&amp;userp-&gt;mx);
  
!     for (ucellp = userp-&gt;cellInfop; ucellp; ucellp = ucellp-&gt;nextp) {
!         osi_Log1(smb_logp,"cm_IoctlDelAllToken ucellp %lx", ucellp);
  		ucellp-&gt;flags &amp;= ~CM_UCELLFLAG_RXKAD;
  		ucellp-&gt;gen++;
  	}
***************
*** 1982,1988 ****
  {
  	char afspath[MAX_PATH];
  	char *submountreqp;
- 	int iteration;
  	int nextAutoSubmount;
      HKEY hkSubmounts;
      DWORD dwType, dwSize;
--- 1991,1996 ----
***************
*** 2021,2027 ****
      if (submountreqp &amp;&amp; *submountreqp) {
  		char submountPathNormalized[MAX_PATH];
  		char submountPath[MAX_PATH];
- 		int submountPathLen;
  
          dwSize = sizeof(submountPath);
          status = RegQueryValueEx( hkSubmounts, submountreqp, 0,
--- 2029,2034 ----
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.13 openafs/src/WINNT/afsd/cm_scache.c:1.14
*** openafs/src/WINNT/afsd/cm_scache.c:1.13	Mon Jul 26 15:08:42 2004
--- openafs/src/WINNT/afsd/cm_scache.c	Sat Aug  7 01:44:05 2004
***************
*** 316,323 ****
  
  		scp-&gt;owner=0x0;
  		scp-&gt;unixModeBits=0x1ff;
! 		scp-&gt;clientModTime=0x3b49f6e2;
! 		scp-&gt;serverModTime=0x3b49f6e2;
  		scp-&gt;parentUnique = 0x1;
  		scp-&gt;parentVnode=0x1;
  		scp-&gt;group=0;
--- 316,323 ----
  
  		scp-&gt;owner=0x0;
  		scp-&gt;unixModeBits=0x1ff;
! 		scp-&gt;clientModTime=FakeFreelanceModTime;
! 		scp-&gt;serverModTime=FakeFreelanceModTime;
  		scp-&gt;parentUnique = 0x1;
  		scp-&gt;parentVnode=0x1;
  		scp-&gt;group=0;
***************
*** 819,826 ****
  		statusp-&gt;ParentVnode = 0x1;
  		statusp-&gt;ParentUnique = 0x1;
  		statusp-&gt;ResidencyMask = 0;
! 		statusp-&gt;ClientModTime = 0x3b49f6e2;
! 		statusp-&gt;ServerModTime = 0x3b49f6e2;
  		statusp-&gt;Group = 0;
  		statusp-&gt;SyncCounter = 0;
  		statusp-&gt;dataVersionHigh = 0;
--- 819,826 ----
  		statusp-&gt;ParentVnode = 0x1;
  		statusp-&gt;ParentUnique = 0x1;
  		statusp-&gt;ResidencyMask = 0;
! 		statusp-&gt;ClientModTime = FakeFreelanceModTime;
! 		statusp-&gt;ServerModTime = FakeFreelanceModTime;
  		statusp-&gt;Group = 0;
  		statusp-&gt;SyncCounter = 0;
  		statusp-&gt;dataVersionHigh = 0;
Index: openafs/src/WINNT/afsd/cm_scache.h
diff -c openafs/src/WINNT/afsd/cm_scache.h:1.3 openafs/src/WINNT/afsd/cm_scache.h:1.4
*** openafs/src/WINNT/afsd/cm_scache.h:1.3	Mon Apr 30 02:48:06 2001
--- openafs/src/WINNT/afsd/cm_scache.h	Sat Jul 31 20:16:37 2004
***************
*** 136,145 ****
  #define CM_SCACHETYPE_MOUNTPOINT	4	/* a mount point */
  
  /* flag bits */
! #define CM_SCACHEFLAG_STATD		1	/* status info is valid */
! #define CM_SCACHEFLAG_DELETED		2	/* file has been deleted */
! #define CM_SCACHEFLAG_CALLBACK		4	/* have a valid callback */
! #define CM_SCACHEFLAG_STORING		8	/* status being stored back */
  #define CM_SCACHEFLAG_FETCHING		0x10	/* status being fetched */
  #define CM_SCACHEFLAG_SIZESTORING	0x20	/* status being stored that
  						 * changes the data; typically,
--- 136,145 ----
  #define CM_SCACHETYPE_MOUNTPOINT	4	/* a mount point */
  
  /* flag bits */
! #define CM_SCACHEFLAG_STATD                 0x01        /* status info is valid */
! #define CM_SCACHEFLAG_DELETED           0x02    /* file has been deleted */
! #define CM_SCACHEFLAG_CALLBACK          0x04    /* have a valid callback */
! #define CM_SCACHEFLAG_STORING           0x08    /* status being stored back */
  #define CM_SCACHEFLAG_FETCHING		0x10	/* status being fetched */
  #define CM_SCACHEFLAG_SIZESTORING	0x20	/* status being stored that
  						 * changes the data; typically,
***************
*** 171,180 ****
   * These flags correspond to individual RPCs that we may be making, and at most
   * one can be set in any one call to SyncOp.
   */
! #define CM_SCACHESYNC_FETCHSTATUS	1	/* fetching status info */
! #define CM_SCACHESYNC_STORESTATUS	2	/* storing status info */
! #define CM_SCACHESYNC_FETCHDATA		4	/* fetch data */
! #define CM_SCACHESYNC_STOREDATA		8	/* store data */
  #define CM_SCACHESYNC_STORESIZE		0x10	/* store new file size */
  #define CM_SCACHESYNC_GETCALLBACK	0x20	/* fetching a callback */
  #define CM_SCACHESYNC_STOREDATA_EXCL	0x40	/* store data */
--- 171,180 ----
   * These flags correspond to individual RPCs that we may be making, and at most
   * one can be set in any one call to SyncOp.
   */
! #define CM_SCACHESYNC_FETCHSTATUS           0x01        /* fetching status info */
! #define CM_SCACHESYNC_STORESTATUS           0x02        /* storing status info */
! #define CM_SCACHESYNC_FETCHDATA             0x04        /* fetch data */
! #define CM_SCACHESYNC_STOREDATA             0x08        /* store data */
  #define CM_SCACHESYNC_STORESIZE		0x10	/* store new file size */
  #define CM_SCACHESYNC_GETCALLBACK	0x20	/* fetching a callback */
  #define CM_SCACHESYNC_STOREDATA_EXCL	0x40	/* store data */
Index: openafs/src/WINNT/afsd/cm_server.c
diff -c openafs/src/WINNT/afsd/cm_server.c:1.9 openafs/src/WINNT/afsd/cm_server.c:1.13
*** openafs/src/WINNT/afsd/cm_server.c:1.9	Wed Jul 14 02:34:09 2004
--- openafs/src/WINNT/afsd/cm_server.c	Sat Aug  7 10:12:11 2004
***************
*** 142,147 ****
--- 142,152 ----
  	lock_ReleaseWrite(&amp;cm_serverLock);
  }
  
+ void cm_PutServerNoLock(cm_server_t *serverp)
+ {
+ 	osi_assert(serverp-&gt;refCount-- &gt; 0);
+ }
+ 
  void cm_SetServerPrefs(cm_server_t * serverp)
  {
  	unsigned long	serverAddr; 	/* in host byte order */
***************
*** 243,255 ****
  {
  	cm_serverRef_t *tsrp;
  
!         lock_ObtainWrite(&amp;cm_serverLock);
  	serverp-&gt;refCount++;
!         lock_ReleaseWrite(&amp;cm_serverLock);
  	tsrp = malloc(sizeof(*tsrp));
  	tsrp-&gt;server = serverp;
  	tsrp-&gt;status = not_busy;
  	tsrp-&gt;next = NULL;
  
  	return tsrp;
  }
--- 248,261 ----
  {
  	cm_serverRef_t *tsrp;
  
!     lock_ObtainWrite(&amp;cm_serverLock);
  	serverp-&gt;refCount++;
!     lock_ReleaseWrite(&amp;cm_serverLock);
  	tsrp = malloc(sizeof(*tsrp));
  	tsrp-&gt;server = serverp;
  	tsrp-&gt;status = not_busy;
  	tsrp-&gt;next = NULL;
+     tsrp-&gt;refCount = 1;
  
  	return tsrp;
  }
***************
*** 261,267 ****
  	cm_serverRef_t *tsrp;
  
      lock_ObtainWrite(&amp;cm_serverLock);
- 
  	for (tsrp = serversp; tsrp; tsrp=tsrp-&gt;next) {
  		if (first)
  			first = 0;
--- 267,272 ----
***************
*** 277,282 ****
--- 282,289 ----
  /*
  ** Insert a server into the server list keeping the list sorted in 
  ** asending order of ipRank. 
+ ** 
+ ** The refCount of the cm_serverRef_t is increased
  */
  void cm_InsertServerList(cm_serverRef_t** list, cm_serverRef_t* element)
  {
***************
*** 284,291 ****
  	unsigned short ipRank = element-&gt;server-&gt;ipRank;
  
      lock_ObtainWrite(&amp;cm_serverLock);
  
! 	/* insertion into empty list  or at the beginning of the list */
  	if ( !current || (current-&gt;server-&gt;ipRank &gt; ipRank) )
  	{
  		element-&gt;next = *list;
--- 291,299 ----
  	unsigned short ipRank = element-&gt;server-&gt;ipRank;
  
      lock_ObtainWrite(&amp;cm_serverLock);
+     element-&gt;refCount++;                /* increase refCount */
  
!     /* insertion into empty list  or at the beginning of the list */
  	if ( !current || (current-&gt;server-&gt;ipRank &gt; ipRank) )
  	{
  		element-&gt;next = *list;
***************
*** 338,343 ****
--- 346,356 ----
  
  	/* re-insert deleted element into the list with modified rank*/
  	cm_InsertServerList(list, element);
+ 
+     /* reduce refCount which was increased by cm_InsertServerList */
+     lock_ObtainWrite(&amp;cm_serverLock);
+     element-&gt;refCount--;
+     lock_ReleaseWrite(&amp;cm_serverLock);
  	return 0;
  }
  /*
***************
*** 419,435 ****
  
  void cm_FreeServerList(cm_serverRef_t** list)
  {
!     cm_serverRef_t  *current = *list;
!     cm_serverRef_t  *next = 0;
  
      lock_ObtainWrite(&amp;cm_serverLock);
  
!     while (current)
      {
!         next = current-&gt;next;
!         cm_FreeServer(current-&gt;server);
!         free(current);
!         current = next;
      }
    
      lock_ReleaseWrite(&amp;cm_serverLock);
--- 432,454 ----
  
  void cm_FreeServerList(cm_serverRef_t** list)
  {
!     cm_serverRef_t  **current = list;
!     cm_serverRef_t  **nextp = 0;
! 	cm_serverRef_t  * next = 0;
  
      lock_ObtainWrite(&amp;cm_serverLock);
  
!     while (*current)
      {
!         nextp = &amp;(*current)-&gt;next;
!         if (--((*current)-&gt;refCount) == 0) {
! 			next = *nextp;
!             cm_FreeServer((*current)-&gt;server);
!             free(*current);
!             *current = next;
!         } else {
!            current = nextp;
!         }
      }
    
      lock_ReleaseWrite(&amp;cm_serverLock);
Index: openafs/src/WINNT/afsd/cm_server.h
diff -c openafs/src/WINNT/afsd/cm_server.h:1.4 openafs/src/WINNT/afsd/cm_server.h:1.5
*** openafs/src/WINNT/afsd/cm_server.h:1.4	Sun May 30 10:39:05 2004
--- openafs/src/WINNT/afsd/cm_server.h	Fri Jul 30 16:02:58 2004
***************
*** 22,43 ****
   */
  typedef struct cm_server {
  	struct cm_server *allNextp;		/* locked by cm_serverLock */
!         struct sockaddr_in addr;		/* by mx */
!         int type;				/* by mx */
  	struct cm_conn *connsp;			/* locked by cm_connLock */
!         long flags;				/* by mx */
!         struct cm_cell *cellp;			/* cell containing this server */
  	int refCount;				/* locked by cm_serverLock */
!         osi_mutex_t mx;
  	unsigned short ipRank;			/* server priority */
  } cm_server_t;
  
  enum repstate {not_busy, busy, offline};
  
  typedef struct cm_serverRef {
! 	struct cm_serverRef *next;
! 	struct cm_server *server;
! 	enum repstate status;
  } cm_serverRef_t;
  
  /* types */
--- 22,44 ----
   */
  typedef struct cm_server {
  	struct cm_server *allNextp;		/* locked by cm_serverLock */
!     struct sockaddr_in addr;		/* by mx */
!     int type;				/* by mx */
  	struct cm_conn *connsp;			/* locked by cm_connLock */
!     long flags;				/* by mx */
!     struct cm_cell *cellp;			/* cell containing this server */
  	int refCount;				/* locked by cm_serverLock */
!     osi_mutex_t mx;
  	unsigned short ipRank;			/* server priority */
  } cm_server_t;
  
  enum repstate {not_busy, busy, offline};
  
  typedef struct cm_serverRef {
! 	struct cm_serverRef *next;      /* locked by cm_serverLock */
! 	struct cm_server *server;       /* locked by cm_serverLock */
! 	enum repstate status;           /* locked by cm_serverLock */
!     int refCount;                   /* locked by cm_serverLock */
  } cm_serverRef_t;
  
  /* types */
***************
*** 75,80 ****
--- 76,83 ----
  
  extern void cm_PutServer(cm_server_t *);
  
+ extern void cm_PutServerNoLock(cm_server_t *);
+ 
  extern cm_server_t *cm_FindServer(struct sockaddr_in *addrp, int type);
  
  extern osi_rwlock_t cm_serverLock;
Index: openafs/src/WINNT/afsd/cm_vnodeops.c
diff -c openafs/src/WINNT/afsd/cm_vnodeops.c:1.18 openafs/src/WINNT/afsd/cm_vnodeops.c:1.19
*** openafs/src/WINNT/afsd/cm_vnodeops.c:1.18	Tue Jul 27 17:34:46 2004
--- openafs/src/WINNT/afsd/cm_vnodeops.c	Fri Jul 30 16:02:58 2004
***************
*** 1114,1121 ****
                  code = RXAFS_RemoveFile(connp-&gt;callp, &amp;afsFid, namep,
  					&amp;newDirStatus, &amp;volSync);
  		
! 	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, NULL, code));
          code = cm_MapRPCError(code, reqp);
  
          lock_ObtainMutex(&amp;dscp-&gt;mx);
--- 1114,1120 ----
                  code = RXAFS_RemoveFile(connp-&gt;callp, &amp;afsFid, namep,
  					&amp;newDirStatus, &amp;volSync);
  		
! 	} while (cm_Analyze(connp, userp, reqp, &amp;dscp-&gt;fid, &amp;volSync, NULL, NULL, code));
          code = cm_MapRPCError(code, reqp);
  
          lock_ObtainMutex(&amp;dscp-&gt;mx);
***************
*** 1630,1636 ****
                          	&amp;statStruct, &amp;callbackStruct, &amp;volSync);
  
  		} while (cm_Analyze(connp, userp, reqp, &amp;dscp-&gt;fid,
! 				    &amp;volSync, &amp;cbReq, code));
                  code = cm_MapRPCError(code, reqp);
  
                  osi_Log0(afsd_logp, "CALL BulkStatus DONE");
--- 1629,1635 ----
                          	&amp;statStruct, &amp;callbackStruct, &amp;volSync);
  
  		} while (cm_Analyze(connp, userp, reqp, &amp;dscp-&gt;fid,
! 				    &amp;volSync, NULL, &amp;cbReq, code));
                  code = cm_MapRPCError(code, reqp);
  
                  osi_Log0(afsd_logp, "CALL BulkStatus DONE");
***************
*** 1850,1856 ****
  			&amp;afsInStatus, &amp;afsOutStatus, &amp;volSync);
  
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;scp-&gt;fid, &amp;volSync, NULL, code));
          code = cm_MapRPCError(code, reqp);
  
  	osi_Log1(afsd_logp, "CALL StoreStatus DONE, code %d", code);
--- 1849,1855 ----
  			&amp;afsInStatus, &amp;afsOutStatus, &amp;volSync);
  
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;scp-&gt;fid, &amp;volSync, NULL, NULL, code));
          code = cm_MapRPCError(code, reqp);
  
  	osi_Log1(afsd_logp, "CALL StoreStatus DONE, code %d", code);
***************
*** 1923,1929 ****
  					&amp;updatedDirStatus, &amp;newFileCallback,
  					&amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, &amp;cbReq, code));
          code = cm_MapRPCError(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
--- 1922,1928 ----
  					&amp;updatedDirStatus, &amp;newFileCallback,
  					&amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, NULL, &amp;cbReq, code));
          code = cm_MapRPCError(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
***************
*** 2039,2045 ****
  				     &amp;updatedDirStatus, &amp;newDirCallback,
  				     &amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, &amp;cbReq, code));
          code = cm_MapRPCError(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
--- 2038,2044 ----
  				     &amp;updatedDirStatus, &amp;newDirCallback,
  				     &amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, NULL, &amp;cbReq, code));
          code = cm_MapRPCError(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
***************
*** 2121,2127 ****
  				     &amp;inStatus, &amp;newAFSFid, &amp;newLinkStatus,
  				     &amp;updatedDirStatus, &amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, NULL, code));
          code = cm_MapRPCError(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
--- 2120,2126 ----
  				     &amp;inStatus, &amp;newAFSFid, &amp;newLinkStatus,
  				     &amp;updatedDirStatus, &amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, NULL, NULL, code));
          code = cm_MapRPCError(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
***************
*** 2190,2196 ****
                  code = RXAFS_RemoveDir(connp-&gt;callp, &amp;dirAFSFid, namep,
  					&amp;updatedDirStatus, &amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, NULL, code));
          code = cm_MapRPCErrorRmdir(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
--- 2189,2195 ----
                  code = RXAFS_RemoveDir(connp-&gt;callp, &amp;dirAFSFid, namep,
  					&amp;updatedDirStatus, &amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp,
! 			    &amp;dscp-&gt;fid, &amp;volSync, NULL, NULL, code));
          code = cm_MapRPCErrorRmdir(code, reqp);
          
          lock_ObtainMutex(&amp;dscp-&gt;mx);
***************
*** 2330,2336 ****
  			&amp;updatedOldDirStatus, &amp;updatedNewDirStatus,
                  	&amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp, &amp;oldDscp-&gt;fid,
! 			    &amp;volSync, NULL, code));
          code = cm_MapRPCError(code, reqp);
          
  	/* update the individual stat cache entries for the directories */
--- 2329,2335 ----
  			&amp;updatedOldDirStatus, &amp;updatedNewDirStatus,
                  	&amp;volSync);
  	} while (cm_Analyze(connp, userp, reqp, &amp;oldDscp-&gt;fid,
! 			    &amp;volSync, NULL, NULL, code));
          code = cm_MapRPCError(code, reqp);
          
  	/* update the individual stat cache entries for the directories */
***************
*** 2402,2408 ****
  			code = RXAFS_SetLock(connp-&gt;callp, &amp;tfid, Which,
  					     &amp;volSync);
  		} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync,
! 				    NULL, code));
  		lock_ObtainMutex(&amp;scp-&gt;mx);
  		code = cm_MapRPCError(code, reqp);
  	}
--- 2401,2407 ----
  			code = RXAFS_SetLock(connp-&gt;callp, &amp;tfid, Which,
  					     &amp;volSync);
  		} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync,
! 				    NULL, NULL, code));
  		lock_ObtainMutex(&amp;scp-&gt;mx);
  		code = cm_MapRPCError(code, reqp);
  	}
***************
*** 2493,2499 ****
                  break;
  			code = RXAFS_ReleaseLock(connp-&gt;callp, &amp;tfid, &amp;volSync);
  		} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync,
! 				    NULL, code));
  		code = cm_MapRPCError(code, reqp);
  		lock_ObtainMutex(&amp;scp-&gt;mx);
  	}
--- 2492,2498 ----
                  break;
  			code = RXAFS_ReleaseLock(connp-&gt;callp, &amp;tfid, &amp;volSync);
  		} while (cm_Analyze(connp, userp, reqp, &amp;scp-&gt;fid, &amp;volSync,
! 				    NULL, NULL, code));
  		code = cm_MapRPCError(code, reqp);
  		lock_ObtainMutex(&amp;scp-&gt;mx);
  	}
***************
*** 2534,2540 ****
  				code = RXAFS_ExtendLock(connp-&gt;callp, &amp;tfid,
  							&amp;volSync);
  			} while (cm_Analyze(connp, fileLock-&gt;userp, &amp;req,
! 					    &amp;fileLock-&gt;fid, &amp;volSync, NULL,
  					    code));
  			code = cm_MapRPCError(code, &amp;req);
  			lock_ObtainWrite(&amp;cm_scacheLock);
--- 2533,2539 ----
  				code = RXAFS_ExtendLock(connp-&gt;callp, &amp;tfid,
  							&amp;volSync);
  			} while (cm_Analyze(connp, fileLock-&gt;userp, &amp;req,
! 					    &amp;fileLock-&gt;fid, &amp;volSync, NULL, NULL,
  					    code));
  			code = cm_MapRPCError(code, &amp;req);
  			lock_ObtainWrite(&amp;cm_scacheLock);
***************
*** 2602,2608 ****
  					     &amp;volSync);
  		} while (cm_Analyze(connp, oldFileLock-&gt;userp, &amp;req,
  				    &amp;oldFileLock-&gt;fid, &amp;volSync,
! 				    NULL, code));
  		code = cm_MapRPCError(code, &amp;req);
  	}
  
--- 2601,2607 ----
  					     &amp;volSync);
  		} while (cm_Analyze(connp, oldFileLock-&gt;userp, &amp;req,
  				    &amp;oldFileLock-&gt;fid, &amp;volSync,
! 				    NULL, NULL, code));
  		code = cm_MapRPCError(code, &amp;req);
  	}
  
Index: openafs/src/WINNT/afsd/cm_volume.c
diff -c openafs/src/WINNT/afsd/cm_volume.c:1.6 openafs/src/WINNT/afsd/cm_volume.c:1.8
*** openafs/src/WINNT/afsd/cm_volume.c:1.6	Sat Jul 24 14:59:32 2004
--- openafs/src/WINNT/afsd/cm_volume.c	Wed Aug  4 11:52:56 2004
***************
*** 55,75 ****
  	long code;
  
  	/* clear out old bindings */
! 	while (tsrp = volp-&gt;rwServersp) {
! 		volp-&gt;rwServersp = tsrp-&gt;next;
! 		cm_PutServer(tsrp-&gt;server);
! 		free(tsrp);
! 	}
! 	while (tsrp = volp-&gt;roServersp) {
! 		volp-&gt;roServersp = tsrp-&gt;next;
! 		cm_PutServer(tsrp-&gt;server);
! 		free(tsrp);
! 	}
! 	while (tsrp = volp-&gt;bkServersp) {
! 		volp-&gt;bkServersp = tsrp-&gt;next;
! 		cm_PutServer(tsrp-&gt;server);
! 		free(tsrp);
! 	}
  
      /* now we have volume structure locked and held; make RPC to fill it */
      do {
--- 55,63 ----
  	long code;
  
  	/* clear out old bindings */
!     cm_FreeServerList(&amp;volp-&gt;rwServersp);
!     cm_FreeServerList(&amp;volp-&gt;roServersp);
!     cm_FreeServerList(&amp;volp-&gt;bkServersp);
  
      /* now we have volume structure locked and held; make RPC to fill it */
      do {
***************
*** 79,85 ****
  		osi_Log1(afsd_logp, "CALL VL_GetEntryByNameO name %s",
                    volp-&gt;namep);
          code = VL_GetEntryByNameO(connp-&gt;callp, volp-&gt;namep, &amp;vldbEntry);
! 	} while (cm_Analyze(connp, userp, reqp, NULL, NULL, NULL, code));
      code = cm_MapVLRPCError(code, reqp);
  
      if (code == 0) {
--- 67,73 ----
  		osi_Log1(afsd_logp, "CALL VL_GetEntryByNameO name %s",
                    volp-&gt;namep);
          code = VL_GetEntryByNameO(connp-&gt;callp, volp-&gt;namep, &amp;vldbEntry);
! 	} while (cm_Analyze(connp, userp, reqp, NULL, NULL, cellp-&gt;vlServersp, NULL, code));
      code = cm_MapVLRPCError(code, reqp);
  
      if (code == 0) {
***************
*** 126,146 ****
  			if ((tflags &amp; VLSF_RWVOL)
                   &amp;&amp; (vldbEntry.flags &amp; VLF_RWEXISTS)) {
  				tsrp = cm_NewServerRef(tsp);
! 				tsrp-&gt;next = volp-&gt;rwServersp;
!                 volp-&gt;rwServersp = tsrp;
  			}
              if ((tflags &amp; VLSF_ROVOL)
                   &amp;&amp; (vldbEntry.flags &amp; VLF_ROEXISTS)) {
  				tsrp = cm_NewServerRef(tsp);
  				cm_InsertServerList(&amp;volp-&gt;roServersp, tsrp);
  				ROcount++;
              }
  			/* We don't use VLSF_BACKVOL !?! */
              if ((tflags &amp; VLSF_RWVOL)
                   &amp;&amp; (vldbEntry.flags &amp; VLF_BACKEXISTS)) {
  				tsrp = cm_NewServerRef(tsp);
!                 tsrp-&gt;next = volp-&gt;bkServersp;
!                 volp-&gt;bkServersp = tsrp;
  			}
  			/* Drop the reference obtained by cm_FindServer() */
  			cm_PutServer(tsp);
--- 114,141 ----
  			if ((tflags &amp; VLSF_RWVOL)
                   &amp;&amp; (vldbEntry.flags &amp; VLF_RWEXISTS)) {
  				tsrp = cm_NewServerRef(tsp);
!                 cm_InsertServerList(&amp;volp-&gt;rwServersp, tsrp);
!                 lock_ObtainWrite(&amp;cm_serverLock);
!                 tsrp-&gt;refCount--;       /* drop allocation reference */
!                 lock_ReleaseWrite(&amp;cm_serverLock);
  			}
              if ((tflags &amp; VLSF_ROVOL)
                   &amp;&amp; (vldbEntry.flags &amp; VLF_ROEXISTS)) {
  				tsrp = cm_NewServerRef(tsp);
  				cm_InsertServerList(&amp;volp-&gt;roServersp, tsrp);
+                 lock_ObtainWrite(&amp;cm_serverLock);
+                 tsrp-&gt;refCount--;       /* drop allocation reference */
+                 lock_ReleaseWrite(&amp;cm_serverLock);
  				ROcount++;
              }
  			/* We don't use VLSF_BACKVOL !?! */
              if ((tflags &amp; VLSF_RWVOL)
                   &amp;&amp; (vldbEntry.flags &amp; VLF_BACKEXISTS)) {
  				tsrp = cm_NewServerRef(tsp);
!                 cm_InsertServerList(&amp;volp-&gt;bkServersp, tsrp);
!                 lock_ObtainWrite(&amp;cm_serverLock);
!                 tsrp-&gt;refCount--;       /* drop allocation reference */
!                 lock_ReleaseWrite(&amp;cm_serverLock);
  			}
  			/* Drop the reference obtained by cm_FindServer() */
  			cm_PutServer(tsp);
***************
*** 308,326 ****
  }
  
  /* find the appropriate servers from a volume */
! cm_serverRef_t *cm_GetVolServers(cm_volume_t *volp, unsigned long volume)
  {
! 	cm_serverRef_t *serversp;
  
  	if (volume == volp-&gt;rwID)
!         	serversp = volp-&gt;rwServersp;
  	else if (volume == volp-&gt;roID)
!         	serversp = volp-&gt;roServersp;
  	else if (volume == volp-&gt;bkID)
!         	serversp = volp-&gt;bkServersp;
  	else osi_panic("bad volume ID in cm_GetVolServers", __FILE__, __LINE__);
          
!         return serversp;
  }
  
  void cm_PutVolume(cm_volume_t *volp)
--- 303,329 ----
  }
  
  /* find the appropriate servers from a volume */
! cm_serverRef_t **cm_GetVolServers(cm_volume_t *volp, unsigned long volume)
  {
! 	cm_serverRef_t **serverspp;
!     cm_serverRef_t *current;;
! 
!     lock_ObtainWrite(&amp;cm_serverLock);
  
  	if (volume == volp-&gt;rwID)
!         serverspp = &amp;volp-&gt;rwServersp;
  	else if (volume == volp-&gt;roID)
!         serverspp = &amp;volp-&gt;roServersp;
  	else if (volume == volp-&gt;bkID)
!         serverspp = &amp;volp-&gt;bkServersp;
  	else osi_panic("bad volume ID in cm_GetVolServers", __FILE__, __LINE__);
          
!     for (current = *serverspp; current; current = current-&gt;next)
!         current-&gt;refCount++;
! 
!     lock_ReleaseWrite(&amp;cm_serverLock);
! 
!     return serverspp;
  }
  
  void cm_PutVolume(cm_volume_t *volp)
Index: openafs/src/WINNT/afsd/cm_volume.h
diff -c openafs/src/WINNT/afsd/cm_volume.h:1.2 openafs/src/WINNT/afsd/cm_volume.h:1.3
*** openafs/src/WINNT/afsd/cm_volume.h:1.2	Sat Nov  4 05:01:41 2000
--- openafs/src/WINNT/afsd/cm_volume.h	Wed Aug  4 11:52:56 2004
***************
*** 12,29 ****
  
  typedef struct cm_volume {
  	struct cm_cell *cellp;		/* never changes */
!         char *namep;			/* by cm_volumeLock */
  	unsigned long rwID;		/* by cm_volumeLock */
  	unsigned long roID;		/* by cm_volumeLock */
  	unsigned long bkID;		/* by cm_volumeLock */
!         struct cm_volume *nextp;	/* by cm_volumeLock */
  	struct cm_fid *dotdotFidp;	/* parent of volume root */
!         osi_mutex_t mx;
!         long flags;			/* by mx */
!         int refCount;			/* by cm_volumeLock */
!         cm_serverRef_t *rwServersp;	/* by mx */
!         cm_serverRef_t *roServersp;	/* by mx */
!         cm_serverRef_t *bkServersp;	/* by mx */
  } cm_volume_t;
  
  #define CM_VOLUMEFLAG_RESET	1	/* reload this info on next use */
--- 12,29 ----
  
  typedef struct cm_volume {
  	struct cm_cell *cellp;		/* never changes */
!     char *namep;			/* by cm_volumeLock */
  	unsigned long rwID;		/* by cm_volumeLock */
  	unsigned long roID;		/* by cm_volumeLock */
  	unsigned long bkID;		/* by cm_volumeLock */
!     struct cm_volume *nextp;	/* by cm_volumeLock */
  	struct cm_fid *dotdotFidp;	/* parent of volume root */
!     osi_mutex_t mx;
!     long flags;			/* by mx */
!     int refCount;			/* by cm_volumeLock */
!     cm_serverRef_t *rwServersp;	/* by mx */
!     cm_serverRef_t *roServersp;	/* by mx */
!     cm_serverRef_t *bkServersp;	/* by mx */
  } cm_volume_t;
  
  #define CM_VOLUMEFLAG_RESET	1	/* reload this info on next use */
***************
*** 43,49 ****
  extern void cm_ForceUpdateVolume(struct cm_fid *fidp, cm_user_t *userp,
  	cm_req_t *reqp);
  
! extern cm_serverRef_t *cm_GetVolServers(cm_volume_t *volp, unsigned long volume);
  
  extern void cm_ChangeRankVolume(cm_server_t *tsp);
  
--- 43,49 ----
  extern void cm_ForceUpdateVolume(struct cm_fid *fidp, cm_user_t *userp,
  	cm_req_t *reqp);
  
! extern cm_serverRef_t **cm_GetVolServers(cm_volume_t *volp, unsigned long volume);
  
  extern void cm_ChangeRankVolume(cm_server_t *tsp);
  
Index: openafs/src/WINNT/afsd/logon_ad.cpp
diff -c openafs/src/WINNT/afsd/logon_ad.cpp:1.5 openafs/src/WINNT/afsd/logon_ad.cpp:1.6
*** openafs/src/WINNT/afsd/logon_ad.cpp:1.5	Thu Jul 22 19:21:06 2004
--- openafs/src/WINNT/afsd/logon_ad.cpp	Wed Aug  4 15:30:03 2004
***************
*** 244,252 ****
                      BSTR bstr;
  
                      hr = pNto-&gt;Get(ADS_NAME_TYPE_1779, &amp;bstr);
!                     wcscpy(adsPath, bstr);
  
!                     SysFreeString(bstr);
                  }
              }
              pNto-&gt;Release();
--- 244,258 ----
                      BSTR bstr;
  
                      hr = pNto-&gt;Get(ADS_NAME_TYPE_1779, &amp;bstr);
!                     if(SUCCEEDED(hr)) {
!                         hr = StringCchCopyW(adsPath, MAX_PATH, bstr);
!                         if(FAILED(hr)) {
!                             DebugEvent("Overflow while copying ADS path");
!                             adsPath[0] = L'\0';
!                         }
  
!                         SysFreeString(bstr);
!                     }
                  }
              }
              pNto-&gt;Release();
***************
*** 349,355 ****
  	}
  }
  
! BOOL GetLocalShortDomain(PWSTR Domain)
  {
      HRESULT hr;
      IADsADSystemInfo *pADsys;
--- 355,361 ----
  	}
  }
  
! BOOL GetLocalShortDomain(PWSTR Domain, DWORD cbDomain)
  {
      HRESULT hr;
      IADsADSystemInfo *pADsys;
***************
*** 370,378 ****
  
          hr = pADsys-&gt;get_DomainShortName(&amp;bstr);
          if ( !FAILED(hr) ) {
!             wcscpy( Domain, bstr );
              SysFreeString(bstr);
-             retval = TRUE;
          }
          pADsys-&gt;Release();
      }
--- 376,386 ----
  
          hr = pADsys-&gt;get_DomainShortName(&amp;bstr);
          if ( !FAILED(hr) ) {
!             hr = StringCbCopyW( Domain, cbDomain, bstr );
!             if(SUCCEEDED(hr)) {
!                 retval = TRUE;
!             }
              SysFreeString(bstr);
          }
          pADsys-&gt;Release();
      }
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.51 openafs/src/WINNT/afsd/smb.c:1.55
*** openafs/src/WINNT/afsd/smb.c:1.51	Mon Jul 26 19:22:20 2004
--- openafs/src/WINNT/afsd/smb.c	Sun Aug  8 12:55:28 2004
***************
*** 98,104 ****
  NCB *NCBs[NCBmax];
  struct smb_packet *bufs[NCBmax];
  
! #define Sessionmax MAXIMUM_WAIT_OBJECTS
  EVENT_HANDLE SessionEvents[Sessionmax];
  unsigned short LSNs[Sessionmax];
  int lanas[Sessionmax];
--- 98,104 ----
  NCB *NCBs[NCBmax];
  struct smb_packet *bufs[NCBmax];
  
! #define Sessionmax MAXIMUM_WAIT_OBJECTS - 4
  EVENT_HANDLE SessionEvents[Sessionmax];
  unsigned short LSNs[Sessionmax];
  int lanas[Sessionmax];
***************
*** 156,162 ****
   * Time in Unix format of midnight, 1/1/1970 local time.
   * When added to dosUTime, gives Unix (AFS) time.
   */
! long smb_localZero;
  
  /* Time difference for converting to kludge-GMT */
  int smb_NowTZ;
--- 156,162 ----
   * Time in Unix format of midnight, 1/1/1970 local time.
   * When added to dosUTime, gives Unix (AFS) time.
   */
! long smb_localZero = 0;
  
  /* Time difference for converting to kludge-GMT */
  int smb_NowTZ;
***************
*** 432,438 ****
  }
  
  #ifndef DJGPP
! void ShowUnixTime(char *FuncName, long unixTime)
  {
  	FILETIME ft;
  	WORD wDate, wTime;
--- 432,438 ----
  }
  
  #ifndef DJGPP
! void ShowUnixTime(char *FuncName, afs_uint32 unixTime)
  {
  	FILETIME ft;
  	WORD wDate, wTime;
***************
*** 583,589 ****
  }
  
  #ifndef DJGPP
! void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime)
  {
  	struct tm *ltp;
  	SYSTEMTIME stm;
--- 583,589 ----
  }
  
  #ifndef DJGPP
! void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, afs_uint32 unixTime)
  {
  	struct tm *ltp;
  	SYSTEMTIME stm;
***************
*** 623,629 ****
  	SystemTimeToFileTime(&amp;stm, largeTimep);
  }
  #else /* DJGPP */
! void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime)
  {
  	/* unixTime: seconds since 1/1/1970 00:00:00 GMT */
  	/* FILETIME: 100ns intervals since 1/1/1601 00:00:00 ??? */
--- 623,629 ----
  	SystemTimeToFileTime(&amp;stm, largeTimep);
  }
  #else /* DJGPP */
! void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, afs_uint32 unixTime)
  {
  	/* unixTime: seconds since 1/1/1970 00:00:00 GMT */
  	/* FILETIME: 100ns intervals since 1/1/1601 00:00:00 ??? */
***************
*** 645,651 ****
  #endif /* !DJGPP */
  
  #ifndef DJGPP
! void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep)
  {
  	SYSTEMTIME stm;
  	struct tm lt;
--- 645,651 ----
  #endif /* !DJGPP */
  
  #ifndef DJGPP
! void smb_UnixTimeFromLargeSearchTime(afs_uint32 *unixTimep, FILETIME *largeTimep)
  {
  	SYSTEMTIME stm;
  	struct tm lt;
***************
*** 668,674 ****
  	_timezone = save_timezone;
  }
  #else /* DJGPP */
! void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep)
  {
  	/* unixTime: seconds since 1/1/1970 00:00:00 GMT */
  	/* FILETIME: 100ns intervals since 1/1/1601 00:00:00 GMT? */
--- 668,674 ----
  	_timezone = save_timezone;
  }
  #else /* DJGPP */
! void smb_UnixTimeFromLargeSearchTime(afs_uint32 *unixTimep, FILETIME *largeTimep)
  {
  	/* unixTime: seconds since 1/1/1970 00:00:00 GMT */
  	/* FILETIME: 100ns intervals since 1/1/1601 00:00:00 GMT? */
***************
*** 689,695 ****
  }
  #endif /* !DJGPP */
  
! void smb_SearchTimeFromUnixTime(long *dosTimep, long unixTime)
  {
  	struct tm *ltp;
  	int dosDate;
--- 689,695 ----
  }
  #endif /* !DJGPP */
  
! void smb_SearchTimeFromUnixTime(long *dosTimep, afs_uint32 unixTime)
  {
  	struct tm *ltp;
  	int dosDate;
***************
*** 714,720 ****
  	*dosTimep = (dosDate&lt;&lt;16) | dosTime;
  }	
  
! void smb_UnixTimeFromSearchTime(long *unixTimep, long searchTime)
  {
  	unsigned short dosDate;
  	unsigned short dosTime;
--- 714,720 ----
  	*dosTimep = (dosDate&lt;&lt;16) | dosTime;
  }	
  
! void smb_UnixTimeFromSearchTime(afs_uint32 *unixTimep, long searchTime)
  {
  	unsigned short dosDate;
  	unsigned short dosTime;
***************
*** 734,745 ****
  	*unixTimep = mktime(&amp;localTm);
  }
  
! void smb_DosUTimeFromUnixTime(long *dosUTimep, long unixTime)
  {
  	*dosUTimep = unixTime - smb_localZero;
  }
  
! void smb_UnixTimeFromDosUTime(long *unixTimep, long dosTime)
  {
  #ifndef DJGPP
  	*unixTimep = dosTime + smb_localZero;
--- 734,745 ----
  	*unixTimep = mktime(&amp;localTm);
  }
  
! void smb_DosUTimeFromUnixTime(afs_uint32 *dosUTimep, afs_uint32 unixTime)
  {
  	*dosUTimep = unixTime - smb_localZero;
  }
  
! void smb_UnixTimeFromDosUTime(afs_uint32 *unixTimep, afs_uint32 dosTime)
  {
  #ifndef DJGPP
  	*unixTimep = dosTime + smb_localZero;
***************
*** 896,902 ****
  	for(uidp = vcp-&gt;usersp; uidp; uidp = uidp-&gt;nextp) {
  		if (uid == uidp-&gt;userID) {
  			uidp-&gt;refCount++;
! 			osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",(int)vcp,uidp-&gt;userID,(uidp-&gt;unp) ? uidp-&gt;unp-&gt;name : "");
          	break;
  		}
  	}
--- 896,904 ----
  	for(uidp = vcp-&gt;usersp; uidp; uidp = uidp-&gt;nextp) {
  		if (uid == uidp-&gt;userID) {
  			uidp-&gt;refCount++;
!                         osi_LogEvent("AFS smb_FindUID (Find by UID)",NULL," VCP[%x] found-uid[%d] name[%s]",
!                                       (int)vcp, uidp-&gt;userID, 
!                                       osi_LogSaveString(smb_logp, (uidp-&gt;unp) ? uidp-&gt;unp-&gt;name : ""));
          	break;
  		}
  	}
***************
*** 1101,1107 ****
          sprintf(eventName,"fid_t event vcp=%d fid=%d", vcp-&gt;vcID, fid);
          event = thrd_CreateEvent(NULL, FALSE, TRUE, eventName);
          if ( GetLastError() == ERROR_ALREADY_EXISTS ) {
!             afsi_log("Event Object Already Exists: %s", eventName);
              thrd_CloseHandle(event);
              fid++;
              if (fid == 0)
--- 1103,1109 ----
          sprintf(eventName,"fid_t event vcp=%d fid=%d", vcp-&gt;vcID, fid);
          event = thrd_CreateEvent(NULL, FALSE, TRUE, eventName);
          if ( GetLastError() == ERROR_ALREADY_EXISTS ) {
!             osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
              thrd_CloseHandle(event);
              fid++;
              if (fid == 0)
***************
*** 1736,1747 ****
              signed int retval =
                  __dpmi_allocate_dos_memory(npar, &amp;tb_sel); /* DOS segment */
              if (retval == -1) {
!                 afsi_log("Cannot allocate %d paragraphs of DOS memory",
                            npar);
                  osi_panic("",__FILE__,__LINE__);
              }
              else {
!                 afsi_log("Allocated %d paragraphs of DOS mem at 0x%X",
                            npar, retval);
                  seg = retval;
              }
--- 1738,1749 ----
              signed int retval =
                  __dpmi_allocate_dos_memory(npar, &amp;tb_sel); /* DOS segment */
              if (retval == -1) {
!                 osi_Log1(smb_logp, "Cannot allocate %d paragraphs of DOS memory",
                            npar);
                  osi_panic("",__FILE__,__LINE__);
              }
              else {
!                 osi_Log2(smb_logp, "Allocated %d paragraphs of DOS mem at 0x%X",
                            npar, retval);
                  seg = retval;
              }
***************
*** 1787,1797 ****
              signed int retval =
                  __dpmi_allocate_dos_memory(npar, &amp;tb_sel); /* DOS segment */
              if (retval == -1) {
!                 afsi_log("Cannot allocate %d paragraphs of DOS mem in GetNCB",
                            npar);
                  osi_panic("",__FILE__,__LINE__);
              } else {
!                 afsi_log("Allocated %d paragraphs of DOS mem at 0x%X in GetNCB",
                            npar, retval);
                  seg = retval;
              }
--- 1789,1799 ----
              signed int retval =
                  __dpmi_allocate_dos_memory(npar, &amp;tb_sel); /* DOS segment */
              if (retval == -1) {
!                 osi_Log1(smb_logp, "Cannot allocate %d paragraphs of DOS mem in GetNCB",
                            npar);
                  osi_panic("",__FILE__,__LINE__);
              } else {
!                 osi_Log2(smb_logp, "Allocated %d paragraphs of DOS mem at 0x%X in GetNCB",
                            npar, retval);
                  seg = retval;
              }
***************
*** 1888,1911 ****
  	parmCount = *smbp-&gt;wctp;
  
  	if (parm &gt;= parmCount) {
  #ifndef DJGPP
          HANDLE h;
  		char *ptbuf[1];
- 		char s[100];
  		h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
  		sprintf(s, "Bad SMB param %d out of %d, ncb len %d",
  				parm, parmCount, smbp-&gt;ncb_length);
  		ptbuf[0] = s;
  		ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL,
  					1, smbp-&gt;ncb_length, ptbuf, smbp);
  		DeregisterEventSource(h);
! #else /* DJGPP */
! 		char s[100];
! 
! 		sprintf(s, "Bad SMB param %d out of %d, ncb len %d",
! 				parm, parmCount, smbp-&gt;ncb_length);
! 		osi_Log0(smb_logp, s);
! #endif /* !DJGPP */
  		osi_panic(s, __FILE__, __LINE__);
  	}
  	parmDatap = smbp-&gt;wctp + (2*parm) + 1;
--- 1890,1910 ----
  	parmCount = *smbp-&gt;wctp;
  
  	if (parm &gt;= parmCount) {
+ 		char s[100];
  #ifndef DJGPP
          HANDLE h;
  		char *ptbuf[1];
  		h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
+ #endif
  		sprintf(s, "Bad SMB param %d out of %d, ncb len %d",
  				parm, parmCount, smbp-&gt;ncb_length);
+ #ifndef DJGPP
  		ptbuf[0] = s;
  		ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL,
  					1, smbp-&gt;ncb_length, ptbuf, smbp);
  		DeregisterEventSource(h);
! #endif
!         osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
  		osi_panic(s, __FILE__, __LINE__);
  	}
  	parmDatap = smbp-&gt;wctp + (2*parm) + 1;
***************
*** 1922,1947 ****
  	parmCount = *smbp-&gt;wctp;
  
  	if (parm * 2 + offset &gt;= parmCount * 2) {
  #ifndef DJGPP
  		HANDLE h;
  		char *ptbuf[1];
- 		char s[100];
  		h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
  		sprintf(s, "Bad SMB param %d offset %d out of %d, ncb len %d",
  				parm, offset, parmCount, smbp-&gt;ncb_length);
! 		ptbuf[0] = s;
  		ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL,
  					1, smbp-&gt;ncb_length, ptbuf, smbp);
  		DeregisterEventSource(h);
! #else /* DJGPP */
! 		char s[100];
!                 
! 		sprintf(s, "Bad SMB param %d offset %d out of %d, "
! 				"ncb len %d",
! 				 parm, offset, parmCount, smbp-&gt;ncb_length);
! 		osi_Log0(smb_logp, s);
! #endif /* !DJGPP */
! 
  		osi_panic(s, __FILE__, __LINE__);
  	}
  	parmDatap = smbp-&gt;wctp + (2*parm) + 1 + offset;
--- 1921,1941 ----
  	parmCount = *smbp-&gt;wctp;
  
  	if (parm * 2 + offset &gt;= parmCount * 2) {
+ 		char s[100];
  #ifndef DJGPP
  		HANDLE h;
  		char *ptbuf[1];
  		h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
+ #endif
  		sprintf(s, "Bad SMB param %d offset %d out of %d, ncb len %d",
  				parm, offset, parmCount, smbp-&gt;ncb_length);
! #ifndef DJGPP
!         ptbuf[0] = s;
  		ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 1006, NULL,
  					1, smbp-&gt;ncb_length, ptbuf, smbp);
  		DeregisterEventSource(h);
! #endif
!         osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
  		osi_panic(s, __FILE__, __LINE__);
  	}
  	parmDatap = smbp-&gt;wctp + (2*parm) + 1 + offset;
***************
*** 2811,2823 ****
  
  void smb_Daemon(void *parmp)
  {
! 	int count = 0;
  
  	while(1) {
  		count++;
  		thrd_Sleep(10000);
! 		if ((count % 360) == 0)	{	/* every hour */
              struct tm myTime;
  		 
              /* Initialize smb_localZero */
              myTime.tm_isdst = -1;		/* compute whether on DST or not */
--- 2805,2818 ----
  
  void smb_Daemon(void *parmp)
  {
! 	afs_uint32 count = 0;
  
  	while(1) {
  		count++;
  		thrd_Sleep(10000);
! 		if ((count % 72) == 0)	{	/* every five minutes */
              struct tm myTime;
+             long old_localZero = smb_localZero;
  		 
              /* Initialize smb_localZero */
              myTime.tm_isdst = -1;		/* compute whether on DST or not */
***************
*** 2830,2835 ****
--- 2825,2835 ----
              smb_localZero = mktime(&amp;myTime);
  
              smb_CalculateNowTZ();
+ 
+ #ifdef AFS_FREELANCE
+             if ( smb_localZero != old_localZero )
+                 cm_noteLocalMountPointChange();
+ #endif
          }
  		/* XXX GC dir search entries */
  	}
***************
*** 3177,3193 ****
  
  	for(patchp = *dirPatchespp; patchp; patchp =
  		 (smb_dirListPatch_t *) osi_QNext(&amp;patchp-&gt;q)) {
! 		code = cm_GetSCache(&amp;patchp-&gt;fid, &amp;scp, userp, reqp);
! 		if (code) continue;
  		lock_ObtainMutex(&amp;scp-&gt;mx);
  		code = cm_SyncOp(scp, NULL, userp, reqp, 0,
  						  CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
  		if (code) {	
  			lock_ReleaseMutex(&amp;scp-&gt;mx);
  			cm_ReleaseSCache(scp);
  			continue;
  		}
- 		dptr = patchp-&gt;dptr;
  
  		attr = smb_Attributes(scp);
          /* check hidden attribute (the flag is only ON when dot file hiding is on ) */
--- 3177,3201 ----
  
  	for(patchp = *dirPatchespp; patchp; patchp =
  		 (smb_dirListPatch_t *) osi_QNext(&amp;patchp-&gt;q)) {
! 
!         dptr = patchp-&gt;dptr;
! 
!         code = cm_GetSCache(&amp;patchp-&gt;fid, &amp;scp, userp, reqp);
!         if (code) {
!             if( patchp-&gt;flags &amp; SMB_DIRLISTPATCH_DOTFILE )
!                 *dptr++ = SMB_ATTR_HIDDEN;
!             continue;
!         }
  		lock_ObtainMutex(&amp;scp-&gt;mx);
  		code = cm_SyncOp(scp, NULL, userp, reqp, 0,
  						  CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
  		if (code) {	
  			lock_ReleaseMutex(&amp;scp-&gt;mx);
  			cm_ReleaseSCache(scp);
+             if( patchp-&gt;flags &amp; SMB_DIRLISTPATCH_DOTFILE )
+                 *dptr++ = SMB_ATTR_HIDDEN;
  			continue;
  		}
  
  		attr = smb_Attributes(scp);
          /* check hidden attribute (the flag is only ON when dot file hiding is on ) */
***************
*** 3195,3201 ****
              attr |= SMB_ATTR_HIDDEN;
          *dptr++ = attr;
  
! 		/* get dos time */
  		smb_SearchTimeFromUnixTime(&amp;dosTime, scp-&gt;clientModTime);
                  
  		/* copy out time */
--- 3203,3209 ----
              attr |= SMB_ATTR_HIDDEN;
          *dptr++ = attr;
  
!         /* get dos time */
  		smb_SearchTimeFromUnixTime(&amp;dosTime, scp-&gt;clientModTime);
                  
  		/* copy out time */
***************
*** 3596,3602 ****
  				fid.unique = ntohl(dep-&gt;fid.unique);
  				fileType = cm_FindFileType(&amp;fid);
  				osi_Log2(smb_logp, "smb_ReceiveCoreSearchDir: file %s "
! 						  "has filetype %d", dep-&gt;name,
  						  fileType);
  				if (fileType == CM_SCACHETYPE_DIRECTORY)
  					goto nextEntry;
--- 3604,3610 ----
  				fid.unique = ntohl(dep-&gt;fid.unique);
  				fileType = cm_FindFileType(&amp;fid);
  				osi_Log2(smb_logp, "smb_ReceiveCoreSearchDir: file %s "
!                                                   "has filetype %d", osi_LogSaveString(smb_logp, dep-&gt;name),
  						  fileType);
  				if (fileType == CM_SCACHETYPE_DIRECTORY)
  					goto nextEntry;
***************
*** 4467,4473 ****
      /* Check if the file already exists; if so return error */
  	code = cm_Lookup(newDscp,newLastNamep,CM_FLAG_CHECKPATH,userp,&amp;req,&amp;tmpscp);
  	if ((code != CM_ERROR_NOSUCHFILE) &amp;&amp; (code != CM_ERROR_NOSUCHPATH) &amp;&amp; (code != CM_ERROR_NOSUCHVOLUME) ) {
!         osi_Log2(afsd_logp, "  lookup returns %ld for [%s]", code,
                   osi_LogSaveString(afsd_logp, newLastNamep));
   
          /* Check if the old and the new names differ only in case. If so return
--- 4475,4481 ----
      /* Check if the file already exists; if so return error */
  	code = cm_Lookup(newDscp,newLastNamep,CM_FLAG_CHECKPATH,userp,&amp;req,&amp;tmpscp);
  	if ((code != CM_ERROR_NOSUCHFILE) &amp;&amp; (code != CM_ERROR_NOSUCHPATH) &amp;&amp; (code != CM_ERROR_NOSUCHVOLUME) ) {
!         osi_Log2(smb_logp, "  lookup returns %ld for [%s]", code,
                   osi_LogSaveString(afsd_logp, newLastNamep));
   
          /* Check if the old and the new names differ only in case. If so return
***************
*** 4489,4495 ****
              }
          } else {
              /* file exist, do not rename, also fixes move */
!             osi_Log0(afsd_logp, "Can't rename.  Target already exists");
              code = CM_ERROR_EXISTS;
          }
  
--- 4497,4503 ----
              }
          } else {
              /* file exist, do not rename, also fixes move */
!             osi_Log0(smb_logp, "Can't rename.  Target already exists");
              code = CM_ERROR_EXISTS;
          }
  
***************
*** 5956,5965 ****
  			1, ncbp-&gt;ncb_length, ptbuf, inp);
  		DeregisterEventSource(h);
  #else /* DJGPP */
!         osi_Log1(smb_logp, "SMB message too short, len %d",
!                  ncbp-&gt;ncb_length);
  #endif /* !DJGPP */
- 
  		return;
  	}
  
--- 5964,5971 ----
  			1, ncbp-&gt;ncb_length, ptbuf, inp);
  		DeregisterEventSource(h);
  #else /* DJGPP */
!         osi_Log1(smb_logp, "SMB message too short, len %d", ncbp-&gt;ncb_length);
  #endif /* !DJGPP */
  		return;
  	}
  
***************
*** 6040,6049 ****
  				ReportEvent(h, EVENTLOG_WARNING_TYPE, 0,
                              1005, NULL, 1, ncbp-&gt;ncb_length, ptbuf, smbp);
  				DeregisterEventSource(h);
! #else /* DJGPP */
  				osi_Log1(smb_logp, "Pkt straddled session startup, "
                           "ncb length %d", ncbp-&gt;ncb_length);
- #endif /* !DJGPP */
  			}
          }
          else {
--- 6046,6054 ----
  				ReportEvent(h, EVENTLOG_WARNING_TYPE, 0,
                              1005, NULL, 1, ncbp-&gt;ncb_length, ptbuf, smbp);
  				DeregisterEventSource(h);
! #endif /* !DJGPP */
  				osi_Log1(smb_logp, "Pkt straddled session startup, "
                           "ncb length %d", ncbp-&gt;ncb_length);
  			}
          }
          else {
***************
*** 6084,6093 ****
  #ifdef NOTSERVICE
              smb_LogPacket(inp);
  #endif /* NOTSERVICE */
! #else /* DJGPP */
              osi_Log1(smb_logp, "Invalid SMB message, length %d",
                       ncbp-&gt;ncb_length);
- #endif /* !DJGPP */
  
  			code = CM_ERROR_INVAL;
  		}
--- 6089,6097 ----
  #ifdef NOTSERVICE
              smb_LogPacket(inp);
  #endif /* NOTSERVICE */
! #endif /* !DJGPP */
              osi_Log1(smb_logp, "Invalid SMB message, length %d",
                       ncbp-&gt;ncb_length);
  
  			code = CM_ERROR_INVAL;
  		}
***************
*** 6241,6263 ****
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numNCBs))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             afsi_log("Error: smb_ClientWaiter event %d abandoned, errno %d\n", abandonIdx, GetLastError());
          }
  
          if (code == WAIT_IO_COMPLETION)
          {
!             afsi_log("Error: smb_ClientWaiter WAIT_IO_COMPLETION\n");
              continue;
          }
          
          if (code == WAIT_TIMEOUT)
          {
!             afsi_log("Error: smb_ClientWaiter WAIT_TIMEOUT, errno %d\n", GetLastError());
          }
  
          if (code == WAIT_FAILED)
          {
!             afsi_log("Error: smb_ClientWaiter WAIT_FAILED, errno %d\n", GetLastError());
          }
  
          idx = code - WAIT_OBJECT_0;
--- 6245,6267 ----
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numNCBs))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             osi_Log2(smb_logp, "Error: smb_ClientWaiter event %d abandoned, errno %d\n", abandonIdx, GetLastError());
          }
  
          if (code == WAIT_IO_COMPLETION)
          {
!             osi_Log0(smb_logp, "Error: smb_ClientWaiter WAIT_IO_COMPLETION\n");
              continue;
          }
          
          if (code == WAIT_TIMEOUT)
          {
!             osi_Log1(smb_logp, "Error: smb_ClientWaiter WAIT_TIMEOUT, errno %d\n", GetLastError());
          }
  
          if (code == WAIT_FAILED)
          {
!             osi_Log1(smb_logp, "Error: smb_ClientWaiter WAIT_FAILED, errno %d\n", GetLastError());
          }
  
          idx = code - WAIT_OBJECT_0;
***************
*** 6266,6272 ****
          if (idx &lt; 0 || idx &gt; (sizeof(NCBevents) / sizeof(NCBevents[0])))
          {
              /* this is fatal - log as much as possible */
!             afsi_log("Fatal: NCBevents idx [ %d ] out of range.\n", idx);
              osi_assert(0);
          }
          
--- 6270,6276 ----
          if (idx &lt; 0 || idx &gt; (sizeof(NCBevents) / sizeof(NCBevents[0])))
          {
              /* this is fatal - log as much as possible */
!             osi_Log1(smb_logp, "Fatal: NCBevents idx [ %d ] out of range.\n", idx);
              osi_assert(0);
          }
          
***************
*** 6299,6321 ****
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numSessions))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             afsi_log("Error: smb_ServerWaiter (SessionEvents) event %d abandoned, errno %d\n", abandonIdx, GetLastError());
          }
  	
          if (code == WAIT_IO_COMPLETION)
          {
!             afsi_log("Error: smb_ServerWaiter (SessionEvents) WAIT_IO_COMPLETION\n");
              continue;
          }
  	
          if (code == WAIT_TIMEOUT)
          {
!             afsi_log("Error: smb_ServerWaiter (SessionEvents) WAIT_TIMEOUT, errno %d\n", GetLastError());
          }
  	
          if (code == WAIT_FAILED)
          {
!             afsi_log("Error: smb_ServerWaiter (SessionEvents) WAIT_FAILED, errno %d\n", GetLastError());
          }
  	
          idx_session = code - WAIT_OBJECT_0;
--- 6303,6325 ----
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numSessions))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             osi_Log2(smb_logp, "Error: smb_ServerWaiter (SessionEvents) event %d abandoned, errno %d\n", abandonIdx, GetLastError());
          }
  	
          if (code == WAIT_IO_COMPLETION)
          {
!             osi_Log0(smb_logp, "Error: smb_ServerWaiter (SessionEvents) WAIT_IO_COMPLETION\n");
              continue;
          }
  	
          if (code == WAIT_TIMEOUT)
          {
!             osi_Log1(smb_logp, "Error: smb_ServerWaiter (SessionEvents) WAIT_TIMEOUT, errno %d\n", GetLastError());
          }
  	
          if (code == WAIT_FAILED)
          {
!             osi_Log1(smb_logp, "Error: smb_ServerWaiter (SessionEvents) WAIT_FAILED, errno %d\n", GetLastError());
          }
  	
          idx_session = code - WAIT_OBJECT_0;
***************
*** 6324,6330 ****
          if (idx_session &lt; 0 || idx_session &gt; (sizeof(SessionEvents) / sizeof(SessionEvents[0])))
          {
              /* this is fatal - log as much as possible */
!             afsi_log("Fatal: session idx [ %d ] out of range.\n", idx_session);
              osi_assert(0);
          }
  
--- 6328,6334 ----
          if (idx_session &lt; 0 || idx_session &gt; (sizeof(SessionEvents) / sizeof(SessionEvents[0])))
          {
              /* this is fatal - log as much as possible */
!             osi_Log1(smb_logp, "Fatal: session idx [ %d ] out of range.\n", idx_session);
              osi_assert(0);
          }
  
***************
*** 6339,6361 ****
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numNCBs))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             afsi_log("Error: smb_ClientWaiter (NCBavails) event %d abandoned, errno %d\n", abandonIdx, GetLastError());
          }
  	
          if (code == WAIT_IO_COMPLETION)
          {
!             afsi_log("Error: smb_ClientWaiter (NCBavails) WAIT_IO_COMPLETION\n");
              continue;
          }
  	
          if (code == WAIT_TIMEOUT)
          {
!             afsi_log("Error: smb_ClientWaiter (NCBavails) WAIT_TIMEOUT, errno %d\n", GetLastError());
          }
  	
          if (code == WAIT_FAILED)
          {
!             afsi_log("Error: smb_ClientWaiter (NCBavails) WAIT_FAILED, errno %d\n", GetLastError());
          }
  		
          idx_NCB = code - WAIT_OBJECT_0;
--- 6343,6365 ----
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numNCBs))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             osi_Log2(smb_logp, "Error: smb_ClientWaiter (NCBavails) event %d abandoned, errno %d\n", abandonIdx, GetLastError());
          }
  	
          if (code == WAIT_IO_COMPLETION)
          {
!             osi_Log0(smb_logp, "Error: smb_ClientWaiter (NCBavails) WAIT_IO_COMPLETION\n");
              continue;
          }
  	
          if (code == WAIT_TIMEOUT)
          {
!             osi_Log1(smb_logp, "Error: smb_ClientWaiter (NCBavails) WAIT_TIMEOUT, errno %d\n", GetLastError());
          }
  	
          if (code == WAIT_FAILED)
          {
!             osi_Log1(smb_logp, "Error: smb_ClientWaiter (NCBavails) WAIT_FAILED, errno %d\n", GetLastError());
          }
  		
          idx_NCB = code - WAIT_OBJECT_0;
***************
*** 6364,6370 ****
          if (idx_NCB &lt; 0 || idx_NCB &gt; (sizeof(NCBsessions) / sizeof(NCBsessions[0])))
          {
              /* this is fatal - log as much as possible */
!             afsi_log("Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB);
              osi_assert(0);
          }
  
--- 6368,6374 ----
          if (idx_NCB &lt; 0 || idx_NCB &gt; (sizeof(NCBsessions) / sizeof(NCBsessions[0])))
          {
              /* this is fatal - log as much as possible */
!             osi_Log1(smb_logp, "Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB);
              osi_assert(0);
          }
  
***************
*** 6448,6470 ****
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numNCBs))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             afsi_log("Error: smb_Server ( NCBreturns[%d] ) event %d abandoned, errno %d\n", myIdx, abandonIdx, GetLastError());
          }
  	
          if (code == WAIT_IO_COMPLETION)
          {
!             afsi_log("Error: smb_Server ( NCBreturns[%d] ) WAIT_IO_COMPLETION\n", myIdx);
              continue;
          }
  	
          if (code == WAIT_TIMEOUT)
          {
!             afsi_log("Error: smb_Server ( NCBreturns[%d] ) WAIT_TIMEOUT, errno %d\n", myIdx, GetLastError());
          }
  	
          if (code == WAIT_FAILED)
          {
!             afsi_log("Error: smb_Server ( NCBreturns[%d] ) WAIT_FAILED, errno %d\n", myIdx, GetLastError());
          }
  
          idx_NCB = code - WAIT_OBJECT_0;
--- 6452,6474 ----
          if (code &gt;= WAIT_ABANDONED_0 &amp;&amp; code &lt; (WAIT_ABANDONED_0 + numNCBs))
          {
              int abandonIdx = code - WAIT_ABANDONED_0;
!             osi_Log3(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) event %d abandoned, errno %d\n", myIdx, abandonIdx, GetLastError());
          }
  	
          if (code == WAIT_IO_COMPLETION)
          {
!             osi_Log1(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) WAIT_IO_COMPLETION\n", myIdx);
              continue;
          }
  	
          if (code == WAIT_TIMEOUT)
          {
!             osi_Log2(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) WAIT_TIMEOUT, errno %d\n", myIdx, GetLastError());
          }
  	
          if (code == WAIT_FAILED)
          {
!             osi_Log2(smb_logp, "Error: smb_Server ( NCBreturns[%d] ) WAIT_FAILED, errno %d\n", myIdx, GetLastError());
          }
  
          idx_NCB = code - WAIT_OBJECT_0;
***************
*** 6473,6479 ****
          if (idx_NCB &lt; 0 || idx_NCB &gt; (sizeof(NCBs) / sizeof(NCBs[0])))
          {
              /* this is fatal - log as much as possible */
!             afsi_log("Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB);
              osi_assert(0);
          }
  
--- 6477,6483 ----
          if (idx_NCB &lt; 0 || idx_NCB &gt; (sizeof(NCBs) / sizeof(NCBs[0])))
          {
              /* this is fatal - log as much as possible */
!             osi_Log1(smb_logp, "Fatal: idx_NCB [ %d ] out of range.\n", idx_NCB);
              osi_assert(0);
          }
  
***************
*** 6501,6507 ****
  				/* Client closed session */
                  if (reportSessionStartups) 
                  {
!                     afsi_log("session [ %d ] closed", idx_session);
                  }
  				dead_sessions[idx_session] = TRUE;
                  if (vcp)
--- 6505,6511 ----
  				/* Client closed session */
                  if (reportSessionStartups) 
                  {
!                     osi_Log1(smb_logp, "session [ %d ] closed", idx_session);
                  }
  				dead_sessions[idx_session] = TRUE;
                  if (vcp)
***************
*** 6548,6555 ****
  					char *ptbuf[1];
  					char s[100];
  
- 					osi_Log1(smb_logp, "dispatch smb recv failed, message incomplete, ncb_length %d",
-                              ncbp-&gt;ncb_length);
  					h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
  					sprintf(s, "SMB message incomplete, length %d",
                              ncbp-&gt;ncb_length);
--- 6552,6557 ----
***************
*** 6559,6572 ****
                                  ncbp-&gt;ncb_length, ptbuf,
                                  bufp);
  					DeregisterEventSource(h);
! #else /* DJGPP */
  					osi_Log1(smb_logp,
                                "dispatch smb recv failed, message incomplete, ncb_length %d",
                                ncbp-&gt;ncb_length);
                      osi_Log1(smb_logp,
                                "SMB message incomplete, "
                                "length %d", ncbp-&gt;ncb_length);
- #endif /* !DJGPP */
  
  					/*
  					 * We used to discard the packet.
--- 6561,6573 ----
                                  ncbp-&gt;ncb_length, ptbuf,
                                  bufp);
  					DeregisterEventSource(h);
! #endif /* !DJGPP */
  					osi_Log1(smb_logp,
                                "dispatch smb recv failed, message incomplete, ncb_length %d",
                                ncbp-&gt;ncb_length);
                      osi_Log1(smb_logp,
                                "SMB message incomplete, "
                                "length %d", ncbp-&gt;ncb_length);
  
  					/*
  					 * We used to discard the packet.
***************
*** 6581,6587 ****
  				/* A weird error code.  Log it, sleep, and
  				 * continue. */
  				if (vcp &amp;&amp; vcp-&gt;errorCount++ &gt; 3) {
!                     afsi_log("session [ %d ] closed, vcp-&gt;errorCount = %d", idx_session, vcp-&gt;errorCount);
  					dead_sessions[idx_session] = TRUE;
                  }
  				else {
--- 6582,6588 ----
  				/* A weird error code.  Log it, sleep, and
  				 * continue. */
  				if (vcp &amp;&amp; vcp-&gt;errorCount++ &gt; 3) {
!                     osi_Log2(smb_logp, "session [ %d ] closed, vcp-&gt;errorCount = %d", idx_session, vcp-&gt;errorCount);
  					dead_sessions[idx_session] = TRUE;
                  }
  				else {
***************
*** 6681,6687 ****
  			if (rwc.code == 0) {
  				rwevent = thrd_CreateEvent(NULL, FALSE, FALSE, TEXT("smb_Server() rwevent"));
                  if ( GetLastError() == ERROR_ALREADY_EXISTS )
!                     afsi_log("Event Object Already Exists: %s", eventName);
  				ncbp-&gt;ncb_command = NCBRECV | ASYNCH;
  				ncbp-&gt;ncb_lsn = (unsigned char) vcp-&gt;lsn;
  				ncbp-&gt;ncb_lana_num = vcp-&gt;lana;
--- 6682,6688 ----
  			if (rwc.code == 0) {
  				rwevent = thrd_CreateEvent(NULL, FALSE, FALSE, TEXT("smb_Server() rwevent"));
                  if ( GetLastError() == ERROR_ALREADY_EXISTS )
!                     osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
  				ncbp-&gt;ncb_command = NCBRECV | ASYNCH;
  				ncbp-&gt;ncb_lsn = (unsigned char) vcp-&gt;lsn;
  				ncbp-&gt;ncb_lana_num = vcp-&gt;lana;
***************
*** 6773,6789 ****
      sprintf(eventName,"NCBavails[%d]", idx);
  	NCBavails[idx] = thrd_CreateEvent(NULL, FALSE, TRUE, eventName);
      if ( GetLastError() == ERROR_ALREADY_EXISTS )
!         afsi_log("Event Object Already Exists: %s", eventName);
  #ifndef DJGPP
      sprintf(eventName,"NCBevents[%d]", idx);
  	NCBevents[idx] = thrd_CreateEvent(NULL, TRUE, FALSE, eventName);
      if ( GetLastError() == ERROR_ALREADY_EXISTS )
!         afsi_log("Event Object Already Exists: %s", eventName);
  #endif /* !DJGPP */
      sprintf(eventName,"NCBReturns[0&lt;=i&lt;smb_NumServerThreads][%d]", idx);
  	retHandle = thrd_CreateEvent(NULL, FALSE, FALSE, eventName);
      if ( GetLastError() == ERROR_ALREADY_EXISTS )
!         afsi_log("Event Object Already Exists: %s", eventName);
  	for (i=0; i&lt;smb_NumServerThreads; i++)
  		NCBreturns[i][idx] = retHandle;
  	bufp = GetPacket();
--- 6774,6790 ----
      sprintf(eventName,"NCBavails[%d]", idx);
  	NCBavails[idx] = thrd_CreateEvent(NULL, FALSE, TRUE, eventName);
      if ( GetLastError() == ERROR_ALREADY_EXISTS )
!         osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
  #ifndef DJGPP
      sprintf(eventName,"NCBevents[%d]", idx);
  	NCBevents[idx] = thrd_CreateEvent(NULL, TRUE, FALSE, eventName);
      if ( GetLastError() == ERROR_ALREADY_EXISTS )
!         osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
  #endif /* !DJGPP */
      sprintf(eventName,"NCBReturns[0&lt;=i&lt;smb_NumServerThreads][%d]", idx);
  	retHandle = thrd_CreateEvent(NULL, FALSE, FALSE, eventName);
      if ( GetLastError() == ERROR_ALREADY_EXISTS )
!         osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
  	for (i=0; i&lt;smb_NumServerThreads; i++)
  		NCBreturns[i][idx] = retHandle;
  	bufp = GetPacket();
***************
*** 6928,6935 ****
  				"%s\n",
                  ncbp-&gt;ncb_lsn,ncbp-&gt;ncb_lana_num, rname);
  #endif
!         afsi_log("New session(ncb_lsn,ncb_lana_num) (%d,%d) starting from host %s, %d ongoing ops",
!                   ncbp-&gt;ncb_lsn,ncbp-&gt;ncb_lana_num, rname, ongoingOps);
  
          if (reportSessionStartups) {
  #ifndef DJGPP
--- 6929,6936 ----
  				"%s\n",
                  ncbp-&gt;ncb_lsn,ncbp-&gt;ncb_lana_num, rname);
  #endif
!         osi_Log4(smb_logp, "New session(ncb_lsn,ncb_lana_num) (%d,%d) starting from host %s, %d ongoing ops",
!                   ncbp-&gt;ncb_lsn,ncbp-&gt;ncb_lana_num, osi_LogSaveString(smb_logp, rname), ongoingOps);
  
          if (reportSessionStartups) {
  #ifndef DJGPP
***************
*** 6944,6958 ****
                          1, 0, ptbuf, NULL);
  			DeregisterEventSource(h);
  #else /* DJGPP */
-             afsi_log("NCBLISTEN completed, call from %s",rname);
-             osi_Log1(smb_logp, "SMB session startup, %d ongoing ops",
-                      ongoingOps);
              time(&amp;now);
              fprintf(stderr, "%s: New session %d starting from host %s\n",
                      asctime(localtime(&amp;now)), ncbp-&gt;ncb_lsn, rname);
              fflush(stderr);
  #endif /* !DJGPP */
  		}
  
          /* now ncbp-&gt;ncb_lsn is the connection ID */
          vcp = smb_FindVC(ncbp-&gt;ncb_lsn, SMB_FLAG_CREATE, ncbp-&gt;ncb_lana_num);
--- 6945,6959 ----
                          1, 0, ptbuf, NULL);
  			DeregisterEventSource(h);
  #else /* DJGPP */
              time(&amp;now);
              fprintf(stderr, "%s: New session %d starting from host %s\n",
                      asctime(localtime(&amp;now)), ncbp-&gt;ncb_lsn, rname);
              fflush(stderr);
  #endif /* !DJGPP */
  		}
+             osi_Log1(smb_logp, "NCBLISTEN completed, call from %s", osi_LogSaveString(smb_logp, rname));
+             osi_Log1(smb_logp, "SMB session startup, %d ongoing ops",
+                      ongoingOps);
  
          /* now ncbp-&gt;ncb_lsn is the connection ID */
          vcp = smb_FindVC(ncbp-&gt;ncb_lsn, SMB_FLAG_CREATE, ncbp-&gt;ncb_lana_num);
***************
*** 6964,6970 ****
          /* But don't look at session[0], it is reserved */
  		for (i = 1; i &lt; numSessions; i++) {
  			if (dead_sessions[i]) {
!                 afsi_log("connecting to dead session [ %d ]", i);
  				dead_sessions[i] = FALSE;
  				break;
  			}
--- 6965,6971 ----
          /* But don't look at session[0], it is reserved */
  		for (i = 1; i &lt; numSessions; i++) {
  			if (dead_sessions[i]) {
!                 osi_Log1(smb_logp, "connecting to dead session [ %d ]", i);
  				dead_sessions[i] = FALSE;
  				break;
  			}
***************
*** 6997,7005 ****
              sprintf(eventName, "SessionEvents[%d]", i);
              SessionEvents[i] = thrd_CreateEvent(NULL, FALSE, TRUE, eventName);
              if ( GetLastError() == ERROR_ALREADY_EXISTS )
!                 afsi_log("Event Object Already Exists: %s", eventName);
  			numSessions++;
!             afsi_log("increasing numNCBs [ %d ] numSessions [ %d ]", numNCBs, numSessions);
  			thrd_SetEvent(SessionEvents[0]);
  		} else {
  			thrd_SetEvent(SessionEvents[i]);
--- 6998,7006 ----
              sprintf(eventName, "SessionEvents[%d]", i);
              SessionEvents[i] = thrd_CreateEvent(NULL, FALSE, TRUE, eventName);
              if ( GetLastError() == ERROR_ALREADY_EXISTS )
!                 osi_Log1(smb_logp, "Event Object Already Exists: %s", osi_LogSaveString(smb_logp, eventName));
  			numSessions++;
!             osi_Log2(smb_logp, "increasing numNCBs [ %d ] numSessions [ %d ]", numNCBs, numSessions);
  			thrd_SetEvent(SessionEvents[0]);
  		} else {
  			thrd_SetEvent(SessionEvents[i]);
***************
*** 7047,7053 ****
          code = Netbios(ncbp);
          if (code != 0) {
              sprintf(s, "Netbios NCBENUM error code %d", code);
!             afsi_log(s);
              osi_panic(s, __FILE__, __LINE__);
          }
      }
--- 7048,7054 ----
          code = Netbios(ncbp);
          if (code != 0) {
              sprintf(s, "Netbios NCBENUM error code %d", code);
!             osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
              osi_panic(s, __FILE__, __LINE__);
          }
      }
***************
*** 7069,7079 ****
              code = ncbp-&gt;ncb_retcode;
          if (code != 0) {
              sprintf(s, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
!             afsi_log(s);
              lana_list.lana[i] = 255;  /* invalid lana */
          } else {
              sprintf(s, "Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
!             afsi_log(s);
          }
      }
  #else
--- 7070,7080 ----
              code = ncbp-&gt;ncb_retcode;
          if (code != 0) {
              sprintf(s, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
!             osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
              lana_list.lana[i] = 255;  /* invalid lana */
          } else {
              sprintf(s, "Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
!             osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
          }
      }
  #else
***************
*** 7096,7102 ****
      memset(smb_sharename,' ',NCBNAMSZ);
      memcpy(smb_sharename,smb_localNamep,len);
      sprintf(s, "lana_list.length %d", lana_list.length);
!     afsi_log(s);
  
      /* Keep the name so we can unregister it later */
      for (l = 0; l &lt; lana_list.length; l++) {
--- 7097,7103 ----
      memset(smb_sharename,' ',NCBNAMSZ);
      memcpy(smb_sharename,smb_localNamep,len);
      sprintf(s, "lana_list.length %d", lana_list.length);
!     osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
  
      /* Keep the name so we can unregister it later */
      for (l = 0; l &lt; lana_list.length; l++) {
***************
*** 7111,7128 ****
          code = Netbios(ncbp, dos_ncb);
  #endif /* !DJGPP */
            
!         afsi_log("Netbios NCBADDNAME lana=%d code=%d retcode=%d complete=%d",
!                  lana, code, ncbp-&gt;ncb_retcode,ncbp-&gt;ncb_cmd_cplt);
          {
              char name[NCBNAMSZ+1];
              name[NCBNAMSZ]=0;
              memcpy(name,ncbp-&gt;ncb_name,NCBNAMSZ);
!             afsi_log("Netbios NCBADDNAME added new name &gt;%s&lt;",name);
          }
  
          if (code == 0) code = ncbp-&gt;ncb_retcode;
          if (code == 0) {
!             afsi_log("Netbios NCBADDNAME succeeded on lana %d\n", lana);
  #ifdef DJGPP
              /* we only use one LANA with djgpp */
              lana_list.lana[0] = lana;
--- 7112,7129 ----
          code = Netbios(ncbp, dos_ncb);
  #endif /* !DJGPP */
            
!         osi_Log4(smb_logp, "Netbios NCBADDNAME lana=%d code=%d retcode=%d complete=%d",
!                  lana, code, ncbp-&gt;ncb_retcode, ncbp-&gt;ncb_cmd_cplt);
          {
              char name[NCBNAMSZ+1];
              name[NCBNAMSZ]=0;
              memcpy(name,ncbp-&gt;ncb_name,NCBNAMSZ);
!             osi_Log1(smb_logp, "Netbios NCBADDNAME added new name &gt;%s&lt;",osi_LogSaveString(smb_logp, name));
          }
  
          if (code == 0) code = ncbp-&gt;ncb_retcode;
          if (code == 0) {
!             osi_Log1(smb_logp, "Netbios NCBADDNAME succeeded on lana %d\n", lana);
  #ifdef DJGPP
              /* we only use one LANA with djgpp */
              lana_list.lana[0] = lana;
***************
*** 7131,7143 ****
          }
          else {
              sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code);
!             afsi_log(s);
              if (code == NRC_BRIDGE) {    /* invalid LANA num */
                  lana_list.lana[l] = 255;
                  continue;
              }
              else if (code == NRC_DUPNAME) {
!                 afsi_log("Name already exists; try to delete it");
                  memset(ncbp, 0, sizeof(*ncbp));
                  ncbp-&gt;ncb_command = NCBDELNAME;
                  memcpy(ncbp-&gt;ncb_name,smb_sharename,NCBNAMSZ);
--- 7132,7144 ----
          }
          else {
              sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code);
!             osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
              if (code == NRC_BRIDGE) {    /* invalid LANA num */
                  lana_list.lana[l] = 255;
                  continue;
              }
              else if (code == NRC_DUPNAME) {
!                 osi_Log0(smb_logp, "Name already exists; try to delete it");
                  memset(ncbp, 0, sizeof(*ncbp));
                  ncbp-&gt;ncb_command = NCBDELNAME;
                  memcpy(ncbp-&gt;ncb_name,smb_sharename,NCBNAMSZ);
***************
*** 7150,7156 ****
                  if (code == 0) code = ncbp-&gt;ncb_retcode;
                  else {
                      sprintf(s, "Netbios NCBDELNAME lana %d error code %d\n", lana, code);
!                     afsi_log(s);
                  }
                  if (code != 0 || delname_tried) {
                      lana_list.lana[l] = 255;
--- 7151,7157 ----
                  if (code == 0) code = ncbp-&gt;ncb_retcode;
                  else {
                      sprintf(s, "Netbios NCBDELNAME lana %d error code %d\n", lana, code);
!                     osi_Log0(smb_logp, s);
                  }
                  if (code != 0 || delname_tried) {
                      lana_list.lana[l] = 255;
***************
*** 7165,7171 ****
              }
              else {
                  sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code);
!                 afsi_log(s);
                  lana_list.lana[l] = 255;  /* invalid lana */
                  osi_panic(s, __FILE__, __LINE__);
              }
--- 7166,7172 ----
              }
              else {
                  sprintf(s, "Netbios NCBADDNAME lana %d error code %d", lana, code);
!                 osi_Log0(smb_logp, osi_LogSaveString(smb_logp, s));
                  lana_list.lana[l] = 255;  /* invalid lana */
                  osi_panic(s, __FILE__, __LINE__);
              }
***************
*** 7245,7250 ****
--- 7246,7256 ----
  	/* Initialize kludge-GMT */
  	smb_CalculateNowTZ();
  
+ #ifdef AFS_FREELANCE_CLIENT
+     /* Make sure the root.afs volume has the correct time */
+     cm_noteLocalMountPointChange();
+ #endif
+ 
  	/* initialize the remote debugging log */
  	smb_logp = logp;
          
Index: openafs/src/WINNT/afsd/smb.h
diff -c openafs/src/WINNT/afsd/smb.h:1.13 openafs/src/WINNT/afsd/smb.h:1.14
*** openafs/src/WINNT/afsd/smb.h:1.13	Mon Jul 26 19:22:20 2004
--- openafs/src/WINNT/afsd/smb.h	Sat Aug  7 01:44:05 2004
***************
*** 378,394 ****
  #endif
    );
  
! extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, long unixTime);
  
! extern void smb_UnixTimeFromLargeSearchTime(long *unixTimep, FILETIME *largeTimep);
  
! extern void smb_SearchTimeFromUnixTime(long *dosTimep, long unixTime);
  
! extern void smb_UnixTimeFromSearchTime(long *unixTimep, long searchTime);
  
! extern void smb_DosUTimeFromUnixTime(long *dosUTimep, long unixTime);
  
! extern void smb_UnixTimeFromDosUTime(long *unixTimep, long dosUTime);
  
  extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);
  
--- 378,394 ----
  #endif
    );
  
! extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, afs_uint32 unixTime);
  
! extern void smb_UnixTimeFromLargeSearchTime(afs_uint32 *unixTimep, FILETIME *largeTimep);
  
! extern void smb_SearchTimeFromUnixTime(long *dosTimep, afs_uint32 unixTime);
  
! extern void smb_UnixTimeFromSearchTime(afs_uint32 *unixTimep, long searchTime);
  
! extern void smb_DosUTimeFromUnixTime(afs_uint32 *dosUTimep, afs_uint32 unixTime);
  
! extern void smb_UnixTimeFromDosUTime(afs_uint32 *unixTimep, afs_uint32 dosUTime);
  
  extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);
  
Index: openafs/src/WINNT/afsd/smb3.c
diff -c openafs/src/WINNT/afsd/smb3.c:1.39 openafs/src/WINNT/afsd/smb3.c:1.42.2.3
*** openafs/src/WINNT/afsd/smb3.c:1.39	Mon Jul 26 19:22:20 2004
--- openafs/src/WINNT/afsd/smb3.c	Tue Aug 10 00:10:47 2004
***************
*** 122,127 ****
--- 122,128 ----
                                 + 3; // terminating '\0' + '\n'
      buffer = malloc( len * sizeof(char) );
      vsprintf( buffer, format, args );
+     osi_Log0(smb_logp, osi_LogSaveString(smb_logp, buffer));
      strcat(buffer, "\n");
      OutputDebugString(buffer);
      free( buffer );
***************
*** 136,147 ****
  
      for(i=0;i&lt;len;i++) {
          if(!(i%16)) {
!             if(i)
                  OutputDebugString(buf);
              sprintf(buf,"%5x",i);
              memset(buf+5,' ',80);
              buf[85] = 0;
-             strcat(buf,"\n");
          }
  
          j = (i%16);
--- 137,150 ----
  
      for(i=0;i&lt;len;i++) {
          if(!(i%16)) {
!             if(i) {
!                 osi_Log0(smb_logp, osi_LogSaveString(smb_logp, buf));
!                 strcat(buf,"\n");
                  OutputDebugString(buf);
+             }
              sprintf(buf,"%5x",i);
              memset(buf+5,' ',80);
              buf[85] = 0;
          }
  
          j = (i%16);
***************
*** 155,163 ****
  
          buf[j] = (k&gt;32 &amp;&amp; k&lt;127)?k:'.';
      }    
!     if(i)
          OutputDebugString(buf);
  }   
  /**/
  
  #define SMB_EXT_SEC_PACKAGE_NAME "Negotiate"
--- 158,169 ----
  
          buf[j] = (k&gt;32 &amp;&amp; k&lt;127)?k:'.';
      }    
!     if(i) {
!         osi_Log0(smb_logp, osi_LogSaveString(smb_logp, buf));
!         strcat(buf,"\n");
          OutputDebugString(buf);
  }   
+ }
  /**/
  
  #define SMB_EXT_SEC_PACKAGE_NAME "Negotiate"
***************
*** 794,800 ****
          unp = uidp-&gt;unp;
          userp = unp-&gt;userp;
          newUid = (unsigned short)uidp-&gt;userID;  /* For some reason these are different types!*/
! 		osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"FindUserByName:Lana[%d],lsn[%d],userid[%d],name[%s]",vcp-&gt;lana,vcp-&gt;lsn,newUid,usern);
  		osi_Log3(smb_logp,"smb_ReceiveV3SessionSetupX FindUserByName:Lana[%d],lsn[%d],userid[%d]",vcp-&gt;lana,vcp-&gt;lsn,newUid);
          smb_ReleaseUID(uidp);
      }
--- 800,806 ----
          unp = uidp-&gt;unp;
          userp = unp-&gt;userp;
          newUid = (unsigned short)uidp-&gt;userID;  /* For some reason these are different types!*/
!                 osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"FindUserByName:Lana[%d],lsn[%d],userid[%d],name[%s]",vcp-&gt;lana,vcp-&gt;lsn,newUid,osi_LogSaveString(smb_logp, usern));
  		osi_Log3(smb_logp,"smb_ReceiveV3SessionSetupX FindUserByName:Lana[%d],lsn[%d],userid[%d]",vcp-&gt;lana,vcp-&gt;lsn,newUid);
          smb_ReleaseUID(uidp);
      }
***************
*** 820,826 ****
          uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
          lock_ObtainMutex(&amp;uidp-&gt;mx);
          uidp-&gt;unp = unp;
! 		osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",(int)vcp,vcp-&gt;lana,vcp-&gt;lsn,newUid,usern);
  		osi_Log4(smb_logp,"smb_ReceiveV3SessionSetupX MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d]",vcp,vcp-&gt;lana,vcp-&gt;lsn,newUid);
          lock_ReleaseMutex(&amp;uidp-&gt;mx);
          smb_ReleaseUID(uidp);
--- 826,832 ----
          uidp = smb_FindUID(vcp, newUid, SMB_FLAG_CREATE);
          lock_ObtainMutex(&amp;uidp-&gt;mx);
          uidp-&gt;unp = unp;
!                 osi_LogEvent("AFS smb_ReceiveV3SessionSetupX",NULL,"MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d],TicketKTCName[%s]",(int)vcp,vcp-&gt;lana,vcp-&gt;lsn,newUid,osi_LogSaveString(smb_logp, usern));
  		osi_Log4(smb_logp,"smb_ReceiveV3SessionSetupX MakeNewUser:VCP[%x],Lana[%d],lsn[%d],userid[%d]",vcp,vcp-&gt;lana,vcp-&gt;lsn,newUid);
          lock_ReleaseMutex(&amp;uidp-&gt;mx);
          smb_ReleaseUID(uidp);
***************
*** 1286,1296 ****
      }   
  
      /* now copy the parms and data */
!     if ( parmCount != 0 )
      {
          memcpy(((char *)asp-&gt;parmsp) + parmDisp, inp-&gt;data + parmOffset, parmCount);
      }
!     if ( dataCount != 0 ) {
          memcpy(asp-&gt;datap + dataDisp, inp-&gt;data + dataOffset, dataCount);
      }
  
--- 1292,1302 ----
      }   
  
      /* now copy the parms and data */
!     if ( asp-&gt;totalParms &gt; 0 &amp;&amp; parmCount != 0 )
      {
          memcpy(((char *)asp-&gt;parmsp) + parmDisp, inp-&gt;data + parmOffset, parmCount);
      }
!     if ( asp-&gt;totalData &gt; 0 &amp;&amp; dataCount != 0 ) {
          memcpy(asp-&gt;datap + dataDisp, inp-&gt;data + dataOffset, dataCount);
      }
  
***************
*** 1299,1305 ****
      asp-&gt;curParms += parmCount;
  
      /* finally, if we're done, remove the packet from the queue and dispatch it */
!     if (asp-&gt;totalData &lt;= asp-&gt;curData &amp;&amp; asp-&gt;totalParms &lt;= asp-&gt;curParms) {
  		/* we've received it all */
          lock_ObtainWrite(&amp;smb_globalLock);
  		osi_QRemove((osi_queue_t **) &amp;smb_tran2AssemblyQueuep, &amp;asp-&gt;q);
--- 1305,1314 ----
      asp-&gt;curParms += parmCount;
  
      /* finally, if we're done, remove the packet from the queue and dispatch it */
!     if (asp-&gt;totalParms &gt; 0 &amp;&amp;
!         asp-&gt;curParms &gt; 0 &amp;&amp;
!         asp-&gt;totalData &lt;= asp-&gt;curData &amp;&amp;
!         asp-&gt;totalParms &lt;= asp-&gt;curParms) {
  		/* we've received it all */
          lock_ObtainWrite(&amp;smb_globalLock);
  		osi_QRemove((osi_queue_t **) &amp;smb_tran2AssemblyQueuep, &amp;asp-&gt;q);
***************
*** 1814,1824 ****
  	memset(outp-&gt;datap,0,totalData);
  
      if(infoLevel == 0) {
!         info0 = (smb_rap_share_info_0_t *) outp-&gt;datap;
          cstrp = (char *) (info0 + 1);
          strcpy(info0-&gt;sv0_name, "AFS");
      } else { /* infoLevel == 1 */
!         info1 = (smb_rap_share_info_1_t *) outp-&gt;datap;
          cstrp = (char *) (info1 + 1);
          strcpy(info1-&gt;sv1_name, "AFS");
  
--- 1823,1833 ----
  	memset(outp-&gt;datap,0,totalData);
  
      if(infoLevel == 0) {
!         info0 = (smb_rap_server_info_0_t *) outp-&gt;datap;
          cstrp = (char *) (info0 + 1);
          strcpy(info0-&gt;sv0_name, "AFS");
      } else { /* infoLevel == 1 */
!         info1 = (smb_rap_server_info_1_t *) outp-&gt;datap;
          cstrp = (char *) (info1 + 1);
          strcpy(info1-&gt;sv1_name, "AFS");
  
***************
*** 1829,1835 ****
  
          info1-&gt;sv1_version_major = 5;
          info1-&gt;sv1_version_minor = 1;
!         info1-&gt;sv1_comment_or_master_browser = (DWORD) (cstrp - outp-&gt;datap);
  
          strcpy(cstrp, smb_ServerComment);
  
--- 1838,1844 ----
  
          info1-&gt;sv1_version_major = 5;
          info1-&gt;sv1_version_minor = 1;
!         info1-&gt;sv1_comment_or_master_browser = (DWORD *) (cstrp - outp-&gt;datap);
  
          strcpy(cstrp, smb_ServerComment);
  
***************
*** 1923,1933 ****
      }   
  
      /* now copy the parms and data */
!     if ( parmCount != 0 )
      {
          memcpy(((char *)asp-&gt;parmsp) + parmDisp, inp-&gt;data + parmOffset, parmCount);
      }
!     if ( dataCount != 0 ) {
          memcpy(asp-&gt;datap + dataDisp, inp-&gt;data + dataOffset, dataCount);
      }
  
--- 1932,1942 ----
      }   
  
      /* now copy the parms and data */
!     if ( asp-&gt;totalParms &gt; 0 &amp;&amp; parmCount != 0 )
      {
          memcpy(((char *)asp-&gt;parmsp) + parmDisp, inp-&gt;data + parmOffset, parmCount);
      }
!     if ( asp-&gt;totalData &gt; 0 &amp;&amp; dataCount != 0 ) {
          memcpy(asp-&gt;datap + dataDisp, inp-&gt;data + dataOffset, dataCount);
      }
  
***************
*** 1936,1942 ****
      asp-&gt;curParms += parmCount;
  
      /* finally, if we're done, remove the packet from the queue and dispatch it */
!     if (asp-&gt;totalData &lt;= asp-&gt;curData &amp;&amp; asp-&gt;totalParms &lt;= asp-&gt;curParms) {
  		/* we've received it all */
          lock_ObtainWrite(&amp;smb_globalLock);
  		osi_QRemove((osi_queue_t **) &amp;smb_tran2AssemblyQueuep, &amp;asp-&gt;q);
--- 1945,1954 ----
      asp-&gt;curParms += parmCount;
  
      /* finally, if we're done, remove the packet from the queue and dispatch it */
!     if (asp-&gt;totalParms &gt; 0 &amp;&amp;
!         asp-&gt;curParms &gt; 0 &amp;&amp;
!         asp-&gt;totalData &lt;= asp-&gt;curData &amp;&amp;
!         asp-&gt;totalParms &lt;= asp-&gt;curParms) {
  		/* we've received it all */
          lock_ObtainWrite(&amp;smb_globalLock);
  		osi_QRemove((osi_queue_t **) &amp;smb_tran2AssemblyQueuep, &amp;asp-&gt;q);
***************
*** 2986,2991 ****
--- 2998,3077 ----
  		if (code) { 
  			lock_ReleaseMutex(&amp;scp-&gt;mx);
  			cm_ReleaseSCache(scp);
+ 
+             dptr = patchp-&gt;dptr;
+ 
+             /* Plug in fake timestamps. A time stamp of 0 causes 'invalid parameter'
+                errors in the client. */
+             if (infoLevel &gt;= 0x101) {
+                 /* 1969-12-31 23:59:59 +00 */
+                 ft.dwHighDateTime = 0x19DB200;
+                 ft.dwLowDateTime = 0x5BB78980;
+ 
+ 			    /* copy to Creation Time */
+ 			    *((FILETIME *)dptr) = ft;
+ 			    dptr += 8;
+ 
+ 			    /* copy to Last Access Time */
+ 			    *((FILETIME *)dptr) = ft;
+ 			    dptr += 8;
+ 
+ 			    /* copy to Last Write Time */
+ 			    *((FILETIME *)dptr) = ft;
+ 			    dptr += 8;
+ 
+ 			    /* copy to Change Time */
+ 			    *((FILETIME *)dptr) = ft;
+                 dptr += 24;
+ 
+                 /* merge in hidden attribute */
+                 if ( patchp-&gt;flags &amp; SMB_DIRLISTPATCH_DOTFILE ) {
+ 			        *((u_long *)dptr) = SMB_ATTR_HIDDEN;
+                 }
+ 			    dptr += 4;
+ 
+             } else {
+                 /* 1969-12-31 23:59:58 +00*/
+                 dosTime = 0xEBBFBF7D;
+ 
+ 			    /* and copy out date */
+ 			    shortTemp = (dosTime&gt;&gt;16) &amp; 0xffff;
+ 			    *((u_short *)dptr) = shortTemp;
+ 			    dptr += 2;
+ 
+ 			    /* copy out creation time */
+ 			    shortTemp = dosTime &amp; 0xffff;
+ 			    *((u_short *)dptr) = shortTemp;
+ 			    dptr += 2;
+ 
+ 			    /* and copy out date */
+ 			    shortTemp = (dosTime&gt;&gt;16) &amp; 0xffff;
+ 			    *((u_short *)dptr) = shortTemp;
+ 			    dptr += 2;
+     			
+ 			    /* copy out access time */
+ 			    shortTemp = dosTime &amp; 0xffff;
+ 			    *((u_short *)dptr) = shortTemp;
+ 			    dptr += 2;
+ 
+ 			    /* and copy out date */
+ 			    shortTemp = (dosTime&gt;&gt;16) &amp; 0xffff;
+ 			    *((u_short *)dptr) = shortTemp;
+ 			    dptr += 2;
+     			
+ 			    /* copy out mod time */
+ 			    shortTemp = dosTime &amp; 0xffff;
+ 			    *((u_short *)dptr) = shortTemp;
+ 			    dptr += 10;
+ 
+                 /* merge in hidden (dot file) attribute */
+                 if ( patchp-&gt;flags &amp; SMB_DIRLISTPATCH_DOTFILE ) {
+                     attr == SMB_ATTR_HIDDEN;
+ 			        *dptr++ = attr &amp; 0xff;
+ 			        *dptr++ = (attr &gt;&gt; 8) &amp; 0xff;
+                 }
+ 
+             }
  			continue;
          }
                  
Index: openafs/src/WINNT/aklog/NTMakefile
diff -c openafs/src/WINNT/aklog/NTMakefile:1.1 openafs/src/WINNT/aklog/NTMakefile:1.2
*** openafs/src/WINNT/aklog/NTMakefile:1.1	Mon Apr 12 23:05:31 2004
--- openafs/src/WINNT/aklog/NTMakefile	Thu Aug  5 12:31:37 2004
***************
*** 29,35 ****
  OTHERLIBS = \
      ..\kfw\lib\i386\krbv4w32.lib \
      ..\kfw\lib\i386\krb5_32.lib \
!     dnsapi.lib
  
  afscflags = -I..\kfw\inc\krb5 -I..\kfw\inc\krb4 $(afscflags)
  
--- 29,35 ----
  OTHERLIBS = \
      ..\kfw\lib\i386\krbv4w32.lib \
      ..\kfw\lib\i386\krb5_32.lib \
!     dnsapi.lib mpr.lib
  
  afscflags = -I..\kfw\inc\krb5 -I..\kfw\inc\krb4 $(afscflags)
  
***************
*** 38,45 ****
  
  ############################################################################
  
! $(EXEFILE) : $(EXEOBJS) $(OUT)\aklog.res $(EXELIBS)
! 	$(EXECONLINK) $(OTHERLIBS)
  	$(EXEPREP) 
  
  install : $(COPYHEADERS) $(EXEFILE)
--- 38,45 ----
  
  ############################################################################
  
! $(EXEFILE) : $(EXEOBJS) $(EXELIBS) $(OUT)\aklog.res
! 	$(EXECONLINK) $(EXELIBS) $(OTHERLIBS)
  	$(EXEPREP) 
  
  install : $(COPYHEADERS) $(EXEFILE)
Index: openafs/src/WINNT/aklog/aklog.c
diff -c openafs/src/WINNT/aklog/aklog.c:1.3 openafs/src/WINNT/aklog/aklog.c:1.5
*** openafs/src/WINNT/aklog/aklog.c:1.3	Thu Jul  8 09:25:40 2004
--- openafs/src/WINNT/aklog/aklog.c	Tue Aug  3 13:27:57 2004
***************
*** 23,28 ****
--- 23,29 ----
  #include &lt;afs/stds.h&gt;
  #include &lt;krb.h&gt;
  #include &lt;krb5.h&gt;
+ #include &lt;afs/ptserver.h&gt;
  
  #ifdef WIN32
  #include &lt;windows.h&gt;
***************
*** 172,187 ****
  	(void) afsconf_Close(*pconfigdir);
  }
  
! void ViceIDToUsername(char *username, int *status, 
! struct ktc_principal *aserver)
  {
! #ifndef WIN32
  	long viceId;			/* AFS uid of user */
  
  	if (dflag)
  		printf("About to resolve name %s to id\n", username);
  
! 	if (!pr_Initialize (0, AFSDIR_CLIENT_ETC_DIRPATH, aserver-&gt;cell))
  		*status = pr_SNameToId (username, &amp;viceId);
  
  	if (dflag)
--- 173,222 ----
  	(void) afsconf_Close(*pconfigdir);
  }
  
! #define ALLOW_REGISTER 1
! void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell,
!                       char * cell_to_use, CREDENTIALS *c,
!                       int *status, 
!                       struct ktc_principal *aclient, struct ktc_principal *aserver, struct ktc_token *atoken)
  {
!     static char lastcell[MAXCELLCHARS+1] = { 0 };
!     static char confname[512] = { 0 };
  	long viceId;			/* AFS uid of user */
+ #ifdef ALLOW_REGISTER
+     afs_int32 id;
+ #endif /* ALLOW_REGISTER */
+ 
+     if (confname[0] == '\0') {
+         strncpy(confname, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confname));
+         confname[sizeof(confname) - 2] = '\0';
+     }
  
  	if (dflag)
  		printf("About to resolve name %s to id\n", username);
  
!     /*
!     * Talk about DUMB!  It turns out that there is a bug in
!     * pr_Initialize -- even if you give a different cell name
!     * to it, it still uses a connection to a previous AFS server
!     * if one exists.  The way to fix this is to change the
!     * _filename_ argument to pr_Initialize - that forces it to
!     * re-initialize the connection.  We do this by adding and
!     * removing a "/" on the end of the configuration directory name.
!     */
! 
!     if (lastcell[0] != '\0' &amp;&amp; (strcmp(lastcell, aserver-&gt;cell) != 0)) {
!         int i = strlen(confname);
!         if (confname[i - 1] == '/') {
!             confname[i - 1] = '\0';
!         } else {
!             confname[i] = '/';
!             confname[i + 1] = '\0';
!         }
!     }
! 
!     strcpy(lastcell, aserver-&gt;cell);
! 
! 	if (!pr_Initialize (0, confname, aserver-&gt;cell))
  		*status = pr_SNameToId (username, &amp;viceId);
  
  	if (dflag)
***************
*** 201,209 ****
  	* the code for tokens, this hack (AFS ID %d) will
  	* not work if you change %d to something else.
  	*/
! 	if ((*status == 0) &amp;&amp; (viceId != ANONYMOUSID))
! 		sprintf (username, "AFS ID %d", viceId);
! #endif
  }
  
  char *LastComponent(char *str)
--- 236,293 ----
  	* the code for tokens, this hack (AFS ID %d) will
  	* not work if you change %d to something else.
  	*/
! 
!     /*
!     * This code is taken from cklog -- it lets people
!     * automatically register with the ptserver in foreign cells
!     */
! 
! #ifdef ALLOW_REGISTER
!     if (*status == 0) {
!         if (viceId != ANONYMOUSID) {
! #else /* ALLOW_REGISTER */
!             if ((*status == 0) &amp;&amp; (viceId != ANONYMOUSID))
! #endif /* ALLOW_REGISTER */
!                 sprintf (username, "AFS ID %d", (int) viceId);
! #ifdef ALLOW_REGISTER
!             } else if (strcmp(realm_of_user, realm_of_cell) != 0) {
!                 if (dflag) {
!                     printf("doing first-time registration of %s "
!                             "at %s\n", username, cell_to_use);
!                 }
!                 id = 0;
!                 strncpy(aclient-&gt;name, username, MAXKTCNAMELEN - 1);
!                 strcpy(aclient-&gt;instance, "");
!                 strncpy(aclient-&gt;cell, c-&gt;realm, MAXKTCREALMLEN - 1);
!                 if ((*status = ktc_SetToken(aserver, atoken, aclient, 0))) {
!                     printf("%s: unable to obtain tokens for cell %s "
!                             "(status: %d).\n", progname, cell_to_use, status);
!                     *status = AKLOG_TOKEN;
!                 }
! 
!                 /*
!                  * In case you're wondering, we don't need to change the
!                  * filename here because we're still connecting to the
!                  * same cell -- we're just using a different authentication
!                  * level
!                  */
! 
!                 if ((*status = pr_Initialize(1L, confname, aserver-&gt;cell, 0))) {
!                     printf("Error %d\n", status);
!                 }
! 
!                 if ((*status = pr_CreateUser(username, &amp;id))) {
!                     printf("%s: unable to create remote PTS "
!                             "user %s in cell %s (status: %d).\n", progname,
!                             username, cell_to_use, *status);
!                 } else {
!                     printf("created cross-cell entry for %s at %s\n",
!                             username, cell_to_use);
!                     sprintf(username, "AFS ID %d", (int) id);
!                 }
!             }
!         }
! #endif /* ALLOW_REGISTER */
  }
  
  char *LastComponent(char *str)
***************
*** 355,361 ****
  
  static char *afs_realm_of_cell5(krb5_context context, struct afsconf_cell *cellconfig)
  {
! 	char ** krbrlms;
  	static char krbrlm[REALM_SZ+1];
  	krb5_error_code status;
  
--- 439,445 ----
  
  static char *afs_realm_of_cell5(krb5_context context, struct afsconf_cell *cellconfig)
  {
! 	char ** krbrlms = 0;
  	static char krbrlm[REALM_SZ+1];
  	krb5_error_code status;
  
***************
*** 364,377 ****
  
  	status = krb5_get_host_realm( context, cellconfig-&gt;hostName[0], &amp;krbrlms );
  
! 	if(krbrlms &amp;&amp; krbrlms[0])
  		strcpy(krbrlm, krbrlms[0]);
! 	else {
  		strcpy(krbrlm, cellconfig-&gt;name);
  		strupr(krbrlm);
  	}
  
! 	if(krbrlms)
  		krb5_free_host_realm( context, krbrlms );
  
  	return krbrlm;
--- 448,461 ----
  
  	status = krb5_get_host_realm( context, cellconfig-&gt;hostName[0], &amp;krbrlms );
  
! 	if (status == 0 &amp;&amp; krbrlms &amp;&amp; krbrlms[0]) {
  		strcpy(krbrlm, krbrlms[0]);
!     } else {
  		strcpy(krbrlm, cellconfig-&gt;name);
  		strupr(krbrlm);
  	}
  
! 	if (krbrlms)
  		krb5_free_host_realm( context, krbrlms );
  
  	return krbrlm;
***************
*** 469,474 ****
--- 553,559 ----
  	struct ktc_principal aclient;
  	struct ktc_token atoken, btoken;
  
+ 
  	/* try to avoid an expensive call to get_cellconfig */
  	if (cell &amp;&amp; ll_string_check(&amp;authedcells, cell))
  	{
***************
*** 665,671 ****
  			strcat(username, realm_of_user);
  		}
  
! 		ViceIDToUsername(username, &amp;status, &amp;aserver);
  	}
  
  	if (dflag)
--- 750,756 ----
  			strcat(username, realm_of_user);
  		}
  
! 		ViceIDToUsername(username, realm_of_user, realm_of_cell, cell_to_use, &amp;c, &amp;status, &amp;aclient, &amp;aserver, &amp;atoken);
  	}
  
  	if (dflag)
Index: openafs/src/WINNT/client_config/drivemap.cpp
diff -c openafs/src/WINNT/client_config/drivemap.cpp:1.26 openafs/src/WINNT/client_config/drivemap.cpp:1.27
*** openafs/src/WINNT/client_config/drivemap.cpp:1.26	Sun Jul 25 16:53:12 2004
--- openafs/src/WINNT/client_config/drivemap.cpp	Tue Aug  3 13:27:57 2004
***************
*** 306,319 ****
        return FALSE;
  
     for ( ; *pszSubmount; ++pszSubmount)
!       {
!       if (!isprint(*pszSubmount))
!          return FALSE;
!       if (*pszSubmount == TEXT(' '))
!          return FALSE;
!       if (*pszSubmount == TEXT('\t'))
!          return FALSE;
!       }
  
     return TRUE;
  }
--- 306,323 ----
        return FALSE;
  
     for ( ; *pszSubmount; ++pszSubmount)
!    {
!        if (!isprint(*pszSubmount))
!            return FALSE;
!        if (*pszSubmount == TEXT(' '))
!            return FALSE;
!        if (*pszSubmount == TEXT('/'))
!            return FALSE;
!        if (*pszSubmount == TEXT('\\'))
!            return FALSE;
!        if (*pszSubmount == TEXT('\t'))
!            return FALSE;
!    }
  
     return TRUE;
  }
Index: openafs/src/WINNT/client_config/lang/en_US/afs_config.rc
diff -c openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.5 openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.6
*** openafs/src/WINNT/client_config/lang/en_US/afs_config.rc:1.5	Thu Feb 26 14:22:46 2004
--- openafs/src/WINNT/client_config/lang/en_US/afs_config.rc	Sat Jul 31 20:20:34 2004
***************
*** 199,205 ****
                      IDC_STATIC,4,4,226,8
      LTEXT           "&amp;AFS Cell:",IDC_STATIC,4,24,30,8
      EDITTEXT        IDC_CELL,50,22,105,13,ES_LOWERCASE | ES_AUTOHSCROLL
!     LTEXT           "&amp;Description:",IDC_STATIC,4,41,38,8
      EDITTEXT        IDC_COMMENT,50,39,181,13,ES_AUTOHSCROLL
      GROUPBOX        "Servers",IDC_STATIC,4,61,236,158
      CONTROL         "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x1b,13,
--- 199,205 ----
                      IDC_STATIC,4,4,226,8
      LTEXT           "&amp;AFS Cell:",IDC_STATIC,4,24,30,8
      EDITTEXT        IDC_CELL,50,22,105,13,ES_LOWERCASE | ES_AUTOHSCROLL
!     LTEXT           "&amp;Submount:",IDC_STATIC,4,41,38,8
      EDITTEXT        IDC_COMMENT,50,39,181,13,ES_AUTOHSCROLL
      GROUPBOX        "Servers",IDC_STATIC,4,61,236,158
      CONTROL         "",IDC_LIST,"FastList",WS_BORDER | WS_TABSTOP | 0x1b,13,
***************
*** 244,250 ****
                      WS_VSCROLL | WS_TABSTOP
      LTEXT           "AFS &amp;Path:",IDC_STATIC,30,77,33,8
      EDITTEXT        IDC_PATH,77,75,168,13,ES_AUTOHSCROLL
!     LTEXT           "D&amp;escription:",IDC_STATIC,29,96,38,8
      EDITTEXT        IDC_DESC,77,94,72,13,ES_AUTOHSCROLL
      CONTROL         "&amp;Restore this mapping whenever I logon",IDC_PERSISTENT,
                      "Button",BS_AUTOCHECKBOX | WS_TABSTOP,77,112,188,10
--- 244,250 ----
                      WS_VSCROLL | WS_TABSTOP
      LTEXT           "AFS &amp;Path:",IDC_STATIC,30,77,33,8
      EDITTEXT        IDC_PATH,77,75,168,13,ES_AUTOHSCROLL
!     LTEXT           "&amp;Submount:",IDC_STATIC,29,96,38,8
      EDITTEXT        IDC_DESC,77,94,72,13,ES_AUTOHSCROLL
      CONTROL         "&amp;Restore this mapping whenever I logon",IDC_PERSISTENT,
                      "Button",BS_AUTOCHECKBOX | WS_TABSTOP,77,112,188,10
***************
*** 442,448 ****
      PUSHBUTTON      "Help",9,190,96,50,14
      LTEXT           "&amp;Drive Letter:",IDC_STATIC,16,25,40,8
      LTEXT           "AFS &amp;Path:",IDC_STATIC,16,44,33,8
!     LTEXT           "D&amp;escription:",IDC_STATIC,15,64,38,8
      GROUPBOX        "Global AFS Drive",IDC_STATIC,7,7,232,80
  END
  
--- 442,448 ----
      PUSHBUTTON      "Help",9,190,96,50,14
      LTEXT           "&amp;Drive Letter:",IDC_STATIC,16,25,40,8
      LTEXT           "AFS &amp;Path:",IDC_STATIC,16,44,33,8
!     LTEXT           "&amp;Submount:",IDC_STATIC,15,64,38,8
      GROUPBOX        "Global AFS Drive",IDC_STATIC,7,7,232,80
  END
  
***************
*** 710,717 ****
  STRINGTABLE DISCARDABLE 
  BEGIN
      IDS_BADLOOKUP_DESC      "Windows could not find a network address for %1. Check to make sure you typed the name of the machine correctly."
!     IDS_NEWSUB_DESC         "AFS was unable to use the description you specified when connecting the network drive.\n\nThe specified description is already used for a different AFS path."
!     IDS_BADSUB_DESC         "The drive letter description you entered cannot be used.\n\nA drive letter description may have no more than 12 characters, and may not contain spaces or tabs."
      IDS_BADGATEWAY_DESC     "AFS was unable to contact the gateway machine that you specified.\n\nCheck to make sure that you typed the name of the gateway machine correctly."
      IDS_BADGWCELL_DESC      "No configuration information could be found for the AFS cell used by the specified gateway machine.\n\nIf you want to configure the AFS Client into a new cell, you must use the AFS Cells tab to add configuration information for that cell.\n\nCell: %1"
      IDS_TITLE_CAUTION_NT    "Caution - AFS Client Configuration"
--- 710,717 ----
  STRINGTABLE DISCARDABLE 
  BEGIN
      IDS_BADLOOKUP_DESC      "Windows could not find a network address for %1. Check to make sure you typed the name of the machine correctly."
!     IDS_NEWSUB_DESC         "AFS was unable to use the submount name you specified when connecting the network drive.\n\nThe specified submount is already used for a different AFS path."
!     IDS_BADSUB_DESC         "The drive letter submount you entered cannot be used.\n\nA submount may have no more than 12 characters, and may not contain spaces or tabs."
      IDS_BADGATEWAY_DESC     "AFS was unable to contact the gateway machine that you specified.\n\nCheck to make sure that you typed the name of the gateway machine correctly."
      IDS_BADGWCELL_DESC      "No configuration information could be found for the AFS cell used by the specified gateway machine.\n\nIf you want to configure the AFS Client into a new cell, you must use the AFS Cells tab to add configuration information for that cell.\n\nCell: %1"
      IDS_TITLE_CAUTION_NT    "Caution - AFS Client Configuration"
Index: openafs/src/WINNT/client_creds/shortcut.cpp
diff -c openafs/src/WINNT/client_creds/shortcut.cpp:1.7 openafs/src/WINNT/client_creds/shortcut.cpp:1.8
*** openafs/src/WINNT/client_creds/shortcut.cpp:1.7	Tue Mar 16 11:21:42 2004
--- openafs/src/WINNT/client_creds/shortcut.cpp	Wed Aug  4 11:54:42 2004
***************
*** 115,123 ****
  
         code = RegOpenKeyEx(HKEY_CURRENT_USER, REGSTR_PATH_OPENAFS_CLIENT,
                              0, KEY_QUERY_VALUE, &amp;hk);
-        if (code != ERROR_SUCCESS)
-            code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_OPENAFS_CLIENT,
-                                 0, KEY_QUERY_VALUE, &amp;hk);
         if (code == ERROR_SUCCESS) {
             len = sizeof(szParams);
             type = REG_SZ;
--- 115,120 ----
***************
*** 125,130 ****
--- 122,138 ----
                                     (BYTE *) &amp;szParams, &amp;len);
             RegCloseKey (hk);
         }
+        if (code != ERROR_SUCCESS) {
+            code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_OPENAFS_CLIENT,
+                                 0, KEY_QUERY_VALUE, &amp;hk);
+            if (code == ERROR_SUCCESS) {
+                len = sizeof(szParams);
+                type = REG_SZ;
+                code = RegQueryValueEx(hk, "AfscredsShortcutParams", NULL, &amp;type,
+                                        (BYTE *) &amp;szParams, &amp;len);
+                RegCloseKey (hk);
+            }
+        }
         Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent", szParams);
     }
     else // (!g.fAutoStart)
Index: openafs/src/WINNT/client_creds/window.cpp
diff -c openafs/src/WINNT/client_creds/window.cpp:1.10 openafs/src/WINNT/client_creds/window.cpp:1.11
*** openafs/src/WINNT/client_creds/window.cpp:1.10	Sun Jul 25 16:53:13 2004
--- openafs/src/WINNT/client_creds/window.cpp	Tue Aug  3 13:27:58 2004
***************
*** 246,279 ****
  
  void Main_OnInitDialog (HWND hDlg)
  {
!    if (!g.fIsWinNT)
!       {
!       TCHAR szTitle[256];
!       GetString (szTitle, IDS_TITLE_95);
!       SetWindowText (hDlg, szTitle);
!       }
  
!    TCHAR szVersion[256];
!    DWORD dwPatch = 0;
!    TCHAR szUser[256];
!    GetString (szVersion, IDS_UNKNOWN);
!    GetString (szUser, IDS_UNKNOWN);
  
!    HKEY hk;
!    if (RegOpenKey (HKEY_LOCAL_MACHINE, REGSTR_PATH_AFS, &amp;hk) == 0)
!       {
!       DWORD dwSize = sizeof(szVersion);
!       DWORD dwType = REG_SZ;
!       RegQueryValueEx (hk, REGVAL_AFS_VERSION, NULL, &amp;dwType, (PBYTE)szVersion, &amp;dwSize);
  
!       dwSize = sizeof(dwPatch);
!       dwType = REG_DWORD;
!       RegQueryValueEx (hk, REGVAL_AFS_PATCH, NULL, &amp;dwType, (PBYTE)&amp;dwPatch, &amp;dwSize);
!       RegCloseKey (hk);
!       }
  
!    BOOL fFoundUserName = FALSE;
!     if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Explorer"), &amp;hk) == 0)
      {
          DWORD dwSize = sizeof(szUser);
          DWORD dwType = REG_SZ;
--- 246,280 ----
  
  void Main_OnInitDialog (HWND hDlg)
  {
!     if (!g.fIsWinNT)
!     {
!         TCHAR szTitle[256];
!         GetString (szTitle, IDS_TITLE_95);
!         SetWindowText (hDlg, szTitle);
!     }
  
!     TCHAR szVersion[256];
!     DWORD dwPatch = 0;
!     TCHAR szUser[256];
!     GetString (szVersion, IDS_UNKNOWN);
!     GetString (szUser, IDS_UNKNOWN);
  
!     HKEY hk;
!     if (RegOpenKey (HKEY_LOCAL_MACHINE, REGSTR_PATH_AFS, &amp;hk) == 0)
!     {
!         DWORD dwSize = sizeof(szVersion);
!         DWORD dwType = REG_SZ;
!         RegQueryValueEx (hk, REGVAL_AFS_VERSION, NULL, &amp;dwType, (PBYTE)szVersion, &amp;dwSize);
  
!         dwSize = sizeof(dwPatch);
!         dwType = REG_DWORD;
!         RegQueryValueEx (hk, REGVAL_AFS_PATCH, NULL, &amp;dwType, (PBYTE)&amp;dwPatch, &amp;dwSize);
!         RegCloseKey (hk);
!     }
  
!     /* We should probably be using GetUserNameEx() for this */
!     BOOL fFoundUserName = FALSE;
!     if (RegOpenKey (HKEY_CURRENT_USER, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"), &amp;hk) == 0)
      {
          DWORD dwSize = sizeof(szUser);
          DWORD dwType = REG_SZ;
***************
*** 283,288 ****
--- 284,300 ----
      }
      if (!fFoundUserName ) 
      {
+         if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Explorer"), &amp;hk) == 0)
+         {
+             DWORD dwSize = sizeof(szUser);
+             DWORD dwType = REG_SZ;
+             if (RegQueryValueEx (hk, TEXT("Logon User Name"), NULL, &amp;dwType, (PBYTE)szUser, &amp;dwSize) == 0)
+                 fFoundUserName = TRUE;
+             RegCloseKey (hk);
+         }
+     }
+     if (!fFoundUserName ) 
+     {
          if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), &amp;hk) == 0)
          {
              DWORD dwSize = sizeof(szUser);
***************
*** 291,319 ****
                  fFoundUserName = TRUE;
              RegCloseKey (hk);
          }
      }
-    if (!fFoundUserName)
-    {
-        if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Network\\Logon"), &amp;hk) == 0)
-        {
-            DWORD dwSize = sizeof(szUser);
-            DWORD dwType = REG_SZ;
-            if (RegQueryValueEx (hk, TEXT("UserName"), NULL, &amp;dwType, (PBYTE)szUser, &amp;dwSize) == 0)
-                fFoundUserName = TRUE;
-            RegCloseKey (hk);
-        }
-    }
  
!    TCHAR szSource[ cchRESOURCE ];
!    TCHAR szTarget[ cchRESOURCE ];
  
!    GetString (szSource, (dwPatch) ? IDS_TITLE_VERSION : IDS_TITLE_VERSION_NOPATCH);
!    wsprintf (szTarget, szSource, szVersion, dwPatch);
!    SetDlgItemText (hDlg, IDC_TITLE_VERSION, szTarget);
! 
!    GetDlgItemText (hDlg, IDC_TITLE_NT, szSource, cchRESOURCE);
!    wsprintf (szTarget, szSource, szUser);
!    SetDlgItemText (hDlg, IDC_TITLE_NT, szTarget);
  }
  
  
--- 303,331 ----
                  fFoundUserName = TRUE;
              RegCloseKey (hk);
          }
+     }   
+     if (!fFoundUserName)
+     {
+         if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Network\\Logon"), &amp;hk) == 0)
+         {
+             DWORD dwSize = sizeof(szUser);
+             DWORD dwType = REG_SZ;
+             if (RegQueryValueEx (hk, TEXT("UserName"), NULL, &amp;dwType, (PBYTE)szUser, &amp;dwSize) == 0)
+                 fFoundUserName = TRUE;
+             RegCloseKey (hk);
+         }
      }
  
!     TCHAR szSource[ cchRESOURCE ];
!     TCHAR szTarget[ cchRESOURCE ];
  
!     GetString (szSource, (dwPatch) ? IDS_TITLE_VERSION : IDS_TITLE_VERSION_NOPATCH);
!     wsprintf (szTarget, szSource, szVersion, dwPatch);
!     SetDlgItemText (hDlg, IDC_TITLE_VERSION, szTarget);
! 
!     GetDlgItemText (hDlg, IDC_TITLE_NT, szSource, cchRESOURCE);
!     wsprintf (szTarget, szSource, szUser);
!     SetDlgItemText (hDlg, IDC_TITLE_NT, szTarget);
  }
  
  
Index: openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc
diff -c openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc:1.6 openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc:1.7
*** openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc:1.6	Sun Jul 25 16:53:14 2004
--- openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc	Sat Jul 31 20:21:51 2004
***************
*** 272,278 ****
                      WS_VSCROLL | WS_TABSTOP
      LTEXT           "AFS &amp;Path:",IDC_STATIC,34,76,33,8
      EDITTEXT        IDC_MAP_PATH,77,74,96,14,ES_AUTOHSCROLL
!     LTEXT           "D&amp;escription:",IDC_STATIC,34,94,38,8
      EDITTEXT        IDC_MAP_DESC,77,92,60,14,ES_AUTOHSCROLL
  END
  
--- 272,278 ----
                      WS_VSCROLL | WS_TABSTOP
      LTEXT           "AFS &amp;Path:",IDC_STATIC,34,76,33,8
      EDITTEXT        IDC_MAP_PATH,77,74,96,14,ES_AUTOHSCROLL
!     LTEXT           "&amp;Submount:",IDC_STATIC,34,94,38,8
      EDITTEXT        IDC_MAP_DESC,77,92,60,14,ES_AUTOHSCROLL
  END
  
***************
*** 355,361 ****
                      WS_VSCROLL | WS_TABSTOP
      LTEXT           "AFS &amp;Path:",IDC_STATIC,23,70,33,8
      EDITTEXT        IDC_MAP_PATH,73,68,178,13,ES_AUTOHSCROLL
!     LTEXT           "D&amp;escription:",IDC_STATIC,23,88,38,8
      EDITTEXT        IDC_MAP_DESC,73,86,60,13,ES_AUTOHSCROLL
      CONTROL         "&amp;Restore this mapping whenever I logon",
                      IDC_MAP_PERSISTENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
--- 355,361 ----
                      WS_VSCROLL | WS_TABSTOP
      LTEXT           "AFS &amp;Path:",IDC_STATIC,23,70,33,8
      EDITTEXT        IDC_MAP_PATH,73,68,178,13,ES_AUTOHSCROLL
!     LTEXT           "&amp;Submount:",IDC_STATIC,23,88,38,8
      EDITTEXT        IDC_MAP_DESC,73,86,60,13,ES_AUTOHSCROLL
      CONTROL         "&amp;Restore this mapping whenever I logon",
                      IDC_MAP_PERSISTENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
***************
*** 549,555 ****
      IDS_UNCONFIG_DESC       "The AFS Client cannot be used because it is not yet configured.\n\nTo configure the AFS Client, open the Control Panel and double-click on the AFS Client icon."
      IDS_NEWSUB_TITLE        "Caution - AFS Client"
      IDS_NEWSUB_TITLE_95     "Caution - AFS Light"
!     IDS_NEWSUB_DESC         "AFS was unable to use the description you specified when connecting the network drive.\n\nThe specified description is already used for a different AFS path."
      IDS_BADSUB_TITLE        "Error - AFS Client"
  END
  
--- 549,555 ----
      IDS_UNCONFIG_DESC       "The AFS Client cannot be used because it is not yet configured.\n\nTo configure the AFS Client, open the Control Panel and double-click on the AFS Client icon."
      IDS_NEWSUB_TITLE        "Caution - AFS Client"
      IDS_NEWSUB_TITLE_95     "Caution - AFS Light"
!     IDS_NEWSUB_DESC         "AFS was unable to use the submount you specified when connecting the network drive.\n\nThe specified submount is already used for a different AFS path."
      IDS_BADSUB_TITLE        "Error - AFS Client"
  END
  
Index: openafs/src/WINNT/client_exp/gui2fs.cpp
diff -c openafs/src/WINNT/client_exp/gui2fs.cpp:1.10 openafs/src/WINNT/client_exp/gui2fs.cpp:1.10.2.1
*** openafs/src/WINNT/client_exp/gui2fs.cpp:1.10	Sat Mar 13 20:28:24 2004
--- openafs/src/WINNT/client_exp/gui2fs.cpp	Mon Aug  9 16:57:13 2004
***************
*** 1478,1484 ****
  	int cellNum;
  	int rc;
  	int current_time;
! 	long tokenExpireTime;
  	char *expireString;
  	char userName[100];
  //	char s[100];
--- 1478,1484 ----
  	int cellNum;
  	int rc;
  	int current_time;
! 	time_t tokenExpireTime;
  	char *expireString;
  	char userName[100];
  //	char s[100];
Index: openafs/src/WINNT/client_exp/submounts_dlg.cpp
diff -c openafs/src/WINNT/client_exp/submounts_dlg.cpp:1.3 openafs/src/WINNT/client_exp/submounts_dlg.cpp:1.4
*** openafs/src/WINNT/client_exp/submounts_dlg.cpp:1.3	Tue Jul 13 23:28:43 2004
--- openafs/src/WINNT/client_exp/submounts_dlg.cpp	Sat Aug  7 10:14:17 2004
***************
*** 162,169 ****
  	HOURGLASS hourglass;
  
      HKEY hkSubmounts;
!     DWORD dwType, dwSize;
!     DWORD status;
      DWORD dwIndex;
      DWORD dwSubmounts;
  
--- 162,168 ----
  	HOURGLASS hourglass;
  
      HKEY hkSubmounts;
!     DWORD dwType;
      DWORD dwIndex;
      DWORD dwSubmounts;
  
Index: openafs/src/WINNT/client_osi/osilog.h
diff -c openafs/src/WINNT/client_osi/osilog.h:1.4 openafs/src/WINNT/client_osi/osilog.h:1.5
*** openafs/src/WINNT/client_osi/osilog.h:1.4	Thu Feb 26 14:22:49 2004
--- openafs/src/WINNT/client_osi/osilog.h	Sat Jul 31 20:19:08 2004
***************
*** 19,25 ****
  #include "osiqueue.h"
  
  #define OSI_LOG_DEFAULTSIZE	1000
! #define OSI_LOG_STRINGSIZE	30
  #define OSI_LOG_MAXPARMS	4	/* max # of int parms */
  
  typedef struct osi_logEntry {
--- 19,25 ----
  #include "osiqueue.h"
  
  #define OSI_LOG_DEFAULTSIZE	1000
! #define OSI_LOG_STRINGSIZE	128
  #define OSI_LOG_MAXPARMS	4	/* max # of int parms */
  
  typedef struct osi_logEntry {
Index: openafs/src/WINNT/install/NSIS/OpenAFS.nsi
diff -c openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.65 openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.69.2.2
*** openafs/src/WINNT/install/NSIS/OpenAFS.nsi:1.65	Mon Jul 26 16:39:54 2004
--- openafs/src/WINNT/install/NSIS/OpenAFS.nsi	Tue Aug 10 00:10:48 2004
***************
*** 626,631 ****
--- 626,633 ----
    StrCmp $R1 "1" +1 +2
    StrCpy $R2 "$R2-S"
    
+   WriteRegStr HKLM "SOFTWARE\OpenAFS\Client" "AfscredsShortcutParams" "$R2"
+   
    CreateShortCut "$SMPROGRAMS\OpenAFS\Client\Authentication.lnk" "$INSTDIR\Client\Program\afscreds.exe" "$R2"
    
    ReadINIStr $R1 $2 "Field 1" "State"
***************
*** 790,797 ****
   File "${AFS_SERVER_BUILDDIR}\afskasadmin.dll"
   File "${AFS_SERVER_BUILDDIR}\afsptsadmin.dll"
  
- !ifdef DEBUG
- !endif
   SetOutPath "$INSTDIR\Common"
     Call AFSLangFiles
     
--- 792,797 ----
***************
*** 1626,1632 ****
     Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.pdb"
     Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.pdb"
     Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb"
! 
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll"
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.pdb"
--- 1626,1632 ----
     Delete /REBOOTOK "$INSTDIR\Common\afscfgadmin.pdb"
     Delete /REBOOTOK "$INSTDIR\Common\afskasadmin.pdb"
     Delete /REBOOTOK "$INSTDIR\Common\afsptsadmin.pdb"
! !IFDEF DEBUG
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.dll"
     Delete /REBOOTOK "$INSTDIR\bin\msvcr71d.pdb"
***************
*** 1650,1655 ****
--- 1650,1656 ----
     Delete /REBOOTOK "$INSTDIR\bin\msvcrtd.dll"
     Delete /REBOOTOK "$INSTDIR\bin\msvcrtd.pdb"
  !ENDIF
+ !ENDIF
  !ELSE
  !IFDEF CL_1310
     Delete /REBOOTOK "$INSTDIR\bin\mfc71.dll"
***************
*** 1750,1759 ****
    
    Delete /REBOOTOK "$SYSDIR\afsserver.cpl"
    Delete /REBOOTOK "$SYSDIR\afs_cpa.cpl"
  
    Delete /REBOOTOK "$SYSDIR\afsserver.pdb"
    Delete /REBOOTOK "$SYSDIR\afs_cpa.pdb"
!   
    RMDir /r "$INSTDIR\Documentation\html\CmdRef"
    RMDir /r "$INSTDIR\Documentation\html\InstallGd"
    RMDir /r "$INSTDIR\Documentation\html\ReleaseNotes"
--- 1751,1762 ----
    
    Delete /REBOOTOK "$SYSDIR\afsserver.cpl"
    Delete /REBOOTOK "$SYSDIR\afs_cpa.cpl"
+   Delete /REBOOTOK "$SYSDIR\afslogon.dll"
  
    Delete /REBOOTOK "$SYSDIR\afsserver.pdb"
    Delete /REBOOTOK "$SYSDIR\afs_cpa.pdb"
!   Delete /REBOOTOK "$SYSDIR\afslogon.pdb"
! 
    RMDir /r "$INSTDIR\Documentation\html\CmdRef"
    RMDir /r "$INSTDIR\Documentation\html\InstallGd"
    RMDir /r "$INSTDIR\Documentation\html\ReleaseNotes"
Index: openafs/src/WINNT/install/loopback/wmi.cpp
diff -c openafs/src/WINNT/install/loopback/wmi.cpp:1.2 openafs/src/WINNT/install/loopback/wmi.cpp:1.3
*** openafs/src/WINNT/install/loopback/wmi.cpp:1.2	Thu Jun 24 00:08:57 2004
--- openafs/src/WINNT/install/loopback/wmi.cpp	Wed Aug  4 23:09:26 2004
***************
*** 739,764 ****
  		strcpy(buffer, etcPath);
  		strcat(buffer, ".old");
  
!         errno = 0;
! 		
!         if ((unlink( buffer ) != 0) &amp;&amp; (errno == EACCES))
!         {
!             ReportMessage(0,"FAILED : Can't delete file",buffer,0,errno);            
!             return FALSE;
!             
          }
-         
-         if ((errno) &amp;&amp; (errno != ENOENT)) ReportMessage(0,"WEIRD : errno after unlink ",0,0,errno);
  
! 		if(rename( etcPath, buffer) != 0)
! 		{
! 			ReportMessage(0,"FAILED : Can't rename old file",etcPath,0,errno);
! 			return FALSE;
! 		}
  
! 		if(rename( tempPath, etcPath ) != 0)
  		{
! 			ReportMessage(0,"FAILED : Can't rename new file",tempPath,0,errno);
  			return FALSE;
  		}
  
--- 739,782 ----
  		strcpy(buffer, etcPath);
  		strcat(buffer, ".old");
  
!         if(!DeleteFileA(buffer)) {
!             DWORD status;
!             int i;
!             char * eos;
! 
!             status = GetLastError();
!             if(status == ERROR_ACCESS_DENIED) {
!                 /* try changing the file attribtues. */
!                 if(SetFileAttributesA(buffer, FILE_ATTRIBUTE_NORMAL) &amp;&amp;
!                     DeleteFileA(buffer)) {
!                     status = 0;
!                     ReportMessage(0,"Changed attributes and deleted back host file", buffer, 0, 0);
!                 }
!             }
!             if(status &amp;&amp; status != ERROR_FILE_NOT_FOUND) {
!                 /* we can't delete the file.  Try to come up with 
!                    a different name that's not already taken. */
!                 srand(GetTickCount());
!                 eos = buffer + strlen(buffer);
!                 for(i=0; i &lt; 50; i++) {
!                     itoa(rand(), eos, 16);
!                     if(GetFileAttributesA(buffer) == INVALID_FILE_ATTRIBUTES &amp;&amp;
!                         GetLastError() == ERROR_FILE_NOT_FOUND)
!                         break;
!                 }
!                 /* At this point if we don't have a unique name, we just let the rename
!                    fail.  Too bad. */
!             }
          }
  
!         if(!MoveFileA( etcPath, buffer )) {
!             ReportMessage(0,"FAILED: Can't rename old file", etcPath, 0, GetLastError());
!             return FALSE;
!         }
  
! 		if(!MoveFileA( tempPath, etcPath ) != 0)
  		{
! 			ReportMessage(0,"FAILED : Can't rename new file", tempPath, 0, GetLastError());
  			return FALSE;
  		}
  
Index: openafs/src/WINNT/install/wix/feature.wxi
diff -c openafs/src/WINNT/install/wix/feature.wxi:1.4 openafs/src/WINNT/install/wix/feature.wxi:1.5
*** openafs/src/WINNT/install/wix/feature.wxi:1.4	Thu Jul 15 23:38:36 2004
--- openafs/src/WINNT/install/wix/feature.wxi	Wed Aug  4 12:36:15 2004
***************
*** 31,36 ****
--- 31,37 ----
  				
  				&lt;Feature Id="feaCredsStartup" AllowAdvertise="no" FollowParent="yes" Display="hidden" InstallDefault="local" Level="30"&gt;
  					&lt;ComponentRef Id="cmp_credsStartup" /&gt;
+ 					&lt;Condition Level="130"&gt;CREDSSTARTUP = 0&lt;/Condition&gt;
  				&lt;/Feature&gt;
  				
  			&lt;?ifdef DebugSyms?&gt;
***************
*** 45,54 ****
--- 46,59 ----
  			&lt;?endif?&gt;
  
  				&lt;ComponentRef Id="rcm_Client" /&gt;
+                 &lt;ComponentRef Id="rcm_ClientCacheSize" /&gt;
+                 &lt;ComponentRef Id="rcm_ClientCachePath" /&gt;
+ 
  				&lt;ComponentRef Id="cmp_CommonDir" /&gt;
  
                  &lt;ComponentRef Id="efl_Readme_TXT_$(var.Language)" /&gt;
                  &lt;ComponentRef Id="efl_CellServDB" /&gt;
+                 &lt;ComponentRef Id="cpf_CellServDB" /&gt;
                  &lt;ComponentRef Id="cmf_afs_cpa_CPL" /&gt;
  
                  &lt;ComponentRef Id="cmf_afsrpc_DLL" /&gt;
Index: openafs/src/WINNT/install/wix/files.wxi
diff -c openafs/src/WINNT/install/wix/files.wxi:1.6 openafs/src/WINNT/install/wix/files.wxi:1.9.2.1
*** openafs/src/WINNT/install/wix/files.wxi:1.6	Thu Jul 22 05:23:57 2004
--- openafs/src/WINNT/install/wix/files.wxi	Tue Aug 10 00:10:50 2004
***************
*** 1,17 ****
  &lt;?xml version="1.0"?&gt;
  &lt;Include&gt;
-     &lt;Directory Id="WindowsFolder"&gt;
-     &lt;/Directory&gt;
      &lt;Directory Id="SystemFolder"&gt;
          &lt;Component Id="cmf_afslogon_DLL" Guid="123197FE-4F53-4035-8D51-FCFB6B50A777"&gt;
              &lt;File Id="fileafslogon_DLL" Name="afslogon.dll" LongName="afslogon.dll" KeyPath="yes" DiskId="1" src="$(var.ClientDir)afslogon.dll" /&gt;
!             &lt;Registry Id="reg_afslogon01" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="*" /&gt;
              &lt;Registry Id="reg_afslogon02" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" /&gt;
!             &lt;Registry Id="reg_afslogon03" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Asynchronous" Value="0" Type="integer" /&gt;
!             &lt;Registry Id="reg_afslogon04" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Impersonate" Value="1" Type="integer" /&gt;
!             &lt;Registry Id="reg_afslogon05" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="DLLName" Value="#fileafslogon_DLL" /&gt;
!             &lt;Registry Id="reg_afslogon06" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logoff" Value="AFS_Logoff_Event" /&gt;
!             &lt;Registry Id="reg_afslogon07" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Startup" Value="AFS_Startup_Event" /&gt;
          &lt;/Component&gt;
      &lt;?ifdef DebugSyms?&gt;
          &lt;Component Id="cmp_ClientSystemDebug" Guid="DD34DA09-D9DA-4A5A-9521-87B7738A7D53"&gt;
--- 1,15 ----
  &lt;?xml version="1.0"?&gt;
  &lt;Include&gt;
      &lt;Directory Id="SystemFolder"&gt;
          &lt;Component Id="cmf_afslogon_DLL" Guid="123197FE-4F53-4035-8D51-FCFB6B50A777"&gt;
              &lt;File Id="fileafslogon_DLL" Name="afslogon.dll" LongName="afslogon.dll" KeyPath="yes" DiskId="1" src="$(var.ClientDir)afslogon.dll" /&gt;
!             &lt;Registry Id="reg_afslogon01" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Action="createKeyAndRemoveKeyOnUninstall" /&gt;
              &lt;Registry Id="reg_afslogon02" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" /&gt;
!             &lt;Registry Id="reg_afslogon03" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Asynchronous" Type="integer" Value="0" /&gt;
!             &lt;Registry Id="reg_afslogon04" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Impersonate" Type="integer" Value="1" /&gt;
!             &lt;Registry Id="reg_afslogon05" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="DLLName" Type="string" Value="[#fileafslogon_DLL]" /&gt;
!             &lt;Registry Id="reg_afslogon06" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Logoff" Type="string" Value="AFS_Logoff_Event" /&gt;
!             &lt;Registry Id="reg_afslogon07" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\Notify\AfsLogon" Name="Startup" Type="string" Value="AFS_Startup_Event" /&gt;
          &lt;/Component&gt;
      &lt;?ifdef DebugSyms?&gt;
          &lt;Component Id="cmp_ClientSystemDebug" Guid="DD34DA09-D9DA-4A5A-9521-87B7738A7D53"&gt;
***************
*** 733,741 ****
              &lt;/Directory&gt; &lt;!-- Documentation --&gt;
  
              &lt;Directory Id="dirClient" Name="Client" LongName="Client" SourceName="."&gt;
!                 &lt;Component Id="efl_CellServDB" Guid="8E69FDAB-08C5-4927-B1AA-57FCEEB065F2"&gt;
                      &lt;File Id="file_CellServDB" Name="CelSrvDB" LongName="CellServDB" KeyPath="yes" DiskId="1" src="$(var.CellDbFile)"/&gt;
!                     &lt;CopyFile Id="copy_CellServDB" Delete="yes" DestinationFolder="dirClient" SourceFolder="WindowsFolder" SourceName="afsdcell.ini" /&gt;
                  &lt;/Component&gt;
                  &lt;Directory Id="dirProgram" Name="Program" LongName="Program" SourceName="." src="$(var.ClientDir)"&gt;
                      &lt;Component Id="cmf_afsshare_EXE" Guid="E972DA35-E950-4736-AE48-E6DDCE8C97D0"&gt;
--- 731,744 ----
              &lt;/Directory&gt; &lt;!-- Documentation --&gt;
  
              &lt;Directory Id="dirClient" Name="Client" LongName="Client" SourceName="."&gt;
!                 &lt;Component Id="efl_CellServDB" Guid="8E69FDAB-08C5-4927-B1AA-57FCEEB065F2" NeverOverwrite="yes" Permanent="yes"&gt;
                      &lt;File Id="file_CellServDB" Name="CelSrvDB" LongName="CellServDB" KeyPath="yes" DiskId="1" src="$(var.CellDbFile)"/&gt;
!                     &lt;Condition&gt;OLDCELLSERVDB = ""&lt;/Condition&gt;
!                 &lt;/Component&gt;
!                 &lt;Component Id="cpf_CellServDB" Guid="D5BA4C15-DBEC-4292-91FC-B54C30F24F2A"&gt;
! 					&lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client" Name="CellServDBMoved" Type="integer" Value="1" Id="reg_OldCellDB" KeyPath="yes" /&gt;
!                     &lt;CopyFile Id="copy_CellServDB" Delete="yes" DestinationDirectory="dirClient" DestinationName="CellServ|CellServDB" SourceDirectory="WindowsFolder" SourceName="afsdcell.ini" /&gt;
!                     &lt;Condition&gt;OLDCELLSERVDB &amp;lt;&amp;gt; ""&lt;/Condition&gt;
                  &lt;/Component&gt;
                  &lt;Directory Id="dirProgram" Name="Program" LongName="Program" SourceName="." src="$(var.ClientDir)"&gt;
                      &lt;Component Id="cmf_afsshare_EXE" Guid="E972DA35-E950-4736-AE48-E6DDCE8C97D0"&gt;
***************
*** 779,785 ****
                      &lt;/Component&gt;
                      &lt;Component Id="cmf_afsd_service_EXE" Guid="37A90054-505D-4C57-B489-7EF4D97B86F6"&gt;
                          &lt;File Id="fileafsd_service_EXE" Name="afsd_svc.exe" LongName="afsd_service.exe" KeyPath="yes" DiskId="1" /&gt;
!                         &lt;ServiceControl Id="TransarcAFSDaemon" Name="TransarcAFSDaemon" Stop="both" Delete="both" Wait="yes" /&gt;
                          &lt;ServiceInstall Id="svc_Client" Name="TransarcAFSDaemon" DisplayName="OpenAFS Client" Type="ownProcess" Start="auto" ErrorControl="normal" Description="Provides access to files and directories stored in AFS"&gt;
  							&lt;!-- ServiceConfig doesn't currently do what you think it does.
  							     We instead use a custom action to set the service failure actions.
--- 782,788 ----
                      &lt;/Component&gt;
                      &lt;Component Id="cmf_afsd_service_EXE" Guid="37A90054-505D-4C57-B489-7EF4D97B86F6"&gt;
                          &lt;File Id="fileafsd_service_EXE" Name="afsd_svc.exe" LongName="afsd_service.exe" KeyPath="yes" DiskId="1" /&gt;
!                         &lt;ServiceControl Id="TransarcAFSDaemon" Name="TransarcAFSDaemon" Stop="both" Remove="both" Wait="yes" /&gt;
                          &lt;ServiceInstall Id="svc_Client" Name="TransarcAFSDaemon" DisplayName="OpenAFS Client" Type="ownProcess" Start="auto" ErrorControl="normal" Description="Provides access to files and directories stored in AFS"&gt;
  							&lt;!-- ServiceConfig doesn't currently do what you think it does.
  							     We instead use a custom action to set the service failure actions.
***************
*** 828,834 ****
                      &lt;/Component&gt;
  					&lt;Component Id="cmf_afs_cpa_CPL" Guid="C83091EC-2967-4AC6-A34D-860CD7FEDA57"&gt;
  						&lt;File Id="fileafs_cpa_CPL" Name="afs_cpa.cpl" LongName="afs_cpa.cpl" KeyPath="yes" DiskId="1"/&gt;
! 				        &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" Name="AFS Client CPL" Value="[#fileafs_cpa_CPL]" Id="reg_Full_Client11" /&gt;
  					&lt;/Component&gt;
                  &lt;?ifdef DebugSyms?&gt;
                      &lt;Component Id="cmp_ClientProgramDebug" Guid="A6A394F6-45D0-45A9-A7DD-C0997070EC14"&gt;
--- 831,837 ----
                      &lt;/Component&gt;
  					&lt;Component Id="cmf_afs_cpa_CPL" Guid="C83091EC-2967-4AC6-A34D-860CD7FEDA57"&gt;
  						&lt;File Id="fileafs_cpa_CPL" Name="afs_cpa.cpl" LongName="afs_cpa.cpl" KeyPath="yes" DiskId="1"/&gt;
! 				        &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" Name="AFS Client CPL" Type="string" Value="[#fileafs_cpa_CPL]" Id="reg_Full_Client11" /&gt;
  					&lt;/Component&gt;
                  &lt;?ifdef DebugSyms?&gt;
                      &lt;Component Id="cmp_ClientProgramDebug" Guid="A6A394F6-45D0-45A9-A7DD-C0997070EC14"&gt;
***************
*** 1198,1204 ****
                              &lt;/Component&gt;
                              &lt;Component Id="cmf_bosctlsvc_EXE" Guid="8F6F62A8-BB6D-46C1-BA80-4F207AA24F0D"&gt;
                                  &lt;File Id="filebosctlsvc_EXE" Name="bosct.exe" LongName="bosctlsvc.exe" KeyPath="yes" DiskId="1" /&gt;
!                                 &lt;ServiceControl Id="TransarcAFSServer" Name="TransarcAFSServer" Stop="both" Delete="both" Wait="yes" /&gt;
                                  &lt;ServiceInstall Id="svc_Server" Name="TransarcAFSServer" DisplayName="OpenAFS Server" Type="ownProcess" Start="auto" ErrorControl="normal" Description="Manages AFS server processes"&gt;
  									&lt;!-- ServiceConfig does nothing 
                                      &lt;ServiceConfig FirstFailureActionType="restart" RestartServiceDelayInSeconds="5" SecondFailureActionType="restart" ThirdFailureActionType="none"/&gt;
--- 1201,1207 ----
                              &lt;/Component&gt;
                              &lt;Component Id="cmf_bosctlsvc_EXE" Guid="8F6F62A8-BB6D-46C1-BA80-4F207AA24F0D"&gt;
                                  &lt;File Id="filebosctlsvc_EXE" Name="bosct.exe" LongName="bosctlsvc.exe" KeyPath="yes" DiskId="1" /&gt;
!                                 &lt;ServiceControl Id="TransarcAFSServer" Name="TransarcAFSServer" Stop="both" Remove="both" Wait="yes" /&gt;
                                  &lt;ServiceInstall Id="svc_Server" Name="TransarcAFSServer" DisplayName="OpenAFS Server" Type="ownProcess" Start="auto" ErrorControl="normal" Description="Manages AFS server processes"&gt;
  									&lt;!-- ServiceConfig does nothing 
                                      &lt;ServiceConfig FirstFailureActionType="restart" RestartServiceDelayInSeconds="5" SecondFailureActionType="restart" ThirdFailureActionType="none"/&gt;
***************
*** 1237,1243 ****
                              &lt;/Component&gt;
  							&lt;Component Id="cmf_afsserver_CPL" Guid="E270281E-9DB2-40A8-A418-55B4EC4A3FE7"&gt;
  								&lt;File Id="fileafsserver_CPL" Name="afsserve.cpl" LongName="afsserver.cpl" KeyPath="yes" DiskId="1"/&gt;
! 						        &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" Name="AFS Server CPL" Value="[#fileafsserver_CPL]" Id="reg_Server30" /&gt;
  							&lt;/Component&gt;
  
                              &lt;Component Id="cmp_Server_Program" Guid="8C4D0351-8EBF-4192-BF63-DCB3AADF4115" KeyPath="yes"&gt;
--- 1240,1246 ----
                              &lt;/Component&gt;
  							&lt;Component Id="cmf_afsserver_CPL" Guid="E270281E-9DB2-40A8-A418-55B4EC4A3FE7"&gt;
  								&lt;File Id="fileafsserver_CPL" Name="afsserve.cpl" LongName="afsserver.cpl" KeyPath="yes" DiskId="1"/&gt;
! 						        &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls" Name="AFS Server CPL" Type="string" Value="[#fileafsserver_CPL]" Id="reg_Server30" /&gt;
  							&lt;/Component&gt;
  
                              &lt;Component Id="cmp_Server_Program" Guid="8C4D0351-8EBF-4192-BF63-DCB3AADF4115" KeyPath="yes"&gt;
***************
*** 1279,1287 ****
  
          &lt;/Directory&gt; &lt;!-- AFS --&gt;
      &lt;/Directory&gt; &lt;!-- program files --&gt;
      &lt;Directory Id="ProgramMenuFolder" Name="."&gt;
          &lt;Directory Id="dirShortCut" Name="OpenAFS" LongName="OpenAFS"/&gt;
      &lt;/Directory&gt;
!     &lt;Directory Id="StartupFolder" Name="."&gt;
!     &lt;/Directory&gt;
  &lt;/Include&gt;
--- 1282,1292 ----
  
          &lt;/Directory&gt; &lt;!-- AFS --&gt;
      &lt;/Directory&gt; &lt;!-- program files --&gt;
+     &lt;!-- References --&gt;
      &lt;Directory Id="ProgramMenuFolder" Name="."&gt;
          &lt;Directory Id="dirShortCut" Name="OpenAFS" LongName="OpenAFS"/&gt;
      &lt;/Directory&gt;
!     &lt;Directory Id="StartupFolder" Name="." /&gt;
!     &lt;Directory Id="WindowsVolume" Name="." /&gt;
!     &lt;Directory Id="WindowsFolder" Name="." /&gt;
  &lt;/Include&gt;
Index: openafs/src/WINNT/install/wix/openafs.wxs
diff -c openafs/src/WINNT/install/wix/openafs.wxs:1.5 openafs/src/WINNT/install/wix/openafs.wxs:1.6
*** openafs/src/WINNT/install/wix/openafs.wxs:1.5	Thu Jun 24 00:11:02 2004
--- openafs/src/WINNT/install/wix/openafs.wxs	Wed Aug  4 12:36:15 2004
***************
*** 23,28 ****
--- 23,29 ----
  		         Id="$(var.PackageCode)"
  		--&gt;
          &lt;Package
+ 		 Id="????????-????-????-????-????????????"
           AdminImage="no"
           Comments="$(var.PackageComments)"
           Compressed="yes"
Index: openafs/src/WINNT/install/wix/property.wxi
diff -c openafs/src/WINNT/install/wix/property.wxi:1.5 openafs/src/WINNT/install/wix/property.wxi:1.6
*** openafs/src/WINNT/install/wix/property.wxi:1.5	Sat Jul 24 03:35:04 2004
--- openafs/src/WINNT/install/wix/property.wxi	Wed Aug  4 12:36:15 2004
***************
*** 20,25 ****
--- 20,31 ----
  	&lt;!-- empty property 
  	&lt;Property Id="CREDSSHOW"&gt;&lt;/Property&gt;
  	--&gt;
+ 	&lt;!-- empty property
+ 	&lt;Property Id="AFSCACHEPATH"&gt;&lt;/Property&gt;
+ 	--&gt;
+ 	&lt;!-- empty property
+ 	&lt;Property Id="AFSCACHESIZE"&gt;&lt;/Property&gt;
+ 	--&gt;
  
      &lt;!-- Add/remove programs --&gt;
      &lt;Property Id="ARPCOMMENTS"&gt;$(var.ProductComments)&lt;/Property&gt;
***************
*** 109,112 ****
--- 115,124 ----
      
      &lt;Property Id="ABORTREASON"&gt;$(loc.StrNsisAbortReason)&lt;/Property&gt;
  
+     &lt;Property Id="OLDCELLSERVDB"&gt;
+       &lt;DirectorySearch Id="dsOldCellServDB" Path="[WindowsFolder]" &gt;
+         &lt;FileSearch Id="fsOldCellServDB" Name="afsdcell.ini" /&gt;
+       &lt;/DirectorySearch&gt;
+     &lt;/Property&gt;
+ 
  &lt;/Include&gt;
Index: openafs/src/WINNT/install/wix/registry.wxi
diff -c openafs/src/WINNT/install/wix/registry.wxi:1.4 openafs/src/WINNT/install/wix/registry.wxi:1.5
*** openafs/src/WINNT/install/wix/registry.wxi:1.4	Sat Jul 24 03:35:04 2004
--- openafs/src/WINNT/install/wix/registry.wxi	Wed Aug  4 12:36:15 2004
***************
*** 4,87 ****
      This file will be included as a child of the root Directory tag.
      --&gt;
      &lt;Component Id="rcm_Server" Guid="D30C980B-8284-49DF-88F5-C90BBFB3E80D"&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Name="*" Id="reg_Server"/&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Id="reg_Server3"/&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Name="TypesSupported" Type="integer" Value="7" Id="reg_Server4" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="*" Id="reg_Server5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Server6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Id="reg_Server7" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Server8" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Server9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Server10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="Software Type" Value="File System" Id="reg_Server11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="PathName" Value="[AFSDIR]Server" Id="reg_Server12" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Server13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Server15" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="Description" Value="$(loc.StrAFSServerDesc)" Id="reg_Server16" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="*" Id="reg_Server18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Server19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Id="reg_Server20" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Server21" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Server22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Server23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="Software Type" Value="File System" Id="reg_Server24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="PathName" Value="[AFSDIR]Server" Id="reg_Server25" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Server26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Server28" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="Description" Value="$(loc.StrAFSServerDesc)" Id="reg_Server29" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server" Name="*" Id="reg_Server31"/&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server" Id="reg_Server32" KeyPath="yes"/&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Name="EventMessageFile" Value="[AFSDIR]Common\afseventmsg_$(var.LanguageCode).dll" Id="reg_Server_$(var.LanguageCode)" /&gt;
      &lt;/Component&gt;
  
      &lt;Component Id="rcm_Control_Center" Guid="2007844F-E101-4C99-81F5-EF9AEAD98821"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center" KeyPath="yes" Id="reg_Control_Center2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center" Name="*" Id="reg_Control_Center" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="*" Id="reg_Control_Center3" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Control_Center4" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Id="reg_Control_Center5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Control_Center6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Control_Center7" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Control_Center8" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="Software Type" Value="File System" Id="reg_Control_Center9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="PathName" Value="[AFSDIR]Control Center" Id="reg_Control_Center10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Control_Center11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Control_Center13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="Description" Value="$(loc.StrAFSCCDesc)" Id="reg_Control_Center14" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="*" Id="reg_Control_Center16" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Control_Center17" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Id="reg_Control_Center18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Control_Center19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Control_Center20" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Control_Center21" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="Software Type" Value="File System" Id="reg_Control_Center22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="PathName" Value="[AFSDIR]Control Center" Id="reg_Control_Center23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Control_Center24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Control_Center26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="Description" Value="$(loc.StrAFSCCDesc)" Id="reg_Control_Center27" /&gt;
      &lt;/Component&gt;
      &lt;Component Id="rcm_Client" Guid="954679B0-547B-4F1E-9A3A-ABFB15B6C724"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" Id="reg_Client_NoUninstall2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" Name="+" Id="reg_Client_NoUninstall" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" Name="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Value="$(loc.StrShlExtDesc)" Id="reg_Client_NoUninstall3" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client" Name="*" Id="reg_Client" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client" Id="reg_Client2" KeyPath="yes" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="*" Id="reg_Client5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Client6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Id="reg_Client7" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Client8" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Client9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Client10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="Software Type" Value="File System" Id="reg_Client11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="PathName" Value="[AFSDIR]Client" Id="reg_Client12" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Client13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="Title" Id="reg_Client15" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Client16" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="Description" Value="$(loc.StrAFSClientDesc)" Id="reg_Client17" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client" Name="ShowTrayIcon" Type="integer" Value="1" Id="reg_Client18" /&gt;
!         &lt;Registry Root="HKCR" Key="*\shellex\ContextMenuHandlers\AFS Client Shell Extension" Name="*" Id="reg_Client19" /&gt;
!         &lt;Registry Root="HKCR" Key="*\shellex\ContextMenuHandlers\AFS Client Shell Extension" Value="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Id="reg_Client20" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="*" Id="reg_Client21" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="AuthentProviderPath" Type="expandable" Value="[SystemFolder]afslogon.dll" Id="reg_Client22" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Id="reg_Client23" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="LogonOptions" Type="integer" Value="[LOGONOPTIONS]" Id="reg_Client24" /&gt;
--- 4,91 ----
      This file will be included as a child of the root Directory tag.
      --&gt;
      &lt;Component Id="rcm_Server" Guid="D30C980B-8284-49DF-88F5-C90BBFB3E80D"&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Server"/&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Id="reg_Server3"/&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Name="TypesSupported" Type="integer" Value="7" Id="reg_Server4" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Server5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Server6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Id="reg_Server7" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Server8" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Server9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Server10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="Software Type" Type="string" Value="File System" Id="reg_Server11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="PathName" Type="string" Value="[AFSDIR]Server" Id="reg_Server12" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Server13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Server15" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\$(var.NumericVersion)" Name="Description" Type="string" Value="$(loc.StrAFSServerDesc)" Id="reg_Server16" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Server18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Server19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Id="reg_Server20" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Server21" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Server22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Server23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="Software Type" Type="string" Value="File System" Id="reg_Server24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="PathName" Type="string" Value="[AFSDIR]Server" Id="reg_Server25" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Server26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Server28" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server\CurrentVersion" Name="Description" Type="string" Value="$(loc.StrAFSServerDesc)" Id="reg_Server29" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Server31"/&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Server" Id="reg_Server32" KeyPath="yes"/&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\AFS Service" Name="EventMessageFile" Type="string" Value="[AFSDIR]Common\afseventmsg_$(var.LanguageCode).dll" Id="reg_Server_$(var.LanguageCode)" /&gt;
      &lt;/Component&gt;
  
      &lt;Component Id="rcm_Control_Center" Guid="2007844F-E101-4C99-81F5-EF9AEAD98821"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center" KeyPath="yes" Id="reg_Control_Center2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Control_Center" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Control_Center3" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Control_Center4" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Id="reg_Control_Center5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Control_Center6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Control_Center7" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Control_Center8" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="Software Type" Type="string" Value="File System" Id="reg_Control_Center9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="PathName" Type="string" Value="[AFSDIR]Control Center" Id="reg_Control_Center10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Control_Center11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Control_Center13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\CurrentVersion" Name="Description" Type="string" Value="$(loc.StrAFSCCDesc)" Id="reg_Control_Center14" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Control_Center16" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Control_Center17" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Id="reg_Control_Center18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Control_Center19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Control_Center20" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Control_Center21" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="Software Type" Type="string" Value="File System" Id="reg_Control_Center22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="PathName" Type="string" Value="[AFSDIR]Control Center" Id="reg_Control_Center23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Control_Center24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Control_Center26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Control Center\$(var.NumericVersion)" Name="Description" Type="string" Value="$(loc.StrAFSCCDesc)" Id="reg_Control_Center27" /&gt;
      &lt;/Component&gt;
      &lt;Component Id="rcm_Client" Guid="954679B0-547B-4F1E-9A3A-ABFB15B6C724"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" Id="reg_Client_NoUninstall2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" Action="createKey" Id="reg_Client_NoUninstall" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" Name="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Type="string" Value="$(loc.StrShlExtDesc)" Id="reg_Client_NoUninstall3" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client" Id="reg_Client2" KeyPath="yes" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Client6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Id="reg_Client7" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Client8" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Client9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Client10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="Software Type" Type="string" Value="File System" Id="reg_Client11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="PathName" Type="string" Value="[AFSDIR]Client" Id="reg_Client12" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Client13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Client16" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\CurrentVersion" Name="Description" Type="string" Value="$(loc.StrAFSClientDesc)" Id="reg_Client17" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client" Action="createKey" Id="reg_Client50" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client\CSCPolicy" Action="createKey" Id="reg_Client51" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client\Freelance" Action="createKey" Id="reg_Client52" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client\Submounts" Action="createKey" Id="reg_Client53" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client" Name="AfscredsShortcutParams" Type="string" Value="[CREDSAUTOINIT] [CREDSRENEWDRMAP] [CREDSIPCHDET] [CREDSQUIET] [CREDSSHOW]" Id="reg_Client54" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client" Name="ShowTrayIcon" Type="integer" Value="1" Id="reg_Client18" /&gt;
!         &lt;Registry Root="HKCR" Key="*\shellex\ContextMenuHandlers\AFS Client Shell Extension" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client19" /&gt;
!         &lt;Registry Root="HKCR" Key="*\shellex\ContextMenuHandlers\AFS Client Shell Extension" Type="string" Value="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Id="reg_Client20" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client21" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="AuthentProviderPath" Type="expandable" Value="[SystemFolder]afslogon.dll" Id="reg_Client22" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Id="reg_Client23" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="LogonOptions" Type="integer" Value="[LOGONOPTIONS]" Id="reg_Client24" /&gt;
***************
*** 89,177 ****
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="ProviderPath" Type="expandable" Value="[SystemFolder]afslogon.dll" Id="reg_Client26" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="LogonScript" Type="expandable" Value="[AFSDIR]Client\Program\afscreds.exe -:%s -x -a -m -n -q" Id="reg_Client27" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="Class" Type="integer" Value="2" Id="reg_Client29" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="Name" Value="TransarcAFSDaemon" Id="reg_Client30" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="*" Id="reg_Client31" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Client32" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Id="reg_Client33" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Client34" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Client35" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Client36" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="Software Type" Value="File System" Id="reg_Client37" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="PathName" Value="[AFSDIR]Client" Id="reg_Client38" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Client39" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="Title" Id="reg_Client41" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Client42" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="Description" Value="$(loc.StrAFSClientDesc)" Id="reg_Client43" /&gt;
!         &lt;Registry Root="HKCR" Key="FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" Name="*" Id="reg_Client45" /&gt;
!         &lt;Registry Root="HKCR" Key="FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" Value="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Id="reg_Client46" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="*" Id="reg_Client47" /&gt;
!         &lt;Registry Root="HKCR" Key="DIRECTORY\shellex\ContextMenuHandlers\AFS Client Shell Extension" Name="*" Id="reg_Client48" /&gt;
!         &lt;Registry Root="HKCR" Key="DIRECTORY\shellex\ContextMenuHandlers\AFS Client Shell Extension" Value="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Id="reg_Client49" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="*" Id="reg_Full_Client" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="HideDotFiles" Type="integer" Value="[HIDEDOTFILES]" Id="reg_Full_Client2" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Id="reg_Full_Client3" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="IsGateway" Type="integer" Value="0" Id="reg_Full_Client4" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="RxMaxMTU" Type="integer" Value="[RXMAXMTU]" Id="reg_Full_Client5" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="NetbiosName" Value="[NETBIOSNAME]" Id="reg_Full_Client6" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="Cell" Value="[AFSCELLNAME]" Id="regAFSCellName" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="MountRoot" Value="[MOUNTROOT]" Id="reg_Full_Client7" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="NoFindLanaByName" Type="integer" Value="[NOFINDLANABYNAME]" Id="reg_Full_Client8" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="FreelanceClient" Type="integer" Value="[FREELANCEMODE]" Id="reg_Full_Client9" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="UseDNS" Type="integer" Value="[USEDNS]" Id="reg_Full_Client10" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="SecurityLevel" Type="integer" Value="[SECURITYLEVEL]" Id="reg_Full_Client12" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="SMBAuthType" Type="integer" Value="[SMBAUTHTYPE]" Id="reg_Full_Client13" /&gt;
      &lt;/Component&gt;
      &lt;Component Id="rcm_Documentation" Guid="97493526-4A5C-4C55-A1D6-EA38841B1B85"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation" KeyPath="yes" Id="reg_Docs2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation" Name="*" Id="reg_Docs" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="*" Id="reg_Docs3" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Docs4" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Id="reg_Docs5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Docs6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Docs7" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Docs8" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="Software Type" Value="File System" Id="reg_Docs9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="PathName" Value="[AFSDIR]Documentation" Id="reg_Docs10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Docs11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Docs13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="Description" Value="$(loc.StrAFSDocDesc)" Id="reg_Docs14" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="*" Id="reg_Docs16" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Docs17" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Id="reg_Docs18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Docs19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Docs20" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_Docs21" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="Software Type" Value="File System" Id="reg_Docs22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="PathName" Value="[AFSDIR]Documentation" Id="reg_Docs23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_Docs24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_Docs26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="Description" Value="$(loc.StrAFSDocDesc)" Id="reg_Docs27" /&gt;
      &lt;/Component&gt;
      &lt;Component Id="rcm_SDK" Guid="648BE65B-C152-412C-A45C-1562512B52DC"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK" KeyPath="yes" Id="reg_SDK2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK" Name="*" Id="reg_SDK" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="*" Id="reg_SDK3" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_SDK4" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Id="reg_SDK5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_SDK6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_SDK7" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_SDK8" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="Software Type" Value="File System" Id="reg_SDK9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="PathName" Value="[AFSDIR]lib" Id="reg_SDK10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_SDK11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_SDK13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="Description" Value="$(loc.StrAFSSDKDesc)" Id="reg_SDK14" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="*" Id="reg_SDK16" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_SDK17" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Id="reg_SDK18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_SDK19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_SDK20" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="ReleaseType" Value="$(var.ReleaseType)" Id="reg_SDK21" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="Software Type" Value="File System" Id="reg_SDK22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="PathName" Value="[AFSDIR]lib" Id="reg_SDK23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="VersionString" Value="$(var.NumericVersion)" Id="reg_SDK24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="InstallDateString" Value="$(var.InstallTimestamp)" Id="reg_SDK26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="Description" Value="$(loc.StrAFSSDKDesc)" Id="reg_SDK27" /&gt;
      &lt;/Component&gt;
  
      &lt;!-- Work around bug KB30673.  Only for Windows 2000. --&gt;    
--- 93,188 ----
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="ProviderPath" Type="expandable" Value="[SystemFolder]afslogon.dll" Id="reg_Client26" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="LogonScript" Type="expandable" Value="[AFSDIR]Client\Program\afscreds.exe -:%s -x -a -m -n -q" Id="reg_Client27" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="Class" Type="integer" Value="2" Id="reg_Client29" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\NetworkProvider" Name="Name" Type="string" Value="TransarcAFSDaemon" Id="reg_Client30" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client31" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Client32" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Id="reg_Client33" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Client34" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Client35" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Client36" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="Software Type" Type="string" Value="File System" Id="reg_Client37" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="PathName" Type="string" Value="[AFSDIR]Client" Id="reg_Client38" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Client39" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Client42" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Client\$(var.NumericVersion)" Name="Description" Type="string" Value="$(loc.StrAFSClientDesc)" Id="reg_Client43" /&gt;
!         &lt;Registry Root="HKCR" Key="FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client45" /&gt;
!         &lt;Registry Root="HKCR" Key="FOLDER\shellex\ContextMenuHandlers\AFS Client Shell Extension" Type="string" Value="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Id="reg_Client46" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client47" /&gt;
!         &lt;Registry Root="HKCR" Key="DIRECTORY\shellex\ContextMenuHandlers\AFS Client Shell Extension" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Client48" /&gt;
!         &lt;Registry Root="HKCR" Key="DIRECTORY\shellex\ContextMenuHandlers\AFS Client Shell Extension" Type="string" Value="{DC515C27-6CAC-11D1-BAE7-00C04FD140D2}" Id="reg_Client49" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Full_Client" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="HideDotFiles" Type="integer" Value="[HIDEDOTFILES]" Id="reg_Full_Client2" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Id="reg_Full_Client3" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="IsGateway" Type="integer" Value="0" Id="reg_Full_Client4" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="RxMaxMTU" Type="integer" Value="[RXMAXMTU]" Id="reg_Full_Client5" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="NetbiosName" Type="string" Value="[NETBIOSNAME]" Id="reg_Full_Client6" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="Cell" Type="string" Value="[AFSCELLNAME]" Id="regAFSCellName" /&gt;
!         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="MountRoot" Type="string" Value="[MOUNTROOT]" Id="reg_Full_Client7" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="NoFindLanaByName" Type="integer" Value="[NOFINDLANABYNAME]" Id="reg_Full_Client8" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="FreelanceClient" Type="integer" Value="[FREELANCEMODE]" Id="reg_Full_Client9" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="UseDNS" Type="integer" Value="[USEDNS]" Id="reg_Full_Client10" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="SecurityLevel" Type="integer" Value="[SECURITYLEVEL]" Id="reg_Full_Client12" /&gt;
          &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="SMBAuthType" Type="integer" Value="[SMBAUTHTYPE]" Id="reg_Full_Client13" /&gt;
      &lt;/Component&gt;
+     &lt;Component Id="rcm_ClientCachePath" Guid="4080E08D-6649-4A06-B286-F5E737DF4D8A" Transitive="yes"&gt;
+         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="CachePath" Type="expandable" Value="[AFSCACHEPATH]" Id="reg_Full_Client14" KeyPath="yes" /&gt;
+         &lt;Condition&gt;AFSCACHEPATH &amp;lt;&amp;gt; ""&lt;/Condition&gt;
+     &lt;/Component&gt;
+     &lt;Component Id="rcm_ClientCacheSize" Guid="F3A12290-920B-42E9-8E49-4958D7C0B6E2" Transitive="yes"&gt;
+         &lt;Registry Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters" Name="CacheSize" Type="integer" Value="[AFSCACHESIZE]" Id="reg_Full_Client15" KeyPath="yes" /&gt;
+         &lt;Condition&gt;AFSCACHESIZE &amp;lt;&amp;gt; ""&lt;/Condition&gt;
+     &lt;/Component&gt;
      &lt;Component Id="rcm_Documentation" Guid="97493526-4A5C-4C55-A1D6-EA38841B1B85"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation" KeyPath="yes" Id="reg_Docs2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Docs" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Docs3" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Docs4" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Id="reg_Docs5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Docs6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Docs7" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Docs8" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="Software Type" Type="string" Value="File System" Id="reg_Docs9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="PathName" Type="string" Value="[AFSDIR]Documentation" Id="reg_Docs10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Docs11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Docs13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\CurrentVersion" Name="Description" Type="string" Value="$(loc.StrAFSDocDesc)" Id="reg_Docs14" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_Docs16" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_Docs17" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Id="reg_Docs18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_Docs19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_Docs20" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_Docs21" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="Software Type" Type="string" Value="File System" Id="reg_Docs22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="PathName" Type="string" Value="[AFSDIR]Documentation" Id="reg_Docs23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_Docs24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_Docs26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS Supplemental Documentation\$(var.NumericVersion)" Name="Description" Type="string" Value="$(loc.StrAFSDocDesc)" Id="reg_Docs27" /&gt;
      &lt;/Component&gt;
      &lt;Component Id="rcm_SDK" Guid="648BE65B-C152-412C-A45C-1562512B52DC"&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK" KeyPath="yes" Id="reg_SDK2" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_SDK" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_SDK3" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_SDK4" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Id="reg_SDK5" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_SDK6" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_SDK7" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_SDK8" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="Software Type" Type="string" Value="File System" Id="reg_SDK9" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="PathName" Type="string" Value="[AFSDIR]lib" Id="reg_SDK10" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_SDK11" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_SDK13" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\CurrentVersion" Name="Description" Type="string" Value="$(loc.StrAFSSDKDesc)" Id="reg_SDK14" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Action="createKeyAndRemoveKeyOnUninstall" Id="reg_SDK16" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="MinorVersion" Type="integer" Value="$(var.VersionMinor)" Id="reg_SDK17" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Id="reg_SDK18" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="PatchLevel" Type="integer" Value="$(var.VersionPatch)" Id="reg_SDK19" /&gt;
          &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="MajorVersion" Type="integer" Value="$(var.VersionMajor)" Id="reg_SDK20" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="ReleaseType" Type="string" Value="$(var.ReleaseType)" Id="reg_SDK21" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="Software Type" Type="string" Value="File System" Id="reg_SDK22" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="PathName" Type="string" Value="[AFSDIR]lib" Id="reg_SDK23" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="VersionString" Type="string" Value="$(var.NumericVersion)" Id="reg_SDK24" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="InstallDateString" Type="string" Value="$(var.InstallTimestamp)" Id="reg_SDK26" /&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\TransarcCorporation\AFS SDK\$(var.NumericVersion)" Name="Description" Type="string" Value="$(loc.StrAFSSDKDesc)" Id="reg_SDK27" /&gt;
      &lt;/Component&gt;
  
      &lt;!-- Work around bug KB30673.  Only for Windows 2000. --&gt;    
***************
*** 185,191 ****
  	     being removed when the product is uninstalled. This is just a flag component to add to the
  	     loopback feature so that it is not empty. --&gt;    
      &lt;Component Id="rcm_Loopback" Guid="9F9BBDA3-208C-4F93-B81F-313E031B6DDA"&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client" Name="LoopbackInstalled" Type="integer" Value="1" Id="reg_Loopback1" /&gt;
      &lt;/Component&gt;
      
  &lt;/Include&gt;
--- 196,202 ----
  	     being removed when the product is uninstalled. This is just a flag component to add to the
  	     loopback feature so that it is not empty. --&gt;    
      &lt;Component Id="rcm_Loopback" Guid="9F9BBDA3-208C-4F93-B81F-313E031B6DDA"&gt;
!         &lt;Registry Root="HKLM" Key="SOFTWARE\OpenAFS\Client" Name="LoopbackInstalled" Type="integer" Value="1" Id="reg_Loopback1" KeyPath="yes" /&gt;
      &lt;/Component&gt;
      
  &lt;/Include&gt;
Index: openafs/src/afs/afs_call.c
diff -c openafs/src/afs/afs_call.c:1.70 openafs/src/afs/afs_call.c:1.74
*** openafs/src/afs/afs_call.c:1.70	Tue Jul 13 01:45:14 2004
--- openafs/src/afs/afs_call.c	Wed Jul 28 23:32:56 2004
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.70 2004/07/13 05:45:14 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74 2004/07/29 03:32:56 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 46,51 ****
--- 46,52 ----
  char afs_rootVolumeName[64] = "";
  struct afs_icl_set *afs_iclSetp = (struct afs_icl_set *)0;
  struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set *)0;
+ afs_uint32 rx_bindhost;
  
  #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
  kmutex_t afs_global_lock;
***************
*** 128,134 ****
  
      /* start RX */
      rx_extraPackets = AFS_NRXPACKETS;	/* smaller # of packets */
!     code = rx_Init(htons(7001));
      if (code) {
  	printf("AFS: RX failed to initialize %d).\n", code);
  	return code;
--- 129,135 ----
  
      /* start RX */
      rx_extraPackets = AFS_NRXPACKETS;	/* smaller # of packets */
!     code = rx_InitHost(rx_bindhost, htons(7001));
      if (code) {
  	printf("AFS: RX failed to initialize %d).\n", code);
  	return code;
***************
*** 354,360 ****
  	/* only root can run this code */
  	return (EACCES);
  #else
!     if (!afs_suser() &amp;&amp; (parm != AFSOP_GETMTU)
  	&amp;&amp; (parm != AFSOP_GETMASK)) {
  	/* only root can run this code */
  #if defined(KERNEL_HAVE_UERROR)
--- 355,361 ----
  	/* only root can run this code */
  	return (EACCES);
  #else
!     if (!afs_suser(NULL) &amp;&amp; (parm != AFSOP_GETMTU)
  	&amp;&amp; (parm != AFSOP_GETMASK)) {
  	/* only root can run this code */
  #if defined(KERNEL_HAVE_UERROR)
***************
*** 700,705 ****
--- 701,707 ----
  		cacheNumEntries : 1));
      } else if (parm == AFSOP_ADVISEADDR) {
  	/* pass in the host address to the rx package */
+ 	int rxbind = 0;
  	afs_int32 count = parm2;
  	afs_int32 *buffer =
  	    afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
***************
*** 709,714 ****
--- 711,723 ----
  	    afs_osi_Alloc(sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
  	int i;
  
+ 	/* Bind, but only if there's only one address configured */ 
+ 	if ( count &amp; 0x80000000) {
+ 	    count &amp;= ~0x80000000;
+ 	    if (count == 1)
+ 		rxbind=1;
+ 	}
+ 
  	if (count &gt; AFS_MAX_INTERFACE_ADDR) {
  	    code = ENOMEM;
  	    count = AFS_MAX_INTERFACE_ADDR;
***************
*** 743,748 ****
--- 752,762 ----
  	}
  	afs_uuid_create(&amp;afs_cb_interface.uuid);
  	rxi_setaddr(buffer[0]);
+ 	if (rxbind)
+ 	    rx_bindhost = buffer[0];
+ 	else
+ 	    rx_bindhost = htonl(INADDR_ANY);
+ 
  	afs_osi_Free(buffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
  	afs_osi_Free(maskbuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
  	afs_osi_Free(mtubuffer, sizeof(afs_int32) * AFS_MAX_INTERFACE_ADDR);
***************
*** 861,867 ****
  	char *cellname = afs_osi_Alloc(cellLen);
  
  #ifndef UKERNEL
! 	afs_osi_MaskSignals();
  #endif
  	AFS_COPYIN((afs_int32 *) parm2, cellname, cellLen, code);
  	AFS_COPYIN((afs_int32 *) parm3, kmsg, kmsgLen, code);
--- 875,881 ----
  	char *cellname = afs_osi_Alloc(cellLen);
  
  #ifndef UKERNEL
! 	afs_osi_MaskUserLoop();
  #endif
  	AFS_COPYIN((afs_int32 *) parm2, cellname, cellLen, code);
  	AFS_COPYIN((afs_int32 *) parm3, kmsg, kmsgLen, code);
***************
*** 1496,1501 ****
--- 1510,1520 ----
      extern struct osi_file *afs_cacheInodep;
  
      AFS_STATCNT(afs_shutdown);
+     if (afs_initState == 0) {
+         afs_warn("AFS not initialized - not shutting down\n");
+       return;
+     }
+ 
      if (afs_shuttingdown)
  	return;
      afs_shuttingdown = 1;
***************
*** 1680,1686 ****
  	return (EACCES);
      }
  #else
!     if (!afs_suser()) {		/* only root can run this code */
  #if defined(KERNEL_HAVE_UERROR)
  	setuerror(EACCES);
  	return EACCES;
--- 1699,1705 ----
  	return (EACCES);
      }
  #else
!     if (!afs_suser(NULL)) {	/* only root can run this code */
  #if defined(KERNEL_HAVE_UERROR)
  	setuerror(EACCES);
  	return EACCES;
Index: openafs/src/afs/afs_osi.c
diff -c openafs/src/afs/afs_osi.c:1.45 openafs/src/afs/afs_osi.c:1.48
*** openafs/src/afs/afs_osi.c:1.45	Mon Jun 21 16:01:50 2004
--- openafs/src/afs/afs_osi.c	Sun Aug  8 20:17:33 2004
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.45 2004/06/21 20:01:50 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48 2004/08/09 00:17:33 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 310,315 ****
--- 310,335 ----
  {
  }
  
+ /* Two hacks to try and fix afsdb */
+ void 
+ afs_osi_MaskUserLoop()
+ {
+ #ifdef AFS_DARWIN_ENV
+     afs_osi_Invisible();
+     afs_osi_fullSigMask();
+ #else
+     afs_osi_MaskSignals();
+ #endif
+ }
+ 
+ void 
+ afs_osi_UnmaskUserLoop()
+ {
+ #ifdef AFS_DARWIN_ENV
+     afs_osi_fullSigRestore();
+ #endif
+ }
+ 
  /* register rxk listener proc info */
  void
  afs_osi_RxkRegister(void)
***************
*** 617,623 ****
  #if defined(AFS_SUN5_ENV)
      return afs_suser(credp);
  #else
!     return afs_suser();
  #endif
  }
  #endif
--- 637,643 ----
  #if defined(AFS_SUN5_ENV)
      return afs_suser(credp);
  #else
!     return afs_suser(NULL);
  #endif
  }
  #endif
***************
*** 786,791 ****
--- 806,817 ----
  #endif
  
  #if defined(AFS_OSF_ENV)
+ 
+ #ifdef AFS_DUX50_ENV
+ extern struct pid_entry *pidtab;
+ extern int npid; 
+ #endif
+ 
  void
  afs_osi_TraverseProcTable(void)
  {
Index: openafs/src/afs/afs_osi_pag.c
diff -c openafs/src/afs/afs_osi_pag.c:1.20 openafs/src/afs/afs_osi_pag.c:1.21
*** openafs/src/afs/afs_osi_pag.c:1.20	Tue Apr 20 22:20:21 2004
--- openafs/src/afs/afs_osi_pag.c	Wed Jul 28 23:13:37 2004
***************
*** 23,29 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.20 2004/04/21 02:20:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 23,29 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.21 2004/07/29 03:13:37 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 161,167 ****
  #elif  defined(AFS_OBSD_ENV)
      if (!afs_osi_suser(p-&gt;p_ucred))
  #else
!     if (!afs_suser())
  #endif
      {
  	while (osi_Time() - pag_epoch &lt; pagCounter) {
--- 161,167 ----
  #elif  defined(AFS_OBSD_ENV)
      if (!afs_osi_suser(p-&gt;p_ucred))
  #else
!     if (!afs_suser(NULL))
  #endif
      {
  	while (osi_Time() - pag_epoch &lt; pagCounter) {
***************
*** 251,257 ****
  #ifdef AFS_SUN5_ENV
      if (!afs_suser(*credpp))
  #else
!     if (!afs_suser())
  #endif
      {
  	while (osi_Time() - pag_epoch &lt; pagCounter) {
--- 251,257 ----
  #ifdef AFS_SUN5_ENV
      if (!afs_suser(*credpp))
  #else
!     if (!afs_suser(NULL))
  #endif
      {
  	while (osi_Time() - pag_epoch &lt; pagCounter) {
Index: openafs/src/afs/afs_prototypes.h
diff -c openafs/src/afs/afs_prototypes.h:1.51 openafs/src/afs/afs_prototypes.h:1.53
*** openafs/src/afs/afs_prototypes.h:1.51	Tue Jun  8 13:27:46 2004
--- openafs/src/afs/afs_prototypes.h	Sun Aug  8 20:24:57 2004
***************
*** 464,469 ****
--- 464,470 ----
  extern void afs_osi_RxkRegister(void);
  extern void afs_osi_MaskSignals(void);
  extern void afs_osi_UnmaskRxkSignals(void);
+ extern void afs_osi_MaskUserLoop(void);
  extern void *afs_osi_Alloc_debug(size_t x, char *func, int line);
  #ifndef afs_osi_Alloc_NoSleep
  extern void *afs_osi_Alloc_NoSleep(size_t x);
***************
*** 1084,1090 ****
  
  
  
! #if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI62_ENV)
  #include "osi_prototypes.h"
  #endif
  
--- 1085,1091 ----
  
  
  
! #if defined(AFS_SUN5_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_AIX_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI62_ENV) || defined(AFS_OSF_ENV)
  #include "osi_prototypes.h"
  #endif
  
Index: openafs/src/afs/AIX/osi_misc.c
diff -c openafs/src/afs/AIX/osi_misc.c:1.7 openafs/src/afs/AIX/osi_misc.c:1.8
*** openafs/src/afs/AIX/osi_misc.c:1.7	Tue Jul 15 19:14:17 2003
--- openafs/src/afs/AIX/osi_misc.c	Wed Jul 28 23:13:41 2004
***************
*** 20,26 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/AIX/osi_misc.c,v 1.7 2003/07/15 23:14:17 shadow Exp $");
  
  #include "h/systm.h"
  #include "h/types.h"
--- 20,26 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/AIX/osi_misc.c,v 1.8 2004/07/29 03:13:41 shadow Exp $");
  
  #include "h/systm.h"
  #include "h/types.h"
***************
*** 167,173 ****
   * Note that it must NOT set errno.
   */
  
! afs_suser()
  {
      register rc;
      char err;
--- 167,173 ----
   * Note that it must NOT set errno.
   */
  
! afs_suser(void *credp)
  {
      register rc;
      char err;
Index: openafs/src/afs/DARWIN/osi_inode.c
diff -c openafs/src/afs/DARWIN/osi_inode.c:1.6 openafs/src/afs/DARWIN/osi_inode.c:1.7
*** openafs/src/afs/DARWIN/osi_inode.c:1.6	Tue Jul 15 19:14:17 2003
--- openafs/src/afs/DARWIN/osi_inode.c	Wed Jul 28 23:13:44 2004
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_inode.c,v 1.6 2003/07/15 23:14:17 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_inode.c,v 1.7 2004/07/29 03:13:44 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 167,173 ****
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
--- 167,173 ----
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
***************
*** 241,247 ****
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 241,247 ----
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
***************
*** 280,286 ****
      struct inode *ip;
      register int code;
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 280,286 ----
      struct inode *ip;
      register int code;
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
Index: openafs/src/afs/DARWIN/osi_misc.c
diff -c openafs/src/afs/DARWIN/osi_misc.c:1.5 openafs/src/afs/DARWIN/osi_misc.c:1.6
*** openafs/src/afs/DARWIN/osi_misc.c:1.5	Tue Jul 15 19:14:17 2003
--- openafs/src/afs/DARWIN/osi_misc.c	Wed Jul 28 23:13:44 2004
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_misc.c,v 1.5 2003/07/15 23:14:17 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_misc.c,v 1.6 2004/07/29 03:13:44 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 49,55 ****
   * Note that it must NOT set errno.
   */
  
! afs_suser()
  {
      int error;
      struct proc *p = current_proc();
--- 49,55 ----
   * Note that it must NOT set errno.
   */
  
! afs_suser(void *credp)
  {
      int error;
      struct proc *p = current_proc();
Index: openafs/src/afs/DARWIN/osi_prototypes.h
diff -c openafs/src/afs/DARWIN/osi_prototypes.h:1.4 openafs/src/afs/DARWIN/osi_prototypes.h:1.5
*** openafs/src/afs/DARWIN/osi_prototypes.h:1.4	Tue Jul 15 19:14:18 2003
--- openafs/src/afs/DARWIN/osi_prototypes.h	Wed Jul 28 23:33:00 2004
***************
*** 20,25 ****
--- 20,30 ----
  /* osi_misc.c */
  extern int osi_lookupname(char *aname, enum uio_seg seg, int followlink,
  			  struct vnode **dirvpp, struct vnode **vpp);
+ 
+ /* osi_sleep.c */
+ extern void afs_osi_fullSigMask(void);
+ extern void afs_osi_fullSigRestore(void);
+ 
  /* osi_vm.c */
  extern void osi_VM_NukePages(struct vnode *vp, off_t offset, off_t size);
  extern int osi_VM_Setup(struct vcache *avc, int force);
Index: openafs/src/afs/DARWIN/osi_sleep.c
diff -c openafs/src/afs/DARWIN/osi_sleep.c:1.9 openafs/src/afs/DARWIN/osi_sleep.c:1.10
*** openafs/src/afs/DARWIN/osi_sleep.c:1.9	Tue Jul 15 19:14:18 2003
--- openafs/src/afs/DARWIN/osi_sleep.c	Wed Jul 28 23:33:00 2004
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_sleep.c,v 1.9 2003/07/15 23:14:18 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_sleep.c,v 1.10 2004/07/29 03:33:00 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 150,155 ****
--- 150,183 ----
      relevent(evp);
  }
  
+ void 
+ afs_osi_fullSigMask()
+ {
+     struct uthread *user_thread = (struct uthread *)get_bsdthread_info(current_act());
+        
+     /* Protect original sigmask */
+     if (!user_thread-&gt;uu_oldmask) {
+ 	/* Back up current sigmask */
+ 	user_thread-&gt;uu_oldmask = user_thread-&gt;uu_sigmask;
+ 	/* Mask all signals */
+ 	user_thread-&gt;uu_sigmask = ~(sigset_t)0;
+     }
+ }
+ 
+ void 
+ afs_osi_fullSigRestore()
+ {
+     struct uthread *user_thread = (struct uthread *)get_bsdthread_info(current_act());
+        
+     /* Protect original sigmask */
+     if (user_thread-&gt;uu_oldmask) {
+ 	/* Restore original sigmask */
+ 	user_thread-&gt;uu_sigmask = user_thread-&gt;uu_oldmask;
+ 	/* Clear the oldmask */
+ 	user_thread-&gt;uu_oldmask = (sigset_t)0;
+     }
+ }
+ 
  int
  afs_osi_SleepSig(void *event)
  {
Index: openafs/src/afs/DUX/osi_inode.c
diff -c openafs/src/afs/DUX/osi_inode.c:1.12 openafs/src/afs/DUX/osi_inode.c:1.13
*** openafs/src/afs/DUX/osi_inode.c:1.12	Tue Jul 15 19:14:18 2003
--- openafs/src/afs/DUX/osi_inode.c	Wed Jul 28 23:13:44 2004
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DUX/osi_inode.c,v 1.12 2003/07/15 23:14:18 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DUX/osi_inode.c,v 1.13 2004/07/29 03:13:44 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 185,191 ****
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
--- 185,191 ----
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
***************
*** 262,268 ****
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 262,268 ----
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
***************
*** 312,318 ****
      struct inode *ip;
      register int code;
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 312,318 ----
      struct inode *ip;
      register int code;
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
Index: openafs/src/afs/DUX/osi_misc.c
diff -c openafs/src/afs/DUX/osi_misc.c:1.6 openafs/src/afs/DUX/osi_misc.c:1.7
*** openafs/src/afs/DUX/osi_misc.c:1.6	Tue Jul 15 19:14:19 2003
--- openafs/src/afs/DUX/osi_misc.c	Wed Jul 28 23:13:44 2004
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DUX/osi_misc.c,v 1.6 2003/07/15 23:14:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DUX/osi_misc.c,v 1.7 2004/07/29 03:13:44 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 27,33 ****
   * Note that it must NOT set errno.
   */
  
! afs_suser()
  {
      int error;
  
--- 27,33 ----
   * Note that it must NOT set errno.
   */
  
! afs_suser(void *credp)
  {
      int error;
  
Index: openafs/src/afs/FBSD/osi_inode.c
diff -c openafs/src/afs/FBSD/osi_inode.c:1.9 openafs/src/afs/FBSD/osi_inode.c:1.10
*** openafs/src/afs/FBSD/osi_inode.c:1.9	Wed Mar 10 18:01:51 2004
--- openafs/src/afs/FBSD/osi_inode.c	Wed Jul 28 23:13:45 2004
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_inode.c,v 1.9 2004/03/10 23:01:51 rees Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_inode.c,v 1.10 2004/07/29 03:13:45 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 141,147 ****
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
--- 141,147 ----
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
***************
*** 219,225 ****
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 219,225 ----
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
***************
*** 258,264 ****
      struct inode *ip;
      register int code;
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 258,264 ----
      struct inode *ip;
      register int code;
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
Index: openafs/src/afs/FBSD/osi_machdep.h
diff -c openafs/src/afs/FBSD/osi_machdep.h:1.8 openafs/src/afs/FBSD/osi_machdep.h:1.9
*** openafs/src/afs/FBSD/osi_machdep.h:1.8	Wed Mar 10 18:01:51 2004
--- openafs/src/afs/FBSD/osi_machdep.h	Wed Jul 28 23:13:45 2004
***************
*** 71,77 ****
  #define VROOT		VV_ROOT
  #define v_flag		v_vflag
  #define osi_curcred()	(curthread-&gt;td_ucred)
! #define afs_suser()	(!suser(curthread))
  #define simple_lock(x)	mtx_lock(x)
  #define simple_unlock(x) mtx_unlock(x)
  #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
--- 71,77 ----
  #define VROOT		VV_ROOT
  #define v_flag		v_vflag
  #define osi_curcred()	(curthread-&gt;td_ucred)
! #define afs_suser(x)	(!suser(curthread))
  #define simple_lock(x)	mtx_lock(x)
  #define simple_unlock(x) mtx_unlock(x)
  #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
***************
*** 85,91 ****
  extern struct lock afs_global_lock;
  
  #define osi_curcred()	(curproc-&gt;p_cred-&gt;pc_ucred)
! #define afs_suser()	(!suser(curproc))
  #define getpid()	curproc
  #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
    vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
--- 85,91 ----
  extern struct lock afs_global_lock;
  
  #define osi_curcred()	(curproc-&gt;p_cred-&gt;pc_ucred)
! #define afs_suser(x)	(!suser(curproc))
  #define getpid()	curproc
  #define        gop_rdwr(rw,gp,base,len,offset,segflg,unit,cred,aresid) \
    vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(unit),(cred),(aresid), curproc)
Index: openafs/src/afs/FBSD/osi_vfsops.c
diff -c openafs/src/afs/FBSD/osi_vfsops.c:1.15 openafs/src/afs/FBSD/osi_vfsops.c:1.16
*** openafs/src/afs/FBSD/osi_vfsops.c:1.15	Wed Mar 10 18:01:51 2004
--- openafs/src/afs/FBSD/osi_vfsops.c	Tue Jul 27 12:24:40 2004
***************
*** 2,8 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_vfsops.c,v 1.15 2004/03/10 23:01:51 rees Exp $");
  
  #include &lt;afs/sysincludes.h&gt;	/* Standard vendor system headers */
  #include &lt;afsincludes.h&gt;	/* Afs-based standard headers */
--- 2,8 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/FBSD/osi_vfsops.c,v 1.16 2004/07/27 16:24:40 rees Exp $");
  
  #include &lt;afs/sysincludes.h&gt;	/* Standard vendor system headers */
  #include &lt;afsincludes.h&gt;	/* Afs-based standard headers */
***************
*** 74,80 ****
--- 74,84 ----
       * the root vnode (this is just a guess right now).
       * This has to be done outside the global lock.
       */
+ #ifdef AFS_FBSD53_ENV
+     vflush(mp, 1, (flags &amp; MNT_FORCE) ? FORCECLOSE : 0, p);
+ #else
      vflush(mp, 1, (flags &amp; MNT_FORCE) ? FORCECLOSE : 0);
+ #endif
      AFS_GLOCK();
      AFS_STATCNT(afs_unmount);
      afs_globalVFS = 0;
Index: openafs/src/afs/HPUX/osi_inode.c
diff -c openafs/src/afs/HPUX/osi_inode.c:1.7 openafs/src/afs/HPUX/osi_inode.c:1.8
*** openafs/src/afs/HPUX/osi_inode.c:1.7	Tue Jul 15 19:14:21 2003
--- openafs/src/afs/HPUX/osi_inode.c	Wed Jul 28 23:13:47 2004
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/HPUX/osi_inode.c,v 1.7 2003/07/15 23:14:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/HPUX/osi_inode.c,v 1.8 2004/07/29 03:13:47 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 86,92 ****
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser()) {
  	u.u_error = EPERM;
  	goto out;
      }
--- 86,92 ----
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser(NULL)) {
  	u.u_error = EPERM;
  	goto out;
      }
***************
*** 131,137 ****
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser()) {
  	u.u_error = EPERM;
  	goto out;
      }
--- 131,137 ----
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser(NULL)) {
  	u.u_error = EPERM;
  	goto out;
      }
***************
*** 190,196 ****
      struct inode *ip;
      register afs_int32 code;
  
!     if (!afs_suser()) {
  	u.u_error = EPERM;
  	goto out;
      }
--- 190,196 ----
      struct inode *ip;
      register afs_int32 code;
  
!     if (!afs_suser(NULL)) {
  	u.u_error = EPERM;
  	goto out;
      }
Index: openafs/src/afs/HPUX/osi_misc.c
diff -c openafs/src/afs/HPUX/osi_misc.c:1.6 openafs/src/afs/HPUX/osi_misc.c:1.7
*** openafs/src/afs/HPUX/osi_misc.c:1.6	Tue Jul 15 19:14:21 2003
--- openafs/src/afs/HPUX/osi_misc.c	Wed Jul 28 23:13:47 2004
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/HPUX/osi_misc.c,v 1.6 2003/07/15 23:14:21 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/HPUX/osi_misc.c,v 1.7 2004/07/29 03:13:47 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 29,35 ****
   * Here we have to save and restore errno since the HP-UX suser() sets errno.
   */
  
! afs_suser()
  {
      int save_errno;
      int code;
--- 29,35 ----
   * Here we have to save and restore errno since the HP-UX suser() sets errno.
   */
  
! afs_suser(void *credp)
  {
      int save_errno;
      int code;
Index: openafs/src/afs/IRIX/osi_file.c
diff -c openafs/src/afs/IRIX/osi_file.c:1.10 openafs/src/afs/IRIX/osi_file.c:1.11
*** openafs/src/afs/IRIX/osi_file.c:1.10	Tue Jul 15 19:14:23 2003
--- openafs/src/afs/IRIX/osi_file.c	Sun Aug  8 23:25:45 2004
***************
*** 11,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_file.c,v 1.10 2003/07/15 23:14:23 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
  #include "afs/afs_stats.h"	/* afs statistics */
  
  int afs_osicred_initialized = 0;
  afs_lock_t afs_xosi;		/* lock is for tvattr */
  extern struct osi_dev cacheDev;
--- 11,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_file.c,v 1.11 2004/08/09 03:25:45 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
  #include "afs/afs_stats.h"	/* afs statistics */
  
+ struct  AFS_UCRED afs_osi_cred;
  int afs_osicred_initialized = 0;
  afs_lock_t afs_xosi;		/* lock is for tvattr */
  extern struct osi_dev cacheDev;
Index: openafs/src/afs/IRIX/osi_inode.c
diff -c openafs/src/afs/IRIX/osi_inode.c:1.11 openafs/src/afs/IRIX/osi_inode.c:1.12
*** openafs/src/afs/IRIX/osi_inode.c:1.11	Tue Jul 15 19:14:23 2003
--- openafs/src/afs/IRIX/osi_inode.c	Wed Jul 28 23:13:47 2004
***************
*** 43,49 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_inode.c,v 1.11 2003/07/15 23:14:23 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 43,49 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_inode.c,v 1.12 2004/07/29 03:13:47 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 314,320 ****
      int error;
  
      AFS_STATCNT(afs_syscall_icreate);
!     if (!afs_suser())
  	return EPERM;
  
      if (error = getinode(0, (dev_t) dev, 2, &amp;ip))
--- 314,320 ----
      int error;
  
      AFS_STATCNT(afs_syscall_icreate);
!     if (!afs_suser(NULL))
  	return EPERM;
  
      if (error = getinode(0, (dev_t) dev, 2, &amp;ip))
***************
*** 567,573 ****
      ino_t ino;
  
  
!     if (!afs_suser())
  	return EPERM;
  
  #ifdef AFS_SGI65_ENV
--- 567,573 ----
      ino_t ino;
  
  
!     if (!afs_suser(NULL))
  	return EPERM;
  
  #ifdef AFS_SGI65_ENV
***************
*** 638,644 ****
      struct vnode *vp;
  
      AFS_STATCNT(afs_syscall_iopen);
!     if (!afs_suser())
  	return EPERM;
      vfsp = vfs_devsearch(dev, xfs_fstype);
      if (!vfsp)
--- 638,644 ----
      struct vnode *vp;
  
      AFS_STATCNT(afs_syscall_iopen);
!     if (!afs_suser(NULL))
  	return EPERM;
      vfsp = vfs_devsearch(dev, xfs_fstype);
      if (!vfsp)
***************
*** 689,695 ****
      struct vfs *vfsp;
  
      AFS_STATCNT(afs_syscall_iopen);
!     if (!afs_suser())
  	return EPERM;
      vfsp = vfs_devsearch(dev);
      if (!vfsp) {
--- 689,695 ----
      struct vfs *vfsp;
  
      AFS_STATCNT(afs_syscall_iopen);
!     if (!afs_suser(NULL))
  	return EPERM;
      vfsp = vfs_devsearch(dev);
      if (!vfsp) {
***************
*** 764,770 ****
      int error;
  
      AFS_STATCNT(afs_syscall_iopen);
!     if (!afs_suser())
  	return EPERM;
      if (error = igetinode(0, (dev_t) dev, inode, &amp;ip))
  	return error;
--- 764,770 ----
      int error;
  
      AFS_STATCNT(afs_syscall_iopen);
!     if (!afs_suser(NULL))
  	return EPERM;
      if (error = igetinode(0, (dev_t) dev, inode, &amp;ip))
  	return error;
***************
*** 971,977 ****
  {
      struct vfs *vfsp;
  
!     if (!afs_suser())
  	return EPERM;
  #ifdef AFS_SGI65_ENV
      vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
--- 971,977 ----
  {
      struct vfs *vfsp;
  
!     if (!afs_suser(NULL))
  	return EPERM;
  #ifdef AFS_SGI65_ENV
      vfsp = vfs_devsearch(dev, VFS_FSTYPE_ANY);
***************
*** 1044,1050 ****
  {
      struct vfs *vfsp;
  
!     if (!afs_suser())
  	return EPERM;
      vfsp = vfs_devsearch(dev);
      if (!vfsp) {
--- 1044,1050 ----
  {
      struct vfs *vfsp;
  
!     if (!afs_suser(NULL))
  	return EPERM;
      vfsp = vfs_devsearch(dev);
      if (!vfsp) {
***************
*** 1083,1089 ****
      struct inode *ip;
      int error = 0;
  
!     if (!afs_suser())
  	return EPERM;
      if (error = igetinode(0, (dev_t) dev, inode, &amp;ip))
  	return error;
--- 1083,1089 ----
      struct inode *ip;
      int error = 0;
  
!     if (!afs_suser(NULL))
  	return EPERM;
      if (error = igetinode(0, (dev_t) dev, inode, &amp;ip))
  	return error;
***************
*** 1146,1152 ****
      i_list_inode_t data;
      int idatalen;
  
!     if (!afs_suser())
  	return EPERM;
  #ifdef AFS_SGI65_ENV
      vfsp = vfs_devsearch(dev, xfs_fstype);
--- 1146,1152 ----
      i_list_inode_t data;
      int idatalen;
  
!     if (!afs_suser(NULL))
  	return EPERM;
  #ifdef AFS_SGI65_ENV
      vfsp = vfs_devsearch(dev, xfs_fstype);
Index: openafs/src/afs/IRIX/osi_machdep.h
diff -c openafs/src/afs/IRIX/osi_machdep.h:1.6 openafs/src/afs/IRIX/osi_machdep.h:1.7
*** openafs/src/afs/IRIX/osi_machdep.h:1.6	Fri Mar 19 02:58:54 2004
--- openafs/src/afs/IRIX/osi_machdep.h	Wed Jul 28 23:13:47 2004
***************
*** 205,215 ****
  
  #ifdef AFS_SGI64_ENV
  #undef suser
! #define suser() cap_able(CAP_DEVICE_MGT)
! #define afs_suser()	suser()
! #else
! #define	afs_suser	    suser
  #endif
  
  #define afs_hz HZ
  
--- 205,213 ----
  
  #ifdef AFS_SGI64_ENV
  #undef suser
! #define suser()		cap_able(CAP_DEVICE_MGT)
  #endif
+ #define afs_suser(x)	suser()
  
  #define afs_hz HZ
  
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.28 openafs/src/afs/LINUX/osi_vfsops.c:1.29
*** openafs/src/afs/LINUX/osi_vfsops.c:1.28	Fri Jul 23 18:06:22 2004
--- openafs/src/afs/LINUX/osi_vfsops.c	Wed Jul 28 23:08:48 2004
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.28 2004/07/23 22:06:22 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29 2004/07/29 03:08:48 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 138,149 ****
      sb-&gt;s_maxbytes = MAX_NON_LFS;
  #endif
      code = afs_root(sb);
!     if (code)
  #if defined(AFS_LINUX26_ENV)
! 	module_put(THIS_MODULE);
  #else
! 	MOD_DEC_USE_COUNT;
  #endif
  
  #if !defined(AFS_LINUX24_ENV)
      unlock_super(sb);
--- 138,151 ----
      sb-&gt;s_maxbytes = MAX_NON_LFS;
  #endif
      code = afs_root(sb);
!     if (code) {
! 	afs_globalVFS = NULL;
  #if defined(AFS_LINUX26_ENV)
!         module_put(THIS_MODULE);
  #else
!         MOD_DEC_USE_COUNT;
  #endif
+     }
  
  #if !defined(AFS_LINUX24_ENV)
      unlock_super(sb);
Index: openafs/src/afs/NBSD/osi_inode.c
diff -c openafs/src/afs/NBSD/osi_inode.c:1.4 openafs/src/afs/NBSD/osi_inode.c:1.5
*** openafs/src/afs/NBSD/osi_inode.c:1.4	Tue Jul 15 19:14:25 2003
--- openafs/src/afs/NBSD/osi_inode.c	Wed Jul 28 23:13:48 2004
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/NBSD/osi_inode.c,v 1.4 2003/07/15 23:14:25 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/NBSD/osi_inode.c,v 1.5 2004/07/29 03:13:48 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 148,154 ****
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
--- 148,154 ----
  
      AFS_STATCNT(afs_syscall_icreate);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = getinode(0, (dev_t) dev, 2, &amp;ip, &amp;dummy);
***************
*** 225,231 ****
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 225,231 ----
  
      AFS_STATCNT(afs_syscall_iopen);
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
***************
*** 263,269 ****
      struct inode *ip;
      register int code;
  
!     if (!afs_suser())
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
--- 263,269 ----
      struct inode *ip;
      register int code;
  
!     if (!afs_suser(NULL))
  	return (EPERM);
  
      code = igetinode(0, (dev_t) dev, (ino_t) inode, &amp;ip, &amp;dummy);
Index: openafs/src/afs/NBSD/osi_misc.c
diff -c openafs/src/afs/NBSD/osi_misc.c:1.3 openafs/src/afs/NBSD/osi_misc.c:1.4
*** openafs/src/afs/NBSD/osi_misc.c:1.3	Tue Jul 15 19:14:25 2003
--- openafs/src/afs/NBSD/osi_misc.c	Wed Jul 28 23:13:49 2004
***************
*** 18,24 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/NBSD/osi_misc.c,v 1.3 2003/07/15 23:14:25 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 18,24 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/NBSD/osi_misc.c,v 1.4 2004/07/29 03:13:49 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 29,35 ****
   * Note that it must NOT set errno.
   */
  
! afs_suser()
  {
      int error;
  
--- 29,35 ----
   * Note that it must NOT set errno.
   */
  
! afs_suser(void *credp)
  {
      int error;
  
Index: openafs/src/afs/OBSD/osi_machdep.h
diff -c openafs/src/afs/OBSD/osi_machdep.h:1.15 openafs/src/afs/OBSD/osi_machdep.h:1.16
*** openafs/src/afs/OBSD/osi_machdep.h:1.15	Thu Mar 25 12:04:44 2004
--- openafs/src/afs/OBSD/osi_machdep.h	Wed Jul 28 23:13:49 2004
***************
*** 16,22 ****
   * afs_osi.h.
   */
  
! /* $Id: osi_machdep.h,v 1.15 2004/03/25 17:04:44 rees Exp $ */
  
  #ifndef _OSI_MACHDEP_H_
  #define _OSI_MACHDEP_H_
--- 16,22 ----
   * afs_osi.h.
   */
  
! /* $Id: osi_machdep.h,v 1.16 2004/07/29 03:13:49 shadow Exp $ */
  
  #ifndef _OSI_MACHDEP_H_
  #define _OSI_MACHDEP_H_
***************
*** 67,73 ****
  /* proc, cred */
  #define	AFS_PROC	struct proc
  #define	AFS_UCRED	ucred
! #define afs_suser()	afs_osi_suser(osi_curcred())
  #define getpid()	curproc
  #define osi_curcred()	(curproc-&gt;p_cred-&gt;pc_ucred)
  #define osi_curproc()	curproc
--- 67,73 ----
  /* proc, cred */
  #define	AFS_PROC	struct proc
  #define	AFS_UCRED	ucred
! #define afs_suser(x)	afs_osi_suser(osi_curcred())
  #define getpid()	curproc
  #define osi_curcred()	(curproc-&gt;p_cred-&gt;pc_ucred)
  #define osi_curproc()	curproc
Index: openafs/src/afs/OBSD/osi_vnodeops.c
diff -c openafs/src/afs/OBSD/osi_vnodeops.c:1.17 openafs/src/afs/OBSD/osi_vnodeops.c:1.18
*** openafs/src/afs/OBSD/osi_vnodeops.c:1.17	Fri Mar 19 11:38:29 2004
--- openafs/src/afs/OBSD/osi_vnodeops.c	Tue Jul 27 10:39:31 2004
***************
*** 3,9 ****
   * Original NetBSD version for Transarc afs by John Kohl &lt;jtk@MIT.EDU&gt;
   * OpenBSD version by Jim Rees &lt;rees@umich.edu&gt;
   *
!  * $Id: osi_vnodeops.c,v 1.17 2004/03/19 16:38:29 rees Exp $
   */
  
  /*
--- 3,9 ----
   * Original NetBSD version for Transarc afs by John Kohl &lt;jtk@MIT.EDU&gt;
   * OpenBSD version by Jim Rees &lt;rees@umich.edu&gt;
   *
!  * $Id: osi_vnodeops.c,v 1.18 2004/07/27 14:39:31 rees Exp $
   */
  
  /*
***************
*** 99,105 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/OBSD/osi_vnodeops.c,v 1.17 2004/03/19 16:38:29 rees Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afs/afsincludes.h"	/* Afs-based standard headers */
--- 99,105 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/OBSD/osi_vnodeops.c,v 1.18 2004/07/27 14:39:31 rees Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afs/afsincludes.h"	/* Afs-based standard headers */
***************
*** 107,112 ****
--- 107,115 ----
  
  #include &lt;sys/malloc.h&gt;
  #include &lt;sys/namei.h&gt;
+ #ifdef AFS_OBSD36_ENV
+ #include &lt;sys/pool.h&gt;
+ #endif
  
  #include "afs/afs_cbqueue.h"
  #include "afs/nfsclient.h"
***************
*** 210,215 ****
--- 213,224 ----
  
  #define DROPNAME() FREE(name, M_TEMP)
  
+ #ifdef AFS_OBSD36_ENV
+ #define DROPCNP(cnp) pool_put(&amp;namei_pool, (cnp)-&gt;cn_pnbuf)
+ #else
+ #define DROPCNP(cnp) FREE((cnp)-&gt;cn_pnbuf, M_NAMEI)
+ #endif
+ 
  int afs_debug;
  
  int
***************
*** 331,337 ****
  	*ap-&gt;a_vpp = 0;
  
      if ((cnp-&gt;cn_flags &amp; SAVESTART) == 0)
! 	FREE(cnp-&gt;cn_pnbuf, M_NAMEI);
      vput(dvp);
      DROPNAME();
      if (afs_debug &amp; AFSDEB_VNLAYER)
--- 340,346 ----
  	*ap-&gt;a_vpp = 0;
  
      if ((cnp-&gt;cn_flags &amp; SAVESTART) == 0)
! 	DROPCNP(cnp);
      vput(dvp);
      DROPNAME();
      if (afs_debug &amp; AFSDEB_VNLAYER)
***************
*** 348,354 ****
  				 * struct componentname *a_cnp;
  				 * struct vattr *a_vap;
  				 * } */ *ap = v;
!     free(ap-&gt;a_cnp-&gt;cn_pnbuf, M_NAMEI);
      vput(ap-&gt;a_dvp);
      return (ENODEV);
  }
--- 357,363 ----
  				 * struct componentname *a_cnp;
  				 * struct vattr *a_vap;
  				 * } */ *ap = v;
!     DROPCNP(ap-&gt;a_cnp);
      vput(ap-&gt;a_dvp);
      return (ENODEV);
  }
***************
*** 561,567 ****
      else
  	vput(vp);
      vput(dvp);
!     FREE(cnp-&gt;cn_pnbuf, M_NAMEI);
      DROPNAME();
      return code;
  }
--- 570,576 ----
      else
  	vput(vp);
      vput(dvp);
!     DROPCNP(cnp);
      DROPNAME();
      return code;
  }
***************
*** 597,603 ****
      AFS_GLOCK();
      code = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp-&gt;cn_cred);
      AFS_GUNLOCK();
!     FREE(cnp-&gt;cn_pnbuf, M_NAMEI);
      if (dvp != vp)
  	VOP_UNLOCK(vp, 0, curproc);
  
--- 606,612 ----
      AFS_GLOCK();
      code = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp-&gt;cn_cred);
      AFS_GUNLOCK();
!     DROPCNP(cnp);
      if (dvp != vp)
  	VOP_UNLOCK(vp, 0, curproc);
  
***************
*** 741,748 ****
  	vn_lock(AFSTOV(vcp), LK_EXCLUSIVE | LK_RETRY, curproc);
      } else
  	*ap-&gt;a_vpp = 0;
      DROPNAME();
-     FREE(cnp-&gt;cn_pnbuf, M_NAMEI);
      vput(dvp);
      return code;
  }
--- 750,757 ----
  	vn_lock(AFSTOV(vcp), LK_EXCLUSIVE | LK_RETRY, curproc);
      } else
  	*ap-&gt;a_vpp = 0;
+     DROPCNP(cnp);
      DROPNAME();
      vput(dvp);
      return code;
  }
***************
*** 763,769 ****
      if (dvp == vp) {
  	vrele(dvp);
  	vput(vp);
! 	FREE(cnp-&gt;cn_pnbuf, M_NAMEI);
  	DROPNAME();
  	return (EINVAL);
      }
--- 772,778 ----
      if (dvp == vp) {
  	vrele(dvp);
  	vput(vp);
! 	DROPCNP(cnp);
  	DROPNAME();
  	return (EINVAL);
      }
***************
*** 796,803 ****
      code =
  	afs_symlink(VTOAFS(dvp), name, ap-&gt;a_vap, ap-&gt;a_target, cnp-&gt;cn_cred);
      AFS_GUNLOCK();
      DROPNAME();
-     FREE(cnp-&gt;cn_pnbuf, M_NAMEI);
      vput(dvp);
      return code;
  }
--- 805,812 ----
      code =
  	afs_symlink(VTOAFS(dvp), name, ap-&gt;a_vap, ap-&gt;a_target, cnp-&gt;cn_cred);
      AFS_GUNLOCK();
+     DROPCNP(cnp);
      DROPNAME();
      vput(dvp);
      return code;
  }
Index: openafs/src/afs/SOLARIS/osi_machdep.h
diff -c openafs/src/afs/SOLARIS/osi_machdep.h:1.6 openafs/src/afs/SOLARIS/osi_machdep.h:1.7
*** openafs/src/afs/SOLARIS/osi_machdep.h:1.6	Tue Jul 15 19:14:26 2003
--- openafs/src/afs/SOLARIS/osi_machdep.h	Wed Jul 28 23:13:50 2004
***************
*** 60,66 ****
  #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
    vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
  
! #define	afs_suser	    suser
  
  
  #ifdef KERNEL
--- 60,66 ----
  #define gop_rdwr(rw,gp,base,len,offset,segflg,ioflag,ulimit,cr,aresid) \
    vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
  
! #define	afs_suser(x)	    suser(x)
  
  
  #ifdef KERNEL
Index: openafs/src/afs/UKERNEL/osi_machdep.h
diff -c openafs/src/afs/UKERNEL/osi_machdep.h:1.5 openafs/src/afs/UKERNEL/osi_machdep.h:1.6
*** openafs/src/afs/UKERNEL/osi_machdep.h:1.5	Tue Jul 15 19:14:29 2003
--- openafs/src/afs/UKERNEL/osi_machdep.h	Wed Jul 28 23:13:50 2004
***************
*** 37,43 ****
  #define osi_Time() (time(NULL))
  
  #define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
! #define	afs_suser	    suser
  
  /*
   * Global lock support.
--- 37,43 ----
  #define osi_Time() (time(NULL))
  
  #define osi_vnhold(avc, r)  do { VN_HOLD(AFSTOV(avc)); } while(0)
! #define	afs_suser(x)	    suser(x)
  
  /*
   * Global lock support.
Index: openafs/src/afs/VNOPS/afs_vnop_readdir.c
diff -c openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.23 openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.24
*** openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.23	Wed Nov 26 20:17:40 2003
--- openafs/src/afs/VNOPS/afs_vnop_readdir.c	Sun Aug  8 20:54:05 2004
***************
*** 23,29 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.23 2003/11/27 01:17:40 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 23,29 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_readdir.c,v 1.24 2004/08/09 00:54:05 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 172,183 ****
  #else
  #if defined(AFS_SUN_ENV) || defined(AFS_AIX32_ENV)
      afs_int32 d_off;
-     afs_uint32 d_fileno;
  #endif
  #if     defined(AFS_HPUX100_ENV)
      unsigned long long d_off;
-     afs_uint32 d_fileno;
  #endif
      u_short d_reclen;
      u_short d_namlen;
  #endif
--- 172,182 ----
  #else
  #if defined(AFS_SUN_ENV) || defined(AFS_AIX32_ENV)
      afs_int32 d_off;
  #endif
  #if     defined(AFS_HPUX100_ENV)
      unsigned long long d_off;
  #endif
+     afs_uint32 d_fileno;
      u_short d_reclen;
      u_short d_namlen;
  #endif
Index: openafs/src/afsd/afs.rc.darwin
diff -c openafs/src/afsd/afs.rc.darwin:1.5 openafs/src/afsd/afs.rc.darwin:1.6
*** openafs/src/afsd/afs.rc.darwin:1.5	Fri Oct 24 02:26:05 2003
--- openafs/src/afsd/afs.rc.darwin	Wed Jul 28 23:36:53 2004
***************
*** 7,26 ****
  # directory or online at http://www.openafs.org/dl/license10.html
  #
  # Portions Copyright (c) 2003 Apple Computer, Inc.
  
  . /etc/rc.common
  
! CheckForNetwork 
! 
! if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
  
  if [ -r /var/db/openafs ]; then
!    VICEETC=/var/db/openafs/etc
!    AFSD=/usr/sbin/afsd
! else
!    VICEETC=/usr/vice/etc
!    AFSD=$VICEETC/afsd
  fi
  CONFIG=$VICEETC/config
  AFSDOPT=$CONFIG/afsd.options
  PACKAGE=$CONFIG/package.options
--- 7,30 ----
  # directory or online at http://www.openafs.org/dl/license10.html
  #
  # Portions Copyright (c) 2003 Apple Computer, Inc.
+ #
+ # Updated to match standard service scripts
+ # Phil Holland &lt;hollandp@umich.edu&gt; 6/11/04
  
  . /etc/rc.common
  
! #
! # Variable Definition Section
! #
! CheckForNetwork
  
+ VICEETC=/usr/vice/etc
+ AFSD=$VICEETC/afsd
  if [ -r /var/db/openafs ]; then
!     VICEETC=/var/db/openafs/etc
!     AFSD=/usr/sbin/afsd
  fi
+ 
  CONFIG=$VICEETC/config
  AFSDOPT=$CONFIG/afsd.options
  PACKAGE=$CONFIG/package.options
***************
*** 29,142 ****
  MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
  SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
  
! if [ -f $AFSDOPT ]; then
!     OPTIONS=`cat $AFSDOPT`
! else
!     OPTIONS="$MEDIUM -fakestat"
! fi
  
! if [ -x /usr/sbin/kmodstat ]; then
!    KMODSTAT=/usr/sbin/kmodstat
! else
!   if [ -x /usr/sbin/kextstat ]; then
!      KMODSTAT=/usr/sbin/kextstat
! fi
! fi
  
  # Need the commands ps, awk, kill, sleep
! PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
! if $KMODSTAT | perl -e 'exit not grep /openafs/, &lt;&gt;' ; then
! :
! else
! if [ -d $VICEETC/afs.kext ]; then
  	echo "Loading AFS kernel extensions"
  	kextload $VICEETC/afs.kext
! else
  	echo "$VICEETC/afs.kext does not exist. Skipping AFS startup."
  	exit 1
! fi
! fi
! if $KMODSTAT | perl -e 'exit not grep /openafs/, &lt;&gt;' ; then
! :
! else
! 	echo "AFS kernel extensions failed to initialize. Skipping AFS startup."
  	exit 1
! fi
  
  #
  # Start the AFS server processes if a bosserver exists
  #
  
! if [ -x /usr/afs/bin/bosserver ]; then
  	echo "Starting AFS Server processes"
  	/usr/afs/bin/bosserver
  	OPTIONS="$OPTIONS -nosettime"
  	sleep 30
! fi
  
  #
  # Check that all of the client configuration files exist
  #
  
! for file in $AFSD $VICEETC/cacheinfo \
! 	    $VICEETC/ThisCell $VICEETC/CellServDB
! do
! 	if [ ! -f ${file} ]; then
! 		echo "${file} does not exist. Not starting AFS client."
! 		exit 1
! 	fi
! done
  
  #
  # Check that the root directory for AFS (/afs) 
  # and the cache directory (/usr/vice/cache) both exist
  #
  
! for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo`
! do
! 	if [ ! -d ${dir} ]; then
! 		echo "${dir} does not exist. Not starting AFS client."
! 		exit 2
! 	fi
! done
  
! echo "Starting afsd"
! $AFSD $OPTIONS
  
  #
  # Call afssettings (if it exists) to set customizable parameters
  #
! if [ -x $VICEETC/config/afssettings ]; then
!     sleep 2
!     $VICEETC/config/afssettings
! fi
  
  #
  # Run package to update the disk
  #
! if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
  	/usr/afsws/etc/package -v -o `cat $PACKAGE` &gt; /dev/console 2&gt;&amp;1
! case $? in
! 0)
! 	(echo "Package completed successfully") &gt; /dev/console 2&gt;&amp;1
! 	date &gt; /dev/console 2&gt;&amp;1
! 	;;
! 4)
! 	(echo "Rebooting to restart system") &gt; /dev/console 2&gt;&amp;1
! 	sync
! 	/sbin/reboot
! 	;;
! *)
! 	(echo "Package update failed; continuing") &gt; /dev/console 2&gt;&amp;1
! 	;;
! esac
! 
! fi
  
  #
  # Start AFS inetd services
  # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
  #
! if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
! 	/usr/sbin/inetd.afs /etc/inetd.conf.afs
! fi
--- 33,170 ----
  MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
  SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
  
! if [ -x /usr/sbin/kextstat ]; then KMODSTAT=/usr/sbin/kextstat; fi
! if [ -x /usr/sbin/kmodstat ]; then KMODSTAT=/usr/sbin/kmodstat; fi
  
! 
! StartService()
! {
!     echo "Starting OpenAFS"
! 
!     if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
! 
!     if [ -f $AFSDOPT ]; then
! 	OPTIONS=`cat $AFSDOPT`
!     else
! 	OPTIONS="$MEDIUM -fakestat"
!     fi
  
  # Need the commands ps, awk, kill, sleep
!     PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
! 
!     if [ -d $VICEETC/afs.kext ]; then
  	echo "Loading AFS kernel extensions"
  	kextload $VICEETC/afs.kext
!     else
  	echo "$VICEETC/afs.kext does not exist. Skipping AFS startup."
  	exit 1
!     fi
! 
!     if $KMODSTAT | perl -e 'exit not grep /openafs/, &lt;&gt;' ; then
! 	:
!     else
! 	echo  "AFS kernel extensions failed to initialize. Skipping AFS startup."
  	exit 1
!     fi
  
  #
  # Start the AFS server processes if a bosserver exists
  #
  
!     if [ -x /usr/afs/bin/bosserver ]; then
  	echo "Starting AFS Server processes"
  	/usr/afs/bin/bosserver
  	OPTIONS="$OPTIONS -nosettime"
  	sleep 30
!     fi
  
  #
  # Check that all of the client configuration files exist
  #
  
!     for file in $AFSD $VICEETC/cacheinfo \
! 	$VICEETC/ThisCell $VICEETC/CellServDB
!       do
!       if [ ! -f ${file} ]; then
! 	  echo "${file} does not exist. Not starting AFS client."
! 	  exit 1
!       fi
!     done
  
  #
  # Check that the root directory for AFS (/afs) 
  # and the cache directory (/usr/vice/cache) both exist
  #
  
!     for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo`
!       do
!       if [ ! -d ${dir} ]; then
! 	  echo "${dir} does not exist. Not starting AFS client."
! 	  exit 2
!       fi
!     done
  
!     echo "Starting afsd"
!     $AFSD $OPTIONS
  
  #
  # Call afssettings (if it exists) to set customizable parameters
  #
!     if [ -x $CONFIG/afssettings ]; then
! 	sleep 2
! 	$CONFIG/afssettings
!     fi
  
  #
  # Run package to update the disk
  #
!     if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
  	/usr/afsws/etc/package -v -o `cat $PACKAGE` &gt; /dev/console 2&gt;&amp;1
! 	case $? in
! 	    0)
!                 (echo "Package completed successfully") &gt; /dev/console 2&gt;&amp;1
!                 date &gt; /dev/console 2&gt;&amp;1
! 	    ;;
! 	    4)
! 	        (echo "Rebooting to restart system") &gt; /dev/console 2&gt;&amp;1
! 		sync
! 		/sbin/reboot
! 	    ;;
! 	    *)
! 	        (echo "Package update failed; continuing") &gt; /dev/console 2&gt;&amp;1
! 	    ;;
! 	esac
!      fi
  
  #
  # Start AFS inetd services
  # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
  #
!      if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
! 	 /usr/sbin/inetd.afs /etc/inetd.conf.afs
!      fi
! }
! 
! StopService()
! {
!     echo "Stopping AFS"
! 
!     if $KMODSTAT | perl -e 'exit not grep /openafs/, &lt;&gt;' ; then
! 	echo "Unmounting /afs"
! 	umount -f /afs 2&gt;&amp;1 &gt; /dev/console
! 
! 	echo "Shutting down afsd processes"
! 	$AFSD -shutdown 2&gt;&amp;1 &gt; /dev/console
! 
! 	echo "Unloading AFS kernel extensions"
! 	kextunload $VICEETC/afs.kext 2&gt;&amp;1 &gt; /dev/console
!     fi
! }
! 
! RestartService()
! {
!     StopService
!     StartService
! }
! 
! RunService "$1"
Index: openafs/src/afsd/afsd.c
diff -c openafs/src/afsd/afsd.c:1.42 openafs/src/afsd/afsd.c:1.43
*** openafs/src/afsd/afsd.c:1.42	Thu Jul  8 00:52:38 2004
--- openafs/src/afsd/afsd.c	Wed Jul 28 18:47:58 2004
***************
*** 56,62 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.42 2004/07/08 04:52:38 shadow Exp $");
  
  #define VFS 1
  
--- 56,62 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43 2004/07/28 22:47:58 shadow Exp $");
  
  #define VFS 1
  
***************
*** 221,226 ****
--- 221,227 ----
  /*
   * Global configuration variables.
   */
+ afs_int32 enable_rxbind = 0;
  afs_int32 afs_shutdown = 0;
  afs_int32 cacheBlocks;		/*Num blocks in the cache */
  afs_int32 cacheFiles = 1000;	/*Optimal # of files in workstation cache */
***************
*** 1496,1502 ****
--- 1497,1508 ----
  	/* -backuptree */
  	enable_backuptree = 1;
      }
+     if (as-&gt;parms[31].items) {
+ 	/* -rxbind */
+ 	enable_rxbind = 1;
+     }
  
+     
      /*
       * Pull out all the configuration info for the workstation's AFS cache and
       * the cellular community we're willing to let our users see.
***************
*** 1667,1675 ****
  	    parseNetFiles(addrbuf, maskbuf, mtubuf, MAXIPADDRS, reason,
  			  AFSDIR_CLIENT_NETINFO_FILEPATH,
  			  AFSDIR_CLIENT_NETRESTRICT_FILEPATH);
! 	if (code &gt; 0)
  	    call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
! 	else
  	    printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
  		   reason);
      }
--- 1673,1683 ----
  	    parseNetFiles(addrbuf, maskbuf, mtubuf, MAXIPADDRS, reason,
  			  AFSDIR_CLIENT_NETINFO_FILEPATH,
  			  AFSDIR_CLIENT_NETRESTRICT_FILEPATH);
! 	if (code &gt; 0) {
! 	    if (enable_rxbind)
! 		code = code | 0x80000000;
  	    call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
! 	} else
  	    printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
  		   reason);
      }
***************
*** 2168,2173 ****
--- 2176,2182 ----
      cmd_AddParm(ts, "-nomount", CMD_FLAG, CMD_OPTIONAL, "Do not mount AFS");
      cmd_AddParm(ts, "-backuptree", CMD_FLAG, CMD_OPTIONAL,
  		"Prefer backup volumes for mointpoints in backup volumes");
+     cmd_AddParm(ts, "-rxbind", CMD_FLAG, CMD_OPTIONAL, "Bind the Rx socket (one interface only)");
      return (cmd_Dispatch(argc, argv));
  }
  
***************
*** 2271,2277 ****
      long eparm[4];
      struct afsprocdata syscall_data;
      int fd = open(PROC_SYSCALL_FNAME,O_RDWR);
! 
      eparm[0] = param4;
      eparm[1] = param5;
      eparm[2] = param6;
--- 2280,2287 ----
      long eparm[4];
      struct afsprocdata syscall_data;
      int fd = open(PROC_SYSCALL_FNAME,O_RDWR);
!     if (fd &lt; 0)
! 	fd = open(PROC_SYSCALL_ARLA_FNAME,O_RDWR);
      eparm[0] = param4;
      eparm[1] = param5;
      eparm[2] = param6;
Index: openafs/src/afsmonitor/afsmonitor.c
diff -c openafs/src/afsmonitor/afsmonitor.c:1.15 openafs/src/afsmonitor/afsmonitor.c:1.18
*** openafs/src/afsmonitor/afsmonitor.c:1.15	Fri Oct 24 02:26:06 2003
--- openafs/src/afsmonitor/afsmonitor.c	Fri Aug  6 17:48:28 2004
***************
*** 19,25 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsmonitor/afsmonitor.c,v 1.15 2003/10/24 06:26:06 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
--- 19,25 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/afsmonitor/afsmonitor.c,v 1.18 2004/08/06 21:48:28 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
***************
*** 277,283 ****
  
  
  
! #if !defined(AFS_FBSD_ENV) &amp;&amp; !defined(AFS_DARWIN70_ENV)
  /*	
          strcasestr(): Return first occurence of pattern s2 in s1, case 
  	insensitive. 
--- 277,283 ----
  
  
  
! #if !defined(AFS_FBSD_ENV) &amp;&amp; !defined(AFS_DARWIN70_ENV) &amp;&amp; !defined(AFS_NBSD20_ENV)
  /*	
          strcasestr(): Return first occurence of pattern s2 in s1, case 
  	insensitive. 
***************
*** 898,904 ****
  	    fprintf(stderr, "[ %s ] Programming error 2\n", rn);
  	    return (-1);
  	}
!     } else if ((strcasecmp(arg1, "cm")) != 0 &amp;&amp; (strcasecmp(arg1, "cm")) != 0) {
  	fprintf(stderr,
  		"[ %s ] Syntax error. Second argument should be \"fs\" or \"cm\" \n",
  		rn);
--- 898,904 ----
  	    fprintf(stderr, "[ %s ] Programming error 2\n", rn);
  	    return (-1);
  	}
!     } else {
  	fprintf(stderr,
  		"[ %s ] Syntax error. Second argument should be \"fs\" or \"cm\" \n",
  		rn);
***************
*** 2624,2630 ****
  
  
      fullP = (struct afs_stats_CMFullPerf *)
! 	(xstat_cm_Results.data.AFSCB_CollData_val);
  
      /* There are 4 parts to CM statistics
       * - Overall performance statistics (including up/down statistics)
--- 2624,2630 ----
  
  
      fullP = (struct afs_stats_CMFullPerf *)
! 	(a_cmResults-&gt;data.AFSCB_CollData_val);
  
      /* There are 4 parts to CM statistics
       * - Overall performance statistics (including up/down statistics)
***************
*** 3615,3621 ****
  
  
  /*-----------------------------------------------------------------------
!  * afsmon_execut()
   *
   * Description:
   *	This is where we start it all. Initialize an array of sockets for
--- 3615,3621 ----
  
  
  /*-----------------------------------------------------------------------
!  * afsmon_execute()
   *
   * Description:
   *	This is where we start it all. Initialize an array of sockets for
Index: openafs/src/afsmonitor/afsmonitor.h
diff -c openafs/src/afsmonitor/afsmonitor.h:1.4 openafs/src/afsmonitor/afsmonitor.h:1.5
*** openafs/src/afsmonitor/afsmonitor.h:1.4	Tue Jul 15 19:14:32 2003
--- openafs/src/afsmonitor/afsmonitor.h	Wed Jul 28 23:53:27 2004
***************
*** 78,85 ****
  
  /* Data is categorized into sections and groups to enable to user to choose
  what he wants displayed. */
! #define FS_NUM_DATA_CATEGORIES 8	/* # of fs categories */
! #define CM_NUM_DATA_CATEGORIES 14	/* # of cm categories */
  
  /* Set this  enable detailed debugging with the -debug switch */
  #define DETAILED_DEBUG 0
--- 78,85 ----
  
  /* Data is categorized into sections and groups to enable to user to choose
  what he wants displayed. */
! #define FS_NUM_DATA_CATEGORIES 9	/* # of fs categories */
! #define CM_NUM_DATA_CATEGORIES 16	/* # of cm categories */
  
  /* Set this  enable detailed debugging with the -debug switch */
  #define DETAILED_DEBUG 0
Index: openafs/src/bozo/NTMakefile
diff -c openafs/src/bozo/NTMakefile:1.7 openafs/src/bozo/NTMakefile:1.8
*** openafs/src/bozo/NTMakefile:1.7	Sat May 29 19:48:06 2004
--- openafs/src/bozo/NTMakefile	Thu Aug  5 12:31:38 2004
***************
*** 70,76 ****
  	$(DESTDIR)\lib\cm_dns.obj
  
  $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  
--- 70,76 ----
  	$(DESTDIR)\lib\cm_dns.obj
  
  $(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  
***************
*** 106,112 ****
  
  
  $(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  $(CL_BOS_EXEFILE): $(RS_BOS_EXEFILE)
--- 106,112 ----
  
  
  $(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  $(CL_BOS_EXEFILE): $(RS_BOS_EXEFILE)
Index: openafs/src/bucoord/NTMakefile
diff -c openafs/src/bucoord/NTMakefile:1.10 openafs/src/bucoord/NTMakefile:1.11
*** openafs/src/bucoord/NTMakefile:1.10	Thu Jul 15 23:56:51 2004
--- openafs/src/bucoord/NTMakefile	Thu Aug  5 12:31:38 2004
***************
*** 91,97 ****
  	
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  
--- 91,97 ----
  	
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  
Index: openafs/src/butc/NTMakefile
diff -c openafs/src/butc/NTMakefile:1.7 openafs/src/butc/NTMakefile:1.8
*** openafs/src/butc/NTMakefile:1.7	Thu Jul 15 23:56:52 2004
--- openafs/src/butc/NTMakefile	Thu Aug  5 12:31:39 2004
***************
*** 54,60 ****
  	$(DESTDIR)\lib\cm_dns.obj
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  ############################################################################
--- 54,60 ----
  	$(DESTDIR)\lib\cm_dns.obj
  
  $(EXEFILE): $(EXEOBJS) $(EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  ############################################################################
Index: openafs/src/cf/osconf.m4
diff -c openafs/src/cf/osconf.m4:1.51 openafs/src/cf/osconf.m4:1.51.2.1
*** openafs/src/cf/osconf.m4:1.51	Thu Jun 24 13:38:27 2004
--- openafs/src/cf/osconf.m4	Mon Aug  9 05:19:26 2004
***************
*** 748,753 ****
--- 748,774 ----
  		SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text"
  		;;
  
+ 	sunx86_59)
+ 		CC="/opt/SUNWspro/bin/cc"
+ 		CCOBJ="/opt/SUNWspro/bin/cc"
+ 		LEX="lex"
+ 		LD="/usr/ccs/bin/ld"
+ 		MT_CC="/opt/SUNWspro/bin/cc"
+ 		MT_CFLAGS='-mt -DAFS_PTHREAD_ENV ${XCFLAGS}'
+ 		MT_LIBS="-lpthread -lsocket"
+ 		PAM_CFLAGS="-KPIC"
+ 		PAM_LIBS="-lc -lpam -lsocket -lnsl -lm"
+ 		SHLIB_CFLAGS="-KPIC"
+ 		SHLIB_LDFLAGS="-G -Bsymbolic"
+ 		TXLIBS="-lcurses"
+ 		XCFLAGS64='${XCFLAGS} -xarch=v9'
+ 		XCFLAGS="-dy -Bdynamic"
+ 		XLIBELFA="-lelf"
+ 		XLIBKVM="-lkvm"
+ 		XLIBS="${LIB_AFSDB} -lsocket -lnsl -lintl -ldl"
+ 		SHLIB_LINKER="${CC} -G -dy -Wl,-M\$(srcdir)/mapfile -Bsymbolic -z text"
+ 		;;
+ 
  	sunx86_510)
  		CC="/opt/SUNWspro/bin/cc"
  		CCOBJ="/opt/SUNWspro/bin/cc"
Index: openafs/src/config/NTLang.bat
diff -c openafs/src/config/NTLang.bat:1.2 openafs/src/config/NTLang.bat:1.3
*** openafs/src/config/NTLang.bat:1.2	Sat Nov  4 05:04:20 2000
--- openafs/src/config/NTLang.bat	Thu Aug  5 12:51:41 2004
***************
*** 143,197 ****
  set LANGNAME=ja_JP
  set LANGCP=932
  echo Building Japanese resources (%LANGID%, %LANGNAME%)
! goto arg2_warn
  
  :ko_KR
  set LANGID=1042
  set LANGNAME=ko_KR
  set LANGCP=949
  echo Building Korean resources (%LANGID%, %LANGNAME%)
! goto arg2_warn
  
  :zh_CN
  set LANGID=2052
  set LANGNAME=zh_CN
  set LANGCP=936
  echo Building Chinese (Simplified: PR China) resources (%LANGID%, %LANGNAME%)
! goto arg2_warn
  
  :zh_TW
  set LANGID=1028
  set LANGNAME=zh_TW
  set LANGCP=950
  echo Building Chinese (Traditional: Taiwan) resources (%LANGID%, %LANGNAME%)
! goto arg2_warn
  
  :pt_BR
  set LANGID=1046
  set LANGNAME=pt_BR
  set LANGCP=1252
  echo Building Brazilian Portuguese resources (%LANGID%, %LANGNAME%)
! goto arg2_warn
  
  :es_ES
  set LANGID=1034
  set LANGNAME=es_ES
  set LANGCP=1252
  echo Building Spanish resources (%LANGID%, %LANGNAME%)
! goto arg2_warn
  
  :de_DE
  set LANGID=1032
  set LANGNAME=de_DE
  set LANGCP=1252
  echo Building German resources (%LANGID%, %LANGNAME%)
- goto arg2_warn
- 
- ###############################################################################
- # Warn the user that ntlang.reg is required to build non-us languages
- 
- :arg2_warn
- echo NOTE: If you have not already run WINNT/docs/NTLang.reg, do so now!
  goto arg2
  
  ###############################################################################
--- 143,190 ----
  set LANGNAME=ja_JP
  set LANGCP=932
  echo Building Japanese resources (%LANGID%, %LANGNAME%)
! goto arg2
  
  :ko_KR
  set LANGID=1042
  set LANGNAME=ko_KR
  set LANGCP=949
  echo Building Korean resources (%LANGID%, %LANGNAME%)
! goto arg2
  
  :zh_CN
  set LANGID=2052
  set LANGNAME=zh_CN
  set LANGCP=936
  echo Building Chinese (Simplified: PR China) resources (%LANGID%, %LANGNAME%)
! goto arg2
  
  :zh_TW
  set LANGID=1028
  set LANGNAME=zh_TW
  set LANGCP=950
  echo Building Chinese (Traditional: Taiwan) resources (%LANGID%, %LANGNAME%)
! goto arg2
  
  :pt_BR
  set LANGID=1046
  set LANGNAME=pt_BR
  set LANGCP=1252
  echo Building Brazilian Portuguese resources (%LANGID%, %LANGNAME%)
! goto arg2
  
  :es_ES
  set LANGID=1034
  set LANGNAME=es_ES
  set LANGCP=1252
  echo Building Spanish resources (%LANGID%, %LANGNAME%)
! goto arg2
  
  :de_DE
  set LANGID=1032
  set LANGNAME=de_DE
  set LANGCP=1252
  echo Building German resources (%LANGID%, %LANGNAME%)
  goto arg2
  
  ###############################################################################
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.44 openafs/src/config/NTMakefile.i386_nt40:1.46.2.1
*** openafs/src/config/NTMakefile.i386_nt40:1.44	Sun Jul 25 17:47:20 2004
--- openafs/src/config/NTMakefile.i386_nt40	Mon Aug  9 16:57:08 2004
***************
*** 79,85 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=6600
  AFSPRODUCT_VER_BUILD=0
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
  AFSPRODUCT_FILE_VERSION=$(AFSPRODUCT_VER_MAJOR),$(AFSPRODUCT_VER_MINOR),$(AFSPRODUCT_VER_PATCH),$(AFSPRODUCT_VER_BUILD)
--- 79,85 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=7000
  AFSPRODUCT_VER_BUILD=0
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
  AFSPRODUCT_FILE_VERSION=$(AFSPRODUCT_VER_MAJOR),$(AFSPRODUCT_VER_MINOR),$(AFSPRODUCT_VER_PATCH),$(AFSPRODUCT_VER_BUILD)
***************
*** 234,244 ****
  	/GF \
  	/Gd \
  	/Gy \
- 	/GX \
  	/Os
  
  !IF ("$(AFSVER_CL)"!="1200")
! afscdefs = $(afscdefs) /G7 /GT /GS
  !ENDIF
  
  !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
--- 234,252 ----
  	/GF \
  	/Gd \
  	/Gy \
  	/Os
  
+ !IF ("$(AFSVER_CL)"=="1400")
+ afscflags = $(afscflags) /EHsc /wd4996
+ !ELSE
+ afscflags = $(afscflags) /GX
+ !ENDIF
+ 
  !IF ("$(AFSVER_CL)"!="1200")
! afscdefs = $(afscdefs) /GT /GS
! !IF ("$(AFSVER_CL)"!="1400")
! afscdefs = $(afscdefs) /G7
! !ENDIF
  !ENDIF
  
  !IF ("$(AFSDEV_BUILDTYPE)" == "FREE")
Index: openafs/src/config/afs_sysnames.h
diff -c openafs/src/config/afs_sysnames.h:1.49 openafs/src/config/afs_sysnames.h:1.50
*** openafs/src/config/afs_sysnames.h:1.49	Thu Jun 24 13:38:28 2004
--- openafs/src/config/afs_sysnames.h	Tue Jul 27 10:39:31 2004
***************
*** 164,169 ****
--- 164,170 ----
  #define SYS_NAME_ID_i386_fbsd_50        2105
  #define SYS_NAME_ID_i386_fbsd_51        2106
  #define SYS_NAME_ID_i386_fbsd_52        2107
+ #define SYS_NAME_ID_i386_fbsd_53        2108
  
  #define SYS_NAME_ID_ia64_linux2		2200
  #define SYS_NAME_ID_ia64_linux22	2201
***************
*** 197,202 ****
--- 198,204 ----
  #define SYS_NAME_ID_i386_obsd33		2602
  #define SYS_NAME_ID_i386_obsd34		2603
  #define SYS_NAME_ID_i386_obsd35		2604
+ #define SYS_NAME_ID_i386_obsd36		2605
  
  #define SYS_NAME_ID_amd64_linux2        2700
  #define SYS_NAME_ID_amd64_linux22       2701
Index: openafs/src/config/config.c
diff -c openafs/src/config/config.c:1.5 openafs/src/config/config.c:1.6
*** openafs/src/config/config.c:1.5	Tue Jul 15 19:14:55 2003
--- openafs/src/config/config.c	Wed Jul 28 23:57:03 2004
***************
*** 12,17 ****
--- 12,18 ----
  #include &lt;sys/file.h&gt;
  #include &lt;sys/time.h&gt;
  #include &lt;stdio.h&gt;
+ #include &lt;string.h&gt;
  #include &lt;errno.h&gt;
  
  #include "AFS_component_version_number.c"
***************
*** 24,31 ****
  {
      register FILE *infile;
      register FILE *outfile;
!     char *alist[3];
      register int code;
  
      if (argc != 4) {
  	printf
--- 25,33 ----
  {
      register FILE *infile;
      register FILE *outfile;
!     char *alist[5];
      register int code;
+     char *sysname;
  
      if (argc != 4) {
  	printf
***************
*** 42,50 ****
  	printf("config: output file %s not found.\n", argv[2]);
  	exit(1);
      }
      alist[0] = argv[3];
      alist[1] = "all";
!     alist[2] = NULL;
      code = mc_copy(infile, outfile, alist);
      if (code) {
  	printf("config: failed to correctly write makefile '%s', code %d\n",
--- 44,63 ----
  	printf("config: output file %s not found.\n", argv[2]);
  	exit(1);
      }
+     memset (alist, 0, sizeof (alist));
      alist[0] = argv[3];
      alist[1] = "all";
! 
!     /* This allows JUST arch or JUST OS/version,
!      * Linux 2.6 uses the in-kernel build system, so 
!      * just 'linux26' is enough. */
!     sysname = strdup (alist[0]);
!     alist[2] = strchr (sysname, '_');
!     if (alist[2]) {
!         alist[3] = sysname;
!         *alist[2] = 0;
!         alist[2]++;
!     }
      code = mc_copy(infile, outfile, alist);
      if (code) {
  	printf("config: failed to correctly write makefile '%s', code %d\n",
Index: openafs/src/config/param.alpha_dux50.h
diff -c openafs/src/config/param.alpha_dux50.h:1.7 openafs/src/config/param.alpha_dux50.h:1.8
*** openafs/src/config/param.alpha_dux50.h:1.7	Fri Aug  8 17:54:39 2003
--- openafs/src/config/param.alpha_dux50.h	Sun Aug  8 21:23:32 2004
***************
*** 24,29 ****
--- 24,30 ----
  #define	AFS_ALPHA_ENV	1
  #define	AFS_DECOSF_ENV	1
  #define	AFS_64BIT_ENV	1
+ #define AFS_64BIT_CLIENT 1
  
  #include &lt;afs/afs_sysnames.h&gt;
  
Index: openafs/src/config/param.alpha_dux51.h
diff -c openafs/src/config/param.alpha_dux51.h:1.4 openafs/src/config/param.alpha_dux51.h:1.5
*** openafs/src/config/param.alpha_dux51.h:1.4	Fri Aug  8 17:54:39 2003
--- openafs/src/config/param.alpha_dux51.h	Mon Aug  9 00:07:33 2004
***************
*** 25,30 ****
--- 25,31 ----
  #define	AFS_ALPHA_ENV	1
  #define	AFS_DECOSF_ENV	1
  #define	AFS_64BIT_ENV	1
+ #define AFS_64BIT_CLIENT	1
  
  #include &lt;afs/afs_sysnames.h&gt;
  
Index: openafs/src/config/param.amd64_linux24.h
diff -c openafs/src/config/param.amd64_linux24.h:1.2 openafs/src/config/param.amd64_linux24.h:1.3
*** openafs/src/config/param.amd64_linux24.h:1.2	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.amd64_linux24.h	Mon Aug  9 00:07:33 2004
***************
*** 36,41 ****
--- 36,42 ----
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
  
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  
Index: openafs/src/config/param.hp_ux11i.h
diff -c openafs/src/config/param.hp_ux11i.h:1.3 openafs/src/config/param.hp_ux11i.h:1.4
*** openafs/src/config/param.hp_ux11i.h:1.3	Fri Aug  8 17:54:39 2003
--- openafs/src/config/param.hp_ux11i.h	Mon Aug  9 00:07:33 2004
***************
*** 24,29 ****
--- 24,30 ----
  #define	AFS_HPUX1111_ENV	1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  
  #include &lt;afs/afs_sysnames.h&gt;
Index: openafs/src/config/param.i386_fbsd_50.h
diff -c openafs/src/config/param.i386_fbsd_50.h:1.7 openafs/src/config/param.i386_fbsd_50.h:1.8
*** openafs/src/config/param.i386_fbsd_50.h:1.7	Wed Mar 10 18:01:52 2004
--- openafs/src/config/param.i386_fbsd_50.h	Mon Aug  9 00:07:33 2004
***************
*** 13,18 ****
--- 13,19 ----
  
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
  #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
  #define AFS_FBSD_ENV 1
  #define AFS_FBSD40_ENV 1
Index: openafs/src/config/param.i386_fbsd_51.h
diff -c openafs/src/config/param.i386_fbsd_51.h:1.2 openafs/src/config/param.i386_fbsd_51.h:1.3
*** openafs/src/config/param.i386_fbsd_51.h:1.2	Wed Mar 10 18:01:52 2004
--- openafs/src/config/param.i386_fbsd_51.h	Mon Aug  9 00:07:33 2004
***************
*** 13,18 ****
--- 13,19 ----
  
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
  #define AFS_FBSD_ENV 1
  #define AFS_FBSD40_ENV 1
Index: openafs/src/config/param.i386_fbsd_52.h
diff -c openafs/src/config/param.i386_fbsd_52.h:1.2 openafs/src/config/param.i386_fbsd_52.h:1.3
*** openafs/src/config/param.i386_fbsd_52.h:1.2	Wed Mar 10 18:01:52 2004
--- openafs/src/config/param.i386_fbsd_52.h	Mon Aug  9 00:07:33 2004
***************
*** 13,18 ****
--- 13,19 ----
  
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
  #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
  #define AFS_FBSD_ENV 1
  #define AFS_FBSD40_ENV 1
Index: openafs/src/config/param.i386_fbsd_53.h
diff -c /dev/null openafs/src/config/param.i386_fbsd_53.h:1.2
*** /dev/null	Tue Aug 10 00:30:06 2004
--- openafs/src/config/param.i386_fbsd_53.h	Mon Aug  9 00:07:33 2004
***************
*** 0 ****
--- 1,201 ----
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ #ifndef IGNORE_STDS_H
+ #include &lt;sys/param.h&gt;
+ #endif
+ 
+ #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV 1
+ 
+ #define AFS_NAMEI_ENV     1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_CLIENT 1
+ #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
+ #define AFS_FBSD_ENV 1
+ #define AFS_FBSD40_ENV 1
+ #define AFS_FBSD42_ENV 1
+ #define AFS_FBSD43_ENV 1
+ #define AFS_FBSD44_ENV 1
+ #define AFS_FBSD45_ENV 1
+ #define AFS_FBSD46_ENV 1
+ #define AFS_FBSD47_ENV 1
+ #define AFS_FBSD50_ENV 1
+ #define AFS_FBSD51_ENV 1
+ #define AFS_FBSD52_ENV 1
+ #define AFS_FBSD53_ENV 1
+ #define AFS_X86_FBSD_ENV 1
+ #define AFS_X86_FBSD40_ENV 1
+ #define AFS_X86_FBSD42_ENV 1
+ #define AFS_X86_FBSD43_ENV 1
+ #define AFS_X86_FBSD46_ENV 1
+ #define AFS_X86_FBSD47_ENV 1
+ #define AFS_X86_FBSD50_ENV 1
+ #define AFS_X86_ENV 1
+ #define AFS_NONFSTRANS 1
+ #define FTRUNC O_TRUNC
+ 
+ #define IUPD 0x0010
+ #define IACC 0x0020
+ #define ICHG 0x0040
+ #define IMOD 0x0080
+ 
+ #define IN_LOCK(ip)     lockmgr(&amp;ip-&gt;i_lock, LK_EXCLUSIVE, \
+                                 NULL, curproc)
+ #define IN_UNLOCK(ip)   lockmgr(&amp;ip-&gt;i_lock, LK_RELEASE, \
+                                 NULL, curproc)
+ 
+ #include &lt;afs/afs_sysnames.h&gt;
+ 
+ #define AFS_VM_RDWR_ENV	1
+ #define AFS_VFS_ENV	1
+ #define AFS_VFSINCL_ENV 1
+ #define AFS_GREEDY43_ENV	1
+ #define AFS_ENV  	1
+ 
+ #define AFS_SYSCALL	339
+ #define AFS_MOUNT_AFS	"afs"
+ 
+ #ifndef MOUNT_UFS
+ #define MOUNT_UFS "ufs"
+ #endif
+ 
+ #ifndef	MOUNT_AFS
+ #define	MOUNT_AFS AFS_MOUNT_AFS
+ #endif
+ #define SYS_NAME	"i386_fbsd_53"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_53
+ 
+ #define AFS_HAVE_FFS            1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS	0	/* System doesn't supports statvfs */
+ 
+ #define RXK_LISTENER_ENV 1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ #define AFSLITTLE_ENDIAN 1
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK        1
+ #define	AFS_VFS34	1	/* What is VFS34??? */
+ #define	AFS_SHORTGID	0	/* are group id's short? */
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	CLBYTES
+ #define	osi_GetTime(x)	microtime(x)
+ #define AFS_KALLOC(x)   osi_fbsd_alloc((x), 1)
+ #undef	AFS_KALLOC_NOSLEEP
+ #define	AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0)
+ #define AFS_KFREE(x,y)  osi_fbsd_free((x))
+ #define	v_count		v_usecount
+ #define v_vfsp		v_mount
+ #define vfs_bsize	mnt_stat.f_bsize
+ #define vfs_fsid	mnt_stat.f_fsid
+ #define va_nodeid	va_fileid
+ #define vfs_vnodecovered mnt_vnodecovered
+ #define direct		dirent
+ #define vnode_t		struct vnode
+ 
+ #ifndef MUTEX_DEFAULT
+ #define MUTEX_DEFAULT   0
+ #endif /* MUTEX_DEFAULT */
+ 
+ #ifndef SSYS
+ #define SSYS            0x00002
+ #endif /* SSYS */
+ 
+ #define p_rcred         p_ucred
+ 
+ #if	!defined(ASSEMBLER) &amp;&amp; !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifdef KERNEL
+ #ifndef MIN
+ #define MIN(A,B) ((A) &lt; (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) &gt; (B) ? (A) : (B))
+ #endif
+ #endif /* KERNEL */
+ 
+ #endif /* ! ASSEMBLER &amp; ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_ENV			1
+ #define AFS_VFSINCL_ENV         1
+ #define AFS_USR_FBSD40_ENV	1
+ #define AFS_USR_FBSD42_ENV	1
+ #define AFS_USR_FBSD43_ENV	1
+ #define AFS_USR_FBSD44_ENV	1
+ #define AFS_USR_FBSD45_ENV	1
+ #define AFS_USR_FBSD46_ENV	1
+ #define AFS_USR_FBSD47_ENV	1
+ #define AFS_USR_FBSD50_ENV	1
+ #define AFS_USR_FBSD51_ENV	1
+ #define AFS_USR_FBSD52_ENV	1
+ #define AFS_USR_FBSD53_ENV	1
+ #define AFS_USR_FBSD_ENV	1
+ #define AFS_NONFSTRANS 1
+ 
+ #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
+ #define AFS_SYSCALL 339
+ #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV 1
+ #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
+ #define AFS_USERSPACE_IP_ADDR 1
+ #define RXK_LISTENER_ENV      1
+ #define AFS_GCPAGS	      0	/* if nonzero, garbage collect PAGs */
+ 
+ /* Machine / Operating system information */
+ #include &lt;afs/afs_sysnames.h&gt;
+ #define SYS_NAME	"i386_fbsd_53"
+ #define SYS_NAME_ID	SYS_NAME_ID_i386_fbsd_53
+ 
+ #define AFSLITTLE_ENDIAN    1
+ #define AFS_HAVE_FFS        1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS    1	/* System doesn't support statvfs */
+ #define AFS_VM_RDWR_ENV	    1	/* read/write implemented via VM */
+ 
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ 
+ #define AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ 
+ #include &lt;limits.h&gt;
+ #include &lt;sys/param.h&gt;
+ #include &lt;sys/types.h&gt;
+ #include &lt;sys/mount.h&gt;
+ #include &lt;sys/fcntl.h&gt;
+ #include &lt;netinet/in.h&gt;
+ #include &lt;sys/uio.h&gt;
+ #include &lt;sys/socket.h&gt;
+ 
+ #endif /* !defined(UKERNEL) */
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.i386_linux26.h
diff -c openafs/src/config/param.i386_linux26.h:1.2 openafs/src/config/param.i386_linux26.h:1.3
*** openafs/src/config/param.i386_linux26.h:1.2	Tue Jun  1 22:55:59 2004
--- openafs/src/config/param.i386_linux26.h	Thu Jul 29 17:29:18 2004
***************
*** 33,45 ****
  
  #include &lt;linux/config.h&gt;
  #ifdef CONFIG_SMP
! #undef CONFIG_SMP
  #endif
  /* Using "AFS_SMP" to map to however many #define's are required to get
   * MP to compile for Linux
   */
  #ifdef AFS_SMP
  #define CONFIG_SMP 1
  #ifndef CONFIG_X86_LOCAL_APIC
  #define CONFIG_X86_LOCAL_APIC 1
  #endif
--- 33,49 ----
  
  #include &lt;linux/config.h&gt;
  #ifdef CONFIG_SMP
! #ifndef AFS_SMP
! #define AFS_SMP 1
! #endif
  #endif
  /* Using "AFS_SMP" to map to however many #define's are required to get
   * MP to compile for Linux
   */
  #ifdef AFS_SMP
+ #ifndef CONFIG_SMP
  #define CONFIG_SMP 1
+ #endif
  #ifndef CONFIG_X86_LOCAL_APIC
  #define CONFIG_X86_LOCAL_APIC 1
  #endif
Index: openafs/src/config/param.i386_nbsd20.h
diff -c openafs/src/config/param.i386_nbsd20.h:1.3 openafs/src/config/param.i386_nbsd20.h:1.4
*** openafs/src/config/param.i386_nbsd20.h:1.3	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.i386_nbsd20.h	Mon Aug  9 00:07:33 2004
***************
*** 40,45 ****
--- 40,47 ----
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 210
  #define AFS_NAMEI_ENV         1	/* User space interface to file system */
+ #define AFS_64BIT_ENV         1
+ #define AFS_64BIT_CLIENT      1
  #define AFS_64BIT_IOPS_ENV    1	/* Needed for NAMEI */
  #include &lt;afs/afs_sysnames.h&gt;
  
Index: openafs/src/config/param.i386_obsd31.h
diff -c openafs/src/config/param.i386_obsd31.h:1.11 openafs/src/config/param.i386_obsd31.h:1.12
*** openafs/src/config/param.i386_obsd31.h:1.11	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.i386_obsd31.h	Mon Aug  9 00:07:33 2004
***************
*** 14,19 ****
--- 14,20 ----
  
  #define AFS_NAMEI_ENV		1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
  #define	AFS_OBSD_ENV		1
  #define AFS_NONFSTRANS		1
Index: openafs/src/config/param.i386_obsd32.h
diff -c openafs/src/config/param.i386_obsd32.h:1.3 openafs/src/config/param.i386_obsd32.h:1.4
*** openafs/src/config/param.i386_obsd32.h:1.3	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.i386_obsd32.h	Mon Aug  9 00:07:33 2004
***************
*** 14,19 ****
--- 14,20 ----
  
  #define AFS_NAMEI_ENV		1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
  #define	AFS_OBSD_ENV		1
  #define AFS_NONFSTRANS		1
Index: openafs/src/config/param.i386_obsd33.h
diff -c openafs/src/config/param.i386_obsd33.h:1.3 openafs/src/config/param.i386_obsd33.h:1.4
*** openafs/src/config/param.i386_obsd33.h:1.3	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.i386_obsd33.h	Mon Aug  9 00:07:33 2004
***************
*** 17,22 ****
--- 17,23 ----
  
  #define AFS_NAMEI_ENV		1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
  #define	AFS_OBSD_ENV		1
  #define AFS_NONFSTRANS		1
Index: openafs/src/config/param.i386_obsd34.h
diff -c openafs/src/config/param.i386_obsd34.h:1.3 openafs/src/config/param.i386_obsd34.h:1.4
*** openafs/src/config/param.i386_obsd34.h:1.3	Tue Jul 15 19:14:55 2003
--- openafs/src/config/param.i386_obsd34.h	Mon Aug  9 00:07:33 2004
***************
*** 17,22 ****
--- 17,23 ----
  
  #define AFS_NAMEI_ENV		1	/* User space interface to file system */
  #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
  #define AFS_OBSD_ENV		1
  #define AFS_OBSD34_ENV		1
Index: openafs/src/config/param.i386_obsd36.h
diff -c /dev/null openafs/src/config/param.i386_obsd36.h:1.2
*** /dev/null	Tue Aug 10 00:30:06 2004
--- openafs/src/config/param.i386_obsd36.h	Mon Aug  9 00:07:33 2004
***************
*** 0 ****
--- 1,64 ----
+ /*
+  * Jim Rees, University of Michigan CITI
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #ifndef IGNORE_STDS_H
+ #include &lt;sys/param.h&gt;
+ #endif
+ 
+ #define SYS_NAME		"i386_obsd36"
+ #define SYS_NAME_ID		SYS_NAME_ID_i386_obsd36
+ 
+ #define AFS_XBSD_ENV		1	/* {Free,Open,Net}BSD */
+ #define AFS_X86_XBSD_ENV	1
+ 
+ #define AFS_NAMEI_ENV		1	/* User space interface to file system */
+ #define AFS_64BIT_ENV		1
+ #define AFS_64BIT_CLIENT	1
+ #define AFS_64BIT_IOPS_ENV	1	/* Needed for NAMEI */
+ #define AFS_OBSD_ENV		1
+ #define AFS_OBSD34_ENV		1
+ #define AFS_OBSD35_ENV		1
+ #define AFS_OBSD36_ENV		1
+ #define AFS_NONFSTRANS		1
+ #define AFS_VM_RDWR_ENV		1
+ #define AFS_VFS_ENV		1
+ #define AFS_VFSINCL_ENV		1
+ 
+ #define FTRUNC O_TRUNC
+ 
+ #define AFS_SYSCALL		208
+ #define AFS_MOUNT_AFS		"afs"
+ 
+ #define RXK_LISTENER_ENV	1
+ #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
+ #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
+ 
+ #define AFSLITTLE_ENDIAN	1
+ 
+ #ifndef IGNORE_STDS_H
+ #include &lt;afs/afs_sysnames.h&gt;
+ #endif
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef _KERNEL
+ #define AFS_GLOBAL_SUNLOCK	1
+ #define	AFS_SHORTGID		0	/* are group id's short? */
+ 
+ #if	!defined(ASSEMBLER) &amp;&amp; !defined(__LANGUAGE_ASSEMBLY__)
+ enum vcexcl { NONEXCL, EXCL };
+ 
+ #ifndef MIN
+ #define MIN(A,B) ((A) &lt; (B) ? (A) : (B))
+ #endif
+ #ifndef MAX
+ #define MAX(A,B) ((A) &gt; (B) ? (A) : (B))
+ #endif
+ 
+ #endif /* ! ASSEMBLER &amp; ! __LANGUAGE_ASSEMBLY__ */
+ #endif /* _KERNEL */
+ 
+ #endif /* AFS_PARAM_H */
Index: openafs/src/config/param.ia64_hpux1122.h
diff -c openafs/src/config/param.ia64_hpux1122.h:1.2 openafs/src/config/param.ia64_hpux1122.h:1.3
*** openafs/src/config/param.ia64_hpux1122.h:1.2	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.ia64_hpux1122.h	Mon Aug  9 00:07:33 2004
***************
*** 22,27 ****
--- 22,28 ----
  #define AFS_HPUX1122_ENV 1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
  #if defined(__LP64__)
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  #endif
Index: openafs/src/config/param.ia64_hpux1123.h
diff -c openafs/src/config/param.ia64_hpux1123.h:1.1 openafs/src/config/param.ia64_hpux1123.h:1.2
*** openafs/src/config/param.ia64_hpux1123.h:1.1	Wed Nov 26 20:17:41 2003
--- openafs/src/config/param.ia64_hpux1123.h	Mon Aug  9 00:07:33 2004
***************
*** 23,28 ****
--- 23,29 ----
  #define	AFS_HPUX1123_ENV 1
  
  #define AFS_64BIT_ENV		1       /* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
  #if defined(__LP64__)
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  #endif
Index: openafs/src/config/param.ia64_linux24.h
diff -c openafs/src/config/param.ia64_linux24.h:1.8 openafs/src/config/param.ia64_linux24.h:1.9
*** openafs/src/config/param.ia64_linux24.h:1.8	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.ia64_linux24.h	Mon Aug  9 00:07:33 2004
***************
*** 36,41 ****
--- 36,42 ----
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1	
  
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  
Index: openafs/src/config/param.nbsd20.h
diff -c openafs/src/config/param.nbsd20.h:1.3 openafs/src/config/param.nbsd20.h:1.5
*** openafs/src/config/param.nbsd20.h:1.3	Sat May 15 02:32:35 2004
--- openafs/src/config/param.nbsd20.h	Fri Aug  6 17:48:32 2004
***************
*** 11,16 ****
--- 11,17 ----
  
  #define AFS_XBSD_ENV 1		/* {Free,Open,Net}BSD */
  
+ #define AFS_64BIT_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  #define AFS_64BIT_IOPS_ENV 1	/* Needed for NAMEI */
  #define AFS_NBSD_ENV 1
***************
*** 52,58 ****
  #endif
  
  #define AFS_HAVE_FFS            1	/* Use system's ffs. */
! #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
  
  #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
  #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
--- 53,59 ----
  #endif
  
  #define AFS_HAVE_FFS            1	/* Use system's ffs. */
! #define AFS_HAVE_STATVFS	0	/* System supports statvfs */
  
  #define AFS_GCPAGS	        0	/* if nonzero, garbage collect PAGs */
  #define AFS_USE_GETTIMEOFDAY    1	/* use gettimeofday to implement rx clock */
Index: openafs/src/config/param.parisc_linux24.h
diff -c openafs/src/config/param.parisc_linux24.h:1.6 openafs/src/config/param.parisc_linux24.h:1.7
*** openafs/src/config/param.parisc_linux24.h:1.6	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.parisc_linux24.h	Mon Aug  9 00:07:33 2004
***************
*** 19,24 ****
--- 19,26 ----
  
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
+ #define AFS_64BIT_ENV  1
+ #define AFS_64BIT_CLIENT  1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  
Index: openafs/src/config/param.ppc64_linux24.h
diff -c openafs/src/config/param.ppc64_linux24.h:1.1 openafs/src/config/param.ppc64_linux24.h:1.2
*** openafs/src/config/param.ppc64_linux24.h:1.1	Tue Feb  3 01:23:36 2004
--- openafs/src/config/param.ppc64_linux24.h	Mon Aug  9 00:07:33 2004
***************
*** 24,29 ****
--- 24,30 ----
  #define AFS_NAMEI_ENV     1   /* User space interface to file system */
  
  #define AFS_64BIT_ENV          1     /* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
  
  #define AFS_64BITPOINTER_ENV   1     /* pointers are 64 bits. */
  
Index: openafs/src/config/param.ppc_darwin_70.h
diff -c openafs/src/config/param.ppc_darwin_70.h:1.3 openafs/src/config/param.ppc_darwin_70.h:1.4
*** openafs/src/config/param.ppc_darwin_70.h:1.3	Wed Jun 23 14:34:51 2004
--- openafs/src/config/param.ppc_darwin_70.h	Sun Aug  8 19:12:55 2004
***************
*** 6,11 ****
--- 6,12 ----
  
  #define AFS_ENV                 1
  #define AFS_64BIT_ENV           1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT        1
  #define AFS_64BIT_IOPS_ENV 1
  #define AFS_PPC_ENV 1
  #define AFS_VFSINCL_ENV 1
Index: openafs/src/config/param.ppc_linux24.h
diff -c openafs/src/config/param.ppc_linux24.h:1.9 openafs/src/config/param.ppc_linux24.h:1.10
*** openafs/src/config/param.ppc_linux24.h:1.9	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.ppc_linux24.h	Mon Aug  9 00:07:34 2004
***************
*** 21,26 ****
--- 21,28 ----
  
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
+ #define AFS_64BIT_ENV	1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  
Index: openafs/src/config/param.s390_linux24.h
diff -c openafs/src/config/param.s390_linux24.h:1.11 openafs/src/config/param.s390_linux24.h:1.12
*** openafs/src/config/param.s390_linux24.h:1.11	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.s390_linux24.h	Mon Aug  9 00:07:34 2004
***************
*** 31,36 ****
--- 31,38 ----
  
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 137
+ #define AFS_64BIT_ENV	1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  
Index: openafs/src/config/param.sgi_65.h
diff -c openafs/src/config/param.sgi_65.h:1.12 openafs/src/config/param.sgi_65.h:1.13
*** openafs/src/config/param.sgi_65.h:1.12	Thu Jun 24 12:55:00 2004
--- openafs/src/config/param.sgi_65.h	Sun Aug  8 23:30:18 2004
***************
*** 38,43 ****
--- 38,44 ----
  #define _ANSI_C_SOURCE		1	/* rx_user.h */
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  #define AFS_HAVE_FFS		1	/* Use system's ffs. */
  #define AFS_HAVE_STATVFS	1	/* System supports statvfs */
Index: openafs/src/config/param.sparc64_linux24.h
diff -c openafs/src/config/param.sparc64_linux24.h:1.6 openafs/src/config/param.sparc64_linux24.h:1.7
*** openafs/src/config/param.sparc64_linux24.h:1.6	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.sparc64_linux24.h	Mon Aug  9 00:07:34 2004
***************
*** 36,41 ****
--- 36,42 ----
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1
  #define AFS_32BIT_USR_ENV       1
  #define AFS_64BITPOINTER_ENV	1	/* pointers are 64 bits. */
  
Index: openafs/src/config/param.sparc_linux24.h
diff -c openafs/src/config/param.sparc_linux24.h:1.7 openafs/src/config/param.sparc_linux24.h:1.8
*** openafs/src/config/param.sparc_linux24.h:1.7	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.sparc_linux24.h	Mon Aug  9 00:07:34 2004
***************
*** 30,35 ****
--- 30,37 ----
  
  #define AFS_MOUNT_AFS "afs"	/* The name of the filesystem type. */
  #define AFS_SYSCALL 227
+ #define AFS_64BIT_ENV	1
+ #define AFS_64BIT_CLIENT	1
  #define AFS_64BIT_IOPS_ENV  1
  #define AFS_NAMEI_ENV     1	/* User space interface to file system */
  
Index: openafs/src/config/param.sun4x_510.h
diff -c openafs/src/config/param.sun4x_510.h:1.1 openafs/src/config/param.sun4x_510.h:1.2
*** openafs/src/config/param.sun4x_510.h:1.1	Thu Jun 24 13:38:28 2004
--- openafs/src/config/param.sun4x_510.h	Sun Aug  8 14:14:08 2004
***************
*** 23,28 ****
--- 23,29 ----
  #define AFS_SUN510_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID	1
  
Index: openafs/src/config/param.sun4x_58.h
diff -c openafs/src/config/param.sun4x_58.h:1.10 openafs/src/config/param.sun4x_58.h:1.11
*** openafs/src/config/param.sun4x_58.h:1.10	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.sun4x_58.h	Sun Aug  8 14:14:08 2004
***************
*** 21,26 ****
--- 21,27 ----
  #define AFS_SUN58_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
Index: openafs/src/config/param.sun4x_59.h
diff -c openafs/src/config/param.sun4x_59.h:1.4 openafs/src/config/param.sun4x_59.h:1.5
*** openafs/src/config/param.sun4x_59.h:1.4	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.sun4x_59.h	Sun Aug  8 14:14:08 2004
***************
*** 22,27 ****
--- 22,28 ----
  #define AFS_SUN59_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
Index: openafs/src/config/param.sunx86_510.h
diff -c openafs/src/config/param.sunx86_510.h:1.1 openafs/src/config/param.sunx86_510.h:1.2
*** openafs/src/config/param.sunx86_510.h:1.1	Thu Jun 24 13:38:28 2004
--- openafs/src/config/param.sunx86_510.h	Sun Aug  8 14:14:08 2004
***************
*** 33,38 ****
--- 33,39 ----
  #define AFS_X86_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
Index: openafs/src/config/param.sunx86_58.h
diff -c openafs/src/config/param.sunx86_58.h:1.5 openafs/src/config/param.sunx86_58.h:1.6
*** openafs/src/config/param.sunx86_58.h:1.5	Tue Jul 15 19:14:56 2003
--- openafs/src/config/param.sunx86_58.h	Sun Aug  8 14:14:08 2004
***************
*** 31,36 ****
--- 31,37 ----
  #define AFS_X86_ENV		1
  
  #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1	
  
  #define AFS_HAVE_FLOCK_SYSID    1
  
Index: openafs/src/config/param.sunx86_59.h
diff -c /dev/null openafs/src/config/param.sunx86_59.h:1.2
*** /dev/null	Tue Aug 10 00:30:06 2004
--- openafs/src/config/param.sunx86_59.h	Sun Aug  8 14:14:08 2004
***************
*** 0 ****
--- 1,207 ----
+ #ifndef UKERNEL
+ /* This section for kernel libafs compiles only */
+ 
+ /*
+  * 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
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ 
+ #define AFS_VFSINCL_ENV	1	/* NOBODY uses this.... */
+ #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
+ #define AFS_ENV			1
+ #define AFS_SUN_ENV		1
+ #define AFS_SUN5_ENV		1
+ #define	AFS_SUN52_ENV		1
+ #define	AFS_SUN53_ENV		1
+ #define	AFS_SUN54_ENV		1
+ #define	AFS_SUN55_ENV		1
+ #define	AFS_SUN56_ENV		1
+ #define AFS_SUN57_ENV		1
+ #define AFS_SUN58_ENV		1
+ #define AFS_SUN59_ENV		1
+ #define AFS_X86_ENV		1
+ 
+ #define AFS_64BIT_ENV		1	/* Defines afs_int32 as int, not long. */
+ #define AFS_64BIT_CLIENT	1	
+ 
+ #define AFS_HAVE_FLOCK_SYSID    1
+ 
+ #include &lt;afs/afs_sysnames.h&gt;
+ 
+ #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
+ #define RXK_LISTENER_ENV   1
+ #define AFS_GCPAGS		1	/* if nonzero, garbage collect PAGs */
+ 
+ #ifdef AFS_NAMEI_ENV
+ #define AFS_64BIT_IOPS_ENV	1	/* needed for NAMEI... */
+ #else /* AFS_NAMEI_ENV */
+ #define	AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
+ #endif /* AFS_NAMEI_ENV */
+ 
+ #define	AFS_SYSCALL		65
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 "afs"
+ 
+ /* Machine / Operating system information */
+ #define sys_sunx86_59	1
+ #define SYS_NAME	"sunx86_59"
+ #define SYS_NAME_ID	SYS_NAME_ID_sunx86_59
+ #define AFSLITTLE_ENDIAN	1
+ #define AFS_HAVE_FFS    1	/* Use system's ffs. */
+ #define AFS_HAVE_VXFS	1	/* Support cache on Veritas vxfs file system */
+ #define AFS_HAVE_STATVFS 1	/* System supports statvfs */
+ #define AFS_VM_RDWR_ENV	1	/* read/write implemented via VM */
+ #define AFS_USE_GETTIMEOFDAY 1	/* use gettimeofday to implement rx clock */
+ 
+ #define NEARINODE_HINT  1	/* hint to ufs module to scatter inodes on disk */
+ #define nearInodeHash(volid, hval) {                                 \
+                 unsigned char*  ts = (unsigned char*)&amp;(volid)+sizeof(volid)-1;\
+                 for ( (hval)=0; ts &gt;= (unsigned char*)&amp;(volid); ts--){\
+                     (hval) *= 173;                      \
+                     (hval) += *ts;                      \
+                 }                                       \
+                 }
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ /* sun definitions here */
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #define	afsio_iov		uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg		uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	UIO_SYSSPACE
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	osi_GetTime(x)	uniqtime(x)
+ 
+ /**
+   * These defines are for the 64 bit Solaris 7 port
+   * AFS_SYSCALL32 is used to protect the ILP32 syscall interface
+   * AFS_64BIT_ENV is for use of 64 bit inode numbers
+   */
+ #if defined(__sparcv9)
+ #define	AFS_SUN57_64BIT_ENV	1
+ #define AFS_64BIT_INO   	1
+ #endif
+ 
+ /**
+   * Solaris 7 64 bit has two versions of uniqtime. Since we consistently
+   * use 32 bit quantities for time in afs, we now use uniqtime32
+   */
+ #if defined(AFS_SUN57_64BIT_ENV)
+ #undef osi_GetTime
+ #define osi_GetTime(x)  uniqtime32(x)
+ #endif
+ 
+ 
+ 
+ #define	AFS_KALLOC(n)	kmem_alloc(n, KM_SLEEP)
+ #define AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)
+ #define	AFS_KFREE	kmem_free
+ #define	VATTR_NULL	vattr_null
+ #define memset(A, B, S) bzero(A, S)
+ #define memcpy(B, A, S) bcopy(A, B, S)
+ #define memcmp(A, B, S) bcmp(A, B, S)
+ #endif /* KERNEL */
+ #define	AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ #define	ROOTINO		UFSROOTINO
+ 
+ #endif /* AFS_PARAM_H */
+ 
+ #else /* !defined(UKERNEL) */
+ 
+ /* This section for user space compiles only */
+ 
+ /*
+  * 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
+  */
+ 
+ #ifndef	AFS_PARAM_H
+ #define	AFS_PARAM_H
+ 
+ #define AFS_VFS_ENV	1
+ /* Used only in vfsck code; is it needed any more???? */
+ #define RXK_LISTENER_ENV	1
+ #define AFS_USERSPACE_IP_ADDR	1
+ #define AFS_GCPAGS		0	/* if nonzero, garbage collect PAGs */
+ 
+ #define UKERNEL			1	/* user space kernel */
+ #define AFS_GREEDY43_ENV	1	/* Used only in rx/rx_user.c */
+ #define AFS_ENV			1
+ #define AFS_USR_SUN5_ENV	1
+ #define AFS_USR_SUN6_ENV	1
+ #define AFS_USR_SUN7_ENV        1
+ #define AFS_USR_SUN8_ENV        1
+ #define AFS_USR_SUN9_ENV        1
+ 
+ #include &lt;afs/afs_sysnames.h&gt;
+ 
+ #if 0
+ #define AFS_GLOBAL_SUNLOCK	1	/* For global locking */
+ #endif
+ 
+ #define	AFS_3DISPARES		1	/* Utilize the 3 available disk inode 'spares' */
+ #define	AFS_SYSCALL		65
+ 
+ /* File system entry (used if mount.h doesn't define MOUNT_AFS */
+ #define AFS_MOUNT_AFS	 1
+ 
+ /* Machine / Operating system information */
+ #define sys_sunx86_59	1
+ #define SYS_NAME	"sunx86_59"
+ #define SYS_NAME_ID	SYS_NAME_ID_sunx86_59
+ #define AFSLITTLE_ENDIAN	1
+ #define AFS_HAVE_FFS            1	/* Use system's ffs. */
+ #define AFS_HAVE_STATVFS      0	/* System doesn't support statvfs */
+ 
+ /* Extra kernel definitions (from kdefs file) */
+ #ifdef KERNEL
+ #define	AFS_UIOFMODE		1	/* Only in afs/afs_vnodeops.c (afs_ustrategy) */
+ #define	AFS_SYSVLOCK		1	/* sys v locking supported */
+ /*#define	AFS_USEBUFFERS	1*/
+ #define	afsio_iov	uio_iov
+ #define	afsio_iovcnt	uio_iovcnt
+ #define	afsio_offset	uio_offset
+ #define	afsio_seg	uio_segflg
+ #define	afsio_fmode	uio_fmode
+ #define	afsio_resid	uio_resid
+ #define	AFS_UIOSYS	1
+ #define	AFS_UIOUSER	UIO_USERSPACE
+ #define	AFS_CLBYTES	MCLBYTES
+ #define	AFS_MINCHANGE	2
+ #define	VATTR_NULL	usr_vattr_null
+ #endif /* KERNEL */
+ #define	AFS_DIRENT
+ #ifndef CMSERVERPREF
+ #define CMSERVERPREF
+ #endif
+ #define	ROOTINO		UFSROOTINO
+ 
+ #endif /* AFS_PARAM_H */
+ 
+ #endif /* !defined(UKERNEL) */
Index: openafs/src/kauth/NTMakefile
diff -c openafs/src/kauth/NTMakefile:1.8 openafs/src/kauth/NTMakefile:1.9
*** openafs/src/kauth/NTMakefile:1.8	Sat May 29 19:48:12 2004
--- openafs/src/kauth/NTMakefile	Thu Aug  5 12:31:39 2004
***************
*** 125,131 ****
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  $(KASERVER): $(KASERVER_OBJS) $(AFSLIBS) $(KASERVER_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP) 
  
  #build $(OUT)\kadatabase.obj
--- 125,131 ----
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  $(KASERVER): $(KASERVER_OBJS) $(AFSLIBS) $(KASERVER_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP) 
  
  #build $(OUT)\kadatabase.obj
***************
*** 149,155 ****
  	$(OUT)\kas.res
  	
  $(KAS): $(KAS_OBJS) $(AFSLIBS) $(KAUTH_LIBFILE) $(TOKENLIB)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP) 
  
  ########### Misc Exes #######################################################
--- 149,155 ----
  	$(OUT)\kas.res
  	
  $(KAS): $(KAS_OBJS) $(AFSLIBS) $(KAUTH_LIBFILE) $(TOKENLIB)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP) 
  
  ########### Misc Exes #######################################################
***************
*** 162,181 ****
  	$(OUT)\kpasswd.res
  
  $(KPASSWD_EXEFILE): $(KPASSWD_OBJS) $(AFSLIBS) $(KAUTH_LIBFILE) $(TOKENLIB)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  #kpwvalid.exe
  $(OUT)\kpwvalid.exe: $(OUT)\kpwvalid.obj $(AFSLIBS) $(KAUTH_LIBFILE)
! 	$(EXECONLINK) dnsapi.lib
  
  #kdb.exe - Not implemented for NT - because dbm not available on NT
  #kdb.exe: $(OUT)\kdb.obj $(AFSLIBS) $(KAUTH_LIBFILE) 
! #	$(EXECONLINK) dnsapi.lib
  
  #rebuild.exe 
  $(OUT)\rebuild.exe: $(OUT)\rebuild.obj $(OUT)\kautils.obj $(AFSLIBS) 
! 	$(EXECONLINK) dnsapi.lib
  
  ############################################################################
  # Definitions for generating versioninfo resources
--- 162,181 ----
  	$(OUT)\kpasswd.res
  
  $(KPASSWD_EXEFILE): $(KPASSWD_OBJS) $(AFSLIBS) $(KAUTH_LIBFILE) $(TOKENLIB)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  #kpwvalid.exe
  $(OUT)\kpwvalid.exe: $(OUT)\kpwvalid.obj $(AFSLIBS) $(KAUTH_LIBFILE)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  
  #kdb.exe - Not implemented for NT - because dbm not available on NT
  #kdb.exe: $(OUT)\kdb.obj $(AFSLIBS) $(KAUTH_LIBFILE) 
! #	$(EXECONLINK) dnsapi.lib mpr.lib
  
  #rebuild.exe 
  $(OUT)\rebuild.exe: $(OUT)\rebuild.obj $(OUT)\kautils.obj $(AFSLIBS) 
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  
  ############################################################################
  # Definitions for generating versioninfo resources
Index: openafs/src/libafs/MakefileProto.DARWIN.in
diff -c openafs/src/libafs/MakefileProto.DARWIN.in:1.20 openafs/src/libafs/MakefileProto.DARWIN.in:1.21
*** openafs/src/libafs/MakefileProto.DARWIN.in:1.20	Fri Oct 24 02:26:11 2003
--- openafs/src/libafs/MakefileProto.DARWIN.in	Sun Aug  8 19:12:57 2004
***************
*** 4,10 ****
  # 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
! # $Header: /cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.20 2003/10/24 06:26:11 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
--- 4,10 ----
  # 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
! # $Header: /cvs/openafs/src/libafs/MakefileProto.DARWIN.in,v 1.21 2004/08/08 23:12:57 shadow Exp $
  # 
  # MakefileProto for Digital Unix systems
  #
***************
*** 98,104 ****
  
  
  ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
! 	$(LD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS}
  
  ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
! 	$(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS}
--- 98,104 ----
  
  
  ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
! 	$(LD) -r -o ${LIBAFS} ${AFSAOBJS} ${AFSNFSOBJS} -lcc_kext
  
  ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
! 	$(LD) -r -o ${LIBAFSNONFS} ${AFSAOBJS} ${AFSNONFSOBJS} -lcc_kext
Index: openafs/src/libafs/MakefileProto.LINUX.in
diff -c openafs/src/libafs/MakefileProto.LINUX.in:1.39 openafs/src/libafs/MakefileProto.LINUX.in:1.40
*** openafs/src/libafs/MakefileProto.LINUX.in:1.39	Mon Jun  7 15:54:33 2004
--- openafs/src/libafs/MakefileProto.LINUX.in	Wed Jul 28 23:57:05 2004
***************
*** 35,41 ****
  LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
  
  # System specific build commands and flags
! &lt;i386_linux26&gt;
  # All the platform-specific and kernel-related things are provided by
  # the kernel build system.  So we should _not_ use COMMON_KERN_CFLAGS!
  CCFLAGS = -Wno-strict-prototypes
--- 35,41 ----
  LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@
  
  # System specific build commands and flags
! &lt;linux26&gt;
  # All the platform-specific and kernel-related things are provided by
  # the kernel build system.  So we should _not_ use COMMON_KERN_CFLAGS!
  CCFLAGS = -Wno-strict-prototypes
***************
*** 104,112 ****
  
  include Makefile.common
  
! &lt;i386_linux26&gt;
  LINUX_MODULE_EXT=ko
! &lt;all -i386_linux26&gt;
  LINUX_MODULE_EXT=o
  &lt;all&gt;
  
--- 104,112 ----
  
  include Makefile.common
  
! &lt;linux26&gt;
  LINUX_MODULE_EXT=ko
! &lt;all -linux26&gt;
  LINUX_MODULE_EXT=o
  &lt;all&gt;
  
***************
*** 229,235 ****
  libafs.bm: $(LIBAFS_BM)
  	echo BM Build Complete
  
! &lt;i386_linux26&gt;
  ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: libafs.ko
  	cp libafs.ko $@
  
--- 229,235 ----
  libafs.bm: $(LIBAFS_BM)
  	echo BM Build Complete
  
! &lt;linux26&gt;
  ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: libafs.ko
  	cp libafs.ko $@
  
***************
*** 239,245 ****
  	  @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
  	$(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules
          
! &lt;all -i386_linux26&gt;
  ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
  	$(RM) -f $@
  	$(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
--- 239,245 ----
  	  @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
  	$(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules
          
! &lt;all -linux26&gt;
  ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
  	$(RM) -f $@
  	$(LD) -r -o $@ $(AFSAOBJS) $(AFSNONFSOBJS)
Index: openafs/src/libafsauthent/NTMakefile
diff -c openafs/src/libafsauthent/NTMakefile:1.9 openafs/src/libafsauthent/NTMakefile:1.10
*** openafs/src/libafsauthent/NTMakefile:1.9	Fri Mar  5 18:09:34 2004
--- openafs/src/libafsauthent/NTMakefile	Thu Aug  5 12:31:40 2004
***************
*** 141,147 ****
      $(DESTDIR)\lib\lanahelper.lib
  
  $(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS)
! 	$(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib dnsapi.lib
  	$(DLLPREP)
  
  # Definitions for generating versioninfo resources
--- 141,147 ----
      $(DESTDIR)\lib\lanahelper.lib
  
  $(LIBFILE): $(DLLOBJS) $(DLLLIBS) $(RXOBJS)
! 	$(DLLCONLINK) /DEF:afsauthent.def rpcrt4.lib dnsapi.lib mpr.lib
  	$(DLLPREP)
  
  # Definitions for generating versioninfo resources
Index: openafs/src/libafsauthent/afsauthent.def
diff -c openafs/src/libafsauthent/afsauthent.def:1.2 openafs/src/libafsauthent/afsauthent.def:1.3
*** openafs/src/libafsauthent/afsauthent.def:1.2	Wed Nov 21 01:44:39 2001
--- openafs/src/libafsauthent/afsauthent.def	Tue Aug  3 13:27:59 2004
***************
*** 78,85 ****
  	pioctl						@77
  	rx_Init						@78
  	ka_UserAuthenticateGeneral2			@79
! 
! 
  
  
  	DISK_function_names				@83 DATA
--- 78,85 ----
  	pioctl						@77
  	rx_Init						@78
  	ka_UserAuthenticateGeneral2			@79
!     pr_CreateUser                   @80
!     pr_SNameToId                    @81
  
  
  	DISK_function_names				@83 DATA
Index: openafs/src/lwp/Makefile.in
diff -c openafs/src/lwp/Makefile.in:1.27 openafs/src/lwp/Makefile.in:1.29
*** openafs/src/lwp/Makefile.in:1.27	Thu Jul  8 01:19:47 2004
--- openafs/src/lwp/Makefile.in	Sun Aug  8 19:49:52 2004
***************
*** 27,36 ****
  	$(AR) crv $@ ${LIBOBJS}
  	$(RANLIB) $@
  
  process.s:
  	echo Nothing to be done for process.s
- 	# This is required so sgi_64+ does not try to build this file.
  
  process.o	: process.s process.i386.s process.c
  	@case "$(SYS_NAME)" in \
  	pmax_he1) \
--- 27,37 ----
  	$(AR) crv $@ ${LIBOBJS}
  	$(RANLIB) $@
  
+ # This is required so sgi_64+ does not try to build this file.
  process.s:
  	echo Nothing to be done for process.s
  
+ # Making process.o for $(SYS_NAME)
  process.o	: process.s process.i386.s process.c
  	@case "$(SYS_NAME)" in \
  	pmax_he1) \
***************
*** 50,56 ****
  	*_darwin* ) \
  		$(CC) ${LWP_DBG} ${LWP_OPTMZ} -c ${XCFLAGS} -I${TOP_INCDIR} ${srcdir}/process.s;; \
  	i386_*bsd*) \
- 		echo foo ; \
  		cp ${srcdir}/process.i386.s process.S ; \
  		${CCOBJ} -E -I${srcdir} -I${TOP_INCDIR} process.S &gt;process.ss ; \
  		${AS} process.ss -o process.o ;  \
--- 51,56 ----
Index: openafs/src/lwp/lwp.c
diff -c openafs/src/lwp/lwp.c:1.26 openafs/src/lwp/lwp.c:1.27
*** openafs/src/lwp/lwp.c:1.26	Thu Jul  8 01:11:34 2004
--- openafs/src/lwp/lwp.c	Wed Jul 28 16:59:58 2004
***************
*** 17,23 ****
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /cvs/openafs/src/lwp/lwp.c,v 1.26 2004/07/08 05:11:34 shadow Exp $");
  
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
--- 17,23 ----
  #include &lt;afsconfig.h&gt;
  #include &lt;afs/param.h&gt;
  
! RCSID("$Header: /cvs/openafs/src/lwp/lwp.c,v 1.27 2004/07/28 20:59:58 shadow Exp $");
  
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
***************
*** 237,243 ****
  {
      register PROCESS tp;
      (tp = lwp_cpptr)-&gt;status = QWAITING;
!     move(tp, &amp;runnable[tp-&gt;priority], qwaiting);
      Set_LWP_RC();
      return LWP_SUCCESS;
  }
--- 237,243 ----
  {
      register PROCESS tp;
      (tp = lwp_cpptr)-&gt;status = QWAITING;
!     move(tp, &amp;runnable[tp-&gt;priority], &amp;qwaiting);
      Set_LWP_RC();
      return LWP_SUCCESS;
  }
***************
*** 248,254 ****
  {
      if (pid-&gt;status == QWAITING) {
  	pid-&gt;status = READY;
! 	move(pid, qwaiting, &amp;runnable[pid-&gt;priority]);
  	return LWP_SUCCESS;
      } else
  	return LWP_ENOWAIT;
--- 248,254 ----
  {
      if (pid-&gt;status == QWAITING) {
  	pid-&gt;status = READY;
! 	move(pid, &amp;qwaiting, &amp;runnable[pid-&gt;priority]);
  	return LWP_SUCCESS;
      } else
  	return LWP_ENOWAIT;
Index: openafs/src/lwp/lwp_elf.h
diff -c openafs/src/lwp/lwp_elf.h:1.2 openafs/src/lwp/lwp_elf.h:1.3
*** openafs/src/lwp/lwp_elf.h:1.2	Thu Jun 24 13:38:32 2004
--- openafs/src/lwp/lwp_elf.h	Tue Aug  3 10:45:49 2004
***************
*** 32,42 ****
   */
  
  /*
!  * For common usage of elf platforms
   *
!  * $Id: lwp_elf.h,v 1.2 2004/06/24 17:38:32 shadow Exp $
   */
- #include &lt;afs/param.h&gt;
  
  #ifndef _C_LABEL
  #if !defined(SYSV) &amp;&amp; !defined(__ELF__) &amp;&amp; !defined(AFS_SUN5_ENV)
--- 32,42 ----
   */
  
  /*
!  * This file is mis-named. It is used by both a.out and elf platforms.
!  * It either adds the leading underscore or not as needed.
   *
!  * $Id: lwp_elf.h,v 1.3 2004/08/03 14:45:49 rees Exp $
   */
  
  #ifndef _C_LABEL
  #if !defined(SYSV) &amp;&amp; !defined(__ELF__) &amp;&amp; !defined(AFS_SUN5_ENV)
Index: openafs/src/lwp/process.fbsd.s
diff -c openafs/src/lwp/process.fbsd.s:1.1 openafs/src/lwp/process.fbsd.s:removed
*** openafs/src/lwp/process.fbsd.s:1.1	Sat Apr 14 13:28:23 2001
--- openafs/src/lwp/process.fbsd.s	Tue Aug 10 00:30:14 2004
***************
*** 1,90 ****
- /*
-  * 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
-  */
- 
- #define	IGNORE_STDS_H	1
- /* Sun 386i... I hope this does the right thing!!!
-  * 
-  * Written by Derek Atkins &lt;warlord@MIT.EDU&gt;
-  * (debugging help by Chris Provenzano &lt;proven@mit.edu&gt;)
-  * 11/1991
-  *
-  * "ojala que es correcto!"
-  */
- 	.file "process.s"
- 
- 	.data
- 
- 	.text
- 
- /*
-  * struct savearea {
-  * 	char	*topstack;
-  * }
-  */
- 
- 	.set 	topstack,0
- 
- /*
-  * savecontext(f, area1, newsp)
-  *	int (*f)(); struct savearea *area1; char *newsp;
-  */
- 
- /* offsets, to make my life easier! */
- 	.set	f,8
- 	.set	area1,12
- 	.set	newsp,16
- 
- 
- .globl	PRE_Block
- .globl	savecontext
- 
- savecontext:
- 	pushl	%ebp			/* New Frame! */
- 	movl	%esp,%ebp
- 	pusha				/* Push all registers */
- 	movl	$1,PRE_Block		/* Pre-emption code */
- 	movl	area1(%ebp),%eax	/* eax = base of savearea */
- 	movl	%esp,(%eax)		/* area-&gt;topstack = esp */
- 	movl	newsp(%ebp),%eax	/* get new sp into eax */
- 	cmpl	$0,%eax
- 	je	L1			/* if new sp is 0 then dont change esp */
- 	movl	%eax,%esp		/* go ahead.  make my day! */
- L1:
- 	jmp	*f(%ebp)			/* ebx = &amp;f */
- 
- /* Shouldnt be here....*/
- 
- 	call	abort
- 
- /*
-  * returnto(area2)
-  *	struct savearea *area2;
-  */
- 
- /* stack offset */
- 	.set	area2,8
- 
- .globl	returnto
- 
- returnto:
- 	pushl	%ebp
- 	movl	%esp, %ebp		/* New frame, to get correct pointer */
- 	movl	area2(%ebp),%eax	/* eax = area2 */
- 	movl	(%eax),%esp		/* restore esp */
- 	popa 
- 	movl	$0,PRE_Block		/* clear it up... */
- 	popl	%ebp
- 	ret
- 
- /* I see, said the blind man, as he picked up his hammer and saw! */
- 	pushl	$1234
- 	call	abort
- 
- 
- 
--- 0 ----
Index: openafs/src/lwp/process.i386.s
diff -c openafs/src/lwp/process.i386.s:1.4 openafs/src/lwp/process.i386.s:1.5
*** openafs/src/lwp/process.i386.s:1.4	Fri Oct 10 09:12:05 2003
--- openafs/src/lwp/process.i386.s	Tue Aug  3 10:45:49 2004
***************
*** 16,21 ****
--- 16,23 ----
   * "ojala que es correcto!"
   */
  
+ #define IGNORE_STDS_H  1
+ #include &lt;afs/param.h&gt;
  #include &lt;lwp_elf.h&gt;
  
  	.file "process.s"
Index: openafs/src/ptserver/NTMakefile
diff -c openafs/src/ptserver/NTMakefile:1.8 openafs/src/ptserver/NTMakefile:1.9
*** openafs/src/ptserver/NTMakefile:1.8	Sat May 29 19:48:13 2004
--- openafs/src/ptserver/NTMakefile	Thu Aug  5 12:31:40 2004
***************
*** 73,79 ****
  !ENDIF
  
  $(PTSERVER): $(PTSERVER_EXEOBJS) $(RXKADOBJS) $(PTSERVER_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP) 
  
  
--- 73,79 ----
  !ENDIF
  
  $(PTSERVER): $(PTSERVER_EXEOBJS) $(RXKADOBJS) $(PTSERVER_EXELIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP) 
  
  
***************
*** 104,110 ****
  	$(DESTDIR)\lib\cm_dns.obj
  
  $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) 
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP) 
  
  
--- 104,110 ----
  	$(DESTDIR)\lib\cm_dns.obj
  
  $(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS) 
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP) 
  
  
***************
*** 180,195 ****
  TEST_LIBS = $(PTS_EXELIBS)
  
  $(OUT)\readgroup.exe: $(OUT)\readgroup.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib
  
  $(OUT)\readpwd.exe: $(OUT)\readpwd.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib
  
  $(OUT)\testpt.exe: $(OUT)\testpt.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib
  
  $(OUT)\db_verify.exe: $(OUT)\db_verify.obj $(OUT)\pterror.obj $(OUT)\display.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib
  
  mkdir:
  	
--- 180,195 ----
  TEST_LIBS = $(PTS_EXELIBS)
  
  $(OUT)\readgroup.exe: $(OUT)\readgroup.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  
  $(OUT)\readpwd.exe: $(OUT)\readpwd.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib 
  
  $(OUT)\testpt.exe: $(OUT)\testpt.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib 
  
  $(OUT)\db_verify.exe: $(OUT)\db_verify.obj $(OUT)\pterror.obj $(OUT)\display.obj $(LIBFILE) $(TEST_LIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib 
  
  mkdir:
  	
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.56 openafs/src/rx/rx.c:1.58
*** openafs/src/rx/rx.c:1.56	Wed Jun  2 02:08:01 2004
--- openafs/src/rx/rx.c	Wed Aug  4 15:41:53 2004
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.56 2004/06/02 06:08:01 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58 2004/08/04 19:41:53 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 370,377 ****
  #define UNLOCK_RX_INIT
  #endif
  
! int
! rx_Init(u_int port)
  {
  #ifdef KERNEL
      osi_timeval_t tv;
--- 370,377 ----
  #define UNLOCK_RX_INIT
  #endif
  
! int 
! rx_InitHost(u_int host, u_int port)
  {
  #ifdef KERNEL
      osi_timeval_t tv;
***************
*** 407,413 ****
      /* Allocate and initialize a socket for client and perhaps server
       * connections. */
  
!     rx_socket = rxi_GetUDPSocket((u_short) port);
      if (rx_socket == OSI_NULLSOCKET) {
  	UNLOCK_RX_INIT return RX_ADDRINUSE;
      }
--- 407,413 ----
      /* Allocate and initialize a socket for client and perhaps server
       * connections. */
  
!     rx_socket = rxi_GetHostUDPSocket(host, (u_short) port);
      if (rx_socket == OSI_NULLSOCKET) {
  	UNLOCK_RX_INIT return RX_ADDRINUSE;
      }
***************
*** 534,539 ****
--- 534,544 ----
      UNLOCK_RX_INIT return tmp_status;
  }
  
+ int rx_Init(u_int port) 
+ {
+     return rx_InitHost(htonl(INADDR_ANY), port);
+ }
+ 
  /* called with unincremented nRequestsRunning to see if it is OK to start
   * a new thread in this service.  Could be "no" for two reasons: over the
   * max quota, or would prevent others from reaching their min quota.
***************
*** 1247,1253 ****
  	    if (socket == OSI_NULLSOCKET) {
  		/* If we don't already have a socket (from another
  		 * service on same port) get a new one */
! 		socket = rxi_GetUDPSocket(port);
  		if (socket == OSI_NULLSOCKET) {
  		    AFS_RXGUNLOCK();
  		    USERPRI;
--- 1252,1258 ----
  	    if (socket == OSI_NULLSOCKET) {
  		/* If we don't already have a socket (from another
  		 * service on same port) get a new one */
! 		socket = rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
  		if (socket == OSI_NULLSOCKET) {
  		    AFS_RXGUNLOCK();
  		    USERPRI;
***************
*** 2304,2310 ****
  		break;
  	    if (type == RX_CLIENT_CONNECTION &amp;&amp; pp-&gt;port == port)
  		break;
! 	    if (type == RX_CLIENT_CONNECTION &amp;&amp; (conn-&gt;epoch &amp; 0x80000000))
  		break;
  	}
  	if (!flag) {
--- 2309,2316 ----
  		break;
  	    if (type == RX_CLIENT_CONNECTION &amp;&amp; pp-&gt;port == port)
  		break;
! 	    /* So what happens when it's a callback connection? */
! 	    if (/*type == RX_CLIENT_CONNECTION &amp;&amp;*/ (conn-&gt;epoch &amp; 0x80000000))
  		break;
  	}
  	if (!flag) {
Index: openafs/src/rx/rx.h
diff -c openafs/src/rx/rx.h:1.21 openafs/src/rx/rx.h:1.22
*** openafs/src/rx/rx.h:1.21	Tue Jul 15 19:16:09 2003
--- openafs/src/rx/rx.h	Wed Jul 28 18:33:54 2004
***************
*** 96,101 ****
--- 96,102 ----
  #ifndef KERNEL
  typedef void (*rx_destructor_t) (void *);
  int rx_KeyCreate(rx_destructor_t);
+ osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
  osi_socket rxi_GetUDPSocket(u_short port);
  #endif /* KERNEL */
  
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.41 openafs/src/rx/rx_kcommon.c:1.44
*** openafs/src/rx/rx_kcommon.c:1.41	Wed Mar 10 18:01:54 2004
--- openafs/src/rx/rx_kcommon.c	Sun Aug  8 15:17:05 2004
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.41 2004/03/10 23:01:54 rees Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44 2004/08/08 19:17:05 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 30,35 ****
--- 30,36 ----
  int (*rxk_GetPacketProc) (char **ahandle, int asize);
  #endif
  
+ struct osi_socket *rxk_NewSocketHost(afs_uint32 ahost, short aport);
  extern struct interfaceAddr afs_cb_interface;
  
  rxk_ports_t rxk_ports;
***************
*** 102,117 ****
  }
  
  osi_socket
! rxi_GetUDPSocket(u_short port)
  {
      struct osi_socket *sockp;
!     sockp = (struct osi_socket *)rxk_NewSocket(port);
      if (sockp == (struct osi_socket *)0)
  	return OSI_NULLSOCKET;
      rxk_AddPort(port, (char *)sockp);
      return (osi_socket) sockp;
  }
  
  
  void
  osi_Panic(msg, a1, a2, a3)
--- 103,123 ----
  }
  
  osi_socket
! rxi_GetHostUDPSocket(u_int host, u_short port)
  {
      struct osi_socket *sockp;
!     sockp = (struct osi_socket *)rxk_NewSocketHost(host, port);
      if (sockp == (struct osi_socket *)0)
  	return OSI_NULLSOCKET;
      rxk_AddPort(port, (char *)sockp);
      return (osi_socket) sockp;
  }
  
+ osi_socket
+ rxi_GetUDPSocket(u_short port)
+ {
+     return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
+ }
  
  void
  osi_Panic(msg, a1, a2, a3)
***************
*** 756,762 ****
   * in network byte order.
   */
  struct osi_socket *
! rxk_NewSocket(short aport)
  {
      register afs_int32 code;
      struct socket *newSocket;
--- 762,768 ----
   * in network byte order.
   */
  struct osi_socket *
! rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      register afs_int32 code;
      struct socket *newSocket;
***************
*** 816,822 ****
      memset(&amp;myaddr, 0, sizeof myaddr);
      myaddr.sin_family = AF_INET;
      myaddr.sin_port = aport;
!     myaddr.sin_addr.s_addr = 0;
  #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
      myaddr.sin_len = sizeof(myaddr);
  #endif
--- 822,828 ----
      memset(&amp;myaddr, 0, sizeof myaddr);
      myaddr.sin_family = AF_INET;
      myaddr.sin_port = aport;
!     myaddr.sin_addr.s_addr = ahost;
  #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
      myaddr.sin_len = sizeof(myaddr);
  #endif
***************
*** 908,913 ****
--- 914,924 ----
      return (struct osi_socket *)0;
  }
  
+ struct osi_socket *
+ rxk_NewSocket(short aport)
+ {
+     return rxk_NewSocketHost(0, aport);
+ }
  
  /* free socket allocated by rxk_NewSocket */
  int
Index: openafs/src/rx/rx_prototypes.h
diff -c openafs/src/rx/rx_prototypes.h:1.13 openafs/src/rx/rx_prototypes.h:1.14
*** openafs/src/rx/rx_prototypes.h:1.13	Wed Mar 10 18:01:54 2004
--- openafs/src/rx/rx_prototypes.h	Wed Jul 28 18:33:54 2004
***************
*** 313,318 ****
--- 313,319 ----
  extern int rxk_DelPort(u_short aport);
  extern void rxk_shutdownPorts(void);
  extern osi_socket rxi_GetUDPSocket(u_short port);
+ extern osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
  extern void osi_Panic();
  extern int osi_utoa(char *buf, size_t len, unsigned long val);
  extern void rxi_InitPeerParams(register struct rx_peer *pp);
Index: openafs/src/rx/rx_user.c
diff -c openafs/src/rx/rx_user.c:1.16 openafs/src/rx/rx_user.c:1.18
*** openafs/src/rx/rx_user.c:1.16	Fri Mar  5 21:42:53 2004
--- openafs/src/rx/rx_user.c	Fri Aug  6 16:04:07 2004
***************
*** 13,19 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_user.c,v 1.16 2004/03/06 02:42:53 rees Exp $");
  
  # include &lt;sys/types.h&gt;
  # include &lt;errno.h&gt;
--- 13,19 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_user.c,v 1.18 2004/08/06 20:04:07 shadow Exp $");
  
  # include &lt;sys/types.h&gt;
  # include &lt;errno.h&gt;
***************
*** 94,100 ****
   * failure. Port must be in network byte order.	
   */
  osi_socket
! rxi_GetUDPSocket(u_short port)
  {
      int binds, code = 0;
      osi_socket socketFd = OSI_NULLSOCKET;
--- 94,100 ----
   * failure. Port must be in network byte order.	
   */
  osi_socket
! rxi_GetHostUDPSocket(u_int ahost, u_short port)
  {
      int binds, code = 0;
      osi_socket socketFd = OSI_NULLSOCKET;
***************
*** 121,127 ****
  	goto error;
      }
  
!     taddr.sin_addr.s_addr = INADDR_ANY;
      taddr.sin_family = AF_INET;
      taddr.sin_port = (u_short) port;
  #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
--- 121,127 ----
  	goto error;
      }
  
!     taddr.sin_addr.s_addr = ahost;
      taddr.sin_family = AF_INET;
      taddr.sin_port = (u_short) port;
  #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
***************
*** 201,206 ****
--- 201,212 ----
      return OSI_NULLSOCKET;
  }
  
+ osi_socket
+ rxi_GetUDPSocket(u_short port)
+ {
+     return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
+ }
+ 
  void
  osi_Panic(char *msg, int a1, int a2, int a3)
  {
Index: openafs/src/rx/DUX/rx_knet.c
diff -c openafs/src/rx/DUX/rx_knet.c:1.10 openafs/src/rx/DUX/rx_knet.c:1.11
*** openafs/src/rx/DUX/rx_knet.c:1.10	Tue Jul 15 19:16:15 2003
--- openafs/src/rx/DUX/rx_knet.c	Sun Aug  8 20:58:50 2004
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/DUX/rx_knet.c,v 1.10 2003/07/15 23:16:15 shadow Exp $");
  
  #ifdef AFS_DUX40_ENV
  #include "rx/rx_kcommon.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/DUX/rx_knet.c,v 1.11 2004/08/09 00:58:50 shadow Exp $");
  
  #ifdef AFS_DUX40_ENV
  #include "rx/rx_kcommon.h"
***************
*** 22,32 ****
  static void rxk_fasttimo(void);
  
  /* start intercepting basic calls */
  rxk_init()
  {
      register struct protosw *tpro, *last;
      if (rxk_initDone)
! 	return 0;
  
      last = inetdomain.dom_protoswNPROTOSW;
      for (tpro = inetdomain.dom_protosw; tpro &lt; last; tpro++)
--- 22,33 ----
  static void rxk_fasttimo(void);
  
  /* start intercepting basic calls */
+ void
  rxk_init()
  {
      register struct protosw *tpro, *last;
      if (rxk_initDone)
! 	return;
  
      last = inetdomain.dom_protoswNPROTOSW;
      for (tpro = inetdomain.dom_protosw; tpro &lt; last; tpro++)
***************
*** 42,48 ****
  	     * until we have something to do
  	     */
  	    rxk_initDone = 1;
! 	    return 0;
  	}
      osi_Panic("inet:no udp");
  }
--- 43,49 ----
  	     * until we have something to do
  	     */
  	    rxk_initDone = 1;
! 	    return;
  	}
      osi_Panic("inet:no udp");
  }
Index: openafs/src/rx/LINUX/rx_knet.c
diff -c openafs/src/rx/LINUX/rx_knet.c:1.20 openafs/src/rx/LINUX/rx_knet.c:1.23
*** openafs/src/rx/LINUX/rx_knet.c:1.20	Mon Jun 21 16:06:26 2004
--- openafs/src/rx/LINUX/rx_knet.c	Wed Jul 28 22:46:48 2004
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.20 2004/06/21 20:06:26 shadow Exp $");
  
  #include &lt;linux/version.h&gt;
  #ifdef AFS_LINUX22_ENV
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23 2004/07/29 02:46:48 shadow Exp $");
  
  #include &lt;linux/version.h&gt;
  #ifdef AFS_LINUX22_ENV
***************
*** 30,36 ****
   * open and bind RX socket
   */
  struct osi_socket *
! rxk_NewSocket(short aport)
  {
      struct socket *sockp;
      struct sockaddr_in myaddr;
--- 30,36 ----
   * open and bind RX socket
   */
  struct osi_socket *
! rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      struct socket *sockp;
      struct sockaddr_in myaddr;
***************
*** 47,53 ****
  
      /* Bind socket */
      myaddr.sin_family = AF_INET;
!     myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
      myaddr.sin_port = aport;
      code =
  	sockp-&gt;ops-&gt;bind(sockp, (struct sockaddr *)&amp;myaddr, sizeof(myaddr));
--- 47,53 ----
  
      /* Bind socket */
      myaddr.sin_family = AF_INET;
!     myaddr.sin_addr.s_addr = ahost;
      myaddr.sin_port = aport;
      code =
  	sockp-&gt;ops-&gt;bind(sockp, (struct sockaddr *)&amp;myaddr, sizeof(myaddr));
***************
*** 64,69 ****
--- 64,74 ----
      return (struct osi_socket *)sockp;
  }
  
+ struct osi_socket *
+ rxk_NewSocket(short aport)
+ {
+     return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
+ }
  
  /* free socket allocated by osi_NetSocket */
  int
Index: openafs/src/rx/SOLARIS/rx_knet.c
diff -c openafs/src/rx/SOLARIS/rx_knet.c:1.18 openafs/src/rx/SOLARIS/rx_knet.c:1.19
*** openafs/src/rx/SOLARIS/rx_knet.c:1.18	Thu Jul  8 01:23:53 2004
--- openafs/src/rx/SOLARIS/rx_knet.c	Wed Jul 28 18:34:13 2004
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.18 2004/07/08 05:23:53 shadow Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "rx/rx_kcommon.h"
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/SOLARIS/rx_knet.c,v 1.19 2004/07/28 22:34:13 shadow Exp $");
  
  #ifdef AFS_SUN5_ENV
  #include "rx/rx_kcommon.h"
***************
*** 222,228 ****
  
  /* Allocate a new socket at specified port in network byte order. */
  struct osi_socket *
! rxk_NewSocket(short aport)
  {
      vnode_t *accessvp;
      struct sonode *so;
--- 222,228 ----
  
  /* Allocate a new socket at specified port in network byte order. */
  struct osi_socket *
! rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      vnode_t *accessvp;
      struct sonode *so;
***************
*** 296,302 ****
  
      addr.sin_family = AF_INET;
      addr.sin_port = aport;
!     addr.sin_addr.s_addr = INADDR_ANY;
      error = sockfs_sobind(so, (struct sockaddr *)&amp;addr, sizeof(addr), 0, 0);
      if (error != 0) {
  	return NULL;
--- 296,303 ----
  
      addr.sin_family = AF_INET;
      addr.sin_port = aport;
!     addr.sin_addr.s_addr = ahost; /* I wonder what the odds are on
! 				     needing to unbyteswap this */
      error = sockfs_sobind(so, (struct sockaddr *)&amp;addr, sizeof(addr), 0, 0);
      if (error != 0) {
  	return NULL;
***************
*** 317,322 ****
--- 318,329 ----
      return (struct osi_socket *)so;
  }
  
+ struct osi_socket *
+ rxk_NewSocket(short aport)
+ {
+     return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
+ }
+ 
  int
  osi_FreeSocket(register struct osi_socket *asocket)
  {
***************
*** 503,509 ****
  
  /* Allocate a new socket at specified port in network byte order. */
  struct osi_socket *
! rxk_NewSocket(short aport)
  {
      TIUSER *udp_tiptr;
      struct t_bind *reqp, *rspp;
--- 510,516 ----
  
  /* Allocate a new socket at specified port in network byte order. */
  struct osi_socket *
! rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      TIUSER *udp_tiptr;
      struct t_bind *reqp, *rspp;
***************
*** 534,540 ****
      myaddrp = (struct sockaddr_in *)reqp-&gt;addr.buf;
      myaddrp-&gt;sin_family = AF_INET;
      myaddrp-&gt;sin_port = aport;
!     myaddrp-&gt;sin_addr.s_addr = INADDR_ANY;	/* XXX Was 0 XXX */
  
      code = t_kbind(udp_tiptr, reqp, rspp);
      if (code) {
--- 541,547 ----
      myaddrp = (struct sockaddr_in *)reqp-&gt;addr.buf;
      myaddrp-&gt;sin_family = AF_INET;
      myaddrp-&gt;sin_port = aport;
!     myaddrp-&gt;sin_addr.s_addr = ahost;	/* byteswap? */
  
      code = t_kbind(udp_tiptr, reqp, rspp);
      if (code) {
***************
*** 564,569 ****
--- 571,581 ----
      return (struct osi_socket *)udp_tiptr;
  }
  
+ struct osi_socket *
+ rxk_NewSocket(short aport)
+ {
+     return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
+ }
  
  int
  osi_FreeSocket(register struct osi_socket *asocket)
Index: openafs/src/rx/UKERNEL/rx_knet.c
diff -c openafs/src/rx/UKERNEL/rx_knet.c:1.9 openafs/src/rx/UKERNEL/rx_knet.c:1.10
*** openafs/src/rx/UKERNEL/rx_knet.c:1.9	Sun Apr 18 02:10:35 2004
--- openafs/src/rx/UKERNEL/rx_knet.c	Wed Jul 28 18:34:14 2004
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/UKERNEL/rx_knet.c,v 1.9 2004/04/18 06:10:35 kolya Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/UKERNEL/rx_knet.c,v 1.10 2004/07/28 22:34:14 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 170,176 ****
   * we start the receiver threads.
   */
  struct osi_socket *
! rxk_NewSocket(short aport)
  {
      struct usr_socket *usockp;
  
--- 170,176 ----
   * we start the receiver threads.
   */
  struct osi_socket *
! rxk_NewSocketHost(afs_uint32 ahost, short aport)
  {
      struct usr_socket *usockp;
  
***************
*** 182,187 ****
--- 182,193 ----
      return (struct osi_socket *)usockp;
  }
  
+ struct osi_socket *
+ rxk_NewSocket(short aport)
+ {
+     return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
+ }
+ 
  /*
   * This routine is called from rxk_Listener. By this time rx_port
   * is set to 7001 and rx_socket points to the socket buffer
Index: openafs/src/rxgk/Makefile.am
diff -c /dev/null openafs/src/rxgk/Makefile.am:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/Makefile.am	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,80 ----
+ #
+ # $Id: Makefile.am,v 1.1 2004/08/08 19:21:33 shadow Exp $
+ #
+ 
+ include $(top_srcdir)/Makefile.am.common
+ 
+ noinst_LTLIBRARIES = librxgkclient.la librxgkserver.la
+ 
+ noinst_PROGRAMS = test_client test_server
+ 
+ INCLUDES += -I. 			\
+ 	-I$(srcdir)			\
+ 	-I../include			\
+ 	-I$(srcdir)/../include		\
+ 	-I.. -I$(srcdir)/..		\
+ 	$(INC_roken) 			\
+ 	$(KRB5_INC_FLAGS)
+ 
+ librxgkclient_la_SOURCES =		\
+ 	rxgk_locl.h			\
+ 	rxgk_proto.h			\
+ 	rxgk_clnt.c			\
+ 	rxgk_info.c			\
+ 	rxgk_crpc.c			\
+ 	rxgk_crkrb.c			\
+ 	rxgk_common.c			\
+ 	rxgk_proto.ydr.c		\
+ 	rxgk_proto.cs.c
+ 
+ librxgkserver_la_SOURCES =		\
+ 	rxgk_locl.h			\
+ 	rxgk_proto.h			\
+ 	rxgk_serv.c			\
+ 	rxgk_info.c			\
+ 	rxgk_srpc.c			\
+ 	rxgk_crkrb.c			\
+ 	rxgk_common.c			\
+ 	rxgk_proto.ydr.c		\
+ 	rxgk_proto.ss.c
+ 
+ LIBYDR = 				\
+ 	rxgk_proto.cs.c 		\
+ 	rxgk_proto.ss.c 		\
+ 	rxgk_proto.ydr.c		\
+ 	rxgk_proto.h			\
+ 	rxgk_proto.cs.h			\
+ 	rxgk_proto.ss.h
+ 
+ LIBTYDR = 				\
+ 	test.cs.h			\
+ 	test.ss.h			\
+ 	test.ss.c			\
+ 	test.cs.c			\
+ 	test.ydr.c			\
+ 	test.h
+ 
+ common_LDADD = \
+ 	../rx/librx.la \
+ 	-L../lwp -llwp $(PLWP_LIB_FLAGS) \
+ 	$(KRB5_LIB_FLAGS)
+ 
+ test_client_SOURCES = test_client.c test.cs.c
+ test_server_SOURCES = test_server.c test.ss.c
+ 
+ test_client_LDADD = librxgkclient.la $(common_LDADD)
+ test_server_LDADD = librxgkserver.la $(common_LDADD)
+ 
+ $(librxgkclient_la_OBJECTS) $(librxgkserver_la_OBJECTS): $(LIBYDR)
+ 
+ $(test_server_OBJECTS) $(test_client_OBJECTS): $(LIBTYDR)
+ 
+ $(LIBYDR): rxgk_proto.xg
+ 	../ydr/ydr $(srcdir)/rxgk_proto.xg
+ 
+ $(LIBTYDR): test.xg
+ 	../ydr/ydr $(srcdir)/test.xg
+ 
+ CLEANFILES = $(LIBYDR) $(LIBTYDR)
+ 
+ LDADD = $(KRB5_LIB_FLAGS)
Index: openafs/src/rxgk/Makefile.in
diff -c /dev/null openafs/src/rxgk/Makefile.in:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/Makefile.in	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,933 ----
+ # Makefile.in generated by automake 1.8.2 from Makefile.am.
+ # @configure_input@
+ 
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ # 2003, 2004  Free Software Foundation, Inc.
+ # This Makefile.in is free software; the Free Software Foundation
+ # gives unlimited permission to copy and/or distribute it,
+ # with or without modifications, as long as this notice is preserved.
+ 
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ # PARTICULAR PURPOSE.
+ 
+ @SET_MAKE@
+ 
+ #
+ # $Id: Makefile.in,v 1.1 2004/08/08 19:21:33 shadow Exp $
+ #
+ 
+ # $Id: Makefile.in,v 1.1 2004/08/08 19:21:33 shadow Exp $
+ 
+ # $Id: Makefile.in,v 1.1 2004/08/08 19:21:33 shadow Exp $
+ 
+ 
+ SOURCES = $(librxgkclient_la_SOURCES) $(librxgkserver_la_SOURCES) $(test_client_SOURCES) $(test_server_SOURCES)
+ 
+ srcdir = @srcdir@
+ top_srcdir = @top_srcdir@
+ VPATH = @srcdir@
+ pkgdatadir = $(datadir)/@PACKAGE@
+ pkglibdir = $(libdir)/@PACKAGE@
+ pkgincludedir = $(includedir)/@PACKAGE@
+ top_builddir = ..
+ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" &amp;&amp; cd
+ INSTALL = @INSTALL@
+ install_sh_DATA = $(install_sh) -c -m 644
+ install_sh_PROGRAM = $(install_sh) -c
+ install_sh_SCRIPT = $(install_sh) -c
+ INSTALL_HEADER = $(INSTALL_DATA)
+ transform = $(program_transform_name)
+ NORMAL_INSTALL = :
+ PRE_INSTALL = :
+ POST_INSTALL = :
+ NORMAL_UNINSTALL = :
+ PRE_UNINSTALL = :
+ POST_UNINSTALL = :
+ host_triplet = @host@
+ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ 	$(top_srcdir)/Makefile.am.common \
+ 	$(top_srcdir)/cf/Makefile.am.common
+ noinst_PROGRAMS = test_client$(EXEEXT) test_server$(EXEEXT)
+ subdir = rxgk
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+ am__aclocal_m4_deps = $(top_srcdir)/cf/__extentions__.m4 \
+ 	$(top_srcdir)/cf/arla-canonical.m4 \
+ 	$(top_srcdir)/cf/arla-openssl-compat.m4 \
+ 	$(top_srcdir)/cf/broken-getaddrinfo.m4 \
+ 	$(top_srcdir)/cf/broken-getnameinfo.m4 \
+ 	$(top_srcdir)/cf/broken-glob.m4 \
+ 	$(top_srcdir)/cf/broken-realloc.m4 \
+ 	$(top_srcdir)/cf/broken-snprintf.m4 $(top_srcdir)/cf/broken.m4 \
+ 	$(top_srcdir)/cf/broken2.m4 \
+ 	$(top_srcdir)/cf/bsd-func-lockmgr.m4 \
+ 	$(top_srcdir)/cf/bsd-func-lockstatus.m4 \
+ 	$(top_srcdir)/cf/bsd-func-selrecord.m4 \
+ 	$(top_srcdir)/cf/bsd-func-suser.m4 \
+ 	$(top_srcdir)/cf/bsd-func-vfs-getnewfsid.m4 \
+ 	$(top_srcdir)/cf/bsd-header-vnode-if-h.m4 \
+ 	$(top_srcdir)/cf/bsd-uvm-only.m4 \
+ 	$(top_srcdir)/cf/bsd-vfs-busy.m4 \
+ 	$(top_srcdir)/cf/bsd-vfs-object-create.m4 \
+ 	$(top_srcdir)/cf/bsd-vget.m4 $(top_srcdir)/cf/bsd-vop-lock.m4 \
+ 	$(top_srcdir)/cf/c-attribute.m4 $(top_srcdir)/cf/c-function.m4 \
+ 	$(top_srcdir)/cf/check-declaration.m4 \
+ 	$(top_srcdir)/cf/check-dirsiz.m4 \
+ 	$(top_srcdir)/cf/check-glibc.m4 $(top_srcdir)/cf/check-kafs.m4 \
+ 	$(top_srcdir)/cf/check-kerberos.m4 \
+ 	$(top_srcdir)/cf/check-kernel-func.m4 \
+ 	$(top_srcdir)/cf/check-kernel-funcs.m4 \
+ 	$(top_srcdir)/cf/check-kernel-var.m4 \
+ 	$(top_srcdir)/cf/check-kernel-vop-t.m4 \
+ 	$(top_srcdir)/cf/check-kernel.m4 $(top_srcdir)/cf/check-lfs.m4 \
+ 	$(top_srcdir)/cf/check-man.m4 \
+ 	$(top_srcdir)/cf/check-netinet-ip-and-tcp.m4 \
+ 	$(top_srcdir)/cf/check-roken.m4 $(top_srcdir)/cf/check-sl.m4 \
+ 	$(top_srcdir)/cf/check-var.m4 $(top_srcdir)/cf/check-x.m4 \
+ 	$(top_srcdir)/cf/db.m4 $(top_srcdir)/cf/elf-object-format.m4 \
+ 	$(top_srcdir)/cf/find-func-no-libs.m4 \
+ 	$(top_srcdir)/cf/find-func-no-libs2.m4 \
+ 	$(top_srcdir)/cf/find-func.m4 \
+ 	$(top_srcdir)/cf/find-if-not-broken.m4 \
+ 	$(top_srcdir)/cf/func-ntohl.m4 \
+ 	$(top_srcdir)/cf/have-kernel-struct-field.m4 \
+ 	$(top_srcdir)/cf/have-linux-kernel-type.m4 \
+ 	$(top_srcdir)/cf/have-linux-kernel-types.m4 \
+ 	$(top_srcdir)/cf/have-struct-field.m4 \
+ 	$(top_srcdir)/cf/have-type.m4 $(top_srcdir)/cf/have-types.m4 \
+ 	$(top_srcdir)/cf/header-dirent-dir-h.m4 \
+ 	$(top_srcdir)/cf/kafs-settoken-rxkad.m4 \
+ 	$(top_srcdir)/cf/kernel-have-def.m4 \
+ 	$(top_srcdir)/cf/kernel-need-proto.m4 \
+ 	$(top_srcdir)/cf/kernel.m4 $(top_srcdir)/cf/krb-bigendian.m4 \
+ 	$(top_srcdir)/cf/krb-func-getlogin.m4 \
+ 	$(top_srcdir)/cf/krb-ipv6.m4 \
+ 	$(top_srcdir)/cf/krb-struct-spwd.m4 \
+ 	$(top_srcdir)/cf/krb-struct-winsize.m4 \
+ 	$(top_srcdir)/cf/krb-sys-aix.m4 \
+ 	$(top_srcdir)/cf/krb-version.m4 \
+ 	$(top_srcdir)/cf/linux-func-init-mutex.m4 \
+ 	$(top_srcdir)/cf/linux-getattr-three-args.m4 \
+ 	$(top_srcdir)/cf/mips-abi.m4 $(top_srcdir)/cf/misc.m4 \
+ 	$(top_srcdir)/cf/need-proto.m4 \
+ 	$(top_srcdir)/cf/osf-func-ubc-lookup.m4 \
+ 	$(top_srcdir)/cf/osf-func-vfs-name-hash.m4 \
+ 	$(top_srcdir)/cf/prog-cc-flags.m4 \
+ 	$(top_srcdir)/cf/proto-compat.m4 \
+ 	$(top_srcdir)/cf/retsigtype.m4 $(top_srcdir)/cf/roken-frag.m4 \
+ 	$(top_srcdir)/cf/subst-val.m4 $(top_srcdir)/cf/test-package.m4 \
+ 	$(top_srcdir)/cf/try-compile-kernel.m4 \
+ 	$(top_srcdir)/cf/try-cpp-kernel.m4 \
+ 	$(top_srcdir)/cf/type-iovec.m4 $(top_srcdir)/cf/type-msghdr.m4 \
+ 	$(top_srcdir)/cf/werror.m4 $(top_srcdir)/cf/wflags.m4 \
+ 	$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ 	$(ACLOCAL_M4)
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+ CONFIG_HEADER = $(top_builddir)/include/config.h
+ CONFIG_CLEAN_FILES =
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+ librxgkclient_la_LIBADD =
+ am_librxgkclient_la_OBJECTS = rxgk_clnt.lo rxgk_info.lo rxgk_crpc.lo \
+ 	rxgk_crkrb.lo rxgk_common.lo rxgk_proto.ydr.lo \
+ 	rxgk_proto.cs.lo
+ librxgkclient_la_OBJECTS = $(am_librxgkclient_la_OBJECTS)
+ librxgkserver_la_LIBADD =
+ am_librxgkserver_la_OBJECTS = rxgk_serv.lo rxgk_info.lo rxgk_srpc.lo \
+ 	rxgk_crkrb.lo rxgk_common.lo rxgk_proto.ydr.lo \
+ 	rxgk_proto.ss.lo
+ librxgkserver_la_OBJECTS = $(am_librxgkserver_la_OBJECTS)
+ PROGRAMS = $(noinst_PROGRAMS)
+ am_test_client_OBJECTS = test_client.$(OBJEXT) test.cs.$(OBJEXT)
+ test_client_OBJECTS = $(am_test_client_OBJECTS)
+ am__DEPENDENCIES_1 =
+ am__DEPENDENCIES_2 = ../rx/librx.la $(am__DEPENDENCIES_1) \
+ 	$(am__DEPENDENCIES_1)
+ test_client_DEPENDENCIES = librxgkclient.la $(am__DEPENDENCIES_2)
+ am_test_server_OBJECTS = test_server.$(OBJEXT) test.ss.$(OBJEXT)
+ test_server_OBJECTS = $(am_test_server_OBJECTS)
+ test_server_DEPENDENCIES = librxgkserver.la $(am__DEPENDENCIES_2)
+ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+ depcomp =
+ am__depfiles_maybe =
+ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ 	$(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+ SOURCES = $(librxgkclient_la_SOURCES) $(librxgkserver_la_SOURCES) \
+ 	$(test_client_SOURCES) $(test_server_SOURCES)
+ DIST_SOURCES = $(librxgkclient_la_SOURCES) $(librxgkserver_la_SOURCES) \
+ 	$(test_client_SOURCES) $(test_server_SOURCES)
+ ETAGS = etags
+ CTAGS = ctags
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ ACLOCAL = @ACLOCAL@
+ AFS_EXTRA_DEFS = @AFS_EXTRA_DEFS@
+ AFS_EXTRA_LD = @AFS_EXTRA_LD@
+ AFS_EXTRA_LIBS = @AFS_EXTRA_LIBS@
+ AFS_EXTRA_OBJS = @AFS_EXTRA_OBJS@
+ AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
+ AMTAR = @AMTAR@
+ AR = @AR@
+ ARLACACHEDIR = @ARLACACHEDIR@
+ ARLACONFFILE = @ARLACONFFILE@
+ ARLA_CONF_HIGHBYTES = @ARLA_CONF_HIGHBYTES@
+ ARLA_CONF_HIGHVNODES = @ARLA_CONF_HIGHVNODES@
+ ARLA_CONF_LOWBYTES = @ARLA_CONF_LOWBYTES@
+ ARLA_CONF_LOWVNODES = @ARLA_CONF_LOWVNODES@
+ ARLA_KNFS = @ARLA_KNFS@
+ ARLA_LOCAL_ROKEN_FALSE = @ARLA_LOCAL_ROKEN_FALSE@
+ ARLA_LOCAL_ROKEN_TRUE = @ARLA_LOCAL_ROKEN_TRUE@
+ AS = @AS@
+ AUTOCONF = @AUTOCONF@
+ AUTOHEADER = @AUTOHEADER@
+ AUTOMAKE = @AUTOMAKE@
+ AWK = @AWK@
+ BSDMAKE = @BSDMAKE@
+ BSD_WERROR = @BSD_WERROR@
+ CANONICAL_HOST = @CANONICAL_HOST@
+ CATMAN = @CATMAN@
+ CATMANEXT = @CATMANEXT@
+ CATMAN_FALSE = @CATMAN_FALSE@
+ CATMAN_TRUE = @CATMAN_TRUE@
+ CC = @CC@
+ CFLAGS = @CFLAGS@
+ COMERR_CPPFLAGS = @COMERR_CPPFLAGS@
+ COM_APPLE_KERNEL_BSD = @COM_APPLE_KERNEL_BSD@
+ CPP = @CPP@
+ CPPFLAGS = @CPPFLAGS@
+ CXX = @CXX@
+ CXXCPP = @CXXCPP@
+ CXXFLAGS = @CXXFLAGS@
+ CYGPATH_W = @CYGPATH_W@
+ DBLIB = @DBLIB@
+ DCE_FALSE = @DCE_FALSE@
+ DCE_TRUE = @DCE_TRUE@
+ DEFS = @DEFS@
+ DEPEND_sl = @DEPEND_sl@
+ DIR_roken = @DIR_roken@
+ DIR_sl = @DIR_sl@
+ DVI2PS = @DVI2PS@
+ DVIPS = @DVIPS@
+ ECHO = @ECHO@
+ ECHO_C = @ECHO_C@
+ ECHO_N = @ECHO_N@
+ ECHO_T = @ECHO_T@
+ EGREP = @EGREP@
+ EXEEXT = @EXEEXT@
+ F77 = @F77@
+ FBSD5_FALSE = @FBSD5_FALSE@
+ FBSD5_TRUE = @FBSD5_TRUE@
+ FFLAGS = @FFLAGS@
+ FREEBSD_GENSETDEFS = @FREEBSD_GENSETDEFS@
+ GCC = @GCC@
+ GROFF = @GROFF@
+ GUILE_GTK = @GUILE_GTK@
+ HAVE_DB1_FALSE = @HAVE_DB1_FALSE@
+ HAVE_DB1_TRUE = @HAVE_DB1_TRUE@
+ HAVE_DB3_FALSE = @HAVE_DB3_FALSE@
+ HAVE_DB3_TRUE = @HAVE_DB3_TRUE@
+ HAVE_NDBM_FALSE = @HAVE_NDBM_FALSE@
+ HAVE_NDBM_TRUE = @HAVE_NDBM_TRUE@
+ INCLUDES_roken = @INCLUDES_roken@
+ INCLUDE_readline = @INCLUDE_readline@
+ INC_roken = @INC_roken@
+ INC_sl = @INC_sl@
+ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ KAFS_CPPFLAGS = @KAFS_CPPFLAGS@
+ KAFS_LIBS = @KAFS_LIBS@
+ KERNEL_CC = @KERNEL_CC@
+ KERNEL_CFLAGS = @KERNEL_CFLAGS@
+ KERNEL_CPPFLAGS = @KERNEL_CPPFLAGS@
+ KERNEL_HDRS = @KERNEL_HDRS@
+ KERNEL_INCLUDE = @KERNEL_INCLUDE@
+ KERNEL_LD = @KERNEL_LD@
+ KERNEL_LD_FLAGS = @KERNEL_LD_FLAGS@
+ KERNEL_SRCS = @KERNEL_SRCS@
+ KRB4_FALSE = @KRB4_FALSE@
+ KRB4_INC_DIR = @KRB4_INC_DIR@
+ KRB4_INC_FLAGS = @KRB4_INC_FLAGS@
+ KRB4_LIB_DIR = @KRB4_LIB_DIR@
+ KRB4_LIB_FLAGS = @KRB4_LIB_FLAGS@
+ KRB4_LIB_LIBS = @KRB4_LIB_LIBS@
+ KRB4_TRUE = @KRB4_TRUE@
+ KRB5_FALSE = @KRB5_FALSE@
+ KRB5_INC_DIR = @KRB5_INC_DIR@
+ KRB5_INC_FLAGS = @KRB5_INC_FLAGS@
+ KRB5_LIB_DIR = @KRB5_LIB_DIR@
+ KRB5_LIB_FLAGS = @KRB5_LIB_FLAGS@
+ KRB5_LIB_LIBS = @KRB5_LIB_LIBS@
+ KRB5_TRUE = @KRB5_TRUE@
+ LDFLAGS = @LDFLAGS@
+ LEX = @LEX@
+ LEXLIB = @LEXLIB@
+ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+ LIB_NDBM = @LIB_NDBM@
+ LIB_bswap16 = @LIB_bswap16@
+ LIB_bswap32 = @LIB_bswap32@
+ LIB_crypt = @LIB_crypt@
+ LIB_db_create = @LIB_db_create@
+ LIB_dbm_firstkey = @LIB_dbm_firstkey@
+ LIB_dbopen = @LIB_dbopen@
+ LIB_dn_expand = @LIB_dn_expand@
+ LIB_el_init = @LIB_el_init@
+ LIB_freeaddrinfo = @LIB_freeaddrinfo@
+ LIB_gai_strerror = @LIB_gai_strerror@
+ LIB_getaddrinfo = @LIB_getaddrinfo@
+ LIB_gethostbyname = @LIB_gethostbyname@
+ LIB_gethostbyname2 = @LIB_gethostbyname2@
+ LIB_getnameinfo = @LIB_getnameinfo@
+ LIB_getsockopt = @LIB_getsockopt@
+ LIB_hstrerror = @LIB_hstrerror@
+ LIB_pidfile = @LIB_pidfile@
+ LIB_pthread_create = @LIB_pthread_create@
+ LIB_readline = @LIB_readline@
+ LIB_res_init = @LIB_res_init@
+ LIB_res_nsearch = @LIB_res_nsearch@
+ LIB_res_search = @LIB_res_search@
+ LIB_roken = @LIB_roken@
+ LIB_setsockopt = @LIB_setsockopt@
+ LIB_sl = @LIB_sl@
+ LIB_socket = @LIB_socket@
+ LIB_syslog = @LIB_syslog@
+ LIB_tgetent = @LIB_tgetent@
+ LINUX_IA64_FALSE = @LINUX_IA64_FALSE@
+ LINUX_IA64_TRUE = @LINUX_IA64_TRUE@
+ LN_S = @LN_S@
+ LTLIBOBJS = @LTLIBOBJS@
+ LWP_C = @LWP_C@
+ LWP_H = @LWP_H@
+ LWP_O = @LWP_O@
+ LWP_PROCESS = @LWP_PROCESS@
+ LWP_REDZONE_FALSE = @LWP_REDZONE_FALSE@
+ LWP_REDZONE_TRUE = @LWP_REDZONE_TRUE@
+ MACOSX_FALSE = @MACOSX_FALSE@
+ MACOSX_TRUE = @MACOSX_TRUE@
+ MAINT = @MAINT@
+ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+ MAKEINFO = @MAKEINFO@
+ MAKE_X_PROGS_BIN = @MAKE_X_PROGS_BIN@
+ MILKO_ROOT = @MILKO_ROOT@
+ MODLOAD = @MODLOAD@
+ MODULE = @MODULE@
+ MODUNLOAD = @MODUNLOAD@
+ NNPFS_AFS_READDIR_FALSE = @NNPFS_AFS_READDIR_FALSE@
+ NNPFS_AFS_READDIR_TRUE = @NNPFS_AFS_READDIR_TRUE@
+ NNPFS_SRCS = @NNPFS_SRCS@
+ NNPFS_SUBDIR = @NNPFS_SUBDIR@
+ NROFF = @NROFF@
+ OBJEXT = @OBJEXT@
+ OSF1_FALSE = @OSF1_FALSE@
+ OSF1_TRUE = @OSF1_TRUE@
+ PACKAGE = @PACKAGE@
+ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+ PACKAGE_NAME = @PACKAGE_NAME@
+ PACKAGE_STRING = @PACKAGE_STRING@
+ PACKAGE_TARNAME = @PACKAGE_TARNAME@
+ PACKAGE_VERSION = @PACKAGE_VERSION@
+ PATH_SEPARATOR = @PATH_SEPARATOR@
+ PLWP_INC_FLAGS = @PLWP_INC_FLAGS@
+ PLWP_LIB_FLAGS = @PLWP_LIB_FLAGS@
+ RANLIB = @RANLIB@
+ ROKEN_H = @ROKEN_H@
+ RXKAD_FALSE = @RXKAD_FALSE@
+ RXKAD_LIBS = @RXKAD_LIBS@
+ RXKAD_TRUE = @RXKAD_TRUE@
+ SET_MAKE = @SET_MAKE@
+ SHELL = @SHELL@
+ SL_H = @SL_H@
+ STRIP = @STRIP@
+ SYMORDER = @SYMORDER@
+ SYS = @SYS@
+ TEXI2DVI = @TEXI2DVI@
+ TEXI2HTML = @TEXI2HTML@
+ TEXI2PDF = @TEXI2PDF@
+ VERSION = @VERSION@
+ VNODE_IF_H = @VNODE_IF_H@
+ VOID_RETSIGTYPE = @VOID_RETSIGTYPE@
+ WFLAGS = @WFLAGS@
+ WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
+ WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
+ X_CFLAGS = @X_CFLAGS@
+ X_EXTRA_LIBS = @X_EXTRA_LIBS@
+ X_LIBS = @X_LIBS@
+ X_PRE_LIBS = @X_PRE_LIBS@
+ YACC = @YACC@
+ YDR_CPPFLAGS = @YDR_CPPFLAGS@
+ ac_ct_AR = @ac_ct_AR@
+ ac_ct_CC = @ac_ct_CC@
+ ac_ct_CXX = @ac_ct_CXX@
+ ac_ct_F77 = @ac_ct_F77@
+ ac_ct_RANLIB = @ac_ct_RANLIB@
+ ac_ct_STRIP = @ac_ct_STRIP@
+ ac_cv_prog_getconf = @ac_cv_prog_getconf@
+ am__leading_dot = @am__leading_dot@
+ bindir = @bindir@
+ build = @build@
+ build_alias = @build_alias@
+ build_cpu = @build_cpu@
+ build_os = @build_os@
+ build_vendor = @build_vendor@
+ chmod = @chmod@
+ datadir = @datadir@
+ do_roken_rename_FALSE = @do_roken_rename_FALSE@
+ do_roken_rename_TRUE = @do_roken_rename_TRUE@
+ editline_OBJS = @editline_OBJS@
+ editline_dir = @editline_dir@
+ exec_prefix = @exec_prefix@
+ have_err_h_FALSE = @have_err_h_FALSE@
+ have_err_h_TRUE = @have_err_h_TRUE@
+ have_fnmatch_h_FALSE = @have_fnmatch_h_FALSE@
+ have_fnmatch_h_TRUE = @have_fnmatch_h_TRUE@
+ have_glob_h_FALSE = @have_glob_h_FALSE@
+ have_glob_h_TRUE = @have_glob_h_TRUE@
+ have_ifaddrs_h_FALSE = @have_ifaddrs_h_FALSE@
+ have_ifaddrs_h_TRUE = @have_ifaddrs_h_TRUE@
+ have_vis_h_FALSE = @have_vis_h_FALSE@
+ have_vis_h_TRUE = @have_vis_h_TRUE@
+ host = @host@
+ host_alias = @host_alias@
+ host_cpu = @host_cpu@
+ host_os = @host_os@
+ host_vendor = @host_vendor@
+ includedir = @includedir@
+ infodir = @infodir@
+ install_sh = @install_sh@
+ libdir = @libdir@
+ libexecdir = @libexecdir@
+ localstatedir = @localstatedir@
+ mandir = @mandir@
+ mkdir_p = @mkdir_p@
+ oldincludedir = @oldincludedir@
+ prefix = @prefix@
+ program_transform_name = @program_transform_name@
+ sbindir = @sbindir@
+ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+ target = @target@
+ target_alias = @target_alias@
+ target_cpu = @target_cpu@
+ target_os = @target_os@
+ target_vendor = @target_vendor@
+ SUFFIXES = .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x
+ INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken) $(INC_roken) -I. 			\
+ 	-I$(srcdir)			\
+ 	-I../include			\
+ 	-I$(srcdir)/../include		\
+ 	-I.. -I$(srcdir)/..		\
+ 	$(INC_roken) 			\
+ 	$(KRB5_INC_FLAGS)
+ 
+ @do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME
+ AM_CFLAGS = $(WFLAGS)
+ CP = cp
+ buildinclude = $(top_builddir)/include
+ LIB_XauReadAuth = @LIB_XauReadAuth@
+ LIB_dlopen = @LIB_dlopen@
+ LIB_getattr = @LIB_getattr@
+ LIB_getpwent_r = @LIB_getpwent_r@
+ LIB_getpwnam_r = @LIB_getpwnam_r@
+ LIB_logout = @LIB_logout@
+ LIB_logwtmp = @LIB_logwtmp@
+ LIB_odm_initialize = @LIB_odm_initialize@
+ LIB_openpty = @LIB_openpty@
+ LIB_setpcred = @LIB_setpcred@
+ HESIODLIB = @HESIODLIB@
+ HESIODINCLUDE = @HESIODINCLUDE@
+ INCLUDE_hesiod = @INCLUDE_hesiod@
+ LIB_hesiod = @LIB_hesiod@
+ INCLUDE_krb4 = @INCLUDE_krb4@
+ LIB_krb4 = @LIB_krb4@
+ INCLUDE_openldap = @INCLUDE_openldap@
+ LIB_openldap = @LIB_openldap@
+ NROFF_MAN = groff -mandoc -Tascii
+ CHECK_LOCAL = $(PROGRAMS)
+ noinst_LTLIBRARIES = librxgkclient.la librxgkserver.la
+ librxgkclient_la_SOURCES = \
+ 	rxgk_locl.h			\
+ 	rxgk_proto.h			\
+ 	rxgk_clnt.c			\
+ 	rxgk_info.c			\
+ 	rxgk_crpc.c			\
+ 	rxgk_crkrb.c			\
+ 	rxgk_common.c			\
+ 	rxgk_proto.ydr.c		\
+ 	rxgk_proto.cs.c
+ 
+ librxgkserver_la_SOURCES = \
+ 	rxgk_locl.h			\
+ 	rxgk_proto.h			\
+ 	rxgk_serv.c			\
+ 	rxgk_info.c			\
+ 	rxgk_srpc.c			\
+ 	rxgk_crkrb.c			\
+ 	rxgk_common.c			\
+ 	rxgk_proto.ydr.c		\
+ 	rxgk_proto.ss.c
+ 
+ LIBYDR = \
+ 	rxgk_proto.cs.c 		\
+ 	rxgk_proto.ss.c 		\
+ 	rxgk_proto.ydr.c		\
+ 	rxgk_proto.h			\
+ 	rxgk_proto.cs.h			\
+ 	rxgk_proto.ss.h
+ 
+ LIBTYDR = \
+ 	test.cs.h			\
+ 	test.ss.h			\
+ 	test.ss.c			\
+ 	test.cs.c			\
+ 	test.ydr.c			\
+ 	test.h
+ 
+ common_LDADD = \
+ 	../rx/librx.la \
+ 	-L../lwp -llwp $(PLWP_LIB_FLAGS) \
+ 	$(KRB5_LIB_FLAGS)
+ 
+ test_client_SOURCES = test_client.c test.cs.c
+ test_server_SOURCES = test_server.c test.ss.c
+ test_client_LDADD = librxgkclient.la $(common_LDADD)
+ test_server_LDADD = librxgkserver.la $(common_LDADD)
+ CLEANFILES = $(LIBYDR) $(LIBTYDR)
+ LDADD = $(KRB5_LIB_FLAGS)
+ all: all-am
+ 
+ .SUFFIXES:
+ .SUFFIXES: .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x .c .lo .o .obj
+ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(am__configure_deps)
+ 	@for dep in $?; do \
+ 	  case '$(am__configure_deps)' in \
+ 	    *$$dep*) \
+ 	      cd $(top_builddir) &amp;&amp; $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ 		&amp;&amp; exit 0; \
+ 	      exit 1;; \
+ 	  esac; \
+ 	done; \
+ 	echo ' cd $(top_srcdir) &amp;&amp; $(AUTOMAKE) --foreign  --ignore-deps rxgk/Makefile'; \
+ 	cd $(top_srcdir) &amp;&amp; \
+ 	  $(AUTOMAKE) --foreign  --ignore-deps rxgk/Makefile
+ .PRECIOUS: Makefile
+ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ 	@case '$?' in \
+ 	  *config.status*) \
+ 	    cd $(top_builddir) &amp;&amp; $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ 	  *) \
+ 	    echo ' cd $(top_builddir) &amp;&amp; $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ 	    cd $(top_builddir) &amp;&amp; $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ 	esac;
+ 
+ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ 	cd $(top_builddir) &amp;&amp; $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ 
+ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ 	cd $(top_builddir) &amp;&amp; $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ 	cd $(top_builddir) &amp;&amp; $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ 
+ clean-noinstLTLIBRARIES:
+ 	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ 	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ 	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ 	  test "$$dir" = "$$p" &amp;&amp; dir=.; \
+ 	  echo "rm -f \"$${dir}/so_locations\""; \
+ 	  rm -f "$${dir}/so_locations"; \
+ 	done
+ librxgkclient.la: $(librxgkclient_la_OBJECTS) $(librxgkclient_la_DEPENDENCIES) 
+ 	$(LINK)  $(librxgkclient_la_LDFLAGS) $(librxgkclient_la_OBJECTS) $(librxgkclient_la_LIBADD) $(LIBS)
+ librxgkserver.la: $(librxgkserver_la_OBJECTS) $(librxgkserver_la_DEPENDENCIES) 
+ 	$(LINK)  $(librxgkserver_la_LDFLAGS) $(librxgkserver_la_OBJECTS) $(librxgkserver_la_LIBADD) $(LIBS)
+ 
+ clean-noinstPROGRAMS:
+ 	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ 	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ 	  echo " rm -f $$p $$f"; \
+ 	  rm -f $$p $$f ; \
+ 	done
+ test_client$(EXEEXT): $(test_client_OBJECTS) $(test_client_DEPENDENCIES) 
+ 	@rm -f test_client$(EXEEXT)
+ 	$(LINK) $(test_client_LDFLAGS) $(test_client_OBJECTS) $(test_client_LDADD) $(LIBS)
+ test_server$(EXEEXT): $(test_server_OBJECTS) $(test_server_DEPENDENCIES) 
+ 	@rm -f test_server$(EXEEXT)
+ 	$(LINK) $(test_server_LDFLAGS) $(test_server_OBJECTS) $(test_server_LDADD) $(LIBS)
+ 
+ mostlyclean-compile:
+ 	-rm -f *.$(OBJEXT)
+ 
+ distclean-compile:
+ 	-rm -f *.tab.c
+ 
+ .c.o:
+ 	$(COMPILE) -c $&lt;
+ 
+ .c.obj:
+ 	$(COMPILE) -c `$(CYGPATH_W) '$&lt;'`
+ 
+ .c.lo:
+ 	$(LTCOMPILE) -c -o $@ $&lt;
+ 
+ mostlyclean-libtool:
+ 	-rm -f *.lo
+ 
+ clean-libtool:
+ 	-rm -rf .libs _libs
+ 
+ distclean-libtool:
+ 	-rm -f libtool
+ uninstall-info-am:
+ 
+ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ 	unique=`for i in $$list; do \
+ 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ 	  done | \
+ 	  $(AWK) '    { files[$$0] = 1; } \
+ 	       END { for (i in files) print i; }'`; \
+ 	mkid -fID $$unique
+ tags: TAGS
+ 
+ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+ 		$(TAGS_FILES) $(LISP)
+ 	tags=; \
+ 	here=`pwd`; \
+ 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+ 	unique=`for i in $$list; do \
+ 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ 	  done | \
+ 	  $(AWK) '    { files[$$0] = 1; } \
+ 	       END { for (i in files) print i; }'`; \
+ 	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ 	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ 	     $$tags $$unique
+ ctags: CTAGS
+ CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+ 		$(TAGS_FILES) $(LISP)
+ 	tags=; \
+ 	here=`pwd`; \
+ 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+ 	unique=`for i in $$list; do \
+ 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ 	  done | \
+ 	  $(AWK) '    { files[$$0] = 1; } \
+ 	       END { for (i in files) print i; }'`; \
+ 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ 	     $$tags $$unique
+ 
+ GTAGS:
+ 	here=`$(am__cd) $(top_builddir) &amp;&amp; pwd` \
+ 	  &amp;&amp; cd $(top_srcdir) \
+ 	  &amp;&amp; gtags -i $(GTAGS_ARGS) $$here
+ 
+ distclean-tags:
+ 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ 
+ distdir: $(DISTFILES)
+ 	$(mkdir_p) $(distdir)/.. $(distdir)/../cf
+ 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ 	list='$(DISTFILES)'; for file in $$list; do \
+ 	  case $$file in \
+ 	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ 	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ 	  esac; \
+ 	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ 	  if test "$$dir" != "$$file" &amp;&amp; test "$$dir" != "."; then \
+ 	    dir="/$$dir"; \
+ 	    $(mkdir_p) "$(distdir)$$dir"; \
+ 	  else \
+ 	    dir=''; \
+ 	  fi; \
+ 	  if test -d $$d/$$file; then \
+ 	    if test -d $(srcdir)/$$file &amp;&amp; test $$d != $(srcdir); then \
+ 	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ 	    fi; \
+ 	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ 	  else \
+ 	    test -f $(distdir)/$$file \
+ 	    || cp -p $$d/$$file $(distdir)/$$file \
+ 	    || exit 1; \
+ 	  fi; \
+ 	done
+ 	$(MAKE) $(AM_MAKEFLAGS) \
+ 	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ 	  dist-hook
+ check-am: all-am
+ 	$(MAKE) $(AM_MAKEFLAGS) check-local
+ check: check-am
+ all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local
+ installdirs:
+ install: install-am
+ install-exec: install-exec-am
+ install-data: install-data-am
+ uninstall: uninstall-am
+ 
+ install-am: all-am
+ 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+ 
+ installcheck: installcheck-am
+ install-strip:
+ 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ 	  `test -z '$(STRIP)' || \
+ 	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ mostlyclean-generic:
+ 
+ clean-generic:
+ 	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+ 
+ distclean-generic:
+ 	-rm -f $(CONFIG_CLEAN_FILES)
+ 
+ maintainer-clean-generic:
+ 	@echo "This command is intended for maintainers to use"
+ 	@echo "it deletes files that may require special tools to rebuild."
+ clean: clean-am
+ 
+ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ 	clean-noinstPROGRAMS mostlyclean-am
+ 
+ distclean: distclean-am
+ 	-rm -f Makefile
+ distclean-am: clean-am distclean-compile distclean-generic \
+ 	distclean-libtool distclean-tags
+ 
+ dvi: dvi-am
+ 
+ dvi-am:
+ 
+ html: html-am
+ 
+ info: info-am
+ 
+ info-am:
+ 
+ install-data-am: install-data-local
+ 
+ install-exec-am:
+ 	@$(NORMAL_INSTALL)
+ 	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+ 
+ install-info: install-info-am
+ 
+ install-man:
+ 
+ installcheck-am:
+ 
+ maintainer-clean: maintainer-clean-am
+ 	-rm -f Makefile
+ maintainer-clean-am: distclean-am maintainer-clean-generic
+ 
+ mostlyclean: mostlyclean-am
+ 
+ mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ 	mostlyclean-libtool
+ 
+ pdf: pdf-am
+ 
+ pdf-am:
+ 
+ ps: ps-am
+ 
+ ps-am:
+ 
+ uninstall-am: uninstall-info-am
+ 
+ .PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \
+ 	clean clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ 	clean-noinstPROGRAMS ctags distclean distclean-compile \
+ 	distclean-generic distclean-libtool distclean-tags distdir dvi \
+ 	dvi-am html html-am info info-am install install-am \
+ 	install-data install-data-am install-data-local install-exec \
+ 	install-exec-am install-info install-info-am install-man \
+ 	install-strip installcheck installcheck-am installdirs \
+ 	maintainer-clean maintainer-clean-generic mostlyclean \
+ 	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ 	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ 	uninstall-info-am
+ 
+ 
+ install-suid-programs:
+ 	@foo='$(bin_SUIDS)'; \
+ 	for file in $$foo; do \
+ 	x=$(DESTDIR)$(bindir)/$$file; \
+ 	if chown 0:0 $$x &amp;&amp; chmod u+s $$x; then :; else \
+ 	echo "*"; \
+ 	echo "* Failed to install $$x setuid root"; \
+ 	echo "*"; \
+ 	fi; done
+ 
+ install-exec-hook: install-suid-programs
+ 
+ install-build-headers:: $(include_HEADERS) $(build_HEADERZ)
+ 	@foo='$(include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \
+ 	for f in $$foo; do \
+ 		f=`basename $$f`; \
+ 		if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
+ 		else file="$$f"; fi; \
+ 		if cmp -s  $$file $(buildinclude)/$$f 2&gt; /dev/null ; then \
+ 		: ; else \
+ 			echo " $(CP) $$file $(buildinclude)/$$f"; \
+ 			$(CP) $$file $(buildinclude)/$$f; \
+ 		fi ; \
+ 	done
+ 
+ all-local: install-build-headers
+ 
+ check-local::
+ 	@if test '$(CHECK_LOCAL)'; then \
+ 	  foo='$(CHECK_LOCAL)'; else \
+ 	  foo='$(PROGRAMS)'; fi; \
+ 	  if test "$$foo"; then \
+ 	  failed=0; all=0; \
+ 	  for i in $$foo; do \
+ 	    all=`expr $$all + 1`; \
+ 	    if ./$$i --version &gt; /dev/null 2&gt;&amp;1; then \
+ 	      echo "PASS: $$i"; \
+ 	    else \
+ 	      echo "FAIL: $$i"; \
+ 	      failed=`expr $$failed + 1`; \
+ 	    fi; \
+ 	  done; \
+ 	  if test "$$failed" -eq 0; then \
+ 	    banner="All $$all tests passed"; \
+ 	  else \
+ 	    banner="$$failed of $$all tests failed"; \
+ 	  fi; \
+ 	  dashes=`echo "$$banner" | sed s/./=/g`; \
+ 	  echo "$$dashes"; \
+ 	  echo "$$banner"; \
+ 	  echo "$$dashes"; \
+ 	  test "$$failed" -eq 0; \
+ 	fi
+ 
+ .x.c:
+ 	@cmp -s $&lt; $@ 2&gt; /dev/null || cp $&lt; $@
+ #NROFF_MAN = nroff -man
+ .1.cat1:
+ 	$(NROFF_MAN) $&lt; &gt; $@
+ .3.cat3:
+ 	$(NROFF_MAN) $&lt; &gt; $@
+ .5.cat5:
+ 	$(NROFF_MAN) $&lt; &gt; $@
+ .8.cat8:
+ 	$(NROFF_MAN) $&lt; &gt; $@
+ 
+ dist-cat1-mans:
+ 	@foo='$(man1_MANS)'; \
+ 	bar='$(man_MANS)'; \
+ 	for i in $$bar; do \
+ 	case $$i in \
+ 	*.1) foo="$$foo $$i";; \
+ 	esac; done ;\
+ 	for i in $$foo; do \
+ 		x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
+ 		echo "$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x"; \
+ 		$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x; \
+ 	done
+ 
+ dist-cat3-mans:
+ 	@foo='$(man3_MANS)'; \
+ 	bar='$(man_MANS)'; \
+ 	for i in $$bar; do \
+ 	case $$i in \
+ 	*.3) foo="$$foo $$i";; \
+ 	esac; done ;\
+ 	for i in $$foo; do \
+ 		x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
+ 		echo "$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x"; \
+ 		$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x; \
+ 	done
+ 
+ dist-cat5-mans:
+ 	@foo='$(man5_MANS)'; \
+ 	bar='$(man_MANS)'; \
+ 	for i in $$bar; do \
+ 	case $$i in \
+ 	*.5) foo="$$foo $$i";; \
+ 	esac; done ;\
+ 	for i in $$foo; do \
+ 		x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
+ 		echo "$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x"; \
+ 		$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x; \
+ 	done
+ 
+ dist-cat8-mans:
+ 	@foo='$(man8_MANS)'; \
+ 	bar='$(man_MANS)'; \
+ 	for i in $$bar; do \
+ 	case $$i in \
+ 	*.8) foo="$$foo $$i";; \
+ 	esac; done ;\
+ 	for i in $$foo; do \
+ 		x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
+ 		echo "$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x"; \
+ 		$(NROFF_MAN) $(srcdir)/$$i &gt; $(distdir)/$$x; \
+ 	done
+ 
+ dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
+ 
+ install-cat-mans: install-man
+ 	$(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
+ 
+ install-data-local: install-cat-mans
+ 
+ .et.h:
+ 	$(COMPILE_ET) $&lt;
+ .et.c:
+ 	$(COMPILE_ET) $&lt;
+ 
+ .x.c:
+ 	@cmp -s $&lt; $@ 2&gt; /dev/null || cp $&lt; $@
+ 
+ check-local::
+ 	@foo='$(CHECK_LOCAL)'; \
+ 	  if test "$$foo"; then \
+ 	  failed=0; all=0; \
+ 	  for i in $$foo; do \
+ 	    all=`expr $$all + 1`; \
+ 	    if ./$$i --version &gt; /dev/null 2&gt;&amp;1; then \
+ 	      echo "PASS: $$i"; \
+ 	    else \
+ 	      echo "FAIL: $$i"; \
+ 	      failed=`expr $$failed + 1`; \
+ 	    fi; \
+ 	  done; \
+ 	  if test "$$failed" -eq 0; then \
+ 	    banner="All $$all tests passed"; \
+ 	  else \
+ 	    banner="$$failed of $$all tests failed"; \
+ 	  fi; \
+ 	  dashes=`echo "$$banner" | sed s/./=/g`; \
+ 	  echo "$$dashes"; \
+ 	  echo "$$banner"; \
+ 	  echo "$$dashes"; \
+ 	  test "$$failed" -eq 0; \
+ 	fi
+ 
+ $(librxgkclient_la_OBJECTS) $(librxgkserver_la_OBJECTS): $(LIBYDR)
+ 
+ $(test_server_OBJECTS) $(test_client_OBJECTS): $(LIBTYDR)
+ 
+ $(LIBYDR): rxgk_proto.xg
+ 	../ydr/ydr $(srcdir)/rxgk_proto.xg
+ 
+ $(LIBTYDR): test.xg
+ 	../ydr/ydr $(srcdir)/test.xg
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
Index: openafs/src/rxgk/README
diff -c /dev/null openafs/src/rxgk/README:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/README	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,225 ----
+ $Id: README,v 1.1 2004/08/08 19:21:33 shadow Exp $
+ 
+ Overview
+ ========
+ 
+ - RX crypto class
+ 
+ 	rxgk is a new crypto class, mostly since the interface need to
+ 	be changed in the ktc for openafs anyway (at least binary
+ 	interface).
+ 
+ 	rxgk (krb5) can be used when the kdc returns a non des enctype.
+ 
+ - Layers
+ 
+ 	There are two layer, the transport layer that is authentiation
+ 	mechamism independent, and the authentiation layer.
+ 
+ 	The glue between the authentiation layer and the transport
+ 	layer is the RXGK authenticator.
+ 
+ - RXGK authenticator
+ 
+ 	The only reson for the RXGK authenticator exists is that there
+ 	are not fragmentation in the Challange/Response protocol in
+ 	Rx. This limits the authentization in Rx to MTU sized packages.
+ 
+ - RXGK authenticator lifetime
+ 
+ 	The server has a local key that is used to encrypt the gk
+ 	authenticators. The local key is semi stateful, the
+ 	server need to remember the old keys al long as there are
+ 	valid RXGK authenticators held by any client. New RXGK
+ 	authenticators can be fetched at any time but might require
+ 	user input.
+ 
+ - Getting RXGK authenticator
+ 
+ 	the authenticator is fetched using a service rx_null on the
+ 	same port as the server the client wants to talk too.
+ 
+ transport layer
+ ===============
+ 
+ - Key derivation
+ 
+ 	Each connection get separate key for each connection/epoch.
+ 	Each direction get a separate key for each direction.
+ 
+ 	S = Session key
+ 	CN = connection key
+ 	counter = key generation (nonce)
+ 	K{server} = Key from server direction
+ 	K{client} = Key from client direction
+ 
+ 	X{cn} = epoch{32} | cid{32} | key_counter{64}
+ 	
+ 	CN = random-to-key(pseudo-random(S, X{cn})
+ 
+ 	K{server} = KD(CN, 0)	{ key used on data from server }
+ 	K{client} = KD(CN, 1)	{ key used on data from client }
+ 
+ 	Checksum field in the header (spare1) is always set to the
+ 	lower 4 bits of the key_counter field. Ie server may not
+ 	request rekeying faster the (4 * rc_max_seq_skew) packets.
+ 
+ 	K depends on {S,epoch,cid,key_counter}
+ 
+ - Rekeying 
+ 
+ 	Rekeing is needed since kcrypt assumes that data isn't
+ 	encrypted for the 2**48 messages with the same key.
+ 
+ - Challenge/Response
+ 
+ 	When the client is unknown to the server it sends a challenge
+ 	with opcode RXKG_OPCODE_CHALLENGE (nonce).
+ 
+ 	The client the send back a rxgk authenticator and the
+ 	encrypted nounce.
+ 
+ - Wire protocol
+ 
+ 	crypt mode
+ 
+ 	Each packet are encrypted as [KCRYPTO] specifies. The data is
+ 	prefixed with parts of the rx header that matter.
+ 
+ 	auth mode
+ 
+ 	Each packet are checksumed as [KCRYPTO] specifies. The data is
+ 	prefixed with parts of the rx header that matter [4]. In auth
+ 	mode the rx header subsitute is not sent over write to save
+ 	space.
+ 
+ 	The part of the header that is checksumed are these fields:
+ 
+ 		uint32_t callid
+ 		uint32_t seqno
+ 		uint32_t serialno
+ 		uint8_t  userstatus
+ 		uint8_t  someflags (RX_PRESET_FLAGS)
+ 		uint8_t  serviceid
+ 
+ Authentication RPCs
+ ===================
+ 
+ - Information RPCs
+ 
+ 	To be later specified.
+ 
+ 	There is an information API to, with a RXGK authenticator, the
+ 	client can verify what authentiation mechamisms is supported,
+ 	both insecure and authenticated.
+ 
+ - Kerberos 5 to rxgk authenticator RPCs
+ 
+ 	key{KerbS} - kerberos session subkey key
+ 
+ 	The mutual auth data in the RXGK_EstablishKrb5Context is
+ 	encrypted with the key{KerbS} key.
+ 
+ 	Client sends acceptable enctypes and nonce to the server in
+ 	challenge.
+ 
+ 	Server sends back key(auth-cred-key) and nonce + 1 to the 
+ 	client together with a RXGK authenticator cred encrypted with
+ 	key{KerbS}.
+ 
+ 	auth-cred is protected by key{gkkey}
+ 
+ 	key{S} = key{auth-cred-key}
+ 
+ - GSS-API to rxgk authenticator RPCs
+ 
+ 	To be later specified.
+ 
+ ========
+ 
+ Code assumptions:
+ 
+ 	L.NXS.SE realm
+ 
+ 	gkkey@L.NXS.SE and afs@L.NXS.SE key exists in default keytab
+ 
+ ========
+ implementation/higher level issues
+ 
+ 
+ - RXGK_AUTH_CRED needs checking
+ 	
+ 	[ 2. should we use the session key or the a random octet
+ 	string generatated by the server, the key(auth-cred-key) below ]
+ 
+ 	[ 3. ac_principal: gss exported name ? this to make it idependant
+ 	of kerberos 5. Problem with gss name only specifed gss-mechs
+ 	can be used. Server local so it can really be anything the
+ 	server wants it to be. Need to be kept short so it will fit on
+ 	one MTU. Also see {{10}}. ]
+ 
+ 	The RXGK authenticator is fetch by doing either the RXGK
+ 	GSSAPI rpc's or the RXGK_EstablishKrb5Context rpc to the RXGK
+ 	service on the same port as the service that rxgk
+ 	secures. Doing the RPC call gives you a gk authenticator and a
+ 	key(S) that is valid for one server. The input to GSSAPI rpc
+ 	and EstablishKrb5Context are mech specific.
+ 
+ 	GSS-API
+ 	[ 11. see rxgss how this should me implemented ... ]
+ 
+ exported auth name
+ 
+ 	all mech's need to have a rxgk name to krb4 name function
+ 	until pts is changed to support rxgk names.
+ 
+ 	[ 10. Proposal: the protection interface have GKNAME to
+ 	AFS/PTS named RPCs.
+ 
+ 	In this proposal all names are mapped to one AFS username.
+ 
+ 	For example, gss exported named KRB5:lha@SU.SE, krb5 native
+ 	lha@SU.SE and krb5 native krb5 lha@KTH.SE all map to the same
+ 	afs username `lha'.
+ 
+ 
+ 	Also see {{3}}. ]
+ 
+ 
+ TODO:
+ 
+ - Auth mode
+ 
+ - Pass length since krb encryption doesn't preserve length (some enctypes does)
+ 
+ 	[ 8. Is this really needed, packets are always send full ]
+ 
+ - More tests
+ 
+ 	More the MTU since rpcs
+ 	Stored packets packets, compare generate packages
+ 	Check other checksum
+ 
+ 
+ DEPRICATED IDEAS
+ 
+ - Diffrent keys for fileservers
+ 
+ 	I think we should ignore this for rxgk/kerberos 5 or do
+ 	"fileserver groups" as discuss on Pittsburgh so this will
+ 	happen. For "fileserver groups" a get groups rpc should be
+ 	added to the vlserver (this will make non rx afslogs harder 
+ 	to implement) and in the first version we just insert a rpc
+ 	stub that return one name only, "default", or something
+ 	equally silly.
+ 
+ 	The reson you want to have diffrent keys for fileservers are
+ 
+ 	- increased security (more keys, less data encrypted with the
+ 	  same key, one server compromised doesn't compromise all servers)
+ 
+ 	- give a fileserver to someone else that you not trust
+ 	  to have the master key
+ 
+   Depricated since we can get consensus, rxgk/gssapi will/must solve
+   the problem.
Index: openafs/src/rxgk/rxgk.h
diff -c /dev/null openafs/src/rxgk/rxgk.h:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk.h	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,91 ----
+ /* -*- C -*- */
+ 
+ /*
+  * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
+  * (Royal Institute of Technology, Stockholm, Sweden).
+  * All rights reserved.
+  * 
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 
+  * 3. Neither the name of the Institute nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  * 
+  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ /* $Id: rxgk.h,v 1.1 2004/08/08 19:21:33 shadow Exp $ */
+ 
+ #ifndef __RXGK_H
+ #define __RXGK_H
+ 
+ /* Is this really large enough for a krb5 ticket? */
+ #define MAXKRB5TICKETLEN	1024
+ 
+ typedef char rxgk_level;
+ #define rxgk_auth 0		/* rxgk_clear + protected packet length */
+ #define rxgk_crypt 1		/* rxgk_crypt + encrypt packet payload */
+ 
+ int32_t
+ rxgk_GetServerInfo(struct rx_connection *, rxgk_level *,
+ 		   uint32_t *, char *, size_t, char *, size_t, int32_t *);
+ 
+ struct rx_securityClass *
+ rxgk_NewServerSecurityObject (/*rxgk_level*/ int min_level,
+ 			      const char *princ,
+ 			      void *appl_data,
+ 			      int (*get_key)(void *data, const char *principal,
+ 					     int enctype, int kvno, 
+ 					     krb5_keyblock *key),
+ 			      int (*user_ok)(const char *name,
+ 					     const char *realm,
+ 					     int kvno),
+ 			      uint32_t serviceId);
+ 
+ struct rx_securityClass *
+ rxgk_k5_NewClientSecurityObject (/*rxgk_level*/ int level,
+ 				 krb5_keyblock *sessionkey,
+ 				 int32_t kvno,
+ 				 int ticketLen,
+ 				 void *ticket,
+ 				 uint32_t serviceId,
+ 				 krb5_context context);
+ 
+ int
+ rxgk_default_get_key(void *, const char *, int, int, krb5_keyblock *);
+ 
+ /* XXX these are not com_err error, MAKE THIS com_err's */
+ #define RXGKINCONSISTENCY	(19270400L)
+ #define RXGKPACKETSHORT		(19270401L)
+ #define RXGKLEVELFAIL		(19270402L)
+ #define RXGKTICKETLEN		(19270403L)
+ #define RXGKOUTOFSEQUENCE	(19270404L)
+ #define RXGKNOAUTH		(19270405L)
+ #define RXGKBADKEY		(19270406L)
+ #define RXGKBADTICKET		(19270407L)
+ #define RXGKUNKNOWNKEY		(19270408L)
+ #define RXGKEXPIRED		(19270409L)
+ #define RXGKSEALEDINCON		(19270410L)
+ #define RXGKDATALEN		(19270411L)
+ #define RXGKILLEGALLEVEL	(19270412L)
+ 
+ #endif /* __RXGK_H */
Index: openafs/src/rxgk/rxgk_clnt.c
diff -c /dev/null openafs/src/rxgk/rxgk_clnt.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_clnt.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,417 ----
+ /*
+  * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
+  * (Royal Institute of Technology, Stockholm, Sweden).
+  * All rights reserved.
+  * 
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 
+  * 3. Neither the name of the Institute nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  * 
+  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ #include "rxgk_locl.h"
+ 
+ RCSID("$Id: rxgk_clnt.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ /* Security object specific client data */
+ typedef struct rxgk_clnt_class {
+     struct rx_securityClass klass;
+     krb5_context context;
+     rxgk_level level;
+     krb5_keyblock krb_key;
+     key_stuff k;
+     int32_t kvno;
+     RXGK_Token ticket;
+     uint32_t serviceId;
+ #if 0
+     RXGK_rxtransport_key contrib;
+ #endif
+ } rxgk_clnt_class;
+ 
+ /* Per connection specific client data */
+ typedef struct clnt_con_data {
+     RXGK_Token auth_token;
+     int32_t auth_token_kvno;
+     end_stuff e;
+ } clnt_con_data;
+ 
+ static
+ int
+ client_NewConnection(struct rx_securityClass *obj_, struct rx_connection *con)
+ {
+     rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_;
+     clnt_con_data *cdat;
+     int ret;
+     
+     assert(con-&gt;securityData == 0);
+     obj-&gt;klass.refCount++;
+     cdat = (clnt_con_data *) osi_Alloc(sizeof(clnt_con_data));
+     cdat-&gt;e.bytesReceived = cdat-&gt;e.packetsReceived = 0;
+     cdat-&gt;e.bytesSent = cdat-&gt;e.packetsSent = 0;
+     
+     con-&gt;securityData = (char *) cdat;
+     rx_nextCid += RX_MAXCALLS;
+     con-&gt;epoch = rx_epoch;
+     con-&gt;cid = rx_nextCid;
+     cdat-&gt;auth_token.len = 0;
+     cdat-&gt;auth_token.val = NULL;
+ 
+     ret = rxgk5_get_auth_token(obj-&gt;context,
+ 			       rx_HostOf(con-&gt;peer), rx_PortOf(con-&gt;peer),
+ 			       obj-&gt;serviceId,
+ 			       &amp;obj-&gt;ticket, &amp;cdat-&gt;auth_token, 
+ 			       &amp;obj-&gt;krb_key, 
+ 			       &amp;obj-&gt;k.ks_key,
+ 			       &amp;cdat-&gt;auth_token_kvno);
+     if (ret) {
+ 	osi_Free(cdat, sizeof(clnt_con_data));
+ 	return ret;
+     }
+ 
+     /* XXX derive crypto key */
+ 
+     ret = krb5_crypto_init(obj-&gt;k.ks_context,
+ 			   &amp;obj-&gt;k.ks_key, obj-&gt;k.ks_key.keytype,
+ 			   &amp;obj-&gt;k.ks_crypto);
+     if (ret)
+ 	goto out;
+ 
+ #if 0
+     obj-&gt;contrib.server_keycontribution.val = "";
+     obj-&gt;contrib.server_keycontribution.len = 0;
+ 
+     obj-&gt;contrib.client_keycontribution.len = rxgk_key_contrib_size;
+     obj-&gt;contrib.client_keycontribution.val = malloc(rxgk_key_contrib_size);
+     if (obj-&gt;contrib.client_keycontribution.val == NULL)
+ 	goto out;
+ 
+     {
+ 	int i;
+ 
+ 	for (i = 0; i &lt; rxgk_key_contrib_size; i++)
+ 	    obj-&gt;contrib.client_keycontribution.val[i] = arc4random(); /*XXX*/
+     }
+ 
+     ret = rxgk_derive_transport_key(obj-&gt;k.ks_context,
+ 				    &amp;obj-&gt;k.ks_key,
+ 				    &amp;obj-&gt;contrib,
+ 				    &amp;obj-&gt;k.ks_skey);
+     if (ret)
+ 	return ret;
+ #endif
+ 
+     ret = krb5_crypto_init (obj-&gt;context, &amp;obj-&gt;k.ks_skey,
+ 			    obj-&gt;k.ks_skey.keytype,
+ 			    &amp;obj-&gt;k.ks_scrypto);
+     if (ret)
+ 	return ret;
+ 
+     ret = rxgk_set_conn(con, obj-&gt;k.ks_key.keytype, 
+ 			obj-&gt;level == rxgk_crypt ? 1 : 0);
+ 
+  out:
+     if (ret) {
+ 	if (obj-&gt;k.ks_crypto)
+ 	    krb5_crypto_destroy(obj-&gt;k.ks_context, obj-&gt;k.ks_crypto);
+ 	obj-&gt;k.ks_crypto = NULL;
+ 	krb5_free_keyblock_contents(obj-&gt;k.ks_context, &amp;obj-&gt;k.ks_skey);
+ 	memset(&amp;obj-&gt;k.ks_skey, 0, sizeof(obj-&gt;k.ks_skey));
+ 	osi_Free(cdat-&gt;auth_token.val, cdat-&gt;auth_token.len);
+ 	osi_Free(cdat, sizeof(clnt_con_data));
+ 	return ret;
+     }
+     
+     return 0;
+ }
+ 
+ static
+ int
+ client_Close(struct rx_securityClass *obj_)
+ {
+     rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_;
+     obj-&gt;klass.refCount--;
+     if (obj-&gt;klass.refCount &lt;= 0)
+     {
+ 	osi_Free(obj-&gt;ticket.val, obj-&gt;ticket.len);
+ 	osi_Free(obj, sizeof(rxgk_clnt_class));
+     }
+     return 0;
+ }
+ 
+ static
+ int
+ client_DestroyConnection(struct rx_securityClass *obj,
+ 			 struct rx_connection *con)
+ {
+     clnt_con_data *cdat = (clnt_con_data *)con-&gt;securityData;
+   
+     if (cdat)
+       osi_Free(cdat, sizeof(clnt_con_data));
+     return client_Close(obj);
+ }
+ 
+ /*
+  * Receive a challange and respond.
+  */
+ static
+ int
+ client_GetResponse(const struct rx_securityClass *obj_,
+ 		   const struct rx_connection *con,
+ 		   struct rx_packet *pkt)
+ {
+     rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_;
+     clnt_con_data *cdat = (clnt_con_data *)con-&gt;securityData;
+     key_stuff *k = &amp;obj-&gt;k;
+     struct RXGK_Challenge c;
+     struct RXGK_Response r;
+     struct RXGK_Response_Crypt rc;
+     char bufrc[RXGK_RESPONSE_CRYPT_SIZE];
+     char bufr[RXGK_RESPONSE_MAX_SIZE];
+     krb5_data data;
+     size_t len;
+     int ret;
+     char *p;
+     
+     memset(&amp;r, 0, sizeof(r));
+     memset(&amp;rc, 0, sizeof(rc));
+     
+     /* Get challenge */
+     if (rx_SlowReadPacket(pkt, 0, sizeof(c), &amp;c) != sizeof(c))
+ 	return RXGKPACKETSHORT;
+     
+     if (ntohl(c.rc_version) != RXGK_VERSION)
+ 	return RXGKINCONSISTENCY;
+     
+     if (ntohl(c.rc_min_level) &gt; obj-&gt;level)
+ 	return RXGKLEVELFAIL;
+     
+     if (c.rc_opcode == htonl(RXKG_OPCODE_CHALLENGE)) {
+ 	;
+     } else if (c.rc_opcode == htonl(RXKG_OPCODE_REKEY)) {
+ 	/* XXX decode ydr_encode_RXGK_ReKey_Crypt info */
+ 	return RXGKINCONSISTENCY;
+ #if 0
+ 	ret = rxgk_derive_transport_key(obj-&gt;k.ks_context,
+ 					&amp;obj-&gt;k.ks_key,
+ 					&amp;obj-&gt;contrib,
+ 					&amp;obj-&gt;k.ks_skey);
+ 	if (ret)
+ 	    return ret;
+ 	
+ 	ret = krb5_crypto_init (obj-&gt;context, &amp;obj-&gt;k.ks_skey,
+ 				obj-&gt;k.ks_skey.keytype,
+ 				&amp;obj-&gt;k.ks_scrypto);
+ 	if (ret)
+ 	    return ret;
+ #endif
+     } else
+ 	return RXGKINCONSISTENCY;
+     
+     rc.nonce = ntohl(c.rc_nonce) + 1;
+     rc.epoch = con-&gt;epoch;
+     rc.cid = con-&gt;cid &amp; RX_CIDMASK;
+     rxi_GetCallNumberVector(con, rc.call_numbers);
+ #if 0
+     rc.security_index = con-&gt;securityIndex;
+ #endif
+     rc.level = obj-&gt;level;
+ #if 0
+     rc.last_seq = 0; /* XXX */
+ #endif
+     rc.key_version = 0;
+ #if 0
+     rc.contrib = obj-&gt;contrib; /* XXX copy_RXGK_rxtransport_key */
+ #endif
+     
+     {
+ 	int i;
+ 	for (i = 0; i &lt; RX_MAXCALLS; i++) {
+ 	    if (rc.call_numbers[i] &lt; 0)
+ 		return RXGKINCONSISTENCY;
+ 	}
+     }
+     len = sizeof(bufrc);
+     p = ydr_encode_RXGK_Response_Crypt(&amp;rc, bufrc, &amp;len);
+     if (p == NULL)
+ 	return RXGKINCONSISTENCY;
+     len = sizeof(bufrc) - len;
+ 
+     ret = krb5_encrypt(obj-&gt;context, k-&gt;ks_crypto, 
+ 		       RXGK_CLIENT_ENC_CHALLENGE, bufrc, len, &amp;data);
+     if (ret)
+ 	return ret;
+ 
+     r.rr_version = RXGK_VERSION;
+     r.rr_auth_token_kvno = cdat-&gt;auth_token_kvno;
+     r.rr_auth_token.val = cdat-&gt;auth_token.val;
+     r.rr_auth_token.len = cdat-&gt;auth_token.len;
+     r.rr_ctext.val = data.data;
+     r.rr_ctext.len = data.length;
+ 
+     len = sizeof(bufr);
+     p = ydr_encode_RXGK_Response(&amp;r, bufr, &amp;len);
+     len = sizeof(bufr) - len;
+     krb5_data_free(&amp;data);
+ 
+     if (p == NULL)
+ 	return RXGKINCONSISTENCY;
+ 
+     if (rx_SlowWritePacket(pkt, 0, len, bufr) != len)
+ 	return RXGKPACKETSHORT;
+     rx_SetDataSize(pkt, len);
+ 
+     return 0;
+ }
+ 
+ /*
+  * Checksum and/or encrypt packet.
+  */
+ static
+ int
+ client_PreparePacket(struct rx_securityClass *obj_,
+ 		     struct rx_call *call,
+ 		     struct rx_packet *pkt)
+ {
+     rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_;
+     key_stuff *k = &amp;obj-&gt;k;
+     struct rx_connection *con = rx_ConnectionOf(call);
+     end_stuff *e = &amp;((clnt_con_data *) con-&gt;securityData)-&gt;e;
+     
+     return rxgk_prepare_packet(pkt, con, obj-&gt;level, k, e);
+ }
+ 
+ /*
+  * Verify checksums and/or decrypt packet.
+  */
+ static
+ int
+ client_CheckPacket(struct rx_securityClass *obj_,
+ 		   struct rx_call *call,
+ 		   struct rx_packet *pkt)
+ {
+     rxgk_clnt_class *obj = (rxgk_clnt_class *) obj_;
+     key_stuff *k = &amp;obj-&gt;k;
+     struct rx_connection *con = rx_ConnectionOf(call);
+     end_stuff *e = &amp;((clnt_con_data *) con-&gt;securityData)-&gt;e;
+     
+     return rxgk_check_packet(pkt, con, obj-&gt;level, k, e);
+ }
+ 
+ static
+ int
+ client_GetStats(const struct rx_securityClass *obj,
+ 		const struct rx_connection *con,
+ 		struct rx_securityObjectStats *st)
+ {
+     clnt_con_data *cdat = (clnt_con_data *) con-&gt;securityData;
+     
+     st-&gt;type = rxgk_disipline;
+     st-&gt;level = ((rxgk_clnt_class *)obj)-&gt;level;
+     st-&gt;flags = rxgk_checksummed;
+     if (cdat == 0)
+ 	st-&gt;flags |= rxgk_unallocated;
+     {
+ 	st-&gt;bytesReceived = cdat-&gt;e.bytesReceived;
+ 	st-&gt;packetsReceived = cdat-&gt;e.packetsReceived;
+ 	st-&gt;bytesSent = cdat-&gt;e.bytesSent;
+ 	st-&gt;packetsSent = cdat-&gt;e.packetsSent;
+     }
+     return 0;
+ }
+ 
+ static
+ struct rx_securityOps client_ops = {
+     client_Close,
+     client_NewConnection,
+     client_PreparePacket,
+     NULL,
+     NULL,
+     NULL,
+     NULL,
+     client_GetResponse,
+     NULL,
+     client_CheckPacket,
+     client_DestroyConnection,
+     client_GetStats,
+     NULL,
+     NULL,
+     NULL,
+ };
+ 
+ int rxgk_EpochWasSet = 0;
+ 
+ int rxgk_min_level = rxgk_crypt; /* rxgk_{auth,crypt} */ /* XXX */
+ 
+ struct rx_securityClass *
+ rxgk_k5_NewClientSecurityObject(/*rxgk_level*/ int level,
+ 				krb5_keyblock *key,
+ 				int32_t kvno,
+ 				int ticket_len,
+ 				void *ticket,
+ 				uint32_t serviceId,
+ 				krb5_context context)
+ {
+     rxgk_clnt_class *obj;
+     static int inited = 0;
+     int ret;
+     
+     if (level &lt; rxgk_min_level)
+ 	level = rxgk_min_level;	/* Boost security level */
+     
+     if (!inited) {
+ 	rx_SetEpoch(arc4random());
+ 	inited = 1;
+     }
+     
+     obj = (rxgk_clnt_class *) osi_Alloc(sizeof(rxgk_clnt_class));
+     obj-&gt;klass.refCount = 1;
+     obj-&gt;klass.ops = &amp;client_ops;
+     
+     obj-&gt;klass.privateData = (char *) obj;
+     
+     obj-&gt;context = context;
+     obj-&gt;level = level;
+     obj-&gt;kvno = kvno;
+     obj-&gt;serviceId = serviceId;
+     
+     ret = krb5_copy_keyblock_contents(context, key, &amp;obj-&gt;krb_key);
+     if (ret) {
+ 	osi_Free(obj, sizeof(rxgk_clnt_class));
+ 	return NULL;
+     }
+ 
+     memset(&amp;obj-&gt;k.ks_key, 0, sizeof(obj-&gt;k.ks_key));
+     obj-&gt;k.ks_crypto = NULL;
+ 
+     memset(&amp;obj-&gt;k.ks_skey, 0, sizeof(obj-&gt;k.ks_skey));
+     obj-&gt;k.ks_scrypto = NULL;
+     obj-&gt;k.ks_context = context;
+ 
+     obj-&gt;ticket.len = ticket_len;
+     obj-&gt;ticket.val = osi_Alloc(ticket_len);
+     memcpy(obj-&gt;ticket.val, ticket, obj-&gt;ticket.len);
+     
+     return &amp;obj-&gt;klass;
+ }
Index: openafs/src/rxgk/rxgk_common.c
diff -c /dev/null openafs/src/rxgk/rxgk_common.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_common.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,392 ----
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  * 
+  * Redistribution is not permitted
+  */
+ 
+ #include "rxgk_locl.h"
+ 
+ RCSID("$Id: rxgk_common.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ #include &lt;errno.h&gt;
+ 
+ #include &lt;rx/rx.h&gt;
+ #include "rxgk_proto.h"
+ 
+ /*
+  *
+  */
+ 
+ int rxgk_key_contrib_size = 16;
+ 
+ /*
+  *
+  */
+ 
+ int
+ rxk5_mutual_auth_client_generate(krb5_context context, krb5_keyblock *key,
+ 				 uint32_t number,
+ 				 RXGK_Token *challage_token)
+ {
+     krb5_crypto crypto;
+     krb5_data data;
+     RXGK_CHALLENGE_TOKEN ct;
+     char buf[RXGK_CHALLENGE_TOKEN_MAX_SIZE];
+     size_t sz;
+     int ret;
+ 
+     data.data = NULL;
+ 
+     ret = krb5_crypto_init (context, key, key-&gt;keytype, &amp;crypto);
+     if (ret)
+ 	return ret;
+     
+     ct.ct_version = RXGK_CR_TOKEN_VERSION;
+     ct.ct_nonce = number;
+     ct.ct_enctype.val = malloc(sizeof(ct.ct_enctype.val[0]));
+     ct.ct_enctype.len = 1;
+     if (ct.ct_enctype.val == NULL) {
+ 	ret = ENOMEM;
+ 	goto out;
+     }
+     ct.ct_enctype.val[0] = RXGK_CRYPTO_DES_CBC_CRC;
+     
+     sz = RXGK_CHALLENGE_TOKEN_MAX_SIZE;
+     if (ydr_encode_RXGK_CHALLENGE_TOKEN(&amp;ct, buf, &amp;sz) == NULL) {
+ 	ret = ENOMEM;
+ 	goto out;
+     }
+     sz = RXGK_CHALLENGE_TOKEN_MAX_SIZE - sz;
+ 
+     ret = krb5_encrypt(context, crypto, 0, buf, sz, &amp;data);
+     if (ret)
+ 	goto out;
+     
+     challage_token-&gt;val = malloc(data.length);
+     if (challage_token-&gt;val == NULL) {
+ 	ret = ENOMEM;
+ 	goto out;
+     }
+ 
+     challage_token-&gt;len = data.length;
+     memcpy(challage_token-&gt;val, data.data, data.length);
+ 
+  out:
+     ydr_free_RXGK_CHALLENGE_TOKEN(&amp;ct);
+     if (data.data)
+ 	krb5_data_free(&amp;data);
+     krb5_crypto_destroy(context, crypto);
+     return ret;
+ }
+ 
+ /*
+  *
+  */
+ 
+ int
+ rxk5_mutual_auth_client_check(krb5_context context, krb5_keyblock *key,
+ 			      uint32_t number,
+ 			      const RXGK_Token *challage_token,
+ 			      krb5_keyblock *rxsession_key)
+ {
+     krb5_crypto crypto;
+     krb5_data data;
+     RXGK_REPLY_TOKEN rt;
+     size_t sz;
+     int ret;
+ 
+     memset(&amp;rt, 0, sizeof(rt));
+     memset(rxsession_key, 0, sizeof(*rxsession_key));
+ 
+     ret = krb5_crypto_init (context, key, key-&gt;keytype, &amp;crypto);
+     if (ret)
+ 	return ret;
+     
+     /* Decrypt ticket */
+     data.data = NULL;
+     ret = krb5_decrypt(context, crypto, 0,
+ 		       challage_token-&gt;val, challage_token-&gt;len,
+ 		       &amp;data);
+     if (ret)
+ 	goto out;
+ 
+     sz = data.length;
+     if (ydr_decode_RXGK_REPLY_TOKEN(&amp;rt, data.data, &amp;sz) == NULL) {
+ 	ret = RXGKSEALEDINCON;
+ 	goto out;
+     }
+ 
+     if (rt.rt_nonce != number + 1) {
+ 	ret = RXGKSEALEDINCON;
+ 	goto out2;
+     }
+ 
+     if (rt.rt_error != 0) {
+ 	ret = rt.rt_error;
+ 	goto out2;
+     }
+ 
+ #if 1
+     /* XXX check rt_enctype */
+     ret = rxgk_random_to_key(rt.rt_enctype, 
+ 			     rt.rt_key.val, rt.rt_key.len,
+ 			     rxsession_key);
+ #else
+     ret = krb5_copy_keyblock_contents(context, key, rxsession_key);
+ #endif
+ 
+  out2:
+     ydr_free_RXGK_REPLY_TOKEN(&amp;rt);
+  out:
+     if (data.data)
+ 	krb5_data_free(&amp;data);
+     krb5_crypto_destroy(context, crypto);
+ 
+     return ret;
+ }
+ 
+ /*
+  *
+  */
+ 
+ int
+ rxk5_mutual_auth_server(krb5_context context, krb5_keyblock *key,
+ 			const RXGK_Token *challage_token,
+ 			int *session_enctype, 
+ 			void **session_key, size_t *session_key_size,
+ 			RXGK_Token *reply_token)
+ {
+     krb5_crypto crypto;
+     krb5_data data;
+     krb5_keyblock keyblock;
+     RXGK_CHALLENGE_TOKEN ct;
+     RXGK_REPLY_TOKEN rt;
+     char buf[RXGK_REPLY_TOKEN_MAX_SIZE];
+     size_t sz;
+     int ret;
+ 
+     memset(&amp;rt, 0, sizeof(rt));
+     memset(&amp;ct, 0, sizeof(ct));
+ 
+     *session_enctype = 0;
+     *session_key = NULL;
+     *session_key_size = 0;
+ 
+     keyblock.keyvalue.data = NULL;
+ 
+     sz = RXGK_CHALLENGE_TOKEN_MAX_SIZE - sz;
+ 
+     ret = krb5_crypto_init (context, key, key-&gt;keytype, &amp;crypto);
+     if (ret)
+ 	return ret;
+     
+     /* Decrypt ticket */
+     data.data = NULL;
+     ret = krb5_decrypt(context, crypto, 0,
+ 		       challage_token-&gt;val, challage_token-&gt;len,
+ 		       &amp;data);
+     if (ret)
+ 	goto out;
+ 
+     sz = data.length;
+     if (ydr_decode_RXGK_CHALLENGE_TOKEN(&amp;ct, data.data, &amp;sz) == NULL) {
+ 	memset(&amp;ct, 0, sizeof(ct));
+ 	ret = ENOMEM;
+ 	goto out;
+     }
+     sz = data.length - sz;
+ 
+     krb5_data_free(&amp;data);
+     data.data = NULL;
+ 
+     if (ct.ct_version &lt; RXGK_CR_TOKEN_VERSION) {
+ 	ret = RXGKSEALEDINCON;
+ 	goto out;
+     } else
+ 	ret = 0;
+ 
+     /* XXX choose best enctype, not just the one we use now */
+     { 
+ 	int i;
+ 
+ 	for (i = 0; i &lt; ct.ct_enctype.len ; i++) {
+ 	    if (ct.ct_enctype.val[i] == key-&gt;keytype)
+ 		break;
+ 	}
+ 
+ 	if (i == ct.ct_enctype.len)
+ 	    ret = RXGKSEALEDINCON;
+     }
+ 
+     rt.rt_version = RXGK_CR_TOKEN_VERSION;
+     rt.rt_nonce = ct.ct_nonce + 1;
+ 
+     rt.rt_key.len = 0;
+     rt.rt_key.val = NULL;
+     rt.rt_error = ret;
+ 
+     if (ret == 0) {
+ 	ret = krb5_generate_random_keyblock(context, 
+ 					    key-&gt;keytype,
+ 					    &amp;keyblock);
+ 	if (ret == 0) {
+ 	    rt.rt_enctype = keyblock.keytype;
+ 	    rt.rt_key.len = keyblock.keyvalue.length;
+ 	    rt.rt_key.val = keyblock.keyvalue.data;
+ 
+ 	    *session_enctype = keyblock.keytype;
+ 	    *session_key_size = keyblock.keyvalue.length;
+ 	    *session_key = malloc(keyblock.keyvalue.length);
+ 	    if (*session_key == NULL)
+ 		abort();
+ 	    memcpy(*session_key, keyblock.keyvalue.data, 
+ 		   keyblock.keyvalue.length);
+ 	} else {
+ 	    rt.rt_error = ret;
+ 	}
+     }
+ 
+     sz = RXGK_REPLY_TOKEN_MAX_SIZE;
+     if (ydr_encode_RXGK_REPLY_TOKEN(&amp;rt, buf, &amp;sz) == 0) {
+ 	ret = ENOMEM;
+ 	goto out;
+     }
+     sz = RXGK_REPLY_TOKEN_MAX_SIZE - sz;
+ 
+     memset(rt.rt_key.val, 0, rt.rt_key.len);
+ 
+     data.data = NULL;
+     ret = krb5_encrypt(context, crypto, 0, buf, sz, &amp;data);
+     if (ret)
+ 	goto out;
+     
+     reply_token-&gt;val = malloc(data.length);
+     if (reply_token-&gt;val == NULL) {
+ 	ret = ENOMEM;
+ 	goto out;
+     }
+ 
+     reply_token-&gt;len = data.length;
+     memcpy(reply_token-&gt;val, data.data, data.length);
+ 
+  out:
+     ydr_free_RXGK_CHALLENGE_TOKEN(&amp;ct);
+     /* ydr_free_RXGK_REPLY_TOKEN(&amp;rt); */
+ 
+     if (data.data)
+ 	krb5_data_free(&amp;data);
+     if (keyblock.keyvalue.data)
+ 	krb5_free_keyblock_contents(context, &amp;keyblock);
+     krb5_crypto_destroy(context, crypto);
+     return ret;
+ }
+ 
+ /*
+  *
+  */
+ 
+ void
+ rxgk_getheader(struct rx_packet *pkt, struct rxgk_header_data *h)
+ {
+   uint32_t t;
+ 
+   /* Collect selected packet fields */
+   h-&gt;call_number = htonl(pkt-&gt;header.callNumber);
+   t = ((pkt-&gt;header.cid &amp; RX_CHANNELMASK) &lt;&lt; (32 - RX_CIDSHIFT))
+     | ((pkt-&gt;header.seq &amp; 0x3fffffff));
+   h-&gt;channel_and_seq = htonl(t);
+ }
+ 
+ /*
+  *
+  */
+ 
+ #if 0
+ int
+ rxgk_derive_transport_key(krb5_context context,
+ 			  krb5_keyblock *rx_conn_key,
+ 			  RXGK_rxtransport_key *keycontrib,
+ 			  krb5_keyblock *rkey)
+ {
+     krb5_error_code ret;
+ 
+     /* XXX heimdal broken doesn't implement derive key for des encrypes */
+ 
+     switch (rx_conn_key-&gt;keytype) {
+     case RXGK_CRYPTO_DES_CBC_CRC:
+     case RXGK_CRYPTO_DES_CBC_MD4:
+     case RXGK_CRYPTO_DES_CBC_MD5:
+ 	ret = krb5_copy_keyblock_contents(context, rx_conn_key, rkey);
+ 	if (ret)
+ 	    abort();
+ 
+ 	break;
+     default: {
+ 	char rxk_enc[RXGK_RXTRANSPORT_KEY_MAX_SIZE];
+ 	size_t sz;
+ 	krb5_keyblock *key;
+ 	
+ 	sz = RXGK_RXTRANSPORT_KEY_MAX_SIZE;
+ 	if (ydr_encode_RXGK_rxtransport_key(keycontrib, rxk_enc, &amp;sz) == NULL)
+ 	    return EINVAL;
+ 	
+ 	sz = RXGK_RXTRANSPORT_KEY_MAX_SIZE - sz;
+ 
+ 	ret = krb5_derive_key (context,
+ 			       rx_conn_key,
+ 			       rx_conn_key-&gt;keytype,
+ 			       rxk_enc,
+ 			       sz,
+ 			       &amp;key);
+ 	if (ret)
+ 	    abort();
+ 	
+ 	ret = krb5_copy_keyblock_contents(context, key, rkey);
+ 	if (ret)
+ 	    abort();
+ 	
+ 	krb5_free_keyblock(context, key);
+ 	break;
+     }
+     }
+ 
+     return ret;
+ }
+ #endif
+ 
+ /*
+  *
+  */
+ 
+ 
+ /* XXX replace me */
+ 
+ int
+ rxgk_random_to_key(int enctype, 
+ 		   void *random_data, int random_sz,
+ 		   krb5_keyblock *key)
+ {
+     memset(key, 0, sizeof(*key));
+ 
+     switch (enctype) {
+     case RXGK_CRYPTO_DES_CBC_CRC:
+     case RXGK_CRYPTO_DES_CBC_MD4:
+     case RXGK_CRYPTO_DES_CBC_MD5:
+ 	if (random_sz != 8)
+ 	    return RXGKINCONSISTENCY;
+ 	break;
+     default:
+ 	    return RXGKINCONSISTENCY;
+     }
+ 
+     key-&gt;keyvalue.data = malloc(random_sz);
+     if (key-&gt;keyvalue.data == NULL)
+ 	return ENOMEM;
+     memcpy(key-&gt;keyvalue.data, random_data, random_sz);
+     key-&gt;keyvalue.length = random_sz;
+     key-&gt;keytype = enctype;
+ 
+     return 0;
+ }
Index: openafs/src/rxgk/rxgk_crkrb.c
diff -c /dev/null openafs/src/rxgk/rxgk_crkrb.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_crkrb.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,255 ----
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  *
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  *
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  *
+  * 3. Neither the name of the university nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+ 
+ /*
+  * Heimdal implementation of the rxgk wire encryption
+  */
+ 
+ #include "rxgk_locl.h"
+ #include &lt;errno.h&gt;
+ 
+ RCSID("$Id: rxgk_crkrb.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ struct _rxg_key_type {
+     char *name;
+     int enctype;
+     int blocklen;
+     int checksumlen;
+     int confounderlen;
+ };
+ 
+ static struct _rxg_key_type ktypes[] = {
+     { "des-cbc-crc", RXGK_CRYPTO_DES_CBC_CRC,
+       8, 4, 8,
+     },
+     { "des-cbc-md5", RXGK_CRYPTO_DES_CBC_MD5,
+       8, 24, 8,
+     }
+ };
+ 
+ static struct _rxg_key_type *
+ _rxg_find_enctype(int enctype)
+ {
+     struct _rxg_key_type *key;
+ 
+     for (key = ktypes; key-&gt;name != NULL; key++)
+ 	if (key-&gt;enctype == enctype)
+ 	    return key;
+     return NULL;
+ }
+ 
+ int
+ rxgk_set_conn(struct rx_connection *con, int enctype, int enc)
+ {
+     struct _rxg_key_type *key;
+ 
+     key = _rxg_find_enctype(enctype);
+     if (key == NULL)
+ 	return ENOENT;
+ 
+     if (enc) {
+ 	rx_SetSecurityHeaderSize(con, key-&gt;checksumlen + key-&gt;confounderlen +
+ 				 RXGK_HEADER_DATA_SIZE);
+ 
+ 	rx_SetSecurityMaxTrailerSize(con, key-&gt;blocklen);
+     } else {
+ 	rx_SetSecurityHeaderSize(con, 
+ 				 key-&gt;checksumlen + RXGK_HEADER_DATA_SIZE);
+ 	rx_SetSecurityMaxTrailerSize(con, 0);
+     }
+     return 0;
+ }
+ 
+ /*
+  *
+  */
+ 
+ static int
+ uiomove_to(struct rx_packet *pkt, u_int pre, u_int off, void **p, u_int *rlen)
+ {
+     u_int len;
+     void *ptr;
+ 
+     len = rx_GetDataSize(pkt);
+     *rlen = len + pre;
+ 
+     ptr = malloc(*rlen);
+     if (ptr == NULL)
+ 	return ENOMEM;
+ 
+     *p = ptr;
+ 
+     ptr = (char *)ptr + pre;
+ 
+     if (rx_SlowReadPacket(pkt, off, len, ptr) != len) {
+ 	free(p);
+ 	*p = NULL;
+ 	return RXGKPACKETSHORT;
+     }
+     
+     return 0;
+ }
+ 
+ /*
+  *
+  */
+ 
+ static int
+ uiomove_from(struct rx_packet *pkt, u_int off, void *ptr, u_int len)
+ {
+     if (rx_SlowWritePacket(pkt, off, len, ptr) != len)
+ 	return RXGKPACKETSHORT;
+     rx_SetDataSize(pkt, len + off);
+ 
+     return 0;
+ }
+ 
+ /*
+  *
+  */
+ int
+ rxgk_prepare_packet(struct rx_packet *pkt, struct rx_connection *con,
+ 		    int level, key_stuff *k, end_stuff *e)
+ {
+     int ret, keyusage;
+     
+     
+ 
+     if (k-&gt;ks_scrypto == NULL)
+ 	return RXGKSEALEDINCON;
+ 
+     if (level == rxgk_crypt) {
+ 	krb5_data data;
+ 	struct rxgk_header_data hdr;
+ 	u_int len;
+ 	void *p;
+ 
+ 	if (rx_IsClientConn(con))
+ 	    keyusage = RXGK_CLIENT_ENC_PACKETS;
+ 	else
+ 	    keyusage = RXGK_SERVER_ENC_PACKETS;
+ 
+ 	ret = uiomove_to(pkt, RXGK_HEADER_DATA_SIZE, 
+ 			 rx_GetSecurityHeaderSize(con),
+ 			 &amp;p, &amp;len);
+ 	if (ret)
+ 	    return ret;
+ 
+ 	rxgk_getheader(pkt, &amp;hdr);
+ 	memcpy(p, &amp;hdr, sizeof(hdr));
+ 
+ 	ret = krb5_encrypt(k-&gt;ks_context, k-&gt;ks_scrypto, 
+ 			   keyusage, p, len, &amp;data);
+ 	if (ret) {
+ 	    free(p);
+ 	    return ret;
+ 	}
+ 
+ 	ret = uiomove_from(pkt, 0, data.data, data.length);
+ 
+ 	krb5_data_free(&amp;data);
+ 	free(p);
+ 
+     } else if (level == rxgk_auth) {
+ 	if (rx_IsClientConn(con))
+ 	    keyusage = RXGK_CLIENT_CKSUM_PACKETS;
+ 	else
+ 	    keyusage = RXGK_SERVER_CKSUM_PACKETS;
+ 
+ 	abort();
+     } else
+ 	abort();
+ 
+     return ret;
+ }
+ 
+ /*
+  *
+  */
+ int
+ rxgk_check_packet(struct rx_packet *pkt, struct rx_connection *con,
+ 		  int level, key_stuff *k, end_stuff *e)
+ {
+     int ret, keyusage;
+     
+     if (k-&gt;ks_scrypto == NULL)
+ 	return RXGKSEALEDINCON;
+ 
+     ret = 0;
+ 
+     if (level == rxgk_crypt) {
+ 	krb5_data data;
+ 	struct rxgk_header_data hdr;
+ 	u_int len;
+ 	void *p;
+ 
+ 	if (rx_IsClientConn(con))
+ 	    keyusage = RXGK_SERVER_ENC_PACKETS;
+ 	else
+ 	    keyusage = RXGK_CLIENT_ENC_PACKETS;
+ 
+ 	ret = uiomove_to(pkt, 0, 0, &amp;p, &amp;len);
+ 	if (ret)
+ 	    return ret;
+ 
+ 	ret = krb5_decrypt(k-&gt;ks_context, k-&gt;ks_scrypto, 
+ 			   keyusage, p, len, &amp;data);
+ 	if (ret) {
+ 	    free(p);
+ 	    return ret;
+ 	}
+ 
+ 	ret = uiomove_from(pkt, rx_GetSecurityHeaderSize(con) - 
+ 			   RXGK_HEADER_DATA_SIZE,
+ 			   data.data, data.length);
+ 	if (ret == 0) {
+ 	    rxgk_getheader(pkt, &amp;hdr);
+ 	    if (memcmp(&amp;hdr, data.data, sizeof(hdr)) != 0)
+ 		ret = RXGKSEALEDINCON;
+ 	}
+ 
+ 	krb5_data_free(&amp;data);
+ 	free(p);
+     } else if (level == rxgk_auth) {
+ 	if (rx_IsClientConn(con))
+ 	    keyusage = RXGK_SERVER_CKSUM_PACKETS;
+ 	else
+ 	    keyusage = RXGK_CLIENT_CKSUM_PACKETS;
+ 
+ 
+ 	abort();
+     } else
+ 	abort();
+ 
+     return ret;
+ }
Index: openafs/src/rxgk/rxgk_crlha.c
diff -c /dev/null openafs/src/rxgk/rxgk_crlha.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_crlha.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,447 ----
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  *
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  *
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  *
+  * 3. Neither the name of the university nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+ 
+ #include "rxgk_locl.h"
+ 
+ RCSID("$Id: rxgk_crlha.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ #include &lt;openssl/md5.h&gt;
+ #include &lt;openssl/des.h&gt;
+ 
+ #include &lt;errno.h&gt;
+ 
+ /*
+  *	krb5 non-des encrypting:
+  *
+  * 	+------------+----------+-------+---------+-----+
+  *	| confounder | checksum | rxhdr | msg-seq | pad |
+  *	+------------+----------+-------+---------+-----+
+  *
+  *	krb5 non-des checksuming only:
+  *
+  * 	+----------+-------+---------+
+  *	| checksum | rxhdr | msg-seq |
+  *	+----------+-------+---------+
+  *
+  *	XXX THIS SHOULD BE FIXED
+  *	so, the checksuming only case includes unnessery data right
+  *	now but I don't care since that makes it easier for me to
+  *	share code between the two cases.
+  *
+  */
+ 
+ struct rxg_key_type;
+ 
+ struct rxg_des_keystuff {
+     des_cblock key;
+     des_key_schedule sched;
+     des_key_schedule chksum;
+     des_cblock iv[RX_MAXCALLS];
+ };
+ 
+ struct rxg_key {
+     struct rxg_key_type *type;
+     rxgk_level level;
+     union {
+ 	struct rxg_des_keystuff des;
+     } key;
+ };
+ 
+ #define RXG_MAX_CHECKSUM_SIZE	128
+ 
+ struct rxg_con {
+     struct rxg_key key;
+     struct rxg_key_type *type;
+ };
+ 
+ int
+ rxg_PacketCheckSum(struct rxg_key_type *, struct rx_packet *, 
+ 		   struct rxg_key *, void *, size_t, int);
+ int
+ rxg_check_packet(struct rx_packet *pkt,
+ 		 struct rx_connection *con,
+ 		 int clear,
+ 		 struct rxg_con *kc);
+ int
+ rxg_prepare_packet(struct rx_packet *pkt,
+ 		   struct rx_connection *con,
+ 		   int clear,
+ 		   struct rxg_con *kc);
+ 
+ static void rxg_des_enc(void *, size_t, struct rxg_key *, void *, int);
+ static void des_setup_iv(struct rx_packet *, struct rxg_key *, void *);
+ static void des_prepare_key(struct rxg_key *, void *);
+ static int checksum_pkt_md5_des(struct rx_packet *, struct rxg_key *, 
+ 				void *, size_t, int);
+ struct rxg_key_type * rxg_find_enctype(int);
+ 
+ struct rxg_key_type {
+     char *name;
+     int enctype;
+     int keylen;
+     int blocklen;
+     int checksumlen;
+     int confounderlen;
+     int ivsize;
+     void (*prepare_key)(struct rxg_key *, void *key);
+     void (*setup_iv)(struct rx_packet *, struct rxg_key *, void *iv);
+     void (*encrypt)(void *, size_t, struct rxg_key *, void *, int);
+     int (*cksum_pkt)(struct rx_packet *, struct rxg_key *,void *,size_t,int);
+ };
+ 
+ static struct rxg_key_type ktypes[] = {
+     { "des-cbc-crc", RXGK_CRYPTO_DES_CBC_MD5,
+       8, 8, 24, 8, 8,
+       des_prepare_key, des_setup_iv, rxg_des_enc, checksum_pkt_md5_des
+     }
+ };
+ 
+ struct rxg_key_type *
+ rxg_find_enctype(int enctype)
+ {
+     struct rxg_key_type *key;
+ 
+     for (key = ktypes; key-&gt;name != NULL; key++)
+ 	if (key-&gt;enctype == enctype)
+ 	    return key;
+     return NULL;
+ }
+ 
+ static void
+ rxg_des_enc(void *io, size_t sz, struct rxg_key *key, void *iv, int enc)
+ {
+     struct rxg_des_keystuff *ks = &amp;key-&gt;key.des;
+ 
+     assert((sz % 8) == 0);
+     des_cbc_encrypt(io, io, sz, ks-&gt;sched, iv, enc);
+ }
+ 
+ static void
+ des_prepare_key(struct rxg_key *key, void *keym)
+ {
+     struct rxg_des_keystuff *ks;
+     des_cblock cksumkey;
+     int i;
+ 
+     ks = &amp;key-&gt;key.des;
+ 
+     memset(ks, 0, sizeof(*ks));
+ 
+     memcpy(ks-&gt;key, keym, sizeof(des_cblock));
+     des_set_key(&amp;ks-&gt;key, ks-&gt;sched);
+     memset(ks-&gt;iv, 0, sizeof(ks-&gt;iv));
+ 
+     for (i = 0; i &lt; 8; i++)
+ 	cksumkey[i] = ((char *)keym)[i] ^ 0xF0;
+ 
+     des_set_key(&amp;cksumkey, ks-&gt;chksum);
+ }
+ 
+ static void
+ des_setup_iv(struct rx_packet *pkt, struct rxg_key *key, void *iv)
+ {
+     memset(iv, 0, sizeof(des_cblock));
+ }
+ 
+ static void
+ rxg_random_data(void *ptr, size_t sz)
+ {
+     memset(ptr, 0, sz);
+     abort();
+ }
+ 
+ 
+ static int
+ encrypt_pkt(struct rxg_key_type *kt, struct rx_packet *pkt, 
+ 	    struct rxg_key *key, int encrypt)
+ {
+     u_int len = rx_GetDataSize(pkt);
+     struct iovec *frag;
+     void *iv;
+ 
+     if ((iv = malloc(kt-&gt;ivsize)) == NULL)
+ 	return ENOMEM;
+ 
+     (kt-&gt;setup_iv)(pkt, key, iv);
+ 
+     assert((len % kt-&gt;blocklen) == 0);
+ 
+     for (frag = &amp;pkt-&gt;wirevec[1]; len; frag++)
+     {
+ 	int      iov_len = frag-&gt;iov_len;
+ 	uint32_t *iov_bas = (uint32_t *) frag-&gt;iov_base;
+ 	if (iov_len == 0) {
+ 	    memset(iv, 0, kt-&gt;ivsize);
+ 	    free(iv);
+ 	    return RXGKPACKETSHORT;	/* Length mismatch */
+ 	}
+ 	if (len &lt; iov_len)
+ 	    iov_len = len;		/* Don't process to much data */
+ 
+ 	assert((iov_len % kt-&gt;blocklen) == 0);
+ 
+ 	(*kt-&gt;encrypt)(iov_bas, iov_len, key, iv, encrypt);
+ 	len -= iov_len;
+     }
+     memset(iv, 0, kt-&gt;ivsize);
+     free(iv);
+     return 0;
+ }
+ 
+ #define MAXCONFOUNDER		50
+ 
+ struct variable_header_data {
+     /* Data that changes per packet */
+     uint32_t call_number;
+     uint32_t channel_and_seq;
+ };
+ 
+ static void
+ getheader(struct rx_packet *pkt, struct variable_header_data *h)
+ {
+   uint32_t t;
+ 
+   /* Collect selected packet fields */
+   h-&gt;call_number = htonl(pkt-&gt;header.callNumber);
+   t = ((pkt-&gt;header.cid &amp; RX_CHANNELMASK) &lt;&lt; (32 - RX_CIDSHIFT))
+     | ((pkt-&gt;header.seq &amp; 0x3fffffff));
+   h-&gt;channel_and_seq = htonl(t);
+ }
+ 
+ 
+ /* des-cbc(key XOR 0xF0F0F0F0F0F0F0F0, conf | rsa-md5(conf | msg)) */
+ 
+ static int
+ checksum_pkt_md5_des(struct rx_packet *pkt, struct rxg_key *key, 
+ 		     void *checksum, size_t checksumlen, int encrypt)
+ {
+     struct rxg_des_keystuff *ks;
+     u_int len = rx_GetDataSize(pkt);
+     struct iovec *frag;
+     des_cblock iv;
+     MD5_CTX c;
+     int cksumsz;
+ 
+     ks = &amp;key-&gt;key.des;
+     cksumsz = key-&gt;type-&gt;checksumlen;
+ 
+     assert(cksumsz == 24);
+ 
+     memset(&amp;iv, 0, sizeof(iv));
+ 
+     MD5_Init(&amp;c);
+ 
+     for (frag = &amp;pkt-&gt;wirevec[1]; len; frag++)
+     {
+ 	int   iov_len = frag-&gt;iov_len;
+ 	char *iov_bas = (char *) frag-&gt;iov_base;
+ 
+ 	if (iov_len == 0)
+ 	    return RXGKPACKETSHORT;		/* Length mismatch */
+ 	if (len &lt; iov_len)
+ 	    iov_len = len;		/* Don't process to much data */
+ 
+ 	MD5_Update(&amp;c, iov_bas, iov_len);
+ 	len -= iov_len;
+     }
+     MD5_Final(checksum, &amp;c);
+ 
+     des_cbc_encrypt(checksum, checksum, cksumsz, ks-&gt;chksum, &amp;iv, 1);
+ 
+     return 0;
+ }
+ 
+ 
+ int
+ rxg_PacketCheckSum(struct rxg_key_type *kt, struct rx_packet *pkt, 
+ 		   struct rxg_key *key, void *cksum, size_t cksumsz,
+ 		   int encrypt)
+ {
+     (*kt-&gt;cksum_pkt)(pkt, key, cksum, cksumsz, encrypt);
+     return 0;
+ }
+ 
+ int
+ rxg_check_packet(struct rx_packet *pkt,
+ 		 struct rx_connection *con,
+ 		 int encrypt,
+ 		 struct rxg_con *kc)
+ {
+     struct variable_header_data hd;
+     char sum[RXG_MAX_CHECKSUM_SIZE];
+     char sum2[RXG_MAX_CHECKSUM_SIZE];
+     char *base;
+     int ret;
+ 
+     if (rx_GetPacketCksum(pkt) != 0)
+ 	return RXGKSEALEDINCON;
+ 
+     if (encrypt) {
+ 	ret = encrypt_pkt(kc-&gt;type, pkt, &amp;kc-&gt;key, 0);
+ 	if (ret)
+ 	    return ret;
+     }
+     
+     base = pkt-&gt;wirevec[1].iov_base;
+     if (encrypt)
+ 	base += kc-&gt;type-&gt;confounderlen;
+     memcpy(sum, base, kc-&gt;type-&gt;checksumlen);
+     memset(base, 0, kc-&gt;type-&gt;checksumlen);
+ 
+     ret = rxg_PacketCheckSum(kc-&gt;type, pkt, &amp;kc-&gt;key, sum2, 
+ 			      kc-&gt;type-&gt;checksumlen, 0);
+     if (ret)
+ 	return ret;
+ 
+     if (memcmp(sum2, sum, kc-&gt;type-&gt;checksumlen) != 0)
+ 	return RXGKSEALEDINCON;
+ 
+     getheader(pkt, &amp;hd);
+     
+     if (memcmp(base + kc-&gt;type-&gt;checksumlen, &amp;hd, sizeof(hd)) != 0)
+ 	return RXGKSEALEDINCON;
+ 
+     return 0;
+ }
+ 
+ int
+ rxg_prepare_packet(struct rx_packet *pkt,
+ 		   struct rx_connection *con,
+ 		   int encrypt,
+ 		   struct rxg_con *kc)
+ {
+     char sum[RXG_MAX_CHECKSUM_SIZE];
+     u_int len = rx_GetDataSize(pkt);
+     int diff, ret;
+     struct variable_header_data hd;
+     char *base;
+ 
+     /* checksum in rx header is defined to 0 in rxgss */
+     rx_SetPacketCksum(pkt, 0);
+     
+     /* 
+      * First we fixup the packet size, its assumed that the checksum
+      * need to to the operation on blocklen too
+      */
+ 
+     len += rx_GetSecurityHeaderSize(con); /* Extended pkt len */
+ 	
+     if (encrypt) {
+ 	if ((diff = (len % kc-&gt;type-&gt;blocklen)) != 0) {
+ 	    rxi_RoundUpPacket(pkt, diff);
+ 	    len += diff;
+ 	}
+     }
+     rx_SetDataSize(pkt, len); /* Set extended packet length */
+ 
+     diff = kc-&gt;type-&gt;checksumlen + RXGK_HEADER_DATA_SIZE;
+     if (encrypt)
+ 	diff += kc-&gt;type-&gt;confounderlen;
+ 
+     if (pkt-&gt;wirevec[1].iov_len &lt; diff)
+ 	return RXGKPACKETSHORT;
+ 
+     base = pkt-&gt;wirevec[1].iov_base;
+     if (encrypt) {
+ 	rxg_random_data(base, kc-&gt;type-&gt;confounderlen);
+ 	base += kc-&gt;type-&gt;confounderlen;
+     }
+     memset(base, 0, kc-&gt;type-&gt;checksumlen);
+     base += kc-&gt;type-&gt;checksumlen;
+     getheader(pkt, &amp;hd);
+     memcpy(base, &amp;hd, sizeof(hd));
+ 
+     /* computer and store checksum of packet */
+     ret = rxg_PacketCheckSum(kc-&gt;type, pkt, &amp;kc-&gt;key, 
+ 			     sum, kc-&gt;type-&gt;checksumlen, 1);
+     if (ret)
+ 	return ret;
+ 
+     base = pkt-&gt;wirevec[1].iov_base;
+     if (encrypt)
+ 	base += kc-&gt;type-&gt;confounderlen;
+     memcpy(base, sum, kc-&gt;type-&gt;checksumlen);
+ 
+     if (!encrypt)
+ 	return 0;
+ 
+     return encrypt_pkt(kc-&gt;type, pkt, &amp;kc-&gt;key, 1);
+ }
+ 
+ int
+ rxgk_set_conn(struct rx_connection *con, int enctype, int enc)
+ {
+     struct rxg_key_type *key;
+ 
+     key = rxg_find_enctype(enctype);
+     if (key)
+ 	return ENOENT;
+ 
+     if (enc) {
+ 	rx_SetSecurityHeaderSize(con, key-&gt;checksumlen + key-&gt;confounderlen +
+ 				 RXGK_HEADER_DATA_SIZE);
+ 	rx_SetSecurityMaxTrailerSize(con, key-&gt;blocklen);
+     } else {
+ 	rx_SetSecurityHeaderSize(con, 
+ 				 key-&gt;checksumlen + RXGK_HEADER_DATA_SIZE);
+ 	rx_SetSecurityMaxTrailerSize(con, 0);
+     }
+     return 0;
+ }
+ 
+ 
+ int
+ rxgk_prepare_packet(struct rx_packet *pkt, struct rx_connection *con,
+ 		     int level, key_stuff *k, end_stuff *e)
+ {
+     return 0;
+ }
+ 
+ int
+ rxgk_check_packet(struct rx_packet *pkt, struct rx_connection *con,
+ 		   int level, key_stuff *k, end_stuff *e)
+ {
+     return 0;
+ }
+ 
+ 
+ #if 0
+ 
+ int
+ main(int argc, char **argv)
+ {
+     krb5_encrypt();
+     return 0;
+ }
+ 
+ #endif
Index: openafs/src/rxgk/rxgk_crpc.c
diff -c /dev/null openafs/src/rxgk/rxgk_crpc.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_crpc.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,61 ----
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  * 
+  * Redistribution is not permitted
+  */
+ 
+ #include "rxgk_locl.h"
+ 
+ RCSID("$Id: rxgk_crpc.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ #include &lt;rx/rx.h&gt;
+ #include "rxgk_proto.h"
+ #include "rxgk_proto.cs.h"
+ 
+ #include &lt;errno.h&gt;
+ 
+ int
+ rxgk5_get_auth_token(krb5_context context, uint32_t addr, int port, 
+ 		     uint32_t serviceId,
+ 		     RXGK_Token *token,
+ 		     RXGK_Token *auth_token, krb5_keyblock *key,
+ 		     krb5_keyblock *skey,
+ 		     int32_t *kvno)
+ {
+     struct rx_securityClass *secobj;
+     struct rx_connection *conn;
+     RXGK_Token challange, reply_token;
+     uint32_t num;
+     int ret;
+ 
+     memset(skey, 0, sizeof(*skey));
+ 
+     secobj = rxnull_NewClientSecurityObject();
+ 
+     conn = rx_NewConnection(addr, port, serviceId, secobj, 0);
+     if (conn == NULL)
+ 	return ENETDOWN;
+ 
+     num = arc4random();
+ 
+     ret = rxk5_mutual_auth_client_generate(context, key, num, &amp;challange);
+     if (ret) {
+ 	rx_DestroyConnection(conn);
+ 	return ret;
+     }
+ 
+     ret = RXGK_EstablishKrb5Context(conn, token, &amp;challange,
+ 				    &amp;reply_token, kvno, auth_token);
+     if (ret) {
+ 	rx_DestroyConnection(conn);
+ 	return ret;
+     }
+ 
+     ret = rxk5_mutual_auth_client_check(context, key, num, &amp;reply_token, skey);
+ 
+     rx_DestroyConnection(conn);
+ 
+     return ret;
+ }
Index: openafs/src/rxgk/rxgk_info.c
diff -c /dev/null openafs/src/rxgk/rxgk_info.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_info.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,59 ----
+ /*
+  * Copyright (c) 1995 - 1998, 2002 Kungliga Tekniska Högskolan
+  * (Royal Institute of Technology, Stockholm, Sweden).
+  * All rights reserved.
+  * 
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 
+  * 3. Neither the name of the Institute nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  * 
+  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ #include "rxgk_locl.h"
+ 
+ RCSID("$Id: rxgk_info.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ int32_t
+ rxgk_GetServerInfo(struct rx_connection *con,
+ 		   rxgk_level *level,
+ 		   uint32_t *expiration,
+ 		   char *name, size_t name_size,
+ 		   char *cell, size_t cell_size,
+ 		   int32_t *kvno)
+ {
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+ 
+     if (cdat &amp;&amp; cdat-&gt;authenticated
+ 	&amp;&amp; (time(0) &lt; cdat-&gt;expires))
+     {
+ 	if (level)
+ 	    *level = cdat-&gt;cur_level;
+ 	if (expiration)
+ 	    *expiration = cdat-&gt;expires;
+ 	return 0;
+     }
+   else
+     return RXGKNOAUTH;
+ }
Index: openafs/src/rxgk/rxgk_locl.h
diff -c /dev/null openafs/src/rxgk/rxgk_locl.h:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_locl.h	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,164 ----
+ /*
+  * Copyright (c) 1995 - 1998, 2002 Kungliga Tekniska Högskolan
+  * (Royal Institute of Technology, Stockholm, Sweden).
+  * All rights reserved.
+  * 
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 
+  * 3. Neither the name of the Institute nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  * 
+  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ /* $Id: rxgk_locl.h,v 1.1 2004/08/08 19:21:33 shadow Exp $ */
+ 
+ #ifndef __RXGK_LOCL_H
+ #define __RXGK_LOCL_H
+ 
+ #ifdef HAVE_CONFIG_H
+ #include &lt;config.h&gt;
+ #endif
+ 
+ #include &lt;stdlib.h&gt;
+ #include &lt;string.h&gt;
+ #include &lt;limits.h&gt;
+ 
+ #include &lt;sys/types.h&gt;
+ #include &lt;netinet/in.h&gt;
+ 
+ #include &lt;krb5.h&gt;
+ #include "rxgk_proto.h"
+ 
+ #ifdef NDEBUG
+ #ifndef assert
+ #define assert(e) ((void)0)
+ #endif
+ #else
+ #ifndef assert
+ #define assert(e) ((e) ? (void)0 : (void)osi_Panic("assert(%s) failed: file %s, line %d\n", #e, __FILE__, __LINE__, #e))
+ #endif
+ #endif
+ 
+ #undef RCSID
+ #include &lt;rx/rx.h&gt;
+ #include &lt;rx/rx_null.h&gt;
+ #undef RCSID
+ #define RCSID(msg) \
+ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
+ 
+ extern int rx_epoch, rx_nextCid;
+ 
+ #include "rxgk.h"
+ 
+ #define rxgk_disipline 3
+ 
+ #define rxgk_unallocated 1
+ #define rxgk_authenticated 2
+ #define rxgk_expired 4
+ #define rxgk_checksummed 8
+ 
+ typedef struct key_stuff {
+     krb5_context	ks_context;
+     krb5_keyblock	ks_key;
+     uint32_t		ks_recv_seqnum;
+     krb5_keyblock	ks_skey;
+     krb5_crypto		ks_crypto;	/* rx session key */
+     krb5_crypto		ks_scrypto;	/* rx stream key */
+ } key_stuff;
+ 
+ typedef struct end_stuff {
+     /* need 64 bit counters */
+     uint32_t bytesReceived, packetsReceived, bytesSent, packetsSent;
+ } end_stuff;
+ 
+ extern int rxgk_key_contrib_size;
+ 
+ int
+ rxgk_prepare_packet(struct rx_packet *pkt, struct rx_connection *con,
+ 		     int level, key_stuff *k, end_stuff *e);
+ 
+ int
+ rxgk_check_packet(struct rx_packet *pkt, struct rx_connection *con,
+ 		   int level, key_stuff *k, end_stuff *e);
+ 
+ /* Per connection specific server data */
+ typedef struct serv_con_data {
+   end_stuff e;
+   key_stuff k;
+   uint32_t expires;
+   uint32_t nonce;
+   rxgk_level cur_level;	/* Starts at min_level and can only increase */
+   char authenticated;
+ } serv_con_data;
+ 
+ /* rxgk */
+ 
+ int
+ rxgk5_get_auth_token(krb5_context context, uint32_t addr, int port, 
+ 		     uint32_t serviceId,
+ 		     RXGK_Token *token,
+ 		     RXGK_Token *auth_token, krb5_keyblock *key,
+ 		     krb5_keyblock *skey,
+ 		     int32_t *kvno);
+ 
+ int
+ rxk5_mutual_auth_client_generate(krb5_context context, krb5_keyblock *key,
+ 				 uint32_t number,
+ 				 RXGK_Token *challage_token);
+ int
+ rxk5_mutual_auth_client_check(krb5_context context, krb5_keyblock *key,
+ 			      uint32_t number,
+ 			      const RXGK_Token *reply_token,
+ 			      krb5_keyblock *rxsession_key);
+ int
+ rxk5_mutual_auth_server(krb5_context context, krb5_keyblock *key,
+ 			const RXGK_Token *challage_token,
+ 			int *enctype, 
+ 			void **session_key, size_t *session_key_size,
+ 			RXGK_Token *reply_token);
+ 
+ int
+ rxgk_set_conn(struct rx_connection *, int, int);
+ 
+ int
+ rxgk_decode_auth_token(void *data, size_t len, struct RXGK_AUTH_CRED *c);
+ 
+ void
+ rxgk_getheader(struct rx_packet *pkt, struct rxgk_header_data *h);
+ 
+ int
+ rxgk_server_init(void);
+ 
+ #if 0
+ int
+ rxgk_derive_transport_key(krb5_context context,
+ 			  krb5_keyblock *rx_conn_key,
+ 			  RXGK_rxtransport_key *keycontrib,
+ 			  krb5_keyblock *rkey);
+ #endif
+ 
+ int
+ rxgk_random_to_key(int, void *, int, krb5_keyblock *);
+ 
+ #endif /* __RXGK_LOCL_H */
Index: openafs/src/rxgk/rxgk_proto.xg
diff -c /dev/null openafs/src/rxgk/rxgk_proto.xg:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_proto.xg	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,202 ----
+ /* hej emacs det h{r {r en -*- c -*- fil */
+ 
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms Universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  * 
+  * Redistribution is not permitted
+  */
+ 
+ /* $Id: rxgk_proto.xg,v 1.1 2004/08/08 19:21:33 shadow Exp $ */
+ 
+ package RXGK_
+ 
+ const RXGK_MAX_TOKEN_LEN = 65536;
+ const RXGK_MAX_AUTHTOKEN = 256;
+ 
+ /* ctext is limited by mtu since its part of responce */
+ const RXGK_MAX_CTEXT	 = 768; 
+ 
+ const RXGK_SERVICE_ID   = 34567;
+ 
+ #define RXGK_ESTABLISH_KRB5_CONTEXT	1
+ #define RXGK_ESTABLISH_GSS_CONTEXT	2
+ #define RXGK_EXCHANGE_GSS_KEYS		3
+ 
+ typedef opaque RXGK_Token&lt;RXGK_MAX_TOKEN_LEN&gt;;
+ 
+ /*
+  *
+  */
+ 
+ const RXGK_KEY_VERSION		= 1;
+ const RXGK_KEY_MAXSIZE		= 256;
+ const RXGK_KEY_MAXPRINCIPAL	= 640;
+ const RXGK_KEY_ENCTYPES		= 32;
+ 
+ /*
+  * Challange token in the 
+  */
+ 
+ const RXGK_CR_TOKEN_VERSION	= 1;
+ 
+ struct RXGK_CHALLENGE_TOKEN {
+     afs_int32	ct_version;
+     afs_uint32	ct_nonce;
+     afs_uint32	ct_enctype&lt;RXGK_KEY_ENCTYPES&gt;;	/* listed in order of pref */
+ };
+ 
+ /*
+  * Reply token in the EstablishKrb5Context
+  */
+ 
+ struct RXGK_REPLY_TOKEN {
+     afs_int32	rt_version;
+     afs_int32	rt_flags;	/* other support ops */
+     afs_int32	rt_error;
+     afs_uint32	rt_nonce;
+     afs_uint32	rt_enctype;
+     opaque	rt_key&lt;RXGK_KEY_MAXSIZE&gt;;
+ };
+ 
+ /*
+  * Rx auth cred equivalent
+  */
+ 
+ struct RXGK_AUTH_CRED {
+     afs_int32	ac_version;	/* version of format of RXGK_AUTH_CRED */
+     string	ac_principal&lt;RXGK_KEY_MAXPRINCIPAL&gt;; /* prefixed with mech */
+     afs_int32	ac_starttime;
+     afs_int32	ac_endtime;
+     afs_int32	ac_enctype;
+     opaque	ac_key&lt;RXGK_KEY_MAXSIZE&gt;;
+ };
+ 
+ /*
+  * This is part of the rxs challange/response exchange.  Its somewhat
+  * complicated since it support rekeying of a data stream.
+  */
+ 
+ const RXGK_VERSION = 3;
+ 
+ const RXKG_OPCODE_CHALLENGE	= 1;
+ const RXKG_OPCODE_REKEY		= 2;
+ 
+ struct RXGK_Challenge {
+     afs_uint32	rc_version;
+     afs_uint32	rc_nonce;
+     afs_uint32	rc_opcode;
+     afs_uint32	rc_max_seq_skew;	/* packets accepted when rekey */
+     afs_uint32	rc_min_level;
+ };
+ 
+ /* is the auth_token EstablishKrb5Context returned */
+ struct RXGK_Response {
+     afs_uint32	rr_version;
+     afs_uint32	rr_auth_token_kvno;
+     opaque	rr_auth_token&lt;RXGK_MAX_AUTHTOKEN&gt;;
+     opaque	rr_ctext&lt;RXGK_MAX_CTEXT&gt;;
+ };
+ 
+ struct RXGK_Response_Crypt {
+     afs_uint32	nonce;
+     afs_uint32  epoch;
+     afs_uint32  cid;
+     afs_uint32	call_numbers[4];
+     afs_uint32	level;
+     afs_uint32	key_version;
+     afs_uint32	key_counter_hi;
+     afs_uint32	key_counter_lo;
+ };
+ 
+ /*
+  * Kerberos crypto framework enctypes 
+  */
+ 
+ const RXGK_CRYPTO_NULL			= 0;
+ const RXGK_CRYPTO_DES_CBC_CRC		= 1;
+ const RXGK_CRYPTO_DES_CBC_MD4		= 2;
+ const RXGK_CRYPTO_DES_CBC_MD5		= 4;
+ const RXGK_CRYPTO_DES3_SHA1_KD		= 16;
+ 
+ const RXGK_CRYPTO_CKSUM_RSA_DES_MD5	= 8;
+ 
+ const RXGK_CLIENT_TO_SERVER		= 0;
+ const RXGK_SERVER_TO_CLIENT		= 1;
+ 
+ const RXGK_CLIENT_ENC_CHALLENGE		= 1026;
+ const RXGK_SERVER_ENC_REKEY		= 1026;
+ const RXGK_CLIENT_ENC_PACKETS		= 1027;
+ const RXGK_CLIENT_CKSUM_PACKETS		= 1028;
+ const RXGK_SERVER_ENC_PACKETS		= 1029;
+ const RXGK_SERVER_CKSUM_PACKETS		= 1030;
+ 
+ /*
+  * In packet protection since header isn't checksum-ed
+  */
+ 
+ struct rxgk_header_data {
+     uint32_t call_number;
+     uint32_t channel_and_seq;
+ };
+ 
+ /*
+  * rx connection key
+  */
+ 
+ struct RXGK_rxconn_key {
+     afs_uint32 rxk_cid;
+     afs_uint32 rxk_epoch;
+ };
+ 
+ #if 0
+ 
+ const RXGK_MAX_KEYCONTRIB= 256; /* MUST only be used from server-&gt;client */
+ 
+ struct RXGK_ReKey {
+     opaque	rk_ctext&lt;RXGK_MAX_CTEXT&gt;;
+ };
+ 
+ struct RXGK_ReKey_Crypt {
+     afs_int32	rkc_version;
+     afs_int32	rkc_max_seq_num;
+     afs_int32	rkc_kvno;		/* 16 bit number */
+     opaque	rkc_keycontribution&lt;RXGK_MAX_KEYCONTRIB&gt;;
+ };
+ 
+ /* rx transport key */
+ 
+ struct RXGK_rxtransport_key {
+     opaque	client_keycontribution&lt;RXGK_MAX_KEYCONTRIB&gt;;
+     opaque	server_keycontribution&lt;RXGK_MAX_KEYCONTRIB&gt;;
+ };
+ 
+ #endif
+ 
+ /*
+  * kerberos auth_token
+  */
+ 
+ EstablishKrb5Context(IN RXGK_Token *token, 
+ 		     IN RXGK_Token *challenge_token,
+ 		     OUT RXGK_Token *reply_token,
+ 		     OUT int32_t *auth_token_kvno,
+ 		     OUT RXGK_Token *auth_token) = RXGK_ESTABLISH_KRB5_CONTEXT;
+ 
+ /*
+  * Add gss stuff here
+  */
+ 
+ #if 0
+ 
+ EstablishGssContext(IN RXGK_Token *in_token,
+ 		    OUT RXGK_Token *out_token) = RXGK_ESTABLISH_GSS_CONTEXT;
+ 
+ ExchangeGSSKeys(IN RXGK_Token *challenge_token,
+ 		OUT RXGK_Token *reply_token,
+ 		OUT int32_t *auth_token_kvno,
+ 		OUT RXGK_Token *auth_token) = RXGK_EXCHANGE_GSS_KEYS;
+ 
+ #endif
+ 
Index: openafs/src/rxgk/rxgk_serv.c
diff -c /dev/null openafs/src/rxgk/rxgk_serv.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_serv.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,498 ----
+ /*
+  * Copyright (c) 1995 - 1998, 2002 Kungliga Tekniska Högskolan
+  * (Royal Institute of Technology, Stockholm, Sweden).
+  * All rights reserved.
+  * 
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 
+  * 3. Neither the name of the Institute nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  * 
+  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ #include "rxgk_locl.h"
+ 
+ RCSID("$Id: rxgk_serv.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ #include &lt;errno.h&gt;
+ 
+ #include "rxgk_proto.ss.h"
+ 
+ /* Security object specific server data */
+ typedef struct rxgk_serv_class {
+     struct rx_securityClass klass;
+     rxgk_level min_level;
+     char *principal;
+     char *service_principal;
+     void *appl_data;
+     int (*get_key)(void *, const char *, int, int, krb5_keyblock *);
+     int (*user_ok)(const char *name, const char *realm, int kvno);
+     uint32_t serviceId;
+ } rxgk_serv_class;
+ 
+ extern krb5_context gk_context;
+ extern krb5_crypto gk_crypto;
+ 
+ static int
+ server_NewConnection(struct rx_securityClass *obj, struct rx_connection *con)
+ {
+     serv_con_data *cdat;
+     assert(con-&gt;securityData == 0);
+     assert(gk_context != NULL);
+     obj-&gt;refCount++;
+     con-&gt;securityData = (char *) osi_Alloc(sizeof(serv_con_data));
+     memset(con-&gt;securityData, 0x0, sizeof(serv_con_data));
+     cdat = (serv_con_data *)con-&gt;securityData;
+     cdat-&gt;k.ks_context = gk_context;
+     return 0;
+ }
+ 
+ static int
+ server_Close(struct rx_securityClass *obj)
+ {
+     obj-&gt;refCount--;
+     if (obj-&gt;refCount &lt;= 0)
+ 	osi_Free(obj, sizeof(rxgk_serv_class));
+     return 0;
+ }
+ 
+ static
+ int
+ server_DestroyConnection(struct rx_securityClass *obj,
+ 			 struct rx_connection *con)
+ {
+   serv_con_data *cdat = (serv_con_data *)con-&gt;securityData;
+ 
+   if (cdat)
+       osi_Free(cdat, sizeof(serv_con_data));
+   return server_Close(obj);
+ }
+ 
+ /*
+  * Check whether a connection authenticated properly.
+  * Zero is good (authentication succeeded).
+  */
+ static int
+ server_CheckAuthentication(struct rx_securityClass *obj,
+ 			   struct rx_connection *con)
+ {
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+ 
+     if (cdat)
+ 	return !cdat-&gt;authenticated;
+     else
+ 	return RXGKNOAUTH;
+ }
+ 
+ /*
+  * Select a nonce for later use.
+  */
+ static
+ int
+ server_CreateChallenge(struct rx_securityClass *obj_,
+ 		       struct rx_connection *con)
+ {
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+ 
+     cdat-&gt;nonce = arc4random();
+     cdat-&gt;authenticated = 0;
+     return 0;
+ }
+ 
+ /*
+  * Wrap the nonce in a challenge packet.
+  */
+ static int
+ server_GetChallenge(const struct rx_securityClass *obj_,
+ 		    const struct rx_connection *con,
+ 		    struct rx_packet *pkt)
+ {
+     rxgk_serv_class *obj = (rxgk_serv_class *) obj_;
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+     struct RXGK_Challenge c;
+     int initial_challage = 1;
+ 
+     c.rc_version = htonl(RXGK_VERSION);
+     c.rc_nonce = htonl(cdat-&gt;nonce);
+     c.rc_max_seq_skew = htonl(200); /* XXX */
+     c.rc_min_level = htonl(obj-&gt;min_level);
+ 
+     if (initial_challage) {
+ 	/* Make challenge */
+ 	c.rc_opcode = htonl(RXKG_OPCODE_CHALLENGE);
+     
+ 	/* Stuff into packet */
+ 	if (rx_SlowWritePacket(pkt, 0, sizeof(c), &amp;c) != sizeof(c))
+ 	    return RXGKPACKETSHORT;
+ 	rx_SetDataSize(pkt, sizeof(c));
+ #if 0
+     } else {
+ 	RXGK_ReKey rk;
+ 	RXGK_ReKey_Crypt rkc;
+ 	char bufrk[RXGK_REKEY_MAX_SIZE];
+ 	char bufrkc[RXGK_REKEY_CRYPT_MAX_SIZE];
+ 	krb5_data data;
+ 	size_t sz;
+ 	int ret;
+ 	key_stuff *k = &amp;cdat-&gt;k;
+ 
+ 	memset(&amp;rk, 0, sizeof(rk));
+ 	memset(&amp;rkc, 0, sizeof(rkc));
+ 
+ 	c.rc_opcode = htonl(RXKG_OPCODE_REKEY);
+ 
+ 	if (rx_SlowWritePacket(pkt, 0, sizeof(c), &amp;c) != sizeof(c))
+ 	    return RXGKPACKETSHORT;
+ 	
+ 	rkc.rkc_version = RXGK_VERSION;
+ 	rkc.rkc_max_seq_num = 200; /* XXX */
+ 	rkc.rkc_kvno = /* current_key + 1 */ 1;
+ 	rkc.rkc_keycontribution.len = 0; /* XXX */
+ 	rkc.rkc_keycontribution.val = NULL;
+ 
+ 	sz = RXGK_REKEY_CRYPT_MAX_SIZE;
+ 	if (ydr_encode_RXGK_ReKey_Crypt(&amp;rkc, bufrkc, &amp;sz) == NULL)
+ 	    return RXGKPACKETSHORT;
+ 	sz = RXGK_REKEY_CRYPT_MAX_SIZE - sz;
+ 	
+ 	ret = krb5_encrypt(k-&gt;ks_context, k-&gt;ks_crypto, 
+ 			   RXGK_SERVER_ENC_REKEY, bufrkc, sz, &amp;data);
+ 	if (ret)
+ 	    return ret;
+ 
+ 	rk.rk_ctext.val = data.data;
+ 	rk.rk_ctext.len = data.length;
+ 
+ 	sz = RXGK_REKEY_MAX_SIZE;
+ 	if (ydr_encode_RXGK_ReKey(&amp;rk, bufrk, &amp;sz) == NULL) {
+ 	    krb5_data_free(&amp;data);
+ 	    return RXGKPACKETSHORT;
+ 	}
+ 	sz = RXGK_REKEY_MAX_SIZE - sz;
+ 
+ 	krb5_data_free(&amp;data);
+ 	
+ 	if (rx_SlowWritePacket(pkt, sizeof(c), sz, bufrk) != sz)
+ 	    return RXGKPACKETSHORT;
+ 
+ 	rx_SetDataSize(pkt, sizeof(c) + sz);
+ #endif
+     }
+     return 0;
+ }
+ 
+ /*
+  * Process a response to a challange.
+  */
+ static int
+ server_CheckResponse(struct rx_securityClass *obj_,
+ 		     struct rx_connection *con,
+ 		     struct rx_packet *pkt)
+ {
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+     
+     struct RXGK_Response r;
+     struct RXGK_Response_Crypt rc;
+     struct RXGK_AUTH_CRED c;
+     char response[RXGK_RESPONSE_MAX_SIZE];
+     size_t len, len2;
+     int ret;
+     krb5_context context = cdat-&gt;k.ks_context;
+     krb5_data data;
+     
+     memset(&amp;r, 0, sizeof(r));
+     memset(&amp;c, 0, sizeof(r));
+     
+     len = rx_SlowReadPacket(pkt, 0, sizeof(response), response);
+     if (len &lt;= 0)
+ 	return RXGKPACKETSHORT;
+     
+     len2 = len;
+     if (ydr_decode_RXGK_Response(&amp;r, response, &amp;len2) == NULL) {
+ 	ret = RXGKPACKETSHORT;
+ 	goto out;
+     }
+     
+     ret = rxgk_decode_auth_token(r.rr_auth_token.val, r.rr_auth_token.len, &amp;c);
+     if (ret)
+ 	goto out;
+     
+     ret = rxgk_random_to_key(c.ac_enctype, c.ac_key.val, c.ac_key.len,
+ 			     &amp;cdat-&gt;k.ks_key);
+     if (ret)
+ 	goto out;
+ 
+     cdat-&gt;k.ks_crypto = NULL; /* XXX */
+     ret = krb5_crypto_init(context, &amp;cdat-&gt;k.ks_key, cdat-&gt;k.ks_key.keytype, 
+ 			   &amp;cdat-&gt;k.ks_crypto);
+     if (ret)
+ 	goto out2;
+ 
+ 
+     ret = krb5_decrypt(context, cdat-&gt;k.ks_crypto, RXGK_CLIENT_ENC_CHALLENGE, 
+ 		       r.rr_ctext.val, r.rr_ctext.len, &amp;data);
+     if (ret)
+ 	goto out2;
+ 
+     len = data.length;
+     if (ydr_decode_RXGK_Response_Crypt(&amp;rc, data.data, &amp;len) == NULL) {
+ 	krb5_data_free(&amp;data);
+ 	goto out2;
+     }
+ 
+     krb5_data_free(&amp;data);
+ 
+     if (rc.epoch != con-&gt;epoch
+ 	|| rc.cid != (con-&gt;cid &amp; RX_CIDMASK)
+ #if 0
+ 	|| rc.security_index != con-&gt;securityIndex
+ #endif
+ 	) {
+ 	ret = RXGKSEALEDINCON;
+ 	goto out2;
+     }
+ 
+     {
+ 	int i;
+ 	for (i = 0; i &lt; RX_MAXCALLS; i++)
+ 	{
+ 	    if (rc.call_numbers[i] &lt; 0) {
+ 		ret = RXGKSEALEDINCON;
+ 		goto out2;
+ 	    }
+ 	}
+ 
+     }
+ 
+     if (rc.nonce != cdat-&gt;nonce + 1) {
+ 	ret = RXGKOUTOFSEQUENCE;
+ 	goto out2;
+     }
+ 
+     /* XXX */
+     if (rc.level != rxgk_crypt) {
+ 	ret = RXGKLEVELFAIL;
+ 	goto out2;
+     }
+ 
+     if ((rc.level != rxgk_auth &amp;&amp; rc.level != rxgk_crypt) ||
+ 	rc.level &lt; cdat-&gt;cur_level) 
+     {
+ 	ret = RXGKLEVELFAIL;
+ 	goto out2;
+     }
+ 
+ #if 0
+     ret = rxgk_derive_transport_key(context, &amp;cdat-&gt;k.ks_key,
+ 				    &amp;rc.contrib, &amp;cdat-&gt;k.ks_skey);
+     if (ret)
+ 	goto out2;
+ #endif
+ 
+     ret = krb5_crypto_init (context, &amp;cdat-&gt;k.ks_skey,
+ 			    cdat-&gt;k.ks_skey.keytype,
+ 			    &amp;cdat-&gt;k.ks_scrypto);
+     if (ret)
+ 	goto out2;
+ 
+     rxi_SetCallNumberVector(con, rc.call_numbers);
+ 
+     cdat-&gt;authenticated = 1;
+     cdat-&gt;expires = c.ac_endtime;
+     cdat-&gt;cur_level = rc.level;
+ 
+     rxgk_set_conn(con, cdat-&gt;k.ks_key.keytype,
+ 		  rc.level == rxgk_crypt ? 1 : 0);
+ 
+  out2:
+     if (ret) {
+ 	krb5_free_keyblock_contents(context, &amp;cdat-&gt;k.ks_key);
+ 	if (cdat-&gt;k.ks_crypto)
+ 	    krb5_crypto_destroy(context, cdat-&gt;k.ks_crypto);
+ 	cdat-&gt;k.ks_crypto = NULL;
+     }
+ 
+  out:  
+ 
+     ydr_free_RXGK_AUTH_CRED(&amp;c);
+     ydr_free_RXGK_Response(&amp;r);
+     
+     return ret;
+ }
+ 
+ /*
+  * Checksum and/or encrypt packet
+  */
+ static int
+ server_PreparePacket(struct rx_securityClass *obj_,
+ 		     struct rx_call *call,
+ 		     struct rx_packet *pkt)
+ {
+     struct rx_connection *con = rx_ConnectionOf(call);
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+     key_stuff *k = &amp;cdat-&gt;k;
+     end_stuff *e = &amp;cdat-&gt;e;
+     
+     return rxgk_prepare_packet(pkt, con, cdat-&gt;cur_level, k, e);
+ }
+ 
+ /*
+  * Verify checksum and/or decrypt packet.
+  */
+ static int
+ server_CheckPacket(struct rx_securityClass *obj_,
+ 		   struct rx_call *call,
+ 		   struct rx_packet *pkt)
+ {
+     struct rx_connection *con = rx_ConnectionOf(call);
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+     key_stuff *k = &amp;cdat-&gt;k;
+     end_stuff *e = &amp;cdat-&gt;e;
+ 
+     if (time(0) &gt; cdat-&gt;expires)	/* Use fast time package instead??? */
+ 	return RXGKEXPIRED;
+ 
+     return rxgk_check_packet(pkt, con, cdat-&gt;cur_level, k, e);
+ }
+ 
+ static int
+ server_GetStats(const struct rx_securityClass *obj_,
+ 		const struct rx_connection *con,
+ 		struct rx_securityObjectStats *st)
+ {
+     rxgk_serv_class *obj = (rxgk_serv_class *) obj_;
+     serv_con_data *cdat = (serv_con_data *) con-&gt;securityData;
+     
+     st-&gt;type = rxgk_disipline;
+     st-&gt;level = obj-&gt;min_level;
+     st-&gt;flags = rxgk_checksummed;
+     if (cdat == 0)
+ 	st-&gt;flags |= rxgk_unallocated;
+     {
+ 	st-&gt;bytesReceived = cdat-&gt;e.bytesReceived;
+ 	st-&gt;packetsReceived = cdat-&gt;e.packetsReceived;
+ 	st-&gt;bytesSent = cdat-&gt;e.bytesSent;
+ 	st-&gt;packetsSent = cdat-&gt;e.packetsSent;
+ 	st-&gt;expires = cdat-&gt;expires;
+ 	st-&gt;level = cdat-&gt;cur_level;
+ 	if (cdat-&gt;authenticated)
+ 	    st-&gt;flags |= rxgk_authenticated;
+     }
+     return 0;
+ }
+ 
+ static
+ void
+ free_context(void)
+ {
+     return;
+ }
+ 
+ static
+ int
+ server_NewService(const struct rx_securityClass *obj_,
+ 		  struct rx_service *service,
+ 		  int reuse)
+ {
+     rxgk_serv_class *obj = (rxgk_serv_class *) obj_;
+ 
+     if (service-&gt;serviceId == obj-&gt;serviceId)
+ 	return 0;
+     
+     if (!reuse) {
+ 	struct rx_securityClass *sec[2];
+ 	struct rx_service *secservice;
+ 	
+ 	sec[0] = rxnull_NewServerSecurityObject();
+ 	sec[1] = NULL;
+ 	
+ 	secservice = rx_NewService (service-&gt;servicePort,
+ 				    obj-&gt;serviceId,
+ 				    "rxgk", 
+ 				    sec, 1, 
+ 				    RXGK_ExecuteRequest);
+ 	
+ 	secservice-&gt;destroyConnProc = free_context;
+ 	rx_setServiceRock(secservice, obj-&gt;principal);
+     }
+     return 0;
+ }
+ 
+ 
+ static struct rx_securityOps server_ops = {
+     server_Close,
+     server_NewConnection,
+     server_PreparePacket,
+     NULL,
+     server_CheckAuthentication,
+     server_CreateChallenge,
+     server_GetChallenge,
+     NULL,
+     server_CheckResponse,
+     server_CheckPacket,
+     server_DestroyConnection,
+     server_GetStats,
+     server_NewService,
+ };
+ 
+ struct rx_securityClass *
+ rxgk_NewServerSecurityObject(/*rxgk_level*/ int min_level,
+ 			     const char *principal,
+ 			     void *appl_data,
+ 			     int (*get_key)(void *data, const char *principal,
+ 					    int enctype, int kvno,
+ 					    krb5_keyblock *key),
+ 			     int (*user_ok)(const char *name,
+ 					    const char *realm,
+ 					    int kvno),
+ 			     uint32_t serviceId)
+ {
+     rxgk_serv_class *obj;
+     int ret;
+ 
+     if (get_key == NULL || principal == NULL)
+ 	return NULL;
+ 
+     ret = rxgk_server_init();
+     if (ret)
+ 	return NULL;
+ 
+     obj = (rxgk_serv_class *) osi_Alloc(sizeof(rxgk_serv_class));
+     obj-&gt;klass.refCount = 1;
+     obj-&gt;klass.ops = &amp;server_ops;
+     obj-&gt;klass.privateData = (char *) obj;
+     
+     obj-&gt;min_level = min_level;
+     obj-&gt;appl_data = appl_data;
+     obj-&gt;get_key = get_key;
+     obj-&gt;user_ok = user_ok;
+     obj-&gt;principal = strdup(principal);
+     if (obj-&gt;principal == NULL) {
+ 	osi_Free(obj, sizeof(rxgk_serv_class));
+ 	return NULL;
+     }
+     obj-&gt;serviceId = serviceId;
+     
+     return &amp;obj-&gt;klass;
+ }
Index: openafs/src/rxgk/rxgk_srpc.c
diff -c /dev/null openafs/src/rxgk/rxgk_srpc.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/rxgk_srpc.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,388 ----
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  * 
+  * Redistribution is not permitted
+  */
+ 
+ #include "rxgk_locl.h"
+ 
+ RCSID("$Id: rxgk_srpc.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ #include &lt;errno.h&gt;
+ 
+ #include &lt;rx/rx.h&gt;
+ #include "rxgk_proto.h"
+ #include "rxgk_proto.ss.h"
+ 
+ /* XXX need to pthread lock these */
+ krb5_context gk_context;
+ static krb5_keyblock gk_key;
+ krb5_crypto gk_crypto;
+ static int gk_kvno;
+ 
+ static int
+ get_key(const char *keytab_string, const char *p, int enctype, int kvno,
+ 	krb5_keyblock *key)
+ {
+     krb5_error_code ret;
+     krb5_keytab keytab;
+     krb5_principal princ;
+     char keytab_buf[256];
+     krb5_keytab_entry ktentry;
+ 
+     ret = krb5_parse_name(gk_context, p, &amp;princ);
+     if (ret)
+ 	return ret;
+ 
+     if (keytab_string == NULL) {
+ 	ret = krb5_kt_default_name (gk_context, keytab_buf,sizeof(keytab_buf));
+ 	if (ret)
+ 	    krb5_err(gk_context, 1, ret, "resolving keytab %s", keytab_string);
+ 	keytab_string = keytab_buf;
+     }
+     ret = krb5_kt_resolve(gk_context, keytab_string, &amp;keytab);
+     if (ret)
+ 	krb5_err(gk_context, 1, ret, "resolving keytab %s", keytab_string);
+ 
+     ret = krb5_kt_get_entry (gk_context, keytab, princ, kvno,
+ 			     enctype, &amp;ktentry);
+     if (ret)
+ 	krb5_err(gk_context, 1, ret, "krb5_kt_get_entry %s", p);
+ 
+     krb5_copy_keyblock_contents(gk_context, &amp;ktentry.keyblock, key);
+     /* ktentry.vno */
+ 
+     krb5_kt_free_entry(gk_context, &amp;ktentry);
+ 	
+     krb5_kt_close(gk_context, keytab);
+ 
+     krb5_free_principal(gk_context, princ);
+ 
+     return ret;
+ }
+ 
+ int
+ rxgk_default_get_key(void *data, const char *p, int enctype, int kvno, 
+ 		     krb5_keyblock *key)
+ {
+     int ret;
+ 
+     ret = rxgk_server_init();
+     if (ret)
+ 	return ret;
+ 
+     return get_key(NULL, p, enctype, kvno, key);
+ }
+ 
+ 
+ int
+ rxgk_server_init(void)
+ {
+     static int inited = 0;
+     int ret;
+ 
+     if (inited)
+ 	return 0;
+ 
+     if (krb5_init_context(&amp;gk_context))
+ 	return EINVAL;
+ 
+     ret = get_key(NULL, "gkkey@L.NXS.SE", 0, 0, &amp;gk_key); /* XXX */
+     if (ret) {
+ 	krb5_free_context(gk_context);
+ 	gk_context = NULL;
+ 	return ret;
+     }
+ 
+     ret = krb5_crypto_init(gk_context, &amp;gk_key, gk_key.keytype,
+ 			   &amp;gk_crypto);
+     if (ret) {
+ 	krb5_free_keyblock_contents(gk_context, &amp;gk_key);
+ 	krb5_free_context(gk_context);
+ 	gk_context = NULL;
+ 	return ret;
+     }
+ 
+ 
+     inited = 1;
+ 
+     return 0;
+ }
+ 
+ static int
+ build_auth_token(krb5_context context, const char *princ, 
+ 		 int32_t start, int32_t end,
+ 		 krb5_keyblock *key,
+ 		 int session_enctype, 
+ 		 void *session_key, size_t session_key_size,
+ 		 int32_t *auth_token_kvno, RXGK_Token *auth_token)
+ {
+     struct RXGK_AUTH_CRED cred;
+     krb5_data data;
+     void *ptr;
+     int sz, ret;
+ 
+     sz = RXGK_AUTH_CRED_MAX_SIZE;
+     ptr = malloc(sz);
+     if (ptr == NULL)
+ 	return ENOMEM;
+ 
+     cred.ac_version = RXGK_KEY_VERSION;
+     strlcpy(cred.ac_principal, princ, sizeof(cred.ac_principal));
+     cred.ac_starttime = start;
+     cred.ac_endtime = end;
+     cred.ac_enctype = session_enctype;
+     cred.ac_key.len = session_key_size;
+     cred.ac_key.val = session_key;
+ 
+     if (ydr_encode_RXGK_AUTH_CRED(&amp;cred, ptr, &amp;sz) == NULL) {
+ 	free(ptr);
+ 	return EINVAL;
+     }
+     sz = RXGK_AUTH_CRED_MAX_SIZE - sz;
+ 
+     ret = krb5_encrypt(context, gk_crypto, 0, ptr, sz, &amp;data);
+     if (ret) {
+ 	free(ptr);
+ 	return ret;
+     }
+     
+     if (data.length &gt; RXGK_AUTH_CRED_MAX_SIZE) {
+ 	free(ptr);
+ 	return EINVAL;
+     }
+     
+     memcpy(ptr, data.data, data.length);
+ 
+     auth_token-&gt;len = data.length;
+     auth_token-&gt;val = ptr;
+     *auth_token_kvno = gk_kvno;
+     
+     krb5_data_free(&amp;data);
+ 
+     return 0;
+ }
+ 
+ int
+ rxgk_decode_auth_token(void *val, size_t len, RXGK_AUTH_CRED *c)
+ {
+     krb5_data data;
+     size_t sz;
+     int ret;
+ 
+     memset(c, 0, sizeof(*c));
+ 
+     ret = krb5_decrypt(gk_context, gk_crypto, 0, val, len, &amp;data);
+     if (ret)
+ 	return ret;
+ 
+     sz = data.length;
+     if (ydr_decode_RXGK_AUTH_CRED(c, data.data, &amp;sz) == NULL) {
+ 	if (c-&gt;ac_key.val)
+ 	    free(c-&gt;ac_key.val);
+ 	memset(c, 0, sizeof(*c));
+ 	ret = RXGKBADTICKET;
+     }
+ 
+     krb5_data_free(&amp;data);
+ 
+     return ret;
+ }
+ 
+ /* XXX share */
+ 
+ static int
+ decode_v5(krb5_context context,
+ 	  int (*get_key)(void *appl_data, const char *p, int enctype,
+ 			 int kvno, krb5_keyblock *key),
+ 	  void *appl_data,
+ 	  const char *princ,
+ 	  char *ticket,
+ 	  int32_t ticket_len,
+ 	  /* OUT parms */
+ 	  krb5_principal *p,
+ 	  krb5_keyblock *key,
+ 	  int32_t *starts,
+ 	  int32_t *expires)
+ {
+     krb5_keyblock serv_key;
+     int code;
+     size_t siz;
+ 
+     Ticket t5;			/* Must free */
+     EncTicketPart decr_part;	/* Must free */
+     krb5_data plain;		/* Must free */
+     krb5_crypto crypto;		/* Must free */
+ 
+     memset(&amp;t5, 0x0, sizeof(t5));
+     memset(&amp;decr_part, 0x0, sizeof(decr_part));
+     krb5_data_zero(&amp;plain);
+     memset(&amp;serv_key, 0, sizeof(serv_key));
+     crypto = NULL;
+ 
+     code = decode_Ticket(ticket, ticket_len, &amp;t5, &amp;siz);
+     if (code != 0)
+ 	goto bad_ticket;
+ 
+     code = (*get_key)(appl_data, princ, 
+ 		      t5.enc_part.etype, t5.tkt_vno, &amp;serv_key);
+     if (code)
+ 	goto unknown_key;
+     
+     code = krb5_crypto_init (context, &amp;serv_key, t5.enc_part.etype,
+ 			     &amp;crypto);
+     krb5_free_keyblock_contents(context, &amp;serv_key);
+     if (code)
+ 	goto bad_ticket;
+ 
+     /* Decrypt ticket */
+     code = krb5_decrypt(context,
+ 			crypto,
+ 			0,
+ 			t5.enc_part.cipher.data,
+ 			t5.enc_part.cipher.length,
+ 			&amp;plain);
+ 
+     if (code)
+ 	goto bad_ticket;
+     
+     /* Decode ticket */
+     code = decode_EncTicketPart(plain.data, plain.length, &amp;decr_part, &amp;siz);
+     if (code != 0)
+ 	goto bad_ticket;
+     
+     /* principal */
+     code = principalname2krb5_principal(p, decr_part.cname, decr_part.crealm);
+     if (code)
+ 	goto bad_ticket;
+     
+     /* Extract session key */
+     code = krb5_copy_keyblock_contents(context, &amp;decr_part.key, key);
+     if (code)
+ 	goto bad_ticket;
+ 
+     /* Check lifetimes and host addresses, flags etc */
+     {
+ 	time_t now = time(0);	/* Use fast time package instead??? */
+ 	time_t start = decr_part.authtime;
+ 	if (decr_part.starttime)
+ 	    start = *decr_part.starttime;
+ 	if (start - now &gt; context-&gt;max_skew || decr_part.flags.invalid)
+ 	    goto no_auth;
+ 	if (now &gt; decr_part.endtime)
+ 	    goto tkt_expired;
+ 	*starts = start;
+ 	*expires = decr_part.endtime;
+     }
+     
+ #if 0
+     /* Check host addresses */
+ #endif
+     
+  cleanup:
+     free_Ticket(&amp;t5);
+     free_EncTicketPart(&amp;decr_part);
+     krb5_data_free(&amp;plain);
+     if (crypto)
+ 	krb5_crypto_destroy(context, crypto);
+     if (code) {
+ 	krb5_free_principal(context, *p);
+ 	*p = NULL;
+     }
+     return code;
+     
+  unknown_key:
+     code = RXGKUNKNOWNKEY;
+     goto cleanup;
+  no_auth:
+     code = RXGKNOAUTH;
+     goto cleanup;
+  tkt_expired:
+     code = RXGKEXPIRED;
+     goto cleanup;
+  bad_ticket:
+     code = RXGKBADTICKET;
+     goto cleanup;
+ }
+ 
+ int
+ SRXGK_EstablishKrb5Context(struct rx_call *call,
+ 			   const RXGK_Token *token,
+ 			   const RXGK_Token *challage_token,
+ 			   RXGK_Token *reply_token,
+ 			   int32_t *auth_token_kvno,
+ 			   RXGK_Token *auth_token)
+ {
+     krb5_principal principal;
+     krb5_keyblock key;
+     int32_t starts, expires;
+     char *cprinc, *sprinc;
+     void *session_key;
+     size_t session_key_size;
+     int session_enctype;
+     int ret;
+ 
+     ret = rxgk_server_init();
+     if (ret)
+ 	return ret;
+ 
+     if ((sprinc = rx_getServiceRock(call-&gt;conn-&gt;service)) == NULL)
+ 	return EINVAL;
+ 
+     session_key = NULL;
+ 
+     key.keyvalue.data = NULL;
+ 
+     auth_token-&gt;len = reply_token-&gt;len = 0;
+     auth_token-&gt;val = reply_token-&gt;val = NULL;
+ 
+     ret = decode_v5(gk_context, rxgk_default_get_key, NULL, sprinc, 
+ 		    token-&gt;val, token-&gt;len,
+ 		    &amp;principal, &amp;key, &amp;starts, &amp;expires);
+     if (ret)
+ 	goto out;
+ 
+     ret = rxk5_mutual_auth_server(gk_context,
+ 				  &amp;key,
+ 				  challage_token,
+ 				  &amp;session_enctype,
+ 				  &amp;session_key, 
+ 				  &amp;session_key_size,
+ 				  reply_token);
+     if (ret)
+ 	goto out;
+ 
+     ret = krb5_unparse_name(gk_context, principal, &amp;cprinc);
+     if (ret)
+ 	goto out;
+ 
+     ret = build_auth_token(gk_context, cprinc, starts, expires, &amp;key,
+ 			   session_enctype, session_key, session_key_size,
+ 			   auth_token_kvno, auth_token);
+ 
+     free(cprinc);
+ 
+  out:
+     if (session_key) {
+ 	memset(session_key, 0, session_key_size);
+ 	free(session_key);
+     }
+     if (key.keyvalue.data != NULL)
+ 	krb5_free_keyblock_contents(gk_context, &amp;key);
+ 
+     if (ret) {
+ 	if (reply_token-&gt;val)
+ 	    free(reply_token-&gt;val);
+ 	reply_token-&gt;len = 0;
+ 	reply_token-&gt;val = NULL;
+ 
+ 	if (auth_token-&gt;val)
+ 	    free(auth_token-&gt;val);
+ 	auth_token-&gt;len = 0;
+ 	auth_token-&gt;val = NULL;
+     }
+ 
+     return ret;
+ }
Index: openafs/src/rxgk/test.xg
diff -c /dev/null openafs/src/rxgk/test.xg:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/test.xg	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,21 ----
+ /* hej emacs det h{r {r en -*- c -*- fil */
+ 
+ /*
+  * Copyright (c) 2002, Stockholms Universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  * 
+  * Redistribution is not permitted
+  */
+ 
+ /* $Id: test.xg,v 1.1 2004/08/08 19:21:33 shadow Exp $ */
+ 
+ package TEST_
+ 
+ const TEST_DEFAULT_PORT = 7009;
+ 
+ const TEST_RXGK_SERVICE = 64000;
+ 
+ const TEST_SERVICE_ID   = 10;
+ 
+ get_hundraelva(OUT afs_int32 *foo, OUT string bar&lt;100&gt;) = 18;
Index: openafs/src/rxgk/test_client.c
diff -c /dev/null openafs/src/rxgk/test_client.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/test_client.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,202 ----
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  * 
+  * Redistribution is not permitted
+  */
+ 
+ #include &lt;sys/socket.h&gt;
+ #include &lt;netinet/in.h&gt;
+ #include &lt;arpa/inet.h&gt;
+ 
+ #include &lt;err.h&gt;
+ #include &lt;errno.h&gt;
+ #include &lt;netdb.h&gt;
+ 
+ #include "rxgk_locl.h"
+ #include "rxgk_proto.cs.h"
+ #include "test.cs.h"
+ 
+ RCSID("$Id: test_client.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ /*
+  *
+  */
+ 
+ static u_long
+ str2addr (const char *s)
+ {
+     struct in_addr server;
+     struct hostent *h;
+ 
+ #ifndef INADDR_NONE
+ #define INADDR_NONE 0xffffffff
+ #endif
+     if (inet_addr(s) != INADDR_NONE)
+         return inet_addr(s);
+     h = gethostbyname (s);
+     if (h != NULL) {
+ 	memcpy (&amp;server, h-&gt;h_addr_list[0], sizeof(server));
+ 	return server.s_addr;
+     }
+     return 0;
+ }
+ 
+ 
+ static int
+ get_krb5_token(krb5_context ctx, krb5_keyblock **key, RXGK_Token *token)
+ {
+     krb5_error_code ret;
+     krb5_creds in_creds, *out_creds;
+     krb5_ccache id;
+     char *realm = "L.NXS.SE";
+     int realm_len = strlen(realm);
+ 
+     memset(token, 0, sizeof(*token));
+ 
+     ret = krb5_cc_default (ctx, &amp;id);
+     if (ret)
+ 	return ret;
+ 
+     memset(&amp;in_creds, 0, sizeof(in_creds));
+     ret = krb5_build_principal(ctx, &amp;in_creds.server,
+ 			       realm_len, realm, "afs", NULL);
+     if(ret)
+ 	return ret;
+     ret = krb5_build_principal(ctx, &amp;in_creds.client,
+ 			       realm_len, realm, "lha", NULL);
+     if(ret){
+ 	krb5_free_principal(ctx, in_creds.server);
+ 	return ret;
+     }
+     in_creds.session.keytype = KEYTYPE_DES; /* XXX */
+     ret = krb5_get_credentials(ctx, 0, id, &amp;in_creds, &amp;out_creds);
+     krb5_free_principal(ctx, in_creds.server);
+     krb5_free_principal(ctx, in_creds.client);
+     if(ret) 
+ 	return ret;
+ 
+     token-&gt;val = malloc(out_creds-&gt;ticket.length);
+     if (token-&gt;val == NULL) {
+ 	krb5_free_creds(ctx, out_creds);
+ 	return ENOMEM;
+     }
+     token-&gt;len = out_creds-&gt;ticket.length;
+     memcpy(token-&gt;val, out_creds-&gt;ticket.data, out_creds-&gt;ticket.length);
+ 
+     ret = krb5_copy_keyblock(ctx, &amp;out_creds-&gt;session, key);
+ 
+     krb5_free_creds(ctx, out_creds);
+ 
+     return ret;
+ }
+ 
+ /*
+  *
+  */
+ 
+ static void
+ test_est_context(krb5_context context, uint32_t addr, int port, 
+ 		 RXGK_Token *ticket, krb5_keyblock *key)
+ {
+     RXGK_Token auth_token;
+     krb5_keyblock skey;
+     int32_t kvno;
+     int ret;
+ 
+     /* kernel */
+ 
+     ret = rxgk5_get_auth_token(context, addr, port, 
+ 			       TEST_RXGK_SERVICE,
+ 			       ticket, &amp;auth_token, key, &amp;skey, &amp;kvno);
+     if (ret)
+ 	errx(1, "rxgk5_get_auth_token: %d", ret);
+ 	
+     printf("EstablishKrb5Context succeeded "
+ 	   "len: %d, version: %d, enctype: %d\n",
+ 	   auth_token.len, kvno, skey.keytype);
+ }
+ 
+ static void
+ test_rxgk_conn(krb5_context context, uint32_t addr, int port, 
+ 	       RXGK_Token *ticket, krb5_keyblock *key)
+ {
+     struct rx_securityClass *secobj;
+     struct rx_connection *conn;
+     int ret;
+     char bar[100];
+     int32_t a111;
+ 
+     secobj = rxgk_k5_NewClientSecurityObject(rxgk_crypt,
+ 					     key,
+ 					     0,
+ 					     ticket-&gt;len,
+ 					     ticket-&gt;val,
+ 					     TEST_RXGK_SERVICE,
+ 					     context);
+ 
+     conn = rx_NewConnection(addr, port, TEST_SERVICE_ID, secobj, 4);
+     if (conn == NULL)
+ 	errx(1, "NewConnection");
+ 
+     ret = TEST_get_hundraelva(conn, &amp;a111, bar);
+ 
+     rx_DestroyConnection(conn);
+ 
+     if (ret)
+ 	errx(1, "TEST_get_hundraelva: %d", ret);
+ 
+     printf("get_hundraelva return %d (should be 111) (bar = \"%s\")\n",
+ 	   (int)a111, bar);
+ }
+ 
+ 
+ /*
+  *
+  */
+ 
+ int
+ main(int argc, char **argv)
+ {
+     RXGK_Token ticket;
+     krb5_context context;
+     krb5_keyblock *key;
+     int port, ret;
+     uint32_t addr;
+     char *saddr;
+     PROCESS pid;
+ 
+     setprogname(argv[0]);
+ 
+     port = htons(TEST_DEFAULT_PORT);
+     saddr = "127.0.0.1";
+ 
+     krb5_init_context(&amp;context);
+ 
+     LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &amp;pid);
+     
+     ret = rx_Init (0);
+     if (ret)
+ 	errx (1, "rx_Init failed");
+ 
+     addr = str2addr(saddr);
+ 
+     ret = get_krb5_token(context, &amp;key, &amp;ticket);
+     if (ret)
+ 	errx(1, "get_krb5_token: %d", ret);
+ 
+     if (0) {
+ 	test_est_context(context, addr, port, &amp;ticket, key);
+     } else {
+ 	test_rxgk_conn(context, addr, port, &amp;ticket, key);
+     }
+ 
+     rx_Finalize();
+ 
+     krb5_free_keyblock(context, key);
+     krb5_free_context(context);
+ 
+     return 0;
+ }
+ 
Index: openafs/src/rxgk/test_server.c
diff -c /dev/null openafs/src/rxgk/test_server.c:1.1
*** /dev/null	Tue Aug 10 00:30:23 2004
--- openafs/src/rxgk/test_server.c	Sun Aug  8 15:21:33 2004
***************
*** 0 ****
--- 1,76 ----
+ /*
+  * Copyright (c) 2002 - 2004, Stockholms universitet
+  * (Stockholm University, Stockholm Sweden)
+  * All rights reserved.
+  * 
+  * Redistribution is not permitted
+  */
+ 
+ #include &lt;sys/socket.h&gt;
+ #include &lt;netinet/in.h&gt;
+ #include &lt;arpa/inet.h&gt;
+ 
+ #include &lt;err.h&gt;
+ #include &lt;netdb.h&gt;
+ 
+ #include "rxgk_locl.h"
+ #include "rxgk_proto.ss.h"
+ #include "test.ss.h"
+ 
+ RCSID("$Id: test_server.c,v 1.1 2004/08/08 19:21:33 shadow Exp $");
+ 
+ /*
+  *
+  */
+ 
+ int
+ STEST_get_hundraelva(struct rx_call *call, int32_t *foo, char *bar)
+ {
+     *foo = 111;
+     snprintf(bar, 100, "hej");
+     return 0;
+ }
+ 
+ /*
+  *
+  */
+ 
+ int
+ main(int argc, char **argv)
+ {
+     struct rx_securityClass *secureobj[5];
+     struct rx_service *service;
+     int secureindex;
+     PROCESS pid;
+     int port = htons(TEST_DEFAULT_PORT);
+     int ret;
+ 
+     LWP_InitializeProcessSupport (LWP_NORMAL_PRIORITY, &amp;pid);
+ 
+     ret = rx_Init (port);
+     if (ret)
+ 	errx (1, "rx_Init failed");
+ 
+     secureindex = 5;
+     memset(secureobj, 0, sizeof(secureobj));
+     secureobj[4] = 
+ 	rxgk_NewServerSecurityObject(rxgk_auth,
+ 				     "afs@L.NXS.SE",
+ 				     NULL,
+ 				     rxgk_default_get_key,
+ 				     NULL,
+ 				     TEST_RXGK_SERVICE);
+     
+     service = rx_NewService (0,
+ 			     TEST_SERVICE_ID,
+ 			     "rxgk-test", 
+ 			     secureobj, 
+ 			     secureindex, 
+ 			     TEST_ExecuteRequest);
+     if (service == NULL) 
+ 	errx(1, "Cant create server");
+ 
+     rx_StartServer(1) ;
+ 
+     return 0;
+ }
Index: openafs/src/sys/pioctl_nt.c
diff -c openafs/src/sys/pioctl_nt.c:1.15 openafs/src/sys/pioctl_nt.c:1.18
*** openafs/src/sys/pioctl_nt.c:1.15	Mon Jul 26 16:40:23 2004
--- openafs/src/sys/pioctl_nt.c	Thu Aug  5 12:28:10 2004
***************
*** 11,17 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.15 2004/07/26 20:40:23 jaltman Exp $");
  
  #include &lt;afs/stds.h&gt;
  #include &lt;windows.h&gt;
--- 11,17 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.18 2004/08/05 16:28:10 jaltman Exp $");
  
  #include &lt;afs/stds.h&gt;
  #include &lt;windows.h&gt;
***************
*** 163,170 ****
  		    FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
  		    FILE_FLAG_WRITE_THROUGH, NULL);
      fflush(stdout);
!     if (fh == INVALID_HANDLE_VALUE)
! 	return -1;
  
      /* return fh and success code */
      *handlep = fh;
--- 163,207 ----
  		    FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
  		    FILE_FLAG_WRITE_THROUGH, NULL);
      fflush(stdout);
! 	if (fh == INVALID_HANDLE_VALUE) {
!         HKEY hk;
!         char szUser[64] = "";
!         char szClient[MAX_PATH] = "";
!         char szPath[MAX_PATH] = "";
!         NETRESOURCE nr;
!         DWORD res;
! 
!         if (GetLastError() != ERROR_DOWNGRADE_DETECTED)
!             return -1;
! 
!         lana_GetNetbiosName(szClient, LANA_NETBIOS_NAME_FULL);
!         sprintf(szPath, "\\\\%s", szClient);
! 
!         /* We should probably be using GetUserNameEx() for this */
!         if (RegOpenKey (HKEY_CURRENT_USER, 
!                         TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"), &amp;hk) == 0)
!         {
!             DWORD dwSize = sizeof(szUser);
!             DWORD dwType = REG_SZ;
!             RegQueryValueEx (hk, TEXT("Logon User Name"), NULL, &amp;dwType, (PBYTE)szUser, &amp;dwSize);
!             RegCloseKey (hk);
!         }
! 
!         memset (&amp;nr, 0x00, sizeof(NETRESOURCE));
!         nr.dwType=RESOURCETYPE_DISK;
!         nr.lpLocalName=0;
!         nr.lpRemoteName=szPath;
!         res = WNetAddConnection2(&amp;nr,NULL,szUser,0);
!         if (res)
!             return -1;
! 
!         fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE,
!                          FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
!                          FILE_FLAG_WRITE_THROUGH, NULL);
!         fflush(stdout);
!         if (fh == INVALID_HANDLE_VALUE)
!             return -1;
! 	}
  
      /* return fh and success code */
      *handlep = fh;
***************
*** 309,316 ****
      GetCurrentDirectory(sizeof(tpath), tpath);
  	if (tpath[1] == ':')
  	    strcpy(outPathp, tpath + 2);	/* skip drive letter */
! 	else
! 		strcpy(outPathp, tpath);		/* copy entire UNC path */
      /* if there is a non-null name after the drive, append it */
      if (*firstp != 0) {
  		int len = strlen(outPathp);
--- 346,369 ----
      GetCurrentDirectory(sizeof(tpath), tpath);
  	if (tpath[1] == ':')
  	    strcpy(outPathp, tpath + 2);	/* skip drive letter */
! 	else if ( tpath[0] == '\\' &amp;&amp; tpath[1] == '\\') {
!         /* UNC path - strip off the server and sharename */
!         int i, count;
!         for ( i=2,count=2; count &lt; 4 &amp;&amp; tpath[i]; i++ ) {
!             if ( tpath[i] == '\\' || tpath[i] == '/' ) {
!                 count++;
!             }
!         }
!         if ( tpath[i] == 0 ) {
!             strcpy(outPathp,"\\");
!         } else {
!             strcpy(outPathp,&amp;tpath[--i]);
!         }
!     } else {
!         /* this should never happen */
!         strcpy(outPathp, tpath);
!     }
! 
      /* if there is a non-null name after the drive, append it */
      if (*firstp != 0) {
  		int len = strlen(outPathp);
Index: openafs/src/tbutc/NTMakefile
diff -c openafs/src/tbutc/NTMakefile:1.14 openafs/src/tbutc/NTMakefile:1.15
*** openafs/src/tbutc/NTMakefile:1.14	Thu Jul 15 23:56:54 2004
--- openafs/src/tbutc/NTMakefile	Thu Aug  5 12:31:41 2004
***************
*** 111,117 ****
  #----------------------------------------------- BUTC
  
  $(BUTCEXE): $(BUTCOBJS) $(BUTCLIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP)
  
  .c.$(OUT)\obj:
--- 111,117 ----
  #----------------------------------------------- BUTC
  
  $(BUTCEXE): $(BUTCOBJS) $(BUTCLIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP)
  
  .c.$(OUT)\obj:
Index: openafs/src/ubik/ubik.c
diff -c openafs/src/ubik/ubik.c:1.14 openafs/src/ubik/ubik.c:1.15
*** openafs/src/ubik/ubik.c:1.14	Tue Jul 15 19:17:05 2003
--- openafs/src/ubik/ubik.c	Sun Aug  8 19:57:23 2004
***************
*** 11,17 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.14 2003/07/15 23:17:05 shadow Exp $");
  
  #include &lt;sys/types.h&gt;
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/ubik/ubik.c,v 1.15 2004/08/08 23:57:23 shadow Exp $");
  
  #include &lt;sys/types.h&gt;
  #ifdef AFS_NT40_ENV
***************
*** 186,216 ****
  */
  
  int
- ubik_ServerInitByInfo(afs_int32 myHost, short myPort,
- 		      struct afsconf_cell *info, char clones[],
- 		      char *pathName, struct ubik_dbase **dbase)
- {
-     afs_int32 code;
- 
-     code =
- 	ubik_ServerInitCommon(myHost, myPort, info, clones, 0, pathName,
- 			      dbase);
-     return code;
- }
- 
- int
- ubik_ServerInit(afs_int32 myHost, short myPort, afs_int32 serverList[],
- 		char *pathName, struct ubik_dbase **dbase)
- {
-     afs_int32 code;
- 
-     code =
- 	ubik_ServerInitCommon(myHost, myPort, (struct afsconf_cell *)0, 0,
- 			      serverList, pathName, dbase);
-     return code;
- }
- 
- int
  ubik_ServerInitCommon(afs_int32 myHost, short myPort,
  		      struct afsconf_cell *info, char clones[],
  		      afs_int32 serverList[], char *pathName,
--- 186,191 ----
***************
*** 321,326 ****
--- 296,326 ----
      return code;
  }
  
+ int
+ ubik_ServerInitByInfo(afs_int32 myHost, short myPort,
+ 		      struct afsconf_cell *info, char clones[],
+ 		      char *pathName, struct ubik_dbase **dbase)
+ {
+     afs_int32 code;
+ 
+     code =
+ 	ubik_ServerInitCommon(myHost, myPort, info, clones, 0, pathName,
+ 			      dbase);
+     return code;
+ }
+ 
+ int
+ ubik_ServerInit(afs_int32 myHost, short myPort, afs_int32 serverList[],
+ 		char *pathName, struct ubik_dbase **dbase)
+ {
+     afs_int32 code;
+ 
+     code =
+ 	ubik_ServerInitCommon(myHost, myPort, (struct afsconf_cell *)0, 0,
+ 			      serverList, pathName, dbase);
+     return code;
+ }
+ 
  /*  This routine begins a read or write transaction on the transaction
      identified by transPtr, in the dbase named by dbase.  An open mode of
      ubik_READTRANS identifies this as a read transaction, while a mode of
Index: openafs/src/util/snprintf.c
diff -c openafs/src/util/snprintf.c:1.21 openafs/src/util/snprintf.c:1.21.2.1
*** openafs/src/util/snprintf.c:1.21	Sun May  9 23:43:02 2004
--- openafs/src/util/snprintf.c	Mon Aug  9 16:57:10 2004
***************
*** 4,10 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/snprintf.c,v 1.21 2004/05/10 03:43:02 shadow Exp $");
  
  #include &lt;sys/types.h&gt;
  #include &lt;stdarg.h&gt;
--- 4,10 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/util/snprintf.c,v 1.21.2.1 2004/08/09 20:57:10 shadow Exp $");
  
  #include &lt;sys/types.h&gt;
  #include &lt;stdarg.h&gt;
***************
*** 508,514 ****
  
  #if defined(AFS_OSF20_ENV) &amp;&amp; !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) &amp;&amp; !defined(AFS_SUN56_ENV)) || !defined(HAVE_VSNPRINTF)
  
! #ifdef AFS_AIX51_ENV
  int
  vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
  #else
--- 508,514 ----
  
  #if defined(AFS_OSF20_ENV) &amp;&amp; !defined(AFS_DUX50_ENV) || defined(AFS_AIX32_ENV) || (defined(AFS_SUN55_ENV) &amp;&amp; !defined(AFS_SUN56_ENV)) || !defined(HAVE_VSNPRINTF)
  
! #if defined(AFS_AIX51_ENV) || defined(AFS_NT40_ENV)
  int
  vsnprintf(char *p, size_t avail, const char *fmt, va_list ap)
  #else
Index: openafs/src/viced/host.c
diff -c openafs/src/viced/host.c:1.56 openafs/src/viced/host.c:1.57
*** openafs/src/viced/host.c:1.56	Sun Dec  7 20:45:34 2003
--- openafs/src/viced/host.c	Thu Aug  5 10:48:09 2004
***************
*** 11,17 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.56 2003/12/08 01:45:34 jaltman Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
--- 11,17 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/host.c,v 1.57 2004/08/05 14:48:09 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
***************
*** 1545,1550 ****
--- 1545,1553 ----
      oldClient = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
      if (oldClient &amp;&amp; oldClient-&gt;tcon == tcon) {
  	oldClient-&gt;tcon = (struct rx_connection *)0;
+ 	ViceLog(0, ("FindClient: client %x(%x) already had conn %x (host %x), stolen by client %x(%x)\n", 
+ 		    oldClient, oldClient-&gt;sid, tcon, 
+ 		    rx_HostOf(rx_PeerOf(tcon)), client, client-&gt;sid));
  	/* rx_SetSpecific will be done immediately below */
      }
      client-&gt;tcon = tcon;
Index: openafs/src/vlserver/NTMakefile
diff -c openafs/src/vlserver/NTMakefile:1.7 openafs/src/vlserver/NTMakefile:1.8
*** openafs/src/vlserver/NTMakefile:1.7	Sat May 29 19:48:16 2004
--- openafs/src/vlserver/NTMakefile	Thu Aug  5 12:31:42 2004
***************
*** 89,95 ****
  
  	
  $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP) 
  
  ############################################################################
--- 89,95 ----
  
  	
  $(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP) 
  
  ############################################################################
***************
*** 135,141 ****
  	$(DESTDIR)\lib\afs\afspioctl.lib
  
  $(OUT)\vlclient.exe: $(OUT)\vlclient.obj  $(LIBFILE) $(VLSERVER_EXECLIBS) $(VLCLIENT_LIBS)
! 	$(EXECONLINK) dnsapi.lib
  
  
  ############################################################################
--- 135,141 ----
  	$(DESTDIR)\lib\afs\afspioctl.lib
  
  $(OUT)\vlclient.exe: $(OUT)\vlclient.obj  $(LIBFILE) $(VLSERVER_EXECLIBS) $(VLCLIENT_LIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  
  
  ############################################################################
Index: openafs/src/vol/fssync.c
diff -c openafs/src/vol/fssync.c:1.25 openafs/src/vol/fssync.c:1.26
*** openafs/src/vol/fssync.c:1.25	Mon Jul 19 10:39:38 2004
--- openafs/src/vol/fssync.c	Wed Jul 28 17:49:18 2004
***************
*** 50,56 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.25 2004/07/19 14:39:38 jaltman Exp $");
  
  #include &lt;sys/types.h&gt;
  #include &lt;stdio.h&gt;
--- 50,56 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/fssync.c,v 1.26 2004/07/28 21:49:18 shadow Exp $");
  
  #include &lt;sys/types.h&gt;
  #include &lt;stdio.h&gt;
***************
*** 105,111 ****
  
  #define MAXHANDLERS	4	/* Up to 4 clients; must be at least 2, so that
  				 * move = dump+restore can run on single server */
! #define MAXOFFLINEVOLUMES 30	/* This needs to be as big as the maximum
  				 * number that would be offline for 1 operation.
  				 * Current winner is salvage, which needs all
  				 * cloned read-only copies offline when salvaging
--- 105,111 ----
  
  #define MAXHANDLERS	4	/* Up to 4 clients; must be at least 2, so that
  				 * move = dump+restore can run on single server */
! #define MAXOFFLINEVOLUMES 128   /* This needs to be as big as the maximum
  				 * number that would be offline for 1 operation.
  				 * Current winner is salvage, which needs all
  				 * cloned read-only copies offline when salvaging
Index: openafs/src/vol/partition.c
diff -c openafs/src/vol/partition.c:1.29 openafs/src/vol/partition.c:1.30
*** openafs/src/vol/partition.c:1.29	Fri Oct 24 02:26:19 2003
--- openafs/src/vol/partition.c	Sun Aug  8 19:59:51 2004
***************
*** 21,27 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/partition.c,v 1.29 2003/10/24 06:26:19 shadow Exp $");
  
  #include &lt;ctype.h&gt;
  #ifdef AFS_NT40_ENV
--- 21,27 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/partition.c,v 1.30 2004/08/08 23:59:51 shadow Exp $");
  
  #include &lt;ctype.h&gt;
  #ifdef AFS_NT40_ENV
***************
*** 353,359 ****
  #endif
  
  #if defined(AFS_DUX40_ENV) &amp;&amp; !defined(AFS_NAMEI_ENV)
!     if (afs_status.st_ino != ROOTINO) {
  	Log("%s is not a mounted file system; ignored.\n", part);
  	return 0;
      }
--- 353,359 ----
  #endif
  
  #if defined(AFS_DUX40_ENV) &amp;&amp; !defined(AFS_NAMEI_ENV)
!     if (status.st_ino != ROOTINO) {
  	Log("%s is not a mounted file system; ignored.\n", part);
  	return 0;
      }
Index: openafs/src/volser/Makefile.in
diff -c openafs/src/volser/Makefile.in:1.14 openafs/src/volser/Makefile.in:1.15
*** openafs/src/volser/Makefile.in:1.14	Fri Nov 14 22:12:16 2003
--- openafs/src/volser/Makefile.in	Mon Aug  9 00:35:54 2004
***************
*** 148,154 ****
  	${INSTALL} $? $@
  
  ${DEST}/root.server/usr/afs/bin/volserver: volserver
! 	${INSTALL} $? $@
  
  #
  # Misc targets
--- 148,165 ----
  	${INSTALL} $? $@
  
  ${DEST}/root.server/usr/afs/bin/volserver: volserver
! 	@case ${SYS_NAME} in \
! 	alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*|sunx86*) \
! 	echo "Don't install volserver for ${SYS_NAME}" ;; \
! 	*_darwin_[1-6][0-9]) \
! 	echo ${INSTALL} -ns $? $@ ; \
! 	${INSTALL} -ns $? $@ ;; \
! 	*_darwin_*) \
! 	echo "Don't install volserver for ${SYS_NAME}" ;; \
! 	*) \
! 	echo ${INSTALL} -ns $? $@ ; \
! 	${INSTALL} -ns $? $@ ;; \
! 	esac
  
  #
  # Misc targets
***************
*** 184,190 ****
  	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvlibexecdir}/volserver: volserver
! 	${INSTALL} $? $@
  
  ${DESTDIR}${libdir}/afs/libvolser.a: libvolser.a
  	${INSTALL} $? $@
--- 195,212 ----
  	${INSTALL} $? $@
  
  ${DESTDIR}${afssrvlibexecdir}/volserver: volserver
! 	@case ${SYS_NAME} in \
! 	alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*|sunx86*) \
! 	echo "Don't install volserver for ${SYS_NAME}" ;; \
! 	*_darwin_[1-6][0-9]) \
! 	echo ${INSTALL} -ns $? $@ ; \
! 	${INSTALL} -ns $? $@ ;; \
! 	*_darwin_*) \
! 	echo "Don't install volserver for ${SYS_NAME}" ;; \
! 	*) \
! 	echo ${INSTALL} -ns $? $@ ; \
! 	${INSTALL} -ns $? $@ ;; \
! 	esac
  
  ${DESTDIR}${libdir}/afs/libvolser.a: libvolser.a
  	${INSTALL} $? $@
Index: openafs/src/volser/NTMakefile
diff -c openafs/src/volser/NTMakefile:1.7 openafs/src/volser/NTMakefile:1.8
*** openafs/src/volser/NTMakefile:1.7	Sat May 29 19:48:17 2004
--- openafs/src/volser/NTMakefile	Thu Aug  5 12:31:43 2004
***************
*** 93,99 ****
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  $(VOLSERVER_EXEFILE): $(VOLSERVER_EXEOBJS) $(VOLSERVER_EXELIBS) $(EXEC_LIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP) 
  
  ############################################################################
--- 93,99 ----
  	$(DESTDIR)\lib\afs\afsprocmgmt.lib
  
  $(VOLSERVER_EXEFILE): $(VOLSERVER_EXEOBJS) $(VOLSERVER_EXELIBS) $(EXEC_LIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP) 
  
  ############################################################################
***************
*** 118,124 ****
  	$(DESTDIR)\lib\afs\afspioctl.lib
  
  $(RS_VOS_EXEFILE): $(VOS_EXEOBJS) $(VOS_EXELIBS) $(EXEC_LIBS)
! 	$(EXECONLINK) dnsapi.lib
  	$(EXEPREP) 
  
  $(CL_VOS_EXEFILE): $(RS_VOS_EXEFILE)
--- 118,124 ----
  	$(DESTDIR)\lib\afs\afspioctl.lib
  
  $(RS_VOS_EXEFILE): $(VOS_EXEOBJS) $(VOS_EXELIBS) $(EXEC_LIBS)
! 	$(EXECONLINK) dnsapi.lib mpr.lib
  	$(EXEPREP) 
  
  $(CL_VOS_EXEFILE): $(RS_VOS_EXEFILE)
Index: openafs/src/volser/volprocs.c
diff -c openafs/src/volser/volprocs.c:1.33 openafs/src/volser/volprocs.c:1.34
*** openafs/src/volser/volprocs.c:1.33	Thu Jan  1 01:22:31 2004
--- openafs/src/volser/volprocs.c	Wed Jul 28 23:44:08 2004
***************
*** 11,17 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.33 2004/01/01 06:22:31 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
--- 11,17 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/volprocs.c,v 1.34 2004/07/29 03:44:08 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
***************
*** 1540,1545 ****
--- 1540,1549 ----
  	td-&gt;maxquota = astatus-&gt;maxquota;
      if (astatus-&gt;dayUse != -1)
  	td-&gt;dayUse = astatus-&gt;dayUse;
+     if (astatus-&gt;creationDate != -1)
+ 	td-&gt;creationDate = astatus-&gt;creationDate;
+     if (astatus-&gt;updateDate != -1)
+ 	td-&gt;updateDate = astatus-&gt;updateDate;
      VUpdateVolume(&amp;error, tv);
      tt-&gt;rxCallPtr = (struct rx_call *)0;
      if (TRELE(tt))
Index: openafs/src/volser/volser.p.h
diff -c openafs/src/volser/volser.p.h:1.7 openafs/src/volser/volser.p.h:1.8
*** openafs/src/volser/volser.p.h:1.7	Thu Jan  8 16:54:10 2004
--- openafs/src/volser/volser.p.h	Wed Jul 28 23:44:08 2004
***************
*** 157,168 ****
  
  /* Values for the UV_RestoreVolume flags parameter */
  /* Also used for UV_CopyVolume and UV_CloneVolume */
! #define RV_FULLRST 0x1
! #define RV_OFFLINE 0x2
! #define RV_RDONLY  0x10000
! #define RV_CPINCR  0x20000
! #define RV_NOVLDB  0x40000
! #define RV_NOCLONE 0x80000
  
  extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
  extern int vsu_ExtractName(char rname[], char name[]);
--- 157,174 ----
  
  /* Values for the UV_RestoreVolume flags parameter */
  /* Also used for UV_CopyVolume and UV_CloneVolume */
! #define RV_FULLRST	0x00001
! #define RV_OFFLINE	0x00002
! #define RV_CRDUMP	0x00010
! #define RV_CRKEEP	0x00020
! #define RV_CRNEW	0x00040
! #define RV_LUDUMP	0x00100
! #define RV_LUKEEP	0x00200
! #define RV_LUNEW	0x00400
! #define RV_RDONLY	0x10000
! #define RV_CPINCR	0x20000
! #define RV_NOVLDB	0x40000
! #define RV_NOCLONE	0x80000
  
  extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
  extern int vsu_ExtractName(char rname[], char name[]);
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.38 openafs/src/volser/vos.c:1.40
*** openafs/src/volser/vos.c:1.38	Thu Apr  8 18:20:39 2004
--- openafs/src/volser/vos.c	Thu Jul 29 14:51:20 2004
***************
*** 11,17 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.38 2004/04/08 22:20:39 jaltman Exp $");
  
  #include &lt;sys/types.h&gt;
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40 2004/07/29 18:51:20 shadow Exp $");
  
  #include &lt;sys/types.h&gt;
  #ifdef AFS_NT40_ENV
***************
*** 499,510 ****
  		fprintf(STDOUT, "    Last Access %s",
  			ctime((time_t *) &amp; pntr-&gt;accessDate));
  #endif
! 	    if (pntr-&gt;updateDate &lt; pntr-&gt;creationDate)
! 		fprintf(STDOUT, "    Last Update %s",
! 			ctime((time_t *) &amp; pntr-&gt;creationDate));
! 	    else
! 		fprintf(STDOUT, "    Last Update %s",
! 			ctime((time_t *) &amp; pntr-&gt;updateDate));
  	    fprintf(STDOUT,
  		    "    %d accesses in the past day (i.e., vnode references)\n",
  		    pntr-&gt;dayUse);
--- 499,506 ----
  		fprintf(STDOUT, "    Last Access %s",
  			ctime((time_t *) &amp; pntr-&gt;accessDate));
  #endif
! 	    fprintf(STDOUT, "    Last Update %s",
! 		    ctime((time_t *) &amp; pntr-&gt;updateDate));
  	    fprintf(STDOUT,
  		    "    %d accesses in the past day (i.e., vnode references)\n",
  		    pntr-&gt;dayUse);
***************
*** 656,667 ****
  		fprintf(STDOUT, "    Last Access %s",
  			ctime((time_t *) &amp; a_xInfoP-&gt;accessDate));
  #endif
! 	    if (a_xInfoP-&gt;updateDate &lt; a_xInfoP-&gt;creationDate)
! 		fprintf(STDOUT, "    Last Update %s",
! 			ctime((time_t *) &amp; a_xInfoP-&gt;creationDate));
! 	    else
! 		fprintf(STDOUT, "    Last Update %s",
! 			ctime((time_t *) &amp; a_xInfoP-&gt;updateDate));
  	    fprintf(STDOUT,
  		    "    %d accesses in the past day (i.e., vnode references)\n",
  		    a_xInfoP-&gt;dayUse);
--- 652,659 ----
  		fprintf(STDOUT, "    Last Access %s",
  			ctime((time_t *) &amp; a_xInfoP-&gt;accessDate));
  #endif
! 	    fprintf(STDOUT, "    Last Update %s",
! 		    ctime((time_t *) &amp; a_xInfoP-&gt;updateDate));
  	    fprintf(STDOUT,
  		    "    %d accesses in the past day (i.e., vnode references)\n",
  		    a_xInfoP-&gt;dayUse);
***************
*** 2254,2260 ****
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu shadowed from %s %s to %s %s \n",
  	    (unsigned long)volid, as-&gt;parms[1].items-&gt;data, fromPartName,
! 	    as-&gt;parms[4].items-&gt;data, toPartName);
  
      return 0;
  }
--- 2246,2252 ----
      MapPartIdIntoName(frompart, fromPartName);
      fprintf(STDOUT, "Volume %lu shadowed from %s %s to %s %s \n",
  	    (unsigned long)volid, as-&gt;parms[1].items-&gt;data, fromPartName,
! 	    as-&gt;parms[3].items-&gt;data, toPartName);
  
      return 0;
  }
***************
*** 2575,2580 ****
--- 2567,2576 ----
  #define FULL  2
  #define INC   3
  
+ #define TS_DUMP	1
+ #define TS_KEEP	2
+ #define TS_NEW	3
+ 
  static
  RestoreVolume(as)
       register struct cmd_syndesc *as;
***************
*** 2582,2587 ****
--- 2578,2584 ----
  {
      afs_int32 avolid, aserver, apart, code, vcode, err;
      afs_int32 aoverwrite = ASK;
+     afs_int32 acreation = 0, alastupdate = 0;
      int restoreflags, readonly = 0, offline = 0, voltype = RWVOL;
      char prompt;
      char afilename[NameLen], avolname[VOLSER_MAXVOLNAME + 1], apartName[10];
***************
*** 2628,2633 ****
--- 2625,2664 ----
  	voltype = ROVOL;
      }
  
+     if (as-&gt;parms[8].items) {
+ 	if ((strcmp(as-&gt;parms[8].items-&gt;data, "d") == 0)
+ 	    || (strcmp(as-&gt;parms[8].items-&gt;data, "dump") == 0)) {
+ 	    acreation = TS_DUMP;
+ 	} else if ((strcmp(as-&gt;parms[8].items-&gt;data, "k") == 0)
+ 	    || (strcmp(as-&gt;parms[8].items-&gt;data, "keep") == 0)) {
+ 	    acreation = TS_KEEP;
+ 	} else if ((strcmp(as-&gt;parms[8].items-&gt;data, "n") == 0)
+ 	    || (strcmp(as-&gt;parms[8].items-&gt;data, "new") == 0)) {
+ 	    acreation = TS_NEW;
+ 	} else {
+ 	    fprintf(STDERR, "vos: %s is not a valid argument to -creation\n",
+ 		    as-&gt;parms[8].items-&gt;data);
+ 	    exit(1);
+ 	}
+     }
+ 
+     if (as-&gt;parms[9].items) {
+ 	if ((strcmp(as-&gt;parms[9].items-&gt;data, "d") == 0)
+ 	    || (strcmp(as-&gt;parms[9].items-&gt;data, "dump") == 0)) {
+ 	    alastupdate = TS_DUMP;
+ 	} else if ((strcmp(as-&gt;parms[9].items-&gt;data, "k") == 0)
+ 	    || (strcmp(as-&gt;parms[9].items-&gt;data, "keep") == 0)) {
+ 	    alastupdate = TS_KEEP;
+ 	} else if ((strcmp(as-&gt;parms[9].items-&gt;data, "n") == 0)
+ 	    || (strcmp(as-&gt;parms[9].items-&gt;data, "new") == 0)) {
+ 	    alastupdate = TS_NEW;
+ 	} else {
+ 	    fprintf(STDERR, "vos: %s is not a valid argument to -lastupdate\n",
+ 		    as-&gt;parms[9].items-&gt;data);
+ 	    exit(1);
+ 	}
+     }
+ 
      aserver = GetServer(as-&gt;parms[0].items-&gt;data);
      if (aserver == 0) {
  	fprintf(STDERR, "vos: server '%s' not found in host table\n",
***************
*** 2779,2784 ****
--- 2810,2847 ----
  	restoreflags |= RV_OFFLINE;
      if (readonly)
  	restoreflags |= RV_RDONLY;
+ 
+     switch (acreation) {
+ 	case TS_DUMP:
+ 	    restoreflags |= RV_CRDUMP;
+ 	    break;
+ 	case TS_KEEP:
+ 	    restoreflags |= RV_CRKEEP;
+ 	    break;
+ 	case TS_NEW:
+ 	    restoreflags |= RV_CRNEW;
+ 	    break;
+ 	default:
+ 	    if (aoverwrite == FULL)
+ 		restoreflags |= RV_CRNEW;
+ 	    else
+ 		restoreflags |= RV_CRKEEP;
+     }
+ 
+     switch (alastupdate) {
+ 	case TS_DUMP:
+ 	    restoreflags |= RV_LUDUMP;
+ 	    break;
+ 	case TS_KEEP:
+ 	    restoreflags |= RV_LUKEEP;
+ 	    break;
+ 	case TS_NEW:
+ 	    restoreflags |= RV_LUNEW;
+ 	    break;
+ 	default:
+ 	    restoreflags |= RV_LUKEEP;
+     }
+ 
      code =
  	UV_RestoreVolume(aserver, apart, avolid, avolname, restoreflags,
  			 WriteData, afilename);
***************
*** 5373,5378 ****
--- 5436,5445 ----
  		"leave restored volume offline");
      cmd_AddParm(ts, "-readonly", CMD_FLAG, CMD_OPTIONAL,
  		"make restored volume read-only");
+     cmd_AddParm(ts, "-creation", CMD_SINGLE, CMD_OPTIONAL,
+ 		"dump | keep | new");
+     cmd_AddParm(ts, "-lastupdate", CMD_SINGLE, CMD_OPTIONAL,
+ 		"dump | keep | new");
      COMMONPARMS;
  
      ts = cmd_CreateSyntax("unlock", LockReleaseCmd, 0,
Index: openafs/src/volser/vsprocs.c
diff -c openafs/src/volser/vsprocs.c:1.32 openafs/src/volser/vsprocs.c:1.33
*** openafs/src/volser/vsprocs.c:1.32	Wed Jun  2 04:39:34 2004
--- openafs/src/volser/vsprocs.c	Wed Jul 28 23:44:08 2004
***************
*** 11,17 ****
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.32 2004/06/02 08:39:34 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
--- 11,17 ----
  #include &lt;afs/param.h&gt;
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.33 2004/07/29 03:44:08 shadow Exp $");
  
  #include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
***************
*** 4040,4045 ****
--- 4040,4046 ----
      afs_int32 totid, code, rcode, vcode, terror = 0;
      afs_int32 rxError = 0;
      struct volser_status tstatus;
+     struct volintInfo vinfo;
      char partName[10];
      afs_int32 pvolid;
      afs_int32 temptid;
***************
*** 4049,4055 ****
      int islocked;
      struct restoreCookie cookie;
      int reuseID;
!     afs_int32 newDate, volflag, voltype, volsertype;
      int index, same, errcode;
      char apartName[10];
  
--- 4050,4057 ----
      int islocked;
      struct restoreCookie cookie;
      int reuseID;
!     afs_int32 volflag, voltype, volsertype;
!     afs_int32 oldCreateDate, oldUpdateDate, newCreateDate, newUpdateDate;
      int index, same, errcode;
      char apartName[10];
  
***************
*** 4129,4134 ****
--- 4131,4143 ----
  	    EGOTO1(refail, code, "Failed to start transaction on %u\n",
  		   pvolid);
  
+ 	    code = AFSVolGetStatus(toconn, totid, &amp;tstatus);
+ 	    EGOTO1(refail, code, "Could not get timestamp from volume %u\n",
+ 		   pvolid);
+ 
+ 	    oldCreateDate = tstatus.creationDate;
+ 	    oldUpdateDate = tstatus.updateDate;
+ 
  	    code =
  		AFSVolSetFlags(toconn, totid,
  			       VTDeleteOnSalvage | VTOutOfService);
***************
*** 4150,4157 ****
  		AFSVolCreateVolume(toconn, topart, tovolname, volsertype, 0,
  				   &amp;pvolid, &amp;totid);
  	    EGOTO1(refail, code, "Could not create new volume %u\n", pvolid);
- 
- 	    newDate = 0;
  	} else {
  	    code =
  		AFSVolTransCreate(toconn, pvolid, topart, ITOffline, &amp;totid);
--- 4159,4164 ----
***************
*** 4161,4169 ****
  	    code = AFSVolGetStatus(toconn, totid, &amp;tstatus);
  	    EGOTO1(refail, code, "Could not get timestamp from volume %u\n",
  		   pvolid);
! 	    newDate = tstatus.creationDate;
  	}
      }
      cookie.parent = pvolid;
      cookie.type = voltype;
      cookie.clone = 0;
--- 4168,4182 ----
  	    code = AFSVolGetStatus(toconn, totid, &amp;tstatus);
  	    EGOTO1(refail, code, "Could not get timestamp from volume %u\n",
  		   pvolid);
! 
! 	    oldCreateDate = tstatus.creationDate;
! 	    oldUpdateDate = tstatus.updateDate;
  	}
+     } else {
+ 	oldCreateDate = 0;
+ 	oldUpdateDate = 0;
      }
+ 
      cookie.parent = pvolid;
      cookie.type = voltype;
      cookie.clone = 0;
***************
*** 4204,4215 ****
  	error = code;
  	goto refail;
      }
!     if (!newDate)
! 	newDate = time(0);
!     code = AFSVolSetDate(toconn, totid, newDate);
      if (code) {
! 	fprintf(STDERR, "Could not set the date on %lu\n",
! 		(unsigned long)pvolid);
  	error = code;
  	goto refail;
      }
--- 4217,4251 ----
  	error = code;
  	goto refail;
      }
! 
!     if (flags &amp; RV_CRDUMP)
! 	newCreateDate = tstatus.creationDate;
!     else if (flags &amp; RV_CRKEEP &amp;&amp; oldCreateDate != 0)
! 	newCreateDate = oldCreateDate;
!     else
! 	newCreateDate = time(0);
!     if (flags &amp; RV_LUDUMP)
! 	newUpdateDate = tstatus.updateDate;
!     else if (flags &amp; RV_LUKEEP)
! 	newUpdateDate = oldUpdateDate;
!     else
! 	newUpdateDate = time(0);
!     code = AFSVolSetDate(toconn,totid, newCreateDate);
      if (code) {
! 	fprintf(STDERR, "Could not set the 'creation' date on %u\n", pvolid);
! 	error = code;
! 	goto refail;
!     }
! 
!     memset(&amp;vinfo, 0, sizeof(struct volintInfo));
!     vinfo.dayUse = -1;
!     vinfo.maxquota = -1;
!     vinfo.creationDate = newCreateDate;
!     vinfo.updateDate = newUpdateDate;
!     code = AFSVolSetInfo(toconn, totid, &amp;vinfo);
!     if (code) {
! 	fprintf(STDERR, "Could not set the 'last updated' date on %u\n",
! 		pvolid);
  	error = code;
  	goto refail;
      }
</pre></body></html>