+Wed Jul 12 11:55:44 EDT 1995 Paul Park (pjpark@mit.edu)
+ * configure.in - Temporarily add --with-kdb4 option. Default is without
+ kdb4. Without kdb4 enables a define. With kdb4 uses -lkdb4 and
+ -l[n]dbm libraries.
+ * kdb5_convert.c - Conditionalize references to kdb4 routines with
+ KDB4_DISABLE. Replace two required routines:
+ kdb_encrypt_key -> pcbc_encrypt
+ kdb_get_master_key -> des_read_password/printf/key_sched
+
+
Fri Jul 7 15:35:07 EDT 1995 Paul Park (pjpark@mit.edu)
* Makefile.in - Remove all explicit library handling and LDFLAGS.
* configure.in - Add appropriate USE_<mumble> and KRB5_LIBRARIES.
AC_INIT(kdb5_convert.c)
CONFIG_RULES
AC_PROG_INSTALL
-AC_CHECK_LIB(ndbm,main)
-AC_CHECK_LIB(dbm,main)
+AC_ARG_WITH([kdb4],
+[ --with-kdb4 use Kerberos version 4 database library.
+ --without-kdb4 Avoid using Kerberos version 4 database library.],
+,
+withval=no)dnl
+if test "$withval" = yes; then
+ AC_MSG_RESULT(Using Kerberos version 4 database library)
+ USE_KDB4_LIBRARY
+ AC_CHECK_LIB(ndbm,main)
+ AC_CHECK_LIB(dbm,main)
+else
+ AC_DEFINE(KDB4_DISABLE)
+fi
USE_KDB5_LIBRARY
-USE_KDB4_LIBRARY
USE_KRB4_LIBRARY
KRB5_LIBRARIES
V5_USE_SHARED_LIB
int create_local_tgt = 0;
-#ifdef ODBM
+/*
+ * I can't say for sure what ODBM is for, but when KDB4_DISABLE is defined,
+ * we are to avoid compiling any references to KDB4 functions.
+ */
+#if defined(ODBM) || defined(KDB4_DISABLE)
static void
usage(who, status)
char *who;
fprintf(stderr, "usage: %s [-d v5dbpathname] [-t] [-n] [-r realmname] [-K] [-k keytype]\n\
\t[-e etype] [-M mkeyname] -f inputfile\n",
who);
- fprintf(stderr, "\t(You must supply a v4 database dump file for this version of %s\n",who);
+ fprintf(stderr, "\t(You must supply a v4 database dump file for this version of %s)\n",who);
exit(status);
}
#else
tempdb = 1;
break;
case 'D': /* set db name */
-#ifdef ODBM
+#if defined(ODBM) || defined(KDB4_DISABLE)
usage(PROGNAME, 1);
#else
if (v4dumpfile)
}
}
-#ifdef ODBM
+#if defined(ODBM) || defined(KDB4_DISABLE)
if (!v4dumpfile) {
usage(PROGNAME, 1);
}
exit(1);
}
+#ifndef KDB4_DISABLE
if (v4dumpfile)
retval = process_v4_dump(context, v4dumpfile, realm);
else
retval = kerb_db_iterate(enter_in_v5_db, realm);
+#else /* KDB4_DISABLE */
+ retval = process_v4_dump(context, v4dumpfile, realm);
+#endif /* KDB4_DISABLE */
putchar('\n');
if (retval)
com_err(PROGNAME, retval, "while translating entries to the database");
void
v4fini()
{
-#ifndef ODBM
+#if !defined(ODBM) && !defined(KDB4_DISABLE)
kerb_fini();
#endif
}
int manual;
char *dumpfile;
{
-#ifndef ODBM
+#if !defined(ODBM) && !defined(KDB4_DISABLE)
kerb_init();
#endif
+#if !defined(KDB4_DISABLE)
if (name) {
if (kerb_db_set_name(name) != 0) {
com_err(pname, 0,
com_err(pname, 0, "Couldn't read v4 master key.");
return 1;
}
-#ifndef ODBM
+#else /* KDB4_DISABLE */
+ /*
+ * Always reads from terminal.
+ */
+ des_read_password(master_key, "Kerberos master key: ", 1);
+ printf("\n");
+ key_sched(master_key, master_key_schedule);
+#endif /* !KDB4_DISABLE */
+#if !defined(ODBM) && !defined(KDB4_DISABLE)
if (!dumpfile) {
if ((master_key_version = kdb_verify_master_key(master_key,
master_key_schedule,
*/
memcpy(key_from_db, (char *)&princ->key_low, 4);
memcpy(((long *) key_from_db) + 1, (char *)&princ->key_high, 4);
+#ifndef KDB4_DISABLE
kdb_encrypt_key (key_from_db, key_from_db,
master_key, master_key_schedule, DECRYPT);
+#else /* KDB4_DISABLE */
+ pcbc_encrypt((C_Block *) key_from_db,
+ (C_Block *) key_from_db,
+ (long) sizeof(C_Block),
+ master_key_schedule,
+ (C_Block *) master_key,
+ DECRYPT);
+#endif /* KDB4_DISABLE */
val = memcmp((char *) master_key, (char *) key_from_db,
sizeof(master_key));
memset((char *)key_from_db, 0, sizeof(key_from_db));
memcpy((char *)v4key, (char *)&(princ->key_low), 4);
memcpy((char *) (((long *) v4key) + 1), (char *)&(princ->key_high), 4);
+#ifndef KDB4_DISABLE
kdb_encrypt_key (v4key, v4key, master_key, master_key_schedule, DECRYPT);
+#else /* KDB4_DISABLE */
+ pcbc_encrypt((C_Block *) v4key,
+ (C_Block *) v4key,
+ (long) sizeof(C_Block),
+ master_key_schedule,
+ (C_Block *) master_key,
+ DECRYPT);
+#endif /* KDB4_DISABLE */
v4v5key.magic = KV5M_KEYBLOCK;
v4v5key.etype = master_keyblock.etype;
+Wed Jul 12 12:01:04 EDT 1995 Paul Park (pjpark@mit.edu)
+ * configure.in - Temporarily add --with-kdb4 option. Default is without
+ kdb4. Without kdb4 enables a define. With kdb4 uses -lkdb4 and
+ -l[n]dbm libraries.
+ * dumpv4.c - Conditionalize references to kdb4 routines with
+ KDB4_DISABLE. Replace two required routines:
+ kdb_encrypt_key -> pcbc_encrypt
+ kdb_get_master_key -> des_read_password/printf/key_sched
+
+
Fri Jul 7 15:38:00 EDT 1995 Paul Park (pjpark@mit.edu)
* Makefile.in - Remove all explicit library handling and LDFLAGS.
* configure.in - Add USE_<mumble> and KRB5_LIBRARIES.
AC_HAVE_FUNCS(ftime timezone)
AC_CONST
AC_HEADER_STDC
-AC_CHECK_LIB(ndbm,main)
-AC_CHECK_LIB(dbm,main)
AC_HAVE_FUNCS(getcwd)
SS_RULES
+AC_ARG_WITH([kdb4],
+[ --with-kdb4 use Kerberos version 4 database library.
+ --without-kdb4 Avoid using Kerberos version 4 database library.],
+,
+withval=no)dnl
+if test "$withval" = yes; then
+ AC_MSG_RESULT(Using Kerberos version 4 database library)
+ USE_KDB4_LIBRARY
+ AC_CHECK_LIB(ndbm,main)
+ AC_CHECK_LIB(dbm,main)
+else
+ AC_DEFINE(KDB4_DISABLE)
+fi
USE_KDB5_LIBRARY
-USE_KDB4_LIBRARY
USE_KRB4_LIBRARY
USE_SS_LIBRARY
KRB5_LIBRARIES
fprintf(f,"K M 255 1 1 0 ");
+#ifndef KDB4_DISABLE
kdb_encrypt_key (arg.v4_master_key, v4key,
arg.v4_master_key, arg.v4_master_key_schedule,
ENCRYPT);
+#else /* KDB4_DISABLE */
+ pcbc_encrypt((C_Block *) arg.v4_master_key,
+ (C_Block *) v4key,
+ (long) sizeof(C_Block),
+ arg.v4_master_key_schedule,
+ (C_Block *) arg.v4_master_key,
+ ENCRYPT);
+#endif /* KDB4_DISABLE */
for (i=0; i<8; i++) {
fprintf(f, "%02x", ((unsigned char*)v4key)[i]);
}
arg->v5master = &master_encblock;
+#ifndef KDB4_DISABLE
/* now master_encblock is set up for the database, we need the v4 key */
if (kdb_get_master_key (0, arg->v4_master_key, arg->v4_master_key_schedule) != 0)
{
com_err(arg->comerr_name, 0, "Couldn't read v4 master key.");
exit(1);
}
+#else /* KDB4_DISABLE */
+ des_read_password(arg->v4_master_key, "Kerberos master key: ", 1);
+ printf("\n");
+ key_sched(arg->v4_master_key, arg->v4_master_key_schedule);
+#endif /* KDB4_DISABLE */
return 0;
}
/* v4v5key.length = sizeof(v4key); */
memcpy(v4key, v5plainkey.contents, sizeof(des_cblock));
+#ifndef KDB4_DISABLE
kdb_encrypt_key (v4key, v4key,
arg->v4_master_key, arg->v4_master_key_schedule,
ENCRYPT);
+#else /* KDB4_DISABLE */
+ pcbc_encrypt((C_Block *) v4key,
+ (C_Block *) v4key,
+ (long) sizeof(C_Block),
+ arg->v4_master_key_schedule,
+ (C_Block *) arg->v4_master_key,
+ ENCRYPT);
+#endif /* KDB4_DISABLE */
return 0;
}