Removed all references to DECLARG and OLDDECLARG.
authorChris Provenzano <proven@mit.edu>
Fri, 13 Jan 1995 21:47:20 +0000 (21:47 +0000)
committerChris Provenzano <proven@mit.edu>
Fri, 13 Jan 1995 21:47:20 +0000 (21:47 +0000)
Added krb5_context to all krb5_routines throughout the tree.

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

src/admin/create/ChangeLog
src/admin/create/kdb5_create.c
src/admin/destroy/ChangeLog
src/admin/destroy/kdb5_destroy.c
src/admin/edit/ChangeLog
src/admin/edit/dump.c
src/admin/edit/kdb5_edit.c
src/admin/edit/kdb5_edit.h
src/admin/edit/tcl_wrapper.c

index 62068c04833850c2840aef8678bd4d4d2e197e6a..8e5b29e5d098a3f0540ee532240cb8fb90fad339 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines
+
 Thu Oct  6 23:29:07 1994  Theodore Y. Ts'o  (tytso@dcl)
 
        * kdb5_create.c (main): Add a new option so that the master key
index b71df6209e1a599bc78adddecddfe4227b2822a7..9cf726c3d792e65c1847303b70fab0e71994867f 100644 (file)
@@ -58,8 +58,11 @@ struct realm_info {
     0
 };
 
-static krb5_error_code add_principal PROTOTYPE((krb5_principal, enum ap_op,
-                                               struct realm_info *));
+static krb5_error_code add_principal 
+       PROTOTYPE((krb5_context,
+                  krb5_principal, 
+                  enum ap_op,
+                  struct realm_info *));
 
 /*
  * Steps in creating a database:
@@ -133,8 +136,10 @@ char *argv[];
     int keytypedone = 0;
     krb5_enctype etype = 0xffff;
     krb5_data scratch, pwd;
+    krb5_context context;
 
-    krb5_init_ets();
+    krb5_init_context(&context);
+    krb5_init_ets(context);
 
     if (strrchr(argv[0], '/'))
        argv[0] = strrchr(argv[0], '/')+1;
@@ -184,9 +189,9 @@ char *argv[];
                "while setting up etype %d", etype);
        exit(1);
     }
-    krb5_use_cstype(&master_encblock, etype);
+    krb5_use_cstype(context, &master_encblock, etype);
 
-    retval = krb5_db_set_name(dbname);
+    retval = krb5_db_set_name(context, dbname);
     if (!retval) retval = EEXIST;
 
     if (retval == EEXIST || retval == EACCES || retval == EPERM) {
@@ -196,7 +201,7 @@ char *argv[];
        exit(1);
     }
     if (!realm) {
-       if (retval = krb5_get_default_realm(&defrealm)) {
+       if (retval = krb5_get_default_realm(context, &defrealm)) {
            com_err(argv[0], retval, "while retrieving default realm name");
            exit(1);
        }           
@@ -205,18 +210,18 @@ char *argv[];
 
     /* assemble & parse the master key name */
 
-    if (retval = krb5_db_setup_mkey_name(mkey_name, realm, &mkey_fullname,
-                                &master_princ)) {
+    if (retval = krb5_db_setup_mkey_name(context, mkey_name, realm, 
+                                        &mkey_fullname, &master_princ)) {
        com_err(argv[0], retval, "while setting up master key name");
        exit(1);
     }
 
-    krb5_princ_set_realm_data(&db_create_princ, realm);
-    krb5_princ_set_realm_length(&db_create_princ, strlen(realm));
-    krb5_princ_set_realm_data(&tgt_princ, realm);
-    krb5_princ_set_realm_length(&tgt_princ, strlen(realm));
-    krb5_princ_component(&tgt_princ,1)->data = realm;
-    krb5_princ_component(&tgt_princ,1)->length = strlen(realm);
+    krb5_princ_set_realm_data(context, &db_create_princ, realm);
+    krb5_princ_set_realm_length(context, &db_create_princ, strlen(realm));
+    krb5_princ_set_realm_data(context, &tgt_princ, realm);
+    krb5_princ_set_realm_length(context, &tgt_princ, strlen(realm));
+    krb5_princ_component(context, &tgt_princ,1)->data = realm;
+    krb5_princ_component(context, &tgt_princ,1)->length = strlen(realm);
 
     printf("Initializing database '%s' for realm '%s',\n\
 master key name '%s'\n",
@@ -225,13 +230,14 @@ master key name '%s'\n",
     if (mkey_password) {
        pwd.data = mkey_password;
        pwd.length = strlen(mkey_password);
-       retval = krb5_principal2salt(master_princ, &scratch);
+       retval = krb5_principal2salt(context, master_princ, &scratch);
        if (retval) {
            com_err(argv[0], retval, "while calculated master key salt");
            exit(1);
        }
-       retval = krb5_string_to_key(&master_encblock, master_keyblock.keytype,
-                                   &master_keyblock, &pwd, &scratch);
+       retval = krb5_string_to_key(context, &master_encblock, 
+                                   master_keyblock.keytype, &master_keyblock, 
+                                   &pwd, &scratch);
        if (retval) {
            com_err(argv[0], retval,
                    "while transforming master key from password");
@@ -244,69 +250,70 @@ master key name '%s'\n",
        fflush(stdout);
 
        /* TRUE here means read the keyboard, and do it twice */
-       if (retval = krb5_db_fetch_mkey(master_princ, &master_encblock, TRUE,
-                                       TRUE, 0, &master_keyblock)) {
+       if (retval = krb5_db_fetch_mkey(context, master_princ, &master_encblock,
+                                       TRUE, TRUE, 0, &master_keyblock)) {
            com_err(argv[0], retval, "while reading master key");
            exit(1);
        }
     }
     
-    if (retval = krb5_process_key(&master_encblock, &master_keyblock)) {
+    if (retval = krb5_process_key(context, &master_encblock,&master_keyblock)){
        com_err(argv[0], retval, "while processing master key");
        exit(1);
     }
 
     rblock.eblock = &master_encblock;
-    if (retval = krb5_init_random_key(&master_encblock, &master_keyblock,
-                                     &rblock.rseed)) {
+    if (retval = krb5_init_random_key(context, &master_encblock, 
+                                     &master_keyblock, &rblock.rseed)) {
        com_err(argv[0], retval, "while initializing random key generator");
-       (void) krb5_finish_key(&master_encblock);
+       (void) krb5_finish_key(context, &master_encblock);
        exit(1);
     }
-    if (retval = krb5_db_create(dbname)) {
-       (void) krb5_finish_key(&master_encblock);
-       (void) krb5_finish_random_key(&master_encblock, &rblock.rseed);
+    if (retval = krb5_db_create(context, dbname)) {
+       (void) krb5_finish_key(context, &master_encblock);
+       (void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
        com_err(argv[0], retval, "while creating database '%s'",
                dbname);
        exit(1);
     }
-    if (retval = krb5_db_set_name(dbname)) {
-       (void) krb5_finish_key(&master_encblock);
-       (void) krb5_finish_random_key(&master_encblock, &rblock.rseed);
+    if (retval = krb5_db_set_name(context, dbname)) {
+       (void) krb5_finish_key(context, &master_encblock);
+       (void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
         com_err(argv[0], retval, "while setting active database to '%s'",
                 dbname);
         exit(1);
     }
-    if (retval = krb5_db_init()) {
-       (void) krb5_finish_key(&master_encblock);
-       (void) krb5_finish_random_key(&master_encblock, &rblock.rseed);
+    if (retval = krb5_db_init(context)) {
+       (void) krb5_finish_key(context, &master_encblock);
+       (void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
        com_err(argv[0], retval, "while initializing the database '%s'",
                dbname);
        exit(1);
     }
 
-    if ((retval = add_principal(master_princ, MASTER_KEY, &rblock)) ||
-       (retval = add_principal(&tgt_princ, RANDOM_KEY, &rblock))) {
-       (void) krb5_db_fini();
-       (void) krb5_finish_key(&master_encblock);
-       (void) krb5_finish_random_key(&master_encblock, &rblock.rseed);
+    if ((retval = add_principal(context, master_princ, MASTER_KEY, &rblock)) ||
+       (retval = add_principal(context, &tgt_princ, RANDOM_KEY, &rblock))) {
+       (void) krb5_db_fini(context);
+       (void) krb5_finish_key(context, &master_encblock);
+       (void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
        com_err(argv[0], retval, "while adding entries to the database");
        exit(1);
     }
     /* clean up */
-    (void) krb5_db_fini();
-    (void) krb5_finish_key(&master_encblock);
-    (void) krb5_finish_random_key(&master_encblock, &rblock.rseed);
+    (void) krb5_db_fini(context);
+    (void) krb5_finish_key(context, &master_encblock);
+    (void) krb5_finish_random_key(context, &master_encblock, &rblock.rseed);
     memset((char *)master_keyblock.contents, 0, master_keyblock.length);
     exit(0);
 
 }
 
 static krb5_error_code
-add_principal(princ, op, pblock)
-krb5_principal princ;
-enum ap_op op;
-struct realm_info *pblock;
+add_principal(context, princ, op, pblock)
+    krb5_context context;
+    krb5_principal princ;
+    enum ap_op op;
+    struct realm_info *pblock;
 {
     krb5_db_entry entry;
     krb5_error_code retval;
@@ -323,23 +330,23 @@ struct realm_info *pblock;
     entry.expiration = pblock->expiration;
     entry.mod_name = &db_create_princ;
 
-    if (retval = krb5_timeofday(&entry.mod_date))
+    if (retval = krb5_timeofday(context, &entry.mod_date))
        return retval;
     entry.attributes = pblock->flags;
 
     switch (op) {
     case MASTER_KEY:
        entry.attributes |= KRB5_KDB_DISALLOW_ALL_TIX;
-       if (retval = krb5_kdb_encrypt_key(pblock->eblock,
-                                         &master_keyblock,
-                                         &ekey))
+       if (retval = krb5_kdb_encrypt_key(context, pblock->eblock,
+                                         &master_keyblock, &ekey))
            return retval;
        break;
     case RANDOM_KEY:
-       if (retval = krb5_random_key(pblock->eblock, pblock->rseed, &rkey))
+       if (retval = krb5_random_key(context, pblock->eblock, 
+                                    pblock->rseed, &rkey))
            return retval;
-       retval = krb5_kdb_encrypt_key(pblock->eblock, rkey, &ekey);
-       krb5_free_keyblock(rkey);
+       retval = krb5_kdb_encrypt_key(context, pblock->eblock, rkey, &ekey);
+       krb5_free_keyblock(context, rkey);
        if (retval)
            return retval;
        break;
@@ -353,7 +360,7 @@ struct realm_info *pblock;
     entry.salt_length = 0;
     entry.salt = 0;
 
-    if (retval = krb5_db_put_principal(&entry, &nentries))
+    if (retval = krb5_db_put_principal(context, &entry, &nentries))
        return retval;
 
     krb5_xfree(ekey.contents);
index c444a81f7f82187aed25adb627de2d113c7330eb..03424276bae00bd95171d6e78126a2d8cb41b815 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines
+
 Thu Oct  6 23:43:38 1994  Theodore Y. Ts'o  (tytso@dcl)
 
        * kdb5_destroy.c (main): Add option to force destruction of a
index 412a0e2d024468b1b9ab53f1dab606f93a120f3b..d10b2ffab108337f2e5cae3a9eb289cc2f597476 100644 (file)
@@ -42,8 +42,8 @@ char *yes = "yes\n";                  /* \n to compare against result of
 
 static void
 usage(who, status)
-char *who;
-int status;
+    char *who;
+    int status;
 {
     fprintf(stderr, "usage: %s [-d dbpathname]\n", who);
     exit(status);
@@ -51,8 +51,8 @@ int status;
 
 void
 main(argc, argv)
-int argc;
-char *argv[];
+    int argc;
+    char *argv[];
 {
     extern char *optarg;       
     int optchar;
@@ -60,9 +60,11 @@ char *argv[];
     char buf[5];
     char dbfilename[MAXPATHLEN];
     krb5_error_code retval;
+    krb5_context context;
     int force = 0;
 
-    krb5_init_ets();
+    krb5_init_context(&context);
+    krb5_init_ets(context);
 
     if (strrchr(argv[0], '/'))
        argv[0] = strrchr(argv[0], '/')+1;
@@ -82,8 +84,7 @@ char *argv[];
        }
     }
     if (!force) {
-       printf("Deleting KDC database stored in '%s', are you sure?\n",
-              dbname);
+       printf("Deleting KDC database stored in '%s', are you sure?\n", dbname);
        printf("(type 'yes' to confirm)? ");
        if (fgets(buf, sizeof(buf), stdin) == NULL)
            exit(1);
@@ -101,7 +102,7 @@ char *argv[];
                    "Database appears to not exist--inspect files manually!\n");
        else
            fprintf(stderr,
-                   "Database may be partially deleted--inspect files manually!\n");
+               "Database may be partially deleted--inspect files manually!\n");
        exit(1);
     }
     (void) strcpy(dbfilename, dbname);
index c7049b1087251b542be8412db092890ba0c7970c..ef46f3b2be89973879b19d2648654aa5db3c6fab 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines
+
 Mon Dec 19 18:04:11 1994  Theodore Y. Ts'o  (tytso@dcl)
 
        * configure.in:
index f56ebd6f04072ea3ac44fe35a13b7698869c8710..90fb7815622eaf04c0dbe70e148201e0d683ccc8 100644 (file)
@@ -50,25 +50,26 @@ krb5_encrypt_block master_encblock;
 extern char *current_dbname;
 extern krb5_boolean dbactive;
 extern int exit_status;
+extern krb5_context edit_context;
 
 void update_ok_file();
 
 krb5_error_code
 dump_iterator(ptr, entry)
-krb5_pointer ptr;
-krb5_db_entry *entry;
+    krb5_pointer ptr;
+    krb5_db_entry *entry;
 {
     krb5_error_code retval;
     struct dump_record *arg = (struct dump_record *) ptr;
     char *name=NULL, *mod_name=NULL;
     int        i;
 
-    if (retval = krb5_unparse_name(entry->principal, &name)) {
+    if (retval = krb5_unparse_name(edit_context, entry->principal, &name)) {
        com_err(arg->comerr_name, retval, "while unparsing principal");
        exit_status++;
        return retval;
     }
-    if (retval = krb5_unparse_name(entry->mod_name, &mod_name)) {
+    if (retval = krb5_unparse_name(edit_context, entry->mod_name, &mod_name)) {
        free(name);
        com_err(arg->comerr_name, retval, "while unparsing principal");
        exit_status++;
@@ -150,7 +151,7 @@ void dump_db(argc, argv)
        fputs(ld_vers, f);
        arg.comerr_name = argv[0];
        arg.f = f;
-       (void) krb5_db_iterate(dump_iterator, (krb5_pointer) &arg);
+       (void) krb5_db_iterate(edit_context, dump_iterator, (krb5_pointer) &arg);
        if (argc == 2)
                fclose(f);
        if (argv[1])
@@ -272,14 +273,14 @@ void load_db(argc, argv)
        }
        strcpy(new_dbname, argv[2]);
        strcat(new_dbname, "~");
-       if (retval = krb5_db_create(new_dbname)) {
+       if (retval = krb5_db_create(edit_context, new_dbname)) {
                com_err(argv[0], retval, "while creating database '%s'",
                        new_dbname);
                exit_status++;
                return;
        }
        if (dbactive) {
-               if ((retval = krb5_db_fini()) &&
+               if ((retval = krb5_db_fini(edit_context)) &&
                    retval != KRB5_KDB_DBNOTINITED) {
                        com_err(argv[0], retval,
                                "while closing previous database");
@@ -287,13 +288,13 @@ void load_db(argc, argv)
                        return;
                }
        }
-       if (retval = krb5_db_set_name(new_dbname)) {
+       if (retval = krb5_db_set_name(edit_context, new_dbname)) {
                com_err(argv[0], retval,
                        "while setting active database to '%s'", new_dbname
                        );
                exit(1);
        }
-       if (retval = krb5_db_init()) {
+       if (retval = krb5_db_init(edit_context)) {
                com_err(argv[0], retval,
                        "while initializing database %s",
                        new_dbname
@@ -481,14 +482,14 @@ void load_db(argc, argv)
                        }
                        putc(ch, stderr);
                }
-               if (retval=krb5_parse_name(name, &entry.principal)) {
+               if (retval=krb5_parse_name(edit_context, name, &entry.principal)) {
                        com_err(argv[0], retval,
                                "while trying to parse %s in line %d",
                                name, lineno);
                        load_error++;
                        goto cleanup;
                }
-               if (retval=krb5_parse_name(mod_name, &entry.mod_name)) {
+               if (retval=krb5_parse_name(edit_context, mod_name, &entry.mod_name)) {
                        com_err(argv[0], retval,
                                "while trying to parse %s in line %d",
                                mod_name, lineno);
@@ -496,7 +497,7 @@ void load_db(argc, argv)
                        goto cleanup;
                }
                one=1;
-               if (retval = krb5_db_put_principal(&entry, &one)) {
+               if (retval = krb5_db_put_principal(edit_context, &entry, &one)) {
                        com_err(argv[0], retval,
                                "while trying to store principal %s",
                                name);
@@ -516,7 +517,7 @@ void load_db(argc, argv)
                    krb5_xfree(entry.alt_salt);
        }
 error_out:
-       if (retval = krb5_db_fini()) {
+       if (retval = krb5_db_fini(edit_context)) {
                com_err(argv[0], retval,
                        "while closing database '%s'", new_dbname);
                exit(1);
@@ -524,7 +525,7 @@ error_out:
        if (load_error) {
                printf("Error while loading database, aborting load.\n");
                exit_status += load_error;
-               if (retval = kdb5_db_destroy(new_dbname)) {
+               if (retval = kdb5_db_destroy(edit_context, new_dbname)) {
                        com_err(argv[0], retval,
                                "while destroying temporary database '%s'",
                                new_dbname);
@@ -538,7 +539,7 @@ error_out:
                 */
                exit(1);
        } else {
-               if (retval = krb5_db_rename(new_dbname, argv[2])) {
+               if (retval = krb5_db_rename(edit_context, new_dbname, argv[2])) {
                        com_err(argv[0], retval,
                                "while renaming database from %s to %s",
                                new_dbname, argv[2]);
@@ -546,13 +547,13 @@ error_out:
                }
        }
        if (dbactive) {
-               if (retval = krb5_db_set_name(current_dbname)) {
+               if (retval = krb5_db_set_name(edit_context, current_dbname)) {
                        com_err(argv[0], retval,
                                "while resetting active database to '%s'",
                                current_dbname);
                        exit(1);
                }
-               if (retval = krb5_db_init()) {
+               if (retval = krb5_db_init(edit_context)) {
                        com_err(argv[0], retval,
                                "while initializing active database %s",
                                current_dbname);
index c105d3cac72404d31db1c3f2ece6904488cdc2dc..ab9390547f1963e03e899e2d37f55c27daac4f4c 100644 (file)
@@ -69,10 +69,12 @@ static char *mkey_password = 0;
 
 int exit_status = 0;
 
+krb5_context edit_context;
+
 static void
 usage(who, status)
-char *who;
-int status;
+    char *who;
+    int status;
 {
     fprintf(stderr,
            "usage: %s [-d dbpathname] [-r realmname] [-R request ]\n",
@@ -111,7 +113,8 @@ char *kdb5_edit_Init(argc, argv)
     extern krb5_kt_ops krb5_ktf_writable_ops;
     char       *request = NULL;
 
-    krb5_init_ets();
+    krb5_init_context(&edit_context);
+    krb5_init_ets(edit_context);
 
     if (strrchr(argv[0], '/'))
        argv[0] = strrchr(argv[0], '/')+1;
@@ -164,7 +167,7 @@ char *kdb5_edit_Init(argc, argv)
        interface will have umask = 77 but that is not a serious problem. */
     (void) umask(077);
 
-    if (retval = krb5_kt_register(&krb5_ktf_writable_ops)) {
+    if (retval = krb5_kt_register(edit_context, &krb5_ktf_writable_ops)) {
        com_err(progname, retval,
                "while registering writable key table functions");
        exit(1);
@@ -184,9 +187,9 @@ char *kdb5_edit_Init(argc, argv)
                "while setting up etype %d", etype);
        exit(1);
     }
-    krb5_use_cstype(&master_encblock, etype);
+    krb5_use_cstype(edit_context, &master_encblock, etype);
     if (!cur_realm) {
-       if (retval = krb5_get_default_realm(&defrealm)) {
+       if (retval = krb5_get_default_realm(edit_context, &defrealm)) {
            com_err(progname, retval, "while retrieving default realm name");
            exit(1);
        }           
@@ -206,8 +209,8 @@ char *kdb5_edit_Init(argc, argv)
 
 krb5_kvno
 princ_exists(pname, principal)
-char *pname;
-krb5_principal principal;
+    char *pname;
+    krb5_principal principal;
 {
     int nprincs = 1;
     krb5_db_entry entry;
@@ -215,19 +218,21 @@ krb5_principal principal;
     krb5_error_code retval;
     krb5_kvno vno;
 
-    if (retval = krb5_db_get_principal(principal, &entry, &nprincs, &more)) {
-       com_err(pname, retval, "while attempting to verify principal's existence");
+    if (retval = krb5_db_get_principal(edit_context, principal, &entry, 
+                                      &nprincs, &more)) {
+       com_err(pname, retval, 
+               "while attempting to verify principal's existence");
        exit_status++;
        return 0;
     }
     if (!nprincs)
            return NO_PRINC;
     vno = entry.kvno;
-    krb5_db_free_principal(&entry, nprincs);
+    krb5_db_free_principal(edit_context, &entry, nprincs);
     return(vno);
 }
 
-int create_db_entry(principal, newentry)
+int create_db_entry( principal, newentry)
     krb5_principal principal;
     krb5_db_entry  *newentry;
 {
@@ -235,51 +240,46 @@ int create_db_entry(principal, newentry)
 
     memset(newentry, 0, sizeof(krb5_db_entry));
     
-    if (retval = krb5_copy_principal(principal, &newentry->principal))
+    if (retval = krb5_copy_principal(edit_context, principal, &newentry->principal))
        return retval;
     newentry->kvno = 1;
     newentry->max_life = mblock.max_life;
     newentry->max_renewable_life = mblock.max_rlife;
     newentry->mkvno = mblock.mkvno;
     newentry->expiration = mblock.expiration;
-    if (retval = krb5_copy_principal(master_princ, &newentry->mod_name))
+    if (retval = krb5_copy_principal(edit_context, master_princ,&newentry->mod_name))
        goto errout;
     
     newentry->attributes = mblock.flags;
     newentry->salt_type = KRB5_KDB_SALTTYPE_NORMAL;
 
-    if (retval = krb5_timeofday(&newentry->mod_date))
+    if (retval = krb5_timeofday(edit_context, &newentry->mod_date))
        goto errout;
 
     return 0;
 
 errout:
     if (newentry->principal)
-       krb5_free_principal(newentry->principal);
+       krb5_free_principal(edit_context, newentry->principal);
     memset(newentry, 0, sizeof(krb5_db_entry));
     return retval;
 }    
 
 void
-add_key(DECLARG(char const *, cmdname),
-       DECLARG(char const *, newprinc),
-       DECLARG(krb5_const_principal, principal),
-       DECLARG(const krb5_keyblock *, key),
-       DECLARG(krb5_kvno, vno),
-       DECLARG(struct saltblock *, salt))
-OLDDECLARG(char const *, cmdname)
-OLDDECLARG(char const *, newprinc)
-OLDDECLARG(krb5_const_principal, principal)
-OLDDECLARG(const krb5_keyblock *, key)
-OLDDECLARG(krb5_kvno, vno)
-OLDDECLARG(struct saltblock *, salt)
+add_key(cmdname, newprinc, principal, key, vno, salt)
+    char const * cmdname;
+    char const * newprinc;
+    krb5_const_principal principal;
+    const krb5_keyblock * key;
+    krb5_kvno vno;
+    struct saltblock * salt;
 {
     krb5_error_code retval;
     krb5_db_entry newentry;
     int one = 1;
 
     memset((char *) &newentry, 0, sizeof(newentry));
-    retval = krb5_kdb_encrypt_key(&master_encblock,
+    retval = krb5_kdb_encrypt_key(edit_context, &master_encblock,
                                  key,
                                  &newentry.key);
     if (retval) {
@@ -294,7 +294,7 @@ OLDDECLARG(struct saltblock *, salt)
     newentry.mkvno = mblock.mkvno;
     newentry.expiration = mblock.expiration;
     newentry.mod_name = master_princ;
-    if (retval = krb5_timeofday(&newentry.mod_date)) {
+    if (retval = krb5_timeofday(edit_context, &newentry.mod_date)) {
        com_err(cmdname, retval, "while fetching date");
        exit_status++;
        memset((char *)newentry.key.contents, 0, newentry.key.length);
@@ -312,7 +312,7 @@ OLDDECLARG(struct saltblock *, salt)
        newentry.salt = 0;
     }
     
-    retval = krb5_db_put_principal(&newentry, &one);
+    retval = krb5_db_put_principal(edit_context, &newentry, &one);
     memset((char *)newentry.key.contents, 0, newentry.key.length);
     krb5_xfree(newentry.key.contents);
     if (retval) {
@@ -329,8 +329,8 @@ OLDDECLARG(struct saltblock *, salt)
 
 void
 set_dbname(argc, argv)
-int argc;
-char *argv[];
+    int argc;
+    char *argv[];
 {
     krb5_error_code retval;
 
@@ -341,14 +341,14 @@ char *argv[];
        return;
     }
     if (dbactive) {
-       if ((retval = krb5_db_fini()) && retval != KRB5_KDB_DBNOTINITED) {
+       if ((retval = krb5_db_fini(edit_context)) && retval!= KRB5_KDB_DBNOTINITED) {
            com_err(argv[0], retval, "while closing previous database");
            exit_status++;
            return;
        }
        if (valid_master_key) {
-               (void) krb5_finish_key(&master_encblock);
-               (void) krb5_finish_random_key(&master_encblock,
+               (void) krb5_finish_key(edit_context, &master_encblock);
+               (void) krb5_finish_random_key(edit_context, &master_encblock,
                                              &master_random);
                memset((char *)master_keyblock.contents, 0,
                       master_keyblock.length);
@@ -356,7 +356,7 @@ char *argv[];
                master_keyblock.contents = NULL;
                valid_master_key = 0;
        }
-       krb5_free_principal(master_princ);
+       krb5_free_principal(edit_context, master_princ);
        dbactive = FALSE;
     }
     if (cur_realm)
@@ -373,8 +373,8 @@ char *argv[];
 
 int
 set_dbname_help(pname, dbname)
-char *pname;
-char *dbname;
+    char *pname;
+    char *dbname;
 {
     krb5_error_code retval;
     int nentries;
@@ -388,13 +388,13 @@ char *dbname;
            exit(1);
     }
     strcpy(current_dbname, dbname);
-    if (retval = krb5_db_set_name(current_dbname)) {
+    if (retval = krb5_db_set_name(edit_context, current_dbname)) {
        com_err(pname, retval, "while setting active database to '%s'",
                dbname);
        exit_status++;
        return(1);
     } 
-    if (retval = krb5_db_init()) {
+    if (retval = krb5_db_init(edit_context)) {
        com_err(pname, retval, "while initializing database");
        exit_status++;
        return(1);
@@ -402,29 +402,29 @@ char *dbname;
            
    /* assemble & parse the master key name */
 
-    if (retval = krb5_db_setup_mkey_name(mkey_name, cur_realm, 0,
+    if (retval = krb5_db_setup_mkey_name(edit_context, mkey_name, cur_realm, 0,
                                         &master_princ)) {
        com_err(pname, retval, "while setting up master key name");
        exit_status++;
        return(1);
     }
     nentries = 1;
-    if (retval = krb5_db_get_principal(master_princ, &master_entry, &nentries,
-                                      &more)) {
+    if (retval = krb5_db_get_principal(edit_context, master_princ, &master_entry, 
+                                      &nentries, &more)) {
        com_err(pname, retval, "while retrieving master entry");
        exit_status++;
-       (void) krb5_db_fini();
+       (void) krb5_db_fini(edit_context);
        return(1);
     } else if (more) {
        com_err(pname, KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE,
                "while retrieving master entry");
        exit_status++;
-       (void) krb5_db_fini();
+       (void) krb5_db_fini(edit_context);
        return(1);
     } else if (!nentries) {
        com_err(pname, KRB5_KDB_NOENTRY, "while retrieving master entry");
        exit_status++;
-       (void) krb5_db_fini();
+       (void) krb5_db_fini(edit_context);
        return(1);
     }
     mblock.max_life = master_entry.max_life;
@@ -433,16 +433,17 @@ char *dbname;
     /* don't set flags, master has some extra restrictions */
     mblock.mkvno = master_entry.kvno;
 
-    krb5_db_free_principal(&master_entry, nentries);
+    krb5_db_free_principal(edit_context, &master_entry, nentries);
     if (mkey_password) {
        pwd.data = mkey_password;
        pwd.length = strlen(mkey_password);
-       retval = krb5_principal2salt(master_princ, &scratch);
+       retval = krb5_principal2salt(edit_context, master_princ, &scratch);
        if (retval) {
            com_err(pname, retval, "while calculated master key salt");
            return(1);
        }
-       retval = krb5_string_to_key(&master_encblock, master_keyblock.keytype,
+       retval = krb5_string_to_key(edit_context, &master_encblock, 
+                                   master_keyblock.keytype,
                                    &master_keyblock, &pwd, &scratch);
        if (retval) {
            com_err(pname, retval,
@@ -451,9 +452,9 @@ char *dbname;
        }
        free(scratch.data);
        mkey_password = 0;
-    } else if (retval = krb5_db_fetch_mkey(master_princ, &master_encblock,
-                                          manual_mkey, FALSE, 0,
-                                          &master_keyblock)) {
+    } else if (retval = krb5_db_fetch_mkey(edit_context, master_princ, 
+                                          &master_encblock, manual_mkey, 
+                                          FALSE, 0, &master_keyblock)) {
        com_err(pname, retval, "while reading master key");
        com_err(pname, 0, "Warning: proceeding without master key");
        exit_status++;
@@ -462,8 +463,8 @@ char *dbname;
        return(0);
     }
     valid_master_key = 1;
-    if (retval = krb5_db_verify_master_key(master_princ, &master_keyblock,
-                                          &master_encblock)) {
+    if (retval = krb5_db_verify_master_key(edit_context, master_princ, 
+                                          &master_keyblock,&master_encblock)) {
        com_err(pname, retval, "while verifying master key");
        exit_status++;
        memset((char *)master_keyblock.contents, 0, master_keyblock.length);
@@ -472,7 +473,7 @@ char *dbname;
        dbactive = TRUE;
        return(1);
     }
-    if (retval = krb5_process_key(&master_encblock,
+    if (retval = krb5_process_key(edit_context, &master_encblock,
                                  &master_keyblock)) {
        com_err(pname, retval, "while processing master key");
        exit_status++;
@@ -482,12 +483,12 @@ char *dbname;
        dbactive = TRUE;
        return(1);
     }
-    if (retval = krb5_init_random_key(&master_encblock,
+    if (retval = krb5_init_random_key(edit_context, &master_encblock,
                                      &master_keyblock,
                                      &master_random)) {
        com_err(pname, retval, "while initializing random key generator");
        exit_status++;
-       (void) krb5_finish_key(&master_encblock);
+       (void) krb5_finish_key(edit_context, &master_encblock);
        memset((char *)master_keyblock.contents, 0, master_keyblock.length);
        krb5_xfree(master_keyblock.contents);
        valid_master_key = 0;
@@ -499,8 +500,8 @@ char *dbname;
 }
 
 void enter_master_key(argc, argv)
-        int argc;
-        char *argv[];
+    int argc;
+    char *argv[];
 {
        char    *pname = argv[0];
        krb5_error_code retval;
@@ -511,38 +512,39 @@ void enter_master_key(argc, argv)
                return;
        }
        if (valid_master_key) {
-               (void) krb5_finish_key(&master_encblock);
-               (void) krb5_finish_random_key(&master_encblock,
+               (void) krb5_finish_key(edit_context, &master_encblock);
+               (void) krb5_finish_random_key(edit_context, &master_encblock,
                                              &master_random);
                memset((char *)master_keyblock.contents, 0,
                       master_keyblock.length);
                krb5_xfree(master_keyblock.contents);
                master_keyblock.contents = NULL;
        }
-       if (retval = krb5_db_fetch_mkey(master_princ, &master_encblock,
+       if (retval = krb5_db_fetch_mkey(edit_context, master_princ, &master_encblock,
                                        TRUE, FALSE, 0, &master_keyblock)) {
                com_err(pname, retval, "while reading master key");
                exit_status++;
                return;
        }
-       if (retval = krb5_db_verify_master_key(master_princ, &master_keyblock,
+       if (retval = krb5_db_verify_master_key(edit_context, master_princ, 
+                                              &master_keyblock,
                                               &master_encblock)) {
                com_err(pname, retval, "while verifying master key");
                exit_status++;
                return;
        }
-       if (retval = krb5_process_key(&master_encblock,
+       if (retval = krb5_process_key(edit_context, &master_encblock,
                                      &master_keyblock)) {
                com_err(pname, retval, "while processing master key");
                exit_status++;
                return;
        }
-       if (retval = krb5_init_random_key(&master_encblock,
+       if (retval = krb5_init_random_key(edit_context, &master_encblock,
                                          &master_keyblock,
                                          &master_random)) {
                com_err(pname, retval, "while initializing random key generator");
                exit_status++;
-               (void) krb5_finish_key(&master_encblock);
+               (void) krb5_finish_key(edit_context, &master_encblock);
                return;
        }
        valid_master_key = 1;
@@ -603,7 +605,7 @@ void extract_srvtab(argc, argv)
        strcat(ktname, argv[1]);
 
     strcat(ktname, "-new-srvtab");
-    if (retval = krb5_kt_resolve(ktname, &ktid)) {
+    if (retval = krb5_kt_resolve(edit_context, ktname, &ktid)) {
        com_err(argv[0], retval, "while resolving keytab name '%s'", ktname);
        exit_status++;
        return;
@@ -627,14 +629,14 @@ void extract_srvtab(argc, argv)
            strcat(pname, cur_realm);
        }
 
-       if (retval = krb5_parse_name(pname, &princ)) {
+       if (retval = krb5_parse_name(edit_context, pname, &princ)) {
            com_err(argv[0], retval, "while parsing %s", pname);
            exit_status++;
            free(pname);
            continue;
        }
        nentries = 1;
-       if (retval = krb5_db_get_principal(princ, &dbentry, &nentries,
+       if (retval = krb5_db_get_principal(edit_context, princ, &dbentry, &nentries,
                                           &more)) {
            com_err(argv[0], retval, "while retrieving %s", pname);
            exit_status++;
@@ -644,14 +646,14 @@ void extract_srvtab(argc, argv)
                    "while retrieving %s", pname);
            exit_status++;
            if (nentries)
-               krb5_db_free_principal(&dbentry, nentries);
+               krb5_db_free_principal(edit_context, &dbentry, nentries);
            goto cleanmost;
        } else if (!nentries) {
            com_err(argv[0], KRB5_KDB_NOENTRY, "while retrieving %s", pname);
            exit_status++;
            goto cleanmost;
        }
-       if (retval = krb5_kdb_decrypt_key(&master_encblock,
+       if (retval = krb5_kdb_decrypt_key(edit_context, &master_encblock,
                                          &dbentry.key,
                                          &newentry.key)) {
            com_err(argv[0], retval, "while decrypting key for '%s'", pname);
@@ -660,7 +662,7 @@ void extract_srvtab(argc, argv)
        }
        newentry.principal = princ;
        newentry.vno = dbentry.kvno;
-       if (retval = krb5_kt_add_entry(ktid, &newentry)) {
+       if (retval = krb5_kt_add_entry(edit_context, ktid, &newentry)) {
            com_err(argv[0], retval, "while adding key to keytab '%s'",
                    ktname);
            exit_status++;
@@ -670,12 +672,12 @@ void extract_srvtab(argc, argv)
        memset((char *)newentry.key.contents, 0, newentry.key.length);
        krb5_xfree(newentry.key.contents);
     cleanall:
-           krb5_db_free_principal(&dbentry, nentries);
+           krb5_db_free_principal(edit_context, &dbentry, nentries);
     cleanmost:
            free(pname);
-           krb5_free_principal(princ);
+           krb5_free_principal(edit_context, princ);
     }
-    if (retval = krb5_kt_close(ktid)) {
+    if (retval = krb5_kt_close(edit_context, ktid)) {
        com_err(argv[0], retval, "while closing keytab");
        exit_status++;
     }
@@ -747,14 +749,14 @@ void extract_v4_srvtab(argc, argv)
            strcat(pname, cur_realm);
        }
 
-       if (retval = krb5_parse_name(pname, &princ)) {
+       if (retval = krb5_parse_name(edit_context, pname, &princ)) {
            com_err(argv[0], retval, "while parsing %s", pname);
            exit_status++;
            free(pname);
            continue;
        }
        nentries = 1;
-       if (retval = krb5_db_get_principal(princ, &dbentry, &nentries,
+       if (retval = krb5_db_get_principal(edit_context, princ, &dbentry, &nentries,
                                           &more)) {
            com_err(argv[0], retval, "while retrieving %s", pname);
            exit_status++;
@@ -764,14 +766,14 @@ void extract_v4_srvtab(argc, argv)
                    "while retrieving %s", pname);
            exit_status++;
            if (nentries)
-               krb5_db_free_principal(&dbentry, nentries);
+               krb5_db_free_principal(edit_context, &dbentry, nentries);
            goto cleanmost;
        } else if (!nentries) {
            com_err(argv[0], KRB5_KDB_NOENTRY, "while retrieving %s", pname);
            exit_status++;
            goto cleanmost;
        }
-       if (retval = krb5_kdb_decrypt_key(&master_encblock,
+       if (retval = krb5_kdb_decrypt_key(edit_context, &master_encblock,
                                          &dbentry.key,
                                          &key)) {
            com_err(argv[0], retval, "while decrypting key for '%s'", pname);
@@ -794,10 +796,10 @@ void extract_v4_srvtab(argc, argv)
        memset((char *)key.contents, 0, key.length);
        krb5_xfree(key.contents);
     cleanall:
-           krb5_db_free_principal(&dbentry, nentries);
+           krb5_db_free_principal(edit_context, &dbentry, nentries);
     cleanmost:
            free(pname);
-           krb5_free_principal(princ);
+           krb5_free_principal(edit_context, princ);
     }
     fclose(fout);
     return;
@@ -805,7 +807,7 @@ void extract_v4_srvtab(argc, argv)
 
 int
 check_print(chk_entry)
-krb5_db_entry *chk_entry;
+    krb5_db_entry *chk_entry;
 {
     int names = 0;
     int instances = 1;
@@ -818,13 +820,13 @@ krb5_db_entry *chk_entry;
        return(check_for_match(search_name, must_be_first[0], chk_entry,
                        num_name_tokens, names));
 
-    if ((krb5_princ_size(chk_entry->principal) > 1) &&
+    if ((krb5_princ_size(edit_context, chk_entry->principal) > 1) &&
        (num_name_tokens == 0) && 
        (num_instance_tokens > 0))
        return(check_for_match(search_instance, must_be_first[1], chk_entry,
                        num_instance_tokens, instances));
 
-    if ((krb5_princ_size(chk_entry->principal) > 1) &&
+    if ((krb5_princ_size(edit_context, chk_entry->principal) > 1) &&
        (num_name_tokens > 0) && 
        (num_instance_tokens > 0)) {
        check1 = check_for_match(search_name, must_be_first[0], chk_entry, 
@@ -843,14 +845,14 @@ struct list_iterator_struct {
 
 krb5_error_code
 list_iterator(ptr, entry)
-krb5_pointer ptr;
-krb5_db_entry *entry;
+    krb5_pointer ptr;
+    krb5_db_entry *entry;
 {
     krb5_error_code retval;
     struct list_iterator_struct *lis = (struct list_iterator_struct *)ptr;
     char *name;
 
-    if (retval = krb5_unparse_name(entry->principal, &name)) {
+    if (retval = krb5_unparse_name(edit_context, entry->principal, &name)) {
        com_err(lis->cmdname, retval, "while unparsing principal");
        exit_status++;
        return retval;
@@ -912,7 +914,7 @@ void list_db(argc, argv)
        parse_token(argbuf, &must_be_first[0],
                        &num_name_tokens, search_name);
     }
-    (void) krb5_db_iterate(list_iterator, argv[0]);
+    (void) krb5_db_iterate(edit_context, list_iterator, argv[0]);
 }
 
 void delete_entry(argc, argv)
@@ -940,7 +942,7 @@ void delete_entry(argc, argv)
            exit_status++;
            return;
     }
-    if (retval = krb5_parse_name(argv[1], &newprinc)) {
+    if (retval = krb5_parse_name(edit_context, argv[1], &newprinc)) {
        com_err(argv[0], retval, "while parsing '%s'", argv[1]);
        exit_status++;
        return;
@@ -948,7 +950,7 @@ void delete_entry(argc, argv)
     if (princ_exists(argv[0], newprinc) == NO_PRINC) {
        com_err(argv[0], 0, "principal '%s' is not in the database", argv[1]);
        exit_status++;
-       krb5_free_principal(newprinc);
+       krb5_free_principal(edit_context, newprinc);
        return;
     }
     printf("Are you sure you want to delete '%s'?\nType 'yes' to confirm:",
@@ -956,11 +958,11 @@ void delete_entry(argc, argv)
     if ((fgets(yesno, sizeof(yesno), stdin) == NULL) ||
        strcmp(yesno, "yes\n")) {
        printf("NOT removing '%s'\n", argv[1]);
-       krb5_free_principal(newprinc);
+       krb5_free_principal(edit_context, newprinc);
        return;
     }
     printf("OK, deleting '%s'\n", argv[1]);
-    if (retval = krb5_db_delete_principal(newprinc, &one)) {
+    if (retval = krb5_db_delete_principal(edit_context, newprinc, &one)) {
        com_err(argv[0], retval, "while deleting '%s'", argv[1]);
        exit_status++;
     } else if (one != 1) {
@@ -973,7 +975,7 @@ void delete_entry(argc, argv)
     printf("\007\007\007WARNING:  Be sure to take '%s' off all access control lists\n\tbefore reallocating the name\n", argv[1]);
 #endif
 
-    krb5_free_principal(newprinc);
+    krb5_free_principal(edit_context, newprinc);
     return;
 }
 
@@ -1009,12 +1011,13 @@ enter_rnd_key(argc, argv, change)
            exit_status++;
            return;
     }
-    if (retval = krb5_parse_name(argv[1], &newprinc)) {
+    if (retval = krb5_parse_name(edit_context, argv[1], &newprinc)) {
        com_err(argv[0], retval, "while parsing '%s'", argv[1]);
        exit_status++;
        return;
     }
-    if (retval = krb5_db_get_principal(newprinc, &entry, &nprincs, &more)) {
+    if (retval = krb5_db_get_principal(edit_context, newprinc, &entry, 
+                                      &nprincs, &more)) {
        com_err(argv[0], retval, "while trying to get principal's database entry");
        exit_status++;
        return;
@@ -1040,7 +1043,8 @@ enter_rnd_key(argc, argv, change)
        nprincs = 1;
     }
     
-    if (retval = krb5_random_key(&master_encblock, master_random, &tempkey)) {
+    if (retval = krb5_random_key(edit_context, &master_encblock, 
+                                master_random, &tempkey)) {
        com_err(argv[0], retval, "while generating random key");
        exit_status++;
        return;
@@ -1071,15 +1075,16 @@ enter_rnd_key(argc, argv, change)
     entry.salt_type = entry.alt_salt_type = 0;
     entry.salt_length = entry.alt_salt_length = 0;
 
-    retval = krb5_kdb_encrypt_key(&master_encblock, tempkey, &entry.key);
-    krb5_free_keyblock(tempkey);
+    retval = krb5_kdb_encrypt_key(edit_context, &master_encblock, 
+                                 tempkey, &entry.key);
+    krb5_free_keyblock(edit_context, tempkey);
     if (retval) {
        com_err(argv[0], retval, "while encrypting key for '%s'", argv[1]);
        exit_status++;
        goto errout;
     }
 
-    if (retval = krb5_db_put_principal(&entry, &nprincs)) {
+    if (retval = krb5_db_put_principal(edit_context, &entry, &nprincs)) {
        com_err(argv[0], retval, "while storing entry for '%s'\n", argv[1]);
        exit_status++;
        goto errout;
@@ -1091,9 +1096,9 @@ enter_rnd_key(argc, argv, change)
     }
        
 errout:
-    krb5_free_principal(newprinc);
+    krb5_free_principal(edit_context, newprinc);
     if (nprincs)
-       krb5_db_free_principal(&entry, nprincs);
+       krb5_db_free_principal(edit_context, &entry, nprincs);
     return;
 }
 
@@ -1142,7 +1147,7 @@ void add_new_key(argc, argv)
            exit_status++;
            return;
     }
-    if (retval = krb5_parse_name(argv[1], &newprinc)) {
+    if (retval = krb5_parse_name(edit_context, argv[1], &newprinc)) {
        com_err(cmdname, retval, "while parsing '%s'", argv[1]);
        exit_status++;
        return;
@@ -1150,11 +1155,11 @@ void add_new_key(argc, argv)
     if (princ_exists(cmdname, newprinc) != NO_PRINC) {
        com_err(cmdname, 0, "principal '%s' already exists", argv[1]);
        exit_status++;
-       krb5_free_principal(newprinc);
+       krb5_free_principal(edit_context, newprinc);
        return;
     }
     enter_pwd_key(cmdname, argv[1], newprinc, newprinc, 0, salttype);
-    krb5_free_principal(newprinc);
+    krb5_free_principal(edit_context, newprinc);
     return;
 }
 
@@ -1176,7 +1181,7 @@ void add_v4_key(argc, argv)
            exit_status++;
            return;
     }
-    if (retval = krb5_parse_name(argv[1], &newprinc)) {
+    if (retval = krb5_parse_name(edit_context, argv[1], &newprinc)) {
        com_err(argv[0], retval, "while parsing '%s'", argv[1]);
        exit_status++;
        return;
@@ -1184,12 +1189,12 @@ void add_v4_key(argc, argv)
     if (princ_exists(argv[0], newprinc) != NO_PRINC) {
        com_err(argv[0], 0, "principal '%s' already exists", argv[1]);
        exit_status++;
-       krb5_free_principal(newprinc);
+       krb5_free_principal(edit_context, newprinc);
        return;
     }
     enter_pwd_key(argv[0], argv[1], newprinc, newprinc, 0,
                  KRB5_KDB_SALTTYPE_V4);
-    krb5_free_principal(newprinc);
+    krb5_free_principal(edit_context, newprinc);
     return;
 }
 
@@ -1230,7 +1235,7 @@ void change_pwd_key(argc, argv)
            exit_status++;
            return;
     }
-    if (retval = krb5_parse_name(argv[1], &newprinc)) {
+    if (retval = krb5_parse_name(edit_context, argv[1], &newprinc)) {
        com_err(cmdname, retval, "while parsing '%s'", argv[1]);
        exit_status++;
        return;
@@ -1238,11 +1243,11 @@ void change_pwd_key(argc, argv)
     if ((vno = princ_exists(argv[0], newprinc)) == NO_PRINC) {
        com_err(cmdname, 0, "No principal '%s' exists!", argv[1]);
        exit_status++;
-       krb5_free_principal(newprinc);
+       krb5_free_principal(edit_context, newprinc);
        return;
     }
     enter_pwd_key(cmdname, argv[1], newprinc, newprinc, vno, salttype);
-    krb5_free_principal(newprinc);
+    krb5_free_principal(edit_context, newprinc);
     return;
 }
 
@@ -1270,7 +1275,7 @@ void change_v4_key(argc, argv)
            exit_status++;
            return;
     }
-    if (retval = krb5_parse_name(argv[1], &newprinc)) {
+    if (retval = krb5_parse_name(edit_context, argv[1], &newprinc)) {
        com_err(argv[0], retval, "while parsing '%s'", argv[1]);
        exit_status++;
        return;
@@ -1278,28 +1283,23 @@ void change_v4_key(argc, argv)
     if ((vno = princ_exists(argv[0], newprinc)) == NO_PRINC) {
        com_err(argv[0], 0, "No principal '%s' exists!", argv[1]);
        exit_status++;
-       krb5_free_principal(newprinc);
+       krb5_free_principal(edit_context, newprinc);
        return;
     }
     enter_pwd_key(argv[0], argv[1], newprinc, newprinc, vno,
                  KRB5_KDB_SALTTYPE_V4);
-    krb5_free_principal(newprinc);
+    krb5_free_principal(edit_context, newprinc);
     return;
 }
 
 void
-enter_pwd_key(DECLARG(char *, cmdname),
-             DECLARG(char *, newprinc),
-             DECLARG(krb5_const_principal, princ),
-             DECLARG(krb5_const_principal, string_princ),
-             DECLARG(krb5_kvno, vno),
-             DECLARG(int, salttype))
-OLDDECLARG(char *, cmdname)
-OLDDECLARG(char *, newprinc)
-OLDDECLARG(krb5_const_principal, princ)
-OLDDECLARG(krb5_const_principal, string_princ)
-OLDDECLARG(krb5_kvno, vno)
-OLDDECLARG(int, salttype)
+enter_pwd_key(cmdname, newprinc, princ, string_princ, vno, salttype)
+    char * cmdname;
+    char * newprinc;
+    krb5_const_principal princ;
+    krb5_const_principal string_princ;
+    krb5_kvno vno;
+    int salttype;
 {
     krb5_error_code retval;
     char password[BUFSIZ];
@@ -1308,7 +1308,7 @@ OLDDECLARG(int, salttype)
     krb5_data pwd;
     struct saltblock salt;
 
-    if (retval = krb5_read_password(krb5_default_pwd_prompt1,
+    if (retval = krb5_read_password(edit_context, krb5_default_pwd_prompt1,
                                    krb5_default_pwd_prompt2,
                                    password, &pwsize)) {
        com_err(cmdname, retval, "while reading password for '%s'", newprinc);
@@ -1322,7 +1322,7 @@ OLDDECLARG(int, salttype)
 
     switch (salttype) {
     case KRB5_KDB_SALTTYPE_NORMAL:
-       if (retval = krb5_principal2salt(string_princ, &salt.saltdata)) {
+       if (retval = krb5_principal2salt(edit_context,string_princ,&salt.saltdata)) {
            com_err(cmdname, retval,
                    "while converting principal to salt for '%s'", newprinc);
            exit_status++;
@@ -1334,7 +1334,7 @@ OLDDECLARG(int, salttype)
        salt.saltdata.length = 0;
        break;
     case KRB5_KDB_SALTTYPE_NOREALM:
-       if (retval = krb5_principal2salt_norealm(string_princ,
+       if (retval = krb5_principal2salt_norealm(edit_context, string_princ,
                                                 &salt.saltdata)) {
            com_err(cmdname, retval,
                    "while converting principal to salt for '%s'", newprinc);
@@ -1345,7 +1345,8 @@ OLDDECLARG(int, salttype)
     case KRB5_KDB_SALTTYPE_ONLYREALM:
     {
        krb5_data *foo;
-       if (retval = krb5_copy_data(krb5_princ_realm(string_princ),
+       if (retval = krb5_copy_data(edit_context, 
+                                   krb5_princ_realm(edit_context, string_princ),
                                    &foo)) {
            com_err(cmdname, retval,
                    "while converting principal to salt for '%s'", newprinc);
@@ -1361,10 +1362,9 @@ OLDDECLARG(int, salttype)
        exit_status++;
        return;
     }
-    retval = krb5_string_to_key(&master_encblock, master_keyblock.keytype,
-                               &tempkey,
-                               &pwd,
-                               &salt.saltdata);
+    retval = krb5_string_to_key(edit_context, &master_encblock, 
+                               master_keyblock.keytype, &tempkey, 
+                               &pwd, &salt.saltdata);
     memset(password, 0, sizeof(password)); /* erase it */
     if (retval) {
        com_err(cmdname, retval, "while converting password to key for '%s'",
@@ -1413,14 +1413,15 @@ void show_principal(argc, argv)
            exit_status++;
            return;
     }
-    if (retval = krb5_parse_name(argv[1], &princ)) {
+    if (retval = krb5_parse_name(edit_context, argv[1], &princ)) {
        com_err(argv[0], retval, "while parsing '%s'", argv[1]);
        exit_status++;
        return;
     }
 
-    if (retval = krb5_db_get_principal(princ, &entry, &nprincs, &more)) {
-       com_err(argv[0], retval, "while trying to get principal's database entry");
+    if (retval = krb5_db_get_principal(edit_context,princ,&entry,&nprincs,&more)) {
+       com_err(argv[0], retval, 
+               "while trying to get principal's database entry");
        exit_status++;
        goto errout;
     }
@@ -1431,13 +1432,13 @@ void show_principal(argc, argv)
        goto errout;
     }
     
-    if (retval = krb5_unparse_name(entry.principal, &pr_name)) {
+    if (retval = krb5_unparse_name(edit_context, entry.principal, &pr_name)) {
        com_err(argv[0], retval, "while unparsing principal");
        exit_status++;
        goto errout;
     }
 
-    if (retval = krb5_unparse_name(entry.mod_name, &pr_mod)) {
+    if (retval = krb5_unparse_name(edit_context, entry.mod_name, &pr_mod)) {
        com_err(argv[0], retval, "while unparsing 'modified by' principal");
        exit_status++;
        goto errout;
@@ -1456,9 +1457,9 @@ void show_principal(argc, argv)
     }
     
 errout:
-    krb5_free_principal(princ);
+    krb5_free_principal(edit_context, princ);
     if (nprincs)
-       krb5_db_free_principal(&entry, nprincs);
+       krb5_db_free_principal(edit_context, &entry, nprincs);
 }
 
 void change_working_dir(argc, argv)
@@ -1500,7 +1501,8 @@ void print_working_dir(argc, argv)
 #undef getwd
 #endif
 
-int quit()
+int 
+quit()
 {
     krb5_error_code retval;
     static krb5_boolean finished = 0;
@@ -1508,10 +1510,11 @@ int quit()
     if (finished)
        return 0;
     if (valid_master_key) {
-           (void) krb5_finish_key(&master_encblock);
-           (void) krb5_finish_random_key(&master_encblock, &master_random);
+           (void) krb5_finish_key(edit_context, &master_encblock);
+           (void) krb5_finish_random_key(edit_context, &master_encblock, 
+                                         &master_random);
     }
-    retval = krb5_db_fini();
+    retval = krb5_db_fini(edit_context);
     memset((char *)master_keyblock.contents, 0, master_keyblock.length);
     finished = TRUE;
     if (retval && retval != KRB5_KDB_DBNOTINITED) {
index 794dab65c0fe3adc29308d661efe1a256d19e16b..180249a3fa79efab1591212eb379ffb9ae310a4f 100644 (file)
@@ -43,11 +43,15 @@ struct saltblock {
 
 /* krb5_kvno may be narrow */
 #include <krb5/widen.h>
-void add_key PROTOTYPE((char const *, char const *, krb5_const_principal,
-                       const krb5_keyblock *, krb5_kvno, struct saltblock *));
-void enter_pwd_key PROTOTYPE((char *, char *, krb5_const_principal,
-                             krb5_const_principal, krb5_kvno, int));
-int set_dbname_help PROTOTYPE((char *, char *));
+void add_key 
+       PROTOTYPE((char const *, char const *, 
+                  krb5_const_principal, const krb5_keyblock *, 
+                  krb5_kvno, struct saltblock *));
+void enter_pwd_key
+       PROTOTYPE((char *, char *, krb5_const_principal,
+                  krb5_const_principal, krb5_kvno, int));
+int set_dbname_help
+       PROTOTYPE((char *, char *));
 
 #include <krb5/narrow.h>
 char *kdb5_edit_Init PROTOTYPE((int, char **));
index 6391b62aa61967feeeb1d018c7eff7918e2db590..55b08d4e8256a7ad212008c1adae91999caf287d 100644 (file)
 #include "kdb5_edit.h"
 #include <tcl.h>
 
-#define CMDDECL(x) int x(DECLARG(ClientData, clientData),\
-                        DECLARG(Tcl_Interp, interp),\
-                        DECLARG(int, argc),\
-                        DECLARG(char **, argv))\
-OLDDECLARG(ClientData, clientData)\
-OLDDECLARG(Tcl_Interp *, interp)\
-OLDDECLARG(int, argc)\
-OLDDECLARG(char **, argv)
+#define CMDDECL(x) int x(clientData, interp, argc, argv)\
+    ClientData clientData;\
+    Tcl_Interp * interp;\
+    int argc;\
+    char ** argv;
 #define CMDPROTO(x) int x PROTOTYPE((ClientData, Tcl_Interp,\
                                     int, char **))
 #define MKCMD(name,cmd) Tcl_CreateCommand(interp, name, cmd,\
@@ -57,13 +54,13 @@ void change_rnd_key PROTOTYPE((int, char **));
 void add_v4_key PROTOTYPE((int, char **));
 void change_v4_key PROTOTYPE((int, char **));
 void delete_entry PROTOTYPE((int, char **));
-void extract_srvtab PROTOTYPE((int, char **));
+void extract_srvtab PROTOTYPE((krb5_context, int, char **));
 void extract_v4_srvtab PROTOTYPE((int, char **));
 void list_db PROTOTYPE((int, char **));
 void dump_db PROTOTYPE((int, char **));
 void load_db PROTOTYPE((int, char **));
-void set_dbname PROTOTYPE((int, char **));
-void enter_master_key PROTOTYPE((int, char **));
+void set_dbname PROTOTYPE((krb5_context, int, char **));
+void enter_master_key PROTOTYPE((krb5_context, int, char **));
 
 /*
  * this is mostly stolen from tcl_ExitCmd()