diff options
author | gibbs <gibbs@FreeBSD.org> | 1995-01-25 06:37:33 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 1995-01-25 06:37:33 +0000 |
commit | 98c3cd0728c0f55ff2e86b18897e195c36d10537 (patch) | |
tree | c26954c76563a74a5c7143311a4d3e8ace69ee20 | |
parent | cd6576a65db27715c8edbafd3730a58b986d545b (diff) | |
download | FreeBSD-src-98c3cd0728c0f55ff2e86b18897e195c36d10537.zip FreeBSD-src-98c3cd0728c0f55ff2e86b18897e195c36d10537.tar.gz |
Less expensive fix for the freeing of uninitialized fields in the hostdata
struct. Simply test the "no_host" variable, which if true implies that
the hostdata contains bogus data, and act accordingly.
-rw-r--r-- | eBones/krb/send_to_kdc.c | 19 | ||||
-rw-r--r-- | eBones/lib/libkrb/send_to_kdc.c | 19 |
2 files changed, 20 insertions, 18 deletions
diff --git a/eBones/krb/send_to_kdc.c b/eBones/krb/send_to_kdc.c index 15e4220..59349c7 100644 --- a/eBones/krb/send_to_kdc.c +++ b/eBones/krb/send_to_kdc.c @@ -4,7 +4,7 @@ * <Copyright.MIT>. * * from: send_to_kdc.c,v 4.20 90/01/02 13:40:37 jtkohl Exp $ - * $Id: send_to_kdc.c,v 1.1.1.1 1994/09/30 14:50:03 csgr Exp $ + * $Id: send_to_kdc.c,v 1.2 1995/01/25 05:40:00 gibbs Exp $ */ #ifndef lint @@ -121,7 +121,6 @@ send_to_kdc(pkt,rpkt,realm) hostlist = (struct hostent *) malloc(sizeof(struct hostent)); if (!hostlist) return (/*errno */SKDC_CANT); - bzero(hostlist, sizeof(struct hostent)); if ((f = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { if (krb_debug) fprintf(stderr,"%s: Can't open socket\n", prog); @@ -214,17 +213,19 @@ send_to_kdc(pkt,rpkt,realm) rtn: (void) close(f); if (hostlist) { - register struct hostent *hp; - for (hp = hostlist; hp->h_name; hp++) + if(!no_host) { + register struct hostent *hp; + for (hp = hostlist; hp->h_name; hp++) #if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40)) - if (hp->h_addr_list) { + if (hp->h_addr_list) { #endif /* ULTRIX022 || SunOS */ - if (hp->h_addr) - free(hp->h_addr); + if (hp->h_addr) + free(hp->h_addr); #if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40)) - free((char *)hp->h_addr_list); - } + free((char *)hp->h_addr_list); + } #endif /* ULTRIX022 || SunOS */ + } free((char *)hostlist); } return(retval); diff --git a/eBones/lib/libkrb/send_to_kdc.c b/eBones/lib/libkrb/send_to_kdc.c index 15e4220..59349c7 100644 --- a/eBones/lib/libkrb/send_to_kdc.c +++ b/eBones/lib/libkrb/send_to_kdc.c @@ -4,7 +4,7 @@ * <Copyright.MIT>. * * from: send_to_kdc.c,v 4.20 90/01/02 13:40:37 jtkohl Exp $ - * $Id: send_to_kdc.c,v 1.1.1.1 1994/09/30 14:50:03 csgr Exp $ + * $Id: send_to_kdc.c,v 1.2 1995/01/25 05:40:00 gibbs Exp $ */ #ifndef lint @@ -121,7 +121,6 @@ send_to_kdc(pkt,rpkt,realm) hostlist = (struct hostent *) malloc(sizeof(struct hostent)); if (!hostlist) return (/*errno */SKDC_CANT); - bzero(hostlist, sizeof(struct hostent)); if ((f = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { if (krb_debug) fprintf(stderr,"%s: Can't open socket\n", prog); @@ -214,17 +213,19 @@ send_to_kdc(pkt,rpkt,realm) rtn: (void) close(f); if (hostlist) { - register struct hostent *hp; - for (hp = hostlist; hp->h_name; hp++) + if(!no_host) { + register struct hostent *hp; + for (hp = hostlist; hp->h_name; hp++) #if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40)) - if (hp->h_addr_list) { + if (hp->h_addr_list) { #endif /* ULTRIX022 || SunOS */ - if (hp->h_addr) - free(hp->h_addr); + if (hp->h_addr) + free(hp->h_addr); #if !(defined(ULTRIX022) || (defined(SunOS) && SunOS < 40)) - free((char *)hp->h_addr_list); - } + free((char *)hp->h_addr_list); + } #endif /* ULTRIX022 || SunOS */ + } free((char *)hostlist); } return(retval); |