From 8d1cdd087d2da9225d452a3eba8779ef6afc73c4 Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Tue, 18 Feb 1997 23:35:19 +0000 Subject: [PATCH] Remove krb5_xfree from the public interface 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 --- src/appl/bsd/ChangeLog | 5 ++ src/appl/bsd/kcmd.c | 2 +- src/appl/bsd/krcp.c | 7 +- src/appl/bsd/krlogind.c | 2 +- src/appl/bsd/krshd.c | 2 +- src/appl/simple/client/ChangeLog | 4 + src/appl/simple/client/sim_client.c | 6 +- src/appl/simple/server/ChangeLog | 4 + src/appl/simple/server/sim_server.c | 2 +- src/include/ChangeLog | 8 ++ src/include/k5-int.h | 4 + src/include/krb5.hin | 113 +++++++++------------------- src/lib/krb5/free/ChangeLog | 6 ++ src/lib/krb5/free/Makefile.in | 27 ++++--- src/lib/krb5/free/f_data.c | 47 ++++++++++++ src/lib/krb5/os/read_msg.c | 6 +- src/slave/ChangeLog | 4 + src/slave/kprop.c | 10 +-- src/slave/kpropd.c | 18 ++--- src/tests/create/ChangeLog | 5 ++ src/tests/create/kdb5_mkdums.c | 4 +- src/tests/hammer/ChangeLog | 5 ++ src/tests/hammer/kdc5_hammer.c | 3 +- 23 files changed, 173 insertions(+), 121 deletions(-) create mode 100644 src/lib/krb5/free/f_data.c diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 5cb08d5ef..32082f028 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 18 18:03:55 1997 Richard Basch + + * 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 * login.c: Force environment variables like HOME to be set even if diff --git a/src/appl/bsd/kcmd.c b/src/appl/bsd/kcmd.c index 6f4583596..e25da17d8 100644 --- a/src/appl/bsd/kcmd.c +++ b/src/appl/bsd/kcmd.c @@ -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) { diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index 6f76bd272..10819afb6 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -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); diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index 7773de517..29bd8a418 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -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; diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c index 8859e3a9f..43727a7d4 100644 --- a/src/appl/bsd/krshd.c +++ b/src/appl/bsd/krshd.c @@ -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; diff --git a/src/appl/simple/client/ChangeLog b/src/appl/simple/client/ChangeLog index 9deae0cc6..72017595a 100644 --- a/src/appl/simple/client/ChangeLog +++ b/src/appl/simple/client/ChangeLog @@ -1,3 +1,7 @@ +Tue Feb 18 18:11:03 1997 Richard Basch + + * sim_client.c: Replace krb5_xfree with krb5_free_data_contents + Tue Feb 4 20:38:44 1997 Tom Yu * Makefile.in: diff --git a/src/appl/simple/client/sim_client.c b/src/appl/simple/client/sim_client.c index a573dfa54..ec88a76b8 100644 --- a/src/appl/simple/client/sim_client.c +++ b/src/appl/simple/client/sim_client.c @@ -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); diff --git a/src/appl/simple/server/ChangeLog b/src/appl/simple/server/ChangeLog index dd7e1e146..e6fd132f4 100644 --- a/src/appl/simple/server/ChangeLog +++ b/src/appl/simple/server/ChangeLog @@ -1,3 +1,7 @@ +Tue Feb 18 18:12:16 1997 Richard Basch + + * sim_server.c: Use krb5_free_data_contents instead of krb5_xfree + Tue Feb 4 20:41:49 1997 Tom Yu * Makefile.in: diff --git a/src/appl/simple/server/sim_server.c b/src/appl/simple/server/sim_server.c index 255d786f2..f57ec8911 100644 --- a/src/appl/simple/server/sim_server.c +++ b/src/appl/simple/server/sim_server.c @@ -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 */ diff --git a/src/include/ChangeLog b/src/include/ChangeLog index a11790341..f7603ab14 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,11 @@ +Tue Feb 18 17:43:55 1997 Richard Basch + + * 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 * win-mac.h: Added KRB4 Windows INI related definitions. diff --git a/src/include/k5-int.h b/src/include/k5-int.h index eb654aa61..0b1d0b90f 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -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 */ diff --git a/src/include/krb5.hin b/src/include/krb5.hin index f19a56b20..df8573996 100644 --- a/src/include/krb5.hin +++ b/src/include/krb5.hin @@ -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" diff --git a/src/lib/krb5/free/ChangeLog b/src/lib/krb5/free/ChangeLog index 8a81e898c..0a4e09847 100644 --- a/src/lib/krb5/free/ChangeLog +++ b/src/lib/krb5/free/ChangeLog @@ -1,3 +1,9 @@ +Tue Feb 18 17:42:52 1997 Richard Basch + + * 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 * Makefile.in: win32 build diff --git a/src/lib/krb5/free/Makefile.in b/src/lib/krb5/free/Makefile.in index 593aacf32..68617bd13 100644 --- a/src/lib/krb5/free/Makefile.in +++ b/src/lib/krb5/free/Makefile.in @@ -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 index 000000000..cf7970bf3 --- /dev/null +++ b/src/lib/krb5/free/f_data.c @@ -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; +} diff --git a/src/lib/krb5/os/read_msg.c b/src/lib/krb5/os/read_msg.c index 6a93644a8..8ece718cc 100644 --- a/src/lib/krb5/os/read_msg.c +++ b/src/lib/krb5/os/read_msg.c @@ -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) { diff --git a/src/slave/ChangeLog b/src/slave/ChangeLog index f152ec2f7..6d203e510 100644 --- a/src/slave/ChangeLog +++ b/src/slave/ChangeLog @@ -1,3 +1,7 @@ +Tue Feb 18 18:18:44 1997 Richard Basch + + * kprop.c kpropd.c: Use krb5_free_data_contents, where appropriate. + Fri Jan 31 19:22:37 1997 Tom Yu * Makefile.in: diff --git a/src/slave/kprop.c b/src/slave/kprop.c index 0ddcc2fb1..d804ea092 100644 --- a/src/slave/kprop.c +++ b/src/slave/kprop.c @@ -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); } diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c index 7139a25c2..4081b7735 100644 --- a/src/slave/kpropd.c +++ b/src/slave/kpropd.c @@ -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); } diff --git a/src/tests/create/ChangeLog b/src/tests/create/ChangeLog index 8d0674d82..809a5f576 100644 --- a/src/tests/create/ChangeLog +++ b/src/tests/create/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 18 18:20:14 1997 Richard Basch + + * kdb5_mkdums.c (add_princ): + Replace krb5_xfree with krb5_free_data_contents + Sun Feb 9 01:35:19 1997 Tom Yu * Makefile.in: diff --git a/src/tests/create/kdb5_mkdums.c b/src/tests/create/kdb5_mkdums.c index df11ddb24..4d501fa83 100644 --- a/src/tests/create/kdb5_mkdums.c +++ b/src/tests/create/kdb5_mkdums.c @@ -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'", diff --git a/src/tests/hammer/ChangeLog b/src/tests/hammer/ChangeLog index f548db424..c50580c9f 100644 --- a/src/tests/hammer/ChangeLog +++ b/src/tests/hammer/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 18 18:21:16 1997 Richard Basch + + * kdc5_hammer.c (verify_cs_pair): + Use krb5_free_data_contents instead of krb5_xfree + Sun Feb 9 01:45:03 1997 Tom Yu * Makefile.in: diff --git a/src/tests/hammer/kdc5_hammer.c b/src/tests/hammer/kdc5_hammer.c index 9c5a51ddb..8100874bc 100644 --- a/src/tests/hammer/kdc5_hammer.c +++ b/src/tests/hammer/kdc5_hammer.c @@ -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; -- 2.26.2