kdb_dbm.c: Remove vestigal code which was using BERK_DB_DBM define.
authorTheodore Tso <tytso@mit.edu>
Thu, 22 Aug 1996 20:28:23 +0000 (20:28 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 22 Aug 1996 20:28:23 +0000 (20:28 +0000)
Still need to remove kludgey database "switch" code and recode to use
the db interface.

t_kdb.c: Update t_kdb to use the new libkdb interface.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8966 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kdb/ChangeLog
src/lib/kdb/Makefile.in
src/lib/kdb/configure.in
src/lib/kdb/kdb_dbm.c
src/lib/kdb/t_kdb.c

index efee9da039fe93e3c079ad65c40dc8c84e6e8b1b..8f3e3776a6138e97d85324bee8cba344170acc26 100644 (file)
@@ -1,3 +1,11 @@
+Thu Aug 22 16:22:01 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * kdb_dbm.c: Remove vestigal code which was using BERK_DB_DBM
+               define.  Still need to remove kludgey database "switch"
+               code and recode to use the db interface.
+
+       * t_kdb.c: Update t_kdb to use the new libkdb interface.
+
 Mon Aug 12 14:11:29 1996  Barry Jaspan  <bjaspan@mit.edu>
 
        * kdb_dbm.c (krb5_dbm_db_rename): rename should not insist that
index 77c31bb1401f4bb9981a97cb5aaadbfa57fff166..6167140be82efb56425f4bbc613bf8890fe622c6 100644 (file)
@@ -71,7 +71,8 @@ t_kdb:        t_kdb.o $(DEPLIBS)
        $(LD) $(LDFLAGS) $(LDARGS) -o t_kdb t_kdb.o $(LIBS)
 
 check::        t_kdb
-       $(KRB5_RUN_ENV) ./t_kdb
+       $(KRB5_RUN_ENV) ./t_kdb -tcv
+       $(KRB5_RUN_ENV) ./t_kdb -tcvr
 
 clean::
        $(RM) t_kdb t_kdb.o
index 75c4e40c869a1678a17f5f6171e6b9e75048cb3f..67d18d5aee329509d93c3a4c68c733046cae8583 100644 (file)
@@ -18,6 +18,7 @@ case $krb5_cv_host in
 esac
 KRB5_RUN_FLAGS
 V5_USE_SHARED_LIB
+USE_KDB5_LIBRARY
 KRB5_LIBRARIES
 V5_SHARED_LIB_OBJS
 V5_MAKE_SHARED_LIB(libkdb5,0.1,.., ./kdb)
index 5b1e06d04cdcd6542bf9e5b557f3a110d9b09b5b..c80087d8338b1ce19ca38a90b9d243014cd8ba57 100644 (file)
@@ -59,55 +59,6 @@ static krb5_error_code krb5_dbm_db_start_update
 static krb5_error_code krb5_dbm_db_end_update 
        PROTOTYPE((krb5_context));
 
-#ifdef BERK_DB_DBM
-/*
- * This module contains all of the code which directly interfaces to
- * the underlying representation of the Kerberos database; this
- * implementation uses a Berkeley hashed database file to store the
- * relations, plus a second file as a semaphore to allow the database
- * to be replaced out from underneath the KDC server.
- */
-extern DBM     *db_dbm_open PROTOTYPE((char *, int, int));
-extern void     db_dbm_close PROTOTYPE((DBM *));
-extern datum    db_dbm_fetch PROTOTYPE((DBM *, datum));
-extern datum    db_dbm_firstkey PROTOTYPE((DBM *));
-extern datum    db_dbm_nextkey PROTOTYPE((DBM *));
-extern int      db_dbm_delete PROTOTYPE((DBM *, datum));
-extern int      db_dbm_store PROTOTYPE((DBM *, datum, datum, int));
-extern int     db_dbm_error PROTOTYPE((DBM *));
-extern int     db_dbm_clearerr PROTOTYPE((DBM *));
-extern int     db_dbm_dirfno PROTOTYPE((DBM *));
-
-static kdb5_dispatch_table kdb5_default_dispatch = {
-    "Berkeley Hashed Database",
-    ".db",                     /* Index file name ext  */
-    (char *) NULL,             /* Data file name ext   */
-    ".ok",                     /* Lock file name ext   */
-    db_dbm_open,               /* Open Database        */
-    db_dbm_close,              /* Close Database       */
-    db_dbm_fetch,              /* Fetch Key            */
-    db_dbm_firstkey,           /* Fetch First Key      */
-    db_dbm_nextkey,            /* Fetch Next Key       */
-    db_dbm_delete,             /* Delete Key           */
-    db_dbm_store,              /* Store Key            */
-    db_dbm_error,              /* Get Database Error   */
-    db_dbm_clearerr,           /* Clear Database Error */
-    db_dbm_dirfno,             /* Get DB index FD num  */
-    (int (*)()) NULL           /* Get DB data FD num   */
-};
-#else  /* BERK_DB_DBM */
-/*
- * The following prototypes are necessary in case dbm_error and
- * dbm_clearerr are in the library but not prototyped
- * (e.g. NetBSD-1.0)
- */
-#if defined(MISSING_ERROR_PROTO) && !defined(dbm_error)
-int dbm_error PROTOTYPE((DBM *));
-#endif
-#if defined(MISSING_CLEARERR_PROTO) && !defined(dbm_clearerr)
-int dbm_clearerr PROTOTYPE((DBM *));
-#endif
-
 /*
  * This module contains all of the code which directly interfaces to
  * the underlying representation of the Kerberos database; this
@@ -116,9 +67,9 @@ int dbm_clearerr PROTOTYPE((DBM *));
  * from underneath the KDC server.
  */
 static kdb5_dispatch_table kdb5_default_dispatch = {
-    "Stock [N]DBM Database",
-    ".dir",                    /* Index file name ext  */
-    ".pag",                    /* Data file name ext   */
+    "Berkeley Hashed Database w/ DBM interface",
+    ".db",                     /* Index file name ext  */
+    (char *) NULL,             /* Data file name ext   */
     ".ok",                     /* Lock file name ext   */
     dbm_open,                  /* Open Database        */
     dbm_close,                 /* Close Database       */
@@ -131,20 +82,9 @@ static kdb5_dispatch_table kdb5_default_dispatch = {
      * The following are #ifdef'd because they have the potential to be
      * macros rather than functions.
      */
-#ifdef dbm_error
-    (int (*)()) NULL,          /* Get Database Error   */
-#else  /* dbm_error */
-    dbm_error,                 /* Get Database Error   */
-#endif /* dbm_error */
-#ifdef dbm_clearerr
-    (int (*)()) NULL,          /* Clear Database Error */
-#else  /* dbm_clearerr */
-    dbm_clearerr,              /* Clear Database Error */
-#endif /* dbm_clearerr */
     (int (*)()) NULL,          /* Get DB index FD num  */
     (int (*)()) NULL,          /* Get DB data FD num   */
 };
-#endif /* BERK_DB_DBM */
 
 /*
  * These macros dispatch via the dispatch table.
@@ -169,18 +109,6 @@ static kdb5_dispatch_table kdb5_default_dispatch = {
 #define        KDBM_STORE(dbc, db, key, c, f)  ((*(((krb5_db_context *)dbc)->  \
                                            db_dispatch->kdb5_dbm_store)) \
                                         (db, key, c, f))
-#define        KDBM_ERROR(dbc, db)             ((((krb5_db_context *)dbc)->     \
-                                         db_dispatch->kdb5_dbm_error) ? \
-                                        ((*(((krb5_db_context *)dbc)->  \
-                                            db_dispatch->kdb5_dbm_error)) \
-                                         (db)) :                        \
-                                        dbm_error(db))
-#define        KDBM_CLEARERR(dbc, db)          ((((krb5_db_context *)dbc)->     \
-                                         db_dispatch->kdb5_dbm_clearerr) ? \
-                                        ((*(((krb5_db_context *)dbc)->  \
-                                            db_dispatch->kdb5_dbm_clearerr)) \
-                                         (db)) :                        \
-                                        dbm_clearerr(db))
 #define        KDBM_INDEX_EXT(dbc)             (((krb5_db_context *)dbc)->      \
                                          db_dispatch->kdb5_db_index_ext)
 #define        KDBM_DATA_EXT(dbc)              (((krb5_db_context *)dbc)->      \
@@ -271,7 +199,7 @@ k5dbm_init_context(context)
     krb5_db_context *  db_ctx;
 
     if (context->db_context == NULL) {
-       if (db_ctx = (krb5_db_context *) malloc(sizeof(krb5_db_context))) {
+       if ((db_ctx = (krb5_db_context *) malloc(sizeof(krb5_db_context)))) {
            memset((char *) db_ctx, 0, sizeof(krb5_db_context));
            k5dbm_clear_context((krb5_db_context *)db_ctx);
            context->db_context = (void *) db_ctx;
index 5c55f2ff624a385b6f0301d0d55d509430efd04d..3d887234c45468ae092ff7caa7115f3010df694a 100644 (file)
 
 #define        KDB5_DISPATCH
 #include "k5-int.h"
+#include <ctype.h>
 #include <sys/time.h>
+#include <sys/wait.h>
+#include "com_err.h"
 
 #if    HAVE_SRAND48
 #define        RAND()          lrand48()
@@ -215,12 +218,16 @@ init_princ_recording(kcontext, nentries)
     krb5_context       kcontext;
     int                nentries;
 {
-    if (recorded_principals = (krb5_principal *)
-       malloc(nentries * sizeof(krb5_principal)))
-       memset((char *) recorded_principals, 0,
-              nentries * sizeof(krb5_principal));
-    if (recorded_names = (char **) malloc(nentries * sizeof(char *)))
-       memset((char *) recorded_names, 0, nentries * sizeof(char *));
+    recorded_principals = (krb5_principal *)
+           malloc(nentries * sizeof(krb5_principal));
+    if (!recorded_principals)
+           abort();
+    memset((char *) recorded_principals, 0,
+          nentries * sizeof(krb5_principal));
+    recorded_names = (char **) malloc(nentries * sizeof(char *));
+    if (!recorded_names)
+           abort();
+    memset((char *) recorded_names, 0, nentries * sizeof(char *));
 }
 
 /*
@@ -275,8 +282,8 @@ add_principal(kcontext, principal, eblock, key, rseed)
 {
     krb5_error_code      kret;
     krb5_db_entry        dbent;
-    krb5_tl_mod_princ    mod_princ;
     krb5_keyblock      * rkey = NULL;
+    krb5_timestamp       timenow;
     int                          nentries = 1;
 
     memset((char *) &dbent, 0, sizeof(dbent));
@@ -287,25 +294,25 @@ add_principal(kcontext, principal, eblock, key, rseed)
     dbent.expiration           = KRB5_KDB_EXPIRATION;
     dbent.max_renewable_life   = KRB5_KDB_MAX_RLIFE;
 
-    if (kret = krb5_copy_principal(kcontext, principal, &dbent.princ))
+    if ((kret = krb5_copy_principal(kcontext, principal, &dbent.princ)))
        goto out;
 
-    mod_princ.mod_princ = principal;
-    if (kret = krb5_timeofday(kcontext, &mod_princ.mod_date))
-       goto out;
-    if (kret = krb5_dbe_encode_mod_princ_data(kcontext, &mod_princ, &dbent))
+    if ((kret = krb5_timeofday(kcontext, &timenow)))
        goto out;
+    if ((kret = krb5_dbe_update_mod_princ_data(kcontext, &dbent,
+                                              timenow, principal)))
+           goto out;
 
     if (!key) {
-       if (kret = krb5_random_key(kcontext, eblock, rseed, &rkey))
+       if ((kret = krb5_random_key(kcontext, eblock, rseed, &rkey)))
            goto out;
     } else
        rkey = key;
 
-    if (kret = krb5_dbe_create_key_data(kcontext, &dbent))
+    if ((kret = krb5_dbe_create_key_data(kcontext, &dbent)))
        goto out;
-    if (kret = krb5_dbekd_encrypt_key_data(kcontext, eblock, rkey, NULL, 1,
-                                          &dbent.key_data[0]))
+    if ((kret = krb5_dbekd_encrypt_key_data(kcontext, eblock, rkey, NULL, 1,
+                                           &dbent.key_data[0])))
        goto out;
 
     if (!key)
@@ -382,36 +389,36 @@ find_principal(kcontext, principal, docompare)
 {
     krb5_error_code    kret;
     krb5_db_entry      dbent;
-    krb5_tl_mod_princ *        mod_princ;
+    krb5_principal     mod_princ;
+    krb5_timestamp     mod_time;
     int                        how_many;
     krb5_boolean       more;
 
     more = 0;
     how_many = 1;
-    if (kret = krb5_db_get_principal(kcontext, principal, &dbent,
-                                    &how_many, &more))
+    if ((kret = krb5_db_get_principal(kcontext, principal, &dbent,
+                                     &how_many, &more)))
        return(kret);
     if (how_many == 0) 
        return(KRB5_KDB_NOENTRY);
 
-    if (kret = krb5_dbe_decode_mod_princ_data(kcontext, &dbent, &mod_princ)) {
-       krb5_db_free_principal(kcontext, &dbent, how_many);
-       return(kret);
-    }
+    if ((kret = krb5_dbe_lookup_mod_princ_data(kcontext, &dbent,
+                                              &mod_time, &mod_princ)))
 
+       return(kret);
+    
     if (docompare) {
        if ((dbent.max_life != KRB5_KDB_MAX_LIFE) ||
            (dbent.max_renewable_life != KRB5_KDB_MAX_RLIFE) ||
            (dbent.expiration != KRB5_KDB_EXPIRATION) ||
            (dbent.attributes != KRB5_KDB_DEF_FLAGS) ||
            !krb5_principal_compare(kcontext, principal, dbent.princ) ||
-           !krb5_principal_compare(kcontext, principal, mod_princ->mod_princ))
+           !krb5_principal_compare(kcontext, principal, mod_princ))
            kret = KRB5_PRINC_NOMATCH;
     }
 
     krb5_db_free_principal(kcontext, &dbent, how_many);
-    krb5_free_principal(kcontext, mod_princ->mod_princ);
-    krb5_xfree(mod_princ);
+    krb5_free_principal(kcontext, mod_princ);
     if (!kret) 
         return(((how_many == 1) && (more == 0)) ? 0 : KRB5KRB_ERR_GENERIC);
     else
@@ -431,16 +438,14 @@ delete_principal(kcontext, principal)
     int                        num2delete;
 
     num2delete = 1;
-    if (kret = krb5_db_delete_principal(kcontext,
-                                       principal,
-                                       &num2delete))
+    if ((kret = krb5_db_delete_principal(kcontext, principal, &num2delete)))
        return(kret);
     return((num2delete == 1) ? 0 : KRB5KRB_ERR_GENERIC);
 }
 
 static int
 do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
-          db_type, ptest)
+          ptest)
     char       *db;
     int                passes;
     int                verbose;
@@ -449,7 +454,6 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
     int                check;
     int                save_db;
     int                dontclean;
-    enum dbtype        db_type;
     int                ptest;
 {
     krb5_error_code    kret;
@@ -486,30 +490,6 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
     krb5_init_context(&kcontext);
     krb5_init_ets(kcontext);
 
-    switch (db_type) {
-#ifdef BERK_DB_DBM
-    case DB_BERKELEY:
-       op = "setting up Berkeley database operations";
-       if (kret = kdb5_db_set_dbops(kcontext, &berkeley_dispatch))
-           goto goodbye;
-       break;
-#endif
-#if defined(ODBM) || defined(NDBM)
-    case DB_DBM:
-       op = "setting up DBM database operations";
-       if (kret = kdb5_db_set_dbops(kcontext, &dbm_dispatch))
-           goto goodbye;
-       break;
-#endif
-    case DB_DEFAULT:
-       break;
-    default:
-       op = "checking database type";
-       kret = EINVAL;
-       goto goodbye;
-       break;
-    }
-
     /* 
      * The database had better not exist.
      */
@@ -521,11 +501,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
 
     /* Set up the master key name */
     op = "setting up master key name";
-    if (kret = krb5_db_setup_mkey_name(kcontext,
-                                      mkey_name,
-                                      realm,
-                                      &mkey_fullname,
-                                      &master_princ))
+    if ((kret = krb5_db_setup_mkey_name(kcontext, mkey_name, realm,
+                                       &mkey_fullname, &master_princ)))
        goto goodbye;
 
     if (verbose)
@@ -533,7 +510,7 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
                programname, db, mkey_fullname);
 
     op = "salting master key";
-    if (kret = krb5_principal2salt(kcontext, master_princ, &salt_data))
+    if ((kret = krb5_principal2salt(kcontext, master_princ, &salt_data)))
        goto goodbye;
 
     op = "converting master key";
@@ -541,49 +518,50 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
     master_keyblock.enctype = DEFAULT_KDC_ENCTYPE;
     passwd.length = strlen(master_passwd);
     passwd.data = master_passwd;
-    if (kret = krb5_string_to_key(kcontext, &master_encblock, &master_keyblock,
-                                 &passwd, &salt_data))
+    if ((kret = krb5_string_to_key(kcontext, &master_encblock,
+                                  &master_keyblock, &passwd, &salt_data)))
        goto goodbye;
     /* Clean up */
     free(salt_data.data);
 
     /* Process master key */
     op = "processing master key";
-    if (kret = krb5_process_key(kcontext, &master_encblock, &master_keyblock))
+    if ((kret = krb5_process_key(kcontext, &master_encblock,
+                                &master_keyblock)))
        goto goodbye;
 
     /* Initialize random key generator */
     op = "initializing random key generator";
-    if (kret = krb5_init_random_key(kcontext,
-                                   &master_encblock,
-                                   &master_keyblock,
-                                   &rseed))
+    if ((kret = krb5_init_random_key(kcontext,
+                                    &master_encblock,
+                                    &master_keyblock,
+                                    &rseed)))
        goto goodbye;
 
     /* Create database */
     op = "creating database";
-    if (kret = krb5_db_create(kcontext, db))
+    if ((kret = krb5_db_create(kcontext, db)))
        goto goodbye;
 
     db_created = 1;
 
     /* Set this database as active. */
     op = "setting active database";
-    if (kret = krb5_db_set_name(kcontext, db))
+    if ((kret = krb5_db_set_name(kcontext, db)))
        goto goodbye;
 
     /* Initialize database */
     op = "initializing database";
-    if (kret = krb5_db_init(kcontext))
+    if ((kret = krb5_db_init(kcontext)))
        goto goodbye;
 
     db_open = 1;
     op = "adding master principal";
-    if (kret = add_principal(kcontext,
-                            master_princ,
-                            &master_encblock,
-                            &master_keyblock,
-                            rseed))
+    if ((kret = add_principal(kcontext,
+                             master_princ,
+                             &master_encblock,
+                             &master_keyblock,
+                             rseed)))
        goto goodbye;
 
 
@@ -619,13 +597,9 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
        for (passno=0; passno<passes; passno++) {
            op = "generating principal name";
            do {
-               if (kret = gen_principal(kcontext,
-                                        realm,
-                                        rcases,
-                                        passno,
-                                        &principal,
-                                        &pname))
-                   goto goodbye;
+               if ((kret = gen_principal(kcontext, realm, rcases,
+                                         passno, &principal, &pname)))
+                       goto goodbye;
            } while (principal_found(passno-1, pname));
            record_principal(passno, principal, pname);
        }
@@ -648,11 +622,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
            if (timing) {
                swatch_on();
            }
-           if (kret = add_principal(kcontext,
-                                    playback_principal(passno),
-                                    &master_encblock,
-                                    kbp,
-                                    rseed)) {
+           if ((kret = add_principal(kcontext, playback_principal(passno),
+                                     &master_encblock, kbp, rseed))) {
                linkage = "initially ";
                oparg = playback_name(passno);
                goto cya;
@@ -681,11 +652,10 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
                if (timing) {
                    swatch_on();
                }
-               if (kret = add_principal(kcontext,
-                                        playback_principal(nvalid),
-                                        &master_encblock,
-                                        kbp,
-                                        rseed)) {
+               if ((kret = add_principal(kcontext,
+                                         playback_principal(nvalid),
+                                         &master_encblock,
+                                         kbp, rseed))) {
                    oparg = playback_name(nvalid);
                    goto cya;
                }
@@ -706,8 +676,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
                if (timing) {
                    swatch_on();
                }
-               if (kret = delete_principal(kcontext,
-                                           playback_principal(nvalid-1))) {
+               if ((kret = delete_principal(kcontext,
+                                            playback_principal(nvalid-1)))) {
                    oparg = playback_name(nvalid-1);
                    goto cya;
                }
@@ -727,9 +697,9 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
                if (timing) {
                    swatch_on();
                }
-               if (kret = find_principal(kcontext,
-                                         playback_principal(passno),
-                                         check)) {
+               if ((kret = find_principal(kcontext,
+                                          playback_principal(passno),
+                                          check))) {
                    oparg = playback_name(passno);
                    goto cya;
                }
@@ -753,8 +723,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
                if (timing) {
                    swatch_on();
                }
-               if (kret = delete_principal(kcontext,
-                                           playback_principal(passno))) {
+               if ((kret = delete_principal(kcontext,
+                                            playback_principal(passno)))) {
                    linkage = "finally ";
                    oparg = playback_name(passno);
                    goto cya;
@@ -800,12 +770,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
         */
        for (passno=0; passno<passes; passno++) {
            op = "generating principal name";
-           if (kret = gen_principal(kcontext,
-                                    realm,
-                                    rcases,
-                                    passno,
-                                    &principal,
-                                    &pname))
+           if ((kret = gen_principal(kcontext, realm, rcases,
+                                    passno, &principal, &pname)))
                goto goodbye;
            record_principal(passno, principal, pname);
        }
@@ -817,11 +783,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
        }
        for (passno=0; passno<passes; passno++) {
            op = "adding principal";
-           if (kret = add_principal(kcontext,
-                                    playback_principal(passno),
-                                    &master_encblock,
-                                    &stat_kb,
-                                    rseed))
+           if ((kret = add_principal(kcontext, playback_principal(passno),
+                                    &master_encblock, &stat_kb, rseed)))
                goto goodbye;
            if (verbose > 4)
                fprintf(stderr, "*A(%s)\n", playback_name(passno));
@@ -841,9 +804,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
        }
        for (passno=0; passno<passes; passno++) {
            op = "looking up principal";
-           if (kret = find_principal(kcontext,
-                                     playback_principal(passno),
-                                     check))
+           if ((kret = find_principal(kcontext, playback_principal(passno),
+                                      check)))
                goto goodbye;
            if (verbose > 4)
                fprintf(stderr, "-S(%s)\n", playback_name(passno));
@@ -864,8 +826,8 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
            }
            for (passno=passes-1; passno>=0; passno--) {
                op = "deleting principal";
-               if (kret = delete_principal(kcontext,
-                                           playback_principal(passno)))
+               if ((kret = delete_principal(kcontext,
+                                            playback_principal(passno))))
                    goto goodbye;
                if (verbose > 4)
                    fprintf(stderr, "XD(%s)\n", playback_name(passno));
@@ -908,25 +870,6 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
                while (stat("./test.lock", &stbuf) == -1)
                krb5_init_context(&ccontext);
                krb5_init_ets(ccontext);
-               switch (db_type) {
-#ifdef BERK_DB_DBM
-               case DB_BERKELEY:
-                   if (kret = kdb5_db_set_dbops(ccontext, &berkeley_dispatch))
-                       exit(1);
-                   break;
-#endif
-#if defined(ODBM) || defined(NDBM)
-               case DB_DBM:
-                   if (kret = kdb5_db_set_dbops(ccontext, &dbm_dispatch))
-                       exit(1);
-                   break;
-#endif
-               case DB_DEFAULT:
-                   break;
-               default:
-                   exit(1);
-                   break;
-               }
                if ((kret = krb5_db_set_name(ccontext, db)) ||
                    (kret = krb5_db_init(ccontext)))
                    exit(1);
@@ -1008,39 +951,14 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
        (void) krb5_db_fini(kcontext);
     if (db_created) {
        if (!kret && !save_db) {
-           switch (db_type) {
-#ifdef BERK_DB_DBM
-           case DB_BERKELEY:
-               op = "setting up Berkeley database operations";
-               if (kret = kdb5_db_set_dbops(kcontext, &berkeley_dispatch))
-                   goto goodbye1;
-               break;
-#endif
-#if defined(ODBM) || defined(NDBM)
-           case DB_DBM:
-               op = "setting up DBM database operations";
-               if (kret = kdb5_db_set_dbops(kcontext, &dbm_dispatch))
-                   goto goodbye1;
-               break;
-#endif
-           case DB_DEFAULT:
-               break;
-           default:
-               op = "checking database type";
-               kret = EINVAL;
-               goto goodbye1;
-               break;
-           }
            kdb5_db_destroy(kcontext, db);
            krb5_db_fini(kcontext);
-       }
-       else {
+       } else {
            if (kret && verbose)
                fprintf(stderr, "%s: database not deleted because of error\n",
                        programname);
        }
     }
- goodbye1:
     return((kret) ? 1 : 0);
 }
 
@@ -1054,8 +972,6 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean,
  *             [-d <dbname>]   - Database name.
  *             [-s]            - Save database even on successful completion.
  *             [-D]            - Leave database dirty.
- *             [-o]            - Use dbm instead of default.
- *             [-O]            - Use Berkeley db instead of default.
  */
 int
 main(argc, argv)
@@ -1067,7 +983,6 @@ main(argc, argv)
 
     int                do_time, do_random, num_passes, check_cont, verbose, error;
     int                save_db, dont_clean, do_ptest;
-    enum dbtype        db_type;
     char       *db_name;
 
     programname = argv[0];
@@ -1084,12 +999,11 @@ main(argc, argv)
     db_name = T_KDB_DEF_DB;
     save_db = 0;
     dont_clean = 0;
-    db_type = DB_DEFAULT;
     error = 0;
     do_ptest = 0;
 
     /* Parse argument list */
-    while ((option = getopt(argc, argv, "cd:n:oprstvDO")) != EOF) {
+    while ((option = getopt(argc, argv, "cd:n:prstvD")) != EOF) {
        switch (option) {
        case 'c':
            check_cont = 1;
@@ -1122,12 +1036,6 @@ main(argc, argv)
        case 'D':
            dont_clean = 1;
            break;
-       case 'o':
-           db_type = DB_DBM;
-           break;
-       case 'O':
-           db_type = DB_BERKELEY;
-           break;
        default:
            error++;
            break;
@@ -1145,7 +1053,6 @@ main(argc, argv)
                           check_cont,
                           save_db,
                           dont_clean,
-                          db_type,
                           do_ptest);
     return(error);
 }