Index: openafs/src/WINNT/afsd/afsd_init.c
diff -c openafs/src/WINNT/afsd/afsd_init.c:1.40.2.20 openafs/src/WINNT/afsd/afsd_init.c:1.40.2.21
*** openafs/src/WINNT/afsd/afsd_init.c:1.40.2.20	Sun May 29 23:52:52 2005
--- openafs/src/WINNT/afsd/afsd_init.c	Thu Aug  4 12:06:37 2005
***************
*** 139,145 ****
      char wd[256];
      char t[100], u[100], *p, *path;
      int zilch;
!     int code;
      DWORD dwLow, dwHigh;
      HKEY parmKey;
      DWORD dummyLen;
--- 139,145 ----
      char wd[256];
      char t[100], u[100], *p, *path;
      int zilch;
!     DWORD code;
      DWORD dwLow, dwHigh;
      HKEY parmKey;
      DWORD dummyLen;
Index: openafs/src/WINNT/afsd/cm_aclent.c
diff -c openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.7 openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.8
*** openafs/src/WINNT/afsd/cm_aclent.c:1.4.2.7	Wed Jul 13 10:29:16 2005
--- openafs/src/WINNT/afsd/cm_aclent.c	Fri Aug  5 20:36:11 2005
***************
*** 190,195 ****
--- 190,202 ----
      long count;
      cm_aclent_t * aclp;
  
+     if ( cm_data.aclLRUp == NULL && cm_data.aclLRUEndp != NULL ||
+          cm_data.aclLRUp != NULL && cm_data.aclLRUEndp == NULL) {
+         afsi_log("cm_ValidateACLCache failure: inconsistent LRU pointers");
+         fprintf(stderr, "cm_ValidateACLCache failure: inconsistent LRU pointers\n");
+         return -9;
+     }
+ 
      for ( aclp = cm_data.aclLRUp, count = 0; aclp;
            aclp = (cm_aclent_t *) osi_QNext(&aclp->q), count++ ) {
          if (aclp->magic != CM_ACLENT_MAGIC) {
Index: openafs/src/WINNT/afsd/cm_buf.c
diff -c openafs/src/WINNT/afsd/cm_buf.c:1.13.2.11 openafs/src/WINNT/afsd/cm_buf.c:1.13.2.12
*** openafs/src/WINNT/afsd/cm_buf.c:1.13.2.11	Sun Jun 12 07:45:49 2005
--- openafs/src/WINNT/afsd/cm_buf.c	Fri Aug  5 20:36:11 2005
***************
*** 156,161 ****
--- 156,168 ----
      cm_buf_t * bp, *bpf, *bpa, *bpb;
      afs_uint32 countb = 0, countf = 0, counta = 0;
  
+     if (cm_data.buf_freeListp == NULL && cm_data.buf_freeListEndp != NULL ||
+          cm_data.buf_freeListp != NULL && cm_data.buf_freeListEndp == NULL) {
+         afsi_log("cm_ValidateBuffers failure: inconsistent free list pointers");
+         fprintf(stderr, "cm_ValidateBuffers failure: inconsistent free list pointers\n");
+         return -9;                  
+     }
+ 
      for (bp = cm_data.buf_freeListEndp; bp; bp=(cm_buf_t *) osi_QPrev(&bp->q)) { 
          if (bp->magic != CM_BUF_MAGIC) {
              afsi_log("cm_ValidateBuffers failure: bp->magic != CM_BUF_MAGIC");
***************
*** 470,476 ****
              lock_ObtainMutex(&scp->mx);
              if (scp->flags & CM_SCACHEFLAG_WAITING) {
                  osi_Log1(buf_logp, "buf_WaitIO waking scp 0x%x", scp);
!                 osi_Wakeup(&scp->flags);
                  lock_ReleaseMutex(&scp->mx);
              }
          }
--- 477,483 ----
              lock_ObtainMutex(&scp->mx);
              if (scp->flags & CM_SCACHEFLAG_WAITING) {
                  osi_Log1(buf_logp, "buf_WaitIO waking scp 0x%x", scp);
!                 osi_Wakeup((long)&scp->flags);
                  lock_ReleaseMutex(&scp->mx);
              }
          }
Index: openafs/src/WINNT/afsd/cm_ioctl.c
diff -c openafs/src/WINNT/afsd/cm_ioctl.c:1.33.2.12 openafs/src/WINNT/afsd/cm_ioctl.c:1.33.2.13
*** openafs/src/WINNT/afsd/cm_ioctl.c:1.33.2.12	Sun May 29 23:52:53 2005
--- openafs/src/WINNT/afsd/cm_ioctl.c	Thu Aug  4 12:06:37 2005
***************
*** 1169,1183 ****
  	long code = 0;
  
  	if (cm_freelanceEnabled) {
! 	    StringCbCopyA(ioctlp->outDatap, 999999, "Freelance.Local.Root");
! 		ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
  	} else if (cm_data.rootCellp) {
  	    /* return the default cellname to the caller */
  	    StringCbCopyA(ioctlp->outDatap, 999999, cm_data.rootCellp->name);
  	    ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
  	} else {
  	    /* if we don't know our default cell, return failure */
! 		code = CM_ERROR_NOSUCHCELL;
      }
  
      return code;
--- 1169,1184 ----
  	long code = 0;
  
  	if (cm_freelanceEnabled) {
!             if (cm_GetRootCellName(ioctlp->outDatap))
!                 StringCbCopyA(ioctlp->outDatap, 999999, "Freelance.Local.Root");
!             ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
  	} else if (cm_data.rootCellp) {
  	    /* return the default cellname to the caller */
  	    StringCbCopyA(ioctlp->outDatap, 999999, cm_data.rootCellp->name);
  	    ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
  	} else {
  	    /* if we don't know our default cell, return failure */
!             code = CM_ERROR_NOSUCHCELL;
      }
  
      return code;
Index: openafs/src/WINNT/afsd/cm_scache.c
diff -c openafs/src/WINNT/afsd/cm_scache.c:1.14.2.12 openafs/src/WINNT/afsd/cm_scache.c:1.14.2.13
*** openafs/src/WINNT/afsd/cm_scache.c:1.14.2.12	Fri Jul 22 21:17:42 2005
--- openafs/src/WINNT/afsd/cm_scache.c	Fri Aug  5 20:36:11 2005
***************
*** 203,208 ****
--- 203,215 ----
      cm_scache_t * scp, *lscp;
      long i;
  
+     if ( cm_data.scacheLRUFirstp == NULL && cm_data.scacheLRULastp != NULL ||
+          cm_data.scacheLRUFirstp != NULL && cm_data.scacheLRULastp == NULL) {
+         afsi_log("cm_ValidateSCache failure: inconsistent LRU pointers");
+         fprintf(stderr, "cm_ValidateSCache failure: inconsistent LRU pointers\n");
+         return -17;
+     }
+ 
      for ( scp = cm_data.scacheLRUFirstp, lscp = NULL, i = 0; 
            scp;
            lscp = scp, scp = (cm_scache_t *) osi_QNext(&scp->q), i++ ) {
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.16.2.7 openafs/src/WINNT/afsd/fs.c:1.16.2.8
*** openafs/src/WINNT/afsd/fs.c:1.16.2.7	Wed May 18 18:57:08 2005
--- openafs/src/WINNT/afsd/fs.c	Thu Aug  4 12:06:37 2005
***************
*** 271,276 ****
--- 271,292 ----
      return 1;
  }
  
+ static int 
+ IsFreelanceRoot(char *apath)
+ {
+     struct ViceIoctl blob;
+     afs_int32 code;
+ 
+     blob.in_size = 0;
+     blob.out_size = MAXSIZE;
+     blob.out = space;
+ 
+     code = pioctl(apath, VIOC_FILE_CELL_NAME, &blob, 1);
+     if (code == 0)
+         return !strcmp("Freelance.Local.Root",space);
+     return 1;   /* assume it is because it is more restrictive that way */
+ }
+ 
  /* return a static pointer to a buffer */
  static char *
  Parent(char *apath)
***************
*** 690,698 ****
      return mydata;
  }
  
  #define AFSCLIENT_ADMIN_GROUPNAME "AFS Client Admins"
  
! BOOL IsAdmin (void)
  {
      static BOOL fAdmin = FALSE;
      static BOOL fTested = FALSE;
--- 706,732 ----
      return mydata;
  }
  
+ static DWORD IsFreelance(void)
+ {
+     HKEY  parmKey;
+     DWORD code;
+     DWORD dummyLen;
+     DWORD enabled = 0;
+ 
+     code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
+                          0, KEY_QUERY_VALUE, &parmKey);
+     if (code == ERROR_SUCCESS) {
+         dummyLen = sizeof(cm_freelanceEnabled);
+         code = RegQueryValueEx(parmKey, "FreelanceClient", NULL, NULL,
+                             (BYTE *) &enabled, &dummyLen);
+         RegCloseKey (parmKey);
+     }
+     return enabled;
+ }
+ 
  #define AFSCLIENT_ADMIN_GROUPNAME "AFS Client Admins"
  
! static BOOL IsAdmin (void)
  {
      static BOOL fAdmin = FALSE;
      static BOOL fTested = FALSE;
***************
*** 1750,1755 ****
--- 1784,1790 ----
      struct vldbentry vldbEntry;
  #endif /* not WIN32 */
      struct ViceIoctl blob;
+     char * parent;
  
      /*
  
***************
*** 1786,1796 ****
          volName = ++tmpName;
      }
  
!     if (!InAFS(Parent(as->parms[0].items->data))) {
  	fprintf(stderr,"%s: mount points must be created within the AFS file system\n", pn);
  	return 1;
      }
  
      if (!cellName) {
  	blob.in_size = 0;
  	blob.out_size = MAXSIZE;
--- 1821,1837 ----
          volName = ++tmpName;
      }
  
!     parent = Parent(as->parms[0].items->data);
!     if (!InAFS(parent)) {
  	fprintf(stderr,"%s: mount points must be created within the AFS file system\n", pn);
  	return 1;
      }
  
+     if ( IsFreelanceRoot(parent) && !IsAdmin() ) {
+ 	fprintf(stderr,"%s: Only AFS Client Administrators may alter the root.afs volume\n", pn);
+ 	return 1;
+     }
+ 
      if (!cellName) {
  	blob.in_size = 0;
  	blob.out_size = MAXSIZE;
***************
*** 1901,1907 ****
              error = 1;
  	    continue;	/* don't bother trying */
  	}
! 	blob.out_size = 0;
  	blob.in = tp;
  	blob.in_size = strlen(tp)+1;
  	code = pioctl(tbuffer, VIOC_AFS_DELETE_MT_PT, &blob, 0);
--- 1942,1955 ----
              error = 1;
  	    continue;	/* don't bother trying */
  	}
! 
!         if ( IsFreelanceRoot(Parent(tp)) && !IsAdmin() ) {
!             fprintf(stderr,"%s: Only AFS Client Administrators may alter the root.afs volume\n", pn);
!             error = 1;
!             continue;   /* skip */
!         }
! 
!         blob.out_size = 0;
  	blob.in = tp;
  	blob.in_size = strlen(tp)+1;
  	code = pioctl(tbuffer, VIOC_AFS_DELETE_MT_PT, &blob, 0);
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.55.2.25 openafs/src/WINNT/afsd/smb.c:1.55.2.26
*** openafs/src/WINNT/afsd/smb.c:1.55.2.25	Sun Jun 12 07:45:49 2005
--- openafs/src/WINNT/afsd/smb.c	Thu Aug  4 12:06:37 2005
***************
*** 7748,7754 ****
          ncbp->ncb_length = sizeof(lana_list);
          code = Netbios(ncbp);
          if (code != 0) {
!             osi_Log1(smb_logp, "Netbios NCBENUM error code %d", code);
              osi_panic(s, __FILE__, __LINE__);
          }
      }
--- 7748,7754 ----
          ncbp->ncb_length = sizeof(lana_list);
          code = Netbios(ncbp);
          if (code != 0) {
!             afsi_log("Netbios NCBENUM error code %d", code);
              osi_panic(s, __FILE__, __LINE__);
          }
      }
***************
*** 7769,7778 ****
          if (code == 0) 
              code = ncbp->ncb_retcode;
          if (code != 0) {
!             osi_Log2(smb_logp, "Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
              lana_list.lana[i] = 255;  /* invalid lana */
          } else {
!             osi_Log1(smb_logp, "Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
          }
      }
  #else
--- 7769,7778 ----
          if (code == 0) 
              code = ncbp->ncb_retcode;
          if (code != 0) {
!             afsi_log("Netbios NCBRESET lana %d error code %d", lana_list.lana[i], code);
              lana_list.lana[i] = 255;  /* invalid lana */
          } else {
!             afsi_log("Netbios NCBRESET lana %d succeeded", lana_list.lana[i]);
          }
      }
  #else
***************
*** 7794,7800 ****
      len=lstrlen(smb_localNamep);
      memset(smb_sharename,' ',NCBNAMSZ);
      memcpy(smb_sharename,smb_localNamep,len);
!     osi_Log1(smb_logp, "lana_list.length %d", lana_list.length);
  
      /* Keep the name so we can unregister it later */
      for (l = 0; l < lana_list.length; l++) {
--- 7794,7800 ----
      len=lstrlen(smb_localNamep);
      memset(smb_sharename,' ',NCBNAMSZ);
      memcpy(smb_sharename,smb_localNamep,len);
!     afsi_log("lana_list.length %d", lana_list.length);
  
      /* Keep the name so we can unregister it later */
      for (l = 0; l < lana_list.length; l++) {
***************
*** 7809,7826 ****
          code = Netbios(ncbp, dos_ncb);
  #endif /* !DJGPP */
            
!         osi_Log4(smb_logp, "Netbios NCBADDNAME lana=%d code=%d retcode=%d complete=%d",
                   lana, code, ncbp->ncb_retcode, ncbp->ncb_cmd_cplt);
          {
              char name[NCBNAMSZ+1];
              name[NCBNAMSZ]=0;
              memcpy(name,ncbp->ncb_name,NCBNAMSZ);
!             osi_Log1(smb_logp, "Netbios NCBADDNAME added new name >%s<",osi_LogSaveString(smb_logp, name));
          }
  
          if (code == 0) code = ncbp->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;
--- 7809,7826 ----
          code = Netbios(ncbp, dos_ncb);
  #endif /* !DJGPP */
            
!         afsi_log("Netbios NCBADDNAME lana=%d code=%d retcode=%d complete=%d",
                   lana, code, ncbp->ncb_retcode, ncbp->ncb_cmd_cplt);
          {
              char name[NCBNAMSZ+1];
              name[NCBNAMSZ]=0;
              memcpy(name,ncbp->ncb_name,NCBNAMSZ);
!             afsi_log("Netbios NCBADDNAME added new name >%s<",name);
          }
  
          if (code == 0) code = ncbp->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;
***************
*** 7828,7840 ****
  #endif	  
          }
          else {
!             osi_Log2(smb_logp, "Netbios NCBADDNAME lana %d error code %d", lana, code);
              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->ncb_command = NCBDELNAME;
                  memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ);
--- 7828,7840 ----
  #endif	  
          }
          else {
!             afsi_log("Netbios NCBADDNAME lana %d error code %d", lana, code);
              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->ncb_command = NCBDELNAME;
                  memcpy(ncbp->ncb_name,smb_sharename,NCBNAMSZ);
***************
*** 7847,7853 ****
                  if (code == 0) 
                      code = ncbp->ncb_retcode;
                  else {
!                     osi_Log2(smb_logp, "Netbios NCBDELNAME lana %d error code %d\n", lana, code);
                  }
                  if (code != 0 || delname_tried) {
                      lana_list.lana[l] = 255;
--- 7847,7853 ----
                  if (code == 0) 
                      code = ncbp->ncb_retcode;
                  else {
!                     afsi_log("Netbios NCBDELNAME lana %d error code %d\n", lana, code);
                  }
                  if (code != 0 || delname_tried) {
                      lana_list.lana[l] = 255;
***************
*** 7861,7867 ****
                  }
              }
              else {
!                 osi_Log2(smb_logp, "Netbios NCBADDNAME lana %d error code %d", lana, code);
                  lana_list.lana[l] = 255;  /* invalid lana */
                  osi_panic(s, __FILE__, __LINE__);
              }
--- 7861,7867 ----
                  }
              }
              else {
!                 afsi_log("Netbios NCBADDNAME lana %d error code %d", lana, code);
                  lana_list.lana[l] = 255;  /* invalid lana */
                  osi_panic(s, __FILE__, __LINE__);
              }
***************
*** 8192,8202 ****
                      sprintf(message,"MsV1_0SetProcessOption failure: nts 0x%x ntsEx 0x%x",
                                         nts, ntsEx);
                      OutputDebugString(message);
!                     osi_Log2(smb_logp,"MsV1_0SetProcessOption failure: nts 0x%x ntsEx 0x%x",
!                               nts, ntsEx);
                  } else {
                      OutputDebugString("MsV1_0SetProcessOption success");
!                     osi_Log0(smb_logp,"MsV1_0SetProcessOption success");
                  }
                  /* END - code from Larry */
  
--- 8192,8201 ----
                      sprintf(message,"MsV1_0SetProcessOption failure: nts 0x%x ntsEx 0x%x",
                                         nts, ntsEx);
                      OutputDebugString(message);
!                     afsi_log(message);
                  } else {
                      OutputDebugString("MsV1_0SetProcessOption success");
!                     afsi_log("MsV1_0SetProcessOption success");
                  }
                  /* END - code from Larry */
  
Index: openafs/src/WINNT/afsd/symlink.c
diff -c openafs/src/WINNT/afsd/symlink.c:1.2.20.1 openafs/src/WINNT/afsd/symlink.c:1.2.20.2
*** openafs/src/WINNT/afsd/symlink.c:1.2.20.1	Fri Nov  5 14:21:47 2004
--- openafs/src/WINNT/afsd/symlink.c	Thu Aug  4 12:06:38 2005
***************
*** 18,23 ****
--- 18,24 ----
  #include <time.h>
  #include <winsock2.h>
  #include <errno.h>
+ #include <assert.h>
  
  #include <osi.h>
  #include <afsint.h>
***************
*** 57,64 ****
  }
  
  /* this function returns TRUE (1) if the file is in AFS, otherwise false (0) */
! static int InAFS(apath)
! register char *apath; {
      struct ViceIoctl blob;
      register afs_int32 code;
  
--- 58,65 ----
  }
  
  /* this function returns TRUE (1) if the file is in AFS, otherwise false (0) */
! static int InAFS(register char *apath)
! {
      struct ViceIoctl blob;
      register afs_int32 code;
  
***************
*** 68,78 ****
  
      code = pioctl(apath, VIOC_FILE_CELL_NAME, &blob, 1);
      if (code) {
! 	if ((errno == EINVAL) || (errno == ENOENT)) return 0;
      }
      return 1;
  }
  
  /* return a static pointer to a buffer */
  static char *Parent(apath)
  char *apath; {
--- 69,235 ----
  
      code = pioctl(apath, VIOC_FILE_CELL_NAME, &blob, 1);
      if (code) {
! 	if ((errno == EINVAL) || (errno == ENOENT)) 
!             return 0;
      }
      return 1;
  }
  
+ static int 
+ IsFreelanceRoot(char *apath)
+ {
+     struct ViceIoctl blob;
+     afs_int32 code;
+ 
+     blob.in_size = 0;
+     blob.out_size = MAXSIZE;
+     blob.out = space;
+ 
+     code = pioctl(apath, VIOC_FILE_CELL_NAME, &blob, 1);
+     if (code == 0)
+         return !strcmp("Freelance.Local.Root",space);
+     return 1;   /* assume it is because it is more restrictive that way */
+ }
+ 
+ #define AFSCLIENT_ADMIN_GROUPNAME "AFS Client Admins"
+ 
+ static BOOL IsAdmin (void)
+ {
+     static BOOL fAdmin = FALSE;
+     static BOOL fTested = FALSE;
+ 
+     if (!fTested)
+     {
+         /* Obtain the SID for the AFS client admin group.  If the group does
+          * not exist, then assume we have AFS client admin privileges.
+          */
+         PSID psidAdmin = NULL;
+         DWORD dwSize, dwSize2;
+         char pszAdminGroup[ MAX_COMPUTERNAME_LENGTH + sizeof(AFSCLIENT_ADMIN_GROUPNAME) + 2 ];
+         char *pszRefDomain = NULL;
+         SID_NAME_USE snu = SidTypeGroup;
+ 
+         dwSize = sizeof(pszAdminGroup);
+ 
+         if (!GetComputerName(pszAdminGroup, &dwSize)) {
+             /* Can't get computer name.  We return false in this case.
+                Retain fAdmin and fTested. This shouldn't happen.*/
+             return FALSE;
+         }
+ 
+         dwSize = 0;
+         dwSize2 = 0;
+ 
+         strcat(pszAdminGroup,"\\");
+         strcat(pszAdminGroup, AFSCLIENT_ADMIN_GROUPNAME);
+ 
+         LookupAccountName(NULL, pszAdminGroup, NULL, &dwSize, NULL, &dwSize2, &snu);
+         /* that should always fail. */
+ 
+         if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+             /* if we can't find the group, then we allow the operation */
+             fAdmin = TRUE;
+             return TRUE;
+         }
+ 
+         if (dwSize == 0 || dwSize2 == 0) {
+             /* Paranoia */
+             fAdmin = TRUE;
+             return TRUE;
+         }
+ 
+         psidAdmin = (PSID)malloc(dwSize); memset(psidAdmin,0,dwSize);
+         assert(psidAdmin);
+         pszRefDomain = (char *)malloc(dwSize2);
+         assert(pszRefDomain);
+ 
+         if (!LookupAccountName(NULL, pszAdminGroup, psidAdmin, &dwSize, pszRefDomain, &dwSize2, &snu)) {
+             /* We can't lookup the group now even though we looked it up earlier.  
+                Could this happen? */
+             fAdmin = TRUE;
+         } else {
+             /* Then open our current ProcessToken */
+             HANDLE hToken;
+ 
+             if (OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken))
+             {
+ 
+                 if (!CheckTokenMembership(hToken, psidAdmin, &fAdmin)) {
+                     /* We'll have to allocate a chunk of memory to store the list of
+                      * groups to which this user belongs; find out how much memory
+                      * we'll need.
+                      */
+                     DWORD dwSize = 0;
+                     PTOKEN_GROUPS pGroups;
+ 
+                     GetTokenInformation (hToken, TokenGroups, NULL, dwSize, &dwSize);
+ 
+                     pGroups = (PTOKEN_GROUPS)malloc(dwSize);
+                     assert(pGroups);
+ 
+                     /* Allocate that buffer, and read in the list of groups. */
+                     if (GetTokenInformation (hToken, TokenGroups, pGroups, dwSize, &dwSize))
+                     {
+                         /* Look through the list of group SIDs and see if any of them
+                          * matches the AFS Client Admin group SID.
+                          */
+                         size_t iGroup = 0;
+                         for (; (!fAdmin) && (iGroup < pGroups->GroupCount); ++iGroup)
+                         {
+                             if (EqualSid (psidAdmin, pGroups->Groups[ iGroup ].Sid)) {
+                                 fAdmin = TRUE;
+                             }
+                         }
+                     }
+ 
+                     if (pGroups)
+                         free(pGroups);
+                 }
+ 
+                 /* if do not have permission because we were not explicitly listed
+                  * in the Admin Client Group let's see if we are the SYSTEM account
+                  */
+                 if (!fAdmin) {
+                     PTOKEN_USER pTokenUser;
+                     SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY;
+                     PSID pSidLocalSystem = 0;
+                     DWORD gle;
+ 
+                     GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize);
+ 
+                     pTokenUser = (PTOKEN_USER)malloc(dwSize);
+                     assert(pTokenUser);
+ 
+                     if (!GetTokenInformation(hToken, TokenUser, pTokenUser, dwSize, &dwSize))
+                         gle = GetLastError();
+ 
+                     if (AllocateAndInitializeSid( &SIDAuth, 1,
+                                                   SECURITY_LOCAL_SYSTEM_RID,
+                                                   0, 0, 0, 0, 0, 0, 0,
+                                                   &pSidLocalSystem))
+                     {
+                         if (EqualSid(pTokenUser->User.Sid, pSidLocalSystem)) {
+                             fAdmin = TRUE;
+                         }
+ 
+                         FreeSid(pSidLocalSystem);
+                     }
+ 
+                     if ( pTokenUser )
+                         free(pTokenUser);
+                 }
+             }
+         }
+ 
+         free(psidAdmin);
+         free(pszRefDomain);
+ 
+         fTested = TRUE;
+     }
+ 
+     return fAdmin;
+ }
+ 
  /* return a static pointer to a buffer */
  static char *Parent(apath)
  char *apath; {
***************
*** 230,241 ****
  register struct cmd_syndesc *as; {
      register afs_int32 code;
      struct ViceIoctl blob;
  
!     if (!InAFS(Parent(as->parms[0].items->data))) {
  	fprintf(stderr,"%s: symlinks must be created within the AFS file system\n", pn);
  	return 1;
      }
  
      strcpy(space, as->parms[1].items->data);
  #ifdef WIN32
      /* create symlink with a special pioctl for Windows NT, since it doesn't
--- 387,406 ----
  register struct cmd_syndesc *as; {
      register afs_int32 code;
      struct ViceIoctl blob;
+     char * parent;
+ 
+     parent = Parent(as->parms[0].items->data);
  
!     if (!InAFS(parent)) {
  	fprintf(stderr,"%s: symlinks must be created within the AFS file system\n", pn);
  	return 1;
      }
  
+     if ( IsFreelanceRoot(parent) && !IsAdmin() ) {
+ 	fprintf(stderr,"%s: Only AFS Client Administrators may alter the root.afs volume\n", pn);
+ 	return 1;
+     }
+ 
      strcpy(space, as->parms[1].items->data);
  #ifdef WIN32
      /* create symlink with a special pioctl for Windows NT, since it doesn't
***************
*** 299,310 ****
  	code = pioctl(tbuffer, VIOC_LISTSYMLINK, &blob, 0);
  	if (code) {
  	    if (errno == EINVAL)
! 		fprintf(stderr,"fs: '%s' is not a symlink.\n", ti->data);
  	    else {
  		Die(errno, ti->data);
  	    }
  	    continue;	/* don't bother trying */
  	}
  	blob.out_size = 0;
  	blob.in = tp;
  	blob.in_size = strlen(tp)+1;
--- 464,482 ----
  	code = pioctl(tbuffer, VIOC_LISTSYMLINK, &blob, 0);
  	if (code) {
  	    if (errno == EINVAL)
! 		fprintf(stderr,"symlink: '%s' is not a symlink.\n", ti->data);
  	    else {
  		Die(errno, ti->data);
  	    }
  	    continue;	/* don't bother trying */
  	}
+ 
+         if ( IsFreelanceRoot(Parent(tp)) && !IsAdmin() ) {
+             fprintf(stderr,"symlink: Only AFS Client Administrators may alter the root.afs volume\n");
+             code = 1;
+             continue;   /* skip */
+         }
+ 
  	blob.out_size = 0;
  	blob.in = tp;
  	blob.in_size = strlen(tp)+1;
***************
*** 312,318 ****
  	if (code) {
  	    Die(errno, ti->data);
  	}
- 
      }
      return code;
  }
--- 484,489 ----
Index: openafs/src/afs/afs_dcache.c
diff -c openafs/src/afs/afs_dcache.c:1.42.2.14 openafs/src/afs/afs_dcache.c:1.42.2.16
*** openafs/src/afs/afs_dcache.c:1.42.2.14	Tue Jun 21 16:13:48 2005
--- openafs/src/afs/afs_dcache.c	Thu Aug  4 16:45:14 2005
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.42.2.14 2005/06/21 20:13:48 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.42.2.16 2005/08/04 20:45:14 shadow Exp $");
  
  #include "afs/sysincludes.h"	/*Standard vendor system headers */
  #include "afsincludes.h"	/*AFS-based standard headers */
***************
*** 1815,1821 ****
  	       ICL_HANDLE_OFFSET(Position));
      if ((aflags & 4) && (hiszero(avc->m.DataVersion)))
  	doAdjustSize = 1;
!     if ((aflags & 4) && (abyte == Position) && (tlen >= size))
  	overWriteWholeChunk = 1;
      if (doAdjustSize || overWriteWholeChunk) {
  #if	defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV)
--- 1815,1822 ----
  	       ICL_HANDLE_OFFSET(Position));
      if ((aflags & 4) && (hiszero(avc->m.DataVersion)))
  	doAdjustSize = 1;
!     if ((AFS_CHUNKTOBASE(chunk) >= avc->m.Length) ||
! 	 ((aflags & 4) && (abyte == Position) && (tlen >= size)))
  	overWriteWholeChunk = 1;
      if (doAdjustSize || overWriteWholeChunk) {
  #if	defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV)
Index: openafs/src/afs/afs_server.c
diff -c openafs/src/afs/afs_server.c:1.33.2.5 openafs/src/afs/afs_server.c:1.33.2.6
*** openafs/src/afs/afs_server.c:1.33.2.5	Sun Feb 20 20:12:38 2005
--- openafs/src/afs/afs_server.c	Thu Aug  4 16:05:15 2005
***************
*** 33,39 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_server.c,v 1.33.2.5 2005/02/21 01:12:38 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 33,39 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_server.c,v 1.33.2.6 2005/08/04 20:05:15 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 603,609 ****
  	multi_RXAFS_GetTime(&tv.tv_sec, &tv.tv_usec);
  	tc = conns[multi_i];
  	sa = tc->srvr;
! 	if (conntimer[multi_i] == 0)
  	  rx_SetConnDeadTime(tc->id, afs_rx_deadtime);
  	end = osi_Time();
  	results[multi_i]=multi_error;
--- 603,609 ----
  	multi_RXAFS_GetTime(&tv.tv_sec, &tv.tv_usec);
  	tc = conns[multi_i];
  	sa = tc->srvr;
! 	if (conntimer[multi_i] == 1)
  	  rx_SetConnDeadTime(tc->id, afs_rx_deadtime);
  	end = osi_Time();
  	results[multi_i]=multi_error;
Index: openafs/src/afs/LINUX/osi_groups.c
diff -c openafs/src/afs/LINUX/osi_groups.c:1.25.2.2 openafs/src/afs/LINUX/osi_groups.c:1.25.2.3
*** openafs/src/afs/LINUX/osi_groups.c:1.25.2.2	Sun Jan 30 23:14:36 2005
--- openafs/src/afs/LINUX/osi_groups.c	Tue Aug  2 01:16:33 2005
***************
*** 17,23 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.2 2005/01/31 04:14:36 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 17,23 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.3 2005/08/02 05:16:33 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 172,177 ****
--- 172,178 ----
      
      for (i = 0; i < group_info->ngroups; ++i)
        GROUP_AT(tmp, i + need_space) = GROUP_AT(group_info, i);
+     put_group_info(group_info);
      group_info = tmp;
  
      *newpag = (pagvalue == -1 ? genpag() : pagvalue);
Index: openafs/src/afs/LINUX/osi_sleep.c
diff -c openafs/src/afs/LINUX/osi_sleep.c:1.22.2.2 openafs/src/afs/LINUX/osi_sleep.c:1.22.2.5
*** openafs/src/afs/LINUX/osi_sleep.c:1.22.2.2	Mon Jul 25 14:14:40 2005
--- openafs/src/afs/LINUX/osi_sleep.c	Tue Aug  2 10:04:47 2005
***************
*** 11,17 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_sleep.c,v 1.22.2.2 2005/07/25 18:14:40 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/LINUX/osi_sleep.c,v 1.22.2.5 2005/08/02 14:04:47 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 193,199 ****
  	AFS_GUNLOCK();
  	schedule();
  #ifdef AFS_LINUX26_ENV
! #ifdef CONFIG_PF
  	if (current->flags & PF_FREEZE)
  	    refrigerator(PF_FREEZE);
  #endif
--- 193,199 ----
  	AFS_GUNLOCK();
  	schedule();
  #ifdef AFS_LINUX26_ENV
! #ifdef CONFIG_PM
  	if (current->flags & PF_FREEZE)
  	    refrigerator(PF_FREEZE);
  #endif
***************
*** 277,283 ****
      } else
  	schedule_timeout(ticks);
  #ifdef AFS_LINUX26_ENV
! #ifdef CONFIG_PF
      if (current->flags & PF_FREEZE)
  	refrigerator(PF_FREEZE);
  #endif
--- 277,283 ----
      } else
  	schedule_timeout(ticks);
  #ifdef AFS_LINUX26_ENV
! #ifdef CONFIG_PM
      if (current->flags & PF_FREEZE)
  	refrigerator(PF_FREEZE);
  #endif
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.8 openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.9
*** openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.8	Tue Jul 26 14:27:02 2005
--- openafs/src/afs/LINUX/osi_vfsops.c	Tue Aug  9 09:42:12 2005
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.8 2005/07/26 18:27:02 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.9 2005/08/09 13:42:12 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 358,365 ****
  static void
  afs_put_super(struct super_block *sbp)
  {
-     int code = 0;
- 
      AFS_GLOCK();
      AFS_STATCNT(afs_unmount);
  
--- 358,363 ----
***************
*** 382,395 ****
      osi_linux_verify_alloced_memory();
      AFS_GUNLOCK();
  
!     if (!code) {
! 	sbp->s_dev = 0;
  #if defined(AFS_LINUX26_ENV)
! 	module_put(THIS_MODULE);
  #else
! 	MOD_DEC_USE_COUNT;
  #endif
-     }
  }
  
  
--- 380,391 ----
      osi_linux_verify_alloced_memory();
      AFS_GUNLOCK();
  
!     sbp->s_dev = 0;
  #if defined(AFS_LINUX26_ENV)
!     module_put(THIS_MODULE);
  #else
!     MOD_DEC_USE_COUNT;
  #endif
  }
  
  
***************
*** 436,447 ****
      return 0;
  }
  
- void
- afs_umount_begin(struct super_block *sbp)
- {
-     afs_shuttingdown = 1;
- }
- 
  struct super_operations afs_sops = {
  #if defined(STRUCT_SUPER_HAS_ALLOC_INODE)
    .alloc_inode =	afs_alloc_inode,
--- 432,437 ----
***************
*** 451,457 ****
    .put_inode =		afs_put_inode,
    .put_super =		afs_put_super,
    .statfs =		afs_statfs,
-   .umount_begin =	afs_umount_begin
  #if !defined(AFS_LINUX24_ENV)
    .notify_change =	afs_notify_change,
  #endif
--- 441,446 ----
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.28 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.33
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.28	Tue Jul 26 13:40:36 2005
--- openafs/src/afs/LINUX/osi_vnodeops.c	Mon Aug  8 11:04:38 2005
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.28 2005/07/26 17:40:36 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.33 2005/08/08 15:04:38 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 913,918 ****
--- 913,919 ----
      if (res) {
  	if (d_unhashed(res))
  	    d_rehash(res);
+ 	iput(ip);
      } else
  #endif
      d_add(dp, ip);
***************
*** 1263,1269 ****
      cred_t *credp = crref();
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
      char *address;
!     afs_offs_t offset = pp->index << PAGE_CACHE_SHIFT;
  #else
      ulong address = afs_linux_page_address(pp);
      afs_offs_t offset = pageoff(pp);
--- 1264,1270 ----
      cred_t *credp = crref();
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
      char *address;
!     afs_offs_t offset = ((loff_t) pp->index) << PAGE_CACHE_SHIFT;
  #else
      ulong address = afs_linux_page_address(pp);
      afs_offs_t offset = pageoff(pp);
***************
*** 1359,1365 ****
      int f_flags = 0;
  
      buffer = kmap(pp) + offset;
!     base = (pp->index << PAGE_CACHE_SHIFT) + offset;
  
      credp = crref();
      lock_kernel();
--- 1360,1366 ----
      int f_flags = 0;
  
      buffer = kmap(pp) + offset;
!     base = (((loff_t) pp->index) << PAGE_CACHE_SHIFT)  + offset;
  
      credp = crref();
      lock_kernel();
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.1.2.11 openafs/src/config/NTMakefile.amd64_w2k:1.1.2.12
*** openafs/src/config/NTMakefile.amd64_w2k:1.1.2.11	Thu Jul 28 18:13:28 2005
--- openafs/src/config/NTMakefile.amd64_w2k	Fri Aug  5 20:37:48 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8600
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8700
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.46.2.26 openafs/src/config/NTMakefile.i386_nt40:1.46.2.27
*** openafs/src/config/NTMakefile.i386_nt40:1.46.2.26	Thu Jul 28 18:13:28 2005
--- openafs/src/config/NTMakefile.i386_nt40	Fri Aug  5 20:37:48 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8600
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8700
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.1.2.11 openafs/src/config/NTMakefile.i386_w2k:1.1.2.12
*** openafs/src/config/NTMakefile.i386_w2k:1.1.2.11	Thu Jul 28 18:13:28 2005
--- openafs/src/config/NTMakefile.i386_w2k	Fri Aug  5 20:37:48 2005
***************
*** 80,86 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8600
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
--- 80,86 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=3
! AFSPRODUCT_VER_PATCH=8700
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.5 openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.6
*** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.5	Sat Jul 30 00:36:51 2005
--- openafs/src/libafs/afs.ppc_darwin_70.plist.in	Tue Aug  9 09:52:21 2005
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.86</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.3.86</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.87</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.3.87</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
Index: openafs/src/libafsauthent/Makefile.in
diff -c openafs/src/libafsauthent/Makefile.in:1.9.2.2 openafs/src/libafsauthent/Makefile.in:1.9.2.3
*** openafs/src/libafsauthent/Makefile.in:1.9.2.2	Tue Dec  7 01:04:18 2004
--- openafs/src/libafsauthent/Makefile.in	Mon Aug  8 11:39:22 2005
***************
*** 58,63 ****
--- 58,65 ----
  	pthread_glock.o \
  	get_krbrlm.o \
  	dirpath.o \
+ 	serverLog.o \
+ 	snprintf.o \
  	fileutil.o
  
  RXKADOBJS = \
***************
*** 178,183 ****
--- 180,191 ----
  dirpath.o: ${UTIL}/dirpath.c
  	${CCRULE}
  
+ serverLog.o: ${UTIL}/serverLog.c
+ 	${CCRULE}
+ 
+ snprintf.o: ${UTIL}/snprintf.c
+ 	${CCRULE}
+ 
  fileutil.o: ${UTIL}/fileutil.c
  	${CCRULE}
  
Index: openafs/src/libafsrpc/Makefile.in
diff -c openafs/src/libafsrpc/Makefile.in:1.29.2.5 openafs/src/libafsrpc/Makefile.in:1.29.2.6
*** openafs/src/libafsrpc/Makefile.in:1.29.2.5	Wed Dec  8 05:52:33 2004
--- openafs/src/libafsrpc/Makefile.in	Mon Aug  8 11:39:22 2005
***************
*** 27,32 ****
--- 27,33 ----
  COMERR = ${srcdir}/../comerr
  UTIL = ${srcdir}/../util
  SYS = ${srcdir}/../sys
+ LWP = ${srcdir}/../lwp
  
  SYSOBJS =\
  	syscall.o
***************
*** 110,115 ****
--- 111,119 ----
  
  CRYPT_OBJ = crypt.o
  
+ LWPOBJS = \
+ 	fasttime.o
+ 
  LIBOBJS = \
  	${RXOBJS} \
  	${DESOBJS} \
***************
*** 120,125 ****
--- 124,130 ----
  	${SYSOBJS} \
  	${CRYPT_OBJ} \
  	${RXSTATOBJS} \
+ 	${LWPOBJS} \
  	${FSINTOBJS}
  
  all: ${TOP_LIBDIR}/libafsrpc.a
***************
*** 267,273 ****
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.29.2.5 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
--- 272,278 ----
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.29.2.6 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
***************
*** 343,348 ****
--- 348,356 ----
  base64.o: ${UTIL}/base64.c
  	${CCRULE} ${UTIL}/base64.c
  
+ fasttime.o: ${LWP}/fasttime.c
+ 	${CCRULE} ${LWP}/fasttime.c
+ 
  syscall.o: ${SYS}/syscall.s
  	case "$(SYS_NAME)" in \
  	     sun4x_5* | sunx86_5*) \
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.13 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.14
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.13	Sat Jul 30 00:36:52 2005
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Tue Aug  9 09:52:23 2005
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.86</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.86</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.87</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.87</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
Index: openafs/src/packaging/MacOS/OpenAFS.info
diff -c openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.13 openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.14
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.13	Sat Jul 30 00:36:52 2005
--- openafs/src/packaging/MacOS/OpenAFS.info	Tue Aug  9 09:52:23 2005
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.3.86
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
--- 1,5 ----
  Title OpenAFS
! Version 1.3.87
  Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information.
  DefaultLocation /
  Diskname (null)
Index: openafs/src/rx/rx_kcommon.c
diff -c openafs/src/rx/rx_kcommon.c:1.44.2.4 openafs/src/rx/rx_kcommon.c:1.44.2.5
*** openafs/src/rx/rx_kcommon.c:1.44.2.4	Wed Jul 27 14:17:46 2005
--- openafs/src/rx/rx_kcommon.c	Mon Aug  8 11:01:40 2005
***************
*** 15,21 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.4 2005/07/27 18:17:46 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
--- 15,21 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.5 2005/08/08 15:01:40 shadow Exp $");
  
  #include "rx/rx_kcommon.h"
  
***************
*** 127,133 ****
--- 127,137 ----
  	msg = "Unknown AFS panic";
  
      printf(msg, a1, a2, a3);
+ #ifdef AFS_LINUX24_ENV
+     BUG();
+ #else
      panic(msg);
+ #endif
  }
  
  /*
Index: openafs/src/shlibafsauthent/Makefile.in
diff -c openafs/src/shlibafsauthent/Makefile.in:1.9.2.2 openafs/src/shlibafsauthent/Makefile.in:1.9.2.3
*** openafs/src/shlibafsauthent/Makefile.in:1.9.2.2	Tue Dec  7 01:04:29 2004
--- openafs/src/shlibafsauthent/Makefile.in	Mon Aug  8 11:39:23 2005
***************
*** 63,68 ****
--- 63,70 ----
  	pthread_glock.o \
  	get_krbrlm.o \
  	dirpath.o \
+ 	serverLog.o \
+ 	snprintf.o \
  	fileutil.o
  
  RXKADOBJS = \
***************
*** 193,198 ****
--- 195,206 ----
  dirpath.o: ${UTIL}/dirpath.c
  	${CCRULE}
  
+ serverLog.o: ${UTIL}/serverLog.c
+ 	${CCRULE}
+ 
+ snprintf.o: ${UTIL}/snprintf.c
+ 	${CCRULE}
+ 
  fileutil.o: ${UTIL}/fileutil.c
  	${CCRULE}
  
Index: openafs/src/shlibafsauthent/mapfile
diff -c openafs/src/shlibafsauthent/mapfile:1.2.2.1 openafs/src/shlibafsauthent/mapfile:1.2.2.2
*** openafs/src/shlibafsauthent/mapfile:1.2.2.1	Wed Aug 25 02:59:34 2004
--- openafs/src/shlibafsauthent/mapfile	Mon Aug  8 11:39:23 2005
***************
*** 82,87 ****
--- 82,89 ----
  	pr_SNameToId;
  	afs_get_pag_from_groups;
  	setpag;
+ 	afs_snprintf;
+ 	LogThreadNum;
  
      local:
  	*;
Index: openafs/src/shlibafsrpc/Makefile.in
diff -c openafs/src/shlibafsrpc/Makefile.in:1.15.2.3 openafs/src/shlibafsrpc/Makefile.in:1.15.2.4
*** openafs/src/shlibafsrpc/Makefile.in:1.15.2.3	Tue Dec  7 09:24:16 2004
--- openafs/src/shlibafsrpc/Makefile.in	Mon Aug  8 11:39:24 2005
***************
*** 31,37 ****
  DES = ../des
  COMERR = ../comerr
  UTIL = ../util
! SYS = ${srcdir}/../sys
  
  SYSOBJS =\
  	syscall.o
--- 31,38 ----
  DES = ../des
  COMERR = ../comerr
  UTIL = ../util
! SYS = ../sys
! LWP = ../lwp
  
  SYSOBJS =\
  	syscall.o
***************
*** 113,118 ****
--- 114,122 ----
  
  CRYPT_OBJ = crypt.o
  
+ LWPOBJS = \
+ 	fasttime.o
+ 
  LIBOBJS = \
  	${RXOBJS} \
  	${DESOBJS} \
***************
*** 123,128 ****
--- 127,133 ----
  	${SYSOBJS} \
  	${CRYPT_OBJ} \
  	${RXSTATOBJS} \
+ 	${LWPOBJS} \
  	${FSINTOBJS}
  
  LIBAFSRPC = libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}.${LIBAFSRPCMINOR}
***************
*** 274,280 ****
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.15.2.3 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
--- 279,285 ----
  #
  #   $ what /opt/langtools/bin/pxdb32
  #   /opt/langtools/bin/pxdb32:
! #           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.15.2.4 $
  #
  # The problem occurs when -g and -O are both used when compiling des.c.
  # The simplest way to work around the problem is to leave out either -g or -O.
***************
*** 350,355 ****
--- 355,363 ----
  base64.o: ${UTIL}/base64.c
  	${CCRULE}
  
+ fasttime.o: ${LWP}/fasttime.c
+ 	${CCRULE} ${LWP}/fasttime.c
+ 
  syscall.o: ${SYS}/syscall.s
  	case "$(SYS_NAME)" in \
  	     sun4x_5* | sunx86_5*) \
Index: openafs/src/shlibafsrpc/mapfile
diff -c openafs/src/shlibafsrpc/mapfile:1.3.2.1 openafs/src/shlibafsrpc/mapfile:1.3.2.2
*** openafs/src/shlibafsrpc/mapfile:1.3.2.1	Mon May 30 00:57:39 2005
--- openafs/src/shlibafsrpc/mapfile	Mon Aug  8 11:39:24 2005
***************
*** 110,115 ****
--- 110,116 ----
  	RXSTATS_QueryRPCStatsVersion;
  	RXSTATS_ClearProcessRPCStats;
  	RXSTATS_ClearPeerRPCStats;
+ 	TM_GetTimeOfDay;
  
      local:
  	*;
Index: openafs/src/tviced/Makefile.in
diff -c openafs/src/tviced/Makefile.in:1.10 openafs/src/tviced/Makefile.in:1.10.2.1
*** openafs/src/tviced/Makefile.in:1.10	Thu Apr  1 17:26:22 2004
--- openafs/src/tviced/Makefile.in	Mon Aug  8 11:39:24 2005
***************
*** 28,34 ****
  
  VLSERVEROBJS=vldbint.cs.o vldbint.xdr.o
  
! LWPOBJS=lock.o fasttime.o threadname.o
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
--- 28,34 ----
  
  VLSERVEROBJS=vldbint.cs.o vldbint.xdr.o
  
! LWPOBJS=lock.o threadname.o
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
***************
*** 94,102 ****
  lock.o: ${LWP}/lock.c
  	${CCRULE}
  
- fasttime.o: ${LWP}/fasttime.c
- 	${CCRULE}
- 
  threadname.o: ${LWP}/threadname.c
  	${CCRULE}
  
--- 94,99 ----
Index: openafs/src/tvolser/Makefile.in
diff -c openafs/src/tvolser/Makefile.in:1.2 openafs/src/tvolser/Makefile.in:1.2.2.1
*** openafs/src/tvolser/Makefile.in:1.2	Fri Nov 21 22:13:19 2003
--- openafs/src/tvolser/Makefile.in	Mon Aug  8 11:39:25 2005
***************
*** 28,34 ****
  
  VLSERVEROBJS=#vldbint.cs.o vldbint.xdr.o
  
! LWPOBJS=lock.o fasttime.o threadname.o
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
--- 28,34 ----
  
  VLSERVEROBJS=#vldbint.cs.o vldbint.xdr.o
  
! LWPOBJS=lock.o threadname.o
  
  LIBACLOBJS=aclprocs.o netprocs.o
  
***************
*** 99,107 ****
  lock.o: ${LWP}/lock.c
  	${COMPILE}
  
- fasttime.o: ${LWP}/fasttime.c
- 	${COMPILE}
- 
  threadname.o: ${LWP}/threadname.c
  	${COMPILE}
  
--- 99,104 ----
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.81.2.9 openafs/src/viced/afsfileprocs.c:1.81.2.10
*** openafs/src/viced/afsfileprocs.c:1.81.2.9	Mon Jul 11 15:29:20 2005
--- openafs/src/viced/afsfileprocs.c	Wed Aug  3 00:46:48 2005
***************
*** 29,35 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.9 2005/07/11 19:29:20 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 29,35 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.10 2005/08/03 04:46:48 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 4249,4255 ****
      Vnode *targetptr = 0;	/* vnode of the new link */
      Vnode *parentwhentargetnotdir = 0;	/* parent for use in SetAccessList */
      int errorCode = 0;		/* error code */
!     int code = 0;
      DirHandle dir;		/* Handle for dir package I/O */
      Volume *volptr = 0;		/* pointer to the volume header */
      struct client *client;	/* pointer to client structure */
--- 4249,4255 ----
      Vnode *targetptr = 0;	/* vnode of the new link */
      Vnode *parentwhentargetnotdir = 0;	/* parent for use in SetAccessList */
      int errorCode = 0;		/* error code */
!     int len, code = 0;
      DirHandle dir;		/* Handle for dir package I/O */
      Volume *volptr = 0;		/* pointer to the volume header */
      struct client *client;	/* pointer to client structure */
***************
*** 4340,4347 ****
      /* Write the contents of the symbolic link name into the target inode */
      fdP = IH_OPEN(targetptr->handle);
      assert(fdP != NULL);
!     assert(FDH_WRITE(fdP, (char *)LinkContents, strlen((char *)LinkContents))
! 	   == strlen((char *)LinkContents));
      FDH_CLOSE(fdP);
      /*
       * Set up and return modified status for the parent dir and new symlink
--- 4340,4348 ----
      /* Write the contents of the symbolic link name into the target inode */
      fdP = IH_OPEN(targetptr->handle);
      assert(fdP != NULL);
!     len = strlen((char *) LinkContents);
!      code = (len == FDH_WRITE(fdP, (char *) LinkContents, len)) ? 0 : VDISKFULL;
!      if (code) ViceLog(0, ("SAFSS_Symlink FDH_WRITE failed for len=%d, Fid=%u.%d.%d\n", len, OutFid->Volume, OutFid->Vnode, OutFid->Unique));
      FDH_CLOSE(fdP);
      /*
       * Set up and return modified status for the parent dir and new symlink
***************
*** 4363,4369 ****
  			   volptr);
      FidZap(&dir);
      ViceLog(2, ("SAFS_Symlink returns %d\n", errorCode));
!     return errorCode;
  
  }				/*SAFSS_Symlink */
  
--- 4364,4370 ----
  			   volptr);
      FidZap(&dir);
      ViceLog(2, ("SAFS_Symlink returns %d\n", errorCode));
!     return ( errorCode ? errorCode : code );
  
  }				/*SAFSS_Symlink */
  
