From 0ea32b79dbd3eb4accf4eacfb5d057f58ecefc12 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Fri, 27 Apr 1990 15:36:33 +0000 Subject: [PATCH] -d option for dbname clean up stuff, make it work git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@610 dc483132-0cff-0310-8789-dd5450dbe970 --- src/admin/create/kdb5_create.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/admin/create/kdb5_create.c b/src/admin/create/kdb5_create.c index aaf79f873..aff1d3035 100644 --- a/src/admin/create/kdb5_create.c +++ b/src/admin/create/kdb5_create.c @@ -23,6 +23,7 @@ static char rcsid_kdb_create_c[] = #include #include #include +#include #include #include @@ -73,7 +74,7 @@ usage(who, status) char *who; int status; { - fprintf(stderr, "usage: %s [-n dbname] [-r realmname] [-k keytype]\n\ + fprintf(stderr, "usage: %s [-d dbpathname] [-r realmname] [-k keytype]\n\ \t[-e etype] [-M mkeyname]\n", who); exit(status); @@ -117,17 +118,20 @@ char *argv[]; char *mkey_name = 0; char *mkey_fullname; char defrealm[BUFSIZ]; - int keytypedone = 0, etypedone = 0; - krb5_enctype etype; + int keytypedone = 0; + krb5_enctype etype = -1; register krb5_cryptosystem_entry *csentry; initialize_krb5_error_table(); initialize_kdb5_error_table(); initialize_isod_error_table(); - while ((optchar = getopt(argc, argv, "n:r:k:M:e:")) != EOF) { + if (rindex(argv[0], '/')) + argv[0] = rindex(argv[0], '/')+1; + + while ((optchar = getopt(argc, argv, "d:r:k:M:e:")) != EOF) { switch(optchar) { - case 'n': /* set db name */ + case 'd': /* set db name */ dbname = optarg; break; case 'r': @@ -142,7 +146,6 @@ char *argv[]; break; case 'e': etype = atoi(optarg); - etypedone++; break; case '?': default: @@ -150,23 +153,21 @@ char *argv[]; /*NOTREACHED*/ } } - if (!mkey_name) - mkey_name = KRB5_KDB_M_NAME; if (!keytypedone) master_keyblock.keytype = KEYTYPE_DES; if (!valid_keytype(master_keyblock.keytype)) { - com_err(argv[0], KRB5KDC_ERR_ETYPE_NOSUPP, + com_err(argv[0], KRB5_PROG_KEYTYPE_NOSUPP, "while setting up keytype %d", master_keyblock.keytype); exit(1); } - if (!etypedone) - etype = keytype_to_etype(master_keyblock.keytype); + if (etype == -1) + etype = krb5_keytype_array[master_keyblock.keytype]->system->proto_enctype; if (!valid_etype(etype)) { - com_err(argv[0], KRB5KDC_ERR_ETYPE_NOSUPP, + com_err(argv[0], KRB5_PROG_ETYPE_NOSUPP, "while setting up etype %d", etype); exit(1); } @@ -196,7 +197,7 @@ char *argv[]; /* assemble & parse the master key name */ - if (retval = setup_mkey_name(mkey_name, realm, &mkey_fullname, + if (retval = krb5_db_setup_mkey_name(mkey_name, realm, &mkey_fullname, &master_princ)) { com_err(argv[0], retval, "while setting up master key name"); exit(1); -- 2.26.2