From: Ken Raeburn Date: Thu, 2 Sep 1999 21:39:46 +0000 (+0000) Subject: from 1.1 branch X-Git-Tag: krb5-1.2-beta1~248 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1b959a62b436e61749986a520378bba642d1f57b;p=krb5.git from 1.1 branch 1999-09-01 Danilo Almeida * kuserok.c (krb5_kuserok): Fix improper negation in non-Unix localname check. Also fix calling convention before this function is exported by the Windows DLL. * localaddr.c (krb5_os_localaddr): Fix memset to clear right address list. (Thanks to jaltman@columbia.edu). 1999-09-01 Ken Raeburn * get_krbhst.c (krb5_get_krbhst): Fix double-indirection confusion. Do actually copy string contents to newly allocated storage. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11780 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index fdb179830..8cc5848e7 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,18 @@ +1999-09-01 Danilo Almeida + + * kuserok.c (krb5_kuserok): Fix improper negation in + non-Unix localname check. Also fix calling convention + before this function is exported by the Windows DLL. + + * localaddr.c (krb5_os_localaddr): Fix memset to clear + right address list. (Thanks to jaltman@columbia.edu). + +1999-09-01 Ken Raeburn + + * get_krbhst.c (krb5_get_krbhst): Fix double-indirection + confusion. Do actually copy string contents to newly allocated + storage. + 1999-08-21 Danilo Almeida * localaddr.c (krb5_os_localaddr): Use multiple addresses, if diff --git a/src/lib/krb5/os/get_krbhst.c b/src/lib/krb5/os/get_krbhst.c index c929bbaba..be2f3f934 100644 --- a/src/lib/krb5/os/get_krbhst.c +++ b/src/lib/krb5/os/get_krbhst.c @@ -64,8 +64,9 @@ krb5_get_krbhst(context, realm, hostlist) const char *realm_kdc_names[4]; krb5_error_code retval; int i, count; + char **rethosts; - *hostlist = 0; + rethosts = 0; realm_kdc_names[0] = "realms"; realm_kdc_names[1] = realm->data; @@ -99,25 +100,29 @@ krb5_get_krbhst(context, realm, hostlist) *cp = 0; } count = cpp - values; - *hostlist = malloc(sizeof(char *) * (count + 1)); - if (!*hostlist) { + rethosts = malloc(sizeof(char *) * (count + 1)); + if (!rethosts) { retval = ENOMEM; goto cleanup; } for (i = 0; i < count; i++) { - *hostlist[i] = malloc(strlen(values[i]) + 1); - if (!*hostlist[i]) { + int len = strlen (values[i]) + 1; + rethosts[i] = malloc(len); + if (!rethosts[i]) { retval = ENOMEM; goto cleanup; } + memcpy (rethosts[i], values[i], len); } - *hostlist[count] = 0; + rethosts[count] = 0; cleanup: - if (retval && *hostlist) { - for (cpp = *hostlist; *cpp; cpp++) + if (retval && rethosts) { + for (cpp = rethosts; *cpp; cpp++) free(*cpp); - free(*hostlist); + free(rethosts); + rethosts = 0; } profile_free_list(values); + *hostlist = rethosts; return retval; } diff --git a/src/lib/krb5/os/kuserok.c b/src/lib/krb5/os/kuserok.c index 6d3032e8e..eff6154fd 100644 --- a/src/lib/krb5/os/kuserok.c +++ b/src/lib/krb5/os/kuserok.c @@ -56,7 +56,7 @@ * */ -krb5_boolean +krb5_boolean KRB5_CALLCONV krb5_kuserok(context, principal, luser) krb5_context context; krb5_principal principal; @@ -143,7 +143,7 @@ krb5_kuserok(context, principal, luser) * If the given Kerberos name "server" translates to the same name as "luser" * (using * krb5_aname_to_lname()), returns TRUE. */ -krb5_boolean +krb5_boolean KRB5_CALLCONV krb5_kuserok(context, principal, luser) krb5_context context; krb5_principal principal; @@ -151,7 +151,7 @@ krb5_kuserok(context, principal, luser) { char kuser[50]; - if (! krb5_aname_to_localname(context, principal, sizeof(kuser), kuser)) + if (krb5_aname_to_localname(context, principal, sizeof(kuser), kuser)) return FALSE; if (strcmp(kuser, luser) == 0) diff --git a/src/lib/krb5/os/localaddr.c b/src/lib/krb5/os/localaddr.c index 9b64ad19b..82bcc4681 100644 --- a/src/lib/krb5/os/localaddr.c +++ b/src/lib/krb5/os/localaddr.c @@ -327,7 +327,7 @@ krb5_os_localaddr (krb5_context context, krb5_address ***addr) { goto cleanup; } - memset(addr, 0, sizeof(krb5_address *) * (count+1)); + memset(paddr, 0, sizeof(krb5_address *) * (count+1)); for (i = 0; i < count; i++) {