[1626] in Kerberos
kerberos v4 mods & patches
daemon@ATHENA.MIT.EDU (Robert Viduya)
Wed Oct 30 19:49:18 1991
Date: 30 Oct 91 21:13:06 GMT
From: robert@shangri-la.gatech.edu (Robert Viduya)
To: kerberos@shelby.Stanford.EDU
The following shar file contains a number of patches to the Kerberos V4
distribution as well as a couple of mods. The changes include:
o A new program called kdb_batch which is simply a modified version
of kdb_edit that takes as input a list of user/instance/password
triples and adds them to the database. The input is one entry
per line with the user name as the first field, the instance as
the second field and the password as the third field. The fields
should be separated by a tab. The source file should be placed in
the src/admin directory (same place as kdb_edit).
o A new conf-*.h file (conf-sequent.h) for Sequents running Dynix
3.1.2. This should be placed in the src/include directory.
o A new conf-*.h file (conf-sgimips.h) for Silicon Graphics
machines running Irix 3.3. This is only partially implemented
and is enough to compile the libraries (which is all we needed).
I had a bit of trouble getting the rest of the programs to compile
and don't have enough time at the moment to work on it.
o A diff of our distribution compared against the original V4 sources
at patchlevel 9. The differences include a number of bug fixes
(which caused our login program to core dump when users mistyped
their password), as well as versions of the library routines
that call the BSD random(3) function to use lrand48 instead for
SysV machines. The random number routines work on SGI machines;
mileage on other SysV machines may vary. This is because I used
a libc routine called gethostid which I don't believe is in the
SVID spec. There are also a bunch of changes to krb_dbm.c from
when I was trying to find a database library that didn't trash
the database when given large numbers (>10,000) of entries (we
ended up using mdbm).
Anyway, here it is... share and enjoy.
------
#! /bin/sh
# Run the following text with /bin/sh to create:
# File gt-diffs (22125 bytes)
# File kdb_batch.c (8200 bytes)
# File conf-sgimips.h (127 bytes)
# File conf-sequent.h (89 bytes)
if test -f 'gt-diffs'
then
echo "`basename $0`: can't extract" 'gt-diffs' "- file exists" 1>&2
else
sed 's/^X//' << '--End_of_gt-diffs--' > 'gt-diffs'
Xdiff -rbc orig/src/admin/Imakefile gt/src/admin/Imakefile
X*** orig/src/admin/Imakefile Wed Oct 30 15:22:16 1991
X--- gt/src/admin/Imakefile Tue Oct 29 14:05:34 1991
X***************
X*** 14,19 ****
X--- 14,20 ----
X ext_srvtab.c \
X kdb_destroy.c \
X kdb_edit.c \
X+ kdb_batch.c \
X kdb_init.c \
X kdb_util.c \
X kstash.c \
X***************
X*** 29,34 ****
X--- 30,36 ----
X program(ext_srvtab,ext_srvtab.o,${DEPLIBS},${LIBS},${DAEMDIR})
X program(kdb_destroy,kdb_destroy.o,,,${DAEMDIR})
X program(kdb_edit,kdb_edit.o maketime.o,${DEPLIBS},${LIBS},${DAEMDIR})
X+ program(kdb_batch,kdb_batch.o maketime.o,${DEPLIBS},${LIBS},${DAEMDIR})
X program(kdb_init,kdb_init.o,${DEPLIBS},${LIBS},${DAEMDIR})
X program(kdb_util,kdb_util.o maketime.o,${DEPLIBS},${LIBS},${DAEMDIR})
X program(kstash,kstash.o,${DEPLIBS},${LIBS},${DAEMDIR})
XOnly in gt/src/admin: kdb_batch.c
Xdiff -rbc orig/src/admin/kdb_util.c gt/src/admin/kdb_util.c
X*** orig/src/admin/kdb_util.c Wed Oct 30 15:22:16 1991
X--- gt/src/admin/kdb_util.c Tue Oct 29 14:05:34 1991
X***************
X*** 219,225 ****
X int code;
X extern char *sys_errlist[];
X char *temp_db_file;
X! temp1 = strlen(db_file+2);
X temp_db_file = malloc (temp1);
X strcpy(temp_db_file, db_file);
X strcat(temp_db_file, "~");
X--- 219,225 ----
X int code;
X extern char *sys_errlist[];
X char *temp_db_file;
X! temp1 = strlen(db_file)+2;
X temp_db_file = malloc (temp1);
X strcpy(temp_db_file, db_file);
X strcat(temp_db_file, "~");
Xdiff -rbc orig/src/include/Imakefile gt/src/include/Imakefile
X*** orig/src/include/Imakefile Thu Jan 4 11:56:41 1990
X--- gt/src/include/Imakefile Wed Oct 30 15:29:08 1991
X***************
X*** 29,34 ****
X--- 29,36 ----
X conf-bsdm68k.h \
X conf-bsdsparc.h \
X conf-ultmips2.h \
X+ conf-sequent.h \
X+ conf-sgimips.h \
X highc.h \
X kdc.h \
X klog.h \
XOnly in gt/src/include: conf-sequent.h
XOnly in gt/src/include: conf-sgimips.h
Xdiff -rbc orig/src/include/osconf.h gt/src/include/osconf.h
X*** orig/src/include/osconf.h Thu Jan 4 11:56:45 1990
X--- gt/src/include/osconf.h Tue Oct 29 15:07:09 1991
X***************
X*** 19,26 ****
X #ifdef vax
X #include "conf-bsdvax.h"
X #else /* !vax */
X! #if defined(mips) && defined(ultrix)
X #include "conf-ultmips2.h"
X #else /* !Ultrix MIPS-2 */
X #ifdef ibm032
X #include "conf-bsdibm032.h"
X--- 19,30 ----
X #ifdef vax
X #include "conf-bsdvax.h"
X #else /* !vax */
X! #if defined(mips)
X! #if defined(ultrix)
X #include "conf-ultmips2.h"
X+ #else
X+ #include "conf-sgimips.h"
X+ #endif
X #else /* !Ultrix MIPS-2 */
X #ifdef ibm032
X #include "conf-bsdibm032.h"
X***************
X*** 41,46 ****
X--- 45,54 ----
X #else /* !sun */
X #ifdef pyr
X #include "conf-pyr.h"
X+ #else
X+ #ifdef sequent
X+ #include "conf-sequent.h"
X+ #endif /* sequent */
X #endif /* pyr */
X #endif /* sun */
X #endif /* apollo */
Xdiff -rbc orig/src/lib/des/new_rnd_key.c gt/src/lib/des/new_rnd_key.c
X*** orig/src/lib/des/new_rnd_key.c Sun Jan 22 13:14:05 1989
X--- gt/src/lib/des/new_rnd_key.c Tue Oct 29 15:07:30 1991
X***************
X*** 69,76 ****
X * Note: this routine calls des_set_random_generator_seed.
X */
X #ifndef BSDUNIX
X! you lose... (aka, you get to implement an analog of this for your
X! system...)
X #else
X
X #include <sys/time.h>
X--- 69,125 ----
X * Note: this routine calls des_set_random_generator_seed.
X */
X #ifndef BSDUNIX
X! extern long time ();
X! void des_init_random_number_generator(key)
X! des_cblock key;
X! {
X! struct { /* This must be 64 bits exactly */
X! long process_id;
X! long host_id;
X! } seed;
X! struct tval {
X! long tsec;
X! long cl;
X! } t; /* this must also be 64 bits exactly */
X! des_cblock new_key;
X! long gethostid();
X!
X! /*
X! * use a host id and process id in generating the seed to ensure
X! * that different servers have different streams:
X! */
X! seed.host_id = gethostid();
X! seed.process_id = getpid();
X!
X! /*
X! * Generate a tempory value that depends on the key, host_id, and
X! * process_id such that it gives no useful information about the key:
X! */
X! des_set_random_generator_seed(key);
X! des_set_sequence_number((unsigned char *)&seed);
X! des_new_random_key(new_key);
X!
X! /*
X! * use it to select a random stream:
X! */
X! des_set_random_generator_seed(new_key);
X!
X! /*
X! * use a time stamp to ensure that a server started later does not reuse
X! * an old stream:
X! */
X! t.tsec = time ((long *) 0);
X! t.cl = clock ();
X! des_set_sequence_number((unsigned char *)&t);
X!
X! /*
X! * use the time stamp finally to select the final seed using the
X! * current random number stream:
X! */
X! des_new_random_key(new_key);
X! des_set_random_generator_seed(new_key);
X! }
X!
X #else
X
X #include <sys/time.h>
Xdiff -rbc orig/src/lib/des/random_key.c gt/src/lib/des/random_key.c
X*** orig/src/lib/des/random_key.c Sat Jan 21 16:50:43 1989
X--- gt/src/lib/des/random_key.c Tue Oct 29 15:07:55 1991
X***************
X*** 96,102 ****
X
X /* **** */
X #else
X! dont know how to do random numbers for this machine;
X #endif
X
X return 0;
X--- 96,134 ----
X
X /* **** */
X #else
X! static long t;
X! extern long time ();
X!
X! if (!p) {
X! p = getpid();
X! p ^= gethostid();
X! }
X!
X! t = time ((long *) 0);
X!
X! /* randomize start */
X! srand48(t ^ p ^ n++);
X!
X! *k++ = lrand48();
X! *k = lrand48();
X!
X! /* make each byte parity odd */
X! for (i = 0; i <= 7; i++) {
X! odd = 0;
X! temp = (unsigned int) *c;
X! /* ignore bit 0, lsb, it will be parity (on vax) */
X! /* should do this with a table lookup */
X! for (j = 0; j <= 6; j++) {
X! temp = temp >> 1;
X! odd ^= temp & 01;
X! }
X! /* set odd parity in lsb */
X! if (!odd)
X! *c |= 1;
X! else
X! *c &= ~1;
X! c++;
X! }
X #endif
X
X return 0;
Xdiff -rbc orig/src/lib/kdb/krb_dbm.c gt/src/lib/kdb/krb_dbm.c
X*** orig/src/lib/kdb/krb_dbm.c Fri Jun 2 13:24:36 1989
X--- gt/src/lib/kdb/krb_dbm.c Tue Oct 29 14:49:10 1991
X***************
X*** 26,34 ****
X--- 26,42 ----
X #include <des.h>
X #include <sys/file.h>
X #ifdef NDBM
X+ #ifdef SDBM
X+ #include "/usr/local/include/sdbm.h"
X+ #else
X #include <ndbm.h>
X+ #endif
X #else /*NDBM*/
X+ #ifdef MDBM
X+ #include <mdbm.h>
X+ #else
X #include <dbm.h>
X+ #endif
X #endif /*NDBM*/
X /* before krb_db.h */
X #include <krb.h>
X***************
X*** 117,124 ****
X */
X
X #ifndef NDBM
X typedef char DBM;
X-
X #define dbm_open(file, flags, mode) ((dbminit(file) == 0)?"":((char *)0))
X #define dbm_fetch(db, key) fetch(key)
X #define dbm_store(db, key, content, flag) store(key, content)
X--- 125,142 ----
X */
X
X #ifndef NDBM
X+ #ifdef MDBM
X+ typedef struct mdbm DBM;
X+ #define dbm_open(file,flags,mode) mdbm_open(file,flags,mode,(int *)0,(int *)0,(char *)0)
X+ #define dbm_fetch(db,key) mdbm_fetch(db,key)
X+ #define dbm_store(db,key,content,flag) mdbm_store(db,key,content,flag)
X+ #define dbm_firstkey(db) mdbm_firstkey(db)
X+ #define dbm_next(db,key) mdbm_nextkey(db,key)
X+ #define dbm_close(db) mdbm_close(db)
X+ #define DBM_INSERT MDBM_INSERT
X+ #define DBM_REPLACE MDBM_REPLACE
X+ #else
X typedef char DBM;
X #define dbm_open(file, flags, mode) ((dbminit(file) == 0)?"":((char *)0))
X #define dbm_fetch(db, key) fetch(key)
X #define dbm_store(db, key, content, flag) store(key, content)
X***************
X*** 125,130 ****
X--- 143,149 ----
X #define dbm_firstkey(db) firstkey()
X #define dbm_next(db,key) nextkey(key)
X #define dbm_close(db) dbmclose()
X+ #endif
X #else
X #define dbm_next(db,key) dbm_nextkey(db)
X #endif
X***************
X*** 294,303 ****
X char *okname = gen_dbsuffix(db_name, ".ok");
X int fd;
X register int ret = 0;
X! #ifdef NDBM
X DBM *db;
X
X db = dbm_open(db_name, O_RDWR|O_CREAT|O_EXCL, 0600);
X if (db == NULL)
X ret = errno;
X else
X--- 313,325 ----
X char *okname = gen_dbsuffix(db_name, ".ok");
X int fd;
X register int ret = 0;
X! #if defined(NDBM) || defined(MDBM)
X DBM *db;
X
X db = dbm_open(db_name, O_RDWR|O_CREAT|O_EXCL, 0600);
X+ #ifdef MDBM
X+ mdbm_bisflags (db, MDBM_ISAUTOW);
X+ #endif
X if (db == NULL)
X ret = errno;
X else
X***************
X*** 341,360 ****
X char *from;
X char *to;
X {
X char *fromdir = gen_dbsuffix (from, ".dir");
X char *todir = gen_dbsuffix (to, ".dir");
X char *frompag = gen_dbsuffix (from , ".pag");
X char *topag = gen_dbsuffix (to, ".pag");
X char *fromok = gen_dbsuffix(from, ".ok");
X long trans = kerb_start_update(to);
X int ok;
X
X! if ((rename (fromdir, todir) == 0)
X! && (rename (frompag, topag) == 0)) {
X (void) unlink (fromok);
X ok = 1;
X }
X-
X free (fromok);
X free (fromdir);
X free (todir);
X--- 363,387 ----
X char *from;
X char *to;
X {
X+ #ifdef MDBM
X+ char *fromdir = gen_dbsuffix (from, ".map");
X+ char *todir = gen_dbsuffix (to, ".map");
X+ char *frompag = gen_dbsuffix (from , ".dat");
X+ char *topag = gen_dbsuffix (to, ".dat");
X+ #else
X char *fromdir = gen_dbsuffix (from, ".dir");
X char *todir = gen_dbsuffix (to, ".dir");
X char *frompag = gen_dbsuffix (from , ".pag");
X char *topag = gen_dbsuffix (to, ".pag");
X+ #endif
X char *fromok = gen_dbsuffix(from, ".ok");
X long trans = kerb_start_update(to);
X int ok;
X
X! if ((rename (fromdir, todir) == 0) && (rename (frompag, topag) == 0)) {
X (void) unlink (fromok);
X ok = 1;
X }
X free (fromok);
X free (fromdir);
X free (todir);
X***************
X*** 398,403 ****
X--- 425,437 ----
X return -1;
X
X db = dbm_open(current_db_name, O_RDONLY, 0600);
X+ #ifdef MDBM
X+ mdbm_bisflags (db, MDBM_ISAUTOW);
X+ #endif
X+ if (db == NULL) {
X+ fprintf (stderr, "db_get_principal: can't open db file, e=%d\n", errno);
X+ return -1;
X+ }
X
X *more = 0;
X
X***************
X*** 404,410 ****
X #ifdef DEBUG
X if (kerb_debug & 2)
X fprintf(stderr,
X! "%s: db_get_principal for %s %s max = %d",
X progname, name, inst, max);
X #endif
X
X--- 438,444 ----
X #ifdef DEBUG
X if (kerb_debug & 2)
X fprintf(stderr,
X! "%s: db_get_principal for %s %s max = %d\n",
X progname, name, inst, max);
X #endif
X
X***************
X*** 430,442 ****
X found = 1;
X goto done;
X }
X- /* process wild cards by looping through entire database */
X
X! for (key = dbm_firstkey(db); key.dptr != NULL;
X! key = dbm_next(db, key)) {
X decode_princ_key(&key, testname, testinst);
X! if ((wildp || !strcmp(testname, name)) &&
X! (wildi || !strcmp(testinst, inst))) { /* have a match */
X if (found >= max) {
X *more = 1;
X goto done;
X--- 464,476 ----
X found = 1;
X goto done;
X }
X
X! /* process wild cards by looping through entire database */
X! for (key = dbm_firstkey(db); key.dptr != NULL; key = dbm_next(db, key)) {
X decode_princ_key(&key, testname, testinst);
X! encode_princ_key(&key, testname, testinst);
X! if ((wildp || !strcmp(testname, name))
X! && (wildi || !strcmp(testinst, inst))) { /* have a match */
X if (found >= max) {
X *more = 1;
X goto done;
X***************
X*** 496,505 ****
X return -1;
X
X db = dbm_open(current_db_name, O_RDWR, 0600);
X
X #ifdef DEBUG
X if (kerb_debug & 2)
X! fprintf(stderr, "%s: kerb_db_put_principal max = %d",
X progname, max);
X #endif
X
X--- 530,546 ----
X return -1;
X
X db = dbm_open(current_db_name, O_RDWR, 0600);
X+ #ifdef MDBM
X+ mdbm_bisflags (db, MDBM_ISAUTOW);
X+ #endif
X+ if (db == NULL) {
X+ fprintf (stderr, " db_put_principal: can't open db file, e=%d\n", errno);
X+ return -1;
X+ }
X
X #ifdef DEBUG
X if (kerb_debug & 2)
X! fprintf(stderr, "%s: kerb_db_put_principal max = %d\n",
X progname, max);
X #endif
X
X***************
X*** 507,513 ****
X for (i = 0; i < max; i++) {
X encode_princ_contents(&contents, principal);
X encode_princ_key(&key, principal->name, principal->instance);
X! dbm_store(db, key, contents, DBM_REPLACE);
X #ifdef DEBUG
X if (kerb_debug & 1) {
X fprintf(stderr, "\n put %s %s\n",
X--- 548,558 ----
X for (i = 0; i < max; i++) {
X encode_princ_contents(&contents, principal);
X encode_princ_key(&key, principal->name, principal->instance);
X! if (dbm_store(db, key, contents, DBM_REPLACE) != 0) {
X! fprintf (stderr, " db_put_principal: can't store %s.%s e=%d\n",
X! principal->name, principal->instance, errno);
X! return -1;
X! }
X #ifdef DEBUG
X if (kerb_debug & 1) {
X fprintf(stderr, "\n put %s %s\n",
X***************
X*** 631,639 ****
X char *arg; /* void *, really */
X {
X datum key, contents;
X- Principal *principal;
X int code;
X DBM *db;
X
X kerb_db_init(); /* initialize and open the database */
X if ((code = kerb_dbl_lock(KERB_DBL_SHARED)) != 0)
X--- 676,685 ----
X char *arg; /* void *, really */
X {
X datum key, contents;
X int code;
X DBM *db;
X+ static char tname[ANAME_SZ], tinst[INST_SZ];
X+ static Principal dbuf;
X
X kerb_db_init(); /* initialize and open the database */
X if ((code = kerb_dbl_lock(KERB_DBL_SHARED)) != 0)
X***************
X*** 640,651 ****
X return code;
X
X db = dbm_open(current_db_name, O_RDONLY, 0600);
X
X for (key = dbm_firstkey (db); key.dptr != NULL; key = dbm_next(db, key)) {
X contents = dbm_fetch (db, key);
X! /* XXX may not be properly aligned */
X! principal = (Principal *) contents.dptr;
X! if ((code = (*func)(arg, principal)) != 0)
X return code;
X }
X dbm_close(db);
X--- 686,705 ----
X return code;
X
X db = dbm_open(current_db_name, O_RDONLY, 0600);
X+ #ifdef MDBM
X+ mdbm_bisflags (db, MDBM_ISAUTOW);
X+ #endif
X+ if (db == NULL) {
X+ fprintf (stderr, "kerb_db_iterate: can't open db file, e=%d\n", errno);
X+ return -1;
X+ }
X
X for (key = dbm_firstkey (db); key.dptr != NULL; key = dbm_next(db, key)) {
X+ decode_princ_key (&key, tname, tinst);
X+ encode_princ_key (&key, tname, tinst);
X contents = dbm_fetch (db, key);
X! decode_princ_contents (&contents, &dbuf);
X! if ((code = (*func)(arg, &dbuf)) != 0)
X return code;
X }
X dbm_close(db);
Xdiff -rbc orig/src/lib/krb/krb_get_in_tkt.c gt/src/lib/krb/krb_get_in_tkt.c
X*** orig/src/lib/krb/krb_get_in_tkt.c Mon Oct 2 15:41:31 1989
X--- gt/src/lib/krb/krb_get_in_tkt.c Tue Oct 29 14:49:30 1991
X***************
X*** 234,240 ****
X bcopy(ptr,(char *)ses,8);
X ptr += 8;
X
X! if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
X return(INTK_BADPW);
X
X /* extract server's name */
X--- 234,241 ----
X bcopy(ptr,(char *)ses,8);
X ptr += 8;
X
X! if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length
X! || (strlen(ptr) + 1) > SNAME_SZ)
X return(INTK_BADPW);
X
X /* extract server's name */
X***************
X*** 241,247 ****
X (void) strcpy(s_name,ptr);
X ptr += strlen(s_name) + 1;
X
X! if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
X return(INTK_BADPW);
X
X /* extract server's instance */
X--- 242,249 ----
X (void) strcpy(s_name,ptr);
X ptr += strlen(s_name) + 1;
X
X! if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length
X! || (strlen(ptr) + 1) > INST_SZ)
X return(INTK_BADPW);
X
X /* extract server's instance */
X***************
X*** 248,259 ****
X (void) strcpy(s_instance,ptr);
X ptr += strlen(s_instance) + 1;
X
X! if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length)
X return(INTK_BADPW);
X
X /* extract server's realm */
X (void) strcpy(rlm,ptr);
X ptr += strlen(rlm) + 1;
X
X /* extract ticket lifetime, server key version, ticket length */
X /* be sure to avoid sign extension on lifetime! */
X--- 250,265 ----
X (void) strcpy(s_instance,ptr);
X ptr += strlen(s_instance) + 1;
X
X! if ((strlen(ptr) + (ptr - (char *) cip->dat)) > cip->length
X! || (strlen(ptr) + 1) > REALM_SZ)
X return(INTK_BADPW);
X
X /* extract server's realm */
X (void) strcpy(rlm,ptr);
X ptr += strlen(rlm) + 1;
X+
X+ if ((3 + (ptr - (char *) cip->dat)) > cip->length)
X+ return(INTK_BADPW);
X
X /* extract ticket lifetime, server key version, ticket length */
X /* be sure to avoid sign extension on lifetime! */
Xdiff -rbc orig/src/util/imake.includes/config.Imakefile gt/src/util/imake.includes/config.Imakefile
X*** orig/src/util/imake.includes/config.Imakefile Wed Oct 30 15:22:20 1991
X--- gt/src/util/imake.includes/config.Imakefile Wed Oct 30 15:41:45 1991
X***************
X*** 87,96 ****
X--- 87,117 ----
X /* #define NOENCRYPTION */
X
X /*
X+ * Define SDBM if you are using the sdbm library.
X+ * NDBM must be defined if SDBM is defined.
X+ */
X+ #undef SDBM
X+
X+ /*
X * Define NDBM if you are using the 4.3 ndbm library (which is part of
X * libc). If not defined, 4.2 dbm will be assumed.
X+ * NDBM must be defined if SDBM is defined.
X */
X+ #undef NDBM
X+
X+ /*
X+ * Define MDBM if you are using the mdbm library.
X+ */
X+ #define MDBM
X+
X+ /*
X+ * Validate db selection.
X+ */
X+ #ifdef SDBM
X+ #ifndef NDBM
X #define NDBM
X+ #endif
X+ #endif
X
X /*
X * Define NEED_SETENV if you don't have setenv() in your libc.
X***************
X*** 142,155 ****
X #endif /* NOENCRYPTION */
X
X #ifdef NDBM
X DBMFLAG=-DNDBM
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a
X! KDB_LIBDEP=$(KDB_LIB)
X #else
X DBMFLAG=
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -ldbm
X- KDB_LIBDEP=$(BUILDTOP)/lib/kdb/libkdb.a
X #endif
X
X #ifdef TKT_SHMEM
X SHMFLAG=-DTKT_SHMEM
X--- 163,185 ----
X #endif /* NOENCRYPTION */
X
X #ifdef NDBM
X+ #ifdef SDBM
X+ DBMFLAG=-DNDBM -DSDBM
X+ KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -lsdbm
X+ #else
X DBMFLAG=-DNDBM
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a
X! #endif
X #else
X+ #ifdef MDBM
X+ DBMFLAG=-DMDBM
X+ KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -lmdbm
X+ #else
X DBMFLAG=
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -ldbm
X #endif
X+ #endif
X+ KDB_LIBDEP=$(BUILDTOP)/lib/kdb/libkdb.a
X
X #ifdef TKT_SHMEM
X SHMFLAG=-DTKT_SHMEM
Xdiff -rbc orig/src/util/patch/imake.includes/config.Imakefile gt/src/util/patch/imake.includes/config.Imakefile
X*** orig/src/util/patch/imake.includes/config.Imakefile Wed Oct 30 15:22:20 1991
X--- gt/src/util/patch/imake.includes/config.Imakefile Wed Oct 30 15:41:45 1991
X***************
X*** 87,96 ****
X--- 87,117 ----
X /* #define NOENCRYPTION */
X
X /*
X+ * Define SDBM if you are using the sdbm library.
X+ * NDBM must be defined if SDBM is defined.
X+ */
X+ #undef SDBM
X+
X+ /*
X * Define NDBM if you are using the 4.3 ndbm library (which is part of
X * libc). If not defined, 4.2 dbm will be assumed.
X+ * NDBM must be defined if SDBM is defined.
X */
X+ #undef NDBM
X+
X+ /*
X+ * Define MDBM if you are using the mdbm library.
X+ */
X+ #define MDBM
X+
X+ /*
X+ * Validate db selection.
X+ */
X+ #ifdef SDBM
X+ #ifndef NDBM
X #define NDBM
X+ #endif
X+ #endif
X
X /*
X * Define NEED_SETENV if you don't have setenv() in your libc.
X***************
X*** 142,155 ****
X #endif /* NOENCRYPTION */
X
X #ifdef NDBM
X DBMFLAG=-DNDBM
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a
X! KDB_LIBDEP=$(KDB_LIB)
X #else
X DBMFLAG=
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -ldbm
X- KDB_LIBDEP=$(BUILDTOP)/lib/kdb/libkdb.a
X #endif
X
X #ifdef TKT_SHMEM
X SHMFLAG=-DTKT_SHMEM
X--- 163,185 ----
X #endif /* NOENCRYPTION */
X
X #ifdef NDBM
X+ #ifdef SDBM
X+ DBMFLAG=-DNDBM -DSDBM
X+ KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -lsdbm
X+ #else
X DBMFLAG=-DNDBM
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a
X! #endif
X #else
X+ #ifdef MDBM
X+ DBMFLAG=-DMDBM
X+ KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -lmdbm
X+ #else
X DBMFLAG=
X KDB_LIB=$(BUILDTOP)/lib/kdb/libkdb.a -ldbm
X #endif
X+ #endif
X+ KDB_LIBDEP=$(BUILDTOP)/lib/kdb/libkdb.a
X
X #ifdef TKT_SHMEM
X SHMFLAG=-DTKT_SHMEM
Xdiff -rbc orig/src/util/ss/cmd_tbl.lex.l gt/src/util/ss/cmd_tbl.lex.l
X*** orig/src/util/ss/cmd_tbl.lex.l Thu Jul 2 14:18:42 1987
X--- gt/src/util/ss/cmd_tbl.lex.l Tue Oct 29 15:11:32 1991
X***************
X*** 31,36 ****
X--- 31,39 ----
X * For copyright info, see mit-sipb-copyright.h.
X */
X #include <string.h>
X+ #ifdef sgi
X+ #define rindex strrchr
X+ #endif
X #include "ct.h"
X #include "mit-sipb-copyright.h"
X
Xdiff -rbc orig/src/util/ss/listen.c gt/src/util/ss/listen.c
X*** orig/src/util/ss/listen.c Thu Jul 2 14:18:30 1987
X--- gt/src/util/ss/listen.c Tue Oct 29 15:11:46 1991
X***************
X*** 11,16 ****
X--- 11,19 ----
X #include "mit-sipb-copyright.h"
X #include "ss_internal.h"
X #include <signal.h>
X+ #ifdef sgi
X+ #define index strchr
X+ #endif
X
X #ifndef lint
X static char rcs_id[] = "$Header: listen.c,v 1.4 87/01/21 07:34:06 spook Exp $";
Xdiff -rbc orig/src/util/ss/make_commands.c gt/src/util/ss/make_commands.c
X*** orig/src/util/ss/make_commands.c Thu Jul 2 14:18:35 1987
X--- gt/src/util/ss/make_commands.c Tue Oct 29 15:13:45 1991
X***************
X*** 12,17 ****
X--- 12,20 ----
X #include <stdio.h>
X #include <sys/file.h>
X #include <strings.h>
X+ #ifdef sgi
X+ #define rindex strrchr
X+ #endif
X #include "ss.h"
X
X static char copyright[] = "Copyright 1987 by MIT Student Information Processing Board";
X***************
X*** 86,93 ****
X--- 89,101 ----
X /* now compile it */
X if (!vfork()) {
X chdir("/tmp");
X+ #ifdef sgi
X+ execl("/usr/bin/cc", "cc", "-c", "-R", "-O", c_file, 0);
X+ perror("/usr/bin/cc");
X+ #else
X execl("/bin/cc", "cc", "-c", "-R", "-O", c_file, 0);
X perror("/bin/cc");
X+ #endif
X _exit(1);
X }
X else wait(0);
X***************
X*** 98,106 ****
X if (!rename(o_file, z_file)) {
X if (!vfork()) {
X chdir("/tmp");
X! execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r", "-n",
X z_file+5, 0);
X perror("/bin/ld");
X _exit(1);
X }
X else wait(0);
X--- 106,120 ----
X if (!rename(o_file, z_file)) {
X if (!vfork()) {
X chdir("/tmp");
X! #ifdef sgi
X! execl("/usr/bin/ld", "ld", "-o", o_file+5, "-s", "-r",
X z_file+5, 0);
X+ perror("/usr/bin/ld");
X+ #else
X+ execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r",
X+ z_file+5, 0);
X perror("/bin/ld");
X+ #endif
X _exit(1);
X }
X else wait(0);
--End_of_gt-diffs--
if test 22125 -ne `wc -c < 'gt-diffs'`
then
echo "`basename $0`: error in" 'gt-diffs' ": sent 22125 chars, received `wc -c < 'gt-diffs'`" 1>&2
fi
fi
if test -f 'kdb_batch.c'
then
echo "`basename $0`: can't extract" 'kdb_batch.c' "- file exists" 1>&2
else
sed 's/^X//' << '--End_of_kdb_batch.c--' > 'kdb_batch.c'
X/*
X * $Source: /afs/athena.mit.edu/astaff/project/kerberos/src/admin/RCS/kdb_edit.c,v $
X * $Author: raeburn $
X *
X * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
X * of Technology.
X *
X * For copying and distribution information, please see the file
X * <mit-copyright.h>.
X *
X * This routine changes the Kerberos encryption keys for principals,
X * i.e., users or services.
X */
X
X/*
X * exit returns 0 ==> success -1 ==> error
X */
X
X#ifndef lint
Xstatic char rcsid_kdb_edit_c[] =
X"$Id: kdb_edit.c,v 4.2 90/01/09 16:05:09 raeburn Exp $";
X#endif lint
X
X#include <mit-copyright.h>
X
X#include <stdio.h>
X#include <signal.h>
X#include <errno.h>
X#include <strings.h>
X#include <sys/ioctl.h>
X#include <sys/file.h>
X#include <ctype.h>
X#include "time.h"
X#include <des.h>
X#include <krb.h>
X#include <krb_db.h>
X/* MKEYFILE is now defined in kdc.h */
X#include <kdc.h>
X
Xextern char *errmsg();
Xextern int errno;
Xextern char *strcpy();
X
Xvoid sig_exit();
X
X#define zaptime(foo) bzero((char *)(foo), sizeof(*(foo)))
X
Xchar prog[32];
Xchar *progname = prog;
Xint nflag = 0;
Xint debug;
Xextern kerb_debug;
Xextern char *sys_errlist[];
X
XC_Block new_key;
X
Xint i, j;
Xint more;
X
Xchar input_name[ANAME_SZ];
Xchar input_instance[INST_SZ];
X
X#define MAX_PRINCIPAL 10
XPrincipal principal_data[MAX_PRINCIPAL];
X
Xstatic Principal old_principal;
Xstatic Principal default_princ;
X
Xstatic C_Block master_key;
Xstatic C_Block session_key;
Xstatic Key_schedule master_key_schedule;
Xstatic char pw_str[255];
Xstatic long master_key_version;
X
Xextern long kdb_get_master_key (), kdb_verify_master_key ();
X
Xmain(argc, argv)
X int argc;
X char *argv[];
X
X{
X /* Local Declarations */
X
X long n;
X
X prog[sizeof prog - 1] = '\0'; /* make sure terminated */
X (void) strncpy(prog, argv[0], sizeof prog - 1); /* salt away invoking
X * program */
X
X /* Assume a long is four bytes */
X if (sizeof(long) != 4) {
X (void) fprintf(stderr, "%s: size of long is %d.\n", sizeof(long), prog);
X exit(-1);
X }
X /* Assume <=32 signals */
X if (NSIG > 32) {
X (void) fprintf(stderr, "%s: more than 32 signals defined.\n", prog);
X exit(-1);
X }
X while (--argc > 0 && (*++argv)[0] == '-')
X for (i = 1; argv[0][i] != '\0'; i++) {
X switch (argv[0][i]) {
X
X /* debug flag */
X case 'd':
X debug = 1;
X continue;
X
X /* debug flag */
X case 'l':
X kerb_debug |= 1;
X continue;
X
X case 'n': /* read MKEYFILE for master key */
X nflag = 1;
X continue;
X
X default:
X (void) fprintf(stderr, "%s: illegal flag \"%c\"\n",
X progname, argv[0][i]);
X Usage(); /* Give message and die */
X }
X };
X
X kerb_init();
X if (argc > 0) {
X if (kerb_db_set_name(*argv) != 0) {
X (void) fprintf(stderr, "Could not open altername database name\n");
X exit(1);
X }
X }
X
X#ifdef notdef
X no_core_dumps(); /* diddle signals to avoid core dumps! */
X
X /* ignore whatever is reasonable */
X (void) signal(SIGHUP, SIG_IGN);
X (void) signal(SIGINT, SIG_IGN);
X (void) signal(SIGTSTP, SIG_IGN);
X
X#endif
X
X if (kdb_get_master_key ((nflag == 0),
X master_key, master_key_schedule) != 0L) {
X (void) fprintf (stderr, "Couldn't read master key.\n");
X exit (-1);
X }
X
X if ((master_key_version = kdb_verify_master_key(master_key,
X master_key_schedule,
X stdout)) < 0L)
X exit (-1);
X
X /* lookup the default values */
X n = kerb_get_principal(KERB_DEFAULT_NAME, KERB_DEFAULT_INST,
X &default_princ, 1, &more);
X if (n != 1) {
X (void) fprintf(stderr,
X "%s: Kerberos error on default value lookup, %d found.\n",
X progname, n);
X exit(-1);
X }
X
X while (change_principal()) {
X }
X
X cleanup();
X return (0);
X}
X
Xparse_input (line)
Xchar *line;
X{
X char *s, *d;
X
X s = line;
X while (*s && isspace (*s))
X s++;
X d = input_name;
X while (*s && !isspace (*s))
X *d++ = *s++;
X *d = '\0';
X while (*s && isspace (*s))
X s++;
X d = input_instance;
X while (*s && !isspace (*s))
X *d++ = *s++;
X *d = '\0';
X while (*s && isspace (*s))
X s++;
X d = pw_str;
X while (*s && !isspace (*s))
X *d++ = *s++;
X *d = '\0';
X return ((input_name[0] == '\0' || pw_str[0] == '\0') ? 0 : 1);
X
X}
X
Xchange_principal()
X{
X static char temp[255];
X int creating = 0;
X struct tm *tp, *localtime();
X long maketime();
X
X if (fgets (temp, 255, stdin) == NULL)
X return (0);
X if (!parse_input (temp)) {
X (void) fprintf (stderr, "bad input line: %s\n", temp);
X return (1); /* continue to next line */
X }
X j = kerb_get_principal(input_name, input_instance, principal_data,
X MAX_PRINCIPAL, &more);
X if (!j) {
X /* make a new principal, fill in defaults */
X (void) fprintf (stdout, "creating %s.%s\n", input_name, input_instance);
X j = 1;
X creating = 1;
X (void) strcpy(principal_data[0].name, input_name);
X (void) strcpy(principal_data[0].instance, input_instance);
X principal_data[0].old = NULL;
X principal_data[0].exp_date = default_princ.exp_date;
X principal_data[0].max_life = default_princ.max_life;
X principal_data[0].attributes = default_princ.attributes;
X principal_data[0].kdc_key_ver = (unsigned char) master_key_version;
X principal_data[0].key_version = 0; /* bumped up later */
X }
X else
X (void) fprintf (stdout, "updating %s.%s\n", input_name, input_instance);
X tp = localtime((long *) &principal_data[0].exp_date);
X (void) sprintf(principal_data[0].exp_date_txt, "%4d-%02d-%02d",
X tp->tm_year > 1900 ? tp->tm_year : tp->tm_year + 1900,
X tp->tm_mon + 1, tp->tm_mday); /* January is 0, not 1 */
X for (i = 0; i < j; i++) {
X for (;;) {
X if (!creating) {
X /*
X * copy the existing data so we can use the old values
X * for the qualifier clause of the replace
X */
X principal_data[i].old = (char *) &old_principal;
X bcopy((char *) (&principal_data[i]), (char *) (&old_principal),
X sizeof(old_principal));
X }
X if (!strcmp(pw_str, "RANDOM")) {
X#ifdef NOENCRYPTION
X bzero(new_key, sizeof(C_Block));
X new_key[0] = 127;
X#else
X random_key(new_key); /* yes, random */
X#endif
X bzero(pw_str, sizeof pw_str);
X } else if (!strcmp(pw_str, "NULL")) {
X principal_data[i].key_low = 0;
X principal_data[i].key_high = 0;
X goto null_key;
X } else {
X#ifdef NOENCRYPTION
X bzero(new_key, sizeof(C_Block));
X new_key[0] = 127;
X#else
X string_to_key(pw_str, new_key);
X#endif
X bzero(pw_str, sizeof pw_str);
X }
X
X /* seal it under the kerberos master key */
X kdb_encrypt_key (new_key, new_key,
X master_key, master_key_schedule,
X ENCRYPT);
X bcopy((char *) (new_key), (char *) (&principal_data[i].key_low), 4);
X bcopy((char *) (((long *) new_key) + 1),
X (char *) (&principal_data[i].key_high), 4);
X bzero((char *) new_key, sizeof(new_key));
Xnull_key:
X /* set master key version */
X principal_data[i].kdc_key_ver = (unsigned char) master_key_version;
X /* bump key version # */
X principal_data[i].key_version++;
X
X if (kerb_put_principal(&principal_data[i], 1)) {
X (void) fprintf(stderr, "\nError updating Kerberos database\n");
X }
X
X bzero((char *) &principal_data[i].key_low, 4);
X bzero((char *) &principal_data[i].key_high, 4);
X break;
X }
X }
X return 1;
X}
X
X
Xno_core_dumps()
X{
X
X (void) signal(SIGQUIT, sig_exit);
X (void) signal(SIGILL, sig_exit);
X (void) signal(SIGTRAP, sig_exit);
X (void) signal(SIGIOT, sig_exit);
X (void) signal(SIGEMT, sig_exit);
X (void) signal(SIGFPE, sig_exit);
X (void) signal(SIGBUS, sig_exit);
X (void) signal(SIGSEGV, sig_exit);
X (void) signal(SIGSYS, sig_exit);
X}
X
Xvoid
Xsig_exit(sig, code, scp)
X int sig, code;
X struct sigcontext *scp;
X{
X cleanup();
X (void) fprintf(stderr,
X "\nSignal caught, sig = %d code = %d old pc = 0x%X \nexiting",
X sig, code, scp->sc_pc);
X exit(-1);
X}
X
X
Xcleanup()
X{
X
X bzero((char *) master_key, sizeof(master_key));
X bzero((char *) session_key, sizeof(session_key));
X bzero((char *) master_key_schedule, sizeof(master_key_schedule));
X bzero((char *) principal_data, sizeof(principal_data));
X bzero((char *) new_key, sizeof(new_key));
X bzero((char *) pw_str, sizeof(pw_str));
X}
XUsage()
X{
X (void) fprintf(stderr, "Usage: %s [-n]\n", progname);
X exit(1);
X}
--End_of_kdb_batch.c--
if test 8200 -ne `wc -c < 'kdb_batch.c'`
then
echo "`basename $0`: error in" 'kdb_batch.c' ": sent 8200 chars, received `wc -c < 'kdb_batch.c'`" 1>&2
fi
fi
if test -f 'conf-sgimips.h'
then
echo "`basename $0`: can't extract" 'conf-sgimips.h' "- file exists" 1>&2
else
sed 's/^X//' << '--End_of_conf-sgimips.h--' > 'conf-sgimips.h'
X#include <mit-copyright.h>
X
X#define MIPS2
X#define BITS32
X#define BIG
X#define MSBFIRST
X#define MUSTALIGN
X#define signal sigset
--End_of_conf-sgimips.h--
if test 127 -ne `wc -c < 'conf-sgimips.h'`
then
echo "`basename $0`: error in" 'conf-sgimips.h' ": sent 127 chars, received `wc -c < 'conf-sgimips.h'`" 1>&2
fi
fi
if test -f 'conf-sequent.h'
then
echo "`basename $0`: can't extract" 'conf-sequent.h' "- file exists" 1>&2
else
sed 's/^X//' << '--End_of_conf-sequent.h--' > 'conf-sequent.h'
X#include <mit-copyright.h>
X
X#define BITS32
X#define BIG
X#define LSBFIRST
X#define BSDUNIX
X
--End_of_conf-sequent.h--
if test 89 -ne `wc -c < 'conf-sequent.h'`
then
echo "`basename $0`: error in" 'conf-sequent.h' ": sent 89 chars, received `wc -c < 'conf-sequent.h'`" 1>&2
fi
fi
exit 0
--
Robert Viduya robert@shangri-la.gatech.edu
Technical Services / Information Technology
Georgia Institute of Technology (404) 894-6296
Atlanta, Georgia 30332-0715