summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/os/hst_realm.c
diff options
context:
space:
mode:
authorDanilo Almeida <dalmeida@mit.edu>1999-08-05 20:37:18 +0000
committerDanilo Almeida <dalmeida@mit.edu>1999-08-05 20:37:18 +0000
commit300ef32ed9238d8728b427a0379cfc685f247e7f (patch)
tree68a734c09c0cdeb9f266cb00a07fa0eb3889fd2a /src/lib/krb5/os/hst_realm.c
parentfb112355a2d57fffc76e66437083f9c6261acfd1 (diff)
downloadkrb5-300ef32ed9238d8728b427a0379cfc685f247e7f.tar.gz
krb5-300ef32ed9238d8728b427a0379cfc685f247e7f.tar.xz
krb5-300ef32ed9238d8728b427a0379cfc685f247e7f.zip
* t_std_conf.c (test_get_krbhst): Use krb5_free_krbhst to
free buffers allocated by krb5_get_krbhst. * locate_kdc.c (_krb5_use_dns): Add _krb_use_dns to abstract away looking up of whether we use DNS or not in the profile. * ktdefname.c (krb5_kt_default_name): Use profile_release_string instead of free to free string allocated by profile_get_string. * get_krbhst.c (krb5_get_krbhst): Copy results from profile_get_values into malloc'ed buffers so we can safely free them later. Also call profile_free_list on the original values. * locate_kdc.c (krb5_locate_kdc): * hst_realm.c (krb5_get_host_realm): * def_realm.c (krb5_get_default_realm): Use _krb5_use_dns to figure out whether to use DNS or not instead of directly reading the profile in this routine. * realm_dom.c (krb5_get_realm_domain): * hst_realm.c (krb5_get_host_realm): * def_realm.c (krb5_get_default_realm): Copy results of profile_get_string into malloc'ed buffer so it can safely be free'd later. * locate_kdc.c (krb5_locate_srv_conf): * def_realm.c (krb5_get_default_realm): * changepw.c (krb5_change_password): * an_to_ln.c (krb5_aname_to_localname): Use profile_free_list to free values allocated by profile_get_values. * init_os_ctx.c (os_init_paths): Wrap use of ctx->profile_in_memory with KRB5_DNS_LOOKUP. Use pointer value to determine whether to free files by checking the files value rather than depending on the return value. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11626 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/os/hst_realm.c')
-rw-r--r--src/lib/krb5/os/hst_realm.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c
index 3bd766ea58..bda5e3706f 100644
--- a/src/lib/krb5/os/hst_realm.c
+++ b/src/lib/krb5/os/hst_realm.c
@@ -230,7 +230,7 @@ krb5_get_host_realm(context, host, realmsp)
char FAR * FAR * FAR *realmsp;
{
char **retrealms;
- char *default_realm, *realm, *cp;
+ char *default_realm, *realm, *cp, *temp_realm;
krb5_error_code retval;
int l;
char local_host[MAX_DNS_NAMELEN+1];
@@ -265,12 +265,13 @@ krb5_get_host_realm(context, host, realmsp)
cp = local_host;
realm = default_realm = (char *)NULL;
+ temp_realm = 0;
while (cp) {
retval = profile_get_string(context->profile, "domain_realm", cp,
- 0, (char *)NULL, &realm);
+ 0, (char *)NULL, &temp_realm);
if (retval)
return retval;
- if (realm != (char *)NULL)
+ if (temp_realm != (char *)NULL)
break; /* Match found */
/* Setup for another test */
@@ -284,24 +285,19 @@ krb5_get_host_realm(context, host, realmsp)
cp = strchr(cp, '.');
}
}
+ if (temp_realm) {
+ realm = malloc(strlen(temp_realm) + 1);
+ if (!realm) {
+ profile_release_string(temp_realm);
+ return ENOMEM;
+ }
+ strcpy(realm, temp_realm);
+ profile_release_string(temp_realm);
+ }
#ifdef KRB5_DNS_LOOKUP
if (realm == (char *)NULL) {
- int use_dns=0;
- char * string=NULL;
- krb5_error_code retval2;
-
- retval2 = profile_get_string(context->profile, "libdefaults",
- "dns_fallback", 0,
- context->profile_in_memory?"1":"0",
- &string);
- if ( retval2 )
- return(retval2);
-
- if ( string ) {
- use_dns = krb5_conf_boolean(string);
- free(string);
- }
+ int use_dns = _krb5_use_dns(context);
if ( use_dns ) {
/*
* Since this didn't appear in our config file, try looking