diff options
author | Zhanna Tsitkov <tsitkova@mit.edu> | 2010-01-04 06:22:41 +0000 |
---|---|---|
committer | Zhanna Tsitkov <tsitkova@mit.edu> | 2010-01-04 06:22:41 +0000 |
commit | 0032360557cdac7a52615a19c0533d59dd289d33 (patch) | |
tree | 60e6f070e4ca5c4438f4fe441b6d927c8bb4e95e /src/lib/krb5/os | |
parent | e056821a27bed3f3794631747f222b50be06ffe8 (diff) | |
download | krb5-0032360557cdac7a52615a19c0533d59dd289d33.tar.gz krb5-0032360557cdac7a52615a19c0533d59dd289d33.tar.xz krb5-0032360557cdac7a52615a19c0533d59dd289d33.zip |
For the better code modularity keep some "free" routines closer to the resource allocators. Also, reindent cleanup in the touched files
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23576 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/os')
-rw-r--r-- | src/lib/krb5/os/Makefile.in | 3 | ||||
-rw-r--r-- | src/lib/krb5/os/free_hstrl.c | 43 | ||||
-rw-r--r-- | src/lib/krb5/os/hst_realm.c | 28 |
3 files changed, 22 insertions, 52 deletions
diff --git a/src/lib/krb5/os/Makefile.in b/src/lib/krb5/os/Makefile.in index 5a81302370..6a1ffd13fd 100644 --- a/src/lib/krb5/os/Makefile.in +++ b/src/lib/krb5/os/Makefile.in @@ -21,7 +21,6 @@ STLIBOBJS= \ dnsglue.o \ dnssrv.o \ free_krbhs.o \ - free_hstrl.o \ full_ipadr.o \ get_krbhst.o \ gen_port.o \ @@ -65,7 +64,6 @@ OBJS= \ $(OUTPRE)dnsglue.$(OBJEXT) \ $(OUTPRE)dnssrv.$(OBJEXT) \ $(OUTPRE)free_krbhs.$(OBJEXT) \ - $(OUTPRE)free_hstrl.$(OBJEXT) \ $(OUTPRE)full_ipadr.$(OBJEXT) \ $(OUTPRE)get_krbhst.$(OBJEXT) \ $(OUTPRE)gen_port.$(OBJEXT) \ @@ -109,7 +107,6 @@ SRCS= \ $(srcdir)/dnsglue.c \ $(srcdir)/dnssrv.c \ $(srcdir)/free_krbhs.c \ - $(srcdir)/free_hstrl.c \ $(srcdir)/full_ipadr.c \ $(srcdir)/get_krbhst.c \ $(srcdir)/gen_port.c \ diff --git a/src/lib/krb5/os/free_hstrl.c b/src/lib/krb5/os/free_hstrl.c deleted file mode 100644 index 58222a6df8..0000000000 --- a/src/lib/krb5/os/free_hstrl.c +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - * lib/krb5/os/free_hstrl.c - * - * Copyright 1990 by the Massachusetts Institute of Technology. - * All Rights Reserved. - * - * 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. Furthermore if you modify this software you must label - * your software as modified software and not distribute it in such a - * fashion that it might be confused with the original M.I.T. software. - * 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_host_realm() - */ - -#include "k5-int.h" -#include <stdio.h> - -/* - Frees the storage taken by a realm list returned by krb5_get_host_realm. -*/ - -krb5_error_code KRB5_CALLCONV -krb5_free_host_realm(krb5_context context, char *const *realmlist) -{ - /* same format, so why duplicate code? */ - return krb5_free_krbhst(context, realmlist); -} diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c index 23c7893b62..96a022f4df 100644 --- a/src/lib/krb5/os/hst_realm.c +++ b/src/lib/krb5/os/hst_realm.c @@ -2,7 +2,7 @@ /* * lib/krb5/os/hst_realm.c * - * Copyright 1990,1991,2002,2008 by the Massachusetts Institute of Technology. + * Copyright 1990,1991,2002,2008,2009 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -26,6 +26,9 @@ * * * krb5_get_host_realm() + * krb5_get_fallback_host_realm() + * krb5int_clean_hostname() + * krb5_free_host_realm() */ @@ -94,7 +97,7 @@ domain_heuristic(krb5_context context, const char *domain, krb5_error_code krb5int_translate_gai_error (int); static krb5_error_code -krb5int_get_fq_hostname (char *buf, size_t bufsize, const char *name) +get_fq_hostname(char *buf, size_t bufsize, const char *name) { struct addrinfo *ai, hints; int err; @@ -116,13 +119,13 @@ krb5int_get_fq_hostname (char *buf, size_t bufsize, const char *name) Always return a null-terminated string. Might return an error if gethostname fails. */ krb5_error_code -krb5int_get_fq_local_hostname (char *buf, size_t bufsiz) +krb5int_get_fq_local_hostname(char *buf, size_t bufsiz) { buf[0] = 0; if (gethostname (buf, bufsiz) == -1) return SOCKET_ERRNO; buf[bufsiz - 1] = 0; - return krb5int_get_fq_hostname (buf, bufsiz, buf); + return get_fq_hostname (buf, bufsiz, buf); } krb5_error_code KRB5_CALLCONV @@ -266,7 +269,8 @@ krb5int_translate_gai_error (int num) */ krb5_error_code KRB5_CALLCONV -krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***realmsp) +krb5_get_fallback_host_realm(krb5_context context, + krb5_data *hdata, char ***realmsp) { char **retrealms; char *realm, *cp; @@ -368,7 +372,8 @@ krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***rea * to do basic sanity checks on supplied hostname. */ krb5_error_code KRB5_CALLCONV -krb5int_clean_hostname(krb5_context context, const char *host, char *local_host, size_t lhsize) +krb5int_clean_hostname(krb5_context context, + const char *host, char *local_host, size_t lhsize) { char *cp; krb5_error_code retval; @@ -492,3 +497,14 @@ cleanup: free(fqdn); return retval; } + +/* + * Frees the storage taken by a realm list returned by krb5_get_host_realm. + */ + +krb5_error_code KRB5_CALLCONV +krb5_free_host_realm(krb5_context context, char *const *realmlist) +{ + /* same format, so why duplicate code? */ + return krb5_free_krbhst(context, realmlist); +} |