+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 <tytso@rsx-11.mit.edu>
* kinit.c (main): Remove the call to krb5_os_localaddr() since
CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE)
-LDFLAGS = -g
COMERRLIB=$(BUILDTOP)/util/et/libcom_err.a
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
* Initialize a credentials cache.
*/
-#include <stdio.h>
+#include "k5-int.h"
#include "com_err.h"
-#include <pwd.h>
-#include "krb5.h"
+#include <stdio.h>
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
#define KRB5_DEFAULT_OPTIONS 0
#define KRB5_DEFAULT_LIFE 60*60*8 /* 8 hours */
krb5_keytab keytab = NULL;
struct passwd *pw = 0;
int pwsize;
- int i;
char password[255], *client_name, prompt[255];
krb5_init_context(&kcontext);
case 'f':
options |= KDC_OPT_FORWARDABLE;
break;
+#ifndef NO_KEYTAB
case 'k':
use_keytab = 1;
break;
errflg++;
}
break;
+#endif
case 'l':
code = krb5_parse_lifetime(optarg, &lifetime);
if (code != 0 || lifetime == 0) {
}
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,
"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) {
"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 */
} 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);
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);