Remove krb5_xfree from the public interface
authorRichard Basch <probe@mit.edu>
Tue, 18 Feb 1997 23:35:19 +0000 (23:35 +0000)
committerRichard Basch <probe@mit.edu>
Tue, 18 Feb 1997 23:35:19 +0000 (23:35 +0000)
Implement krb5_free_data & krb5_free_data_contents to cleanup krb5_data
structures and data contents allocated by the krb5 library.

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

23 files changed:
src/appl/bsd/ChangeLog
src/appl/bsd/kcmd.c
src/appl/bsd/krcp.c
src/appl/bsd/krlogind.c
src/appl/bsd/krshd.c
src/appl/simple/client/ChangeLog
src/appl/simple/client/sim_client.c
src/appl/simple/server/ChangeLog
src/appl/simple/server/sim_server.c
src/include/ChangeLog
src/include/k5-int.h
src/include/krb5.hin
src/lib/krb5/free/ChangeLog
src/lib/krb5/free/Makefile.in
src/lib/krb5/free/f_data.c [new file with mode: 0644]
src/lib/krb5/os/read_msg.c
src/slave/ChangeLog
src/slave/kprop.c
src/slave/kpropd.c
src/tests/create/ChangeLog
src/tests/create/kdb5_mkdums.c
src/tests/hammer/ChangeLog
src/tests/hammer/kdc5_hammer.c

index 5cb08d5ef18d170f3f4de21d5408309ea175e411..32082f0280364f8f51bdfd660e9f1abca2141b15 100644 (file)
@@ -1,3 +1,8 @@
+Tue Feb 18 18:03:55 1997  Richard Basch  <basch@lehman.com>
+
+       * krcp.c: Replace krb5_xfree with krb5_free_data_contents
+       * kcmd.c krlogind.c krshd.c: Use free instead of internal krb5_xfree
+
 Sat Dec 28 21:06:43 1996  Sam Hartman  <hartmans@luminous.MIT.EDU>
 
        * login.c: Force environment variables like HOME to be set even if
index 6f4583596d39c7f038c7728848dc8d62fb2ea68d..e25da17d80b68f53067fd0af09ebafedd51dafae 100644 (file)
@@ -303,7 +303,7 @@ kcmd(sock, ahost, rport, locuser, remuser, cmd, fd2p, service, realm,
     status = krb5_sendauth(bsd_context, &auth_context, (krb5_pointer) &s,
                            "KCMDV0.1", ret_cred->client, ret_cred->server,
                           authopts, &cksumdat, ret_cred, 0,    &error, &rep_ret, NULL);
-       krb5_xfree(cksumdat.data);
+    free(cksumbuf);
     if (status) {
        printf("Couldn't authenticate to server: %s\n", error_message(status));
        if (error) {
index 6f76bd272ee6a35284ee43d36192994d309496fb..10819afb603af0fef8af643548ce014f03958f16 100644 (file)
@@ -1306,7 +1306,8 @@ void
                                  &creds.server)) )
        exit(1);
 
-    krb5_xfree(pname_data.data);
+    krb5_free_data_contents(bsd_context, &pname_data);
+
     if ((status = krb5_get_credentials(bsd_context, KRB5_GC_USER_USER, cc, 
                                       &creds, &new_creds)))
        exit(1);
@@ -1318,7 +1319,7 @@ void
     
     if ((status = krb5_write_message(bsd_context, (krb5_pointer) &rem,
                                     &msg))) {
-       krb5_xfree(msg.data);
+       krb5_free_data_contents(bsd_context, &msg);
        exit(1);
     }
     
@@ -1328,7 +1329,7 @@ void
     /* cleanup */
     krb5_free_cred_contents(bsd_context, &creds);
     krb5_free_creds(bsd_context, new_creds);
-    krb5_xfree(msg.data);
+    krb5_free_data_contents(bsd_context, &msg);
     
     /* OK process key */
     krb5_use_enctype(bsd_context, &eblock, session_key->enctype);
index 7773de5175eacf37686af237d40b091fd4ca8401..29bd8a418a75239cc51e3aa863bf96d4ec79bd1a 100644 (file)
@@ -1495,7 +1495,7 @@ recvauth(valid_checksum)
                                      ticket->enc_part2->session->length);
     error_cleanup:
        if (chksumbuf)
-           krb5_xfree(chksumbuf);
+           free(chksumbuf);
        if (status) {
          krb5_free_authenticator(bsd_context, authenticator);
          return status;
index 8859e3a9f28e7b6d475bf46306744450e7eb1477..43727a7d4399bb9157b189ddfa29c4ae9dffc9d7 100644 (file)
@@ -1850,7 +1850,7 @@ recvauth(netf, peersin, valid_checksum)
 
     error_cleanup:
        if (chksumbuf)
-           krb5_xfree(chksumbuf);
+           free(chksumbuf);
        if (status) {
            krb5_free_authenticator(bsd_context, authenticator);
            return status;
index 9deae0cc6a1c6e85c0eeb1e01eb56cd7efc9ea89..72017595a575c8f0eedd9d4547abdecfb600b0a6 100644 (file)
@@ -1,3 +1,7 @@
+Tue Feb 18 18:11:03 1997  Richard Basch  <basch@lehman.com>
+
+       * sim_client.c: Replace krb5_xfree with krb5_free_data_contents
+
 Tue Feb  4 20:38:44 1997  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in:
index a573dfa54ad2158717723d7d6e962e2dac61a56d..ec88a76b8e77f516e6c2aad5cff5940f5576be61 100644 (file)
@@ -237,7 +237,7 @@ main(argc, argv)
     if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0) 
        com_err(progname, errno, "while sending KRB_AP_REQ message");
     printf("Sent authentication data: %d bytes\n", i);
-    krb5_xfree(packet.data);
+    krb5_free_data_contents(context, &packet);
 
     /* PREPARE KRB_SAFE MESSAGE */
 
@@ -305,7 +305,7 @@ main(argc, argv)
     if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0)
        com_err(progname, errno, "while sending SAFE message");
     printf("Sent checksummed message: %d bytes\n", i);
-    krb5_xfree(packet.data);
+    krb5_free_data_contents(context, &packet);
 
     /* PREPARE KRB_PRIV MESSAGE */
 
@@ -320,7 +320,7 @@ main(argc, argv)
     if ((i = send(sock, (char *)packet.data, packet.length, flags)) < 0)
        com_err(progname, errno, "while sending PRIV message");
     printf("Sent encrypted message: %d bytes\n", i);
-    krb5_xfree(packet.data);
+    krb5_free_data_contents(context, &packet);
 
     krb5_auth_con_free(context, auth_context);
     krb5_free_context(context);
index dd7e1e146239eeb475ae61fd25f2a5017214c857..e6fd132f488b974a2bd8be67a8d171308fe4c9c1 100644 (file)
@@ -1,3 +1,7 @@
+Tue Feb 18 18:12:16 1997  Richard Basch  <basch@lehman.com>
+
+       * sim_server.c: Use krb5_free_data_contents instead of krb5_xfree
+
 Tue Feb  4 20:41:49 1997  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in:
index 255d786f25acccc6e6096a9a71775e70557dc3bd..f57ec89110a686c8ddeed094021a9455dd6f05e6 100644 (file)
@@ -244,7 +244,7 @@ char *argv[];
     }
     printf("Safe message is: '%.*s'\n", message.length, message.data);
 
-    krb5_xfree(message.data);
+    krb5_free_data_contents(context, &message);
 
     /* NOW GET ENCRYPTED MESSAGE */
 
index a1179034135003d4ab14b6ccf4fdab8a7e237883..f7603ab14aec8c4c66bd2c15d96cb20b862c63be 100644 (file)
@@ -1,3 +1,11 @@
+Tue Feb 18 17:43:55 1997  Richard Basch  <basch@lehman.com>
+
+       * krb5.hin:
+               Added prototypes for krb5_free_data, krb5_free_data_contents
+               Moved krb5_xfree definition to k5-int.h
+       * k5-int.h:
+               krb5_xfree is an internal macro
+
 Mon Feb 17 13:58:45 1997  Richard Basch  <basch@lehman.com>
 
        * win-mac.h: Added KRB4 Windows INI related definitions.
index eb654aa61624bae2514f82c014c04d7e8eb73c74..0b1d0b90fa520dabe5bff9835d80242f01b548b5 100644 (file)
@@ -1263,4 +1263,8 @@ int krb5_seteuid  KRB5_PROTOTYPE((int));
 int krb5_setenv  KRB5_PROTOTYPE((const char *, const char *, int));
 
 void krb5_unsetenv  KRB5_PROTOTYPE((const char *));
+
+/* to keep lint happy */
+#define krb5_xfree(val) free((char FAR *)(val))
+
 #endif /* _KRB5_INT_H */
index f19a56b20e56699ae88d9ebc9f18a333f8751d6f..df85739969c3a1e0cd05bd94684a52952a66912c 100644 (file)
@@ -1515,98 +1515,71 @@ void krb5_free_realm_tree
 
 /* krb5_free.c */
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_principal
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_principal ));
+       KRB5_PROTOTYPE((krb5_context, krb5_principal ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_authenticator
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_authenticator FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_authenticator FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_authenticator_contents
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_authenticator FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_authenticator FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_addresses
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_address FAR * FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_address FAR * FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_address
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_address FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_address FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_authdata
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_authdata FAR * FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_authdata FAR * FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_enc_tkt_part
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_enc_tkt_part FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_enc_tkt_part FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_ticket
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_ticket FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_ticket FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_tickets
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_ticket FAR * FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_ticket FAR * FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_kdc_req
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_kdc_req FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_kdc_req FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_kdc_rep
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_kdc_rep FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_kdc_rep FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_last_req
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_last_req_entry FAR * FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_last_req_entry FAR * FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_enc_kdc_rep_part
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_enc_kdc_rep_part FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_enc_kdc_rep_part FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_error
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_error FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_error FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_ap_req
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_ap_req FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_ap_req FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_ap_rep
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_ap_rep FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_ap_rep FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_safe
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_safe FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_safe FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_priv
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_priv FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_priv FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_priv_enc_part
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_priv_enc_part FAR * ));
+       KRB5_PROTOTYPE((krb5_context, krb5_priv_enc_part FAR * ));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_cred
-       KRB5_PROTOTYPE((krb5_context, 
-               krb5_cred FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_cred FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_creds
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_creds FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_creds FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_cred_contents
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_creds FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_creds FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_cred_enc_part
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_cred_enc_part FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_cred_enc_part FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_checksum
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_checksum FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_checksum FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_keyblock
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_keyblock FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_keyblock FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_keyblock_contents
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_keyblock FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_keyblock FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_pa_data
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_pa_data FAR * FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_pa_data FAR * FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_ap_rep_enc_part
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_ap_rep_enc_part FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_ap_rep_enc_part FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_tkt_authent
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_tkt_authent FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_tkt_authent FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_pwd_data
-       KRB5_PROTOTYPE((krb5_context,
-               krb5_pwd_data FAR *));
+       KRB5_PROTOTYPE((krb5_context, krb5_pwd_data FAR *));
 KRB5_DLLIMP void KRB5_CALLCONV krb5_free_pwd_sequences
-       KRB5_PROTOTYPE((krb5_context,
-               passwd_phrase_element FAR * FAR *));
+       KRB5_PROTOTYPE((krb5_context, passwd_phrase_element FAR * FAR *));
+KRB5_DLLIMP void KRB5_CALLCONV krb5_free_data
+       KRB5_PROTOTYPE((krb5_context, krb5_data FAR *));
+KRB5_DLLIMP void KRB5_CALLCONV krb5_free_data_contents
+       KRB5_PROTOTYPE((krb5_context, krb5_data FAR *));
 
 /* From krb5/os but needed but by the outside world */
 KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_us_timeofday
@@ -2026,22 +1999,6 @@ KRB5_DLLIMP krb5_error_code KRB5_CALLCONV krb5_deltat_to_string
        KRB5_PROTOTYPE((krb5_deltat, char FAR *, size_t));
 
 
-/*
- * end stuff from libos.h
- */
-
-/*
- * begin "k5-free.h"
- */
-
-/* to keep lint happy */
-#define krb5_xfree(val) free((char FAR *)(val))
-
-#define krb5_free_data(context, val) { krb5_xfree((val)->data); krb5_xfree(val);}
-
-/*
- * end "k5-free.h"
- */
 
 /* The name of the Kerberos ticket granting service... and its size */
 #define        KRB5_TGS_NAME           "krbtgt"
index 8a81e898c02e9a6061ddf1c14153d80e616ea17e..0a4e098474726a8044279d6a0ec5fbc4d3605bf7 100644 (file)
@@ -1,3 +1,9 @@
+Tue Feb 18 17:42:52 1997  Richard Basch  <basch@lehman.com>
+
+       * Makefile.in f_data.c:
+               f_data.c now implements the functions
+               krb5_free_data, krb5_free_data_contents
+
 Thu Nov 21 11:55:16 EST 1996    Richard Basch   <basch@lehman.com>
 
         * Makefile.in: win32 build
index 593aacf327273fe4ec6bd057f3eda24884183686..68617bd132136f5224e3378332656c2dabc34e3a 100644 (file)
@@ -15,8 +15,11 @@ STLIBOBJS= \
        f_authent.o     \
        f_auth_cnt.o    \
        f_chksum.o      \
-       f_creds.o       \
+       f_cred.o        \
        f_cred_cnt.o    \
+       f_cred_enc.o    \
+       f_creds.o       \
+       f_data.o        \
        f_enc_kdc.o     \
        f_enc_tkt.o     \
        f_einfo.o       \
@@ -35,9 +38,7 @@ STLIBOBJS= \
        f_tgt_cred.o    \
        f_tkt_auth.o    \
        f_pwd_data.o    \
-       f_pwd_seq.o     \
-       f_cred.o        \
-       f_cred_enc.o
+       f_pwd_seq.o
 
 OBJS=  \
        f_addr.$(OBJEXT)        \
@@ -49,8 +50,11 @@ OBJS=        \
        f_authent.$(OBJEXT)     \
        f_auth_cnt.$(OBJEXT)    \
        f_chksum.$(OBJEXT)      \
-       f_creds.$(OBJEXT)       \
+       f_cred.$(OBJEXT)        \
        f_cred_cnt.$(OBJEXT)    \
+       f_cred_enc.$(OBJEXT)    \
+       f_creds.$(OBJEXT)       \
+       f_data.$(OBJEXT)        \
        f_enc_kdc.$(OBJEXT)     \
        f_enc_tkt.$(OBJEXT)     \
        f_einfo.$(OBJEXT)       \
@@ -69,9 +73,7 @@ OBJS= \
        f_tgt_cred.$(OBJEXT)    \
        f_tkt_auth.$(OBJEXT)    \
        f_pwd_data.$(OBJEXT)    \
-       f_pwd_seq.$(OBJEXT)     \
-       f_cred.$(OBJEXT)        \
-       f_cred_enc.$(OBJEXT)
+       f_pwd_seq.$(OBJEXT)
 
 SRCS=  \
        $(srcdir)/f_addr.c      \
@@ -83,8 +85,11 @@ SRCS=        \
        $(srcdir)/f_authent.c   \
        $(srcdir)/f_auth_cnt.c  \
        $(srcdir)/f_chksum.c    \
-       $(srcdir)/f_creds.c     \
+       $(srcdir)/f_cred.c      \
        $(srcdir)/f_cred_cnt.c  \
+       $(srcdir)/f_cred_enc.c  \
+       $(srcdir)/f_creds.c     \
+       $(srcdir)/f_data.c      \
        $(srcdir)/f_enc_kdc.c   \
        $(srcdir)/f_enc_tkt.c   \
        $(srcdir)/f_einfo.c     \
@@ -103,9 +108,7 @@ SRCS=       \
        $(srcdir)/f_tgt_cred.c  \
        $(srcdir)/f_tkt_auth.c  \
        $(srcdir)/f_pwd_data.c  \
-       $(srcdir)/f_pwd_seq.c   \
-       $(srcdir)/f_cred.c      \
-       $(srcdir)/f_cred_enc.c
+       $(srcdir)/f_pwd_seq.c
 
 all-windows:: $(OBJFILE)
 
diff --git a/src/lib/krb5/free/f_data.c b/src/lib/krb5/free/f_data.c
new file mode 100644 (file)
index 0000000..cf7970b
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * lib/krb5/free/f_data.c
+ *
+ * Copyright 1997 by the Massachusetts Institute of Technology.
+ *
+ * Export of this software from the United States of America may
+ *   require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * krb5_free_address()
+ */
+
+#include "k5-int.h"
+
+KRB5_DLLIMP void KRB5_CALLCONV
+krb5_free_data(context, val)
+    krb5_context context;
+    krb5_data FAR * val;
+{
+    if (val->data)
+       krb5_xfree(val->data);
+    krb5_xfree(val);
+    return;
+}
+
+KRB5_DLLIMP void KRB5_CALLCONV
+krb5_free_data_contents(context, val)
+    krb5_context context;
+    krb5_data FAR * val;
+{
+    if (val->data)
+       krb5_xfree(val->data);
+    return;
+}
index 6a93644a827bd99982df14a65c3ab160907588bc..8ece718cc0cd44dba78cb501de6496a00f79ef62 100644 (file)
@@ -39,7 +39,7 @@ krb5_read_message(context, fdp, inbuf)
        krb5_data       *inbuf;
 {
        krb5_int32      len;
-   int      len2, ilen;
+       int             len2, ilen;
        char            *buf = NULL;
        int             fd = *( (int *) fdp);
        
@@ -47,8 +47,8 @@ krb5_read_message(context, fdp, inbuf)
                return((len2 < 0) ? errno : ECONNABORTED);
        len = ntohl(len);
 
-   if ((len & VALID_UINT_BITS) != len)  /* Overflow size_t??? */
-      return ENOMEM;
+       if ((len & VALID_UINT_BITS) != len)  /* Overflow size_t??? */
+               return ENOMEM;
 
        inbuf->length = ilen = (int) len;
        if (ilen) {
index f152ec2f7a5f51f3a5bfbcf5e522ce00d24c39c6..6d203e510701cdbc0ae7c972de12eb145a3a1092 100644 (file)
@@ -1,3 +1,7 @@
+Tue Feb 18 18:18:44 1997  Richard Basch  <basch@lehman.com>
+
+       * kprop.c kpropd.c: Use krb5_free_data_contents, where appropriate.
+
 Fri Jan 31 19:22:37 1997  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in:
index 0ddcc2fb13827ca639d0442cf1ca1200df527363..d804ea0923e663fa884045378825317ab177c0c2 100644 (file)
@@ -546,11 +546,11 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, database_size)
                exit(1);
        }
        if (retval = krb5_write_message(context, (void *) &fd, &outbuf)) {
-               krb5_xfree(outbuf.data);
+               krb5_free_data_contents(context, &outbuf);
                com_err(progname, retval, "while sending database size");
                exit(1);
        }
-       krb5_xfree(outbuf.data);
+       krb5_free_data_contents(context, &outbuf);
     /*
      * Initialize the initial vector.
      */
@@ -577,13 +577,13 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, database_size)
                        exit(1);
                }
                if (retval = krb5_write_message(context, (void *)&fd,&outbuf)) {
-                       krb5_xfree(outbuf.data);
+                       krb5_free_data_contents(context, &outbuf);
                        com_err(progname, retval,
                                "while sending database block starting at %d",
                                sent_size);
                        exit(1);
                }
-               krb5_xfree(outbuf.data);
+               krb5_free_data_contents(context, &outbuf);
                sent_size += n;
                if (debug)
                        printf("%d bytes sent.\n", sent_size);
@@ -674,7 +674,7 @@ send_error(context, my_creds, fd, err_text, err_code)
                strcpy(error.text.data, text);
                if (!krb5_mk_error(context, &error, &outbuf)) {
                        (void) krb5_write_message(context, (void *)&fd,&outbuf);
-                       krb5_xfree(outbuf.data);
+                       krb5_free_data_contents(context, &outbuf);
                }
                free(error.text.data);
        }
index 7139a25c24628c5f21dc03ef9726a06f43a5e147..4081b7735e12a8d5877c52635726610165bf2dd4 100644 (file)
@@ -324,12 +324,12 @@ void doit(fd)
         */
        if (retval = krb5_write_message(kpropd_context, (void *) &fd,
                                        &confmsg)) { 
-               krb5_xfree(confmsg.data);
+               krb5_free_data_contents(context, &confmsg);
                com_err(progname, retval,
                        "while sending # of received bytes");
                exit(1);
        }
-       krb5_xfree(confmsg.data);
+       krb5_free_data_contents(context, &confmsg);
        if (close(fd) < 0) {
                com_err(progname, errno,
                        "while trying to close database file");
@@ -652,14 +652,14 @@ recv_database(context, fd, database_fd, confmsg)
                recv_error(context, &inbuf);
        if (retval = krb5_rd_safe(context,auth_context,&inbuf,&outbuf,NULL)) {
                send_error(context, fd, retval, "while decoding database size");
-               krb5_xfree(inbuf.data);
+               krb5_free_data_contents(context, &inbuf);
                com_err(progname, retval,
                        "while decoding database size from client");
                exit(1);
        }
        memcpy((char *) &database_size, outbuf.data, sizeof(database_size));
-       krb5_xfree(inbuf.data);
-       krb5_xfree(outbuf.data);
+       krb5_free_data_contents(context, &inbuf);
+       krb5_free_data_contents(context, &outbuf);
        database_size = ntohl(database_size);
 
     /*
@@ -693,12 +693,12 @@ recv_database(context, fd, database_fd, confmsg)
                                received_size);
                        com_err(progname, retval, buf);
                        send_error(context, fd, retval, buf);
-                       krb5_xfree(inbuf.data);
+                       krb5_free_data_contents(context, &inbuf);
                        exit(1);
                }
                n = write(database_fd, outbuf.data, outbuf.length);
-               krb5_xfree(inbuf.data);
-               krb5_xfree(outbuf.data);
+               krb5_free_data_contents(context, &inbuf);
+               krb5_free_data_contents(context, &outbuf);
                if (n < 0) {
                        sprintf(buf,
                                "while writing database block starting at offset %d",
@@ -774,7 +774,7 @@ send_error(context, fd, err_code, err_text)
                strcpy(error.text.data, text);
                if (!krb5_mk_error(context, &error, &outbuf)) {
                        (void) krb5_write_message(context, (void *)&fd,&outbuf);
-                       krb5_xfree(outbuf.data);
+                       krb5_free_data_contents(context, &outbuf);
                }
                free(error.text.data);
        }
index 8d0674d829ed02ca516ed65aa8e617fad9e358c5..809a5f576bb942ebb4983494fd5b4bb3ed9f4887 100644 (file)
@@ -1,3 +1,8 @@
+Tue Feb 18 18:20:14 1997  Richard Basch  <basch@lehman.com>
+
+       * kdb5_mkdums.c (add_princ): 
+               Replace krb5_xfree with krb5_free_data_contents
+
 Sun Feb  9 01:35:19 1997  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in:
index df11ddb241b9af38b2565e0397770a66b7805656..4d501fa834df7c008da1378df7309a5754de1778 100644 (file)
@@ -282,10 +282,10 @@ add_princ(context, str_newprinc)
                                        &key, &pwd, &salt)) {
            com_err(progname,retval,"while converting password to key for '%s'",
                    princ_name);
-           krb5_xfree(salt.data);
+           krb5_free_data_contents(context, &salt);
            goto error;
        }
-       krb5_xfree(salt.data);
+       krb5_free_data_contents(context, &salt);
 
        if (retval = krb5_dbe_create_key_data(context, &newentry)) {
            com_err(progname, retval, "while creating key_data for '%s'",
index f548db424b0075531f815718356b8c221e0e5229..c50580c9f1a2dabe9f11ad3dbe6e0aea86fe1944 100644 (file)
@@ -1,3 +1,8 @@
+Tue Feb 18 18:21:16 1997  Richard Basch  <basch@lehman.com>
+
+       * kdc5_hammer.c (verify_cs_pair):
+               Use krb5_free_data_contents instead of krb5_xfree
+
 Sun Feb  9 01:45:03 1997  Tom Yu  <tlyu@mit.edu>
 
        * Makefile.in:
index 9c5a51ddba912b8717a1c2fde52dc3c0b644aca9..8100874bca460876806ba531fc090f635ad5a309 100644 (file)
@@ -458,8 +458,7 @@ cleanup_keyblock:
     krb5_free_keyblock(context, keyblock);
 
 cleanup_rdata:
-    krb5_xfree(request_data.data);
-
+    krb5_free_data_contents(context, &request_data);
     krb5_free_cred_contents(context, credsp);
 
     return retval;