From: Greg Hudson Date: Wed, 24 Dec 2008 18:48:00 +0000 (+0000) Subject: Clean up krb5_get_fallback_host_realm in two respects: X-Git-Tag: krb5-1.7-alpha1~137 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9ad56f7a109d43aed52f17f98434105f6dcfd2cf;p=krb5.git Clean up krb5_get_fallback_host_realm in two respects: 1. It isn't exported from libkrb5 (and no one seems to complain about that). So give it a krb5int_ name and move its declaration to k5-int.h. Also stop exporting it from the collected client lib. 2. It returned a list of realms, but its only caller assumes that the list contains exactly one realm. So just make it return a single realm. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21589 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/k5-int.h b/src/include/k5-int.h index 883de3e18..611bddff8 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -538,6 +538,10 @@ krb5int_locate_server (krb5_context, const krb5_data *realm, struct addrlist *, enum locate_service_type svc, int sockettype, int family); +krb5_error_code +krb5int_get_fallback_host_realm (krb5_context, krb5_data *hdata, + char **realmp); + /* new encryption provider api */ struct krb5_enc_provider { diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index accde60fc..4848178d0 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -2099,10 +2099,6 @@ krb5_error_code KRB5_CALLCONV krb5_get_host_realm (krb5_context, const char *, char *** ); -krb5_error_code KRB5_CALLCONV krb5_get_fallback_host_realm - (krb5_context, - krb5_data *, - char *** ); krb5_error_code KRB5_CALLCONV krb5_free_host_realm (krb5_context, char * const * ); diff --git a/src/lib/krb5/krb/gc_frm_kdc.c b/src/lib/krb5/krb/gc_frm_kdc.c index 90a49d6a6..801ea9f8a 100644 --- a/src/lib/krb5/krb/gc_frm_kdc.c +++ b/src/lib/krb5/krb/gc_frm_kdc.c @@ -787,7 +787,7 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache, krb5_principal client, server, supplied_server, out_supplied_server; krb5_creds tgtq, cc_tgt, *tgtptr, *referral_tgts[KRB5_REFERRAL_MAXHOPS]; krb5_boolean old_use_conf_ktypes; - char **hrealms; + char *hrealm; unsigned int referral_count, i; /* @@ -1021,23 +1021,22 @@ krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache, */ if (krb5_is_referral_realm(&supplied_server->realm)) { if (server->length >= 2) { - retval=krb5_get_fallback_host_realm(context, &server->data[1], - &hrealms); + retval=krb5int_get_fallback_host_realm(context, &server->data[1], + &hrealm); if (retval) goto cleanup; #if 0 DPRINTF(("gc_from_kdc: using fallback realm of %s\n", - hrealms[0])); + hrealm)); #endif krb5_free_data_contents(context,&in_cred->server->realm); - server->realm.data=hrealms[0]; - server->realm.length=strlen(hrealms[0]); - free(hrealms); + server->realm.data=hrealm; + server->realm.length=strlen(hrealm); } else { /* * Problem case: Realm tagged for referral but apparently not * in a / format that - * krb5_get_fallback_host_realm can deal with. + * krb5int_get_fallback_host_realm can deal with. */ DPRINTF(("gc_from_kdc: referral specified " "but no fallback realm avaiable!\n")); diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c index 36c0e4860..a97ca6d98 100644 --- a/src/lib/krb5/os/hst_realm.c +++ b/src/lib/krb5/os/hst_realm.c @@ -335,9 +335,9 @@ krb5int_translate_gai_error (int num) */ krb5_error_code KRB5_CALLCONV -krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***realmsp) +krb5int_get_fallback_host_realm(krb5_context context, krb5_data *hdata, + char **realmp) { - char **retrealms; char *realm, *cp; krb5_error_code retval; char local_host[MAXDNAME+1], host[MAXDNAME+1]; @@ -417,16 +417,7 @@ krb5_get_fallback_host_realm(krb5_context context, krb5_data *hdata, char ***rea return retval; } - if (!(retrealms = (char **)calloc(2, sizeof(*retrealms)))) { - if (realm != (char *)NULL) - free(realm); - return ENOMEM; - } - - retrealms[0] = realm; - retrealms[1] = 0; - - *realmsp = retrealms; + *realmp = realm; return 0; } diff --git a/src/util/collected-client-lib/libcollected.exports b/src/util/collected-client-lib/libcollected.exports index fb91133fb..8c124d186 100644 --- a/src/util/collected-client-lib/libcollected.exports +++ b/src/util/collected-client-lib/libcollected.exports @@ -177,7 +177,6 @@ krb5_auth_con_getauthenticator krb5_read_password krb5_aname_to_localname krb5_get_host_realm -krb5_get_fallback_host_realm krb5_free_host_realm krb5_auth_con_genaddrs krb5_set_real_time