[OpenAFS-devel] [PATCH]: src/aklog cleanup and add heimdal/mit support
Troy Benjegerdes
hozer@hozed.org
Sat, 11 Jun 2005 15:30:13 -0500
This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.
--=_kalmia.hozed.org-17192-1118521813-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Attached is a patch and a Makefile.in (place in src/aklog/Makefile.in)
that allows me to get tokens using either heimdal or MIT kerberos
libraries.
Given the existance of src/WINNT/aklog, I also removed all of the old
windows code.
If this change is acceptable to everyone, I will probably try to figure
out how to make the K5-only ticket support from the windows aklog work
next.
--
--------------------------------------------------------------------------
Troy Benjegerdes 'da hozer' hozer@hozed.org
Somone asked my why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:
"Why do musicians compose symphonies and poets write poems? They do it
because life wouldn't have any meaning for them if they didn't. That's why
I draw cartoons. It's my life." -- Charles Shultz
--=_kalmia.hozed.org-17192-1118521813-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="Makefile.in"
#
# $Id: Makefile.in,v 1.9 1999/09/10 18:47:04 kenh Exp $
#
# This is the Makefile for the AFS-Kerberos 5 Migration Kit. See the
# directions below for the meaning of each flag.
#
srcdir = @srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config
# Defines to add to the command line
DEFS=-DALLOW_REGISTER
# Library files
KRB5_LIBS= @KRB5_LIBS@
#LIBS=-lkrb5 -lresolv
# AFS libraries
AFSLIBS=${TOP_LIBDIR}/libcom_err.a \
${TOP_LIBDIR}/libsys.a \
${TOP_LIBDIR}/libprot.a \
${TOP_LIBDIR}/libubik.a \
${TOP_LIBDIR}/libauth.a \
${TOP_LIBDIR}/librxkad.a \
${TOP_LIBDIR}/librx.a \
${TOP_LIBDIR}/liblwp.a \
${TOP_LIBDIR}/libafsutil.a \
${TOP_LIBDIR}/libdes.a
PROGS=aklog
XCFLAGS+= $(DEFS)
AKLOG_OBJS=aklog.o aklog_main.o aklog_param.o krb_util.o linked_list.o
all: $(PROGS)
clean:
rm -f $(PROGS) $(AKLOG_OBJS)
distclean: clean
rm -f config.cache config.log config.status Makefile
aklog: $(AKLOG_OBJS) $(LIBOBJS)
$(CC) -o aklog $(AKLOG_OBJS) $(LIBOBJS) $(SYSLIBS) $(AFSLIBS) $(LDPATH_FLAGS) $(KRB5_LIBS)
install: $(PROGS)
$(INSTALL) -s aklog $(DESTDIR)$(INSTALL_BIN)
--=_kalmia.hozed.org-17192-1118521813-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="aklog.diff"
? src/aklog/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /cvs/openafs/Makefile.in,v
retrieving revision 1.77
diff -u -r1.77 Makefile.in
--- Makefile.in 15 Apr 2005 19:04:55 -0000 1.77
+++ Makefile.in 11 Jun 2005 20:18:59 -0000
@@ -191,6 +191,9 @@
kauth: cmd comerr ubik cmd auth comerr ptserver audit libacl kauth_depinstall
${COMPILE_PART1} kauth ${COMPILE_PART2}
+aklog: comerr
+ ${COMPILE_PART1} aklog ${COMPILE_PART2}
+
dauth: cmd comerr ubik cmd auth kauth comerr
${COMPILE_PART1} dauth ${COMPILE_PART2}
Index: acconfig.h
===================================================================
RCS file: /cvs/openafs/acconfig.h,v
retrieving revision 1.38
diff -u -r1.38 acconfig.h
--- acconfig.h 18 Mar 2004 05:00:32 -0000 1.38
+++ acconfig.h 11 Jun 2005 20:18:59 -0000
@@ -51,6 +51,7 @@
#undef ssize_t
#undef HAVE_STRUCT_BUF
#undef HAVE_ARPA_NAMESER_COMPAT_H
+#undef HAVE_KRB5_PRINCIPAL_GET_REALM
/* glue for RedHat kernel bug */
#undef ENABLE_REDHAT_BUILDSYS
#if defined(ENABLE_REDHAT_BUILDSYS) && defined(KERNEL) && defined(REDHAT_FIX)
Index: acinclude.m4
===================================================================
RCS file: /cvs/openafs/acinclude.m4,v
retrieving revision 1.149
diff -u -r1.149 acinclude.m4
--- acinclude.m4 2 Jun 2005 04:27:27 -0000 1.149
+++ acinclude.m4 11 Jun 2005 20:18:59 -0000
@@ -904,6 +874,11 @@
fi
AC_SUBST(PTHREAD_LIBS)
+KRB5_LIBS=error
+AC_CHECK_LIB(krb5, krb5_init_context, KRB5_LIBS="-lkrb5")
+AC_CHECK_LIB(krb5, krb5_principal_get_realm, AC_DEFINE(HAVE_KRB5_PRINCIPAL_GET_REALM, 1) )
+AC_SUBST(KRB5_LIBS)
+
WITH_OBSOLETE=NO
if test "$enable_obsolete" = "yes"; then
WITH_OBSOLETE=YES
Index: configure.in
===================================================================
RCS file: /cvs/openafs/configure.in,v
retrieving revision 1.69
diff -u -r1.69 configure.in
--- configure.in 3 Apr 2005 18:32:20 -0000 1.69
+++ configure.in 11 Jun 2005 20:18:59 -0000
@@ -43,6 +43,7 @@
src/JAVA/libjafs/Makefile \
src/kauth/test/Makefile \
src/kauth/Makefile \
+src/aklog/Makefile \
src/libacl/test/Makefile \
src/libacl/Makefile \
src/libadmin/adminutil/Makefile \
Index: src/aklog/aklog.h
===================================================================
RCS file: /cvs/openafs/src/aklog/aklog.h,v
retrieving revision 1.1
diff -u -r1.1 aklog.h
--- src/aklog/aklog.h 19 Nov 2004 20:01:29 -0000 1.1
+++ src/aklog/aklog.h 11 Jun 2005 20:19:00 -0000
@@ -12,8 +12,10 @@
static char *rcsid_aklog_h = "$Id: aklog.h,v 1.1 2004/11/19 20:01:29 kenh Exp $";
#endif /* lint || SABER */
+#include <afsconfig.h>
+#include <stds.h>
#include <krb5.h>
-#include <kerberosIV/krb.h>
+#include <des.h>
#include "linked_list.h"
#ifdef __STDC__
@@ -25,9 +27,9 @@
typedef struct {
int (*readlink)ARGS((char *, char *, size_t));
int (*isdir)ARGS((char *, unsigned char *));
- char *(*getwd)ARGS((char *));
- int (*get_cred)ARGS((krb5_context, char *, char *, char *, CREDENTIALS *,
- krb5_creds **));
+ char *(*getcwd)ARGS((char *, size_t));
+ int (*get_cred)ARGS((krb5_context, char *, char *, char *,
+ struct credentials *, krb5_creds **));
int (*get_user_realm)ARGS((krb5_context, char *));
void (*pstderr)ARGS((char *));
void (*pstdout)ARGS((char *));
@@ -37,35 +39,37 @@
void aklog ARGS((int, char *[], aklog_params *));
void aklog_init_params ARGS((aklog_params *));
-#ifdef WINDOWS
-/*
- * Complete server info for one cell.
- *
- * Normally this is defined in afs/cellconfig.h, but the Windows header
- * files and API don't use this structure. So, I'll include it here so
- * I don't have to rewrite large chunks of code.
- */
-#define MAXCELLCHARS 64
-#define MAXHOSTCHARS 64
-#define MAXHOSTSPERCELL 8
-
-struct afsconf_cell {
- char name[MAXCELLCHARS]; /* Cell name */
- short numServers; /* Num active servers for the cell*/
- short flags; /* useful flags */
- struct sockaddr_in hostAddr[MAXHOSTSPERCELL];
- /* IP addresses for cell's servers*/
- char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS];
- /* Names for cell's servers */
- char *linkedCell; /* Linked cell name, if any */
+/* compatability so we don't need krb.h */
+#define ANAME_SZ 40
+#define REALM_SZ 40
+#define SNAME_SZ 40
+#define INST_SZ 40
+#define KSUCCESS 0
+
+/* Definition of text structure used to pass text around */
+#define MAX_KTXT_LEN 1250
+
+struct ktext {
+ int length; /* Length of the text */
+ unsigned char dat[MAX_KTXT_LEN]; /* The data itself */
+ unsigned long mbz; /* zero to catch runaway strings */
};
-/* Windows krb5 libraries don't seem to have this call */
-#define krb5_xfree(p) free(p)
+typedef struct ktext *KTEXT;
+typedef struct ktext KTEXT_ST;
-/* Title for dialog boxes */
-#define AKLOG_DIALOG_NAME "aklog"
+struct credentials {
+ char service[ANAME_SZ]; /* Service name */
+ char instance[INST_SZ]; /* Instance */
+ char realm[REALM_SZ]; /* Auth domain */
+ des_cblock session; /* Session key */
+ int lifetime; /* Lifetime */
+ int kvno; /* Key version number */
+ KTEXT_ST ticket_st; /* The ticket itself */
+ int32_t issue_date; /* The issue time */
+ char pname[ANAME_SZ]; /* Principal's name */
+ char pinst[INST_SZ]; /* Principal's instance */
+};
-#endif /* WINDOWS */
#endif /* __AKLOG_H__ */
Index: src/aklog/aklog_main.c
===================================================================
RCS file: /cvs/openafs/src/aklog/aklog_main.c,v
retrieving revision 1.1
diff -u -r1.1 aklog_main.c
--- src/aklog/aklog_main.c 19 Nov 2004 20:01:29 -0000 1.1
+++ src/aklog/aklog_main.c 11 Jun 2005 20:19:00 -0000
@@ -10,6 +10,7 @@
"$Id: aklog_main.c,v 1.1 2004/11/19 20:01:29 kenh Exp $";
#endif /* lint || SABER */
+#include <afsconfig.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@@ -28,7 +29,6 @@
#include <sys/stat.h>
#include <fcntl.h>
-#ifndef WINDOWS
#include <sys/param.h>
#include <sys/errno.h>
#include <netdb.h>
@@ -36,7 +36,6 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pwd.h>
-#endif /* WINDOWS */
/* on AIX AFS has an unresolved reference to osi_audit. We will define
* it here as extern. It also trys to call the ntohl and htonl routines
@@ -46,36 +45,10 @@
int osi_audit()
{ return(0);}
-#if 0
-#ifdef _AIX
-u_long htonl(u_long x)
- { return(x);}
-
-u_long ntohl(u_long x)
- { return(x);}
-#endif
-
-#include <netinet/in.h>
-/* #include <krb.h> */
-#endif /* 0 */
-
#include <krb5.h>
-#ifdef WINDOWS
-
-#ifdef PRE_AFS35
-#include "afs_tokens.h"
-#include "rxkad.h"
-#else /* !PRE_AFS35 */
-#include <afs/stds.h>
-#include <afs/auth.h>
-#include <rx/rxkad.h>
-#include <afs/dirpath.h>
-#endif /* PRE_AFS35 */
-
-#else /* !WINDOWS */
#include <afs/stds.h>
-#include <afs/com_err.h>
+//#include <afs/com_err.h>
#include <afs/param.h>
#ifdef AFS_SUN5_ENV
@@ -87,7 +60,6 @@
#include <afs/venus.h>
#include <afs/ptserver.h>
#include <afs/dirpath.h>
-#endif /* WINDOWS */
#include "aklog.h"
#include "linked_list.h"
@@ -139,16 +111,6 @@
static char linkedcell[MAXCELLCHARS+1];
static char linkedcell2[MAXCELLCHARS+1];
-#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?
*/
@@ -177,8 +139,6 @@
extern char *afs_realm_of_cell(krb5_context, struct afsconf_cell *);
-#endif /* WINDOWS */
-
/*
* Provide a replacement for strerror if we don't have it
*/
@@ -252,15 +212,11 @@
{
int status = AKLOG_SUCCESS;
struct afsconf_dir *configdir;
-#ifndef PRE_AFS35
char *dirpath;
-#endif /* ! PRE_AFS35 */
memset(local_cell, 0, sizeof(local_cell));
memset((char *)cellconfig, 0, sizeof(*cellconfig));
-#ifndef WINDOWS
-
if (!(configdir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH))) {
sprintf(msgbuf,
"%s: can't get afs configuration (afsconf_Open(%s))\n",
@@ -290,107 +246,11 @@
(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)) {
- sprintf(msgbuf, "%s: can't get local cellname\n", progname);
- params.pstderr(msgbuf);
- params.exitprog(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.
- */
-#ifdef PRE_AFS35
- status = (int) cm_SearchCellFile(cell, &cm_SearchCellFile_CallBack,
-#else
- status = (int) cm_SearchCellFile(cell, NULL, &cm_SearchCellFile_CallBack,
-#endif
- cellconfig /* rock */);
-
- switch(status) {
- case 0:
- break;
-
- case -1:
- sprintf(msgbuf, "%s: GetWindowsDirectory() failed.\n", progname);
- break;
-
- case -2:
- sprintf(msgbuf, "%s: Couldn't open afsdcells.ini for reading\n",
- progname);
- break;
-
- case -3:
- sprintf(msgbuf, "%s: Couldn't find any servers for cell %s\n",
- progname, cell);
- break;
-
- case -4:
- sprintf(msgbuf, "%s: Badly formatted line in afsdcells.ini (does not begin with a \">\" or contain \"#\"\n",
- progname);
- break;
-
- default:
- sprintf(msgbuf, "%s cm_SearchCellFile returned unknown error %d\n",
- status);
- }
-
- if (status) {
- params.pstderr(msgbuf);
- params.exitprog(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
@@ -419,11 +279,9 @@
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;
- CREDENTIALS c;
+ struct credentials c;
struct ktc_principal aserver;
struct ktc_principal aclient;
struct ktc_token atoken, btoken;
@@ -438,12 +296,10 @@
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,
@@ -665,15 +521,12 @@
noprdb = 1;
#endif
-#ifndef WINDOWS
if (noprdb) {
-#endif
if (dflag) {
sprintf(msgbuf, "Not resolving name %s to id (-noprdb set)\n",
username);
params.pstdout(msgbuf);
}
-#ifndef WINDOWS
}
else {
if ((status = params.get_user_realm(context, realm_of_user)) != KSUCCESS) {
@@ -796,7 +649,6 @@
#endif /* ALLOW_REGISTER */
}
-#endif /* !WINDOWS */
if (dflag) {
sprintf(msgbuf, "Set username to %s\n", username);
@@ -821,7 +673,6 @@
* is going on here! So we will do the following operation
*/
write(2,"",0); /* dummy write */
-#ifndef WINDOWS
if ((status = ktc_SetToken(&aserver, &atoken, &aclient, afssetpag))) {
sprintf(msgbuf,
"%s: unable to obtain tokens for cell %s (status: %d).\n",
@@ -829,36 +680,6 @@
params.pstderr(msgbuf);
status = AKLOG_TOKEN;
}
-#else /* WINDOWS */
- /* Note switched 2nd and 3rd args */
-#ifdef PRE_AFS35
- if ((status = ktc_SetToken(&aserver, &aclient, &atoken, afssetpag))) {
-#else
- if ((status = ktc_SetToken(&aserver, &atoken, &aclient, afssetpag))) {
-#endif
- switch(status) {
- case KTC_INVAL:
- sprintf(msgbuf, "%s: Bad ticket length", progname);
- break;
- case KTC_PIOCTLFAIL:
- sprintf(msgbuf, "%s: Unknown error contacting AFS service",
- progname);
- break;
- case KTC_NOCELL:
- sprintf(msgbuf, "%s: Cell name (%s) not recognized by AFS service",
- progname, realm_of_cell);
- break;
- case KTC_NOCM:
- sprintf(msgbuf, "%s: AFS service is unavailable", progname);
- break;
- default:
- sprintf(msgbuf, "%s: Undocumented error (%d) contacting AFS service", progname, status);
- break;
- }
- params.pstderr(msgbuf);
- status = AKLOG_TOKEN;
- }
-#endif /* !WINDOWS */
}
else
if (dflag) {
@@ -869,7 +690,6 @@
return(status);
}
-#ifndef WINDOWS /* struct ViceIoctl missing */
#ifdef __STDC__
static int get_afs_mountpoint(char *file, char *mountpoint, int size)
@@ -1025,8 +845,6 @@
return(pathtocheck);
}
-#endif /* WINDOWS */
-
#if 0
/*****************************************/
int dee_gettokens()
@@ -1057,8 +875,6 @@
/*****************************************/
#endif
-#ifndef WINDOWS /* struct ViceIoctl missing */
-
#ifdef __STDC__
static void add_hosts(char *file)
#else
@@ -1126,10 +942,6 @@
}
}
-#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.
@@ -1158,7 +970,7 @@
if (path[0] == DIR)
strcpy(pathtocheck, path);
else {
- if (params.getwd(pathtocheck) == NULL) {
+ if (params.getcwd(pathtocheck, MAXPATHLEN) == NULL) {
sprintf(msgbuf, "Unable to find current working directory:\n");
params.pstderr(msgbuf);
sprintf(msgbuf, "%s\n", pathtocheck);
@@ -1229,8 +1041,6 @@
return(status);
}
-#endif /* WINDOWS */
-
/* Print usage message and exit */
#ifdef __STDC__
@@ -1325,9 +1135,7 @@
progname = argv[0];
krb5_init_context(&context);
-#ifndef WINDOWS
initialize_ktc_error_table ();
-#endif
memcpy((char *)¶ms, (char *)a_params, sizeof(aklog_params));
@@ -1362,34 +1170,20 @@
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 */
- {
- sprintf(msgbuf, "%s: path mode not supported.\n", progname);
- params.pstderr(msgbuf);
- params.exitprog(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 */
- sprintf(msgbuf, "%s: path mode not supported.\n", progname);
- params.pstderr(msgbuf);
- params.exitprog(AKLOG_MISC);
-#endif /* WINDOWS */
}
else {
cmode++;
@@ -1432,7 +1226,6 @@
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))) {
@@ -1455,7 +1248,6 @@
pmode = FALSE;
memset(path, 0, sizeof(path));
}
-#endif /* WINDOWS */
}
/*
@@ -1509,7 +1301,6 @@
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
@@ -1552,7 +1343,6 @@
}
}
}
-#endif /* WINDOWS */
}
else {
/* Log to all cells in the cells list first */
@@ -1575,13 +1365,11 @@
}
}
-#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
@@ -1592,7 +1380,6 @@
status = AKLOG_SOMETHINGSWRONG;
}
- /* If we are keeping track of zephyr subscriptions, print them. */
if (zsubs)
for (cur_node = zsublist.first; cur_node; cur_node = cur_node->next) {
sprintf(msgbuf, "zsub: %s\n", cur_node->data);
Index: src/aklog/aklog_param.c
===================================================================
RCS file: /cvs/openafs/src/aklog/aklog_param.c,v
retrieving revision 1.1
diff -u -r1.1 aklog_param.c
--- src/aklog/aklog_param.c 19 Nov 2004 20:01:29 -0000 1.1
+++ src/aklog/aklog_param.c 11 Jun 2005 20:19:00 -0000
@@ -26,7 +26,6 @@
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
-#include <kerberosIV/krb.h>
#include <krb5.h>
@@ -38,17 +37,12 @@
#define FALSE 0
#endif
-#ifndef WINDOWS
#if !defined(HAVE_UNISTD_H) || (defined(__sun__) && ! defined(__svr4__))
extern int readlink ARGS((char *, char *, size_t));
#endif
-/* extern int lstat ARGS((char *, struct stat *)); */
-extern char *getwd ARGS((char *));
-#endif /* WINDOWS */
static krb5_ccache _krb425_ccache = 0;
-#ifndef WINDOWS /* Don't have lstat() */
#ifdef __STDC__
static int isdir(char *path, unsigned char *val)
#else
@@ -69,11 +63,10 @@
return (0);
}
}
-#endif /* WINDOWS */
#ifdef __STDC__
static int get_cred(krb5_context context,
- char *name, char *inst, char *realm, CREDENTIALS *c,
+ char *name, char *inst, char *realm, struct credentials *c,
krb5_creds **creds)
#else
static int get_cred(context, name, inst, realm, c, creds)
@@ -114,7 +107,11 @@
return((int)r);
/* This requires krb524d to be running with the KDC */
+#if 0
r = krb5_524_convert_creds(context, *creds, c);
+#else
+ r = krb524_convert_creds_kdc(context, *creds, c);
+#endif
return((int)r);
}
@@ -136,15 +133,20 @@
if (!client_principal)
krb5_cc_get_principal(context, _krb425_ccache, &client_principal);
+#if defined( HAVE_KRB5_PRINCIPAL_GET_REALM )
+ i = strlen(krb5_principal_get_realm(context, client_principal));
+ if (i < REALM_SZ-1) i = REALM_SZ-1;
+ strncpy(realm,krb5_principal_get_realm(context, client_principal),i);
+#else
i = krb5_princ_realm(context, client_principal)->length;
if (i > REALM_SZ-1) i = REALM_SZ-1;
strncpy(realm,krb5_princ_realm(context, client_principal)->data,i);
realm[i] = 0;
+#endif
return(KSUCCESS);
}
-#ifndef WINDOWS
#ifdef __STDC__
static void pstderr(char *string)
@@ -167,26 +169,6 @@
write(1, string, strlen(string));
}
-#else /* WINDOWS */
-
-static void pstderr(char *string)
-{
- if (_isatty(_fileno(stderr)))
- fprintf(stderr, "%s\r\n", string);
- else
- MessageBox(NULL, string, AKLOG_DIALOG_NAME, MB_OK | MB_ICONSTOP);
-}
-
-static void pstdout(char *string)
-{
- if (_isatty(_fileno(stdout)))
- fprintf(stdout, "%s\r\n", string);
- else
- MessageBox(NULL, string, AKLOG_DIALOG_NAME, MB_OK);
-}
-
-#endif /* WINDOWS */
-
#ifdef __STDC__
static void exitprog(char status)
#else
@@ -205,11 +187,9 @@
aklog_params *params;
#endif /* __STDC__ */
{
-#ifndef WINDOWS
params->readlink = readlink;
params->isdir = isdir;
- params->getwd = getwd;
-#endif
+ params->getcwd = getcwd;
params->get_cred = get_cred;
params->get_user_realm = get_user_realm;
params->pstderr = pstderr;
Index: src/aklog/krb_util.c
===================================================================
RCS file: /cvs/openafs/src/aklog/krb_util.c,v
retrieving revision 1.1
diff -u -r1.1 krb_util.c
--- src/aklog/krb_util.c 19 Nov 2004 20:01:29 -0000 1.1
+++ src/aklog/krb_util.c 11 Jun 2005 20:19:00 -0000
@@ -14,27 +14,20 @@
"$Id: krb_util.c,v 1.1 2004/11/19 20:01:29 kenh Exp $";
#endif /* lint */
+#include "aklog.h"
#if 0
#include <kerberosIV/mit-copyright.h>
#endif
+#include <stds.h>
#include <krb5.h>
-#include <kerberosIV/krb.h>
#ifndef MAX_HSTNM
#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 */
-
#define S_AD_SZ sizeof(struct sockaddr_in)
char *afs_realm_of_cell(context, cellconfig)
--=_kalmia.hozed.org-17192-1118521813-0001-2--