*main.c:
authorRichard Basch <probe@mit.edu>
Tue, 27 Feb 1996 22:37:56 +0000 (22:37 +0000)
committerRichard Basch <probe@mit.edu>
Tue, 27 Feb 1996 22:37:56 +0000 (22:37 +0000)
Do not repeat random number generator initializations, as memory
is allocated and never reclaimed.  Also fixed the V4 random number
generator initialization (a DES_CBC_CRC random number is generated
and used as a seed for the V4 routine, but the generation function
was being called with the wrong arguments).

* do_as_req.c:
Memory was occassionally being freed twice because the pointer was
not re-initialized to NULL after it was freed.

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

src/kdc/ChangeLog
src/kdc/do_as_req.c
src/kdc/main.c

index 2df5127543a0f20e4852af379b6c3012ac87739f..e22de68b89766dfd9849b7c8c17fbe9bbfed8114 100644 (file)
@@ -1,3 +1,16 @@
+Tue Feb 27 17:33:44 1996  Richard Basch  <basch@lehman.com>
+
+       * main.c:
+       Do not repeat random number generator initializations, as memory
+       is allocated and never reclaimed.  Also fixed the V4 random number
+       generator initialization (a DES_CBC_CRC random number is generated
+       and used as a seed for the V4 routine, but the generation function
+       was being called with the wrong arguments).
+
+       * do_as_req.c:
+       Memory was occassionally being freed twice because the pointer was
+       not re-initialized to NULL after it was freed.
+
 Sun Feb 25 16:04:10 1996  Mark W. Eichin  <eichin@cygnus.com>
 
        * main.c (initialize_realms): missing indirection for conf_val in
index 6196a682328a7a32231645e595302cb947107ddb..cf999fec344038107a63d4f606e3f50d85528db8 100644 (file)
@@ -399,6 +399,7 @@ krb5_data **response;                       /* filled in with a response packet */
                                  &encrypting_key,  &reply, response);
     memset((char *)encrypting_key.contents, 0, encrypting_key.length);
     krb5_xfree(encrypting_key.contents);
+    encrypting_key.contents = 0;
 
     if (errcode) {
        status = "ENCODE_KDC_REP";
index 474669ea09854bcbfaef1081e61ae38e7b227563..960ecdf954b9991896cfda755b6188ff3f89cb25 100644 (file)
@@ -311,9 +311,6 @@ init_realm(progname, rdp, realm, def_dbname, def_mpname,
     krb5_key_salt_tuple        *kslist;
     krb5_int32         nkslist;
     int                        i;
-#ifdef KRB5_KRB4_COMPAT
-    static krb5_boolean        k4_inited = FALSE;
-#endif
 
     kret = EINVAL;
     db_inited = 0;
@@ -631,7 +628,8 @@ goto whoops;
                 * generators.
                 */
                for (enctype = 0; enctype <= krb5_max_enctype; enctype++) {
-                   if (krb5_enctype_array[enctype]) {
+                   if (krb5_enctype_array[enctype] &&
+                       !krb5_enctype_array[enctype]->random_sequence) {
                        if ((kret = (*krb5_enctype_array[enctype]->system->
                                     init_random_key)
                             (&rdp->realm_mkey,
@@ -640,22 +638,22 @@ goto whoops;
                                    "while setting up random key generator for enctype %d--enctype disabled",
                                    enctype);
                            krb5_enctype_array[enctype] = 0;
+                       } else {
 #ifdef KRB5_KRB4_COMPAT
-                       } else if (!k4_inited &&
-                                  (enctype == ENCTYPE_DES_CBC_CRC)) {
-                           krb5_use_enctype(rdp->realm_context,
-                                            &temp_eblock, enctype);
-                           if ((kret = (*krb5_enctype_array[enctype]->
-                                        system->random_key)
-                                (&temp_eblock,
-                                 &krb5_enctype_array[enctype]->random_sequence,
-                                 &temp_key)))
-                               com_err(progname, kret,
-                                       "while initializing V4 random key generator");
-                           else {
-                               k4_inited = 1;
-                               (void) des_init_random_number_generator(temp_key->contents);
-                               krb5_free_keyblock(rdp->realm_context, temp_key);
+                           if (enctype == ENCTYPE_DES_CBC_CRC) {
+                               krb5_use_enctype(rdp->realm_context,
+                                                &temp_eblock, enctype);
+                               if ((kret = (*krb5_enctype_array[enctype]->
+                                            system->random_key)
+                                    (&temp_eblock,
+                                     krb5_enctype_array[enctype]->random_sequence,
+                                     &temp_key)))
+                                   com_err(progname, kret,
+                                           "while initializing V4 random key generator");
+                               else {
+                                   (void) des_init_random_number_generator(temp_key->contents);
+                                   krb5_free_keyblock(rdp->realm_context, temp_key);
+                               }
                            }
 #endif
                        }