From 3f3d14eca8bf0042d24fd3d47677c68548bd2cd1 Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Wed, 29 Mar 1995 01:57:39 +0000 Subject: [PATCH] * Makefile.in (LDFLAGS): Remove, conflicts with pre.in. (kinit): Link with $(CC) $(LDFLAGS), to work on the Mac. * kinit.c (HAVE_PWD_H): Use. (NO_KEYTAB): Skip keytab support if defined. FIXME: NO_KEYTAB needs to be set by configure. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5290 dc483132-0cff-0310-8789-dd5450dbe970 --- src/clients/kinit/ChangeLog | 8 ++++++++ src/clients/kinit/Makefile.in | 3 +-- src/clients/kinit/kinit.c | 28 ++++++++++++++++++++++------ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/clients/kinit/ChangeLog b/src/clients/kinit/ChangeLog index d852c5d7a..90a653982 100644 --- a/src/clients/kinit/ChangeLog +++ b/src/clients/kinit/ChangeLog @@ -1,3 +1,11 @@ +Tue Mar 28 17:55:37 1995 John Gilmore (gnu at toad.com) + + * Makefile.in (LDFLAGS): Remove, conflicts with pre.in. + (kinit): Link with $(CC) $(LDFLAGS), to work on the Mac. + * kinit.c (HAVE_PWD_H): Use. + (NO_KEYTAB): Skip keytab support if defined. + FIXME: NO_KEYTAB needs to be set by configure. + Fri Mar 24 14:45:00 1995 * kinit.c (main): Remove the call to krb5_os_localaddr() since diff --git a/src/clients/kinit/Makefile.in b/src/clients/kinit/Makefile.in index bfb9d2643..512d78214 100644 --- a/src/clients/kinit/Makefile.in +++ b/src/clients/kinit/Makefile.in @@ -1,5 +1,4 @@ CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE) -LDFLAGS = -g COMERRLIB=$(BUILDTOP)/util/et/libcom_err.a @@ -9,7 +8,7 @@ KLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(COMERRLIB) DEPKLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(COMERRLIB) kinit: kinit.o $(DEPKLIB) - $(LD) $(CFLAGS) -o kinit kinit.o $(KLIB) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o kinit kinit.o $(KLIB) $(LIBS) kinit.o: $(srcdir)/kinit.c diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index e1516b3c1..5e66b7e82 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -24,11 +24,13 @@ * Initialize a credentials cache. */ -#include +#include "k5-int.h" #include "com_err.h" -#include -#include "krb5.h" +#include +#ifdef HAVE_PWD_H +#include +#endif #define KRB5_DEFAULT_OPTIONS 0 #define KRB5_DEFAULT_LIFE 60*60*8 /* 8 hours */ @@ -82,7 +84,6 @@ main(argc, argv) krb5_keytab keytab = NULL; struct passwd *pw = 0; int pwsize; - int i; char password[255], *client_name, prompt[255]; krb5_init_context(&kcontext); @@ -107,6 +108,7 @@ main(argc, argv) case 'f': options |= KDC_OPT_FORWARDABLE; break; +#ifndef NO_KEYTAB case 'k': use_keytab = 1; break; @@ -125,6 +127,7 @@ main(argc, argv) errflg++; } break; +#endif case 'l': code = krb5_parse_lifetime(optarg, &lifetime); if (code != 0 || lifetime == 0) { @@ -173,6 +176,7 @@ main(argc, argv) } if (optind != argc-1) { /* No principal name specified */ +#ifndef NO_KEYTAB if (use_keytab) { /* Use the default host/service name */ code = krb5_sname_to_principal(kcontext, NULL, NULL, @@ -182,10 +186,13 @@ main(argc, argv) "when creating default server principal name"); exit(1); } - } else { + } else +#endif + { /* Get default principal from cache if one exists */ code = krb5_cc_get_principal(kcontext, ccache, &me); if (code) { +#ifdef HAVE_PWD_H /* Else search passwd file for client */ pw = getpwuid((int) getuid()); if (pw) { @@ -199,6 +206,10 @@ main(argc, argv) "Unable to identify user from password file\n"); exit(1); } +#else /* HAVE_PWD_H */ + fprintf(stderr, "Unable to identify user\n"); + exit(1); +#endif /* HAVE_PWD_H */ } } } /* Use specified name */ @@ -248,7 +259,10 @@ main(argc, argv) } else my_creds.times.renew_till = 0; - if (!use_keytab) { +#ifndef NO_KEYTAB + if (!use_keytab) +#endif + { (void) sprintf(prompt,"Password for %s: ", (char *) client_name); pwsize = sizeof(password); @@ -265,10 +279,12 @@ main(argc, argv) NULL, preauth, password, ccache, &my_creds, 0); memset(password, 0, sizeof(password)); +#ifndef NO_KEYTAB } else { code = krb5_get_in_tkt_with_keytab(kcontext, options, 0, NULL, preauth, keytab, ccache, &my_creds, 0); +#endif } krb5_free_principal(kcontext, server); -- 2.26.2