Index: openafs/src/afs/LINUX/osi_probe.c
diff -c openafs/src/afs/LINUX/osi_probe.c:1.1.2.24 openafs/src/afs/LINUX/osi_probe.c:1.1.2.25
*** openafs/src/afs/LINUX/osi_probe.c:1.1.2.24	Tue Aug 21 17:31:59 2007
--- openafs/src/afs/LINUX/osi_probe.c	Sun Apr  6 23:19:40 2008
***************
*** 45,50 ****
--- 45,51 ----
  
  /* Code to find the Linux syscall table */
  
+ #if defined(EXPORTED_INIT_MM)
  #ifdef OSI_PROBE_STANDALONE
  #define OSI_PROBE_DEBUG
  #endif
***************
*** 1481,1483 ****
--- 1482,1490 ----
  module_exit(osi_probe_exit);
  #endif
  #endif
+ #else
+ void *osi_find_syscall_table(int which)
+ {
+     return 0;
+ }
+ #endif /* EXPORTED_INIT_MM */
Index: openafs/src/afs/LINUX/osi_vnodeops.c
diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.61 openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.63
*** openafs/src/afs/LINUX/osi_vnodeops.c:1.81.2.61	Wed Mar 26 00:17:32 2008
--- openafs/src/afs/LINUX/osi_vnodeops.c	Wed Apr  2 14:27:13 2008
***************
*** 22,28 ****
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.61 2008/03/26 04:17:32 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
--- 22,28 ----
  #include "afs/param.h"
  
  RCSID
!     ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.63 2008/04/02 18:27:13 shadow Exp $");
  
  #include "afs/sysincludes.h"
  #include "afsincludes.h"
***************
*** 570,577 ****
  
      AFS_GLOCK();
  
!     if (fp->f_flags | O_RDONLY)     /* readers dont flush */
  	return 0;
  
      credp = crref();
      vcp = VTOAFS(FILE_INODE(fp));
--- 570,579 ----
  
      AFS_GLOCK();
  
!     if ((fp->f_flags & O_ACCMODE) == O_RDONLY) { /* readers dont flush */
! 	AFS_GUNLOCK();
  	return 0;
+     }
  
      credp = crref();
      vcp = VTOAFS(FILE_INODE(fp));
Index: openafs/src/aklog/aklog.c
diff -c openafs/src/aklog/aklog.c:1.1.2.5 openafs/src/aklog/aklog.c:1.1.2.6
*** openafs/src/aklog/aklog.c:1.1.2.5	Fri Jul 15 12:11:24 2005
--- openafs/src/aklog/aklog.c	Tue Apr  1 13:44:52 2008
***************
*** 1,19 ****
  /* 
!  * $Id: aklog.c,v 1.1.2.5 2005/07/15 16:11:24 rra Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
  #if !defined(lint) && !defined(SABER)
! static char *rcsid = "$Id: aklog.c,v 1.1.2.5 2005/07/15 16:11:24 rra Exp $";
  #endif /* lint || SABER */
  
  #include <afs/stds.h>
  #include "aklog.h"
  
- #ifndef WINDOWS
- 
  int
  main(int argc, char *argv[])
  {
--- 1,17 ----
  /* 
!  * $Id: aklog.c,v 1.1.2.6 2008/04/01 17:44:52 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
  #if !defined(lint) && !defined(SABER)
! static char *rcsid = "$Id: aklog.c,v 1.1.2.6 2008/04/01 17:44:52 shadow Exp $";
  #endif /* lint || SABER */
  
  #include <afs/stds.h>
  #include "aklog.h"
  
  int
  main(int argc, char *argv[])
  {
***************
*** 21,107 ****
      exit(0);
  }
  
- #else /* WINDOWS */
- 
- #include <windows.h>
- #include <windowsx.h>
- 
- static void parse_cmdline();
- 
- 
- int PASCAL
- WinMain(HINSTANCE hinst, HINSTANCE hprevinstance, LPSTR cmdline, int noshow)
- {
- 	int argc = 0;
- 	char **argv;
- 
-     aklog_params params;
- 
- 	parse_cmdline(cmdline, &argv, &argc);
- 
-     aklog(argc, argv, &params);
- 
- 	return 0;
- }
- 
- /*
-  * Generate agrv/argc here from command line.
-  * Note that windows doesn't pass us the executible name, so
-  * we need to fill that in manually.
-  */
- 
- static void
- parse_cmdline(char *cmdline, char ***pargv, int *pargc)
- {
- 	char **argv;
- 	int argc = 0;
- 	char *arg, *sep = " \t";
- 	int argv_size = 10;		/* to start with */
- 
- 
- 	argv = malloc(argv_size * sizeof(char *));
- 
- 	if (!argv) {
- 		MessageBox(NULL, "Fatal Error: Out of memory", AKLOG_DIALOG_NAME, 
- 				   MB_OK | MB_ICONSTOP);
- 		exit(1);
- 	}
- 
- 	argv[argc++] = "aklog";
- 
- 	arg = strtok(cmdline, sep);
- 
- 	while(arg) {
- 		argv[argc] = strdup(arg);
- 
- 		if (!argv[argc]) {
- 			MessageBox(NULL, "Fatal Error: Out of memory", AKLOG_DIALOG_NAME, 
- 					   MB_OK | MB_ICONSTOP);
- 			exit(1);
- 		}
- 
- 		argc++;
- 
- 		if (argc == argv_size) {
- 			argv_size += 10;
- 			argv = realloc(argv, argv_size * sizeof(char *));
- 
- 			if (!argv) {
- 				MessageBox(NULL, "Fatal Error: Out of memory",
- 						   AKLOG_DIALOG_NAME, 
- 						   MB_OK | MB_ICONSTOP);
- 				exit(1);
- 			}
- 		}
- 
- 		arg = strtok(NULL, sep);
- 	}
- 
- 	argv[argc] = NULL;
- 
- 	*pargv = argv;
- 	*pargc = argc;
- }
- 
- #endif /* WINDOWS */
- 
--- 19,21 ----
Index: openafs/src/aklog/aklog.h
diff -c openafs/src/aklog/aklog.h:1.1.2.6 openafs/src/aklog/aklog.h:1.1.2.7
*** openafs/src/aklog/aklog.h:1.1.2.6	Wed Jul 11 00:32:27 2007
--- openafs/src/aklog/aklog.h	Tue Apr  1 13:44:52 2008
***************
*** 1,5 ****
  /* 
!  * $Id: aklog.h,v 1.1.2.6 2007/07/11 04:32:27 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
--- 1,5 ----
  /* 
!  * $Id: aklog.h,v 1.1.2.7 2008/04/01 17:44:52 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
***************
*** 8,17 ****
  #ifndef __AKLOG_H__
  #define __AKLOG_H__
  
- #if !defined(lint) && !defined(SABER)
- static char *rcsid_aklog_h = "$Id: aklog.h,v 1.1.2.6 2007/07/11 04:32:27 shadow Exp $";
- #endif /* lint || SABER */
- 
  #include <krb5.h>
  #include "linked_list.h"
  #include <afsconfig.h>
--- 8,13 ----
Index: openafs/src/aklog/aklog_main.c
diff -c openafs/src/aklog/aklog_main.c:1.1.2.23 openafs/src/aklog/aklog_main.c:1.1.2.26
*** openafs/src/aklog/aklog_main.c:1.1.2.23	Fri Jan  4 23:48:40 2008
--- openafs/src/aklog/aklog_main.c	Tue Apr  1 14:15:53 2008
***************
*** 1,5 ****
  /* 
!  * $Id: aklog_main.c,v 1.1.2.23 2008/01/05 04:48:40 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
--- 1,5 ----
  /* 
!  * $Id: aklog_main.c,v 1.1.2.26 2008/04/01 18:15:53 shadow Exp $
   *
   * Copyright 1990,1991 by the Massachusetts Institute of Technology
   * For distribution and copying rights, see the file "mit-copyright.h"
***************
*** 34,45 ****
   * such damages.                                                
   */
  
- #if !defined(lint) && !defined(SABER)
- static char *rcsid =
- 	"$Id: aklog_main.c,v 1.1.2.23 2008/01/05 04:48:40 shadow Exp $";
- #endif /* lint || SABER */
- 
  #include <afsconfig.h>
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
--- 34,42 ----
   * such damages.                                                
   */
  
  #include <afsconfig.h>
+ RCSID
+      ("$Header: /cvs/openafs/src/aklog/aklog_main.c,v 1.1.2.26 2008/04/01 18:15:53 shadow Exp $");
  #include <stdio.h>
  #include <string.h>
  #include <ctype.h>
***************
*** 58,64 ****
  #include <sys/stat.h>
  #include <fcntl.h>
  
- #ifndef WINDOWS
  #include <sys/param.h>
  #include <sys/errno.h>
  #include <netdb.h>
--- 55,60 ----
***************
*** 66,83 ****
  #include <netinet/in.h>
  #include <arpa/inet.h>
  #include <pwd.h>
- #endif /* WINDOWS */
  
  #include <afs/stds.h>
  #include <krb5.h>
  
- #ifdef WINDOWS
- 
- #include <afs/auth.h>
- #include <rx/rxkad.h>
- #include <afs/dirpath.h>
- 
- #else /* !WINDOWS */
  #ifndef HAVE_KERBEROSV_HEIM_ERR_H
  #include <afs/com_err.h>
  #endif
--- 62,71 ----
***************
*** 93,99 ****
  #include <afs/ptserver.h>
  #include <afs/ptuser.h>
  #include <afs/dirpath.h>
- #endif /* WINDOWS */
  
  #include "aklog.h"
  #include "linked_list.h"
--- 81,86 ----
***************
*** 112,117 ****
--- 99,105 ----
  #define AFS_TRY_FULL_PRINC 1
  #endif /* AFS_TRY_FULL_PRINC */
  
+ #define AKLOG_TRYAGAIN -1
  #define AKLOG_SUCCESS 0
  #define AKLOG_USAGE 1
  #define AKLOG_SOMETHINGSWRONG 2
***************
*** 153,168 ****
  static char linkedcell2[MAXCELLCHARS+1];
  static krb5_ccache  _krb425_ccache = NULL;
  
- #ifdef WINDOWS
- 
- /* libafsconf.dll */
- extern long cm_GetRootCellName();
- extern long cm_SearchCellFile();
- 
- static long cm_SearchCellFile_CallBack();
- 
- #else /* !WINDOWS */
- 
  /*
   * Why doesn't AFS provide these prototypes?
   */
--- 141,146 ----
***************
*** 179,184 ****
--- 157,166 ----
  				  char *, krb5_creds **);
  static int get_user_realm(krb5_context, char *);
  
+ #define TRYAGAIN(x) (x == AKLOG_TRYAGAIN || \
+ 		     x == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || \
+ 		     x == KRB5KRB_ERR_GENERIC)
+ 
  #if defined(HAVE_KRB5_PRINC_SIZE) || defined(krb5_princ_size)
  
  #define get_princ_str(c, p, n) krb5_princ_component(c, p, n)->data
***************
*** 300,306 ****
  
  #define deref_entry_enctype(entry)			\
      deref_keyblock_enctype(&deref_entry_keyblock(entry))
- #endif /* WINDOWS */
  
  /*
   * Provide a replacement for strerror if we don't have it
--- 282,287 ----
***************
*** 343,348 ****
--- 324,340 ----
  }
  
  
+ static char *copy_string(char *string)    
+ {
+     char *new_string;
+ 
+     if ((new_string = (char *)calloc(strlen(string) + 1, sizeof(char))))
+ 	(void) strcpy(new_string, string);
+ 
+     return (new_string);
+ }
+ 
+ 
  static int get_cellconfig(char *cell, struct afsconf_cell *cellconfig, char *local_cell, char *linkedcell)
  {
      int status = AKLOG_SUCCESS;
***************
*** 351,358 ****
      memset(local_cell, 0, sizeof(local_cell));
      memset((char *)cellconfig, 0, sizeof(*cellconfig));
  
- #ifndef WINDOWS
- 
      if (!(configdir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH))) {
  	fprintf(stderr, 
  		"%s: can't get afs configuration (afsconf_Open(%s))\n",
--- 343,348 ----
***************
*** 379,479 ****
  
      (void) afsconf_Close(configdir);
  
- #else /* WINDOWS */
-     /*
-      * We'll try to mimic the GetCellInfo call here and fill in as much
-      * of the afsconf_cell structure as we can.
-      */
-     if (cm_GetRootCellName(local_cell)) {
- 	fprintf(stderr, "%s: can't get local cellname\n", progname);
- 	exit(AKLOG_AFS);
-     }
- 
-     if ((cell == NULL) || (cell[0] == 0))
- 	cell = local_cell;
- 
-     strcpy(cellconfig->name, cell);
- 
-     /* No way of figuring this out as far as I can tell */
-     linkedcell[0] = '\0';
- 
-     /* Initialize server info */
-     cellconfig->numServers = 0;
-     cellconfig->hostName[0][0] = "\0";
- 
-     /*
-      * Get servers of cell. cm_SearchCellFile_CallBack() gets call with
-      * each server.
-      */
-     status = (int) cm_SearchCellFile(cell, NULL, &cm_SearchCellFile_CallBack,
- 				     cellconfig /* rock */);
- 
-     switch(status) {
-     case 0:
- 	break;
- 
-     case -1:
- 	fprintf(stderr, "%s: GetWindowsDirectory() failed.\n", progname);
- 	break;
- 
-     case -2:
- 	fprintf(stderr, "%s: Couldn't open afsdcells.ini for reading\n",
- 		progname);
- 	break;
- 
-     case -3:
- 	fprintf(stderr, "%s: Couldn't find any servers for cell %s\n",
- 		progname, cell);
- 	break;
- 
-     case -4:
- 	fprintf(stderr, "%s: Badly formatted line in afsdcells.ini (does not begin with a \">\" or contain \"#\"\n",
- 		progname);
- 	break;
- 
-     default:
- 	fprintf(stderr, "%s cm_SearchCellFile returned unknown error %d\n",
- 		status);
-     }
- 
-     if (status) {
- 	exit(AKLOG_AFS);
-     }
- 
-     status = AKLOG_SUCCESS;
- 
-     
- #endif /* WINDOWS */
- 
      return(status);
  }
  
- 
- #ifdef WINDOWS
- /*
-  * Callback function for cm_SearchCellFile() in get_cellconfig() above.
-  * This function gets called once for each server that is found for the cell.
-  */
- static long
- cm_SearchCellFile_CallBack(void *rock /* cellconfig */,
- 			   struct sockaddr_in *addr, /* Not used */
- 			   char *server)
- {
-     struct afsconf_cell *cellconfig = rock;
- 
- 
-     /*
-      * Save server name and increment count of servers
-      */
-     strcpy(cellconfig->hostName[cellconfig->numServers++], server);
-     
-     return (long) 0;
- }
- 
-     
- #endif /* WINDOWS */
- 
- 
  /* 
   * Log to a cell.  If the cell has already been logged to, return without
   * doing anything.  Otherwise, log to it and mark that it has been logged
--- 369,377 ----
***************
*** 485,523 ****
      char username[BUFSIZ];	/* To hold client username structure */
      afs_int32 viceId;		/* AFS uid of user */
  
-     char name[ANAME_SZ];	/* Name of afs key */
-     char primary_instance[INST_SZ];	/* Instance of afs key */
-     char secondary_instance[INST_SZ];	/* Backup instance to try */
-     int try_secondary = 0;		/* Flag to indicate if we try second */
      char realm_of_user[REALM_SZ]; /* Kerberos realm of user */
!     char realm_of_cell[REALM_SZ]; /* Kerberos realm of cell */
      char local_cell[MAXCELLCHARS+1];
      char cell_to_use[MAXCELLCHARS+1]; /* Cell to authenticate to */
      static char lastcell[MAXCELLCHARS+1] = { 0 };
- #ifndef WINDOWS
      static char confname[512] = { 0 };
- #endif
      krb5_creds *v5cred = NULL;
      struct ktc_principal aserver;
      struct ktc_principal aclient;
      struct ktc_token atoken, btoken;
  
- #ifdef ALLOW_REGISTER
-     afs_int32 id;
- #endif /* ALLOW_REGISTER */
- 
-     memset(name, 0, sizeof(name));
-     memset(primary_instance, 0, sizeof(primary_instance));
-     memset(secondary_instance, 0, sizeof(secondary_instance));
      memset(realm_of_user, 0, sizeof(realm_of_user));
-     memset(realm_of_cell, 0, sizeof(realm_of_cell));
  
- #ifndef WINDOWS
      if (confname[0] == '\0') {
  	strncpy(confname, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confname));
  	confname[sizeof(confname) - 2] = '\0';
      }
- #endif /* WINDOWS */
  
      /* NULL or empty cell returns information on local cell */
      if ((status = get_cellconfig(cell, &ak_cellconfig,
--- 383,408 ----
      char username[BUFSIZ];	/* To hold client username structure */
      afs_int32 viceId;		/* AFS uid of user */
  
      char realm_of_user[REALM_SZ]; /* Kerberos realm of user */
!     char *realm_from_princ = 0 ;  /* Calculated realm data */
!     char *realm_of_cell = 0;	  /* Pointer to realm we're using */	
!     int retry;			  /* round, and round we go ... */
!     
      char local_cell[MAXCELLCHARS+1];
      char cell_to_use[MAXCELLCHARS+1]; /* Cell to authenticate to */
      static char lastcell[MAXCELLCHARS+1] = { 0 };
      static char confname[512] = { 0 };
      krb5_creds *v5cred = NULL;
      struct ktc_principal aserver;
      struct ktc_principal aclient;
      struct ktc_token atoken, btoken;
  
      memset(realm_of_user, 0, sizeof(realm_of_user));
  
      if (confname[0] == '\0') {
  	strncpy(confname, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(confname));
  	confname[sizeof(confname) - 2] = '\0';
      }
  
      /* NULL or empty cell returns information on local cell */
      if ((status = get_cellconfig(cell, &ak_cellconfig,
***************
*** 568,667 ****
  		   cell_to_use, ak_cellconfig.hostName[0]);
  	}
  
! 	/*
! 	 * Find out which realm we're supposed to authenticate to.  If one
! 	 * is not included, use the kerberos realm found in the credentials
! 	 * cache.
! 	 */
! 
! 	if (realm && realm[0]) {
! 	    strcpy(realm_of_cell, realm);
! 	    if (dflag) {
! 		printf("We were told to authenticate to realm %s.\n", realm);
! 	    }
  	}
- 	else {
- 	    char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, FALSE);
  
! 	    if (!afs_realm) {
! 		fprintf(stderr, 
! 			"%s: Couldn't figure out realm for cell %s.\n",
! 			progname, cell_to_use);
! 		exit(AKLOG_MISC);
  	    }
! 
! 	    strcpy(realm_of_cell, afs_realm);
! 
! 	    if (dflag) {
! 		if (realm_of_cell[0])
! 		    printf("We've deduced that we need to authenticate to"
! 			   " realm %s.\n", realm_of_cell);
! 		else
! 		    printf("We've deduced that we need to authenticate "
! 			   "using referrals.\n");
  	    }
- 	}
- 
- 	/* We use the afs.<cellname> convention here... 
- 	 *
- 	 * Doug Engert's original code had principals of the form:
- 	 *
- 	 * "afsx/cell@realm"
- 	 *
- 	 * in the KDC, so the name wouldn't conflict with DFS.  Since we're
- 	 * not using DFS, I changed it just to look for the following
- 	 * principals:
- 	 *
- 	 * afs/<cell>@<realm>
- 	 * afs@<realm>
- 	 *
- 	 * Because people are transitioning from afs@realm to afs/cell,
- 	 * we configure things so that if the first one isn't found, we
- 	 * try the second one.  You can select which one you prefer with
- 	 * a configure option.
- 	 */
  
! 	strcpy(name, AFSKEY);
  
! 	if (AFS_TRY_FULL_PRINC || strcasecmp(cell_to_use, realm_of_cell) != 0) {
! 	    strncpy(primary_instance, cell_to_use, sizeof(primary_instance));
! 	    primary_instance[sizeof(primary_instance)-1] = '\0';
! 	    if (strcasecmp(cell_to_use, realm_of_cell) == 0) {
! 		try_secondary = 1;
! 		secondary_instance[0] = '\0';
  	    }
! 	} else {
! 	    primary_instance[0] = '\0';
! 	    try_secondary = 1;
! 	    strncpy(secondary_instance, cell_to_use,
! 		    sizeof(secondary_instance));
! 	    secondary_instance[sizeof(secondary_instance)-1] = '\0';
  	}
! 
! 	/* 
! 	 * Extract the session key from the ticket file and hand-frob an
! 	 * afs style authenticator.
! 	 */
! 
! 	/*
! 	 * Try to obtain AFS tickets.  Because there are two valid service
! 	 * names, we will try both, but trying the more specific first.
! 	 *
! 	 *	afs/<cell>@<realm> i.e. allow for single name with "."
! 	 * 	afs@<realm>
  	 */
- 
- 	if (dflag) {
- 	    printf("Getting tickets: %s%s%s@%s\n", name,
- 		   primary_instance[0] ? "/" : "", 
- 		   primary_instance, realm_of_cell);
- 	}
- 
- 	status = get_credv5(context, name, primary_instance, realm_of_cell,
- 			    &v5cred);
- 
  #if !defined(USING_HEIMDAL) && defined(HAVE_KRB5_DECODE_TICKET)
! 	if (status == 0 && strcmp(realm_of_cell, "") == 0) {
  	    krb5_error_code code;
  	    krb5_ticket *ticket;
  
--- 453,580 ----
  		   cell_to_use, ak_cellconfig.hostName[0]);
  	}
  
! 	if ((status = get_user_realm(context, realm_of_user))) {
! 	    fprintf(stderr, "%s: Couldn't determine realm of user:)",
! 		    progname);
! 	    afs_com_err(progname, status, " while getting realm");
! 	    return(AKLOG_KERBEROS);
  	}
  
! 	retry = 1;
! 	
! 	while(retry) {
! 	    
! 	    /* Cell on command line - use that one */
! 	    if (realm && realm[0]) {
! 		realm_of_cell = realm;
! 		status = AKLOG_TRYAGAIN;
! 		if (dflag) {
! 		    printf("We were told to authenticate to realm %s.\n", 
! 			   realm);
! 		}
! 	    } else {
! 		/* Initially, try using afs/cell@USERREALM */
! 		if (dflag) {
! 		    printf("Trying to authenticate to user's realm %s.\n",
! 			   realm_of_user);
! 		}
! 		
! 		realm_of_cell = realm_of_user;
! 		status = get_credv5(context, AFSKEY, cell_to_use, 
! 				    realm_of_cell, &v5cred);
! 	    
! 		/* If that failed, try to determine the realm from the name of 
! 		 * one of the DB servers */
! 		if (TRYAGAIN(status)) {
! 		    realm_of_cell = afs_realm_of_cell(context, &ak_cellconfig, 
! 				    		      FALSE);
! 		    if (!realm_of_cell) {
! 			fprintf(stderr, 
! 				"%s: Couldn't figure out realm for cell %s.\n",
! 				progname, cell_to_use);
! 		    	exit(AKLOG_MISC);
! 	    	    }
! 
! 		    if (dflag) {
! 			if (realm_of_cell[0])
! 			    printf("We've deduced that we need to authenticate"
! 				   " to realm %s.\n", realm_of_cell);
! 		    else
! 			printf("We've deduced that we need to authenticate "
! 			       "using referrals.\n");
! 		    }
! 		}
  	    }
! 	
! 	    if (TRYAGAIN(status)) {
! 		/* If we've got the full-princ-first option, or we're in a
! 		 * different realm from the cell - use the cell name as the
! 		 * instance */
! 		if (AFS_TRY_FULL_PRINC || 
! 		    strcasecmp(cell_to_use, realm_of_cell)!=0) {
! 		    status = get_credv5(context, AFSKEY, cell_to_use, 
! 				        realm_of_cell, &v5cred);
! 
! 		    /* If we failed & we've got an empty realm, then try 
! 		     * calling afs_realm_for_cell again. */
! 		    if (TRYAGAIN(status) && !realm_of_cell[0]) {
! 			/* This time, get the realm by taking the domain 
! 			 * component of the db server and make it upper case */
! 		    	realm_of_cell = afs_realm_of_cell(context, 
! 							  &ak_cellconfig, TRUE);
! 			if (!realm_of_cell) {
! 			    fprintf(stderr,
! 				    "%s: Couldn't figure out realm for cell "
! 				    "%s.\n", progname, cell_to_use);
! 			    exit(AKLOG_MISC);
! 			}
! 			printf("We've deduced that we need to authenticate to"
! 			       " realm %s.\n", realm_of_cell);
! 		    }
! 		    status = get_credv5(context, AFSKEY, cell_to_use, 
! 				        realm_of_cell, &v5cred);
! 	    	}
! 	   
! 		/* If the realm and cell name match, then try without an 
! 		 * instance, but only if realm is non-empty */
! 	        
! 		if (TRYAGAIN(status) && 
! 		    strcasecmp(cell_to_use, realm_of_cell) == 0) {
! 		    status = get_credv5(context, AFSKEY, NULL, 
! 				        realm_of_cell, &v5cred);
!     		    if (!AFS_TRY_FULL_PRINC && TRYAGAIN(status)) {
! 		        status = get_credv5(context, AFSKEY, cell_to_use,
! 				            realm_of_cell, &v5cred);
! 		    }
! 		}
  	    }
  
! 	    /* Try to find a service principal for this cell.
! 	     * Some broken MIT libraries return KRB5KRB_AP_ERR_MSG_TYPE upon 
! 	     * the first attempt, so we try twice to be sure */
  
! 	    if (status == KRB5KRB_AP_ERR_MSG_TYPE && retry == 1)
! 		retry++;
! 	    else
! 		retry = 0;
! 	} 
! 	
! 	if (status != 0) {
! 	    if (dflag) {
! 		printf("Kerberos error code returned by get_cred : %d\n",
! 		       status);
  	    }
! 	    fprintf(stderr, "%s: Couldn't get %s AFS tickets:\n",
! 		    progname, cell_to_use);
! 	    afs_com_err(progname, status, "while getting AFS tickets");
! 	    return(AKLOG_KERBEROS);
  	}
! 	
! 	/* If we've got a valid ticket, and we still don't know the realm name
! 	 * try to figure it out from the contents of the ticket
  	 */
  #if !defined(USING_HEIMDAL) && defined(HAVE_KRB5_DECODE_TICKET)
! 	if (strcmp(realm_of_cell, "") == 0) {
  	    krb5_error_code code;
  	    krb5_ticket *ticket;
  
***************
*** 671,746 ****
  		fprintf(stderr,
  			"%s: Couldn't decode ticket to determine realm for "
  			"cell %s.\n",
! 			progname, cell_to_use);
  	    } else {
  		int len = realm_len(context, ticket->server);
  		/* This really shouldn't happen. */
  		if (len > REALM_SZ-1)
  		    len = REALM_SZ-1;
  
! 		strncpy(realm_of_cell, realm_data(context, ticket->server), 
  			len);
! 		realm_of_cell[len] = 0;
! 
  		krb5_free_ticket(context, ticket);
  	    }
  	}
  #endif
  
- 	if ((status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) &&
- 	    !realm_of_cell[0]) {
- 	    char *afs_realm = afs_realm_of_cell(context, &ak_cellconfig, TRUE);
- 
- 	    if (!afs_realm) {
- 		fprintf(stderr, 
- 			"%s: Couldn't figure out realm for cell %s.\n",
- 			progname, cell_to_use);
- 		exit(AKLOG_MISC);
- 	    }
- 
- 	    strcpy(realm_of_cell, afs_realm);
- 
- 	    if (strcasecmp(cell_to_use, realm_of_cell) == 0) {
- 		try_secondary = 1;
- 		secondary_instance[0] = '\0';
- 	    }
- 
- 	    if (dflag) {
- 		printf("We've deduced that we need to authenticate to"
- 			" realm %s.\n", realm_of_cell);
- 		printf("Getting tickets: %s%s%s@%s\n", name,
- 			primary_instance[0] ? "/" : "", 
- 			primary_instance, realm_of_cell);
- 	    }
- 
- 	    status = get_credv5(context, name, primary_instance, realm_of_cell,
- 				 &v5cred);
- 
- 	}
- 	if (status == KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN || status == KRB5KRB_ERR_GENERIC) {
- 	    if (try_secondary) {
- 		if (dflag) {
- 		    printf("Principal not found, trying alternate "
- 			   "service name: %s%s%s@%s\n", name,
- 			    secondary_instance[0] ? "/" : "",
- 			    secondary_instance, realm_of_cell);
- 		}
- 		status = get_credv5(context, name, secondary_instance,
- 				    realm_of_cell, &v5cred);
- 	    }
- 	}
- 
- 	if (status) {
- 	    if (dflag) {
- 		printf("Kerberos error code returned by get_cred: %d\n",
- 			status);
- 	    }
- 	    fprintf(stderr, "%s: Couldn't get %s AFS tickets:\n",
- 		    progname, cell_to_use);
- 		afs_com_err(progname, status, "while getting AFS tickets");
- 	    return(AKLOG_KERBEROS);
- 	}
- 
  	strncpy(aserver.name, AFSKEY, MAXKTCNAMELEN - 1);
  	strncpy(aserver.instance, AFSINST, MAXKTCNAMELEN - 1);
  	strncpy(aserver.cell, cell_to_use, MAXKTCREALMLEN - 1);
--- 584,608 ----
  		fprintf(stderr,
  			"%s: Couldn't decode ticket to determine realm for "
  			"cell %s.\n",
! 		    	progname, cell_to_use);
  	    } else {
  		int len = realm_len(context, ticket->server);
  		/* This really shouldn't happen. */
  		if (len > REALM_SZ-1)
  		    len = REALM_SZ-1;
  
! 		realm_from_princ = (char *) malloc(sizeof(char) * (len+1));
! 		
! 		strncpy(realm_from_princ, realm_data(context, ticket->server), 
  			len);
! 		realm_from_princ[len] = 0;
! 		realm_of_cell = realm_from_princ;
! 		
  		krb5_free_ticket(context, ticket);
  	    }
  	}
  #endif
  
  	strncpy(aserver.name, AFSKEY, MAXKTCNAMELEN - 1);
  	strncpy(aserver.instance, AFSINST, MAXKTCNAMELEN - 1);
  	strncpy(aserver.cell, cell_to_use, MAXKTCREALMLEN - 1);
***************
*** 836,857 ****
  	noprdb = 1;
  #endif
  
- #ifndef WINDOWS
  	if (noprdb) {
- #endif
  	    if (dflag) {
  		printf("Not resolving name %s to id (-noprdb set)\n",
  			username);
  	    }
- #ifndef WINDOWS
  	}
  	else {
- 	    if ((status = get_user_realm(context, realm_of_user))) {
- 		fprintf(stderr, "%s: Couldn't determine realm of user:)",
- 			progname);
- 		afs_com_err(progname, status, " while getting realm");
- 		return(AKLOG_KERBEROS);
- 	    }
  	    if (strcmp(realm_of_user, realm_of_cell)) {
  		strcat(username, "@");
  		strcat(username, realm_of_user);
--- 698,710 ----
***************
*** 890,908 ****
  		 */
  
  #ifdef ALLOW_REGISTER
! 	if (status == 0) {
! 	    if (viceId != ANONYMOUSID) {
! #else /* ALLOW_REGISTER */
! 	    if ((status == 0) && (viceId != ANONYMOUSID))
! #endif /* ALLOW_REGISTER */
! 		sprintf (username, "AFS ID %d", (int) viceId);
! #ifdef ALLOW_REGISTER
! 	    } else if (strcmp(realm_of_user, realm_of_cell) != 0) {
  		if (dflag) {
  		    printf("doing first-time registration of %s "
  			    "at %s\n", username, cell_to_use);
  		}
! 		id = 0;
  		strncpy(aclient.name, username, MAXKTCNAMELEN - 1);
  		strcpy(aclient.instance, "");
  		strncpy(aclient.cell, realm_of_user, MAXKTCREALMLEN - 1);
--- 743,755 ----
  		 */
  
  #ifdef ALLOW_REGISTER
! 	    if ((status == 0) && (viceId == ANONYMOUSID) &&
! 	 	(strcmp(realm_of_user, realm_of_cell) != 0)) {
  		if (dflag) {
  		    printf("doing first-time registration of %s "
  			    "at %s\n", username, cell_to_use);
  		}
! 		viceId = 0;
  		strncpy(aclient.name, username, MAXKTCNAMELEN - 1);
  		strcpy(aclient.instance, "");
  		strncpy(aclient.cell, realm_of_user, MAXKTCREALMLEN - 1);
***************
*** 923,944 ****
  		    printf("Error %d\n", status);
  		}
  
! 		if ((status = pr_CreateUser(username, &id))) {
  		    fprintf(stderr, "%s: %s so unable to create remote PTS "
  			    "user %s in cell %s (status: %d).\n", progname,
  			    afs_error_message(status), username, cell_to_use,
  			    status);
  		} else {
  		    printf("created cross-cell entry for %s (Id %d) at %s\n",
! 			   username, id, cell_to_use);
! 		    sprintf(username, "AFS ID %d", (int) id);
  		}
  	    }
- 	}
  #endif /* ALLOW_REGISTER */
  
  	}
- #endif /* !WINDOWS */
  
  	if (dflag) {
  	    fprintf(stdout, "Set username to %s\n", username);
--- 770,792 ----
  		    printf("Error %d\n", status);
  		}
  
! 		if ((status = pr_CreateUser(username, &viceId))) {
  		    fprintf(stderr, "%s: %s so unable to create remote PTS "
  			    "user %s in cell %s (status: %d).\n", progname,
  			    afs_error_message(status), username, cell_to_use,
  			    status);
+ 		    viceId = ANONYMOUSID;
  		} else {
  		    printf("created cross-cell entry for %s (Id %d) at %s\n",
! 			   username, viceId, cell_to_use);
  		}
  	    }
  #endif /* ALLOW_REGISTER */
  
+ 	    if ((status == 0) && (viceId != ANONYMOUSID)) {
+ 		sprintf(username, "AFS ID %d", (int) viceId);
+ 	    }
  	}
  
  	if (dflag) {
  	    fprintf(stdout, "Set username to %s\n", username);
***************
*** 964,1001 ****
  	 */
  	write(2,"",0); /* dummy write */
  #endif
- #ifndef WINDOWS
  	if ((status = ktc_SetToken(&aserver, &atoken, &aclient, afssetpag))) {
  	    fprintf(stderr, 
  		    "%s: unable to obtain tokens for cell %s (status: %d).\n",
  		    progname, cell_to_use, status);
  	    status = AKLOG_TOKEN;
  	}
- #else /* WINDOWS */
- 	/* Note switched 2nd and 3rd args */
- 	if ((status = ktc_SetToken(&aserver, &atoken, &aclient, afssetpag))) {
- 	    switch(status) {
- 	    case KTC_INVAL:
- 		fprintf(stderr, "%s: Bad ticket length", progname);
- 		break;
- 	    case KTC_PIOCTLFAIL:
- 		fprintf(stderr, "%s: Unknown error contacting AFS service",
- 			progname);
- 		break;
- 	    case KTC_NOCELL:
- 		fprintf(stderr, "%s: Cell name (%s) not recognized by AFS service",
- 			progname, realm_of_cell);
- 		break;
- 	    case KTC_NOCM:
- 		fprintf(stderr, "%s: AFS service is unavailable", progname);
- 		break;
- 	    default:
- 		fprintf(stderr, "%s: Undocumented error (%d) contacting AFS service", progname, status);
- 		break;	
- 	    }
- 	    status = AKLOG_TOKEN;	    
- 	}
- #endif /* !WINDOWS */
      }
      else
  	if (dflag) {
--- 812,823 ----
***************
*** 1005,1012 ****
      return(status);
  }
  
- #ifndef WINDOWS /* struct ViceIoctl missing */
- 
  static int get_afs_mountpoint(char *file, char *mountpoint, int size)
  {
  #ifdef AFS_SUN_ENV
--- 827,832 ----
***************
*** 1103,1110 ****
  	    ? elast_comp - last_comp : strlen(last_comp);
  	strncat(pathtocheck, last_comp, len);
  	memset(linkbuf, 0, sizeof(linkbuf));
! 	if (link = (readlink(pathtocheck, linkbuf, 
! 				    sizeof(linkbuf)) > 0)) {
  	    if (++symlinkcount > MAXSYMLINKS) {
  		fprintf(stderr, "%s: %s\n", progname, strerror(ELOOP));
  		exit(AKLOG_BADPATH);
--- 923,930 ----
  	    ? elast_comp - last_comp : strlen(last_comp);
  	strncat(pathtocheck, last_comp, len);
  	memset(linkbuf, 0, sizeof(linkbuf));
! 	if ((link = (readlink(pathtocheck, linkbuf, 
! 				    sizeof(linkbuf)) > 0))) {
  	    if (++symlinkcount > MAXSYMLINKS) {
  		fprintf(stderr, "%s: %s\n", progname, strerror(ELOOP));
  		exit(AKLOG_BADPATH);
***************
*** 1148,1155 ****
      return(pathtocheck);
  }
  
- #endif /* WINDOWS */
- 
  #if 0
  /*****************************************/
  int dee_gettokens()
--- 968,973 ----
***************
*** 1180,1187 ****
  /*****************************************/
  #endif
  
- #ifndef WINDOWS /* struct ViceIoctl missing */
- 
  static void add_hosts(char *file)
  {
  #ifdef AFS_SUN_ENV
--- 998,1003 ----
***************
*** 1241,1250 ****
      }
  }
  
- #endif /* WINDOWS */
- 
- #ifndef WINDOWS /* next_path(), get_afs_mountpoint() */
- 
  /*
   * This routine descends through a path to a directory, logging to 
   * every cell it encounters along the way.
--- 1057,1062 ----
***************
*** 1332,1339 ****
      return(status);
  }
  
- #endif /* WINDOWS */
- 
  
  /* Print usage message and exit */
  static void usage(void)
--- 1144,1149 ----
***************
*** 1410,1418 ****
  	progname = argv[0];
  
      krb5_init_context(&context);
! #ifndef WINDOWS
! 	initialize_ktc_error_table ();
! #endif
  
      /* Initialize list of cells to which we have authenticated */
      (void)ll_init(&authedcells);
--- 1220,1226 ----
  	progname = argv[0];
  
      krb5_init_context(&context);
!     initialize_ktc_error_table ();
  
      /* Initialize list of cells to which we have authenticated */
      (void)ll_init(&authedcells);
***************
*** 1461,1492 ****
  		usage();
  	else if (((strcmp(argv[i], "-path") == 0) ||
  		  (strcmp(argv[i], "-p") == 0)) && !cmode)
- #ifndef WINDOWS
  	    if (++i < argc) {
  		pmode++;
  		strcpy(path, argv[i]);
  	    }
  	    else
  		usage();
- #else /* WINDOWS */
- 	{
- 	    fprintf(stderr, "%s: path mode not supported.\n", progname);
- 	    exit(AKLOG_MISC);
- 	}
- #endif /* WINDOWS */
  	    
  	else if (argv[i][0] == '-')
  	    usage();
  	else if (!pmode && !cmode) {
  	    if (strchr(argv[i], DIR) || (strcmp(argv[i], ".") == 0) ||
  		(strcmp(argv[i], "..") == 0)) {
- #ifndef WINDOWS
  		pmode++;
  		strcpy(path, argv[i]);
- #else /* WINDOWS */
- 		fprintf(stderr, "%s: path mode not supported.\n", progname);
- 		exit(AKLOG_MISC);
- #endif /* WINDOWS */
  	    }
  	    else { 
  		cmode++;
--- 1269,1288 ----
***************
*** 1527,1538 ****
  	    memset(cell, 0, sizeof(cell));
  	    memset(realm, 0, sizeof(realm));
  	}
- #ifndef WINDOWS
  	else if (pmode) {
  	    /* Add this path to list of paths */
  	    if ((cur_node = ll_add_node(&paths, ll_tail))) {
! 		char *new_path;
! 		if ((new_path = strdup(path)))
  		    ll_add_data(cur_node, new_path);
  		else {
  		    fprintf(stderr, "%s: failure copying path name.\n",
--- 1323,1333 ----
  	    memset(cell, 0, sizeof(cell));
  	    memset(realm, 0, sizeof(realm));
  	}
  	else if (pmode) {
  	    /* Add this path to list of paths */
  	    if ((cur_node = ll_add_node(&paths, ll_tail))) {
! 		char *new_path; 
! 		if ((new_path = copy_string(path)))
  		    ll_add_data(cur_node, new_path);
  		else {
  		    fprintf(stderr, "%s: failure copying path name.\n",
***************
*** 1548,1554 ****
  	    pmode = FALSE;
  	    memset(path, 0, sizeof(path));
  	}
- #endif /* WINDOWS */
      }
  
      /*
--- 1343,1348 ----
***************
*** 1600,1606 ****
  				status = auth_to_cell(context, linkedcell2, NULL);
  		}
  
- #ifndef WINDOWS
  		/*
  		 * Local hack - if the person has a file in their home
  		 * directory called ".xlog", read that for a list of
--- 1394,1399 ----
***************
*** 1641,1647 ****
  			}
  		    }
  		}
- #endif /* WINDOWS */
  	}
      else {
  	/* Log to all cells in the cells list first */
--- 1434,1439 ----
***************
*** 1663,1675 ****
  		}
  	}
  	
- #ifndef WINDOWS
  	/* Then, log to all paths in the paths list */
  	for (cur_node = paths.first; cur_node; cur_node = cur_node->next) {
  	    if ((status = auth_to_path(context, cur_node->data)))
  		somethingswrong++;
  	}
- #endif /* WINDOWS */
  	
  	/* 
  	 * If only one thing was logged to, we'll return the status 
--- 1455,1465 ----
***************
*** 1764,1772 ****
      code = krb5_kt_resolve(context, keytab, &kt);
      if (code) {
          if (keytab)
!             com_err(progname, code, "while resolving keytab %s", keytab);
          else
!             com_err(progname, code, "while resolving default keytab");
          goto cleanup;
      }
  
--- 1554,1562 ----
      code = krb5_kt_resolve(context, keytab, &kt);
      if (code) {
          if (keytab)
!             afs_com_err(progname, code, "while resolving keytab %s", keytab);
          else
!             afs_com_err(progname, code, "while resolving default keytab");
          goto cleanup;
      }
  
***************
*** 1785,1791 ****
  	    }
          }
          if (code) {
! 	    com_err(progname, code,"while scanning keytab entries");
  	    goto cleanup;
          }
      } else {
--- 1575,1581 ----
  	    }
          }
          if (code) {
! 	    afs_com_err(progname, code,"while scanning keytab entries");
  	    goto cleanup;
          }
      } else {
***************
*** 1793,1799 ****
          int best = -1;
          memset(new, 0, sizeof *new);
          if ((code == krb5_kt_start_seq_get(context, kt, cursor))) {
!             com_err(progname, code, "while starting keytab scan");
              goto cleanup;
          }
          while (!(code = krb5_kt_next_entry(context, kt, new, cursor))) {
--- 1583,1589 ----
          int best = -1;
          memset(new, 0, sizeof *new);
          if ((code == krb5_kt_start_seq_get(context, kt, cursor))) {
!             afs_com_err(progname, code, "while starting keytab scan");
              goto cleanup;
          }
          while (!(code = krb5_kt_next_entry(context, kt, new, cursor))) {
***************
*** 1809,1820 ****
              } else krb5_free_keytab_entry_contents(context, new);
          }
          if ((i = krb5_kt_end_seq_get(context, kt, cursor))) {
!             com_err(progname, i, "while ending keytab scan");
              code = i;
              goto cleanup;
          }
          if (best < 0) {
!             com_err(progname, code, "while scanning keytab");
              goto cleanup;
          }
          deref_keyblock_enctype(session_key) = deref_entry_enctype(entry);
--- 1599,1610 ----
              } else krb5_free_keytab_entry_contents(context, new);
          }
          if ((i = krb5_kt_end_seq_get(context, kt, cursor))) {
!             afs_com_err(progname, i, "while ending keytab scan");
              code = i;
              goto cleanup;
          }
          if (best < 0) {
!             afs_com_err(progname, code, "while scanning keytab");
              goto cleanup;
          }
          deref_keyblock_enctype(session_key) = deref_entry_enctype(entry);
***************
*** 1825,1831 ****
  #if USING_HEIMDAL
      if ((code = krb5_generate_random_keyblock(context,
  					      deref_keyblock_enctype(session_key), session_key))) {
!         com_err(progname, code, "while making session key");
          goto cleanup;
      }
      enc_tkt_reply->flags.initial = 1;
--- 1615,1621 ----
  #if USING_HEIMDAL
      if ((code = krb5_generate_random_keyblock(context,
  					      deref_keyblock_enctype(session_key), session_key))) {
!         afs_com_err(progname, code, "while making session key");
          goto cleanup;
      }
      enc_tkt_reply->flags.initial = 1;
***************
*** 1848,1854 ****
  #else
      if ((code = krb5_c_make_random_key(context,
  				       deref_keyblock_enctype(session_key), session_key))) {
!         com_err(progname, code, "while making session key");
          goto cleanup;
      }
      enc_tkt_reply->magic = KV5M_ENC_TKT_PART;
--- 1638,1644 ----
  #else
      if ((code = krb5_c_make_random_key(context,
  				       deref_keyblock_enctype(session_key), session_key))) {
!         afs_com_err(progname, code, "while making session key");
          goto cleanup;
      }
      enc_tkt_reply->magic = KV5M_ENC_TKT_PART;
***************
*** 1911,1922 ****
          ASN1_MALLOC_ENCODE(EncTicketPart, buf, buf_size,
  			   enc_tkt_reply, &buf_len, code);
          if(code) {
!             com_err(progname, code, "while encoding ticket");
              goto cleanup;
          }
  
          if(buf_len != buf_size) {
!             com_err(progname, code,
  		    "%d != %d while encoding ticket (internal ASN.1 encoder error",
  		    buf_len, buf_size);
              goto cleanup;
--- 1701,1712 ----
          ASN1_MALLOC_ENCODE(EncTicketPart, buf, buf_size,
  			   enc_tkt_reply, &buf_len, code);
          if(code) {
!             afs_com_err(progname, code, "while encoding ticket");
              goto cleanup;
          }
  
          if(buf_len != buf_size) {
!             afs_com_err(progname, code,
  		    "%d != %d while encoding ticket (internal ASN.1 encoder error",
  		    buf_len, buf_size);
              goto cleanup;
***************
*** 1934,1940 ****
          if (buf) free(buf);
          if (crypto) krb5_crypto_destroy(context, crypto);
          if(code) {
!             com_err(progname, code, "while %s", what);
              goto cleanup;
          }
      } /* crypto block */
--- 1724,1730 ----
          if (buf) free(buf);
          if (crypto) krb5_crypto_destroy(context, crypto);
          if(code) {
!             afs_com_err(progname, code, "while %s", what);
              goto cleanup;
          }
      } /* crypto block */
***************
*** 1946,1952 ****
      ticket_reply->server = service_principal;
      ticket_reply->enc_part2 = enc_tkt_reply;
      if ((code = krb5_encrypt_tkt_part(context, &deref_entry_keyblock(entry), ticket_reply))) {
!         com_err(progname, code, "while making ticket");
          goto cleanup;
      }
      ticket_reply->enc_part.kvno = entry->vno;
--- 1736,1742 ----
      ticket_reply->server = service_principal;
      ticket_reply->enc_part2 = enc_tkt_reply;
      if ((code = krb5_encrypt_tkt_part(context, &deref_entry_keyblock(entry), ticket_reply))) {
!         afs_com_err(progname, code, "while making ticket");
          goto cleanup;
      }
      ticket_reply->enc_part.kvno = entry->vno;
***************
*** 1956,1972 ****
  
      if ((code = krb5_copy_principal(context, service_principal,
  				    &creds->server))) {
!         com_err(progname, code, "while copying service principal");
          goto cleanup;
      }
      if ((code = krb5_copy_principal(context, client_principal,
  				    &creds->client))) {
!         com_err(progname, code, "while copying client principal");
          goto cleanup;
      }
      if ((code = krb5_copy_keyblock_contents(context, session_key,
  					    &deref_session_key(creds)))) {
!         com_err(progname, code, "while copying session key");
          goto cleanup;
      }
  
--- 1746,1762 ----
  
      if ((code = krb5_copy_principal(context, service_principal,
  				    &creds->server))) {
!         afs_com_err(progname, code, "while copying service principal");
          goto cleanup;
      }
      if ((code = krb5_copy_principal(context, client_principal,
  				    &creds->client))) {
!         afs_com_err(progname, code, "while copying client principal");
          goto cleanup;
      }
      if ((code = krb5_copy_keyblock_contents(context, session_key,
  					    &deref_session_key(creds)))) {
!         afs_com_err(progname, code, "while copying session key");
          goto cleanup;
      }
  
***************
*** 1984,1990 ****
          ;
      else if ((code = krb5_copy_addresses(context,
  					 deref_enc_tkt_addrs(enc_tkt_reply), &creds->addresses))) {
!         com_err(progname, code, "while copying addresses");
          goto cleanup;
      }
  
--- 1774,1780 ----
          ;
      else if ((code = krb5_copy_addresses(context,
  					 deref_enc_tkt_addrs(enc_tkt_reply), &creds->addresses))) {
!         afs_com_err(progname, code, "while copying addresses");
          goto cleanup;
      }
  
***************
*** 1994,2006 ****
  	ASN1_MALLOC_ENCODE(Ticket, creds->ticket.data, creds->ticket.length,
  			   ticket_reply, &creds_tkt_len, code);
  	if(code) {
! 	    com_err(progname, code, "while encoding ticket");
  	    goto cleanup;
  	}
      }
  #else
      if ((code = encode_krb5_ticket(ticket_reply, &temp))) {
! 	com_err(progname, code, "while encoding ticket");
  	goto cleanup;
      }
      creds->ticket = *temp;
--- 1784,1796 ----
  	ASN1_MALLOC_ENCODE(Ticket, creds->ticket.data, creds->ticket.length,
  			   ticket_reply, &creds_tkt_len, code);
  	if(code) {
! 	    afs_com_err(progname, code, "while encoding ticket");
  	    goto cleanup;
  	}
      }
  #else
      if ((code = encode_krb5_ticket(ticket_reply, &temp))) {
! 	afs_com_err(progname, code, "while encoding ticket");
  	goto cleanup;
      }
      creds->ticket = *temp;
***************
*** 2038,2043 ****
--- 1828,1838 ----
      krb5_creds increds;
      krb5_error_code r;
      static krb5_principal client_principal = 0;
+ 
+     if (dflag) {
+ 	printf("Getting tickets: %s%s%s@%s\n", name, (inst && inst[0])
+ 	       ? "/" : "", inst ? inst : "", realm);
+     }
      
      memset((char *)&increds, 0, sizeof(increds));
  /* ANL - instance may be ptr to a null string. Pass null then */
Index: openafs/src/aklog/asetkey.c
diff -c openafs/src/aklog/asetkey.c:1.4.2.9 openafs/src/aklog/asetkey.c:1.4.2.10
*** openafs/src/aklog/asetkey.c:1.4.2.9	Tue Mar 18 12:11:50 2008
--- openafs/src/aklog/asetkey.c	Tue Apr  1 13:44:52 2008
***************
*** 1,5 ****
  /*
!  * $Id: asetkey.c,v 1.4.2.9 2008/03/18 16:11:50 shadow Exp $
   *
   * asetkey - Manipulates an AFS KeyFile
   *
--- 1,5 ----
  /*
!  * $Id: asetkey.c,v 1.4.2.10 2008/04/01 17:44:52 shadow Exp $
   *
   * asetkey - Manipulates an AFS KeyFile
   *
***************
*** 110,116 ****
  
  	code = afsconf_AddKey(tdir, kvno, (char *) deref_key_contents(key), 1);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to set key, code %d.\n", argv[0], code);
  	    exit(1);
  	}
  	krb5_free_principal(context, principal);
--- 110,116 ----
  
  	code = afsconf_AddKey(tdir, kvno, (char *) deref_key_contents(key), 1);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to set key, code %ld.\n", argv[0], code);
  	    exit(1);
  	}
  	krb5_free_principal(context, principal);
***************
*** 126,132 ****
  	kvno = atoi(argv[2]);
  	code = afsconf_DeleteKey(tdir, kvno);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to delete key %d, (code %d)\n",
  		    argv[0], kvno, code);
  	    exit(1);
  	}
--- 126,132 ----
  	kvno = atoi(argv[2]);
  	code = afsconf_DeleteKey(tdir, kvno);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to delete key %ld, (code %ld)\n",
  		    argv[0], kvno, code);
  	    exit(1);
  	}
***************
*** 137,143 ****
  	
  	code = afsconf_GetKeys(tdir, &tkeys);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to get keys, code %d\n", argv[0], code);
  	    exit(1);
  	}
  	for(i=0;i<tkeys.nkeys;i++) {
--- 137,143 ----
  	
  	code = afsconf_GetKeys(tdir, &tkeys);
  	if (code) {
! 	    fprintf(stderr, "%s: failed to get keys, code %ld\n", argv[0], code);
  	    exit(1);
  	}
  	for(i=0;i<tkeys.nkeys;i++) {
Index: openafs/src/aklog/klog.c
diff -c openafs/src/aklog/klog.c:1.3.4.5 openafs/src/aklog/klog.c:1.3.4.6
*** openafs/src/aklog/klog.c:1.3.4.5	Thu Mar 27 14:48:59 2008
--- openafs/src/aklog/klog.c	Tue Apr  1 13:44:52 2008
***************
*** 30,38 ****
  
  #include <stdio.h>
  #include <pwd.h>
- #if 0
  #include <afs/com_err.h>
- #endif
  #include <afs/auth.h>
  #include <afs/afsutil.h>
  #include <afs/cellconfig.h>
--- 30,36 ----
***************
*** 51,57 ****
  #endif
  
  #include "assert.h"
! 
  
  /* This code borrowed heavily from the previous version of log.  Here is the
     intro comment for that program: */
--- 49,55 ----
  #endif
  
  #include "assert.h"
! #include "skipwrap.h"
  
  /* This code borrowed heavily from the previous version of log.  Here is the
     intro comment for that program: */
***************
*** 349,356 ****
      krb5_principal princ = 0;
      char *cell, *pname, **hrealms, *service;
      char service_temp[MAXKTCREALMLEN + 20];
-     char realm[MAXKTCREALMLEN];
-     char lrealm[MAXKTCREALMLEN];	/* uppercase copy of local cellname */
      krb5_creds incred[1], mcred[1], *outcred = 0, *afscred;
      krb5_ccache cc = 0;
      krb5_get_init_creds_opt gic_opts[1];
--- 347,352 ----
***************
*** 375,385 ****
      static int Pipe = 0;	/* reading from a pipe */
      static int Silent = 0;	/* Don't want error messages */
  
-     int local;			/* explicit cell is same a local one */
      int writeTicketFile = 0;	/* write ticket file to /tmp */
  
-     char *reason;		/* string describing errors */
- 
      service = 0;
      memset(incred, 0, sizeof *incred);
      /* blow away command line arguments */
--- 371,378 ----
***************
*** 433,439 ****
  	authtype |= env_afs_rxk5_default();
  #endif
  
!     cell = as->parms[aCELL].items ? cell = as->parms[aCELL].items->data : 0;
      if ((code = afsconf_GetCellInfo(tdir, cell, "afsprot", cellconfig))) {
  	if (cell)
  	    com_err(rn, code, "Can't get cell information for '%s'", cell);
--- 426,432 ----
  	authtype |= env_afs_rxk5_default();
  #endif
  
!     cell = as->parms[aCELL].items ? as->parms[aCELL].items->data : 0;
      if ((code = afsconf_GetCellInfo(tdir, cell, "afsprot", cellconfig))) {
  	if (cell)
  	    com_err(rn, code, "Can't get cell information for '%s'", cell);
Index: openafs/src/aklog/krb_util.c
diff -c openafs/src/aklog/krb_util.c:1.1.2.5 openafs/src/aklog/krb_util.c:1.1.2.6
*** openafs/src/aklog/krb_util.c:1.1.2.5	Sat Feb 10 08:56:54 2007
--- openafs/src/aklog/krb_util.c	Tue Apr  1 13:44:52 2008
***************
*** 9,18 ****
   * <mit-copyright.h>.
   */
  
! #ifndef lint
! static char rcsid_send_to_kdc_c[] =
! "$Id: krb_util.c,v 1.1.2.5 2007/02/10 13:56:54 jaltman Exp $";
! #endif /* lint */
  
  #if 0
  #include <kerberosIV/mit-copyright.h>
--- 9,17 ----
   * <mit-copyright.h>.
   */
  
! #include <afsconfig.h>
! RCSID
!     ("$Header: /cvs/openafs/src/aklog/krb_util.c,v 1.1.2.6 2008/04/01 17:44:52 shadow Exp $");
  
  #if 0
  #include <kerberosIV/mit-copyright.h>
***************
*** 25,42 ****
  #define MAX_HSTNM 100
  #endif
  
- #ifdef WINDOWS
- 
- #include "aklog.h"		/* for struct afsconf_cell */
- 
- #else /* !WINDOWS */
- 
- #include <afs/param.h>
  #include <afs/cellconfig.h>
  
- #endif /* WINDOWS */
- 
  #include <string.h>
  
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
--- 24,33 ----
  #define MAX_HSTNM 100
  #endif
  
  #include <afs/cellconfig.h>
  
  #include <string.h>
+ #include <ctype.h>
  
  #define S_AD_SZ sizeof(struct sockaddr_in)
  
***************
*** 61,68 ****
  		*p = toupper(*p);
  	}
      } else {
! 	if (retval = krb5_get_host_realm(context,
! 					 cellconfig->hostName[0], &hrealms))
  	    return 0; 
  	if(!hrealms[0]) return 0;
  	strcpy(krbrlm, hrealms[0]);
--- 52,59 ----
  		*p = toupper(*p);
  	}
      } else {
! 	if ((retval = krb5_get_host_realm(context,
! 					 cellconfig->hostName[0], &hrealms)))
  	    return 0; 
  	if(!hrealms[0]) return 0;
  	strcpy(krbrlm, hrealms[0]);
Index: openafs/src/aklog/linked_list.c
diff -c openafs/src/aklog/linked_list.c:1.1.2.2 openafs/src/aklog/linked_list.c:1.1.2.3
*** openafs/src/aklog/linked_list.c:1.1.2.2	Fri Jul 15 12:11:24 2005
--- openafs/src/aklog/linked_list.c	Tue Apr  1 13:44:52 2008
***************
*** 1,5 ****
  /* 
!  * $Id: linked_list.c,v 1.1.2.2 2005/07/15 16:11:24 rra Exp $
   * 
   * This file contains general linked list routines.
   * 
--- 1,5 ----
  /* 
!  * $Id: linked_list.c,v 1.1.2.3 2008/04/01 17:44:52 shadow Exp $
   * 
   * This file contains general linked list routines.
   * 
***************
*** 7,15 ****
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
! #if !defined(lint) && !defined(SABER)
! static char *rcsid_list_c = "$Id: linked_list.c,v 1.1.2.2 2005/07/15 16:11:24 rra Exp $";
! #endif /* lint || SABER */
  
  #include <stdio.h>
  #include <stdlib.h>
--- 7,15 ----
   * For distribution and copying rights, see the file "mit-copyright.h"
   */
  
! #include <afsconfig.h>
! RCSID
!     ("$Header: /cvs/openafs/src/aklog/linked_list.c,v 1.1.2.3 2008/04/01 17:44:52 shadow Exp $");
  
  #include <stdio.h>
  #include <stdlib.h>
***************
*** 46,56 ****
      }
  
      /* This sets everything to zero, which is what we want. */
- #ifdef WINDOWS
- 	memset(list, 0, sizeof(linked_list));
- #else
      bzero((char *)list, sizeof(linked_list));
- #endif /* WINDOWS */
  }
  
  ll_node *ll_add_node(linked_list *list, ll_end which_end)
--- 46,52 ----
***************
*** 164,173 ****
        case ll_s_add:
  	/* Add a string to the list. */
  	if (!ll_string(list, ll_s_check, string)) {
! 	    if (cur_node = ll_add_node(list, ll_tail)) {
  		char *new_string;
! 		if (new_string = (char *)calloc(strlen(string) + 1, 
! 						sizeof(char))) {
  		    strcpy(new_string, string);
  		    ll_add_data(cur_node, new_string);
  		}
--- 160,169 ----
        case ll_s_add:
  	/* Add a string to the list. */
  	if (!ll_string(list, ll_s_check, string)) {
! 	    if ((cur_node = ll_add_node(list, ll_tail))) {
  		char *new_string;
! 		if ((new_string = (char *)calloc(strlen(string) + 1, 
! 						sizeof(char)))) {
  		    strcpy(new_string, string);
  		    ll_add_data(cur_node, new_string);
  		}
Index: openafs/src/aklog/linked_list.h
diff -c openafs/src/aklog/linked_list.h:1.1.2.1 openafs/src/aklog/linked_list.h:1.1.2.2
*** openafs/src/aklog/linked_list.h:1.1.2.1	Tue Dec  7 00:51:24 2004
--- openafs/src/aklog/linked_list.h	Tue Apr  1 13:44:52 2008
***************
*** 1,5 ****
  /* 
!  * $Id: linked_list.h,v 1.1.2.1 2004/12/07 05:51:24 shadow Exp $
   *
   * This is the header file for a general list linked package.
   * 
--- 1,5 ----
  /* 
!  * $Id: linked_list.h,v 1.1.2.2 2008/04/01 17:44:52 shadow Exp $
   *
   * This is the header file for a general list linked package.
   * 
***************
*** 10,19 ****
  #ifndef __LINKED_LIST_H__
  #define __LINKED_LIST_H__
  
- #if !defined(lint) && !defined(SABER)
- static char *rcsid_linked_list_h = "$Id: linked_list.h,v 1.1.2.1 2004/12/07 05:51:24 shadow Exp $";
- #endif /* lint || SABER */
- 
  #define LL_SUCCESS 0
  #define LL_FAILURE -1
  
--- 10,15 ----
Index: openafs/src/aklog/skipwrap.c
diff -c openafs/src/aklog/skipwrap.c:1.1.12.2 openafs/src/aklog/skipwrap.c:1.1.12.3
*** openafs/src/aklog/skipwrap.c:1.1.12.2	Thu Nov  1 12:51:58 2007
--- openafs/src/aklog/skipwrap.c	Tue Apr  1 13:44:52 2008
***************
*** 34,39 ****
--- 34,40 ----
  #include <stdio.h>
  #include <aklog.h>
  #include <krb5.h>
+ #include "skipwrap.h"
  
  /* evil hack */
  #define SEQUENCE 16
Index: openafs/src/aklog/skipwrap.h
diff -c /dev/null openafs/src/aklog/skipwrap.h:1.1.4.2
*** /dev/null	Mon Apr  7 16:52:25 2008
--- openafs/src/aklog/skipwrap.h	Tue Apr  1 13:44:52 2008
***************
*** 0 ****
--- 1,8 ----
+ #ifndef _AKLOG_SKIPWRAP_H
+ #define _AKLOG_SKIPWRAP_H
+ 
+ int afs_krb5_skip_ticket_wrapper(char *tix, size_t tixlen, char **enc, 
+ 				 size_t *enclen);
+ 
+ #endif
+ 
Index: openafs/src/cf/linux-test4.m4
diff -c openafs/src/cf/linux-test4.m4:1.20.2.44 openafs/src/cf/linux-test4.m4:1.20.2.46
*** openafs/src/cf/linux-test4.m4:1.20.2.44	Mon Mar 10 15:05:28 2008
--- openafs/src/cf/linux-test4.m4	Sun Apr  6 23:49:12 2008
***************
*** 72,81 ****
    AC_MSG_CHECKING([for exported init_mm])
    AC_CACHE_VAL([ac_cv_linux_exports_init_mm], [
      AC_TRY_KBUILD(
! [#include <linux/modversions.h>],
! [#ifndef __ver_init_mm
! #error init_mm not exported
! #endif],
        ac_cv_linux_exports_init_mm=yes,
        ac_cv_linux_exports_init_mm=no)])
    AC_MSG_RESULT($ac_cv_linux_exports_init_mm)])
--- 72,80 ----
    AC_MSG_CHECKING([for exported init_mm])
    AC_CACHE_VAL([ac_cv_linux_exports_init_mm], [
      AC_TRY_KBUILD(
! [extern struct mm_struct init_mm;],
! [void *address = &init_mm;
! printk("%p\n", address);],
        ac_cv_linux_exports_init_mm=yes,
        ac_cv_linux_exports_init_mm=no)])
    AC_MSG_RESULT($ac_cv_linux_exports_init_mm)])
Index: openafs/src/packaging/RedHat/openafs.spec.in
diff -c openafs/src/packaging/RedHat/openafs.spec.in:1.1.2.18 openafs/src/packaging/RedHat/openafs.spec.in:1.1.2.19
*** openafs/src/packaging/RedHat/openafs.spec.in:1.1.2.18	Wed Feb 13 00:31:02 2008
--- openafs/src/packaging/RedHat/openafs.spec.in	Mon Apr  7 16:27:31 2008
***************
*** 1,11 ****
! # Openafs Spec $Revision: 1.1.2.18 $
  
  %define afsvers @VERSION@
  %define pkgvers @VERSION@
  # for beta/rc releases make pkgrel 0.X.<tag>
  # for real releases make pkgrel 1 (or more for extra releases)
  #%define pkgrel 0.1.rc1
! %define pkgrel 1
  
  %if %{?osvers:0}%{!?osvers:1}
  %define osvers 1
--- 1,11 ----
! # Openafs Spec $Revision: 1.1.2.19 $
  
  %define afsvers @VERSION@
  %define pkgvers @VERSION@
  # for beta/rc releases make pkgrel 0.X.<tag>
  # for real releases make pkgrel 1 (or more for extra releases)
  #%define pkgrel 0.1.rc1
! %define pkgrel @LINUX_VERSION@
  
  %if %{?osvers:0}%{!?osvers:1}
  %define osvers 1
Index: openafs/src/tests/Makefile.in
diff -c openafs/src/tests/Makefile.in:1.12.2.2 openafs/src/tests/Makefile.in:1.12.2.3
*** openafs/src/tests/Makefile.in:1.12.2.2	Mon Jan 21 14:50:32 2008
--- openafs/src/tests/Makefile.in	Mon Mar 31 11:53:48 2008
***************
*** 359,365 ****
  
  uninstall:
  
! all: run-tests dirpath.conf OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
  	afsdump_scan afsdump_dirlist afsdump_extract dumptool
  	@chmod +x run-tests
  
--- 359,365 ----
  
  uninstall:
  
! all: run-tests OpenAFS/Dirpath.pm libxfiles.a libdumpscan.a $(TEST_PROGRAMS)\
  	afsdump_scan afsdump_dirlist afsdump_extract dumptool
  	@chmod +x run-tests
  
***************
*** 378,402 ****
  check-fast: run-tests $(TEST_PROGRAMS)
  	./run-tests -all -fast
  
! dirpath.conf: Makefile
! 	@echo "creating $@"
! 	@echo "# auto-generated by src/tests/Makefile"      >$@
! 	@echo "# DO NOT EDIT"                               >>$@
! 	@echo "afsconfdir=@afsconfdir@"                     >>$@
! 	@echo "viceetcdir=@viceetcdir@"                     >>$@
! 	@echo "afssrvbindir=@afssrvbindir@"                 >>$@
! 	@echo "afssrvsbindir=@afssrvsbindir@"               >>$@
! 	@echo "afssrvlibexecdir=@afssrvlibexecdir@"         >>$@
! 	@echo "afsdbdir=@afsdbdir@"                         >>$@
! 	@echo "afslogsdir=@afslogsdir@"                     >>$@
! 	@echo "afslocaldir=@afslocaldir@"                   >>$@
! 	@echo "afsbackupdir=@afsbackupdir@"                 >>$@
! 	@echo "afsbosconfigdir=@afsbosconfigdir@"           >>$@
! 	@echo "afskerneldir=@afskerneldir@"                 >>$@
! 	@echo "initdir=@sysconfdir@"                        >>$@
! 	@echo "localstatedir=@localstatedir@"               >>$@
! 	@echo "ostype=@MKAFS_OSTYPE@"                       >>$@
! 
  OpenAFS/Dirpath.pm: Makefile
  	@echo "Creating OpenAFS/Dirpath.pm"
  	@echo "# This is -*- perl -*-"                          >$@
--- 378,386 ----
  check-fast: run-tests $(TEST_PROGRAMS)
  	./run-tests -all -fast
  
! # Note: The autoconf variables are not fully expanded
! #       until make is run so we resort to creating the
! #       configuration at make time.
  OpenAFS/Dirpath.pm: Makefile
  	@echo "Creating OpenAFS/Dirpath.pm"
  	@echo "# This is -*- perl -*-"                          >$@
***************
*** 420,431 ****
  	@echo "  'afslocaldir'      => '@afslocaldir@',"        >>$@
  	@echo "  'afsbackupdir'     => '@afsbackupdir@',"       >>$@
  	@echo "  'afsbosconfigdir'  => '@afsbosconfigdir@',"    >>$@
- 	@echo "  'afskerneldir'     => '@afskerneldir@',"       >>$@
- 	@echo "  'initdir'          => '@sysconfdir@',"         >>$@
- 	@echo "  'localstatedir'    => '@localstatedir@',"      >>$@
  	@echo "  'ostype'           => '@MKAFS_OSTYPE@',"       >>$@
  	@echo "};"                                              >>$@
  	@echo ""                                                >>$@
  	@echo "1;"                                              >>$@
  
  .PHONY:		all install clean realclean distclean mostlyclean install uninstall check
--- 404,428 ----
  	@echo "  'afslocaldir'      => '@afslocaldir@',"        >>$@
  	@echo "  'afsbackupdir'     => '@afsbackupdir@',"       >>$@
  	@echo "  'afsbosconfigdir'  => '@afsbosconfigdir@',"    >>$@
  	@echo "  'ostype'           => '@MKAFS_OSTYPE@',"       >>$@
+ 	@if test "@afsconfdir@" = "/usr/afs/etc" ; then \
+ 		echo "  # transarc paths" ;\
+ 		echo "  'cachedir'     => '/usr/vice/cache'," ;\
+ 		echo "  'afsddir'      => '/usr/vice/etc'," ;\
+ 		echo "  'initdir'      => '/usr/vice/etc',"  ;\
+ 		echo "  'afskerneldir' => '/usr/vice/etc/modload'," ;\
+ 		echo "  'afswsbindir'  => '/usr/afsws/bin'," ;\
+ 	else \
+ 		echo "  # modern paths" ;\
+ 		echo "  'cachedir'     => '@localstatedir@/openafs/cache'," ;\
+ 		echo "  'afsddir'      => '@afssrvsbindir@'," ;\
+ 		echo "  'initdir'      => '@sysconfdir@',"  ;\
+ 		echo "  'afskerneldir' => '@afskerneldir@'," ;\
+ 		echo "  'afswsbindir'  => '@afssrvbindir@'," ;\
+ 	fi >>$@
  	@echo "};"                                              >>$@
  	@echo ""                                                >>$@
  	@echo "1;"                                              >>$@
  
+ 
  .PHONY:		all install clean realclean distclean mostlyclean install uninstall check
Index: openafs/src/tests/afs-newcell.pl
diff -c openafs/src/tests/afs-newcell.pl:1.1.10.1 openafs/src/tests/afs-newcell.pl:1.1.10.2
*** openafs/src/tests/afs-newcell.pl:1.1.10.1	Mon Jan 21 14:50:32 2008
--- openafs/src/tests/afs-newcell.pl	Mon Mar 31 11:53:48 2008
***************
*** 12,49 ****
  use OpenAFS::Auth;
  use Getopt::Long;
  use Pod::Usage;
  
  =head1  NAME
  
!    afs-newcell - Set up initial database server for AFS cell.
  
  =head1 SYNOPSIS
  
  B<afs-newcell>
!        B<--batch>
!        B<--debug>
!        B<--dont-unwind>
!        B<--help>
!        B<--ostype>=os
!        B<--server>=hostname
!        B<--cellname>=cell
!        B<--partition>=partition
!        B<--admin>=administrator
!        B<--kerberos-type>=authentication_type
!        B<--kerberos-realm>=realm_name
!        B<--kerberos-keytab>=keytab_file
!        B<--skip-make-keyfile>
!        B<--with-dafs>
!        B<--options-fileserver>=options
!        B<--options-volserver>=options
!        B<--options-salvageserver>=options
! 	   B<--options-salvager>=options 
  
  =head1 DESCRIPTION
  
  This script sets up the initial AFS database and configures the first
! database/file server. It also sets up an AFS cell's root volumes.  It assumes
! that you already have a fileserver and database servers installed.  The
  fileserver should have an empty root.afs. This script creates root.cell, user,
  service and populates root.afs.  
  
--- 12,50 ----
  use OpenAFS::Auth;
  use Getopt::Long;
  use Pod::Usage;
+ use Socket;
  
  =head1  NAME
  
!    afs-newcell - Set up the initial database and file server for a new OpenAFS cell.
  
  =head1 SYNOPSIS
  
  B<afs-newcell>
!        [ B<--batch> ]
!        [ B<--debug> ]
!        [ B<--unwind> ]
!        [ B<--help> ]
!        [ B<--server>=hostname ]
!        [ B<--cellname>=cell ]
!        [ B<--partition>=partition ]
!        [ B<--admin>=administrator ]
!        [ B<--kerberos-type>=authentication_type ]
!        [ B<--kerberos-realm>=realm_name ]
!        [ B<--kerberos-keytab>=keytab_file ]
!        [ B<--with-dafs> ]
!        [ B<--options-ptserver>=options ]
!        [ B<--options-vlserver>=options ]
!        [ B<--options-fileserver>=options ]
!        [ B<--options-volserver>=options ] 
!        [ B<--options-salvageserver>=options ]
!        [ B<--options-salvager>=options ]
  
  =head1 DESCRIPTION
  
  This script sets up the initial AFS database and configures the first
! database/file server. It also sets up an AFS cell's root volumes.  The
! fileserver and database server binaries must already be installed.  The
  fileserver should have an empty root.afs. This script creates root.cell, user,
  service and populates root.afs.  
  
***************
*** 88,94 ****
  You will need an administrative principal created in a Kerberos realm.  This
  principal will be added to system:administrators and thus will be able to run
  administrative commands.  Generally the user is a root instance of some
! administravie user.  For example if jruser is an administrator then it would be
  reasonable to create jruser/root and specify jruser/root as the user to be
  added in this script using the 'admin' command line option.  You will also need
  to create a keyfile for this adminstrative user which is used by the script to
--- 89,95 ----
  You will need an administrative principal created in a Kerberos realm.  This
  principal will be added to system:administrators and thus will be able to run
  administrative commands.  Generally the user is a root instance of some
! administrative user.  For example if jruser is an administrator then it would be
  reasonable to create jruser/root and specify jruser/root as the user to be
  added in this script using the 'admin' command line option.  You will also need
  to create a keyfile for this adminstrative user which is used by the script to
***************
*** 125,141 ****
  #
  sub mkvol($$$$) {
      my ($vol, $mnt, $srv, $part) = @_;
!     run("$path->{'afssrvsbindir'}/vos create $srv $part $vol -maxquota 0 -localauth");
!     unwind("$path->{'afssrvsbindir'}/vos remove $srv $part $vol -localauth");
!     run("$path->{'afssrvbindir'}/fs mkm $mnt $vol ");
!     run("$path->{'afssrvbindir'}/fs sa $mnt system:anyuser rl");
  }
  
  #-----------------------------------------------------------------------------------
  # check_program($prog) - verify the program is installed.
  #
  sub check_program($) {
!     my ($program) = @_;
    unless ( -f $program ) {
       die "error: Missing program: $program\n";
    }
--- 126,142 ----
  #
  sub mkvol($$$$) {
      my ($vol, $mnt, $srv, $part) = @_;
!     run("$path->{'afssrvsbindir'}/vos create $srv $part $vol -maxquota 0");
!     unwind("$path->{'afssrvsbindir'}/vos remove $srv $part $vol");
!     run("$path->{'afssrvbindir'}/fs mkmount $mnt $vol ");
!     run("$path->{'afssrvbindir'}/fs setacl $mnt system:anyuser rl");
  }
  
  #-----------------------------------------------------------------------------------
  # check_program($prog) - verify the program is installed.
  #
  sub check_program($) {
!   my ($program) = @_;
    unless ( -f $program ) {
       die "error: Missing program: $program\n";
    }
***************
*** 150,181 ****
  # options
  my $batch = 0;
  my $debug = 0;
! my $dont_unwind = 0;
  my $help = 0;
- my $ostype = $path->{'ostype'};
- my $server = 'localhost';
  my $cellname = 'testcell';
! my $partition = '/vicepa';
  my $admin = 'admin';
  my $kerberos_type = 'MIT';
  my $kerberos_realm = 'TESTCELL';
  my $kerberos_keytab = "$path->{'afsconfdir'}/krb5.keytab";
- my $skip_make_keyfile = 0;
  my $with_dafs = 0;
  my $options_fileserver = '';
  my $options_volserver = '';
  my $options_salvageserver = '';
  my $options_salvager = '';
  
! $server = `hostname`;
  chomp $server;
  
  GetOptions (
!        "batch" => \$batch, 
         "debug!" => \$debug,
!        "dont-unwind!" => \$dont_unwind,
         "help" => \$help,
-        "ostype=s" => \$ostype,
         "server=s" => \$server,
         "cellname=s" => \$cellname, 
         "partition=s" => \$partition,
--- 151,180 ----
  # options
  my $batch = 0;
  my $debug = 0;
! my $unwind = 1;
  my $help = 0;
  my $cellname = 'testcell';
! my $partition = 'a';
  my $admin = 'admin';
  my $kerberos_type = 'MIT';
  my $kerberos_realm = 'TESTCELL';
  my $kerberos_keytab = "$path->{'afsconfdir'}/krb5.keytab";
  my $with_dafs = 0;
+ my $options_ptserver = '';
+ my $options_vlserver = '';
  my $options_fileserver = '';
  my $options_volserver = '';
  my $options_salvageserver = '';
  my $options_salvager = '';
  
! my $server = `hostname -f`;
  chomp $server;
  
  GetOptions (
!        "batch!" => \$batch, 
         "debug!" => \$debug,
!        "unwind!" => \$unwind,
         "help" => \$help,
         "server=s" => \$server,
         "cellname=s" => \$cellname, 
         "partition=s" => \$partition,
***************
*** 183,190 ****
         "kerberos-type=s" => \$kerberos_type,
         "kerberos-realm=s" => \$kerberos_realm,
         "kerberos-keytab=s" => \$kerberos_keytab,
-        "skip-make-keyfile" => \$skip_make_keyfile,
         "with-dafs" => \$with_dafs,
         "options-fileserver=s" => \$options_fileserver,
         "options-volserver=s" => \$options_volserver,
         "options-salvageserver=s" => \$options_salvageserver,
--- 182,190 ----
         "kerberos-type=s" => \$kerberos_type,
         "kerberos-realm=s" => \$kerberos_realm,
         "kerberos-keytab=s" => \$kerberos_keytab,
         "with-dafs" => \$with_dafs,
+        "options-ptserver=s" => \$options_ptserver,
+        "options-vlserver=s" => \$options_vlserver,
         "options-fileserver=s" => \$options_fileserver,
         "options-volserver=s" => \$options_volserver,
         "options-salvageserver=s" => \$options_salvageserver,
***************
*** 196,212 ****
    exit 0;
  }
  
! # print debug messages when running commands.
  $OpenAFS::ConfigUtils::debug = $debug;
  
! #
! # Verify we have a clean slate before starting.
  #
  my @problems = ();
  my $try_rm_cell = 0;
  
  if ($> != 0) {
!   push(@problems, "This script should run as root.");
  }
  
  my @afsconfigfiles = (
--- 196,212 ----
    exit 0;
  }
  
! # To print debug messages in the run() calls.
  $OpenAFS::ConfigUtils::debug = $debug;
  
! #-----------------------------------------------------------------------------
! # Prereq: Must be root and must not already have a cell configuration.
  #
  my @problems = ();
  my $try_rm_cell = 0;
  
  if ($> != 0) {
!   push(@problems, "You must be root to run this script.");
  }
  
  my @afsconfigfiles = (
***************
*** 215,220 ****
--- 215,222 ----
    "$path->{'afsconfdir'}/UserList",
    "$path->{'afsdbdir'}/prdb.DB0",
    "$path->{'afsbosconfigdir'}/BosConfig",
+   "$path->{'afsddir'}/ThisCell",
+   "$path->{'afsddir'}/CellServDB",
  );
  foreach my $configfile (@afsconfigfiles) {
    if ( -f $configfile ) {
***************
*** 231,238 ****
    exit 1;
  }
  
! #
! # Interactive mode
  #
  unless ($batch) {
  
--- 233,240 ----
    exit 1;
  }
  
! #-----------------------------------------------------------------------------
! # Prereq: System requirements notification.
  #
  unless ($batch) {
  
***************
*** 246,265 ****
     the --partition option for alternative mount points.)
  
  2) The OpenAFS client and server binaries must be installed.
!    The init scripts to start and stop the client and servers 
!    must be installed and configured. OpenAFS/OS.pm must be 
!    configured for your system. There should be no remants
!    from a previous cell. Run afs-rmcell to remove any.
  
! 3) A Kerberos realm with Kerberos4 support must be available.
     Supported Kerberos implementations are Heimdal with
     Kth-kerberos compatibility, MIT Kerberos 5, and 
!    Kaserver (deprecated). OpenAFS/Auth.pm must be configured
!    for your system.
  
  4) A Kerberos keytab file containing the afs principal 
!    and the administrator principal must be be present at
!    $path->{'afsconfdir'}/krb5.keytab.
     See the asetkey man page for information about creating the
     keytab file.  The default name of the administrator 
     principal is 'admin'. See the --admin option for
--- 248,263 ----
     the --partition option for alternative mount points.)
  
  2) The OpenAFS client and server binaries must be installed.
!    There should be no remnants from a previous cell. 
!    Run afs-rmcell to remove any.
  
! 3) A Kerberos realm with Kerberos 4 support must be available.
     Supported Kerberos implementations are Heimdal with
     Kth-kerberos compatibility, MIT Kerberos 5, and 
!    Kaserver (deprecated). 
  
  4) A Kerberos keytab file containing the afs principal 
!    and the administrator principal must be be present.
     See the asetkey man page for information about creating the
     keytab file.  The default name of the administrator 
     principal is 'admin'. See the --admin option for
***************
*** 270,356 ****
    my $answer = prompt("Does your system meet these requirements? (yes/no)", "no");
    unless ($answer=~/^y/i ) {
      print "OK: Aborted.\n";
!   exit 0;
    }
  
!   print "\nServer options:\n"; 
!   $ostype = prompt("Which OS?", $ostype);
!   $server = prompt("What server name should be used?", $server);
!   $cellname = prompt("What cellname should be used?", $cellname);
!   $partition = prompt("What vice partition?", $partition);
!   $admin = prompt("What administrator username?", $admin);
!   if($admin =~ /@/) {
!     die "error: Please specify the username without the realm name.\n";
!   }
  
!   print "\nKerberos options:\n";
!   $kerberos_type = prompt("Which Kerberos is to be used?", $kerberos_type);
!   if ($kerberos_type!~/kaserver/i) {
!     $kerberos_realm  = prompt("What Kerberos realm?", $kerberos_realm);
!     $kerberos_keytab = prompt("What keytab file?", $kerberos_keytab);
!     $answer = prompt("Create OpenAFS KeyFile from a keytab? (yes/no)", "yes");
!     $skip_make_keyfile = ($answer=~/^y/i) ? 0 : 1;
!   }
! 
!   print "\nFileserver options:\n";
!   $answer = prompt("Use DAFS fileserver (requires DAFS build option)? (yes/no)", "no");
!   $with_dafs = ($answer=~/^y/i) ? 1 : 0;
!   $options_fileserver = prompt("fileserver options:", $options_fileserver);
!   $options_volserver = prompt("volserver options:",  $options_volserver);
!   $options_salvageserver = prompt("salvageserver options:",  $options_salvageserver);
!   $options_salvager = prompt("salvager options:", $options_salvager);
! 
!   print "\nConfirmation:\n";
!   print "OS Type                : $ostype\n";
!   print "Server name            : $server\n";
!   print "Cell name              : $cellname\n";
!   print "Partition              : $partition\n";
!   print "Administrator          : $admin\n";
!   print "Kerberos               : $kerberos_type\n";
!   if ($kerberos_type!~/kaserver/i) {
!     print "Realm                  : $kerberos_realm\n";
!     print "Keytab file            : $kerberos_keytab\n";
!     print "Make KeyFile           : ", $skip_make_keyfile ? "yes" : "no", "\n";
!   }
!   print "DAFS fileserver        : ", $with_dafs ? "yes" : "no", "\n";
!   print "fileserver options     : $options_fileserver\n";
!   print "volserver options      : $options_volserver\n";
!   print "salvagerserver options : $options_salvageserver\n";
!   print "salvager options       : $options_salvager\n";
!   print "\n";
  
!   $answer = prompt("Continue? (yes/no)", "yes");
!   unless ($answer=~/^y/i ) {
!     print "OK: Aborted.\n";
!   exit 0;
    }
  
!   # Save the options for the next time.
!   $answer = prompt("Save as command-line options? (yes/no)", "yes");
    if ($answer=~/^y/i ) {
!     my $switches = "";
!     $switches .= "--batch";
!     $switches .= " --debug"                                          if $debug;
!     $switches .= " --dont_unwind"                                    if $dont_unwind;
!     $switches .= " --ostype='$ostype'"                               if $ostype;
!     $switches .= " --server='$server'"                               if $server;
!     $switches .= " --cellname='$cellname'"                           if $cellname;
!     $switches .= " --partition='$partition'"                         if $partition;
!     $switches .= " --admin='$admin'"                                 if $admin;
!     $switches .= " --kerberos-type='$kerberos_type'"                 if $kerberos_type;
!     $switches .= " --kerberos-realm='$kerberos_realm'"               if $kerberos_realm;
!     $switches .= " --kerberos-keytab='$kerberos_keytab'"             if $kerberos_keytab;
!     $switches .= " --skip-make-keyfile"                              if $skip_make_keyfile;
!     $switches .= " --with-dafs"                                      if $with_dafs;
!     $switches .= " --options-fileserver='$options_fileserver'"       if $options_fileserver;
!     $switches .= " --options-volserver='$options_volserver'"         if $options_volserver;;
!     $switches .= " --options-salvageserver='$options_salvageserver'" if $options_salvageserver;;
!     $switches .= " --options-salvager='$options_salvager'"           if $options_salvager;
    
!     my $conf = prompt("Filename for save?", "afs-newcell.conf");
!     open(CONF, "> $conf") or die "error: Cannot open file $conf: $!\n";
!     print CONF "$switches\n";
!     close CONF;
    }
  }
  
--- 268,421 ----
    my $answer = prompt("Does your system meet these requirements? (yes/no)", "no");
    unless ($answer=~/^y/i ) {
      print "OK: Aborted.\n";
!     exit 0;
    }
+ }
  
! #-----------------------------------------------------------------------------
! # Prereq: Verify required binaries, directories, and permissions.
! #
! my $bosserver = "$path->{'afssrvsbindir'}/bosserver";
! my $bos       = "$path->{'afssrvbindir'}/bos";
! my $fs        = "$path->{'afssrvbindir'}/fs";
! my $pts       = "$path->{'afssrvbindir'}/pts";
! my $vos       = "$path->{'afssrvsbindir'}/vos";
! my $afsrc     = "$path->{'initdir'}/afs.rc";
! my $aklog     = "$path->{'afswsbindir'}/aklog";
! my $tokens    = "$path->{'afswsbindir'}/tokens";
! my $klog      = "$path->{'afswsbindir'}/klog";
! my $kas       = "$path->{'afssrvsbindir'}/kas";
  
! check_program($bosserver);
! check_program($bos);
! check_program($fs);
! check_program($pts);
! check_program($vos);
! check_program($afsrc);
! check_program($tokens);
  
! #-----------------------------------------------------------------------------
! # Prereq: Cell configuration
! #
! if ($batch) {
!   if ($kerberos_type!~/kaserver/i) {
!     check_program($aklog);
!     unless ( -f $kerberos_keytab ) {
!       die "error: Missing keytab file: $kerberos_keytab\n";
!     }
!   }
! }
! else {
!   my $answer;
!   get_options: {
!     $answer = prompt("Print afs-newcell debugging messages? (yes/no)", $debug ? "yes" : "no");
!     $debug = ($answer=~/^y/i) ? 1 : 0;
! 
!     print "\nServer options:\n"; 
!     $server = prompt("What server name should be used?", $server);
!     $cellname = prompt("What cellname should be used?", $cellname);
!     $partition = prompt("What vice partition?", $partition);
!     $admin = prompt("What administrator username?", $admin);
!     if($admin =~ /@/) {
!       die "error: Please specify the username without the realm name.\n";
!     }
!   
!     print "\nKerberos options:\n";
!     $kerberos_type = prompt("Which Kerberos is to be used?", $kerberos_type);
!     if ($kerberos_type=~/kaserver/i) {
!       check_program($klog);
!       check_program($kas);
!     }
!     else {
!       check_program($aklog);
!       $kerberos_realm = $cellname;
!       $kerberos_realm =~ tr/a-z/A-Z/;
!       $kerberos_realm = prompt("What Kerberos realm?", $kerberos_realm);
!       get_keytab: {
!         $kerberos_keytab = prompt("What keytab file?", $kerberos_keytab);
!         unless ( -f $kerberos_keytab ) {
!           print "Cannot find keytab file $kerberos_keytab\n";
!           redo get_keytab;
!         }
!       }
!     }
!   
!     print "\nDatabase Server options:\n";
!     $options_ptserver = prompt("ptserver options:", $options_ptserver);
!     $options_vlserver = prompt("vlserver options:", $options_vlserver);
! 
!     print "\nFileserver options:\n";
!     $answer = prompt("Use DAFS fileserver (requires DAFS build option)? (yes/no)", "no");
!     $with_dafs = ($answer=~/^y/i) ? 1 : 0;
!     $options_fileserver = prompt("fileserver options:", $options_fileserver);
!     $options_volserver = prompt("volserver options:",  $options_volserver);
!     $options_salvageserver = prompt("salvageserver options:",  $options_salvageserver);
!     $options_salvager = prompt("salvager options:", $options_salvager);
!   
!     print "\nConfirmation:\n";
!     print "Server name            : $server\n";
!     print "Cell name              : $cellname\n";
!     print "Partition              : $partition\n";
!     print "Administrator          : $admin\n";
!     print "Kerberos               : $kerberos_type\n";
!     if ($kerberos_type!~/kaserver/i) {
!       print "Realm                  : $kerberos_realm\n";
!       print "Keytab file            : $kerberos_keytab\n";
!     }
!     print "DAFS fileserver        : ", $with_dafs ? "yes" : "no", "\n";
!     print "ptserver options       : $options_ptserver\n";
!     print "vlserver options       : $options_vlserver\n";
!     print "fileserver options     : $options_fileserver\n";
!     print "volserver options      : $options_volserver\n";
!     print "salvagerserver options : $options_salvageserver\n";
!     print "salvager options       : $options_salvager\n";
!     print "\n";
!   
!     $answer = prompt("Correct? (yes/no/quit)", "yes");
!     exit(0)          if $answer=~/^q/i;
!     redo get_options if $answer!~/^y/i;
    }
  
!   # Save the options as a shell script for the next run.
!   $answer = prompt("Save these options? (yes/no)", "yes");
    if ($answer=~/^y/i ) {
!     my $script = '';
!     get_script_name: {
!       $script = prompt("File name for save?", "run-afs-newcell.sh");
!       last get_script_name if ! -f $script;
! 
!       $answer = prompt("File $script already exists. Overwrite? (yes/no/quit)", "no");
!       exit(0)              if $answer=~/^q/i;
!       last get_script_name if $answer=~/^yes/i;
!       redo get_script_name;
!     }
! 
!     my @switches = ();
!     push(@switches, "--batch"); # automatically added to the script
!     push(@switches, "--debug")                                          if $debug;
!     push(@switches, "--nounwind")                                       unless $unwind;
!     push(@switches, "--server='$server'")                               if $server;
!     push(@switches, "--cellname='$cellname'")                           if $cellname;
!     push(@switches, "--partition='$partition'")                         if $partition;
!     push(@switches, "--admin='$admin'")                                 if $admin;
!     push(@switches, "--kerberos-type='$kerberos_type'")                 if $kerberos_type;
!     push(@switches, "--kerberos-realm='$kerberos_realm'")               if $kerberos_realm;
!     push(@switches, "--kerberos-keytab='$kerberos_keytab'")             if $kerberos_keytab;
!     push(@switches, "--with-dafs")                                      if $with_dafs;
!     push(@switches, "--options-ptserver='$options_ptserver'")           if $options_ptserver;
!     push(@switches, "--options-vlserver='$options_vlserver'")           if $options_vlserver;
!     push(@switches, "--options-fileserver='$options_fileserver'")       if $options_fileserver;
!     push(@switches, "--options-volserver='$options_volserver'")         if $options_volserver;;
!     push(@switches, "--options-salvageserver='$options_salvageserver'") if $options_salvageserver;;
!     push(@switches, "--options-salvager='$options_salvager'")           if $options_salvager;
    
!     open(SCRIPT, "> $script") or die "error: Cannot open file $script: $!\n";
!     print SCRIPT "#!/bin/sh\n";
!     print SCRIPT "perl afs-newcell.pl \\\n";
!     print SCRIPT join(" \\\n", map("  $_", @switches));
!     print SCRIPT "\n\n";
!     close SCRIPT;
!     chmod(0755, $script);
    }
  }
  
***************
*** 358,366 ****
    print "debug: afs-newcell options\n";
    print "debug:  \$batch = '$batch'\n";
    print "debug:  \$debug = '$debug'\n";
!   print "debug:  \$dont_unwind = '$dont_unwind'\n";
    print "debug:  \$help = '$help'\n";
-   print "debug:  \$ostype = '$ostype'\n";
    print "debug:  \$server = '$server'\n";
    print "debug:  \$cellname = '$cellname'\n";
    print "debug:  \$partition = '$partition'\n";
--- 423,430 ----
    print "debug: afs-newcell options\n";
    print "debug:  \$batch = '$batch'\n";
    print "debug:  \$debug = '$debug'\n";
!   print "debug:  \$unwind = '$unwind'\n";
    print "debug:  \$help = '$help'\n";
    print "debug:  \$server = '$server'\n";
    print "debug:  \$cellname = '$cellname'\n";
    print "debug:  \$partition = '$partition'\n";
***************
*** 368,418 ****
    print "debug:  \$kerberos_type = '$kerberos_type'\n";
    print "debug:  \$kerberos_realm = '$kerberos_realm'\n";
    print "debug:  \$kerberos_keytab = '$kerberos_keytab'\n";
-   print "debug:  \$skip_make_keyfile = '$skip_make_keyfile'\n";
    print "debug:  \$with_dafs = '$with_dafs'\n";
    print "debug:  \$options_fileserver = '$options_fileserver'\n";
    print "debug:  \$options_volserver = '$options_volserver'\n";
    print "debug:  \$options_salvageserver = '$options_salvageserver'\n";
    print "debug:  \$options_salvager = '$options_salvager'\n";
  }
  
! # 
! # Create an auth object for the type of kerberos
! # to be used for authentication in our cell.
  #
  my $auth = OpenAFS::Auth::create(
        'debug'=>$debug,
        'type'=>$kerberos_type, 
        'cell'=>$cellname,
        'realm'=>$kerberos_realm,
        'keytab'=>$kerberos_keytab,
        );
  
  my $os = OpenAFS::OS::create(
        'debug'=>$debug,
-       'ostype'=>$ostype,
        );
  
! #
! # Sanity checks before we begin. Make sure we have correct
! # binaries, directories, and permissions.
! #
! 
! my $bosserver = "$path->{'afssrvsbindir'}/bosserver";
! my $bos       = "$path->{'afssrvbindir'}/bos";
! my $fs        = "$path->{'afssrvbindir'}/fs";
! my $pts       = "$path->{'afssrvbindir'}/pts";
! my $vos       = "$path->{'afssrvsbindir'}/vos";
! 
! check_program($bosserver);
! check_program($bos);
! check_program($fs);
! check_program($pts);
! check_program($vos);
! 
! 
! #
! # Sanity check admin username and convert kerberos 5 notation to afs.
  #
  if ($admin =~ /@/) {
     die "error: Please specify the username without the realm name.\n";
--- 432,508 ----
    print "debug:  \$kerberos_type = '$kerberos_type'\n";
    print "debug:  \$kerberos_realm = '$kerberos_realm'\n";
    print "debug:  \$kerberos_keytab = '$kerberos_keytab'\n";
    print "debug:  \$with_dafs = '$with_dafs'\n";
+   print "debug:  \$options_pteserver = '$options_ptserver'\n";
+   print "debug:  \$options_pteserver = '$options_vlserver'\n";
    print "debug:  \$options_fileserver = '$options_fileserver'\n";
    print "debug:  \$options_volserver = '$options_volserver'\n";
    print "debug:  \$options_salvageserver = '$options_salvageserver'\n";
    print "debug:  \$options_salvager = '$options_salvager'\n";
  }
  
! 
! #-----------------------------------------------------------------------------
! # Prereq: Sanity check the forward and reverse name resolution.
  #
+ if ($server eq 'localhost') {
+   die "error: localhost is not a valid --server parameter. Use the ip hostname of this machine.\n";
+ }
+ my $packed_ip = gethostbyname($server);
+ unless (defined $packed_ip) {
+   die "error: gethostbyname failed, $?\n";
+ }
+ my $ip_from_name = inet_ntoa($packed_ip);
+ print "debug: $server ip address is $ip_from_name\n" if $debug;
+ if ($ip_from_name=~/^127/) {
+   die "error: Loopback address $ip_from_name cannot not be used for server $server. Check your /etc/hosts file.\n";
+ }
+ 
+ my $name_from_ip  = gethostbyaddr($packed_ip, AF_INET);
+ print "debug: hostname of $ip_from_name is $name_from_ip\n" if $debug;
+ if ($name_from_ip ne $server) {
+   die "error: Name from ip $name_from_ip does not match ip from name $ip_from_name for --server $server. ".
+       " Use the correct --server parameter and verify forward and reverse name resolution is working.\n";
+ }
+ 
+ #-----------------------------------------------------------------------------
+ # Prereq: The vice partition must be available and empty.
+ #
+ unless ($partition=~/^(([a-z])|([a-h][a-z])|([i][a-v]))$/) {
+   die "error: Invalid partition id specified: $partition. Valid values are a..z and aa..iv\n";
+ }
+ unless ( -d "/vicep$partition" ) {
+   die "error: Missing fileserver partition, /vicep$partition\n";
+ }
+ if ( -d "/vicep$partition/AFSIDat" ) {
+   die "error: Fileserver partition is not empty. /vicep$partition/AFSIDat needs to be removed.\n";
+ }
+ open(LS, "ls /vicep$partition |") or 
+   die "error: ls /vicep$partition failed, $!\n";
+ while (<LS>) {
+   chomp;
+   if (/^V\d+.vol$/) {
+     die "error: Fileserver partition, /vicep$partition, is not empty.\n";
+   }
+ }
+ close LS;
+ 
+ # Prereq: authorization and platform specific objects.
  my $auth = OpenAFS::Auth::create(
        'debug'=>$debug,
        'type'=>$kerberos_type, 
        'cell'=>$cellname,
        'realm'=>$kerberos_realm,
        'keytab'=>$kerberos_keytab,
+       'admin'=>$admin,
        );
  
  my $os = OpenAFS::OS::create(
        'debug'=>$debug,
        );
  
! #-----------------------------------------------------------------------------
! # Prereq: Sanity check admin username and convert kerberos 5 notation to afs.
  #
  if ($admin =~ /@/) {
     die "error: Please specify the username without the realm name.\n";
***************
*** 420,439 ****
  my $username = $admin;
  $username=~s:/:.:g;   # convert kerberos separators to afs separators.
  
! # Shutdown the client and server, if running.
  run($os->command('client-stop'));
  run($os->command('fileserver-stop'));
  
  #
! # Attempt the client setup for this system before we try to create the cell.
! #
! $os->configure_client();
  
! #
! # Create the initial server configuration and the server administrator, temporarily running
! # with -noauth.
! #
  
  # bosserver attempts to create the following directories with these limited 
  # permissions. However, bosserver does not create parent directories as needed, so
  # the directories are not successfully created when they are more than one level
--- 510,560 ----
  my $username = $admin;
  $username=~s:/:.:g;   # convert kerberos separators to afs separators.
  
! #-----------------------------------------------------------------------------
! # Prereq: Save the paths and setup configuration in a form that is easily
! # read by the shell scripts.
! #
! open(CONF, "> dirpath.conf") or die "error: Cannot open file dirpath.conf for writing: $!\n";
! my ($n, $v);
! while(($n,$v)=each(%{$path})) {
!   print CONF "$n=$v\n";
! }
! close CONF;
! open(CONF, "> run-tests.conf") or die "error: Cannot open file run-tests.conf for writing: $!\n";
!   print CONF <<"__CONF__";
! CELLNAME=$cellname
! PARTITION=$partition
! ADMIN=$admin
! KERBEROS_TYPE=$kerberos_type
! KERBEROS_REALM=$kerberos_realm
! KERBEROS_KEYTAB=$kerberos_keytab
! __CONF__
! close CONF;
! 
! unless ($batch) {
!   my $answer = prompt("Last chance to cancel before setup begins. Continue? (yes/no)", "yes");
!   exit(0) unless $answer=~/^y/i;
! }
! 
! #-----------------------------------------------------------------------------
! # Prereq: Shutdown the client and server, if running.
! #
  run($os->command('client-stop'));
  run($os->command('fileserver-stop'));
  
+ #-----------------------------------------------------------------------------
+ # Prereq: Verify the server processes are not running.
  #
! foreach my $program ('bosserver', 'ptserver', 'vlserver', 'kaserver', 'fileserver') {
!   die "error: program is already running, $program\n" if $os->number_running($program);
! }
  
! #-----------------------------------------------------------------------------
! # Perform Platform-Specific Procedures
! $os->configure_client();
  
+ #-----------------------------------------------------------------------------
+ # WORKAROUND:
  # bosserver attempts to create the following directories with these limited 
  # permissions. However, bosserver does not create parent directories as needed, so
  # the directories are not successfully created when they are more than one level
***************
*** 451,608 ****
  run("chmod 0755 $path->{'afslogsdir'}"); 
  run("chmod 0777 $path->{'viceetcdir'}");
  
  print "debug: Starting bosserver...\n" if $debug;
  run("$path->{'afssrvsbindir'}/bosserver -noauth");
      unwind($os->command('remove', "$path->{'afsconfdir'}/ThisCell"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/CellServDB"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/UserList"));
      unwind($os->command('remove', "$path->{'afsbosconfigdir'}/BosConfig"));
      unwind($os->command('fileserver-stop'));
  
! run("$bos setcellname $server $cellname -localauth");
! run("$bos addhost $server $server -localauth");
! run("$bos adduser $server $username -localauth");
!     unwind("$bos removeuser $server $username -localauth");
! 
! #
! # Create the AFS KeyFile. (This must be done after bosserver creates the configuration files.)
  #
! unless ($skip_make_keyfile) {
!   print "debug: Making the keyfile...\n" if $debug;
!   $auth->make_keyfile();
! }
! unless ( -f "$path->{'afsconfdir'}/KeyFile") {
!   die "You do not have an AFS keyfile.  Please create this using asetkey or the bos addkey command.\n";
  }
  
! # make the krb.conf file if the realm name is different than the cell name.
! $auth->make_krb_config();
! 
! #
! # Start up the ptserver and vlserver.
  #
  print "debug: Starting the ptserver and vlserver...\n" if $debug;
! run("$bos create $server ptserver simple $path->{'afssrvlibexecdir'}/ptserver -localauth");
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DBSYS1"));
!     unwind("$bos delete $server ptserver -localauth");
!     unwind("$bos stop $server ptserver -localauth");
  
! run("$path->{'afssrvbindir'}/bos create $server vlserver simple $path->{'afssrvlibexecdir'}/vlserver -localauth");
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DBSYS1"));
!     unwind("$bos delete $server vlserver -localauth");
!     unwind("$bos stop $server vlserver -localauth");
  
  #
! # Start the file server.
  #
  print "debug: Starting the fileserver...\n" if $debug;
  if ($with_dafs) {
    run( "$bos create $server dafs dafs ".
!        "-cmd $path->{'afssrvlibexecdir'}/fileserver $options_fileserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/volserver $options_volserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/salvageserver $options_salvageserver".
!        "-cmd $path->{'afssrvlibexecdir'}/salvager $options_salvager".
!      "-localauth");
  }
  else {
    run( "$bos create $server fs fs ".
!        "-cmd $path->{'afssrvlibexecdir'}/fileserver $options_fileserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/volserver $options_volserver ".
!        "-cmd $path->{'afssrvlibexecdir'}/salvager $options_salvager ".
!      "-localauth");
  }
-   unwind("$bos delete $server fs -localauth ");
-   unwind("$bos stop $server fs -localauth ");
  
! #
! # Create the AFS administrator (with the same name as the server administrator).
! #
! print "debug: Creating users...\n" if $debug;
! sleep(10); # wait to avoid "no quorum elected" errors.
! 
! run("$pts createuser -name $username -cell $cellname -noauth");
! run("$pts adduser $username system:administrators -cell $cellname -noauth");
! run("$pts membership $username -cell $cellname -noauth");
! 
! #
! # Create the root afs volume.
! #
  print "debug: Creating root.afs volume...\n" if $debug;
  run("$vos create $server $partition root.afs -cell $cellname -noauth");
      unwind($os->command('remove', "$partition/AFSIDat "));
      unwind($os->command('remove', "$partition/V*.vol"));
      unwind($os->command('remove', "$partition/Lock"));
!     unwind("$vos remove $server $partition root.afs -cell $cellname -noauth");
! 
! # The initial configuration is done, turn on authorization checking.
! #run("$bos setauth $server -authrequired on -cell $cellname -localauth");
! #    unwind("$bos setauth $server -authrequired off -cell $cellname -localauth");
! 
  
! #
! # Bring up the AFS client.
  #
  print "debug: Starting the OpenAFS client...\n" if $debug;
  run($os->command('client-start'));
      unwind($os->command('client-stop'));
  
- #
  # Run as the administrator.
! #
! $auth->authorize($admin);
  
  #
! # Create the root cell volumes, read-only and read-write.
! #
! print "debug: Creating the root volumes...\n" if $debug;
  run("$fs setacl /afs system:anyuser rl");
  
! run("$vos create $server $partition root.cell -localauth");
      unwind("$vos remove $server $partition root.cell -localauth");
  
  run("$fs mkmount /afs/$cellname root.cell -cell $cellname -fast");
      unwind("$fs rmmount /afs/$cellname");
  
  run("$fs setacl /afs/$cellname system:anyuser rl");
  run("$fs mkmount /afs/.$cellname root.cell -cell $cellname -rw");
      unwind("$fs rmmount /afs/.$cellname");
  
! #run("$fs mkmount /afs/.root.afs root.afs -rw");
! #    unwind("$fs rmmmount /afs/.root.afs");
  
- #
  # Create some volumes in our new cell.
- #
  print "debug: Creating the test volumes...\n" if $debug;
! mkvol("user", "/afs/$cellname/user", $server, $partition);
! mkvol("service", "/afs/$cellname/service", $server, $partition);
! mkvol("unrep", "/afs/$cellname/unreplicated", $server, $partition);
! 
! # make a read-only volume
! mkvol("rep", "/afs/$cellname/.replicated", $server, $partition);
! run("$fs mkmount /afs/$cellname/replicated rep.readonly");
! run("$vos addsite $server $partition rep -localauth");
! run("$vos release rep -localauth");
!     unwind("$vos remove $server $partition rep.readonly -localauth");
  
! 
! #
! # Create readonly volumes of our roots.
! #
! run("$vos addsite $server $partition root.afs -localauth");
! run("$vos addsite $server $partition root.cell -localauth");
! run("$vos release root.afs -localauth");
! run("$vos release root.cell -localauth");
!     unwind("$vos remove $server $partition root.cell.readonly -localauth");
!     unwind("$vos remove $server $partition root.afs.readonly -localauth");
  
  # done.
  @unwinds = (); # clear unwinds
  
  END {
!   if (!$dont_unwind && scalar @unwinds) {
      print "\ninfo: Error encountered, unwinding...\n"; 
      while (@unwinds) {
        eval { 
--- 572,790 ----
  run("chmod 0755 $path->{'afslogsdir'}"); 
  run("chmod 0777 $path->{'viceetcdir'}");
  
+ #-----------------------------------------------------------------------------
+ # Starting the BOS Server
+ #
+ # Start the bosserver and create the initial server configuration.
+ # Authorization is disabled by the -noauth flag.
+ #
  print "debug: Starting bosserver...\n" if $debug;
  run("$path->{'afssrvsbindir'}/bosserver -noauth");
+ if ($unwind) {
      unwind($os->command('remove', "$path->{'afsconfdir'}/ThisCell"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/CellServDB"));
      unwind($os->command('remove', "$path->{'afsconfdir'}/UserList"));
      unwind($os->command('remove', "$path->{'afsbosconfigdir'}/BosConfig"));
      unwind($os->command('fileserver-stop'));
+ }
+ sleep(10); # allow bosserver some time to start accepting connections...
  
! #-----------------------------------------------------------------------------
! # Defining Cell Name and Membership for Server Processes
  #
! run("$bos setcellname $server $cellname -noauth");
! run("$bos addhost $server $server -noauth");
! run("$bos adduser $server $username -noauth");
! if ($unwind) {
!     unwind("$bos removeuser $server $username -noauth");
! }
! 
! # WORKAROUND:
! # The initial bosserver startup may create CellServDB entry which does
! # not match the host name retured by gethostbyaddr(). This entry will
! # cause ptserver/vlserver quorum errors and so is removed.
! open(HOSTS, "$bos listhosts $server |") or 
!   die "error: failed to run bos listhosts, $?\n";
! my @hosts = <HOSTS>;
! close HOSTS;
! foreach (@hosts) {
!   chomp;
!   if (/^\s+Host \d+ is (.*)/) {
!     my $host = $1;
!     print "debug: bos listhosts: host=[$host]\n" if $debug; 
!     if ($host ne $name_from_ip) {
!       print "debug: removing invalid host '$host' from CellServDB.\n" if $debug;
!       run("$bos removehost $server $host -noauth");
!     }
!   }
  }
  
! #-----------------------------------------------------------------------------
! # Starting the Database Server Processes
  #
  print "debug: Starting the ptserver and vlserver...\n" if $debug;
! run("$bos create $server ptserver simple -cmd \"$path->{'afssrvlibexecdir'}/ptserver $options_ptserver\" -noauth"); 
! if ($unwind) {
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/prdb.DBSYS1"));
!     unwind("$bos delete $server ptserver -noauth");
!     unwind("$bos stop $server ptserver -noauth");
! }
  
! run("$bos create $server vlserver simple -cmd \"$path->{'afssrvlibexecdir'}/vlserver $options_vlserver\" -noauth");
! if ($unwind) {
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DB0"));
      unwind($os->command('remove', "$path->{'afsdbdir'}/vldb.DBSYS1"));
!     unwind("$bos delete $server vlserver -noauth");
!     unwind("$bos stop $server vlserver -noauth");
! }
  
+ if ($kerberos_type =~ /kaserver/i) {
+   print "warning: kaserver is deprecated!\n";
+   run("$bos create $server kaserver simple -cmd \"$path->{'afssrvlibexecdir'}/kaserver $options_vlserver\" -noauth");
+   if ($unwind) {
+     unwind($os->command('remove', "$path->{'afsdbdir'}/kaserver.DB0"));
+     unwind($os->command('remove', "$path->{'afsdbdir'}/kaserver.DBSYS1"));
+     unwind("$bos delete $server kaserver -noauth");
+     unwind("$bos stop $server kaserver -noauth");
+   }
+ }
+ 
+ sleep(10); # to allow the database servers to start servicing requests.
+ 
+ #-----------------------------------------------------------------------------
+ # Initializing Cell Security
  #
! # Create the AFS administrative account and the AFS server encryption key.
! # Make the krb.conf file if the realm name is different than the cell name.
! 
! $auth->make_krb_config();
! $auth->make_keyfile();
! unless ( -f "$path->{'afsconfdir'}/KeyFile") {
!   die "Failed to create $path->{'afsconfdir'}/KeyFile. Please create this using asetkey or the bos addkey command.\n";
! }
! 
! print "debug: Creating admin user...\n" if $debug;
! run("$pts createuser -name $username -cell $cellname -noauth");
! run("$pts adduser $username system:administrators -cell $cellname -noauth");
! run("$pts membership $username -cell $cellname -noauth");
! 
! print "debug: Restarting the database servers to use the new encryption key.\n" if $debug;
! run("$bos restart $server -all -noauth");
! sleep(10); # to allow the database servers to start servicing requests.
! 
! #-----------------------------------------------------------------------------
! # Starting the File Server, Volume Server, and Salvager
  #
  print "debug: Starting the fileserver...\n" if $debug;
  if ($with_dafs) {
    run( "$bos create $server dafs dafs ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/fileserver $options_fileserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/volserver $options_volserver\"".
!        "-cmd \"$path->{'afssrvlibexecdir'}/salvageserver $options_salvageserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/salvager $options_salvager\" ".
!        "-noauth");
!   if ($unwind) {
!     unwind("$bos delete $server dafs -noauth");
!     unwind("$bos stop $server dafs -noauth");
!   }
  }
  else {
    run( "$bos create $server fs fs ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/fileserver $options_fileserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/volserver $options_volserver\" ".
!        "-cmd \"$path->{'afssrvlibexecdir'}/salvager $options_salvager\" ".
!        "-noauth");
!   if ($unwind) {
!     unwind("$bos delete $server fs -noauth");
!     unwind("$bos stop $server fs -noauth");
!   }
  }
  
! # Create the root.afs volume.
  print "debug: Creating root.afs volume...\n" if $debug;
  run("$vos create $server $partition root.afs -cell $cellname -noauth");
+ if ($unwind) {
      unwind($os->command('remove', "$partition/AFSIDat "));
      unwind($os->command('remove', "$partition/V*.vol"));
      unwind($os->command('remove', "$partition/Lock"));
!     unwind("$vos remove $server $partition root.afs -cell $cellname -localauth");
! }
  
! #-----------------------------------------------------------------------------
! # Installing Client Functionality
  #
  print "debug: Starting the OpenAFS client...\n" if $debug;
  run($os->command('client-start'));
+ if ($unwind) {
      unwind($os->command('client-stop'));
+ }
  
  # Run as the administrator.
! $auth->authorize();
  
+ #-----------------------------------------------------------------------------
+ # Configuring the Top Levels of the AFS Filespace
  #
! print "debug: Creating the volumes...\n" if $debug;
  run("$fs setacl /afs system:anyuser rl");
  
! run("$vos create $server $partition root.cell");
! if ($unwind) {
      unwind("$vos remove $server $partition root.cell -localauth");
+ }
  
  run("$fs mkmount /afs/$cellname root.cell -cell $cellname -fast");
+ if ($unwind) {
      unwind("$fs rmmount /afs/$cellname");
+ }
  
  run("$fs setacl /afs/$cellname system:anyuser rl");
  run("$fs mkmount /afs/.$cellname root.cell -cell $cellname -rw");
+ if ($unwind) {
      unwind("$fs rmmount /afs/.$cellname");
+ }
  
! run("$fs examine /afs");
! run("$fs examine /afs/$cellname");
! 
! run("$vos addsite $server $partition root.afs");
! run("$vos addsite $server $partition root.cell");
! run("$vos release root.cell");
! run("$vos release root.afs");
! 
! run("$fs checkvolumes"); # so client notices the releases
! print "debug: the following should show root.afs.readonly\n" if $debug;
! run("$fs examine /afs");
! print "debug: the following should show root.cell.readonly\n" if $debug;
! run("$fs examine /afs/$cellname");
! print "debug: the following should show root.cell\n" if $debug;
! run("$fs examine /afs/.$cellname");
  
  # Create some volumes in our new cell.
  print "debug: Creating the test volumes...\n" if $debug;
! mkvol("user",    "/afs/.$cellname/user",         $server, $partition);
! mkvol("service", "/afs/.$cellname/service",      $server, $partition);
! mkvol("unrep",   "/afs/.$cellname/unreplicated", $server, $partition);
! mkvol("rep",     "/afs/.$cellname/replicated",   $server, $partition);
! 
! run("$vos addsite $server $partition rep");
! if ($unwind) {
!     unwind("$vos remsite $server $partition rep");
! }
! run("$vos release rep");
! run("$fs mkmount /afs/.$cellname/.replicated rep -rw");
! run("$fs setacl  /afs/.$cellname/.replicated system:anyuser rl");
  
! # Show the new volumes in the read-only path.
! run("$vos release root.cell"); 
  
  # done.
  @unwinds = (); # clear unwinds
+ print "info: DONE\n";
  
  END {
!   if ($unwind && scalar @unwinds) {
      print "\ninfo: Error encountered, unwinding...\n"; 
      while (@unwinds) {
        eval { 
Index: openafs/src/tests/afs-rmcell.pl
diff -c openafs/src/tests/afs-rmcell.pl:1.1.4.2 openafs/src/tests/afs-rmcell.pl:1.1.4.3
*** openafs/src/tests/afs-rmcell.pl:1.1.4.2	Thu Jan 24 18:52:17 2008
--- openafs/src/tests/afs-rmcell.pl	Mon Mar 31 11:53:48 2008
***************
*** 65,74 ****
  
  unless ($batch) {
    my $rl = new Term::ReadLine('afs-rmcell');
!   print "\n*** WARNING!! WARNING!! WARNING!! *** \n";
!   print "You are about to permanently DESTROY the OpenAFS configuration, database, and volumes on this machine!\n\n";
!   my $answer = $rl->readline("Do you really want to destroy the AFS cell data? (y/n) [n] ");
!   unless ($answer=~/^y/i ) {
      print "info: Aborted.\n";
      exit 0;
    }
--- 65,76 ----
  
  unless ($batch) {
    my $rl = new Term::ReadLine('afs-rmcell');
!   print "\n***  WARNING !!   WARNING !!   WARNING !!  *** \n\n";
!   print "You are about to permanently DESTROY the OpenAFS\n";
!   print "configuration, databases, and volumes on this machine!\n";
!   my $answer = $rl->readline("Do you really want to destroy the AFS cell? (destroy/no) [no] ");
!   unless ($answer eq "destroy" ) {
!     print "info: must answer 'destroy' to continue.\n" if $answer!~/^n/i;
      print "info: Aborted.\n";
      exit 0;
    }
***************
*** 87,92 ****
--- 89,96 ----
  $os->remove("$path->{'afsdbdir'}/prdb.DBSYS1");
  $os->remove("$path->{'afsdbdir'}/vldb.DB0");
  $os->remove("$path->{'afsdbdir'}/vldb.DBSYS1");
+ $os->remove("$path->{'afsdbdir'}/kaserver.DB0");
+ $os->remove("$path->{'afsdbdir'}/kaserver.DBSYS1");
  $os->remove("$path->{'afsbosconfigdir'}/BosConfig");
  $os->remove("$path->{'afslogsdir'}/*");
  $os->remove("$path->{'afslocaldir'}/*");
***************
*** 95,100 ****
--- 99,106 ----
  $os->remove("$path->{'afsconfdir'}/CellServDB");
  $os->remove("$path->{'afsconfdir'}/KeyFile");
  $os->remove("$path->{'afsconfdir'}/krb.conf");
+ $os->remove("$path->{'afsddir'}/ThisCell");
+ $os->remove("$path->{'afsddir'}/CellServDB");
  $os->remove("/vicep$partition_id/AFSIDat ");
  $os->remove("/vicep$partition_id/V*.vol");
  $os->remove("/vicep$partition_id/Lock");
Index: openafs/src/tests/run-tests.in
diff -c openafs/src/tests/run-tests.in:1.5.8.1 openafs/src/tests/run-tests.in:1.5.8.2
*** openafs/src/tests/run-tests.in:1.5.8.1	Mon Jan 21 14:50:32 2008
--- openafs/src/tests/run-tests.in	Mon Mar 31 11:53:48 2008
***************
*** 1,6 ****
  #!/bin/sh
  #
! # $Id: run-tests.in,v 1.5.8.1 2008/01/21 19:50:32 shadow Exp $
  #
  
  # Directory paths configured during the build.
--- 1,6 ----
  #!/bin/sh
  #
! # $Id: run-tests.in,v 1.5.8.2 2008/03/31 15:53:48 shadow Exp $
  #
  
  # Directory paths configured during the build.
***************
*** 8,17 ****
    . dirpath.conf
  else
    echo "error: Missing dirpath.conf file, try make dirpath.conf"
  fi
  
! if test -f run-test.conf; then
!   . run-test.conf
  fi  
  
  
--- 8,20 ----
    . dirpath.conf
  else
    echo "error: Missing dirpath.conf file, try make dirpath.conf"
+   exit 1
  fi
  
! if test -f run-tests.conf; then
!   . run-tests.conf
! else
!   echo "warning: Missing run-tests.conf, using default values."
  fi  
  
  
***************
*** 324,330 ****
    -help|--help) echo $usage; 
  	echo "tests available: $linebreak"; for a in "$ALL_TESTS"; do echo $a ; done;
  	exit 0;;
!   -version|--version) echo "$0 $Id: run-tests.in,v 1.5.8.1 2008/01/21 19:50:32 shadow Exp $"; exit 0;;
    -*) echo "$0: Bad option $1"; echo $usage; exit 1;;
    *) break;;
    esac
--- 327,333 ----
    -help|--help) echo $usage; 
  	echo "tests available: $linebreak"; for a in "$ALL_TESTS"; do echo $a ; done;
  	exit 0;;
!   -version|--version) echo "$0 $Id: run-tests.in,v 1.5.8.2 2008/03/31 15:53:48 shadow Exp $"; exit 0;;
    -*) echo "$0: Bad option $1"; echo $usage; exit 1;;
    *) break;;
    esac
***************
*** 372,377 ****
--- 375,386 ----
  export srcdir
  export objdir
  
+ # login
+ if [ "$KERBEROS_TYPE" != "kaserver" ] ; then
+   kinit -k -t $KERBEROS_KEYTAB $ADMIN || exit 1;
+   $afswsbindir/aklog -d -c $CELLNAME || exit 1;
+ fi
+ 
  echo "-------------------------------------------------"
  echo "$PACKAGE-$VERSION"
  echo "hosttype $host"
***************
*** 401,406 ****
--- 410,419 ----
    else
      b="${objdir}/$a"
    fi
+   if test "`echo $a | cut -c1`" = "#" ; then  # tests to skip
+     echo "Skipping $a"
+     continue
+   fi
    echo "Running $a"
    test "X$VERBOSE" != "X" && echo "Running test $a ($b)."
    if test "$a" = "setgroups" ; then
Index: openafs/src/tests/OpenAFS/Auth.pm
diff -c openafs/src/tests/OpenAFS/Auth.pm:1.1.4.2 openafs/src/tests/OpenAFS/Auth.pm:1.1.4.3
*** openafs/src/tests/OpenAFS/Auth.pm:1.1.4.2	Thu Jan 24 18:52:17 2008
--- openafs/src/tests/OpenAFS/Auth.pm	Mon Mar 31 11:53:50 2008
***************
*** 7,12 ****
--- 7,24 ----
  use OpenAFS::ConfigUtils;
  
  my $path = $OpenAFS::Dirpath::openafsdirpath;
+ my $classes = {
+   'mit'      => 'OpenAFS::Auth::MIT',
+   #'heimdal' => 'OpenAFS::Auth::Heimdal',
+   'kaserver' => 'OpenAFS::Auth::Kaserver',
+ };
+ 
+ my $bos       = "$path->{'afssrvbindir'}/bos";
+ my $aklog     = "$path->{'afswsbindir'}/aklog";
+ my $tokens    = "$path->{'afswsbindir'}/tokens";
+ my $asetkey   = "$path->{'afssrvbindir'}/asetkey";
+ my $kas       = "$path->{'afssrvsbindir'}/kas";
+ my $klog      = "$path->{'afswsbindir'}/klog";
  
  #
  # Create an auth type for the specified Kerberos implementation.
***************
*** 27,50 ****
  #  $auth->authorize('admin');
  #
  sub create {
    my $self = {
       # default values
       'type' => 'MIT',
-      'keytab' =>  "$path->{'afsconfdir'}/krb5.keytab",
       'cell' => '',
       'realm' => '', 
       'debug' => '0',
       # user specified values
       @_,
    };
  
-   # check for supported kerberos type.
-   my $type = $self->{'type'};
-   $self->{'type'} = _check_kerberos_type($type) or 
-     die "Unsupported kerberos type: $type\n";
- 
-   # create the sub-class for the kerberos type.
-   my $class = "OpenAFS::Auth::$self->{'type'}";
    $self = bless($self, $class);
  
    # attempt get default values.
--- 39,74 ----
  #  $auth->authorize('admin');
  #
  sub create {
+   my $parms = {@_};
+   my $type = 'mit';
+ 
+   if (defined $parms->{'type'}) {
+     $type = $parms->{'type'};
+   }
+   $type =~ tr/A-Z/a-z/;
+   my $class = $classes->{$type};
+   unless($class) {
+     die "Unsupported kerberos type: $type\n";
+   }
+   return $class->new(@_);
+ }
+ 
+ #
+ # Create an auth instance.
+ #
+ sub new {
+   my $class = shift;
    my $self = {
       # default values
       'type' => 'MIT',
       'cell' => '',
       'realm' => '', 
+      'admin' => 'admin',
       'debug' => '0',
       # user specified values
       @_,
    };
  
    $self = bless($self, $class);
  
    # attempt get default values.
***************
*** 76,94 ****
  }
  
  #
- # Check for supported kerberos type, and allow for case insensitivity.
- #
- sub _check_kerberos_type {
-   my $type = shift;
-   foreach my $supported ('MIT', 'Heimdal', 'Kaserver') {
-      if ($type =~ /^$supported$/i) {
-         return $supported;
-      }
-   }
-   return undef;
- }
- 
- #
  # Returns the cell name from the ThisCell configuration file.
  #
  sub _lookup_cell_name {
--- 100,105 ----
***************
*** 149,154 ****
--- 160,178 ----
    return $self->{'debug'};
  }
  
+ #
+ # check_program($prog) - verify the program is installed.
+ #
+ sub check_program {
+   my $self = shift;
+   my $program = shift;
+   unless ( -f $program ) {
+      die "error: Missing program: $program\n";
+   }
+   unless ( -x $program ) {
+      die "error: Not executable: $program\n";
+   }
+ }
  
  #------------------------------------------------------------------------------------
  # MIT Kerberos authorization commands.
***************
*** 159,178 ****
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
  #
  # Sanity checks before we get started.
  #
  sub _sanity_check {
    my $self = shift;
!   unless (defined $path->{'afssrvbindir'}) {
!     die "error: \$path->{'afssrvbindir'} is not defined.\n";
!   }
!   unless (-f "$path->{'afssrvbindir'}/aklog") {
!     die "error: $path->{'afssrvbindir'}/aklog not found.\n";
!   }
!   unless (-x "$path->{'afssrvbindir'}/aklog") {
!     die "error: $path->{'afssrvbindir'}/aklog not executable.\n";
!   }
    unless ($self->{'realm'}) {
      die "error: Missing realm parameter Auth::create().\n";
    }
--- 183,199 ----
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
+ 
  #
  # Sanity checks before we get started.
  #
  sub _sanity_check {
    my $self = shift;
! 
!   $self->check_program($aklog);
!   $self->check_program($tokens);
!   $self->check_program($asetkey);
! 
    unless ($self->{'realm'}) {
      die "error: Missing realm parameter Auth::create().\n";
    }
***************
*** 182,225 ****
    unless ( -f $self->{'keytab'} ) {
      die "error: Kerberos keytab file not found: $self->{'keytab'}\n";
    }
!   unless ( -f $self->{'keytab'} ) {
!     die "error: Keytab file not found: $self->{'keytab'}\n";
!   }
  }
  
  #
! # Create the KeyFile from the Kerberos keytab file. The keytab file
! # should be created using the Kerberos kadmin command (or with the kadmin.local command
! # as root on the KDC). See the OpenAFS asetkey man page for details.
! # 
! sub make_keyfile {
    my $self = shift;
  
-   # asetkey annoyance. The current asetkey implementation requires the ThisCell and CellServDB files
-   # to be present but they really are not needed to create the KeyFile. This check is done here
-   # rather than in the _sanity_checks() because the ThisCell/CellServerDB are created later in 
-   # the process of creating the new cell.
-   unless ( -f "$path->{'afsconfdir'}/ThisCell" ) {
-     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/ThisCell\n";
-   }
-   unless ( -f "$path->{'afsconfdir'}/CellServDB" ) {
-     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/CellServDB\n";
-   }
- 
-   unless ( -f "$path->{'afssrvbindir'}/asetkey" ) {
-     die "error: $path->{'afssrvbindir'}/asetkey is missing.\nWas OpenAFS built with Kerberos support?\n";
-   }
-   unless ( -x "$path->{'afssrvbindir'}/asetkey" ) {
-     die "error: Do not have execute permissions on $path->{'afssrvbindir'}/asetkey\n";
-   }
-   unless ( -d $path->{'afsconfdir'} ) {
-     die "error: OpenAFS configuration directory '$path->{'afsconfdir'}' is missing.\n";
-   }
-   unless ( -w $path->{'afsconfdir'} ) {
-     die "error: Write access to the OpenAFS configuration directory '$path->{'afsconfdir'}' is required.\n";
-   }
- 
- 
    # Run klist to get the kvno of the afs key. Search for afs/cellname@REALM
    # then afs@REALM. klist must be in the path.
    my %keys = ();
--- 203,222 ----
    unless ( -f $self->{'keytab'} ) {
      die "error: Kerberos keytab file not found: $self->{'keytab'}\n";
    }
! 
!   print "debug: Verifying the keytab and admin name, $self->{'admin'}.\n" if $self->debug;
!   run("kinit -k -t $self->{'keytab'} $self->{'admin'}");
! 
!   print "debug: Getting the afs principal and kvno from the keytab.\n" if $self->debug;
!   $self->_prepare_make_keyfile();
  }
  
  #
! # Read the keytab to find the kvno of the afs principal.
! #
! sub _prepare_make_keyfile {
    my $self = shift;
  
    # Run klist to get the kvno of the afs key. Search for afs/cellname@REALM
    # then afs@REALM. klist must be in the path.
    my %keys = ();
***************
*** 262,270 ****
      die "error: Could not find an afs key matching 'afs/$cell\@$realm' or ".
        "'afs/$cell' in keytab $self->{'keytab'}\n";
    }
  
!   # Run asetkey on the keytab to create the KeyFile. asetkey must be in the PATH.
!   run("$path->{'afssrvbindir'}/asetkey add $afs_kvno $self->{'keytab'} $afs_principal");
  }
  
  #
--- 259,295 ----
      die "error: Could not find an afs key matching 'afs/$cell\@$realm' or ".
        "'afs/$cell' in keytab $self->{'keytab'}\n";
    }
+   
+   $self->{'afs_principal'} = $afs_principal;
+   $self->{'afs_kvno'}      = $afs_kvno;
+ }
+ 
+ #
+ # Create the KeyFile from the Kerberos keytab file. The keytab file
+ # should be created using the Kerberos kadmin command (or with the kadmin.local command
+ # as root on the KDC). See the OpenAFS asetkey man page for details.
+ #
+ sub make_keyfile {
+   my $self = shift;
+   
+   # The current asetkey implementation requires the ThisCell and CellServDB files
+   # to be present but they really are not needed to create the KeyFile. A check is done here
+   # rather than in the _sanity_checks() because the ThisCell/CellServerDB are created later in 
+   # the process of creating the new cell.
+   unless ( -d $path->{'afsconfdir'} ) {
+     die "error: OpenAFS configuration directory '$path->{'afsconfdir'}' is missing.\n";
+   }
+   unless ( -w $path->{'afsconfdir'} ) {
+     die "error: Write access to the OpenAFS configuration directory '$path->{'afsconfdir'}' is required.\n";
+   }
+   unless ( -f "$path->{'afsconfdir'}/ThisCell" ) {
+     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/ThisCell\n";
+   }
+   unless ( -f "$path->{'afsconfdir'}/CellServDB" ) {
+     die "error: OpenAFS configuration file is required, $path->{'afsconfdir'}/CellServDB\n";
+   }
  
!   run("$asetkey add $self->{'afs_kvno'} $self->{'keytab'} $self->{'afs_principal'}");
  }
  
  #
***************
*** 272,284 ****
  #
  sub authorize {
    my $self = shift;
!   my $principal = shift || 'admin';
    my $opt_aklog = "";
    $opt_aklog .= " -d" if $self->debug;
  
    run("kinit -k -t $self->{'keytab'} $principal");
!   run("$path->{'afssrvbindir'}/aklog $opt_aklog");
!   run("$path->{'afssrvbindir'}/tokens");
  }
  
  
--- 297,309 ----
  #
  sub authorize {
    my $self = shift;
!   my $principal = shift || $self->{'admin'};
    my $opt_aklog = "";
    $opt_aklog .= " -d" if $self->debug;
  
    run("kinit -k -t $self->{'keytab'} $principal");
!   run("$aklog $opt_aklog");
!   run("$tokens");
  }
  
  
***************
*** 305,310 ****
--- 330,340 ----
    }
  }
  
+ sub make_keyfile {
+   my $self = shift;
+   die "not implemented.";
+ }
+ 
  #
  # Get kerberos ticket and AFS token for the user.
  #
***************
*** 321,343 ****
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
  #
  # Various checks during initialization.
  #
  sub _sanity_check {
    my $self = shift;
    unless ($self->{'realm'}) {
      die "Missing realm parameter Auth::create().\n";
    }
  }
  
  #
  # Get kerberos ticket and AFS token for the user.
  #
  sub authorize {
    my $self = shift;
    my $principal = shift || 'admin';
!   run("echo \"Proceeding w/o authentication\"|klog -pipe ${principal}\@$self->{'realm'}");
  }
  
  1;
--- 351,386 ----
  use OpenAFS::ConfigUtils;
  our @ISA = ("OpenAFS::Auth");
  
+ 
  #
  # Various checks during initialization.
  #
  sub _sanity_check {
    my $self = shift;
+   $self->check_program($kas);
+   $self->check_program($klog);
+   $self->check_program($tokens);
    unless ($self->{'realm'}) {
      die "Missing realm parameter Auth::create().\n";
    }
  }
  
+ sub make_keyfile {
+   my $self = shift;
+   run("$kas create afs -noauth");
+   run("$kas create admin -noauth");
+   run("$kas setfields admin -flags admin -noauth");
+   run("$bos addkey localhost -kvno 0 -noauth");
+ }
+ 
  #
  # Get kerberos ticket and AFS token for the user.
  #
  sub authorize {
    my $self = shift;
    my $principal = shift || 'admin';
!   #run("echo \"Proceeding w/o authentication\"|klog -pipe ${principal}\@$self->{'realm'}");
!   run("klog $principal\@$self->{'realm'}");
  }
  
  1;
Index: openafs/src/tests/OpenAFS/OS.pm
diff -c openafs/src/tests/OpenAFS/OS.pm:1.1.4.2 openafs/src/tests/OpenAFS/OS.pm:1.1.4.3
*** openafs/src/tests/OpenAFS/OS.pm:1.1.4.2	Thu Jan 24 18:52:17 2008
--- openafs/src/tests/OpenAFS/OS.pm	Mon Mar 31 11:53:50 2008
***************
*** 13,42 ****
  # and commands.
  #
  sub create {
    my $self = {
      'debug'=>0,
      'ostype'=>$path->{'ostype'},
      @_,
    };
  
-   my $class = _get_class($self->{'ostype'});
    $self = bless($self, $class);
    $self->{'commands'} = $self->get_commands();
- 
-   # Put the paths to the cache and afsd into the path
-   # table. Assume legacy paths if the the viceetcdir is set to
-   # the Transarc path.
-   if ($path->{'viceetcdir'} eq '/usr/vice/etc') {
-     # set in the makefile dest targets
-     $path->{'cachedir'} = "/usr/vice"     unless $path->{'cachedir'};  
-     $path->{'afsddir'}  = "/usr/vice/etc" unless $path->{'afsddir'};
-   }
-   else {
-     # set in the makefile install targets
-     $path->{'cachedir'} = "$path->{'localstatedir'}/openafs" unless $path->{'cachedir'};
-     $path->{'afsddir'}  = "$path->{'afssrvsbindir'}"         unless $path->{'afsddir'};
-   }  
- 
    return $self;
  }
  
--- 13,36 ----
  # and commands.
  #
  sub create {
+   my $class = _get_class($path->{'ostype'});
+   $class->new(@_);
+ }
+ 
+ #
+ # Create the OS object.
+ #
+ sub new {
+   my $class = shift;
    my $self = {
      'debug'=>0,
      'ostype'=>$path->{'ostype'},
      @_,
    };
  
    $self = bless($self, $class);
+   $self->{'syscnf'} = "$path->{'initdir'}/test-afs-rc.conf";
    $self->{'commands'} = $self->get_commands();
    return $self;
  }
  
***************
*** 156,161 ****
--- 150,165 ----
    return @pids;
  }
  
+ #
+ # Returns the number of pids found for a program name.
+ #
+ sub number_running {
+   my $self = shift;
+   my $program = shift;
+   my @pids = $self->find_pids($program);
+   return scalar @pids;
+ }
+ 
  #--------------------------------------------------------------
  package OpenAFS::OS::Linux;
  use warnings;
***************
*** 169,180 ****
  #
  sub get_commands {
    my $self = shift;
-   my $syscnf = "$path->{'initdir'}/testclient.conf";
  
    my $commands = {
!     'client-start'         => "SYSCNF=$syscnf $path->{'initdir'}/afs.rc start",
!     'client-stop'          => "SYSCNF=$syscnf $path->{'initdir'}/afs.rc stop",
!     'client-restart'       => "SYSCNF=$syscnf $path->{'initdir'}/afs.rc restart",
      'client-forcestop'     => sub { $self->client_forcestop() },
      'fileserver-start'     => sub { $self->fileserver_start() },
      'fileserver-stop'      => sub { $self->fileserver_stop() },
--- 173,183 ----
  #
  sub get_commands {
    my $self = shift;
  
    my $commands = {
!     'client-start'         => "SYSCNF=$self->{'syscnf'} $path->{'initdir'}/afs.rc start",
!     'client-stop'          => "SYSCNF=$self->{'syscnf'} $path->{'initdir'}/afs.rc stop",
!     'client-restart'       => "SYSCNF=$self->{'syscnf'} $path->{'initdir'}/afs.rc restart",
      'client-forcestop'     => sub { $self->client_forcestop() },
      'fileserver-start'     => sub { $self->fileserver_start() },
      'fileserver-stop'      => sub { $self->fileserver_stop() },
***************
*** 201,212 ****
    };
    
    my $debug = $self->{'debug'};
-   my $syscnf = "$path->{'initdir'}/testclient.conf";
  
!   open (SYSCNF, "> $syscnf") or
!     die "error: Cannot open afs.rc configuration file $syscnf, $!\n";
  
!   print "debug: creating afs.rc configuration file $syscnf\n" if $debug; 
    print SYSCNF <<"_SYSCNF_";
  AFS_CLIENT=on
  AFS_SERVER=off
--- 204,214 ----
    };
    
    my $debug = $self->{'debug'};
  
!   open (SYSCNF, "> $self->{'syscnf'}") or
!     die "error: Cannot open afs.rc configuration file $self->{'syscnf'}, $!\n";
  
!   print "debug: creating afs.rc configuration file $self->{'syscnf'}\n" if $debug; 
    print SYSCNF <<"_SYSCNF_";
  AFS_CLIENT=on
  AFS_SERVER=off
***************
*** 216,222 ****
  OPTIONS="-confdir $path->{'viceetcdir'}"
  WAIT_FOR_SALVAGE=no
  AFSDIR=/afs
! CACHEDIR=$path->{'cachedir'}/cache
  CACHEINFO=$path->{'viceetcdir'}/cacheinfo
  VERBOSE=
  AFS_POST_INIT=
--- 218,224 ----
  OPTIONS="-confdir $path->{'viceetcdir'}"
  WAIT_FOR_SALVAGE=no
  AFSDIR=/afs
! CACHEDIR=$path->{'cachedir'}
  CACHEINFO=$path->{'viceetcdir'}/cacheinfo
  VERBOSE=
  AFS_POST_INIT=
***************
*** 228,234 ****
  _SYSCNF_
    close SYSCNF;
    if ($debug) {
!     if (open(SYSCNF, "< $syscnf")) {
        while (<SYSCNF>) {
          chomp; print "debug:  $_\n";
        }
--- 230,236 ----
  _SYSCNF_
    close SYSCNF;
    if ($debug) {
!     if (open(SYSCNF, "< $self->{'syscnf'}")) {
        while (<SYSCNF>) {
          chomp; print "debug:  $_\n";
        }
***************
*** 237,246 ****
    }
  
    # Create a cache directory if none.
!   unless ( -d "$path->{'cachedir'}/cache" ) {
!     print "debug: making cache directory: $path->{'cachedir'}/cache\n" if $debug;
!     system("mkdir -p $path->{'cachedir'}/cache");
!     system("chmod 0700 $path->{'cachedir'}/cache"); 
    }
  
    # Create the local /afs directory on which the afs filespace will be mounted. 
--- 239,248 ----
    }
  
    # Create a cache directory if none.
!   unless ( -d "$path->{'cachedir'}" ) {
!     print "debug: making cache directory: $path->{'cachedir'}\n" if $debug;
!     system("mkdir -p $path->{'cachedir'}");
!     system("chmod 0700 $path->{'cachedir'}"); 
    }
  
    # Create the local /afs directory on which the afs filespace will be mounted. 
Index: openafs/src/tests/OpenAFS/config.pm
diff -c openafs/src/tests/OpenAFS/config.pm:1.1.10.1 openafs/src/tests/OpenAFS/config.pm:1.1.10.2
*** openafs/src/tests/OpenAFS/config.pm:1.1.10.1	Mon Jan 21 14:50:32 2008
--- openafs/src/tests/OpenAFS/config.pm	Mon Mar 31 11:53:50 2008
***************
*** 94,105 ****
  
  =cut
  
! @CmdPath = (split(/:/, $ENV{PATH}),
              $OpenAFS::Dirpath::openafsdirpath->{'afssrvbindir'},        # For servers
! 	    '/usr/local/bin',      # Many sites put AFS in /usr/local
! 	    '/usr/local/etc',
! 	    '/usr/afsws/bin',      # For people who use Transarc's
! 	    '/usr/afsws/etc');     # silly reccommendations
  
  =item $err_table_dir - Error table directory
  
--- 94,103 ----
  
  =cut
  
! @CmdPath = (
              $OpenAFS::Dirpath::openafsdirpath->{'afssrvbindir'},        # For servers
!             $OpenAFS::Dirpath::openafsdirpath->{'afswsbindir'},
!         );
  
  =item $err_table_dir - Error table directory
  
Index: openafs/src/vlserver/vlserver.c
diff -c openafs/src/vlserver/vlserver.c:1.18.2.11 openafs/src/vlserver/vlserver.c:1.18.2.12
*** openafs/src/vlserver/vlserver.c:1.18.2.11	Mon Mar 10 18:35:37 2008
--- openafs/src/vlserver/vlserver.c	Tue Apr  1 12:55:41 2008
***************
*** 11,17 ****
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.18.2.11 2008/03/10 22:35:37 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
--- 11,17 ----
  #include <afs/param.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vlserver/vlserver.c,v 1.18.2.12 2008/04/01 16:55:41 shadow Exp $");
  
  #include <afs/stds.h>
  #include <sys/types.h>
***************
*** 85,91 ****
  
      if (errorcode =
  	Init_VLdbase(&trans, LOCKREAD, VLGETSTATS - VL_LOWEST_OPCODE))
! 	return errorcode;
      VLog(0, ("Dump name hash table out\n"));
      for (i = 0; i < HASHSIZE; i++) {
  	HashNDump(trans, i);
--- 85,91 ----
  
      if (errorcode =
  	Init_VLdbase(&trans, LOCKREAD, VLGETSTATS - VL_LOWEST_OPCODE))
! 	return (void *)errorcode;
      VLog(0, ("Dump name hash table out\n"));
      for (i = 0; i < HASHSIZE; i++) {
  	HashNDump(trans, i);
Index: openafs/src/vol/fssync.c
diff -c openafs/src/vol/fssync.c:1.26.2.9 openafs/src/vol/fssync.c:1.26.2.10
*** openafs/src/vol/fssync.c:1.26.2.9	Fri Mar 21 12:59:26 2008
--- openafs/src/vol/fssync.c	Tue Apr  1 16:05:47 2008
***************
*** 51,57 ****
  #include <afs/afsutil.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/Attic/fssync.c,v 1.26.2.9 2008/03/21 16:59:26 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
--- 51,57 ----
  #include <afs/afsutil.h>
  
  RCSID
!     ("$Header: /cvs/openafs/src/vol/Attic/fssync.c,v 1.26.2.10 2008/04/01 20:05:47 shadow Exp $");
  
  #include <sys/types.h>
  #include <stdio.h>
***************
*** 102,112 ****
  
  /*@printflike@*/ extern void Log(const char *format, ...);
  
- #ifdef osi_Assert
- #undef osi_Assert
- #endif
- #define osi_Assert(e) (void)(e)
- 
  int (*V_BreakVolumeCallbacks) ();
  
  #define MAXHANDLERS	4	/* Up to 4 clients; must be at least 2, so that
--- 102,107 ----
