Verify return code from krb5_db_set_mkey_list
authorZhanna Tsitkov <tsitkova@mit.edu>
Mon, 16 Mar 2009 18:00:06 +0000 (18:00 +0000)
committerZhanna Tsitkov <tsitkova@mit.edu>
Mon, 16 Mar 2009 18:00:06 +0000 (18:00 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22100 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/kdc_util.c
src/kdc/main.c

index 5e1c91c80612d0bc45047e3522750b36212246bb..4b1e31c787ff2dd202971ffb5c1abb6948e78b21 100644 (file)
@@ -454,7 +454,9 @@ kdc_get_server_key(krb5_ticket *ticket, unsigned int flags,
                                     &master_keyblock, 0, &tmp_mkey_list) == 0) {
             krb5_dbe_free_key_list(kdc_context, master_keylist);
             master_keylist = tmp_mkey_list;
-           krb5_db_set_mkey_list(kdc_context, master_keylist);
+           retval = krb5_db_set_mkey_list(kdc_context, master_keylist);
+            if (retval)
+                goto errout;
             if ((retval = krb5_dbe_find_mkey(kdc_context, master_keylist,
                                              server, &mkey_ptr))) {
                 goto errout;
@@ -469,10 +471,10 @@ kdc_get_server_key(krb5_ticket *ticket, unsigned int flags,
                                   -1, (krb5_int32)ticket->enc_part.kvno,
                                   &server_key);
     if (retval)
-       goto errout;
+        goto errout;
     if (!server_key) {
-       retval = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;
-       goto errout;
+        retval = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;
+        goto errout;
     }
     if ((*key = (krb5_keyblock *)malloc(sizeof **key))) {
        retval = krb5_dbekd_decrypt_key_data(kdc_context, mkey_ptr,
index 7656dcd8e11e0c2c58626c5e5cd93c0915bf0666..8a56f593e33a3039dd4f195d99c4ea9d3412c620 100644 (file)
@@ -444,7 +444,12 @@ init_realm(kdc_realm_t *rdp, char *realm, char *def_mpname,
                "while setting master key for realm %s", realm);
        goto whoops;
     }
-    krb5_db_set_mkey_list(rdp->realm_context, rdp->mkey_list);
+    kret = krb5_db_set_mkey_list(rdp->realm_context, rdp->mkey_list);
+    if (kret) {
+        kdc_err(rdp->realm_context, kret,
+                "while setting master key list for realm %s", realm);
+        goto whoops;
+    }
 
     /* Set up the keytab */
     if ((kret = krb5_ktkdb_resolve(rdp->realm_context, NULL,