Index: openafs/src/NTMakefile
diff -c openafs/src/NTMakefile:1.27.2.2 openafs/src/NTMakefile:1.27.2.3
*** openafs/src/NTMakefile:1.27.2.2	Thu Oct 12 17:19:35 2006
--- openafs/src/NTMakefile	Thu Feb 15 13:14:07 2007
***************
*** 137,143 ****
  	$(NTMAKE)
  	$(CD) ..\..
  
! ubik_headers: rx
       echo ***** $@
  	$(DOCD) $(SRC)\ubik
  	$(CD) $(SRC)\ubik
--- 137,150 ----
  	$(NTMAKE)
  	$(CD) ..\..
  
! rxdebug: rx
!      echo ***** $@
! 	$(DOCD) $(SRC)\$@
! 	$(CD) $(SRC)\$@
! 	$(NTMAKE)
! 	$(CD) ..\..
! 
! ubik_headers: rxdebug
       echo ***** $@
  	$(DOCD) $(SRC)\ubik
  	$(CD) $(SRC)\ubik
Index: openafs/src/WINNT/afsd/afsd.h
diff -c openafs/src/WINNT/afsd/afsd.h:1.18 openafs/src/WINNT/afsd/afsd.h:1.18.2.1
*** openafs/src/WINNT/afsd/afsd.h:1.18	Thu Feb 16 16:59:19 2006
--- openafs/src/WINNT/afsd/afsd.h	Mon Feb 26 20:32:09 2007
***************
*** 29,43 ****
  #include "largeint95.h"
  #endif /* !DJGPP */
  
- #include "afsdicon.h"
- 
  #include "cm.h"
  
- #include "krb.h"
- #include "krb_prot.h"
- /*#include <crypt.h>*/
- #include <afs/prs_fs.h>
- 
  #include <osi.h>
  #include "cm_config.h"
  #include "cm_user.h"
--- 29,36 ----
***************
*** 72,77 ****
--- 65,71 ----
  
  #include <afs/vldbint.h>
  #include <afs/afsint.h>
+ #include <afs/prs_fs.h>
  
  #define AFS_DAEMON_SERVICE_NAME AFSREG_CLT_SVC_NAME
  #define AFS_DAEMON_EVENT_NAME   AFSREG_CLT_SW_NAME
Index: openafs/src/WINNT/afsd/afsd_eventmessages.rc
diff -c openafs/src/WINNT/afsd/afsd_eventmessages.rc:1.1 openafs/src/WINNT/afsd/afsd_eventmessages.rc:removed
*** openafs/src/WINNT/afsd/afsd_eventmessages.rc:1.1	Thu Feb 26 14:22:44 2004
--- openafs/src/WINNT/afsd/afsd_eventmessages.rc	Thu Mar  8 20:32:35 2007
***************
*** 1,2 ****
- LANGUAGE 0x9,0x1
- 1 11 MSG00409.bin
--- 0 ----
Index: openafs/src/WINNT/afsd/afsd_init.c
diff -c openafs/src/WINNT/afsd/afsd_init.c:1.79.2.10 openafs/src/WINNT/afsd/afsd_init.c:1.79.2.11
*** openafs/src/WINNT/afsd/afsd_init.c:1.79.2.10	Sat Feb  3 12:49:33 2007
--- openafs/src/WINNT/afsd/afsd_init.c	Wed Mar  7 13:14:05 2007
***************
*** 76,83 ****
  DWORD cm_CachePathLen;
  DWORD cm_ValidateCache = 1;
  
- BOOL isGateway = FALSE;
- 
  BOOL reportSessionStartups = FALSE;
  
  cm_initparams_v1 cm_initParams;
--- 76,81 ----
***************
*** 568,574 ****
      long code;
      /*int freelanceEnabled;*/
      WSADATA WSAjunk;
-     lana_number_t lanaNum;
      int i;
      char *p, *q; 
      int cm_noIPAddr;         /* number of client network interfaces */
--- 566,571 ----
***************
*** 1081,1105 ****
      
      RegCloseKey (parmKey);
  
-     /* Call lanahelper to get Netbios name, lan adapter number and gateway flag */
-     if (SUCCEEDED(code = lana_GetUncServerNameEx(cm_NetbiosName, &lanaNum, &isGateway, LANA_NETBIOS_NAME_FULL))) {
-         LANadapter = (lanaNum == LANA_INVALID)? -1: lanaNum;
- 
-         if (LANadapter != -1)
-             afsi_log("LAN adapter number %d", LANadapter);
-         else
-             afsi_log("LAN adapter number not determined");
- 
-         if (isGateway)
-             afsi_log("Set for gateway service");
- 
-         afsi_log("Using >%s< as SMB server name", cm_NetbiosName);
-     } else {
-         /* something went horribly wrong.  We can't proceed without a netbios name */
-         StringCbPrintfA(buf,sizeof(buf),"Netbios name could not be determined: %li", code);
-         osi_panic(buf, __FILE__, __LINE__);
-     }
- 
      cacheBlocks = ((afs_uint64)cacheSize * 1024) / CM_CONFIGDEFAULT_BLOCKSIZE;
          
      /* get network related info */
--- 1078,1083 ----
***************
*** 1325,1331 ****
      /* Do this last so that we don't handle requests before init is done.
       * Here we initialize the SMB listener.
       */
!     smb_Init(afsd_logp, cm_NetbiosName, smb_UseV3, LANadapter, numSvThreads, aMBfunc);
      afsi_log("smb_Init complete");
  
      return 0;
--- 1303,1309 ----
      /* Do this last so that we don't handle requests before init is done.
       * Here we initialize the SMB listener.
       */
!     smb_Init(afsd_logp, smb_UseV3, numSvThreads, aMBfunc);
      afsi_log("smb_Init complete");
  
      return 0;
Index: openafs/src/WINNT/afsd/cm_dir.h
diff -c openafs/src/WINNT/afsd/cm_dir.h:1.4 openafs/src/WINNT/afsd/cm_dir.h:1.4.4.1
*** openafs/src/WINNT/afsd/cm_dir.h:1.4	Sat Nov  5 01:47:46 2005
--- openafs/src/WINNT/afsd/cm_dir.h	Mon Feb 19 22:14:45 2007
***************
*** 10,17 ****
  #ifndef __CM_DIR_ENV__
  #define __CM_DIR_ENV__ 1
  
  #define CM_DIR_PAGESIZE		2048		/* bytes per page */
! #define CM_DIR_NHASHENT		256		/* entries in the hash tbl == NHSIZE */
  #define CM_DIR_MAXPAGES		128		/* max pages in a dir */
  #define CM_DIR_BIGMAXPAGES	1023		/* new big max pages */
  #define CM_DIR_EPP		64		/* dir entries per page */
--- 10,22 ----
  #ifndef __CM_DIR_ENV__
  #define __CM_DIR_ENV__ 1
  
+ /* These data structures are derived from src/dir/dir.h and should not 
+  * be changed as they describe AFS3 wire protocol.
+  *
+  */
+ 
  #define CM_DIR_PAGESIZE		2048		/* bytes per page */
! #define CM_DIR_NHASHENT		128		/* entries in the dir hash tbl */
  #define CM_DIR_MAXPAGES		128		/* max pages in a dir */
  #define CM_DIR_BIGMAXPAGES	1023		/* new big max pages */
  #define CM_DIR_EPP		64		/* dir entries per page */
***************
*** 35,44 ****
  typedef struct cm_pageHeader {
  	/* A page header entry. */
  	unsigned short pgcount;	/* number of pages, or 0 if old-style */
! 	unsigned short tag;		/* 1234 in network byte order */
  	char freeCount;	/* unused, info in dirHeader structure */
  	char freeBitmap[CM_DIR_EPP/8];
! 	char padding[32-(5+CM_DIR_EPP/8)];	/* pad to one 32-byte entry */
  } cm_pageHeader_t;
  
  /* a total of 13 32-byte entries, 1 for the header that in all pages, and
--- 40,49 ----
  typedef struct cm_pageHeader {
  	/* A page header entry. */
  	unsigned short pgcount;	/* number of pages, or 0 if old-style */
! 	unsigned short tag;		/* '1234' in network byte order */
  	char freeCount;	/* unused, info in dirHeader structure */
  	char freeBitmap[CM_DIR_EPP/8];
! 	char padding[CM_DIR_CHUNKSIZE-(5+CM_DIR_EPP/8)];/* pad to one 32-byte entry */
  } cm_pageHeader_t;
  
  /* a total of 13 32-byte entries, 1 for the header that in all pages, and
***************
*** 56,66 ****
   */
  typedef struct cm_dirEntry {
  	/* A directory entry */
! 	char flag;
  	char length;	/* currently unused */
  	unsigned short next;
  	cm_dirFid_t fid;
! 	char name[16];
  } cm_dirEntry_t;
  
  #ifdef UNUSED
--- 61,71 ----
   */
  typedef struct cm_dirEntry {
  	/* A directory entry */
! 	char flag;	/* this must be FFIRST (1) */
  	char length;	/* currently unused */
  	unsigned short next;
  	cm_dirFid_t fid;
! 	char name[1];	/* the real length is determined with strlen() */
  } cm_dirEntry_t;
  
  #ifdef UNUSED
Index: openafs/src/WINNT/afsd/cm_dnlc.h
diff -c openafs/src/WINNT/afsd/cm_dnlc.h:1.4 openafs/src/WINNT/afsd/cm_dnlc.h:1.4.6.1
*** openafs/src/WINNT/afsd/cm_dnlc.h:1.4	Fri Mar 11 00:33:22 2005
--- openafs/src/WINNT/afsd/cm_dnlc.h	Mon Feb 19 22:14:45 2007
***************
*** 11,17 ****
  
  #define 	CM_AFSNCNAMESIZE 	40  /* multiple of 8 (for 64-bit) */
  #define         NCSIZE 			512
! #define         NHSIZE 			256 /* must be power of 2 == CM_DIR_NHASHENT */
  
  #define         CM_DNLC_MAGIC           ('D' | 'N' <<8 | 'L'<<16 | 'C'<<24)
  
--- 11,17 ----
  
  #define 	CM_AFSNCNAMESIZE 	40  /* multiple of 8 (for 64-bit) */
  #define         NCSIZE 			512
! #define         NHSIZE 			256 /* must be power of 2 */
  
  #define         CM_DNLC_MAGIC           ('D' | 'N' <<8 | 'L'<<16 | 'C'<<24)
  
Index: openafs/src/WINNT/afsd/cm_utils.c
diff -c openafs/src/WINNT/afsd/cm_utils.c:1.11.4.3 openafs/src/WINNT/afsd/cm_utils.c:1.11.4.4
*** openafs/src/WINNT/afsd/cm_utils.c:1.11.4.3	Thu Oct  5 16:30:39 2006
--- openafs/src/WINNT/afsd/cm_utils.c	Thu Feb 15 01:02:03 2007
***************
*** 284,289 ****
--- 284,291 ----
          return error;
      }
  
+     error = et_to_sys_error(error);
+ 
      if (error < 0) 
          error = CM_ERROR_TIMEDOUT;
      else if (error == 30) 
***************
*** 304,327 ****
  
  long cm_MapVLRPCError(long error, cm_req_t *reqp)
  {
! 	if (error == 0) return 0;
  
! 	/* If we had to stop retrying, report our saved error code. */
! 	if (reqp && error == CM_ERROR_TIMEDOUT) {
! 		if (reqp->accessError)
! 			return reqp->accessError;
! 		if (reqp->volumeError)
! 			return reqp->volumeError;
! 		if (reqp->rpcError)
! 			return reqp->rpcError;
! 		return error;
! 	}
! 
! 	if (error < 0) 
!             error = CM_ERROR_TIMEDOUT;
! 	else if (error == VL_NOENT) 
!             error = CM_ERROR_NOSUCHVOLUME;
  	return error;
  }
  
  cm_space_t *cm_GetSpace(void)
--- 306,331 ----
  
  long cm_MapVLRPCError(long error, cm_req_t *reqp)
  {
!     if (error == 0) return 0;
  
!     /* If we had to stop retrying, report our saved error code. */
!     if (reqp && error == CM_ERROR_TIMEDOUT) {
! 	if (reqp->accessError)
! 	    return reqp->accessError;
! 	if (reqp->volumeError)
! 	    return reqp->volumeError;
! 	if (reqp->rpcError)
! 	    return reqp->rpcError;
  	return error;
+     }
+ 
+     error = et_to_sys_error(error);
+ 
+     if (error < 0) 
+ 	error = CM_ERROR_TIMEDOUT;
+     else if (error == VL_NOENT) 
+ 	error = CM_ERROR_NOSUCHVOLUME;
+     return error;
  }
  
  cm_space_t *cm_GetSpace(void)
Index: openafs/src/WINNT/afsd/fs.c
diff -c openafs/src/WINNT/afsd/fs.c:1.32.4.5 openafs/src/WINNT/afsd/fs.c:1.32.4.6
*** openafs/src/WINNT/afsd/fs.c:1.32.4.5	Sun Jan 21 21:18:09 2007
--- openafs/src/WINNT/afsd/fs.c	Fri Mar  2 20:32:06 2007
***************
*** 2096,2102 ****
          /* sanity check */
          if(checkserv.tinterval<0) {
              printf("Warning: The negative -interval is ignored; treated as an inquiry\n");
!             checkserv.tinterval=0;
          } else if(checkserv.tinterval> 600) {
              printf("Warning: The maximum -interval value is 10 mins (600 secs)\n");
              checkserv.tinterval=600;	/* 10 min max interval */
--- 2096,2102 ----
          /* sanity check */
          if(checkserv.tinterval<0) {
              printf("Warning: The negative -interval is ignored; treated as an inquiry\n");
!             checkserv.tinterval=-1;
          } else if(checkserv.tinterval> 600) {
              printf("Warning: The maximum -interval value is 10 mins (600 secs)\n");
              checkserv.tinterval=600;	/* 10 min max interval */
***************
*** 2105,2111 ****
          checkserv.tinterval = -1;	/* don't change current interval */
      }
  
!     if ( checkserv.tinterval != 0 ) {
  #ifdef WIN32
          if ( !IsAdmin() ) {
              fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n");
--- 2105,2111 ----
          checkserv.tinterval = -1;	/* don't change current interval */
      }
  
!     if ( checkserv.tinterval >= 0 ) {
  #ifdef WIN32
          if ( !IsAdmin() ) {
              fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n");
Index: openafs/src/WINNT/afsd/lanahelper.cpp
diff -c openafs/src/WINNT/afsd/lanahelper.cpp:1.12.2.1 openafs/src/WINNT/afsd/lanahelper.cpp:1.12.2.3
*** openafs/src/WINNT/afsd/lanahelper.cpp:1.12.2.1	Sat Oct 21 16:47:48 2006
--- openafs/src/WINNT/afsd/lanahelper.cpp	Tue Feb 27 19:42:05 2007
***************
*** 59,65 ****
--- 59,67 ----
  static const char *szNetbiosNameValue = "NetbiosName";
  static const char *szIsGatewayValue = "IsGateway";
  static const char *szLanAdapterValue = "LanAdapter";
+ #ifdef USE_FINDLANABYNAME
  static const char *szNoFindLanaByName = "NoFindLanaByName";
+ #endif
  static const char *szForceLanaLoopback = "ForceLanaLoopback";
  
  // Use the IShellFolder API to get the connection name for the given Guid.
***************
*** 522,657 ****
  //      LANA_NETBIOS_NAME_FULL : Return full netbios name
  extern "C" long lana_GetUncServerNameEx(char *buffer, lana_number_t * pLana, int * pIsGateway, int flags) {
      HKEY hkConfig;
! 	DWORD dummyLen;
! 	LONG rv;
! 	int regLana;
! 	int regGateway, regNoFindLanaByName;
! 	TCHAR regNbName[MAX_NB_NAME_LENGTH];
! 	TCHAR nbName[MAX_NB_NAME_LENGTH];
! 	TCHAR hostname[MAX_COMPUTERNAME_LENGTH+1];
! 
! 	rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE,AFSREG_CLT_SVC_PARAM_SUBKEY,0,KEY_READ,&hkConfig);
! 	if(rv == ERROR_SUCCESS) {
! 		if(!(flags & LANA_NETBIOS_NAME_IN) || !pLana) {
! 			dummyLen = sizeof(regLana);
! 			rv = RegQueryValueEx(hkConfig, szLanAdapterValue, NULL, NULL, (LPBYTE) &regLana, &dummyLen);
! 			if(rv != ERROR_SUCCESS) regLana = -1;
! 		} else
! 			regLana = *pLana;
! 
! 		if(!(flags & LANA_NETBIOS_NAME_IN) || !pIsGateway) {
! 			dummyLen = sizeof(regGateway);
! 			rv = RegQueryValueEx(hkConfig, szIsGatewayValue, NULL, NULL, (LPBYTE) &regGateway, &dummyLen);
! 			if(rv != ERROR_SUCCESS) regGateway = 0;
! 		} else
! 			regGateway = *pIsGateway;
! 
! 		dummyLen = sizeof(regNoFindLanaByName);
! 		rv = RegQueryValueEx(hkConfig, szNoFindLanaByName, NULL, NULL, (LPBYTE) &regNoFindLanaByName, &dummyLen);
! 		if(rv != ERROR_SUCCESS) regNoFindLanaByName = 0;
! 
! 		// Do not care if the call fails for insufficient buffer size.  We are not interested
! 		// in netbios names over 15 chars.
! 		dummyLen = sizeof(regNbName);
! 		rv = RegQueryValueEx(hkConfig, szNetbiosNameValue, NULL, NULL, (LPBYTE) &regNbName, &dummyLen);
! 		if(rv != ERROR_SUCCESS) regNbName[0] = 0;
! 		else regNbName[15] = 0;
  
! 		RegCloseKey(hkConfig);
  	} else {
! 		if(flags & LANA_NETBIOS_NAME_IN) {
! 			regLana = (pLana)? *pLana: -1;
! 			regGateway = (pIsGateway)? *pIsGateway: 0;
! 		} else {
! 			regLana = -1;
! 			regGateway = 0;
! 		}
!         regNoFindLanaByName = 0;
! 		regNbName[0] = 0;
  	}
  
      if(regLana < 0 || regLana > MAX_LANA) 
          regLana = -1;
  
! 	if(regLana == -1) {
! 		LANAINFO *lanaInfo = NULL;
          int nLana = LANA_INVALID;
  
          if (!regNoFindLanaByName)
              lanaInfo = lana_FindLanaByName("AFS");
! 		if(lanaInfo != NULL) {
              nLana = lanaInfo[0].lana_number;
! 			free(lanaInfo);
! 		} else
! 			nLana = LANA_INVALID;
! 
! 		if(nLana == LANA_INVALID && !regGateway) {
! 			nLana = lana_FindLoopback();
! 		}
! 		if(nLana != LANA_INVALID) 
!             regLana = nLana;
  	}
  
! 	if(regNbName[0] &&
!        (regLana >=0 && lana_IsLoopback((lana_number_t) regLana,FALSE))) {
          strncpy(nbName,regNbName,15);
          nbName[16] = 0;
          strupr(nbName);
! 	} else {
! 		char * dot;
  
! 		if(flags & LANA_NETBIOS_NAME_SUFFIX) {
! 			strcpy(nbName,"-AFS");
! 		} else {
! 			dummyLen = sizeof(hostname);
! 			// assume we are not a cluster.
! 			rv = GetComputerName(hostname, &dummyLen);
! 			if(!SUCCEEDED(rv)) { // should not happen, but...
! 				return rv;
! 			}
! 			strncpy(nbName, hostname, 11);
! 			nbName[11] = 0;
! 			if(dot = strchr(nbName,'.'))
! 				*dot = 0;
! 			strcat(nbName,"-AFS");
! 		}
  	}
  
! 	if(pLana) *pLana = regLana;
! 	if(pIsGateway) *pIsGateway = regGateway;
  
! 	strcpy(buffer, nbName);
  
! 	return ERROR_SUCCESS;
  }
  
  extern "C" void lana_GetUncServerNameDynamic(int lanaNumber, BOOL isGateway, TCHAR *name, int type) {
! 	char szName[MAX_NB_NAME_LENGTH];
! 	lana_number_t lana = (lana_number_t) lanaNumber;
! 	int gateway = (int) isGateway;
  
! 	if(SUCCEEDED(lana_GetUncServerNameEx(szName, &lana, &gateway, LANA_NETBIOS_NAME_IN | type))) {
  #ifdef _UNICODE
! 		mbswcs(name,szName,MAX_NB_NAME_LENGTH);
  #else
! 		strncpy(name,szName,MAX_NB_NAME_LENGTH);
  #endif
! 	} else
! 		*name = _T('\0');
  }
  
  extern "C" void lana_GetUncServerName(TCHAR *name, int type) {
! 	char szName[MAX_NB_NAME_LENGTH];
  
! 	if(SUCCEEDED(lana_GetUncServerNameEx(szName,NULL,NULL,type))) {
  #ifdef _UNICODE
! 		mbswcs(name,szName,MAX_NB_NAME_LENGTH);
! #else
! 		strncpy(name,szName,MAX_NB_NAME_LENGTH);
  #endif
! 	} else {
!         *name = _T('\0');
! 	}
  }
  
  extern "C" void lana_GetAfsNameString(int lanaNumber, BOOL isGateway, TCHAR* name)
--- 524,676 ----
  //      LANA_NETBIOS_NAME_FULL : Return full netbios name
  extern "C" long lana_GetUncServerNameEx(char *buffer, lana_number_t * pLana, int * pIsGateway, int flags) {
      HKEY hkConfig;
!     DWORD dummyLen;
!     LONG rv;
!     int regLana;
!     int regGateway;
! #ifdef USE_FINDLANABYNAME
!     int regNoFindLanaByName;
! #endif
!     TCHAR regNbName[MAX_NB_NAME_LENGTH] = "AFS";
!     TCHAR nbName[MAX_NB_NAME_LENGTH];
!     TCHAR hostname[MAX_COMPUTERNAME_LENGTH+1];
! 
!     rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE,AFSREG_CLT_SVC_PARAM_SUBKEY,0,KEY_READ,&hkConfig);
!     if(rv == ERROR_SUCCESS) {
! 	if(!(flags & LANA_NETBIOS_NAME_IN) || !pLana) {
! 	    dummyLen = sizeof(regLana);
! 	    rv = RegQueryValueEx(hkConfig, szLanAdapterValue, NULL, NULL, (LPBYTE) &regLana, &dummyLen);
! 	    if(rv != ERROR_SUCCESS) 
! 		regLana = -1;
! 	} else
! 	    regLana = *pLana;
! 
! 	if(!(flags & LANA_NETBIOS_NAME_IN) || !pIsGateway) {
! 	    dummyLen = sizeof(regGateway);
! 	    rv = RegQueryValueEx(hkConfig, szIsGatewayValue, NULL, NULL, (LPBYTE) &regGateway, &dummyLen);
! 	    if(rv != ERROR_SUCCESS) 
! 		regGateway = 0;
! 	} else
! 	    regGateway = *pIsGateway;
  
! #ifdef USE_FINDLANABYNAME
! 	dummyLen = sizeof(regNoFindLanaByName);
! 	rv = RegQueryValueEx(hkConfig, szNoFindLanaByName, NULL, NULL, (LPBYTE) &regNoFindLanaByName, &dummyLen);
! 	if(rv != ERROR_SUCCESS) 
! 	    regNoFindLanaByName = 0;
! #endif
! 
! 	// Do not care if the call fails for insufficient buffer size.  We are not interested
! 	// in netbios names over 15 chars.
! 	dummyLen = sizeof(regNbName);
! 	rv = RegQueryValueEx(hkConfig, szNetbiosNameValue, NULL, NULL, (LPBYTE) &regNbName, &dummyLen);
! 	if(rv != ERROR_SUCCESS) 
! 	    strcpy(regNbName, "AFS");
! 	else 
! 	    regNbName[15] = 0;
! 
! 	RegCloseKey(hkConfig);
!     } else {
! 	if(flags & LANA_NETBIOS_NAME_IN) {
! 	    regLana = (pLana)? *pLana: -1;
! 	    regGateway = (pIsGateway)? *pIsGateway: 0;
  	} else {
! 	    regLana = -1;
! 	    regGateway = 0;
  	}
+ #ifdef USE_FINDLANABYNAME 
+         regNoFindLanaByName = 0;
+ #endif
+ 	strcpy(regNbName, "AFS");
+     }
  
      if(regLana < 0 || regLana > MAX_LANA) 
          regLana = -1;
  
!     if(regLana == -1) {
! 	LANAINFO *lanaInfo = NULL;
          int nLana = LANA_INVALID;
  
+ #ifdef USE_FINDLANABYNAME
          if (!regNoFindLanaByName)
              lanaInfo = lana_FindLanaByName("AFS");
! #endif
! 	if(lanaInfo != NULL) {
              nLana = lanaInfo[0].lana_number;
! 	    free(lanaInfo);
! 	} else
! 	    nLana = LANA_INVALID;
! 
! 	if(nLana == LANA_INVALID && !regGateway) {
! 	    nLana = lana_FindLoopback();
  	}
+ 	if(nLana != LANA_INVALID) 
+             regLana = nLana;
+ 	}	
  
!     if(regNbName[0] &&
! 	(regLana >=0 && lana_IsLoopback((lana_number_t) regLana,FALSE))) 	
!     {
          strncpy(nbName,regNbName,15);
          nbName[16] = 0;
          strupr(nbName);
!     } else {
! 	char * dot;
  
! 	if(flags & LANA_NETBIOS_NAME_SUFFIX) {
! 	    strcpy(nbName,"-AFS");
! 	} else {
! 	    dummyLen = sizeof(hostname);
! 	    // assume we are not a cluster.
! 	    rv = GetComputerName(hostname, &dummyLen);
! 	    if(!SUCCEEDED(rv)) { // should not happen, but...
! 		return rv;
! 	    }
! 	    strncpy(nbName, hostname, 11);
! 	    nbName[11] = 0;
! 	    if(dot = strchr(nbName,'.'))
! 		*dot = 0;
! 	    strcat(nbName,"-AFS");
  	}
+     }
  
!     if(pLana) 
! 	*pLana = regLana;
!     if(pIsGateway) 
! 	*pIsGateway = regGateway;
  
!     strcpy(buffer, nbName);
  
!     return ERROR_SUCCESS;
  }
  
  extern "C" void lana_GetUncServerNameDynamic(int lanaNumber, BOOL isGateway, TCHAR *name, int type) {
!     char szName[MAX_NB_NAME_LENGTH];
!     lana_number_t lana = (lana_number_t) lanaNumber;
!     int gateway = (int) isGateway;
  
!     if(SUCCEEDED(lana_GetUncServerNameEx(szName, &lana, &gateway, LANA_NETBIOS_NAME_IN | type))) {
  #ifdef _UNICODE
! 	mbswcs(name,szName,MAX_NB_NAME_LENGTH);
  #else
! 	strncpy(name,szName,MAX_NB_NAME_LENGTH);
  #endif
!     } else
! 	*name = _T('\0');
  }
  
  extern "C" void lana_GetUncServerName(TCHAR *name, int type) {
!     char szName[MAX_NB_NAME_LENGTH];
  
!     if(SUCCEEDED(lana_GetUncServerNameEx(szName,NULL,NULL,type))) {
  #ifdef _UNICODE
! 	mbswcs(name,szName,MAX_NB_NAME_LENGTH);
! #else	
! 	strncpy(name,szName,MAX_NB_NAME_LENGTH);
  #endif
!     } else {
! 	*name = _T('\0');
!     }
  }
  
  extern "C" void lana_GetAfsNameString(int lanaNumber, BOOL isGateway, TCHAR* name)
***************
*** 663,671 ****
  
  extern "C" void lana_GetNetbiosName(LPTSTR pszName, int type)
  {
! 	HKEY hkCfg;
      TCHAR name[MAX_NB_NAME_LENGTH];
! 	DWORD dummyLen;
  
      memset(name, 0, sizeof(name));
      if (GetVersion() >= 0x80000000) // not WindowsNT
--- 682,690 ----
  
  extern "C" void lana_GetNetbiosName(LPTSTR pszName, int type)
  {
!     HKEY hkCfg;
      TCHAR name[MAX_NB_NAME_LENGTH];
!     DWORD dummyLen;
  
      memset(name, 0, sizeof(name));
      if (GetVersion() >= 0x80000000) // not WindowsNT
***************
*** 676,687 ****
              return;
          }
  
! 		if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,AFSREG_CLT_SVC_PARAM_SUBKEY,0,KEY_READ,&hkCfg) == ERROR_SUCCESS) {
! 			dummyLen = sizeof(name);
! 			if(RegQueryValueEx(hkCfg,TEXT("Gateway"),NULL,NULL,(LPBYTE) name,&dummyLen) == ERROR_SUCCESS)
! 				name[0] = _T('\0');
! 			RegCloseKey(hkCfg);
! 		}
  
          if (_tcslen(name) == 0)
          {
--- 695,706 ----
              return;
          }
  
! 	if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,AFSREG_CLT_SVC_PARAM_SUBKEY,0,KEY_READ,&hkCfg) == ERROR_SUCCESS) {
! 	    dummyLen = sizeof(name);
! 	    if(RegQueryValueEx(hkCfg,TEXT("Gateway"),NULL,NULL,(LPBYTE) name,&dummyLen) == ERROR_SUCCESS)
! 		name[0] = _T('\0');
! 	    RegCloseKey(hkCfg);
! 	}
  
          if (_tcslen(name) == 0)
          {
***************
*** 689,701 ****
              return;
          }
  
! 		_tcscpy(pszName, name);
          _tcscat(pszName, TEXT("-afs"));
          return;
      }
  
      lana_GetUncServerName(name,type);
! 	_tcslwr(name);
      _tcscpy(pszName, name);
      return;
  }
--- 708,720 ----
              return;
          }
  
! 	_tcscpy(pszName, name);
          _tcscat(pszName, TEXT("-afs"));
          return;
      }
  
      lana_GetUncServerName(name,type);
!     _tcslwr(name);
      _tcscpy(pszName, name);
      return;
  }
Index: openafs/src/WINNT/afsd/smb.c
diff -c openafs/src/WINNT/afsd/smb.c:1.118.2.32 openafs/src/WINNT/afsd/smb.c:1.118.2.33
*** openafs/src/WINNT/afsd/smb.c:1.118.2.32	Fri Feb  9 18:51:15 2007
--- openafs/src/WINNT/afsd/smb.c	Wed Mar  7 13:14:05 2007
***************
*** 65,70 ****
--- 65,72 ----
  char smb_LANadapter;
  unsigned char smb_sharename[NCBNAMSZ+1] = {0};
  
+ BOOL isGateway = FALSE;
+ 
  /* for debugging */
  long smb_maxObsConcurrentCalls=0;
  long smb_concurrentCalls=0;
***************
*** 8592,8597 ****
--- 8594,8600 ----
      int delname_tried=0;
      int len;
      int lana_found = 0;
+     lana_number_t lanaNum;
  
      /* setup the NCB system */
      ncbp = GetNCB();
***************
*** 8599,8604 ****
--- 8602,8636 ----
      dos_ncb = ((smb_ncb_t *)ncbp)->dos_ncb;
  #endif /* DJGPP */
  
+     /* Call lanahelper to get Netbios name, lan adapter number and gateway flag */
+     if (SUCCEEDED(code = lana_GetUncServerNameEx(cm_NetbiosName, &lanaNum, &isGateway, LANA_NETBIOS_NAME_FULL))) {
+         smb_LANadapter = (lanaNum == LANA_INVALID)? -1: lanaNum;
+ 
+         if (smb_LANadapter != -1)
+             afsi_log("LAN adapter number %d", smb_LANadapter);
+         else
+             afsi_log("LAN adapter number not determined");
+ 
+         if (isGateway)
+             afsi_log("Set for gateway service");
+ 
+         afsi_log("Using >%s< as SMB server name", cm_NetbiosName);
+     } else {
+         /* something went horribly wrong.  We can't proceed without a netbios name */
+ 	char buf[128];
+         StringCbPrintfA(buf,sizeof(buf),"Netbios name could not be determined: %li", code);
+         osi_panic(buf, __FILE__, __LINE__);
+     }
+ 
+     /* remember the name */
+     len = (int)strlen(cm_NetbiosName);
+     if (smb_localNamep)
+ 	free(smb_localNamep);
+     smb_localNamep = malloc(len+1);
+     strcpy(smb_localNamep, cm_NetbiosName);
+     afsi_log("smb_localNamep is >%s<", smb_localNamep);
+ 
+ 
  #ifndef DJGPP
      if (smb_LANadapter == -1) {
          ncbp->ncb_command = NCBENUM;
***************
*** 8835,8841 ****
      Sleep(1000);	/* give the listener threads a chance to exit */
  }
  
! void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt,
                int nThreads
  #ifndef DJGPP
                , void *aMBfunc
--- 8867,8873 ----
      Sleep(1000);	/* give the listener threads a chance to exit */
  }
  
! void smb_Init(osi_log_t *logp, int useV3,
                int nThreads
  #ifndef DJGPP
                , void *aMBfunc
***************
*** 8846,8852 ****
      thread_t phandle;
      int lpid;
      INT_PTR i;
-     int len;
      struct tm myTime;
  #ifdef DJGPP
      int npar, seg, sel;
--- 8878,8883 ----
***************
*** 8862,8868 ****
  #endif /* DJGPP */
  
      smb_useV3 = useV3;
-     smb_LANadapter = LANadapt;
  
      /* Initialize smb_localZero */
      myTime.tm_isdst = -1;		/* compute whether on DST or not */
--- 8893,8898 ----
***************
*** 8886,8897 ****
      /* initialize the remote debugging log */
      smb_logp = logp;
          
-     /* remember the name */
-     len = (int)strlen(snamep);
-     smb_localNamep = malloc(len+1);
-     strcpy(smb_localNamep, snamep);
-     afsi_log("smb_localNamep is >%s<", smb_localNamep);
- 
      /* and the global lock */
      lock_InitializeRWLock(&smb_globalLock, "smb global lock");
      lock_InitializeRWLock(&smb_rctLock, "smb refct and tree struct lock");
--- 8916,8921 ----
Index: openafs/src/WINNT/afsd/smb.h
diff -c openafs/src/WINNT/afsd/smb.h:1.41.2.12 openafs/src/WINNT/afsd/smb.h:1.41.2.13
*** openafs/src/WINNT/afsd/smb.h:1.41.2.12	Mon Jan 15 14:52:19 2007
--- openafs/src/WINNT/afsd/smb.h	Wed Mar  7 13:14:05 2007
***************
*** 523,529 ****
  
  /* prototypes */
  
! extern void smb_Init(osi_log_t *logp, char *smbNamep, int useV3, int LANadapt,
  	int nThreads
  #ifndef DJGPP
          , void *aMBfunc
--- 523,529 ----
  
  /* prototypes */
  
! extern void smb_Init(osi_log_t *logp, int useV3,
  	int nThreads
  #ifndef DJGPP
          , void *aMBfunc
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.9 openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.10
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm:1.5.4.9	Sat Feb 10 10:28:15 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/index.htm	Thu Mar  8 20:13:17 2007
***************
*** 198,204 ****
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.15</h2>
  
  <p class=MsoNormal><span style='mso-fareast-font-family:"MS Mincho"'>&nbsp; <o:p></o:p></span></p>
  
--- 198,204 ----
  
  <h1>OpenAFS for Windows</h1>
  
! <h2>Version 1.5.16</h2>
  
  <p class=MsoNormal><span style='mso-fareast-font-family:"MS Mincho"'>&nbsp; <o:p></o:p></span></p>
  
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.10 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.11
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm:1.1.6.10	Sat Feb 10 10:28:39 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/logo.htm	Thu Mar  8 20:13:21 2007
***************
*** 18,24 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.15 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
--- 18,24 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.16 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Revision>1</o:Revision>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.12 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.13
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm:1.1.4.12	Sat Feb 10 10:28:39 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes-frames.htm	Thu Mar  8 20:13:21 2007
***************
*** 8,14 ****
  <meta name=Generator content="Microsoft Word 11">
  <meta name=Originator content="Microsoft Word 11">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.15 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <w:WordDocument>
    <w:Zoom>0</w:Zoom>
--- 8,14 ----
  <meta name=Generator content="Microsoft Word 11">
  <meta name=Originator content="Microsoft Word 11">
  <link rel=File-List href="relnotes-frames_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.16 Release Notes</title>
  <!--[if gte mso 9]><xml>
   <w:WordDocument>
    <w:Zoom>0</w:Zoom>
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.13 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.14
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm:1.6.4.13	Sat Feb 10 10:28:39 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/relnotes.htm	Thu Mar  8 20:13:21 2007
***************
*** 19,25 ****
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.15 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
--- 19,25 ----
  .shape {behavior:url(#default#VML);}
  </style>
  <![endif]-->
! <title>OpenAFS for Windows 1.5.16 Release Notes</title>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
   name="PostalCode"/>
  <o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
***************
*** 583,589 ****
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.15<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
--- 583,589 ----
  
  <div class=Section1>
  
! <p class=MsoTitle>OpenAFS for Windows 1.5.16<br>
  Release Notes</p>
  
  <p class=MsoBodyText>The Andrew File System (AFS) is a location-independent
Index: openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm
diff -c openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.8 openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.9
*** openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm:1.2.6.8	Sat Feb 10 10:28:39 2007
--- openafs/src/WINNT/doc/install/Documentation/en_US/html/ReleaseNotes/toc.htm	Thu Mar  8 20:13:21 2007
***************
*** 10,16 ****
  <meta name=Originator content="Microsoft Word 11">
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.15 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
--- 10,16 ----
  <meta name=Originator content="Microsoft Word 11">
  <base target=body>
  <link rel=File-List href="toc_files/filelist.xml">
! <title>OpenAFS for Windows 1.5.16 Table of Contents</title>
  <!--[if gte mso 9]><xml>
   <o:DocumentProperties>
    <o:Author>Jeffrey Altman</o:Author>
Index: openafs/src/WINNT/netidmgr_plugin/afsplugin.c
diff -c openafs/src/WINNT/netidmgr_plugin/afsplugin.c:1.1.2.3 openafs/src/WINNT/netidmgr_plugin/afsplugin.c:1.1.2.4
*** openafs/src/WINNT/netidmgr_plugin/afsplugin.c:1.1.2.3	Mon Oct 16 09:55:35 2006
--- openafs/src/WINNT/netidmgr_plugin/afsplugin.c	Thu Feb 15 16:52:24 2007
***************
*** 22,28 ****
   * SOFTWARE.
   */
  
! /* $Id: afsplugin.c,v 1.1.2.3 2006/10/16 13:55:35 jaltman Exp $ */
  
  #include<afscred.h>
  #include<kcreddb.h>
--- 22,28 ----
   * SOFTWARE.
   */
  
! /* $Id: afsplugin.c,v 1.1.2.4 2007/02/15 21:52:24 jaltman Exp $ */
  
  #include<afscred.h>
  #include<kcreddb.h>
***************
*** 30,35 ****
--- 30,36 ----
  #include<kherror.h>
  #include<khuidefs.h>
  #include<commctrl.h>
+ #include<htmlhelp.h>
  #include<assert.h>
  
  static BOOL initialized = FALSE;
***************
*** 47,52 ****
--- 48,55 ----
  khm_handle afs_credset = NULL;
  khm_handle afs_sub = NULL;      /* AFS message subscription */
  
+ khm_int32 action_id_afs_help = 0;
+ 
  /* forward dcls */
  khm_int32 KHMAPI 
  afs_msg_system(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
***************
*** 57,65 ****
--- 60,107 ----
  khm_int32 KHMAPI 
  afs_msg_cred(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
  
+ khm_int32 KHMAPI
+ afs_msg_act(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
+ 
  khm_int32 KHMAPI 
  afs_msg_ext(khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam);
  
+ /* AFS help menu extensions */
+ 
+ /* some of the functions we will be calling are only available on API
+    version 7 and above of Network Identity Manager.  Since these
+    aren't critical, we allow building using API version 5 or above,
+    but conditionally use the newer functionality if the plug-in is
+    loaded by a newer version of Network Identity Manager. */
+ 
+ #if KH_VERSION_API < 7
+ 
+ HMODULE hm_netidmgr;
+ 
+ /* declarations from version 7 of the API */
+ KHMEXP void
+ (KHMAPI * pkhui_action_lock)(void);
+ 
+ KHMEXP void
+ (KHMAPI * pkhui_action_unlock)(void);
+ 
+ KHMEXP void
+ (KHMAPI * pkhui_refresh_actions)(void);
+ 
+ typedef khm_int32
+ (KHMAPI * khm_ui_callback)(HWND hwnd_main_wnd, void * rock);
+ 
+ KHMEXP khm_int32
+ (KHMAPI * pkhui_request_UI_callback)(khm_ui_callback cb,
+                                      void * rock);
+ 
+ #define khui_action_lock         (*pkhui_action_lock)
+ #define khui_action_unlock       (*pkhui_action_unlock)
+ #define khui_refresh_actions     (*pkhui_refresh_actions)
+ #define khui_request_UI_callback (*pkhui_request_UI_callback)
+ 
+ #endif
+ 
  /* AFS plugin callback */
  khm_int32 KHMAPI 
  afs_plugin_cb(khm_int32 msg_type,
***************
*** 73,78 ****
--- 115,122 ----
          return afs_msg_kcdb(msg_subtype, uparam, vparam);
      if (msg_type == KMSG_CRED)
          return afs_msg_cred(msg_subtype, uparam, vparam);
+     if (msg_type == KMSG_ACT)
+         return afs_msg_act(msg_subtype, uparam, vparam);
      if (msg_type == afs_msg_type_id)
          return afs_msg_ext(msg_subtype, uparam, vparam);
  
***************
*** 494,499 ****
--- 538,638 ----
                  khc_close_space(csp_afscred);
              }
  
+             /* try to register the "AFS Help" menu item, if
+                possible */
+             {
+                 khm_handle h_sub = NULL;
+                 wchar_t short_desc[KHUI_MAXCCH_SHORT_DESC];
+                 wchar_t long_desc[KHUI_MAXCCH_LONG_DESC];
+ 
+ #if KH_VERSION_API < 7
+ 
+                 khm_version libver;
+                 khm_ui_4 apiver;
+ 
+                 khm_get_lib_version(&libver, &apiver);
+ 
+                 if (apiver < 7)
+                     goto no_custom_help;
+ 
+                 hm_netidmgr = LoadLibrary(L"nidmgr32.dll");
+ 
+                 if (hm_netidmgr == NULL)
+                     goto no_custom_help;
+ 
+                 pkhui_action_lock = (void (KHMAPI *)(void))
+                     GetProcAddress(hm_netidmgr, "_khui_action_lock@0");
+                 pkhui_action_unlock = (void (KHMAPI *)(void))
+                     GetProcAddress(hm_netidmgr, "_khui_action_unlock@0");
+                 pkhui_refresh_actions = (void (KHMAPI *)(void))
+                     GetProcAddress(hm_netidmgr, "_khui_refresh_actions@0");
+                 pkhui_request_UI_callback = (khm_int32 (KHMAPI *)(khm_ui_callback, void *))
+                     GetProcAddress(hm_netidmgr, "_khui_request_UI_callback@8");
+ 
+                 if (pkhui_action_lock == NULL ||
+                     pkhui_action_unlock == NULL ||
+                     pkhui_refresh_actions == NULL ||
+                     pkhui_request_UI_callback == NULL)
+ 
+                     goto no_custom_help;
+ 
+ #endif
+                 kmq_create_subscription(afs_plugin_cb, &h_sub);
+ 
+                 LoadString(hResModule, IDS_ACTION_AFS_HELP,
+                            short_desc, ARRAYLENGTH(short_desc));
+                 LoadString(hResModule, IDS_ACTION_AFS_HELP_TT,
+                            long_desc, ARRAYLENGTH(long_desc));
+ 
+                 action_id_afs_help = khui_action_create(NULL,
+                                                         short_desc,
+                                                         long_desc,
+                                                         NULL,
+                                                         KHUI_ACTIONTYPE_TRIGGER,
+                                                         h_sub);
+ 
+                 if (action_id_afs_help != 0) {
+                     khm_size s;
+                     khm_size i;
+                     khui_menu_def * help_menu;
+                     khm_boolean refresh = FALSE;
+ 
+                     khui_action_lock();
+ 
+                     help_menu = khui_find_menu(KHUI_MENU_HELP);
+                     if (help_menu) {
+                         s = khui_menu_get_size(help_menu);
+ 
+                         for (i=0; i < s; i++) {
+                             khui_action_ref * aref;
+ 
+                             aref = khui_menu_get_action(help_menu, i);
+ 
+                             if (aref && !(aref->flags & KHUI_ACTIONREF_PACTION) &&
+                                 aref->action == KHUI_ACTION_HELP_INDEX) {
+ 
+                                 khui_menu_insert_action(help_menu,
+                                                         i + 1,
+                                                         action_id_afs_help,
+                                                         0);
+                                 refresh = TRUE;
+                                 break;
+                             }
+                         }
+                     }
+ 
+                     khui_action_unlock();
+ 
+                     if (refresh)
+                         khui_refresh_actions();
+                 }
+ 
+ #if KH_VERSION_API < 7
+             no_custom_help:
+                 ;
+ #endif
+             }
+ 
          _exit_init:
              if(ct.short_desc)
                  PFREE(ct.short_desc);
***************
*** 518,523 ****
--- 657,701 ----
          /* end of KMSG_SYSTEM_INIT */
  
      case KMSG_SYSTEM_EXIT:
+ 
+         /* Try to remove the AFS plug-in action from Help menu if it
+            was successfully registered.  Also, delete the action. */
+         if (action_id_afs_help != 0) {
+ 
+             khui_menu_def * help_menu;
+             khm_boolean menu_changed = FALSE;
+ 
+             khui_action_lock();
+ 
+             help_menu = khui_find_menu(KHUI_MENU_HELP);
+             if (help_menu) {
+                 khm_size s;
+                 khm_size i;
+ 
+                 s = khui_menu_get_size(help_menu);
+                 for (i=0; i < s; i++) {
+                     khui_action_ref * aref = khui_menu_get_action(help_menu, i);
+ 
+                     if (aref && !(aref->flags & KHUI_ACTIONREF_PACTION) &&
+                         aref->action == action_id_afs_help) {
+ 
+                         khui_menu_remove_action(help_menu, i);
+                         menu_changed = TRUE;
+                         break;
+                     }
+                 }
+             }
+ 
+             khui_action_delete(action_id_afs_help);
+ 
+             khui_action_unlock();
+ 
+             if (menu_changed)
+                 khui_refresh_actions();
+ 
+             action_id_afs_help = 0;
+         }
+ 
          if (afs_msg_type_id != -1) {
              kmq_unsubscribe(afs_msg_type_id, afs_plugin_cb);
              kmq_unregister_type(afs_msg_type_id);
***************
*** 559,564 ****
--- 737,752 ----
             of when unregistering the afs cred type */
          afs_sub = NULL;
  
+ #if KH_VERSION_API < 7
+         if (hm_netidmgr)
+             FreeLibrary(hm_netidmgr);
+ 
+         pkhui_action_lock = NULL;
+         pkhui_action_unlock = NULL;
+         pkhui_refresh_actions = NULL;
+         pkhui_request_UI_callback = NULL;
+ #endif
+ 
          rv = KHM_ERROR_SUCCESS;
          break;
          /* end of KMSG_SYSTEM_EXIT */
***************
*** 640,642 ****
--- 828,854 ----
      return rv;
  }
  
+ 
+ khm_int32 KHMAPI
+ help_launcher(HWND hwnd_main, void * rock) {
+     afs_html_help(hwnd_main, NULL, HH_DISPLAY_TOC, 0);
+ 
+     return KHM_ERROR_SUCCESS;
+ }
+ 
+ khm_int32 KHMAPI 
+ afs_msg_act(khm_int32 msg_subtype, 
+             khm_ui_4 uparam, 
+             void * vparam)
+ {
+     khm_int32 rv = KHM_ERROR_SUCCESS;
+ 
+     if (msg_subtype == KMSG_ACT_ACTIVATE &&
+         uparam == action_id_afs_help) {
+ 
+         khui_request_UI_callback(help_launcher, NULL);
+ 
+     }
+ 
+     return rv;
+ }
Index: openafs/src/WINNT/netidmgr_plugin/langres.h
diff -c openafs/src/WINNT/netidmgr_plugin/langres.h:1.1.2.2 openafs/src/WINNT/netidmgr_plugin/langres.h:1.1.2.3
*** openafs/src/WINNT/netidmgr_plugin/langres.h:1.1.2.2	Thu Oct 12 17:19:43 2006
--- openafs/src/WINNT/netidmgr_plugin/langres.h	Thu Feb 15 16:52:24 2007
***************
*** 1,6 ****
  //{{NO_DEPENDENCIES}}
  // Microsoft Visual C++ generated include file.
! // Used by C:\work\pismere\athena\auth\krb5\src\windows\identity\plugins\afs\lang\en_us\langres.rc
  //
  #define IDS_AFS_SHORT_DESC              101
  #define IDS_AFS_LONG_DESC               102
--- 1,6 ----
  //{{NO_DEPENDENCIES}}
  // Microsoft Visual C++ generated include file.
! // Used by C:\work\openafs.1.5\src\Winnt\netidmgr_plugin\lang\en_us\langres.rc
  //
  #define IDS_AFS_SHORT_DESC              101
  #define IDS_AFS_LONG_DESC               102
***************
*** 66,71 ****
--- 66,73 ----
  #define IDS_ERR_NOSERVICE               152
  #define IDS_ERR_CELLCONFIG_S            153
  #define IDS_ERR_GENERAL                 154
+ #define IDS_ACTION_AFS_HELP             155
+ #define IDS_ACTION_AFS_HELP_TT          156
  #define IDC_NCAFS_OBTAIN                1001
  #define IDC_NCAFS_TOKENLIST             1002
  #define IDC_NCAFS_CELL                  1004
Index: openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc
diff -c openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc:1.1.2.4 openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc:1.1.2.5
*** openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc:1.1.2.4	Mon Feb 12 22:49:27 2007
--- openafs/src/WINNT/netidmgr_plugin/lang/en_us/langres.rc	Thu Feb 15 16:52:25 2007
***************
*** 254,259 ****
--- 254,261 ----
      IDS_ERR_NOSERVICE       "The AFS service is not running.  If OpenAFS is installed, you can start the service using the AFS configuration panel."
      IDS_ERR_CELLCONFIG_S    "The error code returned was %2!d!."
      IDS_ERR_GENERAL         "Credentials could not be obtained for cell %1!S!."
+     IDS_ACTION_AFS_HELP     "Help for OpenAFS plug-in"
+     IDS_ACTION_AFS_HELP_TT  "Display documentation for the OpenAFS plug-in"
  END
  
  #endif    // English (U.S.) resources
Index: openafs/src/afs/afs_conn.c
diff -c openafs/src/afs/afs_conn.c:1.14 openafs/src/afs/afs_conn.c:1.14.8.1
*** openafs/src/afs/afs_conn.c:1.14	Wed Dec  1 18:38:56 2004
--- openafs/src/afs/afs_conn.c	Mon Feb 26 17:14:58 2007
***************
*** 14,20 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_conn.c,v 1.14 2004/12/01 23:38:56 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_conn.c,v 1.14.8.1 2007/02/26 22:14:58 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 339,352 ****
      if (!sap)
  	return;			/* defensive check */
  
-     /* if client is not multihomed, do nothing */
-     ObtainReadLock(&afs_xinterface);
-     if (afs_cb_interface.numberOfInterfaces <= 1) {
- 	ReleaseReadLock(&afs_xinterface);
- 	return;
-     }
-     ReleaseReadLock(&afs_xinterface);
- 
      ObtainWriteLock(&afs_xconn, 413);
      for (tc = sap->conns; tc; tc = tc->next)
  	tc->forceConnectFS = 1;
--- 339,344 ----
Index: openafs/src/afs/afs_util.c
diff -c openafs/src/afs/afs_util.c:1.28.2.4 openafs/src/afs/afs_util.c:1.28.2.5
*** openafs/src/afs/afs_util.c:1.28.2.4	Thu Jan  4 11:05:30 2007
--- openafs/src/afs/afs_util.c	Thu Feb 22 19:44:08 2007
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_util.c,v 1.28.2.4 2007/01/04 16:05:30 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/afs_util.c,v 1.28.2.5 2007/02/23 00:44:08 shadow Exp $");
  
  #include "afs/stds.h"
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
***************
*** 662,669 ****
  	ino ^= (ino ^ vnode) & 1;
      } else {
  	ino = (volume << 16) + vnode;
- 	ino &= 0x7fffffff;      /* Assumes 32 bit ino_t ..... */
      }
      return ino;
  }
  
--- 662,669 ----
  	ino ^= (ino ^ vnode) & 1;
      } else {
  	ino = (volume << 16) + vnode;
      }
+     ino &= 0x7fffffff;      /* Assumes 32 bit ino_t ..... */
      return ino;
  }
  
Index: openafs/src/afs/DARWIN/osi_vnodeops.c
diff -c openafs/src/afs/DARWIN/osi_vnodeops.c:1.41 openafs/src/afs/DARWIN/osi_vnodeops.c:1.41.2.1
*** openafs/src/afs/DARWIN/osi_vnodeops.c:1.41	Thu Mar  2 01:35:59 2006
--- openafs/src/afs/DARWIN/osi_vnodeops.c	Wed Feb 14 19:28:26 2007
***************
*** 5,11 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.41 2006/03/02 06:35:59 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
--- 5,11 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.41.2.1 2007/02/15 00:28:26 shadow Exp $");
  
  #include <afs/sysincludes.h>	/* Standard vendor system headers */
  #include <afsincludes.h>	/* Afs-based standard headers */
***************
*** 354,359 ****
--- 354,360 ----
      }
  #ifdef AFS_DARWIN80_ENV
      if ((error=afs_darwin_finalizevnode(vcp, ap->a_dvp, ap->a_cnp, 0))) {
+ 	DROPNAME();
  	*ap->a_vpp = 0;
  	return error;
      }
***************
*** 438,445 ****
      if (vcp) {
  #ifdef AFS_DARWIN80_ENV
          if ((error=afs_darwin_finalizevnode(vcp, ap->a_dvp, ap->a_cnp, 0))) {
!              *ap->a_vpp=0;
!              return error;
          }
  #endif
  	*ap->a_vpp = AFSTOV(vcp);
--- 439,447 ----
      if (vcp) {
  #ifdef AFS_DARWIN80_ENV
          if ((error=afs_darwin_finalizevnode(vcp, ap->a_dvp, ap->a_cnp, 0))) {
! 	    DROPNAME();
! 	    *ap->a_vpp=0;
! 	    return error;
          }
  #endif
  	*ap->a_vpp = AFSTOV(vcp);
Index: openafs/src/afs/LINUX/osi_sysctl.c
diff -c openafs/src/afs/LINUX/osi_sysctl.c:1.9.2.1 openafs/src/afs/LINUX/osi_sysctl.c:1.9.2.2
*** openafs/src/afs/LINUX/osi_sysctl.c:1.9.2.1	Thu Nov  9 18:12:51 2006
--- openafs/src/afs/LINUX/osi_sysctl.c	Thu Feb 22 16:47:26 2007
***************
*** 1,7 ****
  /*
   * osi_sysctl.c: Linux sysctl interface to OpenAFS
   *
!  * $Id: osi_sysctl.c,v 1.9.2.1 2006/11/09 23:12:51 shadow Exp $
   *
   * Written Jan 30, 2002 by Kris Van Hees (Sine Nomine Associates)
   */
--- 1,7 ----
  /*
   * osi_sysctl.c: Linux sysctl interface to OpenAFS
   *
!  * $Id: osi_sysctl.c,v 1.9.2.2 2007/02/22 21:47:26 shadow Exp $
   *
   * Written Jan 30, 2002 by Kris Van Hees (Sine Nomine Associates)
   */
***************
*** 102,108 ****
--- 102,112 ----
  int
  osi_sysctl_init()
  {
+ #if defined(REGISTER_SYSCTL_TABLE_NOFLAG)
+     afs_sysctl = register_sysctl_table(fs_sysctl_table);
+ #else
      afs_sysctl = register_sysctl_table(fs_sysctl_table, 0);
+ #endif
      if (!afs_sysctl)
  	return -1;
  
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.11 openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.13
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.126.2.11	Thu Feb  8 20:36:35 2007
--- openafs/src/afs/LINUX/osi_vnodeops.c	Thu Feb 22 16:41:33 2007
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.126.2.11 2007/02/09 01:36:35 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.126.2.13 2007/02/22 21:41:33 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 1025,1030 ****
--- 1025,1031 ----
  #if defined(AFS_LINUX26_ENV)
  		unlock_kernel();
  #endif
+ 		crfree(credp);
  		return alias;
  	    }
  	}
***************
*** 1126,1131 ****
--- 1127,1134 ----
              }
              tvc->uncred = credp;
  	    tvc->states |= CUnlinked;
+ 	} else {
+ 	    osi_FreeSmallSpace(__name);	
  	}
  	AFS_GUNLOCK();
  
Index: openafs/src/afs/VNOPS/afs_vnop_flock.c
diff -c openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.3 openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.4
*** openafs/src/afs/VNOPS/afs_vnop_flock.c:1.29.2.3	Mon Feb 12 20:34:38 2007
--- openafs/src/afs/VNOPS/afs_vnop_flock.c	Wed Feb 14 19:35:04 2007
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.29.2.3 2007/02/13 01:34:38 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_flock.c,v 1.29.2.4 2007/02/15 00:35:04 shadow Exp $");
  
  #include "afs/sysincludes.h"	/* Standard vendor system headers */
  #include "afsincludes.h"	/* Afs-based standard headers */
***************
*** 26,31 ****
--- 26,35 ----
  #include "afs/afs_osidnlc.h"
  #include "afs/unified_afs.h"
  
+ #ifndef OFFSET_MAX
+ #define OFFSET_MAX 0x7fffffffffffffff
+ #endif
+ 
  /* Static prototypes */
  static int HandleGetLock(register struct vcache *avc,
  			 register struct AFS_FLOCK *af,
***************
*** 549,555 ****
  #endif
      /* Java VMs ask for l_len=(long)-1 regardless of OS/CPU; bottom 32 bits
       * sometimes get masked off by OS */
!     if ((af->l_len >> 32) == 0x7fffffff)
  	af->l_len = 0;
      /* next line makes byte range locks always succeed,
       * even when they should block */
--- 553,559 ----
  #endif
      /* Java VMs ask for l_len=(long)-1 regardless of OS/CPU; bottom 32 bits
       * sometimes get masked off by OS */
!     if (af->l_len == OFFSET_MAX-1)
  	af->l_len = 0;
      /* next line makes byte range locks always succeed,
       * even when they should block */
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.29.2.20 openafs/src/cf/linux-test4.m4:1.29.2.22
*** openafs/src/cf/linux-test4.m4:1.29.2.20	Fri Feb  9 13:22:50 2007
--- openafs/src/cf/linux-test4.m4	Mon Feb 26 12:52:04 2007
***************
*** 6,11 ****
--- 6,12 ----
  #include <linux/sched.h>],
  [
  extern rwlock_t tasklist_lock __attribute__((weak)); 
+ read_lock(&tasklist_lock);
  ],
        ac_cv_linux_exports_tasklist_lock=yes,
        ac_cv_linux_exports_tasklist_lock=no)])
***************
*** 806,808 ****
--- 807,821 ----
        ac_cv_linux_fs_struct_fop_has_flock=yes,
        ac_cv_linux_fs_struct_fop_has_flock=no)])
    AC_MSG_RESULT($ac_cv_linux_fs_struct_fop_has_flock)])
+ 
+ AC_DEFUN([LINUX_REGISTER_SYSCTL_TABLE_NOFLAG], [
+   AC_MSG_CHECKING([whether register_sysctl_table has an insert_at_head flag argument])
+   AC_CACHE_VAL([ac_cv_linux_register_sysctl_table_noflag], [
+     AC_TRY_KBUILD(
+ [#include <linux/sysctl.h>],
+ [ctl_table *t;
+ register_sysctl_table (t);],
+       ac_cv_linux_register_sysctl_table_noflag=yes,
+       ac_cv_linux_register_sysctl_table_noflag=no)])
+   AC_MSG_RESULT($ac_cv_linux_register_sysctl_table_noflag)])
+ 
Index: openafs/src/config/NTMakefile
diff -c openafs/src/config/NTMakefile:1.20.2.1 openafs/src/config/NTMakefile:1.20.2.2
*** openafs/src/config/NTMakefile:1.20.2.1	Thu Oct 12 17:19:46 2006
--- openafs/src/config/NTMakefile	Thu Feb 15 13:14:08 2007
***************
*** 173,178 ****
--- 173,181 ----
  !	IF (!EXIST($(OJT)\rx\test))
  		$(MKDIR) $(OJT)\rx\test
  !	ENDIF
+ !	IF (!EXIST($(OJT)\rxdebug))
+ 		$(MKDIR) $(OJT)\rxdebug
+ !	ENDIF
  !	IF (!EXIST($(OJT)\rxgen))
  		$(MKDIR) $(OJT)\rxgen
  !	ENDIF
Index: openafs/src/config/NTMakefile.amd64_w2k
diff -c openafs/src/config/NTMakefile.amd64_w2k:1.24.2.18 openafs/src/config/NTMakefile.amd64_w2k:1.24.2.19
*** openafs/src/config/NTMakefile.amd64_w2k:1.24.2.18	Tue Feb 13 13:29:59 2007
--- openafs/src/config/NTMakefile.amd64_w2k	Thu Mar  8 19:46:12 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1600
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_nt40
diff -c openafs/src/config/NTMakefile.i386_nt40:1.84.2.18 openafs/src/config/NTMakefile.i386_nt40:1.84.2.19
*** openafs/src/config/NTMakefile.i386_nt40:1.84.2.18	Tue Feb 13 13:29:59 2007
--- openafs/src/config/NTMakefile.i386_nt40	Thu Mar  8 19:46:12 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1600
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/NTMakefile.i386_w2k
diff -c openafs/src/config/NTMakefile.i386_w2k:1.23.2.18 openafs/src/config/NTMakefile.i386_w2k:1.23.2.19
*** openafs/src/config/NTMakefile.i386_w2k:1.23.2.18	Tue Feb 13 13:29:59 2007
--- openafs/src/config/NTMakefile.i386_w2k	Thu Mar  8 19:46:12 2007
***************
*** 84,90 ****
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1500
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
--- 84,90 ----
  #define used in WinNT/2000 installation and program version display
  AFSPRODUCT_VER_MAJOR=1
  AFSPRODUCT_VER_MINOR=5
! AFSPRODUCT_VER_PATCH=1600
  AFSPRODUCT_VER_BUILD=0
  
  AFSPRODUCT_VERSION=$(AFSPRODUCT_VER_MAJOR).$(AFSPRODUCT_VER_MINOR).$(AFSPRODUCT_VER_PATCH)
Index: openafs/src/config/libafsdep
diff -c openafs/src/config/libafsdep:1.1.14.1 openafs/src/config/libafsdep:1.1.14.2
*** openafs/src/config/libafsdep:1.1.14.1	Mon Dec 18 23:20:10 2006
--- openafs/src/config/libafsdep	Wed Feb 14 18:56:32 2007
***************
*** 1,4 ****
  make_vnode.pl
  Makefile.config.in
! Makefile.version.in
  afsconfig.h.in
--- 1,4 ----
  make_vnode.pl
  Makefile.config.in
! Makefile.version-NOCML.in
  afsconfig.h.in
Index: openafs/src/libafs/afs.ppc_darwin_70.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.11 openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.12
*** openafs/src/libafs/afs.ppc_darwin_70.plist.in:1.2.10.11	Mon Feb 12 20:50:59 2007
--- openafs/src/libafs/afs.ppc_darwin_70.plist.in	Thu Mar  8 19:46:14 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.16</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.16</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kernel.bsd</key>
Index: openafs/src/libafs/afs.ppc_darwin_80.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.11 openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.12
*** openafs/src/libafs/afs.ppc_darwin_80.plist.in:1.2.4.11	Mon Feb 12 20:50:59 2007
--- openafs/src/libafs/afs.ppc_darwin_80.plist.in	Thu Mar  8 19:46:14 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.16</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.16</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/libafs/afs.ppc_darwin_90.plist.in
diff -c openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.11 openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.12
*** openafs/src/libafs/afs.ppc_darwin_90.plist.in:1.1.6.11	Mon Feb 12 20:50:59 2007
--- openafs/src/libafs/afs.ppc_darwin_90.plist.in	Thu Mar  8 19:46:14 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.16</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.16</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/libafs/afs.x86_darwin_80.plist.in
diff -c openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.11 openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.12
*** openafs/src/libafs/afs.x86_darwin_80.plist.in:1.1.6.11	Mon Feb 12 20:50:59 2007
--- openafs/src/libafs/afs.x86_darwin_80.plist.in	Thu Mar  8 19:46:14 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.16</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.16</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/libafs/afs.x86_darwin_90.plist.in
diff -c openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.11 openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.12
*** openafs/src/libafs/afs.x86_darwin_90.plist.in:1.1.6.11	Mon Feb 12 20:50:59 2007
--- openafs/src/libafs/afs.x86_darwin_90.plist.in	Thu Mar  8 19:46:14 2007
***************
*** 15,25 ****
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.15</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.15</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
--- 15,25 ----
  	<key>CFBundlePackageType</key>
  	<string>KEXT</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.16</string>
  	<key>CFBundleSignature</key>
  	<string>????</string>
  	<key>CFBundleVersion</key>
! 	<string>1.5.16</string>
  	<key>OSBundleLibraries</key>
  	<dict>
  		<key>com.apple.kpi.bsd</key>
Index: openafs/src/packaging/MacOS/OpenAFS.Info.plist
diff -c openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.12 openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.13
*** openafs/src/packaging/MacOS/OpenAFS.Info.plist:1.2.10.12	Mon Feb 12 20:51:01 2007
--- openafs/src/packaging/MacOS/OpenAFS.Info.plist	Thu Mar  8 19:46:15 2007
***************
*** 3,15 ****
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.5.15</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.15</string>
  	<key>IFMajorVersion</key>
  	<integer>1</integer>
  	<key>IFMinorVersion</key>
--- 3,15 ----
  <plist version="1.0">
  <dict>
  	<key>CFBundleGetInfoString</key>
! 	<string>OpenAFS 1.5.16</string>
  	<key>CFBundleIdentifier</key>
  	<string>org.openafs.OpenAFS.pkg</string>
  	<key>CFBundleName</key>
  	<string>OpenAFS</string>
  	<key>CFBundleShortVersionString</key>
! 	<string>1.5.16</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.12.11 openafs/src/packaging/MacOS/OpenAFS.info:1.1.12.12
*** openafs/src/packaging/MacOS/OpenAFS.info:1.1.12.11	Mon Feb 12 20:51:01 2007
--- openafs/src/packaging/MacOS/OpenAFS.info	Thu Mar  8 19:46:15 2007
***************
*** 1,5 ****
  Title OpenAFS
! Version 1.5.15
  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.5.16
  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/NTMakefile
diff -c openafs/src/rx/NTMakefile:1.9 openafs/src/rx/NTMakefile:1.9.4.1
*** openafs/src/rx/NTMakefile:1.9	Sun Nov 20 20:57:20 2005
--- openafs/src/rx/NTMakefile	Thu Feb 15 13:14:08 2007
***************
*** 70,98 ****
  # Not yet
  #rxdumptrace.exe: rx_trace.c
  
! # build rxdebug.
! RXDEBUG = $(DESTDIR)\etc\rxdebug.exe
! RXDOBJS = $(OUT)\rxdebug.obj \
! 	  $(OUT)\rxdebug.res
! 
! LIBDIR  = $(DESTDIR)\lib
! RXDLIBS = $(LIBDIR)\afs\afscmd.lib \
! 	  $(LIBDIR)\afsrx.lib \
! 	  $(LIBDIR)\afslwp.lib \
! 	  $(LIBDIR)\afs\afsutil.lib \
!           $(LIBDIR)\afs\afsreg.lib
! 
! $(OUT)\rxdebug.res: rxdebug.rc $(VERSFILE).h
! 	$(RC) /Fo$*.RES $(*F).rc 
! 
! $(OUT)\rxdebug.obj: rxdebug.c
! 
! $(RXDEBUG): $(RXDOBJS) $(RXDLIBS)
! 	$(EXECONLINK) iphlpapi.lib
!         $(_VC_MANIFEST_EMBED_EXE)
! 	$(EXEPREP)
! 
! install: $(LIBFILE) $(INCFILES) $(RXDEBUG)
  
  install9x: $(LIBFILE) $(INCFILES)
  
--- 70,76 ----
  # Not yet
  #rxdumptrace.exe: rx_trace.c
  
! install: $(LIBFILE) $(INCFILES)
  
  install9x: $(LIBFILE) $(INCFILES)
  
Index: openafs/src/rx/rx.c
diff -c openafs/src/rx/rx.c:1.97.2.5 openafs/src/rx/rx.c:1.97.2.6
*** openafs/src/rx/rx.c:1.97.2.5	Sat Dec 16 20:23:30 2006
--- openafs/src/rx/rx.c	Thu Feb 15 12:11:29 2007
***************
*** 17,23 ****
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.5 2006/12/17 01:23:30 jaltman Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
--- 17,23 ----
  #endif
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/rx.c,v 1.97.2.6 2007/02/15 17:11:29 shadow Exp $");
  
  #ifdef KERNEL
  #include "afs/sysincludes.h"
***************
*** 6335,6351 ****
  	      void *outputData, size_t outputLength)
  {
      static afs_int32 counter = 100;
!     time_t endTime;
      struct rx_header theader;
      char tbuffer[1500];
      register afs_int32 code;
!     struct timeval tv;
      struct sockaddr_in taddr, faddr;
      int faddrLen;
      fd_set imask;
      register char *tp;
  
!     endTime = time(0) + 20;	/* try for 20 seconds */
      LOCK_RX_DEBUG;
      counter++;
      UNLOCK_RX_DEBUG;
--- 6335,6353 ----
  	      void *outputData, size_t outputLength)
  {
      static afs_int32 counter = 100;
!     time_t waitTime, waitCount, startTime, endTime;
      struct rx_header theader;
      char tbuffer[1500];
      register afs_int32 code;
!     struct timeval tv_now, tv_wake, tv_delta;
      struct sockaddr_in taddr, faddr;
      int faddrLen;
      fd_set imask;
      register char *tp;
  
!     startTime = time(0);
!     waitTime = 1;
!     waitCount = 5;
      LOCK_RX_DEBUG;
      counter++;
      UNLOCK_RX_DEBUG;
***************
*** 6374,6402 ****
  		   (struct sockaddr *)&taddr, sizeof(struct sockaddr_in));
  
  	/* see if there's a packet available */
! 	FD_ZERO(&imask);
! 	FD_SET(socket, &imask);
! 	tv.tv_sec = 1;
! 	tv.tv_usec = 0;
! 	code = select((int)(socket + 1), &imask, 0, 0, &tv);
! 	if (code == 1 && FD_ISSET(socket, &imask)) {
! 	    /* now receive a packet */
! 	    faddrLen = sizeof(struct sockaddr_in);
! 	    code =
! 		recvfrom(socket, tbuffer, sizeof(tbuffer), 0,
! 			 (struct sockaddr *)&faddr, &faddrLen);
! 
! 	    if (code > 0) {
! 		memcpy(&theader, tbuffer, sizeof(struct rx_header));
! 		if (counter == ntohl(theader.callNumber))
! 		    break;
  	    }
  	}
  
  	/* see if we've timed out */
! 	if (endTime < time(0))
! 	    return -1;
      }
      code -= sizeof(struct rx_header);
      if (code > outputLength)
  	code = outputLength;
--- 6376,6429 ----
  		   (struct sockaddr *)&taddr, sizeof(struct sockaddr_in));
  
  	/* see if there's a packet available */
! 	gettimeofday(&tv_wake,0);
! 	tv_wake.tv_sec += waitTime;
! 	for (;;) {
! 	    FD_ZERO(&imask);
! 	    FD_SET(socket, &imask);
! 	    tv_delta.tv_sec = tv_wake.tv_sec;
! 	    tv_delta.tv_usec = tv_wake.tv_usec;
! 	    gettimeofday(&tv_now, 0);
! 	    
! 	    if (tv_delta.tv_usec < tv_now.tv_usec) {
! 		/* borrow */
! 		tv_delta.tv_usec += 1000000;
! 		tv_delta.tv_sec--;
! 	    }
! 	    tv_delta.tv_usec -= tv_now.tv_usec;
! 	    
! 	    if (tv_delta.tv_sec < tv_now.tv_sec) {
! 		/* time expired */
! 		break;
  	    }
+ 	    tv_delta.tv_sec -= tv_now.tv_sec;
+ 	    
+ 	    code = select(socket + 1, &imask, 0, 0, &tv_delta);
+ 	    if (code == 1 && FD_ISSET(socket, &imask)) {
+ 		/* now receive a packet */
+ 		faddrLen = sizeof(struct sockaddr_in);
+ 		code =
+ 		    recvfrom(socket, tbuffer, sizeof(tbuffer), 0,
+ 			     (struct sockaddr *)&faddr, &faddrLen);
+ 		
+ 		if (code > 0) {
+ 		    memcpy(&theader, tbuffer, sizeof(struct rx_header));
+ 		    if (counter == ntohl(theader.callNumber))
+ 			goto success;
+ 		    continue;
+ 		}
+ 	    }
+ 	    break;
  	}
  
  	/* see if we've timed out */
! 	if (!--waitCount) {
!             return -1;
! 	}
! 	waitTime <<= 1;
      }
+     
+  success:
      code -= sizeof(struct rx_header);
      if (code > outputLength)
  	code = outputLength;
Index: openafs/src/rx/rxdebug.c
diff -c openafs/src/rx/rxdebug.c:1.22 openafs/src/rx/rxdebug.c:removed
*** openafs/src/rx/rxdebug.c:1.22	Sat Nov  5 01:48:18 2005
--- openafs/src/rx/rxdebug.c	Thu Mar  8 20:32:38 2007
***************
*** 1,619 ****
- /*
-  * 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
-  */
- 
- #include <afsconfig.h>
- #include <afs/param.h>
- 
- RCSID
-     ("$Header: /cvs/openafs/src/rx/Attic/rxdebug.c,v 1.22 2005/11/05 06:48:18 jaltman Exp $");
- 
- #include <sys/types.h>
- #include <errno.h>
- #ifdef AFS_NT40_ENV
- #include <winsock2.h>
- #else
- #include <sys/socket.h>
- #include <sys/file.h>
- #include <netdb.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
- #endif
- #ifdef HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
- #ifdef HAVE_STRING_H
- #include <string.h>
- #else
- #ifdef HAVE_STRINGS_H
- #include <strings.h>
- #endif
- #endif
- #include <sys/stat.h>
- #include <afs/stds.h>
- #include <afs/cmd.h>
- 
- #include <stdio.h>
- 
- #include "rx_user.h"
- #include "rx_clock.h"
- #include "rx_queue.h"
- #include "rx.h"
- #include "rx_globals.h"
- 
- 
- #define	TIMEOUT	    20
- 
- static short
- PortNumber(aport)
-      register char *aport;
- {
-     register int tc;
-     register short total;
- 
-     total = 0;
-     while (tc = *aport++) {
- 	if (tc < '0' || tc > '9')
- 	    return -1;		/* bad port number */
- 	total *= 10;
- 	total += tc - (int)'0';
-     }
-     return htons(total);
- }
- 
- static short
- PortName(aname)
-      register char *aname;
- {
-     register struct servent *ts;
-     ts = getservbyname(aname, NULL);
-     if (!ts)
- 	return -1;
-     return ts->s_port;		/* returns it in network byte order */
- }
- 
- int
- MainCommand(as, arock)
-      char *arock;
-      struct cmd_syndesc *as;
- {
-     register int i;
-     osi_socket s;
-     int j;
-     struct sockaddr_in taddr;
-     afs_int32 host;
-     struct in_addr hostAddr;
-     short port;
-     struct hostent *th;
-     register afs_int32 code;
-     int nodally;
-     int allconns;
-     int rxstats;
-     int onlyClient, onlyServer;
-     afs_int32 onlyHost;
-     short onlyPort;
-     int onlyAuth;
-     int flag;
-     int dallyCounter;
-     int withSecStats;
-     int withAllConn;
-     int withRxStats;
-     int withWaiters;
-     int withIdleThreads;
-     int withWaited;
-     int withPeers;
-     struct rx_debugStats tstats;
-     char *portName, *hostName;
-     char hoststr[20];
-     struct rx_debugConn tconn;
-     short noConns;
-     short showPeers;
-     int version_flag;
-     char version[64];
-     afs_int32 length = 64;
- 
-     afs_uint32 supportedDebugValues = 0;
-     afs_uint32 supportedStatValues = 0;
-     afs_uint32 supportedConnValues = 0;
-     afs_uint32 supportedPeerValues = 0;
-     afs_int32 nextconn = 0;
-     afs_int32 nextpeer = 0;
- 
-     nodally = (as->parms[2].items ? 1 : 0);
-     allconns = (as->parms[3].items ? 1 : 0);
-     rxstats = (as->parms[4].items ? 1 : 0);
-     onlyServer = (as->parms[5].items ? 1 : 0);
-     onlyClient = (as->parms[6].items ? 1 : 0);
-     version_flag = (as->parms[10].items ? 1 : 0);
-     noConns = (as->parms[11].items ? 1 : 0);
-     showPeers = (as->parms[12].items ? 1 : 0);
- 
-     if (as->parms[0].items)
- 	hostName = as->parms[0].items->data;
-     else
- 	hostName = NULL;
- 
-     if (as->parms[1].items)
- 	portName = as->parms[1].items->data;
-     else
- 	portName = NULL;
- 
-     if (as->parms[7].items) {
- 	char *name = as->parms[7].items->data;
- 	if ((onlyPort = PortNumber(name)) == -1)
- 	    onlyPort = PortName(name);
- 	if (onlyPort == -1) {
- 	    printf("rxdebug: can't resolve port name %s\n", name);
- 	    exit(1);
- 	}
-     } else
- 	onlyPort = -1;
- 
-     if (as->parms[8].items) {
- 	char *name = as->parms[8].items->data;
- 	struct hostent *th;
- 	th = hostutil_GetHostByName(name);
- 	if (!th) {
- 	    printf("rxdebug: host %s not found in host table\n", name);
- 	    exit(1);
- 	}
- 	memcpy(&onlyHost, th->h_addr, sizeof(afs_int32));
-     } else
- 	onlyHost = -1;
- 
-     if (as->parms[9].items) {
- 	char *name = as->parms[9].items->data;
- 	if (strcmp(name, "clear") == 0)
- 	    onlyAuth = 0;
- 	else if (strcmp(name, "auth") == 0)
- 	    onlyAuth = 1;
- 	else if (strcmp(name, "crypt") == 0)
- 	    onlyAuth = 2;
- 	else if ((strcmp(name, "null") == 0) || (strcmp(name, "none") == 0)
- 		 || (strncmp(name, "noauth", 6) == 0)
- 		 || (strncmp(name, "unauth", 6) == 0))
- 	    onlyAuth = -1;
- 	else {
- 	    fprintf(stderr, "Unknown authentication level: %s\n", name);
- 	    exit(1);
- 	}
-     } else
- 	onlyAuth = 999;
- 
-     /* lookup host */
-     if (hostName) {
- 	th = hostutil_GetHostByName(hostName);
- 	if (!th) {
- 	    printf("rxdebug: host %s not found in host table\n", hostName);
- 	    exit(1);
- 	}
- 	memcpy(&host, th->h_addr, sizeof(afs_int32));
-     } else
- 	host = htonl(0x7f000001);	/* IP localhost */
- 
-     if (!portName)
- 	port = htons(7000);	/* default is fileserver */
-     else {
- 	if ((port = PortNumber(portName)) == -1)
- 	    port = PortName(portName);
- 	if (port == -1) {
- 	    printf("rxdebug: can't resolve port name %s\n", portName);
- 	    exit(1);
- 	}
-     }
- 
-     dallyCounter = 0;
- 
-     hostAddr.s_addr = host;
-     afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
-     printf("Trying %s (port %d):\n", hoststr, ntohs(port));
-     s = socket(AF_INET, SOCK_DGRAM, 0);
-     taddr.sin_family = AF_INET;
-     taddr.sin_port = 0;
-     taddr.sin_addr.s_addr = 0;
- #ifdef STRUCT_SOCKADDR_HAS_SA_LEN
-     taddr.sin_len = sizeof(struct sockaddr_in);
- #endif
-     code = bind(s, (struct sockaddr *)&taddr, sizeof(struct sockaddr_in));
-     if (code) {
- 	perror("bind");
- 	exit(1);
-     }
- 
-     if (version_flag) {
- 
- 	code = rx_GetServerVersion(s, host, port, length, version);
- 	if (code < 0) {
- 	    printf("get version call failed with code %d, errno %d\n", code,
- 		   errno);
- 	    exit(1);
- 	}
- 	printf("AFS version: %s\n", version);
- 	fflush(stdout);
- 
- 	exit(0);
- 
-     }
- 
- 
-     code = rx_GetServerDebug(s, host, port, &tstats, &supportedDebugValues);
-     if (code < 0) {
- 	printf("getstats call failed with code %d\n", code);
- 	exit(1);
-     }
- 
-     withSecStats = (supportedDebugValues & RX_SERVER_DEBUG_SEC_STATS);
-     withAllConn = (supportedDebugValues & RX_SERVER_DEBUG_ALL_CONN);
-     withRxStats = (supportedDebugValues & RX_SERVER_DEBUG_RX_STATS);
-     withWaiters = (supportedDebugValues & RX_SERVER_DEBUG_WAITER_CNT);
-     withIdleThreads = (supportedDebugValues & RX_SERVER_DEBUG_IDLE_THREADS);
-     withWaited = (supportedDebugValues & RX_SERVER_DEBUG_WAITED_CNT);
-     withPeers = (supportedDebugValues & RX_SERVER_DEBUG_ALL_PEER);
- 
-     printf("Free packets: %d, packet reclaims: %d, calls: %d, used FDs: %d\n",
- 	   tstats.nFreePackets, tstats.packetReclaims, tstats.callsExecuted,
- 	   tstats.usedFDs);
-     if (!tstats.waitingForPackets)
- 	printf("not ");
-     printf("waiting for packets.\n");
-     if (withWaiters)
- 	printf("%d calls waiting for a thread\n", tstats.nWaiting);
-     if (withIdleThreads)
- 	printf("%d threads are idle\n", tstats.idleThreads);
-     if (withWaited)
- 	printf("%d calls have waited for a thread\n", tstats.nWaited);
- 
-     if (rxstats) {
- 	if (!withRxStats) {
- 	  noRxStats:
- 	    withRxStats = 0;
- 	    fprintf(stderr,
- 		    "WARNING: Server doesn't support retrieval of Rx statistics\n");
- 	} else {
- 	    struct rx_stats rxstats;
- 
- 	    /* should gracefully handle the case where rx_stats grows */
- 	    code =
- 		rx_GetServerStats(s, host, port, &rxstats,
- 				  &supportedStatValues);
- 	    if (code < 0) {
- 		printf("rxstats call failed with code %d\n", code);
- 		exit(1);
- 	    }
- 	    if (code != sizeof(rxstats)) {
- 		if ((((struct rx_debugIn *)(&rxstats))->type ==
- 		     RX_DEBUGI_BADTYPE))
- 		    goto noRxStats;
- 		printf
- 		    ("WARNING: returned Rx statistics of unexpected size (got %d)\n",
- 		     code);
- 		/* handle other versions?... */
- 	    }
- 
- 	    rx_PrintTheseStats(stdout, &rxstats, sizeof(rxstats),
- 			       tstats.nFreePackets, tstats.version);
- 	}
-     }
- 
-     if (!noConns) {
- 	if (allconns) {
- 	    if (!withAllConn)
- 		fprintf(stderr,
- 			"WARNING: Server doesn't support retrieval of all connections,\n         getting only interesting instead.\n");
- 	}
- 
- 	if (onlyServer)
- 	    printf("Showing only server connections\n");
- 	if (onlyClient)
- 	    printf("Showing only client connections\n");
- 	if (onlyAuth != 999) {
- 	    static char *name[] =
- 		{ "unauthenticated", "rxkad_clear", "rxkad_auth",
- 		"rxkad_crypt"
- 	    };
- 	    printf("Showing only %s connections\n", name[onlyAuth + 1]);
- 	}
- 	if (onlyHost != -1) {
- 	    hostAddr.s_addr = onlyHost;
- 	    afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
- 	    printf("Showing only connections from host %s\n",
- 		   hoststr);
- 	}
- 	if (onlyPort != -1)
- 	    printf("Showing only connections on port %u\n", ntohs(onlyPort));
- 
- 	for (i = 0;; i++) {
- 	    code =
- 		rx_GetServerConnections(s, host, port, &nextconn, allconns,
- 					supportedDebugValues, &tconn,
- 					&supportedConnValues);
- 	    if (code < 0) {
- 		printf("getconn call failed with code %d\n", code);
- 		break;
- 	    }
- 	    if (tconn.cid == (afs_int32) 0xffffffff) {
- 		printf("Done.\n");
- 		break;
- 	    }
- 
- 	    /* see if we're in nodally mode and all calls are dallying */
- 	    if (nodally) {
- 		flag = 0;
- 		for (j = 0; j < RX_MAXCALLS; j++) {
- 		    if (tconn.callState[j] != RX_STATE_NOTINIT
- 			&& tconn.callState[j] != RX_STATE_DALLY) {
- 			flag = 1;
- 			break;
- 		    }
- 		}
- 		if (flag == 0) {
- 		    /* this call looks too ordinary, bump skipped count and go
- 		     * around again */
- 		    dallyCounter++;
- 		    continue;
- 		}
- 	    }
- 	    if ((onlyHost != -1) && (onlyHost != tconn.host))
- 		continue;
- 	    if ((onlyPort != -1) && (onlyPort != tconn.port))
- 		continue;
- 	    if (onlyServer && (tconn.type != RX_SERVER_CONNECTION))
- 		continue;
- 	    if (onlyClient && (tconn.type != RX_CLIENT_CONNECTION))
- 		continue;
- 	    if (onlyAuth != 999) {
- 		if (onlyAuth == -1) {
- 		    if (tconn.securityIndex != 0)
- 			continue;
- 		} else {
- 		    if (tconn.securityIndex != 2)
- 			continue;
- 		    if (withSecStats && (tconn.secStats.type == 3)
- 			&& (tconn.secStats.level != onlyAuth))
- 			continue;
- 		}
- 	    }
- 
- 	    /* now display the connection */
- 	    hostAddr.s_addr = tconn.host;
- 	    afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
- 	    printf("Connection from host %s, port %hu, ", hoststr,
- 		   ntohs(tconn.port));
- 	    if (tconn.epoch)
- 		printf("Cuid %x/%x", tconn.epoch, tconn.cid);
- 	    else
- 		printf("cid %x", tconn.cid);
- 	    if (tconn.error)
- 		printf(", error %d", tconn.error);
- 	    printf("\n  serial %d, ", tconn.serial);
- 	    printf(" natMTU %d, ", tconn.natMTU);
- 
- 	    if (tconn.flags) {
- 		printf("flags");
- 		if (tconn.flags & RX_CONN_MAKECALL_WAITING)
- 		    printf(" MAKECALL_WAITING");
- 		if (tconn.flags & RX_CONN_DESTROY_ME)
- 		    printf(" DESTROYED");
- 		if (tconn.flags & RX_CONN_USING_PACKET_CKSUM)
- 		    printf(" pktCksum");
- 		printf(", ");
- 	    }
- 	    printf("security index %d, ", tconn.securityIndex);
- 	    if (tconn.type == RX_CLIENT_CONNECTION)
- 		printf("client conn\n");
- 	    else
- 		printf("server conn\n");
- 
- 	    if (withSecStats) {
- 		switch ((int)tconn.secStats.type) {
- 		case 0:
- 		    if (tconn.securityIndex == 2)
- 			printf
- 			    ("  no GetStats procedure for security object\n");
- 		    break;
- 		case 1:
- 		    printf("  rxnull level=%d, flags=%d\n",
- 			   tconn.secStats.level, tconn.secStats.flags);
- 		    break;
- 		case 2:
- 		    printf("  rxvab level=%d, flags=%d\n",
- 			   tconn.secStats.level, tconn.secStats.flags);
- 		    break;
- 		case 3:{
- 			char *level;
- 			char flags = tconn.secStats.flags;
- 			if (tconn.secStats.level == 0)
- 			    level = "clear";
- 			else if (tconn.secStats.level == 1)
- 			    level = "auth";
- 			else if (tconn.secStats.level == 2)
- 			    level = "crypt";
- 			else
- 			    level = "unknown";
- 			printf("  rxkad: level %s", level);
- 			if (flags)
- 			    printf(", flags");
- 			if (flags & 1)
- 			    printf(" unalloc");
- 			if (flags & 2)
- 			    printf(" authenticated");
- 			if (flags & 4)
- 			    printf(" expired");
- 			if (flags & 8)
- 			    printf(" pktCksum");
- 			if (tconn.secStats.expires)
- 			    /* Apparently due to a bug in the RT compiler that
- 			     * prevents (afs_uint32)0xffffffff => (double) from working,
- 			     * this code produces negative lifetimes when run on the
- 			     * RT. */
- 			    printf(", expires in %.1f hours",
- 				   ((afs_uint32) tconn.secStats.expires -
- 				    time(0)) / 3600.0);
- 			if (!(flags & 1)) {
- 			    printf("\n  Received %u bytes in %u packets\n",
- 				   tconn.secStats.bytesReceived,
- 				   tconn.secStats.packetsReceived);
- 			    printf("  Sent %u bytes in %u packets\n",
- 				   tconn.secStats.bytesSent,
- 				   tconn.secStats.packetsSent);
- 			} else
- 			    printf("\n");
- 			break;
- 		    }
- 
- 		default:
- 		    printf("  unknown\n");
- 		}
- 	    }
- 
- 	    for (j = 0; j < RX_MAXCALLS; j++) {
- 		printf("    call %d: # %d, state ", j, tconn.callNumber[j]);
- 		if (tconn.callState[j] == RX_STATE_NOTINIT) {
- 		    printf("not initialized\n");
- 		    continue;
- 		} else if (tconn.callState[j] == RX_STATE_PRECALL)
- 		    printf("precall, ");
- 		else if (tconn.callState[j] == RX_STATE_ACTIVE)
- 		    printf("active, ");
- 		else if (tconn.callState[j] == RX_STATE_DALLY)
- 		    printf("dally, ");
- 		else if (tconn.callState[j] == RX_STATE_HOLD)
- 		    printf("hold, ");
- 		printf("mode: ");
- 		if (tconn.callMode[j] == RX_MODE_SENDING)
- 		    printf("sending");
- 		else if (tconn.callMode[j] == RX_MODE_RECEIVING)
- 		    printf("receiving");
- 		else if (tconn.callMode[j] == RX_MODE_ERROR)
- 		    printf("error");
- 		else if (tconn.callMode[j] == RX_MODE_EOF)
- 		    printf("eof");
- 		else
- 		    printf("unknown");
- 		if (tconn.callFlags[j]) {
- 		    printf(", flags:");
- 		    if (tconn.callFlags[j] & RX_CALL_READER_WAIT)
- 			printf(" reader_wait");
- 		    if (tconn.callFlags[j] & RX_CALL_WAIT_WINDOW_ALLOC)
- 			printf(" window_alloc");
- 		    if (tconn.callFlags[j] & RX_CALL_WAIT_WINDOW_SEND)
- 			printf(" window_send");
- 		    if (tconn.callFlags[j] & RX_CALL_WAIT_PACKETS)
- 			printf(" wait_packets");
- 		    if (tconn.callFlags[j] & RX_CALL_WAIT_PROC)
- 			printf(" waiting_for_process");
- 		    if (tconn.callFlags[j] & RX_CALL_RECEIVE_DONE)
- 			printf(" receive_done");
- 		    if (tconn.callFlags[j] & RX_CALL_CLEARED)
- 			printf(" call_cleared");
- 		}
- 		if (tconn.callOther[j] & RX_OTHER_IN)
- 		    printf(", has_input_packets");
- 		if (tconn.callOther[j] & RX_OTHER_OUT)
- 		    printf(", has_output_packets");
- 		printf("\n");
- 	    }
- 	}
- 	if (nodally)
- 	    printf("Skipped %d dallying connections.\n", dallyCounter);
-     }
-     if (showPeers && withPeers) {
- 	for (i = 0;; i++) {
- 	    struct rx_debugPeer tpeer;
- 	    code =
- 		rx_GetServerPeers(s, host, port, &nextpeer, allconns, &tpeer,
- 				  &supportedPeerValues);
- 	    if (code < 0) {
- 		printf("getpeer call failed with code %d\n", code);
- 		break;
- 	    }
- 	    if (tpeer.host == 0xffffffff) {
- 		printf("Done.\n");
- 		break;
- 	    }
- 
- 	    if ((onlyHost != -1) && (onlyHost != tpeer.host))
- 		continue;
- 	    if ((onlyPort != -1) && (onlyPort != tpeer.port))
- 		continue;
- 
- 	    /* now display the peer */
- 	    hostAddr.s_addr = tpeer.host;
- 	    afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
- 	    printf("Peer at host %s, port %hu\n", hoststr, 
- 		   ntohs(tpeer.port));
- 	    printf("\tifMTU %hu\tnatMTU %hu\tmaxMTU %hu\n", tpeer.ifMTU,
- 		   tpeer.natMTU, tpeer.maxMTU);
- 	    printf("\tpackets sent %u\tpacket resends %u\n", tpeer.nSent,
- 		   tpeer.reSends);
- 	    printf("\tbytes sent high %u low %u\n", tpeer.bytesSent.high,
- 		   tpeer.bytesSent.low);
- 	    printf("\tbytes received high %u low %u\n",
- 		   tpeer.bytesReceived.high, tpeer.bytesReceived.low);
- 	    printf("\trtt %u msec, rtt_dev %u msec\n", tpeer.rtt >> 3,
- 		   tpeer.rtt_dev >> 2);
- 	    printf("\ttimeout %u.%03u sec\n", tpeer.timeout.sec,
- 		   tpeer.timeout.usec / 1000);
- 	}
-     }
-     exit(0);
- }
- 
- /* simple main program */
- #ifndef AFS_NT40_ENV
- #include "AFS_component_version_number.c"
- #endif
- int
- main(argc, argv)
-      int argc;
-      char **argv;
- {
-     struct cmd_syndesc *ts;
- 
- #ifdef RXDEBUG
-     rxi_DebugInit();
- #endif
- #ifdef AFS_NT40_ENV
-     if (afs_winsockInit() < 0) {
- 	printf("%s: Couldn't initialize winsock. Exiting...\n", argv[0]);
- 	return 1;
-     }
- #endif
- 
-     ts = cmd_CreateSyntax(NULL, MainCommand, 0, "probe RX server");
-     cmd_AddParm(ts, "-servers", CMD_SINGLE, CMD_REQUIRED, "server machine");
-     cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
-     cmd_AddParm(ts, "-nodally", CMD_FLAG, CMD_OPTIONAL,
- 		"don't show dallying conns");
-     cmd_AddParm(ts, "-allconnections", CMD_FLAG, CMD_OPTIONAL,
- 		"don't filter out uninteresting connections on server");
-     cmd_AddParm(ts, "-rxstats", CMD_FLAG, CMD_OPTIONAL, "show Rx statistics");
-     cmd_AddParm(ts, "-onlyserver", CMD_FLAG, CMD_OPTIONAL,
- 		"only show server conns");
-     cmd_AddParm(ts, "-onlyclient", CMD_FLAG, CMD_OPTIONAL,
- 		"only show client conns");
-     cmd_AddParm(ts, "-onlyport", CMD_SINGLE, CMD_OPTIONAL,
- 		"show only <port>");
-     cmd_AddParm(ts, "-onlyhost", CMD_SINGLE, CMD_OPTIONAL,
- 		"show only <host>");
-     cmd_AddParm(ts, "-onlyauth", CMD_SINGLE, CMD_OPTIONAL,
- 		"show only <auth level>");
- 
-     cmd_AddParm(ts, "-version", CMD_FLAG, CMD_OPTIONAL,
- 		"show AFS version id");
-     cmd_AddParm(ts, "-noconns", CMD_FLAG, CMD_OPTIONAL,
- 		"show no connections");
-     cmd_AddParm(ts, "-peers", CMD_FLAG, CMD_OPTIONAL, "show peers");
- 
-     cmd_Dispatch(argc, argv);
-     exit(0);
- }
--- 0 ----
Index: openafs/src/rx/rxdebug.rc
diff -c openafs/src/rx/rxdebug.rc:1.4 openafs/src/rx/rxdebug.rc:removed
*** openafs/src/rx/rxdebug.rc:1.4	Sat Nov 22 23:53:37 2003
--- openafs/src/rx/rxdebug.rc	Thu Mar  8 20:32:38 2007
***************
*** 1,17 ****
- /*
-  * Copyright 2000, International Business Machines Corporation and others.
-  * All Rights Reserved.
-  * 
-  * This software has been released under the terms of the IBM Public
-  * License.  For details, see the LICENSE file in the top-level source
-  * directory or online at http://www.openafs.org/dl/license10.html
-  */
- 
- /* Define VERSIONINFO resource */
- 
- #define  AFS_VERINFO_FILE_DESCRIPTION "AFS Rx RPC Diagnostic Command"
- #define  AFS_VERINFO_NAME "rxdebug"
- #define  AFS_VERINFO_FILENAME "rxdebug.exe"
- 
- #include "RX_component_version_number.h"
- #include "..\config\NTVersioninfo.rc"
--- 0 ----
Index: openafs/src/rx/LINUX/rx_knet.c
diff -c openafs/src/rx/LINUX/rx_knet.c:1.32.2.2 openafs/src/rx/LINUX/rx_knet.c:1.32.2.3
*** openafs/src/rx/LINUX/rx_knet.c:1.32.2.2	Thu Dec 28 16:30:29 2006
--- openafs/src/rx/LINUX/rx_knet.c	Mon Feb 26 12:57:40 2007
***************
*** 16,22 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.32.2.2 2006/12/28 21:30:29 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
--- 16,22 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.32.2.3 2007/02/26 17:57:40 shadow Exp $");
  
  #include <linux/version.h>
  #ifdef AFS_LINUX22_ENV
***************
*** 204,227 ****
--- 204,237 ----
  
      return code;
  }
+ #ifdef EXPORTED_TASKLIST_LOCK
  extern rwlock_t tasklist_lock __attribute__((weak));
+ #endif
  void
  osi_StopListener(void)
  {
      struct task_struct *listener;
      extern int rxk_ListenerPid;
  
+ #ifdef EXPORTED_TASKLIST_LOCK
      if (&tasklist_lock)
        read_lock(&tasklist_lock);
+ #endif
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+ #ifdef EXPORTED_TASKLIST_LOCK
      else
+ #endif
        rcu_read_lock();
  #endif
      listener = find_task_by_pid(rxk_ListenerPid);
+ #ifdef EXPORTED_TASKLIST_LOCK
      if (&tasklist_lock)
         read_unlock(&tasklist_lock);
+ #endif
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+ #ifdef EXPORTED_TASKLIST_LOCK
      else
+ #endif
        rcu_read_unlock();
  #endif
      while (rxk_ListenerPid) {
Index: openafs/src/rxdebug/NTMakefile
diff -c /dev/null openafs/src/rxdebug/NTMakefile:1.1.2.2
*** /dev/null	Thu Mar  8 20:32:38 2007
--- openafs/src/rxdebug/NTMakefile	Thu Feb 15 13:14:09 2007
***************
*** 0 ****
--- 1,45 ----
+ # 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
+ 
+ RELDIR=rxdebug
+ !include ..\config\NTMakefile.$(SYS_NAME)
+ 
+ !include ..\config\NTMakefile.version
+ 
+ # Additional debugging flag for RX.
+ AFSDEV_AUXCDEFINES = -DRXDEBUG
+ 
+ # build rxdebug.
+ RXDEBUG = $(DESTDIR)\etc\rxdebug.exe
+ RXDOBJS = $(OUT)\rxdebug.obj \
+ 	  $(OUT)\AFS_component_version_number.obj \
+ 	  $(OUT)\rxdebug.res
+ 
+ LIBDIR  = $(DESTDIR)\lib
+ RXDLIBS = $(LIBDIR)\afs\afscmd.lib \
+ 	  $(LIBDIR)\afsrx.lib \
+ 	  $(LIBDIR)\afslwp.lib \
+ 	  $(LIBDIR)\afs\afsutil.lib \
+           $(LIBDIR)\afs\afsreg.lib
+ 
+ $(OUT)\rxdebug.res: rxdebug.rc $(VERSFILE).h
+ 	$(RC) /Fo$*.RES $(*F).rc 
+ 
+ $(OUT)\rxdebug.obj: rxdebug.c
+ 
+ $(RXDEBUG): $(RXDOBJS) $(RXDLIBS)
+ 	$(EXECONLINK) iphlpapi.lib
+         $(_VC_MANIFEST_EMBED_EXE)
+ 	$(EXEPREP)
+ 
+ install: $(RXDEBUG)
+ 
+ clean::
+ 	$(DEL) $(RXDOBJS) $(RXDEBUG)
+ 
+ mkdir:
+ 	
Index: openafs/src/rxdebug/rxdebug.c
diff -c openafs/src/rxdebug/rxdebug.c:1.6 openafs/src/rxdebug/rxdebug.c:1.6.8.1
*** openafs/src/rxdebug/rxdebug.c:1.6	Tue Dec  7 00:07:06 2004
--- openafs/src/rxdebug/rxdebug.c	Thu Feb 15 13:14:09 2007
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxdebug/rxdebug.c,v 1.6 2004/12/07 05:07:06 shadow Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/rxdebug/rxdebug.c,v 1.6.8.1 2007/02/15 18:14:09 jaltman Exp $");
  
  #include <sys/types.h>
  #include <errno.h>
***************
*** 90,96 ****
       struct cmd_syndesc *as;
  {
      register int i;
!     int s;
      int j;
      struct sockaddr_in taddr;
      afs_int32 host;
--- 90,96 ----
       struct cmd_syndesc *as;
  {
      register int i;
!     osi_socket s;
      int j;
      struct sockaddr_in taddr;
      afs_int32 host;
***************
*** 112,120 ****
--- 112,122 ----
      int withRxStats;
      int withWaiters;
      int withIdleThreads;
+     int withWaited;
      int withPeers;
      struct rx_debugStats tstats;
      char *portName, *hostName;
+     char hoststr[20];
      struct rx_debugConn tconn;
      short noConns;
      short showPeers;
***************
*** 217,223 ****
      dallyCounter = 0;
  
      hostAddr.s_addr = host;
!     printf("Trying %s (port %d):\n", inet_ntoa(hostAddr), ntohs(port));
      s = socket(AF_INET, SOCK_DGRAM, 0);
      taddr.sin_family = AF_INET;
      taddr.sin_port = 0;
--- 219,226 ----
      dallyCounter = 0;
  
      hostAddr.s_addr = host;
!     afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
!     printf("Trying %s (port %d):\n", hoststr, ntohs(port));
      s = socket(AF_INET, SOCK_DGRAM, 0);
      taddr.sin_family = AF_INET;
      taddr.sin_port = 0;
***************
*** 258,263 ****
--- 261,267 ----
      withRxStats = (supportedDebugValues & RX_SERVER_DEBUG_RX_STATS);
      withWaiters = (supportedDebugValues & RX_SERVER_DEBUG_WAITER_CNT);
      withIdleThreads = (supportedDebugValues & RX_SERVER_DEBUG_IDLE_THREADS);
+     withWaited = (supportedDebugValues & RX_SERVER_DEBUG_WAITED_CNT);
      withPeers = (supportedDebugValues & RX_SERVER_DEBUG_ALL_PEER);
  
      printf("Free packets: %d, packet reclaims: %d, calls: %d, used FDs: %d\n",
***************
*** 270,275 ****
--- 274,281 ----
  	printf("%d calls waiting for a thread\n", tstats.nWaiting);
      if (withIdleThreads)
  	printf("%d threads are idle\n", tstats.idleThreads);
+     if (withWaited)
+ 	printf("%d calls have waited for a thread\n", tstats.nWaited);
  
      if (rxstats) {
  	if (!withRxStats) {
***************
*** 323,330 ****
  	}
  	if (onlyHost != -1) {
  	    hostAddr.s_addr = onlyHost;
  	    printf("Showing only connections from host %s\n",
! 		   inet_ntoa(hostAddr));
  	}
  	if (onlyPort != -1)
  	    printf("Showing only connections on port %u\n", ntohs(onlyPort));
--- 329,337 ----
  	}
  	if (onlyHost != -1) {
  	    hostAddr.s_addr = onlyHost;
+ 	    afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
  	    printf("Showing only connections from host %s\n",
! 		   hoststr);
  	}
  	if (onlyPort != -1)
  	    printf("Showing only connections on port %u\n", ntohs(onlyPort));
***************
*** 338,344 ****
  		printf("getconn call failed with code %d\n", code);
  		break;
  	    }
! 	    if (tconn.cid == 0xffffffff) {
  		printf("Done.\n");
  		break;
  	    }
--- 345,351 ----
  		printf("getconn call failed with code %d\n", code);
  		break;
  	    }
! 	    if (tconn.cid == (afs_int32) 0xffffffff) {
  		printf("Done.\n");
  		break;
  	    }
***************
*** 383,389 ****
  
  	    /* now display the connection */
  	    hostAddr.s_addr = tconn.host;
! 	    printf("Connection from host %s, port %hu, ", inet_ntoa(hostAddr),
  		   ntohs(tconn.port));
  	    if (tconn.epoch)
  		printf("Cuid %x/%x", tconn.epoch, tconn.cid);
--- 390,397 ----
  
  	    /* now display the connection */
  	    hostAddr.s_addr = tconn.host;
! 	    afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
! 	    printf("Connection from host %s, port %hu, ", hoststr,
  		   ntohs(tconn.port));
  	    if (tconn.epoch)
  		printf("Cuid %x/%x", tconn.epoch, tconn.cid);
***************
*** 456,465 ****
  				   ((afs_uint32) tconn.secStats.expires -
  				    time(0)) / 3600.0);
  			if (!(flags & 1)) {
! 			    printf("\n  Received %d bytes in %d packets\n",
  				   tconn.secStats.bytesReceived,
  				   tconn.secStats.packetsReceived);
! 			    printf("  Sent %d bytes in %d packets\n",
  				   tconn.secStats.bytesSent,
  				   tconn.secStats.packetsSent);
  			} else
--- 464,473 ----
  				   ((afs_uint32) tconn.secStats.expires -
  				    time(0)) / 3600.0);
  			if (!(flags & 1)) {
! 			    printf("\n  Received %u bytes in %u packets\n",
  				   tconn.secStats.bytesReceived,
  				   tconn.secStats.packetsReceived);
! 			    printf("  Sent %u bytes in %u packets\n",
  				   tconn.secStats.bytesSent,
  				   tconn.secStats.packetsSent);
  			} else
***************
*** 545,569 ****
  
  	    /* now display the peer */
  	    hostAddr.s_addr = tpeer.host;
! 	    printf("Peer at host %s, port %hu\n", inet_ntoa(hostAddr),
  		   ntohs(tpeer.port));
  	    printf("\tifMTU %hu\tnatMTU %hu\tmaxMTU %hu\n", tpeer.ifMTU,
  		   tpeer.natMTU, tpeer.maxMTU);
! 	    printf("\tpackets sent %d\tpacket resends %d\n", tpeer.nSent,
  		   tpeer.reSends);
! 	    printf("\tbytes sent high %d low %d\n", tpeer.bytesSent.high,
  		   tpeer.bytesSent.low);
! 	    printf("\tbytes received high %d low %d\n",
  		   tpeer.bytesReceived.high, tpeer.bytesReceived.low);
! 	    printf("\trtt %d msec, rtt_dev %d msec\n", tpeer.rtt >> 3,
  		   tpeer.rtt_dev >> 2);
! 	    printf("\ttimeout %d.%03d sec\n", tpeer.timeout.sec,
  		   tpeer.timeout.usec / 1000);
  	    if (!showLong)
  		continue;
  
  	    printf("\tin/out packet skew: %d/%d\n", tpeer.inPacketSkew,
! 		   tpeer.outPacketSkew);
  	    printf("\tcongestion window %d, MTU %d\n", tpeer.cwind,
  		   tpeer.MTU);
  	    printf("\tcurrent/if/max jumbogram size: %d/%d/%d\n",
--- 553,578 ----
  
  	    /* now display the peer */
  	    hostAddr.s_addr = tpeer.host;
! 	    afs_inet_ntoa_r(hostAddr.s_addr, hoststr);
! 	    printf("Peer at host %s, port %hu\n", hoststr, 
  		   ntohs(tpeer.port));
  	    printf("\tifMTU %hu\tnatMTU %hu\tmaxMTU %hu\n", tpeer.ifMTU,
  		   tpeer.natMTU, tpeer.maxMTU);
! 	    printf("\tpackets sent %u\tpacket resends %u\n", tpeer.nSent,
  		   tpeer.reSends);
! 	    printf("\tbytes sent high %u low %u\n", tpeer.bytesSent.high,
  		   tpeer.bytesSent.low);
! 	    printf("\tbytes received high %u low %u\n",
  		   tpeer.bytesReceived.high, tpeer.bytesReceived.low);
! 	    printf("\trtt %u msec, rtt_dev %u msec\n", tpeer.rtt >> 3,
  		   tpeer.rtt_dev >> 2);
! 	    printf("\ttimeout %u.%03u sec\n", tpeer.timeout.sec,
  		   tpeer.timeout.usec / 1000);
  	    if (!showLong)
  		continue;
  
  	    printf("\tin/out packet skew: %d/%d\n", tpeer.inPacketSkew,
! 		    tpeer.outPacketSkew);
  	    printf("\tcongestion window %d, MTU %d\n", tpeer.cwind,
  		   tpeer.MTU);
  	    printf("\tcurrent/if/max jumbogram size: %d/%d/%d\n",
***************
*** 585,590 ****
--- 594,602 ----
  {
      struct cmd_syndesc *ts;
  
+ #ifdef RXDEBUG
+     rxi_DebugInit();
+ #endif
  #ifdef AFS_NT40_ENV
      if (afs_winsockInit() < 0) {
  	printf("%s: Couldn't initialize winsock. Exiting...\n", argv[0]);
Index: openafs/src/viced/afsfileprocs.c
diff -c openafs/src/viced/afsfileprocs.c:1.113.2.12 openafs/src/viced/afsfileprocs.c:1.113.2.14
*** openafs/src/viced/afsfileprocs.c:1.113.2.12	Thu Feb  8 20:00:22 2007
--- openafs/src/viced/afsfileprocs.c	Mon Feb 26 13:49:42 2007
***************
*** 29,35 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.113.2.12 2007/02/09 01:00:22 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
--- 29,35 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.113.2.14 2007/02/26 18:49:42 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 7363,7368 ****
--- 7363,7370 ----
      sys2et[EDQUOT] = UAEDQUOT;
      sys2et[ENOMEDIUM] = UAENOMEDIUM;
      sys2et[EMEDIUMTYPE] = UAEMEDIUMTYPE;
+ 
+     sys2et[EIO] = UAEIO;
  }
  
  /* NOTE:  2006-03-01                                                     
