Index: openafs/src/WINNT/afsd/afsd.h
diff -c openafs/src/WINNT/afsd/afsd.h:1.5.2.6 openafs/src/WINNT/afsd/afsd.h:1.5.2.8
*** openafs/src/WINNT/afsd/afsd.h:1.5.2.6	Wed May 18 18:57:07 2005
--- openafs/src/WINNT/afsd/afsd.h	Sat Aug 20 20:51:01 2005
***************
*** 128,134 ****
  #define CAPABILITY_ERRORTRANS (1<<0)
  #define CAPABILITY_BITS 1
  
! #define DFS_SUPPORT 1
  #define LOG_PACKET 1
  #undef  NOTSERVICE
  
--- 128,134 ----
  #define CAPABILITY_ERRORTRANS (1<<0)
  #define CAPABILITY_BITS 1
  
! #undef  DFS_SUPPORT
  #define LOG_PACKET 1
  #undef  NOTSERVICE
  
Index: openafs/src/WINNT/afsd/cm_conn.c
diff -c openafs/src/WINNT/afsd/cm_conn.c:1.25.2.12 openafs/src/WINNT/afsd/cm_conn.c:1.25.2.13
*** openafs/src/WINNT/afsd/cm_conn.c:1.25.2.12	Fri Jul 22 21:17:42 2005
--- openafs/src/WINNT/afsd/cm_conn.c	Sat Aug 20 20:51:45 2005
***************
*** 326,355 ****
      else if (errorCode == VNOVOL || errorCode == VMOVED || errorCode == VOFFLINE ||
               errorCode == VSALVAGE || errorCode == VNOSERVICE || errorCode == VIO) 
      {       
!         /* Log server being offline for this volume */
!         osi_Log4(afsd_logp, "cm_Analyze found server %d.%d.%d.%d marked offline for a volume",
!                   ((serverp->addr.sin_addr.s_addr & 0xff)),
!                   ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
!                   ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
!                   ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
!         /* Create Event Log message */ 
!         {
!             HANDLE h;
!             char *ptbuf[1];
!             char s[100];
!             h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
!             sprintf(s, "cm_Analyze: Server %d.%d.%d.%d reported volume %d as missing.",
!                      ((serverp->addr.sin_addr.s_addr & 0xff)),
!                      ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
!                      ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
!                      ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24),
!                      fidp->volume);
!             ptbuf[0] = s;
!             ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1009, NULL,
!                          1, 0, ptbuf, NULL);
!             DeregisterEventSource(h);
          }
  
          /* Mark server offline for this volume */
          if (!serversp) {
              code = cm_GetServerList(fidp, userp, reqp, &serverspp);
--- 326,378 ----
      else if (errorCode == VNOVOL || errorCode == VMOVED || errorCode == VOFFLINE ||
               errorCode == VSALVAGE || errorCode == VNOSERVICE || errorCode == VIO) 
      {       
! #ifndef DJGPP
!         HANDLE h;
!         char *ptbuf[1];
!         char s[100];
! #endif
!         char addr[16];
!         char *format;
! 
!         switch ( errorCode ) {
!         case VNOVOL:
!             format = "Server %s reported volume %d as not attached.";
!             break;
!         case VMOVED:
!             format = "Server %s reported volume %d as moved.";
!             break;
!         case VOFFLINE:
!             format = "Server %s reported volume %d as offline.";
!             break;
!         case VSALVAGE:
!             format = "Server %s reported volume %d as needs salvage.";
!             break;
!         case VNOSERVICE:
!             format = "Server %s reported volume %d as not in service.";
!             break;
!         case VIO:
!             format = "Server %s reported volume %d as temporarily unaccessible.";
!             break;
          }
  
+         /* Log server being offline for this volume */
+         sprintf(addr, "%d.%d.%d.%d", 
+                  ((serverp->addr.sin_addr.s_addr & 0xff)),
+                  ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
+                  ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
+                  ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); 
+         osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume);
+         
+ #ifndef DJGPP
+         /* Create Event Log message */
+         h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME);
+         sprintf(s, format, addr, fidp->volume);
+         ptbuf[0] = s;
+         ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1009, NULL,
+                      1, 0, ptbuf, NULL);
+         DeregisterEventSource(h);
+ #endif
+ 
          /* Mark server offline for this volume */
          if (!serversp) {
              code = cm_GetServerList(fidp, userp, reqp, &serverspp);
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.16.2.8 openafs/src/WINNT/afsd/fs.c:1.16.2.9
*** openafs/src/WINNT/afsd/fs.c:1.16.2.8	Thu Aug  4 12:06:37 2005
--- openafs/src/WINNT/afsd/fs.c	Wed Aug 17 12:07:24 2005
***************
*** 1943,1949 ****
  	    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 */
--- 1943,1949 ----
  	    continue;	/* don't bother trying */
  	}
  
!         if ( IsFreelanceRoot(Parent(ti->data)) && !IsAdmin() ) {
              fprintf(stderr,"%s: Only AFS Client Administrators may alter the root.afs volume\n", pn);
              error = 1;
              continue;   /* skip */
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.55.2.26 openafs/src/WINNT/afsd/smb.c:1.55.2.27
*** openafs/src/WINNT/afsd/smb.c:1.55.2.26	Thu Aug  4 12:06:37 2005
--- openafs/src/WINNT/afsd/smb.c	Mon Aug 15 13:29:54 2005
***************
*** 2313,2319 ****
--- 2313,2323 ----
          NTStatus = 0xC000000FL;	/* No such file */
      }
      else if (code == CM_ERROR_TIMEDOUT) {
+ #ifdef COMMENT
          NTStatus = 0xC00000CFL;	/* Sharing Paused */
+ #else
+         NTStatus = 0x00000102L; /* Timeout */
+ #endif
      }
      else if (code == CM_ERROR_RETRY) {
          NTStatus = 0xC000022DL;	/* Retry */
***************
*** 2431,2442 ****
--- 2435,2456 ----
      else if (code == CM_ERROR_PATH_NOT_COVERED) {
          NTStatus = 0xC0000257L; /* Path Not Covered */
      } 
+ #ifdef COMMENT
      else if (code == CM_ERROR_ALLBUSY) {
          NTStatus = 0xC00000BFL; /* Network Busy */
      } 
      else if (code == CM_ERROR_ALLOFFLINE) {
          NTStatus = 0xC0000350L; /* Remote Host Down */
      } 
+ #else
+     /* we do not want to be telling the SMB/CIFS client that
+      * the AFS Client Service is busy or down.  
+      */
+     else if (code == CM_ERROR_ALLBUSY || 
+              code == CM_ERROR_ALLOFFLINE) {
+         NTStatus = 0xC00000BEL; /* Bad Network Path */
+     }
+ #endif
      else {
          NTStatus = 0xC0982001L;	/* SMB non-specific error */
      }
Index: openafs/src/WINNT/afsd/symlink.c
diff -c openafs/src/WINNT/afsd/symlink.c:1.2.20.2 openafs/src/WINNT/afsd/symlink.c:1.2.20.3
*** openafs/src/WINNT/afsd/symlink.c:1.2.20.2	Thu Aug  4 12:06:38 2005
--- openafs/src/WINNT/afsd/symlink.c	Wed Aug 17 12:07:24 2005
***************
*** 471,477 ****
  	    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 */
--- 471,477 ----
  	    continue;	/* don't bother trying */
  	}
  
!         if ( IsFreelanceRoot(Parent(ti->data)) && !IsAdmin() ) {
              fprintf(stderr,"symlink: Only AFS Client Administrators may alter the root.afs volume\n");
              code = 1;
              continue;   /* skip */
Index: openafs/src/WINNT/client_creds/credstab.cpp
diff -c openafs/src/WINNT/client_creds/credstab.cpp:1.5.2.2 openafs/src/WINNT/client_creds/credstab.cpp:1.5.2.3
*** openafs/src/WINNT/client_creds/credstab.cpp:1.5.2.2	Wed Jul  6 20:29:13 2005
--- openafs/src/WINNT/client_creds/credstab.cpp	Sun Aug 14 07:27:43 2005
***************
*** 162,168 ****
        SYSTEMTIME stGMT;
        FileTimeToSystemTime (&ftGMT, &stGMT);
  
!       LPTSTR pszCreds = FormatString (IDS_CREDS, TEXT("%s%t"), g.aCreds[ iCreds ].szUser, &stGMT);
        SetDlgItemText (hDlg, IDC_CREDS_INFO, pszCreds);
        FreeString (pszCreds);
        }
--- 162,185 ----
        SYSTEMTIME stGMT;
        FileTimeToSystemTime (&ftGMT, &stGMT);
  
!       SYSTEMTIME stNow;
!       GetLocalTime (&stNow);
! 
!       FILETIME ftNow;
!       SystemTimeToFileTime (&stNow, &ftNow);
! 
!       LONGLONG llNow = (((LONGLONG)ftNow.dwHighDateTime) << 32) + (LONGLONG)(ftNow.dwLowDateTime);
!       LONGLONG llExpires = (((LONGLONG)ftLocal.dwHighDateTime) << 32) + (LONGLONG)(ftLocal.dwLowDateTime);
! 
!       llNow /= c100ns1SECOND;
!       llExpires /= c100ns1SECOND;
! 
!       LPTSTR pszCreds = NULL;
!       if (llExpires <= (llNow + (LONGLONG)cminREMIND_WARN * csec1MINUTE))
!           pszCreds = FormatString (IDS_CREDS_EXPIRED, TEXT("%s"), g.aCreds[ iCreds ].szUser);
! 
!       if (!pszCreds || !pszCreds[0])
!           pszCreds = FormatString (IDS_CREDS, TEXT("%s%t"), g.aCreds[ iCreds ].szUser, &stGMT);
        SetDlgItemText (hDlg, IDC_CREDS_INFO, pszCreds);
        FreeString (pszCreds);
        }
***************
*** 228,237 ****
                                      oc, 0, &threadID);
      if (thread != NULL)
          CloseHandle(thread);
! 	else {
! 		free(oc->cell);
! 		free(oc);
! 	}
  }
  
  
--- 245,254 ----
                                      oc, 0, &threadID);
      if (thread != NULL)
          CloseHandle(thread);
!     else {
!         free(oc->cell);
!         free(oc);
!     }
  }
  
  
Index: openafs/src/WINNT/client_creds/ipaddrchg.c
diff -c openafs/src/WINNT/client_creds/ipaddrchg.c:1.1.2.2 openafs/src/WINNT/client_creds/ipaddrchg.c:1.1.2.3
*** openafs/src/WINNT/client_creds/ipaddrchg.c:1.1.2.2	Wed Sep  8 01:59:01 2004
--- openafs/src/WINNT/client_creds/ipaddrchg.c	Sun Aug 14 07:27:43 2005
***************
*** 295,304 ****
      }
  
      rootcell = (char *)GlobalAlloc(GPTR,MAXCELLCHARS+1);
!     if ( !rootcell ) goto cleanup;
  
      code = KFW_AFS_get_cellconfig(cell, (void*)&cellconfig, rootcell);
!     if ( code ) goto cleanup;
  
      memset(&aserver, '\0', sizeof(aserver));
      strcpy(aserver.name, "afs");
--- 295,306 ----
      }
  
      rootcell = (char *)GlobalAlloc(GPTR,MAXCELLCHARS+1);
!     if (!rootcell) 
!         goto cleanup;
  
      code = KFW_AFS_get_cellconfig(cell, (void*)&cellconfig, rootcell);
!     if (code) 
!         goto cleanup;
  
      memset(&aserver, '\0', sizeof(aserver));
      strcpy(aserver.name, "afs");
***************
*** 330,336 ****
  #ifdef USE_FSPROBE
      serverReachable = cellPing(NULL);
  #else
!     if ( use_kfw ) {
          // If we can't use the FSProbe interface we can attempt to forge
          // a kinit and if we can back an invalid user error we know the
          // kdc is at least reachable
--- 332,338 ----
  #ifdef USE_FSPROBE
      serverReachable = cellPing(NULL);
  #else
!     if (use_kfw) {
          // If we can't use the FSProbe interface we can attempt to forge
          // a kinit and if we can back an invalid user error we know the
          // kdc is at least reachable
Index: openafs/src/WINNT/client_creds/resource.h
diff -c openafs/src/WINNT/client_creds/resource.h:1.5 openafs/src/WINNT/client_creds/resource.h:1.5.2.1
*** openafs/src/WINNT/client_creds/resource.h:1.5	Thu Apr  1 14:09:58 2004
--- openafs/src/WINNT/client_creds/resource.h	Sun Aug 14 07:27:43 2005
***************
*** 58,63 ****
--- 58,64 ----
  #define IDS_BADSUB_TITLE_95                   48
  #define IDS_BADSUB_DESC                       49
  #define IDS_TITLE_95                          50
+ #define IDS_CREDS_EXPIRED                     51
  
  #define IDI_MAIN                        100
  #define IDD_MAIN                        101
Index: openafs/src/WINNT/client_creds/window.cpp
diff -c openafs/src/WINNT/client_creds/window.cpp:1.11.2.2 openafs/src/WINNT/client_creds/window.cpp:1.11.2.4
*** openafs/src/WINNT/client_creds/window.cpp:1.11.2.2	Wed Jul  6 20:29:13 2005
--- openafs/src/WINNT/client_creds/window.cpp	Sat Aug 20 20:51:35 2005
***************
*** 376,388 ****
     // dialog. Make sure we never display a warning more than once.
     //
     size_t iExpired;
!    if ((iExpired = Main_FindExpiredCreds()) != -1)
!       {
!       if (InterlockedIncrement (&g.fShowingMessage) != 1)
!          InterlockedDecrement (&g.fShowingMessage);
!       else
!          ShowObtainCreds (TRUE, g.aCreds[ iExpired ].szCell);
!       }
  }
  
  
--- 376,433 ----
     // dialog. Make sure we never display a warning more than once.
     //
     size_t iExpired;
!    if ((iExpired = Main_FindExpiredCreds()) != -1) {
!        if (InterlockedIncrement (&g.fShowingMessage) != 1) {
!            InterlockedDecrement (&g.fShowingMessage);
!        } else { 
!            char * rootcell = NULL;
!            char   password[PROBE_PASSWORD_LEN+1];
!            struct afsconf_cell cellconfig;
!            BOOL   serverReachable = FALSE;
!            DWORD  code;
! 
!            rootcell = (char *)GlobalAlloc(GPTR,MAXCELLCHARS+1);
!            if (!rootcell) 
!                goto cleanup;
! 
!            code = KFW_AFS_get_cellconfig(g.aCreds[ iExpired ].szCell, 
!                                          (afsconf_cell*)&cellconfig, rootcell);
!            if (code) 
!                goto cleanup;
! 
!            if (KFW_is_available()) {
!                // If we can't use the FSProbe interface we can attempt to forge
!                // a kinit and if we can back an invalid user error we know the
!                // kdc is at least reachable
!                serverReachable = KFW_probe_kdc(&cellconfig);
!            } else {
!                int i;
! 
!                for ( i=0 ; i<PROBE_PASSWORD_LEN ; i++ )
!                    password[i] = 'x';
! 
!                code = ObtainNewCredentials(rootcell, PROBE_USERNAME, password, TRUE);
!                switch ( code ) {
!                case INTK_BADPW:
!                case KERB_ERR_PRINCIPAL_UNKNOWN:
!                case KERB_ERR_SERVICE_EXP:
!                case RD_AP_TIME:
!                    serverReachable = TRUE;
!                    break;
!                default:
!                    serverReachable = FALSE;
!                }
!            }
!          cleanup:
!            if (rootcell)
!                GlobalFree(rootcell);
! 
!            if (serverReachable)
!                ShowObtainCreds (TRUE, g.aCreds[ iExpired ].szCell);
!            else
!                InterlockedDecrement (&g.fShowingMessage);
!        }
!    }
  }
  
  
***************
*** 634,642 ****
--- 679,696 ----
  size_t Main_FindExpiredCreds (void)
  {
     size_t retval = (size_t) -1;
+    static bool expirationCheck = false;
     lock_ObtainMutex(&g.expirationCheckLock);
+    if (expirationCheck) {
+        lock_ReleaseMutex(&g.expirationCheckLock);
+        return -1;
+    }
+    expirationCheck = true;
+    lock_ReleaseMutex(&g.expirationCheckLock);
+ 
     if ( KFW_is_available() )
         KFW_AFS_renew_expiring_tokens();
+    
     lock_ObtainMutex(&g.credsLock);
     for (size_t iCreds = 0; iCreds < g.cCreds; ++iCreds)
        {
***************
*** 671,676 ****
--- 725,733 ----
        }
     
     lock_ReleaseMutex(&g.credsLock);
+ 
+    lock_ObtainMutex(&g.expirationCheckLock);
+    expirationCheck = false;
     lock_ReleaseMutex(&g.expirationCheckLock);
  
     return retval;
Index: openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc
diff -c openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc:1.7 openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc:1.7.2.1
*** openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc:1.7	Sat Jul 31 20:21:51 2004
--- openafs/src/WINNT/client_creds/lang/en_US/afscreds.rc	Sun Aug 14 07:27:43 2005
***************
*** 558,563 ****
--- 558,564 ----
      IDS_BADSUB_TITLE_95     "Error - AFS Light"
      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_TITLE_95            "AFS Light"
+     IDS_CREDS_EXPIRED       "%1   (expired)"
  END
  #endif    // English (U.S.) resources
  /////////////////////////////////////////////////////////////////////////////
Index: openafs/src/afs/afs_cell.c
diff -c openafs/src/afs/afs_cell.c:1.30.2.1 openafs/src/afs/afs_cell.c:1.30.2.2
*** openafs/src/afs/afs_cell.c:1.30.2.1	Wed Apr  6 01:09:09 2005
--- openafs/src/afs/afs_cell.c	Mon Aug 15 11:52:34 2005
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.30.2.1 2005/04/06 05:09:09 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 14,20 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_cell.c,v 1.30.2.2 2005/08/15 15:52:34 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 132,138 ****
      ObtainWriteLock(&afsdb_req.lock, 686);
  
      *acellHosts = 0;
!     afsdb_req.cellname = acellName;
      afsdb_req.cellhosts = acellHosts;
      afsdb_req.timeout = timeout;
      afsdb_req.realname = realName;
--- 132,138 ----
      ObtainWriteLock(&afsdb_req.lock, 686);
  
      *acellHosts = 0;
!     afsdb_req.cellname = afs_strdup(acellName);
      afsdb_req.cellhosts = acellHosts;
      afsdb_req.timeout = timeout;
      afsdb_req.realname = realName;
***************
*** 147,152 ****
--- 147,154 ----
  	afs_osi_Sleep(&afsdb_req);
  	ObtainReadLock(&afsdb_req.lock);
      };
+ 
+     afs_osi_FreeStr(afsdb_req.cellname);
      ReleaseReadLock(&afsdb_req.lock);
      ReleaseWriteLock(&afsdb_client_lock);
  
***************
*** 161,184 ****
  afs_LookupAFSDB(char *acellName)
  {
  #ifdef AFS_AFSDB_ENV
!     afs_int32 cellHosts[MAXCELLHOSTS];
!     char *realName = NULL;
!     int code, timeout;
  
!     code = afs_GetCellHostsAFSDB(acellName, cellHosts, &timeout, &realName);
      if (code)
  	goto done;
!     code = afs_NewCell(realName, cellHosts, CNoSUID, NULL, 0, 0, timeout);
      if (code && code != EEXIST)
  	goto done;
  
      /* If we found an alias, create it */
!     if (afs_strcasecmp(acellName, realName))
! 	afs_NewCellAlias(acellName, realName);
  
    done:
!     if (realName)
! 	afs_osi_FreeStr(realName);
  #endif
  }
  
--- 163,203 ----
  afs_LookupAFSDB(char *acellName)
  {
  #ifdef AFS_AFSDB_ENV
!     afs_int32 *cellHosts;
!     char **realName=NULL;
!     int code;
!     int *timeout=NULL;
! 
!     if(!(cellHosts = afs_osi_Alloc(MAXCELLHOSTS)))
! 	goto done;
! 
!     if(!(realName = afs_osi_Alloc(sizeof(char **))))
! 	goto done;
!     *realName = NULL;
! 
!     if(!(timeout = afs_osi_Alloc(sizeof(int *))))
! 	goto done;
  
!     code = afs_GetCellHostsAFSDB(acellName, cellHosts, timeout, realName);
      if (code)
  	goto done;
!     code = afs_NewCell(*realName, cellHosts, CNoSUID, NULL, 0, 0, *timeout);
      if (code && code != EEXIST)
  	goto done;
  
      /* If we found an alias, create it */
!     if (afs_strcasecmp(acellName, *realName))
! 	afs_NewCellAlias(acellName, *realName);
  
    done:
!     if(timeout)
! 	afs_osi_Free(timeout, sizeof(int *));
!     if (realName && *realName)
! 	afs_osi_FreeStr(*realName);
!     if(realName)
! 	afs_osi_Free(realName, sizeof(char **));
!     if(cellHosts)
! 	afs_osi_Free(cellHosts, MAXCELLHOSTS);
  #endif
  }
  
Index: openafs/src/afs/IRIX/osi_inode.c
diff -c openafs/src/afs/IRIX/osi_inode.c:1.12.2.1 openafs/src/afs/IRIX/osi_inode.c:1.12.2.3
*** openafs/src/afs/IRIX/osi_inode.c:1.12.2.1	Fri Mar 11 01:50:39 2005
--- openafs/src/afs/IRIX/osi_inode.c	Wed Aug 17 15:27:03 2005
***************
*** 43,49 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/IRIX/osi_inode.c,v 1.12.2.1 2005/03/11 06:50:39 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.2.3 2005/08/17 19:27:03 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 438,444 ****
  	AFS_COPYINSTR((char *)datap, name, AFS_PNAME_SIZE - 1, &junk, unused);
  	strcat(name, "/.");
  	strcat(name, int_to_base64(stmp1, rw_vno));
! 	code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, NULL, &dvp);
  	if (!code) {
  	    /* Use old name format. */
  	    strcpy(path, name);
--- 438,444 ----
  	AFS_COPYINSTR((char *)datap, name, AFS_PNAME_SIZE - 1, &junk, unused);
  	strcat(name, "/.");
  	strcat(name, int_to_base64(stmp1, rw_vno));
! 	code = gop_lookupname(name, AFS_UIOSYS, FOLLOW, &dvp);
  	if (!code) {
  	    /* Use old name format. */
  	    strcpy(path, name);
***************
*** 456,462 ****
  	if (code) {
  	    if (code == EEXIST) {
  		/* someone beat us to it? */
! 		code = gop_lookupname(path, AFS_UIOSYS, 0, NULL, &dvp);
  	    }
  	    if (code) {
  		AFS_UNLOCK_VOL_CREATE();
--- 456,462 ----
  	if (code) {
  	    if (code == EEXIST) {
  		/* someone beat us to it? */
! 		code = gop_lookupname(path, AFS_UIOSYS, NO_FOLLOW, &dvp);
  	    }
  	    if (code) {
  		AFS_UNLOCK_VOL_CREATE();
Index: openafs/src/afs/LINUX/osi_sleep.c
diff -c openafs/src/afs/LINUX/osi_sleep.c:1.22.2.5 openafs/src/afs/LINUX/osi_sleep.c:1.22.2.6
*** openafs/src/afs/LINUX/osi_sleep.c:1.22.2.5	Tue Aug  2 10:04:47 2005
--- openafs/src/afs/LINUX/osi_sleep.c	Wed Aug 10 15:23:19 2005
***************
*** 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 */
--- 11,17 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_sleep.c,v 1.22.2.6 2005/08/10 19:23:19 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 195,201 ****
--- 195,205 ----
  #ifdef AFS_LINUX26_ENV
  #ifdef CONFIG_PM
  	if (current->flags & PF_FREEZE)
+ #ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
  	    refrigerator(PF_FREEZE);
+ #else
+ 	    refrigerator();
+ #endif
  #endif
  #endif
  	AFS_GLOCK();
***************
*** 279,285 ****
--- 283,293 ----
  #ifdef AFS_LINUX26_ENV
  #ifdef CONFIG_PM
      if (current->flags & PF_FREEZE)
+ #ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
  	refrigerator(PF_FREEZE);
+ #else
+ 	refrigerator();
+ #endif
  #endif
  #endif
  
Index: openafs/src/afs/LINUX/osi_vfsops.c
diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.9 openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.10
*** openafs/src/afs/LINUX/osi_vfsops.c:1.29.2.9	Tue Aug  9 09:42:12 2005
--- openafs/src/afs/LINUX/osi_vfsops.c	Fri Aug 19 13:51:50 2005
***************
*** 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 */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.10 2005/08/19 17:51:50 shadow Exp $");
  
  #define __NO_VERSION__		/* don't define kernel_version in module.h */
  #include <linux/module.h> /* early to avoid printf->printk mapping */
***************
*** 341,356 ****
  static void
  afs_put_inode(struct inode *ip)
  {
-     cred_t *credp = crref();
      struct vcache *vcp = VTOAFS(ip);
  
!     AFS_GLOCK();
!     ObtainReadLock(&vcp->lock);
!     if (VREFCOUNT(vcp) == 2)
! 	afs_InactiveVCache(vcp, credp);
!     ReleaseReadLock(&vcp->lock);
!     AFS_GUNLOCK();
!     crfree(credp);
  }
  
  /* afs_put_super
--- 341,354 ----
  static void
  afs_put_inode(struct inode *ip)
  {
      struct vcache *vcp = VTOAFS(ip);
  
!     if (VREFCOUNT(vcp) == 2) {
! 	AFS_GLOCK();
! 	if (VREFCOUNT(vcp) == 2)
! 	    afs_InactiveVCache(vcp, NULL);
! 	AFS_GUNLOCK();
!     }
  }
  
  /* afs_put_super
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.33 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.35
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.33	Mon Aug  8 11:04:38 2005
--- openafs/src/afs/LINUX/osi_vnodeops.c	Fri Aug 19 11:33:28 2005
***************
*** 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"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.35 2005/08/19 15:33:28 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 792,798 ****
  
      AFS_GLOCK();
      if (vcp->states & CUnlinked)
! 	(void) afs_remunlink(vcp, 1);		/* perhaps afs_InactiveVCache() instead */
      AFS_GUNLOCK();
  
      iput(ip);
--- 792,798 ----
  
      AFS_GLOCK();
      if (vcp->states & CUnlinked)
! 	(void) afs_InactiveVCache(vcp, NULL);
      AFS_GUNLOCK();
  
      iput(ip);
***************
*** 974,980 ****
  #if defined(AFS_LINUX26_ENV)
      lock_kernel();
  #endif
!     if (((VREFCOUNT(tvc) > 0) && tvc->opens > 0)
  				&& !(tvc->states & CUnlinked)) {
  	struct dentry *__dp;
  	char *__name;
--- 974,980 ----
  #if defined(AFS_LINUX26_ENV)
      lock_kernel();
  #endif
!     if (VREFCOUNT(tvc) > 1 && tvc->opens > 0
  				&& !(tvc->states & CUnlinked)) {
  	struct dentry *__dp;
  	char *__name;
***************
*** 1098,1106 ****
      cred_t *credp = crref();
      const char *name = dp->d_name.name;
  
! #if defined(AFS_LINUX26_ENV)
!     lock_kernel();
! #endif
      AFS_GLOCK();
      code = afs_rmdir(VTOAFS(dip), name, credp);
      AFS_GUNLOCK();
--- 1098,1105 ----
      cred_t *credp = crref();
      const char *name = dp->d_name.name;
  
!     /* locking kernel conflicts with glock? */
! 
      AFS_GLOCK();
      code = afs_rmdir(VTOAFS(dip), name, credp);
      AFS_GUNLOCK();
***************
*** 1117,1125 ****
  	d_drop(dp);
      }
  
- #if defined(AFS_LINUX26_ENV)
-     unlock_kernel();
- #endif
      crfree(credp);
      return -code;
  }
--- 1116,1121 ----
Index: openafs/src/cf/linux-test1.m4
diff -c openafs/src/cf/linux-test1.m4:1.3.2.1 openafs/src/cf/linux-test1.m4:1.3.2.2
*** openafs/src/cf/linux-test1.m4:1.3.2.1	Tue Dec  7 01:12:14 2004
--- openafs/src/cf/linux-test1.m4	Wed Aug 10 15:23:19 2005
***************
*** 121,123 ****
--- 121,142 ----
  AC_DEFINE(AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL, 1, [define if your aops.writepage takes a struct writeback_control argument])
  fi
  CPPFLAGS="$save_CPPFLAGS"])
+ 
+ AC_DEFUN([LINUX_REFRIGERATOR],[
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS"
+ AC_MSG_CHECKING(whether refrigerator takes PF_FREEZE)
+ AC_CACHE_VAL(ac_cv_linux_func_refrigerator_takes_pf_freeze,
+ [
+ AC_TRY_COMPILE(
+ [#include <linux/sched.h>],
+ [
+ refrigerator(PF_FREEZE);
+ ],
+ ac_cv_linux_func_refrigerator_takes_pf_freeze=yes,
+ ac_cv_linux_func_refrigerator_takes_pf_freeze=no)])
+ AC_MSG_RESULT($ac_cv_linux_func_refrigerator_takes_pf_freeze)
+ if test "x$ac_cv_linux_func_refrigerator_takes_pf_freeze" = "xyes" ; then
+ AC_DEFINE(LINUX_REFRIGERATOR_TAKES_PF_FREEZE, 1, [define if your refrigerator takes PF_FREEZE])
+ fi
+ CPPFLAGS="$save_CPPFLAGS"])
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.1.2.12 openafs/src/config/NTMakefile.amd64_w2k:1.1.2.13
*** openafs/src/config/NTMakefile.amd64_w2k:1.1.2.12	Fri Aug  5 20:37:48 2005
--- openafs/src/config/NTMakefile.amd64_w2k	Wed Aug 17 06:24:36 2005
***************
*** 79,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
--- 79,86 ----
  
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
! AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0000
  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.27 openafs/src/config/NTMakefile.i386_nt40:1.46.2.28
*** openafs/src/config/NTMakefile.i386_nt40:1.46.2.27	Fri Aug  5 20:37:48 2005
--- openafs/src/config/NTMakefile.i386_nt40	Wed Aug 17 06:24:36 2005
***************
*** 79,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
--- 79,86 ----
  
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
! AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0000
  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.12 openafs/src/config/NTMakefile.i386_w2k:1.1.2.13
*** openafs/src/config/NTMakefile.i386_w2k:1.1.2.12	Fri Aug  5 20:37:48 2005
--- openafs/src/config/NTMakefile.i386_w2k	Wed Aug 17 06:24:36 2005
***************
*** 79,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
--- 79,86 ----
  
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
! AFSPRODUCT_VER_MINOR=4
! AFSPRODUCT_VER_PATCH=0000
  AFSPRODUCT_VER_BUILD=0
  
  # For MSI installer, each major release should have a different GUID
Index: openafs/src/des/des.c
diff -c openafs/src/des/des.c:1.11.2.4 openafs/src/des/des.c:1.11.2.5
*** openafs/src/des/des.c:1.11.2.4	Thu Jun  2 01:21:57 2005
--- openafs/src/des/des.c	Thu Aug 18 00:56:14 2005
***************
*** 37,43 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/des.c,v 1.11.2.4 2005/06/02 05:21:57 shadow Exp $");
  
  #ifndef KERNEL
  #include <stdio.h>
--- 37,43 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/des.c,v 1.11.2.5 2005/08/18 04:56:14 shadow Exp $");
  
  #ifndef KERNEL
  #include <stdio.h>
***************
*** 51,57 ****
  #ifdef BIG
  #include "p_table.h"
  #endif
- #include "stats.h"
  
  #include "des_prototypes.h"
  
--- 51,56 ----
***************
*** 101,110 ****
  #ifdef DEBUG
      afs_uint32 dbg_tmp[2];
  #endif
-     if (encrypt)
- 	INC_RXKAD_STATS(des_encrypts[DES_ENCRYPT]);
-     else
- 	INC_RXKAD_STATS(des_encrypts[DES_DECRYPT]);
      /*
       * Use L1,R1 and L2,R2 as two sets of "64-bit" registers always
       * work from L1,R1 input to L2,R2 output; initialize the cleartext
--- 100,105 ----
Index: openafs/src/des/key_sched.c
diff -c openafs/src/des/key_sched.c:1.6.2.4 openafs/src/des/key_sched.c:1.6.2.5
*** openafs/src/des/key_sched.c:1.6.2.4	Tue Jun 21 16:19:48 2005
--- openafs/src/des/key_sched.c	Thu Aug 18 00:56:14 2005
***************
*** 31,37 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/key_sched.c,v 1.6.2.4 2005/06/21 20:19:48 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include "des_internal.h"
--- 31,37 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/key_sched.c,v 1.6.2.5 2005/08/18 04:56:14 shadow Exp $");
  
  #include <mit-cpyright.h>
  #include "des_internal.h"
***************
*** 39,45 ****
  
  #include "des.h"
  #include "key_perm.h"
- #include "stats.h"
  #include "des_prototypes.h"
  
  typedef char key[64];
--- 39,44 ----
***************
*** 66,72 ****
      n = 0;
      p_char = k_char;
  
-     INC_RXKAD_STATS(des_key_scheds);
  #ifdef lint
      n = n;			/* fool it in case of VAXASM */
  #endif
--- 65,70 ----
Index: openafs/src/des/new_rnd_key.c
diff -c openafs/src/des/new_rnd_key.c:1.13.2.2 openafs/src/des/new_rnd_key.c:1.13.2.3
*** openafs/src/des/new_rnd_key.c:1.13.2.2	Mon May 30 00:57:34 2005
--- openafs/src/des/new_rnd_key.c	Thu Aug 18 00:56:14 2005
***************
*** 19,25 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/new_rnd_key.c,v 1.13.2.2 2005/05/30 04:57:34 shadow Exp $");
  
  #ifndef KERNEL
  #include <stdio.h>
--- 19,25 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/des/new_rnd_key.c,v 1.13.2.3 2005/08/18 04:56:14 shadow Exp $");
  
  #ifndef KERNEL
  #include <stdio.h>
***************
*** 38,44 ****
  #include <strings.h>
  #endif
  #endif
- #include "stats.h"
  
  static afs_int32 des_set_sequence_number(des_cblock new_sequence_number);
  static afs_int32 des_generate_random_block(des_cblock block);
--- 38,43 ----
***************
*** 257,263 ****
  {
      int i;
  
-     INC_RXKAD_STATS(des_randoms);
      /*
       * Encrypt the sequence number to get the new random block:
       */
--- 256,261 ----
Index: openafs/src/libadmin/kas/afs_kasAdmin.c
diff -c openafs/src/libadmin/kas/afs_kasAdmin.c:1.9.2.2 openafs/src/libadmin/kas/afs_kasAdmin.c:1.9.2.3
*** openafs/src/libadmin/kas/afs_kasAdmin.c:1.9.2.2	Mon Dec 13 14:39:18 2004
--- openafs/src/libadmin/kas/afs_kasAdmin.c	Tue Aug 16 14:48:34 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/kas/afs_kasAdmin.c,v 1.9.2.2 2004/12/13 19:39:18 shadow Exp $");
  
  #include <stdio.h>
  
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/libadmin/kas/afs_kasAdmin.c,v 1.9.2.3 2005/08/16 18:48:34 shadow Exp $");
  
  #include <stdio.h>
  
***************
*** 716,722 ****
  	locked = 0;
  	tst =
  	    ubik_CallIter(KAM_LockStatus, kaserver->servers, UPUBIKONLY,
! 			  &count, who->principal, who->instance, &locked, 0,
  			  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  	if (tst == 0) {
  	    if (locked) {
--- 716,722 ----
  	locked = 0;
  	tst =
  	    ubik_CallIter(KAM_LockStatus, kaserver->servers, UPUBIKONLY,
! 			  &count, (long)who->principal, (long)who->instance, (long)&locked, 0,
  			  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  	if (tst == 0) {
  	    if (locked) {
***************
*** 1273,1280 ****
      do {
  	tst =
  	    ubik_CallIter(KAM_Unlock, kaserver.servers, 0, &count,
! 			  who->principal, who->instance, 0, 0, 0, 0, 0, 0,
! 			  0, 0, 0, 0, 0, 0, 0, 0);
  	if (tst && (tst != UNOSERVERS)) {
  	    if (save_tst == 0) {
  		save_tst = tst;	/* save the first failure */
--- 1273,1280 ----
      do {
  	tst =
  	    ubik_CallIter(KAM_Unlock, kaserver.servers, 0, &count,
! 			  (long)who->principal, (long)who->instance, 0, 0, 0,
! 			  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  	if (tst && (tst != UNOSERVERS)) {
  	    if (save_tst == 0) {
  		save_tst = tst;	/* save the first failure */
Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in
diff -c 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.7
*** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.2.6	Tue Aug  9 09:52:21 2005
--- openafs/src/libafs/afs.ppc_darwin_70.plist.in	Fri Aug 19 11:52:55 2005
***************
*** 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>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.99</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.3.99</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.14 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.15
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.2.14	Tue Aug  9 09:52:23 2005
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Fri Aug 19 11:52:56 2005
***************
*** 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>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.3.99</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.3.99</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.14 openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.15
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.4.14	Tue Aug  9 09:52:23 2005
--- openafs/src/packaging/MacOS/OpenAFS.info	Fri Aug 19 11:52:56 2005
***************
*** 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)
--- 1,5 ----
  Title OpenAFS
! Version 1.4.0-rc1
  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/sgistuff/Makefile.in
diff -c openafs/src/sgistuff/Makefile.in:1.7 openafs/src/sgistuff/Makefile.in:1.7.8.1
*** openafs/src/sgistuff/Makefile.in:1.7	Thu Nov  1 00:00:57 2001
--- openafs/src/sgistuff/Makefile.in	Tue Aug 16 14:00:44 2005
***************
*** 26,32 ****
  	  ${TOP_LIBDIR}/libauth.krb.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \
  	  ${TOP_LIBDIR}/libdes.a ${LIBDIR}/librx.a ${LIBDIR}/liblwp.a \
            ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a
! AUTHFILES=../inetd/ta-rauth.o ../rsh/rcmd.o ../rsh/herror.o
  AUTHLIBS=afsauthlib.so afskauthlib.so
  TARGETS=$(AUTHLIBS) 
  
--- 26,32 ----
  	  ${TOP_LIBDIR}/libauth.krb.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/libsys.a \
  	  ${TOP_LIBDIR}/libdes.a ${LIBDIR}/librx.a ${LIBDIR}/liblwp.a \
            ${TOP_LIBDIR}/libcmd.a ${TOP_LIBDIR}/libcom_err.a ${TOP_LIBDIR}/util.a
! AUTHFILES=ta-rauth.o rcmd.o herror.o
  AUTHLIBS=afsauthlib.so afskauthlib.so
  TARGETS=$(AUTHLIBS) 
  
***************
*** 43,56 ****
  afskauthlib.so: sgi_auth.o ${KAFSLIBS} ${AUTHFILES}
  	$(LD) ${LDFLAGS} -shared -all -o afskauthlib.so sgi_auth.o $(KAFSLIBS) ${AUTHFILES}
  
! ../inetd/ta-rauth.o: ../inetd/ta-rauth.c
! 	(cd ../inetd ; $(MAKE) ta-rauth.o )
  
! ../rsh/rcmd.o: ../rsh/rcmd.c
! 	(cd ../rsh ; $(MAKE) rcmd.o )
  
! ../rsh/herror.o: ../rsh/herror.c
! 	(cd ../rsh ; $(MAKE) herror.o )
  
  sgi_auth.o: sgi_auth.c
  	${CC} ${CFLAGS} -c sgi_auth.c
--- 43,56 ----
  afskauthlib.so: sgi_auth.o ${KAFSLIBS} ${AUTHFILES}
  	$(LD) ${LDFLAGS} -shared -all -o afskauthlib.so sgi_auth.o $(KAFSLIBS) ${AUTHFILES}
  
! ta-rauth.o: ta-rauth.c
! 	${CC} ${CFLAGS} -c ta-rauth.c
  
! rcmd.o: rcmd.c
! 	${CC} ${CFLAGS} -c rcmd.c
  
! herror.o: herror.c
! 	${CC} ${CFLAGS} -c herror.c
  
  sgi_auth.o: sgi_auth.c
  	${CC} ${CFLAGS} -c sgi_auth.c
Index: openafs/src/sgistuff/herror.c
diff -c /dev/null openafs/src/sgistuff/herror.c:1.1.2.2
*** /dev/null	Sun Aug 21 23:38:47 2005
--- openafs/src/sgistuff/herror.c	Tue Aug 16 14:00:44 2005
***************
*** 0 ****
--- 1,69 ----
+ /*
+  * Copyright (c) 1987 Regents of the University of California.
+  * All rights reserved.
+  *
+  * Redistribution and use in source and binary forms are permitted
+  * provided that the above copyright notice and this paragraph are
+  * duplicated in all such forms and that any documentation,
+  * advertising materials, and other materials related to such
+  * distribution and use acknowledge that the software was developed
+  * by the University of California, Berkeley.  The name of the
+  * University may not be used to endorse or promote products derived
+  * from this software without specific prior written permission.
+  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+  */
+ 
+ #include <afsconfig.h>
+ #include <afs/param.h>
+ 
+ RCSID
+     ("$Header: /cvs/openafs/src/sgistuff/herror.c,v 1.1.2.2 2005/08/16 18:00:44 shadow Exp $");
+ 
+ #ifndef AFS_DARWIN_ENV
+ #include <sys/types.h>
+ #include <sys/uio.h>
+ 
+ char *h_errlist[] = {
+     "Error 0",
+     "Unknown host",		/* 1 HOST_NOT_FOUND */
+     "Host name lookup failure",	/* 2 TRY_AGAIN */
+     "Unknown server error",	/* 3 NO_RECOVERY */
+     "No address associated with name",	/* 4 NO_ADDRESS */
+ };
+ int h_nerr = { sizeof(h_errlist) / sizeof(h_errlist[0]) };
+ 
+ #if defined(AFS_SUN_ENV)
+ int h_errno;
+ #else
+ extern int h_errno;
+ #endif
+ 
+ /*
+  * herror --
+  *	print the error indicated by the h_errno value.
+  */
+ herror(s)
+      char *s;
+ {
+     struct iovec iov[4];
+     register struct iovec *v = iov;
+ 
+     if (s && *s) {
+ 	v->iov_base = s;
+ 	v->iov_len = strlen(s);
+ 	v++;
+ 	v->iov_base = ": ";
+ 	v->iov_len = 2;
+ 	v++;
+     }
+     v->iov_base =
+ 	(u_int) h_errno < h_nerr ? h_errlist[h_errno] : "Unknown error";
+     v->iov_len = strlen(v->iov_base);
+     v++;
+     v->iov_base = "\n";
+     v->iov_len = 1;
+     writev(2, iov, (v - iov) + 1);
+ }
+ #endif
Index: openafs/src/sgistuff/rcmd.c
diff -c /dev/null openafs/src/sgistuff/rcmd.c:1.1.2.2
*** /dev/null	Sun Aug 21 23:38:47 2005
--- openafs/src/sgistuff/rcmd.c	Tue Aug 16 14:00:44 2005
***************
*** 0 ****
--- 1,600 ----
+ /*
+  * Copyright (c) 1983 Regents of the University of California.
+  * All rights reserved.
+  *
+  * Redistribution and use in source and binary forms are permitted
+  * provided that the above copyright notice and this paragraph are
+  * duplicated in all such forms and that any documentation,
+  * advertising materials, and other materials related to such
+  * distribution and use acknowledge that the software was developed
+  * by the University of California, Berkeley.  The name of the
+  * University may not be used to endorse or promote products derived
+  * from this software without specific prior written permission.
+  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+  */
+ 
+ #include <afsconfig.h>
+ #include <afs/param.h>
+ 
+ RCSID
+     ("$Header: /cvs/openafs/src/sgistuff/rcmd.c,v 1.1.2.2 2005/08/16 18:00:44 shadow Exp $");
+ 
+ #ifdef aiws /*AIX*/
+ #include <sys/types.h>
+ #define MAXHOSTNAMELEN	64	/* use BSD's, not sys/param's */
+ #define MAXPATHLEN	1024	/* from BSD */
+ #include <sys/ioctl.h>		/* for SIOCSPGRP */
+ #endif
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <pwd.h>
+ #include <sys/param.h>
+ #include <limits.h>
+ #include <sys/file.h>
+ #ifdef	AFS_SUN5_ENV
+ #include <fcntl.h>
+ #endif
+ #include <unistd.h>		/* select() prototype */
+ #include <sys/types.h>		/* fd_set on older platforms */
+ #include <sys/time.h>		/* struct timeval, select() prototype */
+ #ifndef	FD_SET
+ # include <sys/select.h>	/* fd_set on newer platforms */
+ #endif
+ #include <sys/signal.h>
+ #include <sys/socket.h>
+ #include <sys/stat.h>
+ #include <netinet/in.h>
+ #include <netdb.h>
+ #include <errno.h>
+ #if defined(AFS_HPUX_ENV)
+ /* HPUX uses a different call to set[res][gu]ids: */
+ #define seteuid(newEuid)	setresuid(-1, (newEuid), -1)
+ #define setegid(newEgid)	setresgid(-1, (newEgid), -1)
+ #endif /* defined(AFS_HPUX_ENV) */
+ #ifdef	TCP_DEBUG
+ #include <sys/syslog.h>
+ #	define	DPRINTF(args)	dprintf args
+ dprintf(args)
+      char *args;
+ {
+     char **argv;
+     char buf[BUFSIZ];
+     static char prefix[] = "rcmd: ";
+ 
+     argv = &args;
+     vsprintf(buf, argv[0], &argv[1]);
+     syslog(LOG_DEBUG, "%s %s\n", prefix, buf);
+ }
+ #else
+ #	define	DPRINTF(args)
+ #endif
+ #include <syslog.h>
+ static _checkhost();
+ 
+ #ifdef AFS_HPUX102_ENV
+ int
+ rmcd(ahost, rport, locuser, remuser, cmd, fd2p)
+      char **ahost;
+      int rport;
+      const char *locuser, *remuser, *cmd;
+      int *fd2p;
+ #else
+ #ifdef	AFS_AIX32_ENV
+ rcmd(ahost, rport, locuser, remuser, cmd, fd2p, retry)
+      int retry;
+ #else
+ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
+ #endif
+      char **ahost;
+      u_short rport;
+ #if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+      const char *locuser, *remuser, *cmd;
+ #else
+      char *locuser, *remuser, *cmd;
+ #endif
+      int *fd2p;
+ #endif
+ {
+     int s, timo = 1, pid;
+     sigset_t oldset;
+     sigset_t sigBlock;
+     int someSignals[100];
+     struct servent *sp, *getservbyport();
+     struct sockaddr_in sin, from;
+     char c;
+     int lport = IPPORT_RESERVED - 1;
+     struct hostent *hp;
+     fd_set reads;
+ 
+     memset((char *)someSignals, 0, sizeof(someSignals));
+     someSignals[0] = 1 << (SIGURG - 1);
+     sigBlock = *((sigset_t *) someSignals);
+ 
+     pid = getpid();
+     hp = gethostbyname(*ahost);	/* CAUTION: this uses global static */
+     /* storage.  ANY OTHER CALLS to gethostbyname (including from within
+      * syslog, eg) will trash the contents of hp. BE CAREFUL! */
+     if (hp == 0) {
+ 	herror(*ahost);
+ 	return (-1);
+     }
+     *ahost = hp->h_name;
+     /* was: syslog(LOG_ERR, "rcmd: host=%s, rport=%d, luser=%s,ruser=%s,cmd=%s,fd2p=%s\n", *ahost,rport,locuser,remuser,cmd,fd2p) 
+      * but that trashes hp... */
+     sigprocmask(SIG_BLOCK, &sigBlock, &oldset);
+     for (;;) {
+ 	s = rresvport(&lport);
+ 	if (s < 0) {
+ 	    if (errno == EAGAIN)
+ 		fprintf(stderr, "socket: All ports in use\n");
+ 	    else
+ 		perror("rcmd: socket");
+ 	    sigprocmask(SIG_SETMASK, &oldset, (sigset_t *) 0);
+ 	    return (-1);
+ 	}
+ #ifdef	AFS_AIX32_ENV
+ #ifndef aiws
+ 	fcntl(s, F_SETOWN, pid);
+ #else
+ 	/* since AIX has no F_SETOWN, we just do the ioctl */
+ 	(void)ioctl(s, SIOCSPGRP, &pid);
+ #endif
+ #else
+ #if !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV)
+ 	fcntl(s, F_SETOWN, pid);
+ #endif /* !defined(AIX) */
+ #endif
+ 	sin.sin_family = hp->h_addrtype;
+ #ifdef	AFS_OSF_ENV
+ 	memcpy((caddr_t) & sin.sin_addr, hp->h_addr_list[0], hp->h_length);
+ #else
+ 	memcpy((caddr_t) & sin.sin_addr, hp->h_addr, hp->h_length);
+ #endif
+ 	sin.sin_port = rport;
+ 	/* attempt to remote authenticate first... */
+ 	sp = getservbyport((int)rport, "tcp");
+ 	if (sp) {
+ 	    int ok = 0;
+ 
+ 	    switch (ta_rauth(s, sp->s_name, sin.sin_addr)) {
+ 	    case 0:
+ #ifndef	AFS_SGI_ENV
+ 		fprintf(stderr, "No remote authentication\n");
+ #endif
+ 		close(s);
+ 		s = rresvport(&lport);
+ 		if (s < 0) {
+ 		    if (errno == EAGAIN)
+ 			fprintf(stderr, "socket: All ports in use\n");
+ 		    else
+ 			perror("rcmd: socket");
+ 		    sigprocmask(SIG_SETMASK, &oldset, (sigset_t *) 0);
+ 		    return (-1);
+ 		}
+ #if !defined(AFS_AIX_ENV) && !defined(AFS_HPUX_ENV)
+ 		fcntl(s, F_SETOWN, pid);
+ #endif /* !defined(AIX) */
+ 		break;
+ 	    case 1:
+ 		ok = 1;
+ 		break;
+ 	    case -1:
+ 		fprintf(stderr, "Login incorrect.");
+ 		exit(1);
+ 		break;
+ 	    case -2:
+ 		fprintf(stderr, "internal failure, ta_rauth\n");
+ 		exit(errno);
+ 		break;
+ 	    case -3:
+ 		fprintf(stderr, "Cannot connect to remote machine\n");
+ 		exit(errno);
+ 		break;
+ 	    }
+ 
+ 	    if (ok) {
+ 		break;		/* from for loop */
+ 	    }
+ 	}
+ 	if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
+ 	    break;
+ 	(void)close(s);
+ 	if (errno == EADDRINUSE) {
+ 	    lport--;
+ 	    continue;
+ 	}
+ 	if (errno == ECONNREFUSED && timo <= 16) {
+ #ifdef	AFS_AIX32_ENV
+ 	    if (!retry) {
+ 		return (-2);
+ 	    }
+ #endif
+ 	    sleep(timo);
+ 	    timo *= 2;
+ 	    continue;
+ 	}
+ 	if (hp->h_addr_list[1] != NULL) {
+ 	    int oerrno = errno;
+ 
+ 	    fprintf(stderr, "connect to address %s: ",
+ 		    inet_ntoa(sin.sin_addr));
+ 	    errno = oerrno;
+ 	    perror(0);
+ 	    hp->h_addr_list++;
+ 	    memcpy((caddr_t) & sin.sin_addr, hp->h_addr_list[0],
+ 		   hp->h_length);
+ 	    fprintf(stderr, "Trying %s...\n", inet_ntoa(sin.sin_addr));
+ 	    continue;
+ 	}
+ 	perror(hp->h_name);
+ 	sigprocmask(SIG_SETMASK, &oldset, (sigset_t *) 0);
+ 	return (-1);
+     }
+     lport--;
+     if (fd2p == 0) {
+ 	write(s, "", 1);
+ 	lport = 0;
+     } else {
+ 	char num[8];
+ 	int s2 = rresvport(&lport), s3;
+ 	int len = sizeof(from);
+ 	int maxfd = -1;
+ 
+ 	if (s2 < 0)
+ 	    goto bad;
+ 	listen(s2, 1);
+ 	(void)sprintf(num, "%d", lport);
+ 	if (write(s, num, strlen(num) + 1) != strlen(num) + 1) {
+ 	    perror("write: setting up stderr");
+ 	    (void)close(s2);
+ 	    goto bad;
+ 	}
+ 	FD_ZERO(&reads);
+ 	FD_SET(s, &reads);
+ 	if (maxfd < s)
+ 	    maxfd = s;
+ 	FD_SET(s2, &reads);
+ 	if (maxfd < s2)
+ 	    maxfd = s2;
+ 	errno = 0;
+ 	if (select(maxfd + 1, &reads, 0, 0, 0) < 1 || !FD_ISSET(s2, &reads)) {
+ 	    if (errno != 0)
+ 		perror("select: setting up stderr");
+ 	    else
+ 		fprintf(stderr,
+ 			"select: protocol failure in circuit setup.\n");
+ 	    (void)close(s2);
+ 	    goto bad;
+ 	}
+ 	s3 = accept(s2, (struct sockaddr *)&from, &len);
+ 	(void)close(s2);
+ 	if (s3 < 0) {
+ 	    perror("accept");
+ 	    lport = 0;
+ 	    goto bad;
+ 	}
+ 	*fd2p = s3;
+ 	from.sin_port = ntohs((u_short) from.sin_port);
+ 	if (from.sin_family != AF_INET || from.sin_port >= IPPORT_RESERVED
+ 	    || from.sin_port < IPPORT_RESERVED / 2) {
+ 	    fprintf(stderr, "socket: protocol failure in circuit setup.\n");
+ 	    goto bad2;
+ 	}
+     }
+     (void)write(s, locuser, strlen(locuser) + 1);
+     (void)write(s, remuser, strlen(remuser) + 1);
+     (void)write(s, cmd, strlen(cmd) + 1);
+     errno = 0;
+     if (read(s, &c, 1) < 0) {
+ 	perror(*ahost);
+ 	goto bad2;
+     }
+     if (c != 0) {
+ #ifdef	AFS_OSF_ENV
+ 	/*
+ 	 *   Two different protocols seem to be used;
+ 	 *   one prepends a "message" byte with a "small"
+ 	 *   number; the other one just sends the message
+ 	 */
+ 	if (isalnum(c))
+ 	    (void)write(2, &c, 1);
+ 
+ #endif
+ 	while (read(s, &c, 1) == 1) {
+ 	    (void)write(2, &c, 1);
+ 	    if (c == '\n')
+ 		break;
+ 	}
+ 	goto bad2;
+     }
+     sigprocmask(SIG_SETMASK, &oldset, (sigset_t *) 0);
+     return (s);
+   bad2:
+     if (lport)
+ 	(void)close(*fd2p);
+   bad:
+     (void)close(s);
+     sigprocmask(SIG_SETMASK, &oldset, (sigset_t *) 0);
+     return (-1);
+ }
+ 
+ #ifndef AFS_AIX32_ENV
+ rresvport(alport)
+      int *alport;
+ {
+     struct sockaddr_in sin;
+     int s;
+ 
+     sin.sin_family = AF_INET;
+     sin.sin_addr.s_addr = INADDR_ANY;
+     s = socket(AF_INET, SOCK_STREAM, 0);
+     if (s < 0)
+ 	return (-1);
+     for (;;) {
+ 	sin.sin_port = htons((u_short) * alport);
+ 	if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
+ 	    return (s);
+ 	if (errno != EADDRINUSE) {
+ 	    (void)close(s);
+ 	    return (-1);
+ 	}
+ 	(*alport)--;
+ 	if (*alport == IPPORT_RESERVED / 2) {
+ 	    (void)close(s);
+ 	    errno = EAGAIN;	/* close */
+ 	    return (-1);
+ 	}
+     }
+ }
+ #endif
+ 
+ int _check_rhosts_file = 1;
+ 
+ #if defined(AFS_HPUX102_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+ ruserok(rhost, superuser, ruser, luser)
+      const char *rhost;
+      int superuser;
+      const char *ruser, *luser;
+ #else
+ ruserok(rhost, superuser, ruser, luser)
+      int superuser;
+      char *rhost;
+      char *ruser, *luser;
+ #endif
+ {
+     FILE *hostf;
+     char fhost[MAXHOSTNAMELEN];
+     int first = 1;
+     register char *sp, *p;
+     int baselen = -1;
+     int suid, sgid;
+     int group_list_size = -1;
+     gid_t groups[NGROUPS_MAX];
+     sp = rhost;
+     p = fhost;
+     while (*sp) {
+ 	if (*sp == '.') {
+ 	    if (baselen == -1)
+ 		baselen = sp - rhost;
+ 	    *p++ = *sp++;
+ 	} else {
+ 	    *p++ = isupper(*sp) ? tolower(*sp++) : *sp++;
+ 	}
+     }
+     *p = '\0';
+     hostf = superuser ? (FILE *) 0 : fopen("/etc/hosts.equiv", "r");
+   again:
+     if (hostf) {
+ 	if (!_validuser(hostf, fhost, luser, ruser, baselen)) {
+ 	    (void)fclose(hostf);
+ #ifdef	AFS_OSF_ENV
+ 	    if (first == 0) {
+ 		(void)seteuid(suid);
+ 		(void)setegid(sgid);
+ 		if (group_list_size >= 0)
+ 		    (void)setgroups(group_list_size, groups);
+ 	    }
+ #endif
+ 	    return (0);
+ 	}
+ 	(void)fclose(hostf);
+     }
+     if (first == 1 && (_check_rhosts_file || superuser)) {
+ 	struct stat sbuf;
+ 	struct passwd *pwd, *getpwnam();
+ 	char pbuf[MAXPATHLEN];
+ 
+ 	first = 0;
+ 	suid = geteuid();
+ 	sgid = getegid();
+ 	group_list_size = getgroups(NGROUPS_MAX, groups);
+ 	if ((pwd = getpwnam(luser)) == NULL)
+ 	    return (-1);
+ 	if (setegid(pwd->pw_gid) >= 0)
+ 	    (void)initgroups(luser, pwd->pw_gid);
+ 	(void)seteuid(pwd->pw_uid);
+ 	(void)strcpy(pbuf, pwd->pw_dir);
+ 	(void)strcat(pbuf, "/.rhosts");
+ 	if ((hostf = fopen(pbuf, "r")) == NULL)
+ 	    goto bad;
+ 	/*
+ 	 * if owned by someone other than user or root or if
+ 	 * writeable by anyone but the owner, quit
+ 	 */
+ 	if (fstat(fileno(hostf), &sbuf) || sbuf.st_uid
+ 	    && sbuf.st_uid != pwd->pw_uid || sbuf.st_mode & 022) {
+ 	    fclose(hostf);
+ 	    goto bad;
+ 	}
+ 	goto again;
+     }
+   bad:
+     if (first == 0) {
+ 	(void)seteuid(suid);
+ 	(void)setegid(sgid);
+ 	if (group_list_size >= 0)
+ 	    (void)setgroups(group_list_size, groups);
+     }
+     return (-1);
+ }
+ 
+ /* don't make static, used by lpd(8) */
+ _validuser(hostf, rhost, luser, ruser, baselen)
+      char *rhost, *luser, *ruser;
+      FILE *hostf;
+      int baselen;
+ {
+     char *user;
+     char ahost[MAXHOSTNAMELEN * 4];
+     register char *p;
+ #ifdef	AFS_AIX32_ENV
+ #include <arpa/nameser.h>
+     int hostmatch, usermatch;
+     char domain[MAXDNAME], *dp;
+ 
+     dp = NULL;
+     if (getdomainname(domain, sizeof(domain)) == 0)
+ 	dp = domain;
+ #endif
+     while (fgets(ahost, sizeof(ahost), hostf)) {
+ #ifdef	AFS_AIX32_ENV
+ 	hostmatch = usermatch = 0;
+ 	p = ahost;
+ 	if (*p == '#' || *p == '\n')	/* ignore comments and blanks */
+ 	    continue;
+ 	while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0')
+ 	    p++;
+ 	if (*p == ' ' || *p == '\t') {
+ 	    *p++ = '\0';
+ 	    while (*p == ' ' || *p == '\t')
+ 		p++;
+ 	    user = p;
+ 	    while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0')
+ 		p++;
+ 	} else
+ 	    user = p;
+ 	*p = '\0';
+ 	/*
+ 	 *  + - anything goes
+ 	 *  +@<name> - group <name> allowed
+ 	 *  -@<name> - group <name> disallowed
+ 	 *  -<name> - host <name> disallowed
+ 	 */
+ 	if (ahost[0] == '+' && ahost[1] == 0)
+ 	    hostmatch = 1;
+ 	else if (ahost[0] == '+' && ahost[1] == '@')
+ 	    hostmatch = innetgr(ahost + 2, rhost, NULL, dp);
+ 	else if (ahost[0] == '-' && ahost[1] == '@') {
+ 	    if (innetgr(ahost + 2, rhost, NULL, dp))
+ 		return (-1);
+ 	} else if (ahost[0] == '-') {
+ 	    if (_checkhost(rhost, ahost + 1, baselen))
+ 		return (-1);
+ 	} else
+ 	    hostmatch = _checkhost(rhost, ahost, baselen);
+ 	if (user[0]) {
+ 	    if (user[0] == '+' && user[1] == 0)
+ 		usermatch = 1;
+ 	    else if (user[0] == '+' && user[1] == '@')
+ 		usermatch = innetgr(user + 2, NULL, ruser, dp);
+ 	    else if (user[0] == '-' && user[1] == '@') {
+ 		if (hostmatch && innetgr(user + 2, NULL, ruser, dp))
+ 		    return (-1);
+ 	    } else if (user[0] == '-') {
+ 		if (hostmatch && !strcmp(user + 1, ruser))
+ 		    return (-1);
+ 	    } else
+ 		usermatch = !strcmp(user, ruser);
+ 	} else
+ 	    usermatch = !strcmp(ruser, luser);
+ 	if (hostmatch && usermatch)
+ 	    return (0);
+ #else
+ 	p = ahost;
+ 	while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') {
+ 	    *p = isupper(*p) ? tolower(*p) : *p;
+ 	    p++;
+ 	}
+ 	if (*p == ' ' || *p == '\t') {
+ 	    *p++ = '\0';
+ 	    while (*p == ' ' || *p == '\t')
+ 		p++;
+ 	    user = p;
+ 	    while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0')
+ 		p++;
+ 	} else
+ 	    user = p;
+ 	*p = '\0';
+ 	if (_checkhost(rhost, ahost, baselen)
+ 	    && !strcmp(ruser, *user ? user : luser)) {
+ 	    return (0);
+ 	}
+ #endif
+     }
+     return (-1);
+ }
+ 
+ static
+ _checkhost(rhost, lhost, len)
+      char *rhost, *lhost;
+      int len;
+ {
+     static char ldomain[MAXHOSTNAMELEN + 1];
+     static char *domainp = NULL;
+     static int nodomain = 0;
+     register char *cp;
+ 
+ #ifdef	AFS_AIX32_ENV
+     struct hostent *hp;
+     long addr;
+ 
+     /*
+      * check for ip address and do a lookup to convert to hostname
+      */
+     if (isinet_addr(lhost) && (addr = inet_addr(lhost)) != -1
+ 	&& (hp = gethostbyaddr(&addr, sizeof(addr), AF_INET)))
+ 	lhost = hp->h_name;
+ 
+ #endif
+     if (len == -1) {
+ #ifdef	AFS_AIX32_ENV
+ 	/* see if hostname from file has a domain name */
+ 	for (cp = lhost; *cp; ++cp) {
+ 	    if (*cp == '.') {
+ 		len = cp - lhost;
+ 		break;
+ 	    }
+ 	}
+ #endif
+ 	return (!strcmp(rhost, lhost));
+     }
+     if (strncmp(rhost, lhost, len))
+ 	return (0);
+     if (!strcmp(rhost, lhost))
+ 	return (1);
+ #ifdef	AFS_AIX32_ENV
+     if (*(lhost + len) != '\0' && *(rhost + len) != '\0')
+ #else
+     if (*(lhost + len) != '\0')
+ #endif
+ 	return (0);
+     if (nodomain)
+ 	return (0);
+     if (!domainp) {
+ 	if (gethostname(ldomain, sizeof(ldomain)) == -1) {
+ 	    nodomain = 1;
+ 	    return (0);
+ 	}
+ 	ldomain[MAXHOSTNAMELEN] = '\0';
+ 	if ((domainp = strchr(ldomain, '.')) == (char *)NULL) {
+ 	    nodomain = 1;
+ 	    return (0);
+ 	}
+ 	for (cp = ++domainp; *cp; ++cp)
+ 	    if (isupper(*cp))
+ 		*cp = tolower(*cp);
+     }
+     return (!strcmp(domainp, rhost + len + 1));
+ }
Index: openafs/src/sgistuff/ta-rauth.c
diff -c /dev/null openafs/src/sgistuff/ta-rauth.c:1.1.2.2
*** /dev/null	Sun Aug 21 23:38:47 2005
--- openafs/src/sgistuff/ta-rauth.c	Tue Aug 16 14:00:44 2005
***************
*** 0 ****
--- 1,203 ----
+ /*
+  * 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
+  */
+ 
+ /*
+  * This code is used for application programs who want to transfer a
+  * token from the local system to the remote system.
+  */
+ #include <afsconfig.h>
+ #include <afs/param.h>
+ 
+ RCSID
+     ("$Header: /cvs/openafs/src/sgistuff/ta-rauth.c,v 1.1.2.2 2005/08/16 18:00:44 shadow Exp $");
+ 
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
+ #include <sys/file.h>
+ #include <sys/wait.h>
+ #include <sys/time.h>
+ 
+ #include <netinet/in.h>
+ 
+ #include <afs/auth.h>
+ #include <afs/cellconfig.h>
+ 
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <signal.h>
+ #include <strings.h>
+ #if defined(AIX)
+ #include <sys/syslog.h>
+ #else /* defined(AIX) */
+ #include <syslog.h>
+ #endif /* defined(AIX) */
+ #include <errno.h>
+ #include <pwd.h>
+ #include <afs/afsutil.h>
+ 
+ 
+ #ifndef RAUTH_PORT
+ #define RAUTH_PORT (601)
+ #endif
+ 
+  /* ta_rauth provides a single entry point into the remote */
+  /* authentication scheme.  This allows us to simply pass the service */
+  /* name; this routine will in turn obtain whatever remote */
+  /* authentication information necessary and will negotiate with the */
+  /* remote connection.  There are three possible return codes: */
+  /*  (0) There is no remote authentication system; continue without */
+  /*      any authentication. */
+  /*  (1) Remote authentication was negotiated successfully */
+  /*  (-1) Remote authentication failed (but did exist) */
+  /*  (-2) The call could not complete due to internal failure */
+  /*  (-3) The remote connection failed */
+  /* Note that raddr is in *network* byte order! */
+ 
+ int ta_debug = 0;
+ 
+ int
+ ta_rauth(s, svc_name, raddr)
+      int s;
+      char *svc_name;
+      struct in_addr raddr;
+ {
+     char localName[64];
+     int code;
+     struct afsconf_dir *tdir;
+     struct ktc_principal tserver;
+     struct ktc_token token;
+     struct sockaddr_in name;
+ 
+     /* extract the token */
+ 
+     tdir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH);
+     if (!tdir) {
+ 	if (ta_debug) {
+ 	    syslog(LOG_ERR, "ta_rauth: afsconf_Open failed\n");
+ 	}
+ 	return (-2);
+     }
+     code = afsconf_GetLocalCell(tdir, localName, sizeof(localName));
+     if (code) {
+ 	if (ta_debug) {
+ 	    syslog(LOG_ERR, "ta_rauth: afsconf_GetLocalCell failed\n");
+ 	}
+ 	return (-2);
+     }
+     afsconf_Close(tdir);
+ 
+     strcpy(tserver.cell, localName);
+     strcpy(tserver.name, "afs");
+ 
+     code = ktc_GetToken(&tserver, &token, sizeof(token), NULL);
+     if (code) {
+ 	syslog(LOG_WARNING, "ta_rauth: no tokens available");
+ 	return 0;		/* try port without authentication */
+     }
+ 
+     name.sin_family = AF_INET;
+     name.sin_port = htons(RAUTH_PORT);
+     name.sin_addr = raddr;
+     if (connect(s, (struct sockaddr *)&name, sizeof(name)) == -1) {
+ 	extern int errno;
+ 
+ 	if (ta_debug) {
+ 	    syslog(LOG_ERR,
+ 		   "ta_rauth(%s): connect call to (%d:%d) failed=%d\n",
+ 		   svc_name, raddr.s_addr, htons(RAUTH_PORT), errno);
+ 	    perror("socket");
+ 	}
+ 	switch (errno) {
+ #ifdef AFS_AIX_ENV
+ 	    /* On conn failure aix doesn't return any error! */
+ 	case 0:
+ #endif
+ 	case ECONNREFUSED:
+ 	    return 0;
+ 	case ETIMEDOUT:
+ 	case ENETUNREACH:
+ 	    return -3;
+ 	default:
+ 	    return -2;
+ 	}
+     }
+ 
+     if (outtoken(s, &token, svc_name, localName) == 0) {
+ 	char result;
+ 
+ 	if (read(s, &result, 1) != 1) {
+ 	    syslog(LOG_ERR, "Invalid return from remote authenticator\n");
+ 	    exit(1);
+ 	}
+ 	if (result == '0')	/* remote authentication denied */
+ 	    return -1;
+ 	else			/* remote authentication allowed */
+ 	    return 1;
+     }
+ 
+     return (-2);
+ }
+ 
+ /*
+  * outtoken:
+  *
+  * This routine writes a token on the specified file handle;
+  * The output format for a token is:
+  *
+  *   Field #    Contents         description
+  *    (0)       Service requested char[]
+  *    (1)       Version #        unsigned integer (< 2^32)
+  *    (2)       startTime        unsigned afs_int32 (< 2^32)
+  *    (3)       endTime          unsigned afs_int32 (< 2^32)
+  *    (4)       sessionKey       char[8]
+  *    (5)       kvno             short (< 2^16)
+  *    (6)       ticketLen        unsigned integer (< 2^32)
+  *    (7)       ticket           char[MAXKTCTICKETLEN]
+  *
+  *  All fields are comma separated except (4) and (5) because (4) is fixed
+  *  length; since field (7) is variable length, it is presumed to
+  *  begin after the ',' and to be ticketLen afs_int32.
+  */
+ outtoken(s, token, svc, localName)
+      int s;
+      struct ktc_token *token;
+      char *svc, *localName;
+ {
+     char buf[1024], *bp;
+     int count;
+ 
+     /* (0) - (3) */
+     sprintf(buf, "%s,%d,%s,%ld,%ld,", svc, 2, localName, token->startTime,
+ 	    token->endTime);
+ 
+     /* (4) sessionKey */
+     bp = buf + strlen(buf);
+     memcpy(bp, &token->sessionKey, 8);
+     bp += 8;
+ 
+     /* (5) - (6) */
+     sprintf(bp, "%u,%u,", token->kvno, token->ticketLen);
+ 
+     /* (7) ticket */
+     bp += strlen(bp);
+     memcpy(bp, token->ticket, token->ticketLen);
+     bp += token->ticketLen;
+ 
+     if ((count = write(s, buf, (int)(bp - buf))) == -1) {
+ 	perror("outtoken write");
+ 	exit(1);
+     }
+     if (ta_debug) {
+ 	fprintf(stderr, "sent buffer %s\n", buf);
+     }
+     return 0;
+ }
Index: openafs/src/sys/afssyscalls.h
diff -c openafs/src/sys/afssyscalls.h:1.8 openafs/src/sys/afssyscalls.h:1.8.2.1
*** openafs/src/sys/afssyscalls.h:1.8	Tue Jul 15 19:16:54 2003
--- openafs/src/sys/afssyscalls.h	Mon Aug 15 13:36:16 2005
***************
*** 132,137 ****
--- 132,141 ----
  
  #endif /* AFS_NAMEI_ENV */
  
+ /* Declarations for lsetpag and lpioctl */
+ int     lsetpag(void);
+ int     lpioctl(char *path, int cmd, char *cmarg, int follow);
+ 
  #endif /* AFS_NT40_ENV */
  
  #endif /* AFS_AFSSYSCALLS_H */
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.81.2.10 openafs/src/viced/afsfileprocs.c:1.81.2.11
*** openafs/src/viced/afsfileprocs.c:1.81.2.10	Wed Aug  3 00:46:48 2005
--- openafs/src/viced/afsfileprocs.c	Sat Aug 13 22:11:38 2005
***************
*** 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>
--- 29,35 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.11 2005/08/14 02:11:38 jaltman Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 2441,2447 ****
  
      osi_auditU(acall, FetchACLEvent, errorCode, 
                 AUD_ID, t_client ? t_client->ViceId : 0,
!                AUD_FID, Fid, AUD_END);
      return errorCode;
  }				/*SRXAFS_FetchACL */
  
--- 2441,2448 ----
  
      osi_auditU(acall, FetchACLEvent, errorCode, 
                 AUD_ID, t_client ? t_client->ViceId : 0,
!                AUD_FID, Fid, 
!                AUD_ACL, AccessList->AFSOpaque_val, AUD_END);
      return errorCode;
  }				/*SRXAFS_FetchACL */
  
Index: openafs/src/volser/vos.c
diff -c openafs/src/volser/vos.c:1.40.2.10 openafs/src/volser/vos.c:1.40.2.12
*** openafs/src/volser/vos.c:1.40.2.10	Mon Jul 11 15:10:34 2005
--- openafs/src/volser/vos.c	Mon Aug 15 11:55:49 2005
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.10 2005/07/11 19:10:34 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/volser/vos.c,v 1.40.2.12 2005/08/15 15:55:49 shadow Exp $");
  
  #include <sys/types.h>
  #ifdef AFS_NT40_ENV
***************
*** 448,455 ****
  static char *
  vos_ctime(afs_int32 *timep)
  {
!     time_t *foo = timep;
!     return ctime(foo);
  }
  #else
  #define vos_ctime ctime
--- 448,455 ----
  static char *
  vos_ctime(afs_int32 *timep)
  {
!     time_t foo = *timep;
!     return ctime(&foo);
  }
  #else
  #define vos_ctime ctime
***************
*** 847,855 ****
       int a_showProblems;
  
  {				/*XDisplayFormat */
- 
-     char pname[10];
- 
      if (a_fast) {
  	/*
  	 * Short & sweet.
--- 847,852 ----
***************
*** 880,888 ****
  		if (a_partID != partition_cache) {
  			MapPartIdIntoName(a_partID, pname);
  			partition_cache = a_partID;
- 		} else {
- 			pname[0] = '\0';
  		}
  		fprintf(STDOUT, "name\t\t%s\n", a_xInfoP->name);
  		fprintf(STDOUT, "id\t\t%lu\n", a_xInfoP->volid);
  		fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
--- 877,884 ----
  		if (a_partID != partition_cache) {
  			MapPartIdIntoName(a_partID, pname);
  			partition_cache = a_partID;
  		}
+ 
  		fprintf(STDOUT, "name\t\t%s\n", a_xInfoP->name);
  		fprintf(STDOUT, "id\t\t%lu\n", a_xInfoP->volid);
  		fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname);
***************
*** 1029,1036 ****
      if (partition != partition_cache) {
  	MapPartIdIntoName(partition, pname);
  	partition_cache = partition;
-     } else {
-         pname[0] = '\0';
      }
      fprintf(STDOUT, "name\t\t%s\n", pntr->name);
      fprintf(STDOUT, "id\t\t%lu\n", pntr->volid);
--- 1025,1030 ----
