krb5_sname_to_principal fix from Luke Howard <lukeh@xedoc.com.au>

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3036 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-08-16 23:39:04 +00:00
parent 9419ca2356
commit 6079dab507

View File

@@ -635,19 +635,19 @@ krb5_sname_to_principal (krb5_context context,
if(hp != NULL) if(hp != NULL)
hostname = hp->h_name; hostname = hp->h_name;
} }
ret = krb5_get_host_realm(context, hostname, &realms);
if(ret)
return ret;
if(type == KRB5_NT_SRV_HST){ if(type == KRB5_NT_SRV_HST){
host = strdup(hostname); host = strdup(hostname);
if(host == NULL){ if(host == NULL){
krb5_free_host_realm(context, realms);
return ENOMEM; return ENOMEM;
} }
strlwr(host); strlwr(host);
hostname = host; hostname = host;
} }
ret = krb5_make_principal(context, ret_princ, realms[0], sname, hostname, NULL); ret = krb5_get_host_realm(context, hostname, &realms);
if(ret)
return ret;
ret = krb5_make_principal(context, ret_princ, realms[0], sname,
hostname, NULL);
if(host) if(host)
free(host); free(host);
krb5_free_host_realm(context, realms); krb5_free_host_realm(context, realms);