Replace krb5_xfree with appropriate free routine
authorRichard Basch <probe@mit.edu>
Tue, 18 Feb 1997 23:55:39 +0000 (23:55 +0000)
committerRichard Basch <probe@mit.edu>
Tue, 18 Feb 1997 23:55:39 +0000 (23:55 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9905 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/ChangeLog
src/kdc/do_as_req.c
src/kdc/do_tgs_req.c
src/kdc/kdc_preauth.c
src/kdc/kdc_util.c
src/kdc/kerberos_v4.c
src/kdc/main.c
src/kdc/replay.c

index 7ddfe33a87b81dd561b3f1e029e0107ef7b1f7ff..a9190212b02202964cc56f8fcc09df2b71decf82 100644 (file)
@@ -2,6 +2,12 @@ Tue Feb 18 09:56:16 1997  Ezra Peisach  <epeisach@mit.edu>
 
        * kerberos_v4.c: Remove include of krb4-proto.h
 
+Tue Feb 18 18:51:09 1997  Richard Basch  <basch@lehman.com>
+
+       * do_as_req.c do_tgs_req.c kdc_preauth.c kdc_util.c main.c
+       replay.c kerberos_v4.c:
+               Replace krb5_xfree with appropriate free routine.
+
 Thu Feb  6 00:09:46 1997  Richard Basch  <basch@lehman.com>
 
        * Makefile.in: Remove logger.c target before copying over it.
index cf999fec344038107a63d4f606e3f50d85528db8..d28a6b69ee36447dca478f660988857f535b5731 100644 (file)
@@ -321,8 +321,7 @@ krb5_data **response;                       /* filled in with a response packet */
        encrypting_key.enctype = ENCTYPE_DES_CBC_MD5;
        
     errcode = krb5_encrypt_tkt_part(kdc_context, &encrypting_key, &ticket_reply);
-    memset((char *)encrypting_key.contents, 0, encrypting_key.length);
-    krb5_xfree(encrypting_key.contents);
+    krb5_free_keyblock_contents(kdc_context, &encrypting_key);
     encrypting_key.contents = 0;
     if (errcode) {
        status = "ENCRYPTING_TICKET";
@@ -397,8 +396,7 @@ krb5_data **response;                       /* filled in with a response packet */
 
     errcode = krb5_encode_kdc_rep(kdc_context, KRB5_AS_REP, &reply_encpart, 
                                  &encrypting_key,  &reply, response);
-    memset((char *)encrypting_key.contents, 0, encrypting_key.length);
-    krb5_xfree(encrypting_key.contents);
+    krb5_free_keyblock_contents(kdc_context, &encrypting_key);
     encrypting_key.contents = 0;
 
     if (errcode) {
@@ -438,10 +436,9 @@ errout:
            
        errcode = prepare_error_as(request, errcode, &e_data, response);
     }
-    if (encrypting_key.contents) {
-       memset((char *)encrypting_key.contents, 0, encrypting_key.length);
-       krb5_xfree(encrypting_key.contents);
-    }
+
+    krb5_free_keyblock_contents(kdc_context, &encrypting_key);
+
     if (cname)
            free(cname);
     if (sname)
index 0ea2df1cd6129f9a43dbf0c56a9cc591c1493596..f2d7d93f19020934619ccefa37aa759daf62edf8 100644 (file)
@@ -567,8 +567,7 @@ tgt_again:
        ticket_reply.enc_part.kvno = server_key->key_data_kvno;
        errcode = krb5_encrypt_tkt_part(kdc_context, &encrypting_key,
                                        &ticket_reply);
-       memset((char *)encrypting_key.contents, 0, encrypting_key.length);
-       krb5_xfree(encrypting_key.contents);
+       krb5_free_keyblock_contents(kdc_context, &encrypting_key);
        if (errcode) {
            status = "TKT_ENCRYPT";
            goto cleanup;
index 6baaa27d146868ccaa7d3c5c61d10e2805b7c5b4..f1588d924c10fb641c2f4501439235ec4036ddff 100644 (file)
@@ -381,9 +381,7 @@ verify_enc_timestamp(context, client, request, enc_tkt_reply, pa)
        key.enctype = enc_data->enctype;
 
        retval = krb5_decrypt_data(context, &key, 0, enc_data, &enc_ts_data);
-       memset((char *)key.contents, 0, key.length);
-       krb5_xfree(key.contents);
-
+       krb5_free_keyblock_contents(context, &key);
        if (retval == 0)
            break;
     }
@@ -405,14 +403,12 @@ verify_enc_timestamp(context, client, request, enc_tkt_reply, pa)
     
 cleanup:
     if (enc_data) {
-       if (enc_data->ciphertext.data)
-           krb5_xfree(enc_data->ciphertext.data);
+       krb5_free_data_contents(context, &enc_data->ciphertext);
        free(enc_data);
     }
-    if (enc_ts_data.data)
-       krb5_xfree(enc_ts_data.data);
+    krb5_free_data_contents(context, &enc_ts_data)
     if (pa_enc)
-       krb5_xfree(pa_enc);
+       free(pa_enc);
     return retval;
 }
 
@@ -499,7 +495,7 @@ cleanup:
     if (entry)
        krb5_free_etype_info(context, entry);
     if (salt.data)
-       krb5_xfree(salt.data);
+       free(salt.data);
     return retval;
 }
 
@@ -920,8 +916,7 @@ sc.sam_challenge_label.length = strlen(sc.sam_challenge_label.data);
     }
 
 cleanup:
-    memset((char *)encrypting_key.contents, 0, encrypting_key.length);
-    krb5_xfree(encrypting_key.contents);
+    krb5_free_keyblock_contents(context, &encrypting_key);
     return retval;
 }
 
@@ -983,9 +978,9 @@ verify_sam_response(context, client, request, enc_tkt_reply, pa)
     setflag(enc_tkt_reply->flags, TKT_FLG_HW_AUTH);
   cleanup:
     if (retval) com_err("krb5kdc", retval, "sam verify failure");
-    if (sr) krb5_xfree(sr);
-    if (psr) krb5_xfree(psr);
-    if (esre) krb5_xfree(esre);
+    if (sr) free(sr);
+    if (psr) free(psr);
+    if (esre) free(esre);
 
     return retval;
 }
index a711a27e8b7d6717ca8afa6ffb6636cec4e8d871..60670ff8ec072fc9f7d36c0c44c0f792a809c40f 100644 (file)
@@ -69,7 +69,7 @@ krb5_authdata ***output;
            *retdata[i] = **ptr;
            if (!(retdata[i]->contents =
                  (krb5_octet *)malloc(retdata[i]->length))) {
-               krb5_xfree(retdata[i]);
+               free((char *)retdata[i]);
                retdata[i] = 0;
                krb5_free_authdata(kdc_context, retdata);
                return ENOMEM;
index 6b889613d735e125d1f6eef64760d7ec379b787e..b84175f4ad6f54617d80de433a23b13444efa9ad 100644 (file)
@@ -323,8 +323,7 @@ int compat_decrypt_key (in5, out4)
        memcpy(out4, out5.contents, out5.length);
        retval = 0;
     }
-    memset(out5.contents, 0, out5.length);
-    krb5_xfree(out5.contents);
+    krb5_free_keyblock_contents(kdc_context, &out5);
     return(retval);
 }
 
index bc7a2fee1ae60f2a5915113f25e4560dbec0aa8f..9fdd415ab341522fed8fa99d456830e280eb4c20 100644 (file)
@@ -153,7 +153,7 @@ get_realm_port(ctx, realm, name, defport, service)
                    }
                }
            }
-           krb5_xfree(hostlist);
+           free(hostlist);
        }
     }
     /*
index 1ec38a35a86b0f665f7f37a51d9845169e92c3ae..cf30c0784624decfe43438dfb9b099780e7021e5 100644 (file)
@@ -101,7 +101,7 @@ register krb5_data **outpkt;
                hold = eptr;
                last->next = eptr->next;
                eptr = last;
-               krb5_xfree(hold);
+               free(hold);
            } else {
                /* this isn't it, just move along */
                last = eptr;
@@ -134,12 +134,12 @@ register krb5_data *outpkt;
     eptr->timein = timenow;
     eptr->db_age = db_age;
     if (krb5_copy_data(kdc_context, inpkt, &eptr->req_packet)) {
-       krb5_xfree(eptr);
+       free(eptr);
        return;
     }
     if (krb5_copy_data(kdc_context, outpkt, &eptr->reply_packet)) {
        krb5_free_data(kdc_context, eptr->req_packet);
-       krb5_xfree(eptr);
+       free(eptr);
        return;
     }
     eptr->next = root_ptr.next;