[OpenAFS-devel] Patch for afs krb5 migration kit for windows

Dave Bailey D.Bailey@bristol.ac.uk
Sun, 31 Mar 2002 17:39:23 +0100


Hi all,

Included is a small patch for version 1.3 of the afs-krb5 migration kit. It
just makes small modifications to make.win (the windows makefile) and allows
asetkey to build on windows. Apply it in the src folder of the afs kerberos
5 kit distribution.

Cheers,
    Dave


*** aklog_main.c.orig	Sun Mar 31 17:25:52 2002
--- aklog_main.c	Sun Mar 31 17:28:00 2002
***************
*** 532,544 ****
  	 */
  
  	strcpy(name, AFSKEY);
! 
  	if (strcasecmp(cell_to_use, realm_of_cell) != 0) {
  	    strncpy(instance, cell_to_use, sizeof(instance));
  	    instance[sizeof(instance)-1] = '\0';
  	} else {
  	    instance[0] = '\0';
  	}
  	
  	/* 
  	 * Extract the session key from the ticket file and hand-frob an
--- 532,548 ----
  	 */
  
  	strcpy(name, AFSKEY);
! #ifndef WIN2KAD
  	if (strcasecmp(cell_to_use, realm_of_cell) != 0) {
  	    strncpy(instance, cell_to_use, sizeof(instance));
  	    instance[sizeof(instance)-1] = '\0';
  	} else {
  	    instance[0] = '\0';
  	}
+ #else /* Force both lookups if using Win2k Active Directory */
+         strncpy(instance, cell_to_use, sizeof(instance));
+         instance[sizeof(instance)-1] = '\0';
+ #endif
  	
  	/* 
  	 * Extract the session key from the ticket file and hand-frob an
*** /h/afs-krb5/src/asetkey.c	Sun Aug 22 19:01:50 1999
--- asetkey.c	Thu Mar 21 16:29:25 2002
***************
*** 6,14 ****
--- 6,19 ----
   * Updated for Kerberos 5
   */
  
+ #include <stdio.h>
  #include <sys/types.h>
+ #ifndef _WIN32
  #include <netinet/in.h>
  #include <netdb.h>
+ #else
+ #include <winsock2.h>
+ #endif
  #include <krb5.h>
  
  #include <afs/stds.h>
***************
*** 33,38 ****
--- 38,46 ----
  	exit(1);
      }
  
+ #ifdef _WIN32
+     initAFSDirPath();
+ #endif
  #ifdef PRE_AFS35
      confdir = AFSCONF_SERVERNAME;
  #else /* PRE_AFS35 */
*** make.win.orig	Sun Mar 31 17:02:49 2002
--- make.win	Sun Mar 31 17:30:52 2002
***************
*** 4,17 ****
  
  OBJS=aklog.obj aklog_main.obj aklog_param.obj linked_list.obj krb_util.obj
  
  ZIPFILES=aklog.c aklog.h aklog_main.c aklog_param.c linked_list.c \
! 	linked_list.h krb_util.c make.win
  ZIPFILE=aklog.zip
  
  # Set this to point at your Kerberos 5 build tree
  K5_DIR=..\..\krb5-win
  KRB524_DIR=$(K5_DIR)\krb524
  
  # Set this to point at where your AFS client is installed
  # AFS 3.4
  #AFS_DIR="C:\Program Files\Transarc\AFS\AFSClient\PROGRAM"
--- 4,22 ----
  
  OBJS=aklog.obj aklog_main.obj aklog_param.obj linked_list.obj krb_util.obj
  
+ AOBJS=asetkey.obj
+ 
  ZIPFILES=aklog.c aklog.h aklog_main.c aklog_param.c linked_list.c \
! 	linked_list.h krb_util.c asetkey.c make.win
  ZIPFILE=aklog.zip
  
  # Set this to point at your Kerberos 5 build tree
  K5_DIR=..\..\krb5-win
  KRB524_DIR=$(K5_DIR)\krb524
  
+ # Set this to point to the getopt library in the Kerberos 5 build tree
+ GETOPTLIB=$(K5_DIR)\src\util\windows\obj\i386\rel\getopt.lib
+ 
  # Set this to point at where your AFS client is installed
  # AFS 3.4
  #AFS_DIR="C:\Program Files\Transarc\AFS\AFSClient\PROGRAM"
***************
*** 27,36 ****
  # AFS 3.5 and above
  AFSINCS=/I$(AFS_DIR)\include
  
  INCLUDES=$(KRB5INCS) $(AFSINCS) $(KRB524INCS)
  
  KRB5LIBS=/LIBPATH:$(K5_DIR)\lib krb5_32.lib comerr32.lib \
! 	$(K5_DIR)\util\windows\getopt.obj
  KRB524LIBS=/LIBPATH:$(KRB524_DIR)\Release /LIBPATH:$(KRB524_DIR)
krb524.lib 
  WINLIBS=user32.lib
  
--- 32,44 ----
  # AFS 3.5 and above
  AFSINCS=/I$(AFS_DIR)\include
  
+ # Uncomment this line if you're using Win2k Active directory as the KDC
+ # WIN2KDEF=/DWIN2KAD
+ 
  INCLUDES=$(KRB5INCS) $(AFSINCS) $(KRB524INCS)
  
  KRB5LIBS=/LIBPATH:$(K5_DIR)\lib krb5_32.lib comerr32.lib \
! 	$(GETOPTLIB)
  KRB524LIBS=/LIBPATH:$(KRB524_DIR)\Release /LIBPATH:$(KRB524_DIR)
krb524.lib 
  WINLIBS=user32.lib
  
***************
*** 44,62 ****
  # AFS 3.4
  #DEFINES=/DWINDOWS /DPRE_AFS35
  # AFS 3.5 and above
! DEFINES=/DWINDOWS
  
  CC=cl /nologo
! CFLAGS=/Os /Zi /Od /W3 $(INCLUDES) $(DEFINES)
  
  aklog.exe: $(OBJS)
  	link /nologo /out:$@ $** $(KRB5LIBS) $(AFSLIBS) $(KRB524LIBS)
$(WINLIBS)
  
  .c.obj:
  	$(CC) $(CFLAGS) /c $*.c
  
  clean:
! 	del $(OBJS)
  
  # Make zip distribution
  zipfile: $(ZIPFILE)
--- 52,75 ----
  # AFS 3.4
  #DEFINES=/DWINDOWS /DPRE_AFS35
  # AFS 3.5 and above
! DEFINES=/DWINDOWS /DHAVE_STRERROR $(WIN2KDEF)
  
  CC=cl /nologo
! CFLAGS=/Os /Zi /W3 /MD $(INCLUDES) $(DEFINES)
! 
! all: aklog.exe asetkey.exe
  
  aklog.exe: $(OBJS)
  	link /nologo /out:$@ $** $(KRB5LIBS) $(AFSLIBS) $(KRB524LIBS)
$(WINLIBS)
  
+ asetkey.exe: $(AOBJS)
+ 	link /nologo /out:$@ $** $(KRB5LIBS) $(AFSLIBS) $(WINLIBS)
+ 
  .c.obj:
  	$(CC) $(CFLAGS) /c $*.c
  
  clean:
! 	del $(OBJS) $(AOBJS)
  
  # Make zip distribution
  zipfile: $(ZIPFILE)

                                              __  _
David Bailey                              .-.'  `; `-._  __  _
Bristol University                       (_,         .-:'  `; `-._
Email: D.Bailey@Bristol.ac.uk          ,'o"(        (_,           )
Tel:   +44 117 9546879                (__,-'      ,'o"(            )>
Fax:   +44 117 9255624                   (       (__,-'            )
                                          `-'._.--._(             )
                                             |||  |||`-'._.--._.-'
                                                        |||  |||