* kadm5_create.c: Add prototype for static
authorEzra Peisach <epeisach@mit.edu>
Mon, 4 Jun 2001 21:17:17 +0000 (21:17 +0000)
committerEzra Peisach <epeisach@mit.edu>
Mon, 4 Jun 2001 21:17:17 +0000 (21:17 +0000)
add_admin_princs(). Cleanup calling of add_admin_princs() to be
consistant with prototype.

* kdb5_create.c, kdb5_stash.c, kdb5_destroy.c: Cleanup assignments
in conditionals.

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

src/kadmin/dbutil/ChangeLog
src/kadmin/dbutil/kadm5_create.c
src/kadmin/dbutil/kdb5_create.c
src/kadmin/dbutil/kdb5_destroy.c
src/kadmin/dbutil/kdb5_stash.c

index 4b62233fdd5fc9c587b1f26c148aee9e80dbbff4..10e2df034301811414fe992af0eded24fc01ab90 100644 (file)
@@ -1,3 +1,12 @@
+2001-06-04  Ezra Peisach  <epeisach@mit.edu>
+
+       * kadm5_create.c: Add prototype for static
+       add_admin_princs(). Cleanup calling of add_admin_princs() to be
+       consistant with prototype.
+
+       * kdb5_create.c, kdb5_stash.c, kdb5_destroy.c: Cleanup assignments
+       in conditionals.
+
 Mon Feb 26 15:01:27 2001  Ezra Peisach  <epeisach@mit.edu>
 
        * loadv4.c, ovload.c, kdb5_util.h, kdb5_util.c, kadm5_create.c,
index 1c432ef73d4c486888d6f1a878f53fce85a8627b..d4f326a39f4a41d75f7655001335525fdc67f356 100644 (file)
@@ -51,6 +51,7 @@ static char *rcsid = "$Header$";
 
 static int add_admin_princ(void *handle, krb5_context context,
                    char *name, char *realm, int attrs, int lifetime);
+static int add_admin_princs(void *handle, krb5_context context, char *realm);
 
 #define ERR 1
 #define OK 0
@@ -119,7 +120,7 @@ int kadm5_create_magic_princs(kadm5_config_params *params,
          return retval;
      }
 
-     retval = add_admin_princs(handle, &context, params->realm);
+     retval = add_admin_princs(handle, context, params->realm);
 
      kadm5_destroy(handle);
 
@@ -229,25 +230,25 @@ int add_admin_princ(void *handle, krb5_context context,
                    char *name, char *realm, int attrs, int lifetime)
 {
      char *fullname;
-     int nprincs;
      krb5_error_code ret;
      kadm5_principal_ent_rec ent;
 
      memset(&ent, 0, sizeof(ent));
 
      fullname = build_name_with_realm(name, realm);
-     if (ret = krb5_parse_name(context, fullname, &ent.principal)) {
+     ret = krb5_parse_name(context, fullname, &ent.principal);
+     if (ret) {
          com_err(progname, ret, str_PARSE_NAME);
          return(ERR);
      }
      ent.max_life = lifetime;
      ent.attributes = attrs | KRB5_KDB_DISALLOW_ALL_TIX;
      
-     if (ret = kadm5_create_principal(handle, &ent,
-                                          (KADM5_PRINCIPAL |
-                                           KADM5_MAX_LIFE |
-                                           KADM5_ATTRIBUTES),
-                                          "to-be-random")) {
+     ret = kadm5_create_principal(handle, &ent,
+                                 (KADM5_PRINCIPAL | KADM5_MAX_LIFE |
+                                  KADM5_ATTRIBUTES),
+                                 "to-be-random");
+     if (ret) {
          if (ret != KADM5_DUP) {
               com_err(progname, ret, str_PUT_PRINC, fullname);
               krb5_free_principal(context, ent.principal);
index ee2982f44e75238712062c6a4a54a9b0656e21f7..f10f6a4f873092484a84ad3ec8935d2dd0b9befa 100644 (file)
@@ -240,8 +240,10 @@ master key name '%s'\n",
        com_err(argv[0], retval, "while calculated master key salt");
        exit_status++; return;
     }
-    if (retval = krb5_c_string_to_key(util_context, master_keyblock.enctype, 
-                                     &pwd, &master_salt, &master_keyblock)) {
+
+    retval = krb5_c_string_to_key(util_context, master_keyblock.enctype, 
+                                 &pwd, &master_salt, &master_keyblock);
+    if (retval) {
        com_err(argv[0], retval, "while transforming master key from password");
        exit_status++; return;
     }
@@ -261,7 +263,7 @@ master key name '%s'\n",
                global_params.dbname);
        exit_status++; return;
     }
-    if (retval = krb5_db_fini(util_context)) {
+    if ((retval = krb5_db_fini(util_context))) {
         com_err(argv[0], retval, "while closing current database");
         exit_status++; return;
     }
@@ -287,10 +289,11 @@ master key name '%s'\n",
      * it; delete the file below if it was not requested.  DO NOT EXIT
      * BEFORE DELETING THE KEYFILE if do_stash is not set.
      */
-    if (retval = krb5_db_store_mkey(util_context,
-                                   global_params.stash_file,
-                                   master_princ,
-                                   &master_keyblock)) {
+    retval = krb5_db_store_mkey(util_context,
+                           global_params.stash_file,
+                           master_princ,
+                           &master_keyblock);
+    if (retval) {
        com_err(argv[0], errno, "while storing key");
        printf("Warning: couldn't stash master key.\n");
     }
@@ -324,7 +327,6 @@ tgt_keysalt_iterate(ksent, ptr)
     struct iterate_args        *iargs;
     krb5_keyblock      key;
     krb5_int32         ind;
-    krb5_pointer rseed;
     krb5_data  pwd;
 
     iargs = (struct iterate_args *) ptr;
@@ -338,7 +340,8 @@ tgt_keysalt_iterate(ksent, ptr)
      */
     pwd.data = mkey_password;
     pwd.length = strlen(mkey_password);
-    if (kret = krb5_c_random_seed(context, &pwd))
+    kret = krb5_c_random_seed(context, &pwd);
+    if (kret)
        return kret;
 
     if (!(kret = krb5_dbe_create_key_data(iargs->ctx, iargs->dbentp))) {
index 51fe7ac018bed6e3663ca3e8fa46330408615c40..ea2fb7142a664073ef71116f3fcd658c77d75b38 100644 (file)
@@ -53,7 +53,6 @@ kdb5_destroy(argc, argv)
     int optchar;
     char *dbname;
     char buf[5];
-    char dbfilename[MAXPATHLEN];
     krb5_error_code retval, retval1, retval2;
     krb5_context context;
     int force = 0;
@@ -90,7 +89,8 @@ kdb5_destroy(argc, argv)
        printf("OK, deleting database '%s'...\n", dbname);
     }
 
-    if (retval = krb5_db_set_name(context, dbname)) {
+    retval = krb5_db_set_name(context, dbname);
+    if (retval) {
        com_err(argv[0], retval, "'%s'",dbname);
        exit_status++; return;
     }
index 419d14f66ff2781596c349a7c0f5c37481cdf3b2..46a2c6192102916dcdde24cfd584748b741a2f28 100644 (file)
@@ -83,8 +83,6 @@ char *argv[];
     char *keyfile = 0;
     krb5_context context;
 
-    int enctypedone = 0;
-
     if (strrchr(argv[0], '/'))
        argv[0] = strrchr(argv[0], '/')+1;
 
@@ -121,50 +119,59 @@ char *argv[];
        exit_status++; return; 
     }
 
-    if (retval = krb5_db_set_name(context, dbname)) {
+    retval = krb5_db_set_name(context, dbname);
+    if (retval) {
        com_err(argv[0], retval, "while setting active database to '%s'",
                dbname);
        exit_status++; return; 
     }
 
     /* assemble & parse the master key name */
-
-    if (retval = krb5_db_setup_mkey_name(context, mkey_name, realm, 
-                                        &mkey_fullname, &master_princ)) {
+    retval = krb5_db_setup_mkey_name(context, mkey_name, realm, 
+                                    &mkey_fullname, &master_princ);
+    if (retval) {
        com_err(argv[0], retval, "while setting up master key name");
        exit_status++; return; 
     }
 
-    if (retval = krb5_db_init(context)) {
+    retval = krb5_db_init(context);
+    if (retval) {
        com_err(argv[0], retval, "while initializing the database '%s'",
                dbname);
        exit_status++; return; 
     }
 
     /* TRUE here means read the keyboard, but only once */
-    if (retval = krb5_db_fetch_mkey(context, master_princ,
-                                   master_keyblock.enctype,
-                                   TRUE, FALSE, (char *) NULL,
-                                   0, &master_keyblock)) {
+    retval = krb5_db_fetch_mkey(context, master_princ,
+                               master_keyblock.enctype,
+                               TRUE, FALSE, (char *) NULL,
+                               0, &master_keyblock);
+    if (retval) {
        com_err(argv[0], retval, "while reading master key");
        (void) krb5_db_fini(context);
        exit_status++; return; 
     }
-    if (retval = krb5_db_verify_master_key(context, master_princ, 
-                                          &master_keyblock)) {
+
+    retval = krb5_db_verify_master_key(context, master_princ, 
+                                      &master_keyblock);
+    if (retval) {
        com_err(argv[0], retval, "while verifying master key");
        (void) krb5_db_fini(context);
        exit_status++; return; 
     }  
-    if (retval = krb5_db_store_mkey(context, keyfile, master_princ, 
-                                   &master_keyblock)) {
+
+    retval = krb5_db_store_mkey(context, keyfile, master_princ, 
+                               &master_keyblock);
+    if (retval) {
        com_err(argv[0], errno, "while storing key");
        memset((char *)master_keyblock.contents, 0, master_keyblock.length);
        (void) krb5_db_fini(context);
        exit_status++; return; 
     }
     memset((char *)master_keyblock.contents, 0, master_keyblock.length);
-    if (retval = krb5_db_fini(context)) {
+
+    retval = krb5_db_fini(context);
+    if (retval) {
        com_err(argv[0], retval, "closing database '%s'", dbname);
        exit_status++; return; 
     }