getopt test vs EOF, not zero
authorJohn Kohl <jtkohl@mit.edu>
Thu, 26 Apr 1990 17:14:57 +0000 (17:14 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 26 Apr 1990 17:14:57 +0000 (17:14 +0000)
move master_encblock initialization into process_args

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

src/kdc/main.c

index ba33f13cc85ca9b894a3d93499738b12c67038f4..1a3e898e0eabb98b870de9741d40c87a07bf0fab 100644 (file)
@@ -133,7 +133,7 @@ char **argv;
 
     extern char *optarg;
 
-    while (c = getopt(argc, argv, "r:d:mM:k:")) {
+    while ((c = getopt(argc, argv, "r:d:mM:k:")) != EOF) {
        switch(c) {
        case 'r':                       /* realm name for db */
            db_realm = optarg;
@@ -179,9 +179,16 @@ char **argv;
        exit(1);
     }
 
+#ifdef PROVIDE_DES_CBC_CRC
+    master_encblock.crypto_entry = &mit_des_cryptosystem_entry;
+#else
+#error You gotta figure out what cryptosystem to use in the KDC.
+#endif
+
     if (retval = krb5_db_fetch_mkey(master_princ, &master_encblock, manual,
                                    &master_keyblock)) {
        com_err(argv[0], retval, "while fetching master key");
+       exit(1);
     }
     return;
 }
@@ -203,12 +210,6 @@ krb5_keyblock *masterkeyblock;
     if (retval = krb5_db_init())
        return(retval);
 
-#ifdef PROVIDE_DES_CBC_CRC
-    master_encblock.crypto_entry = &mit_des_cryptosystem_entry;
-#else
-#error You gotta figure out what cryptosystem to use in the KDC.
-#endif
-    
     if (retval = krb5_db_verify_master_key(masterkeyname, masterkeyblock,
                                           &master_encblock)) {
        master_encblock.crypto_entry = 0;
@@ -279,6 +280,9 @@ char *argv[];
 {
     krb5_error_code retval;
 
+    if (rindex(argv[0], '/'))
+       argv[0] = rindex(argv[0], '/')+1;
+
     setup_com_err();
 
     process_args(argc, argv);          /* includes reading master key */