(krb5_get_host_realm): do the name2name thing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2433 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -64,6 +64,8 @@ krb5_get_host_realm(krb5_context context,
|
||||
char *res = NULL;
|
||||
const char *partial = NULL;
|
||||
const krb5_config_binding *l;
|
||||
struct in_addr addr;
|
||||
struct hostent *hostent;
|
||||
|
||||
if (host == NULL) {
|
||||
if (gethostname (hostname, sizeof(hostname)))
|
||||
@@ -71,6 +73,13 @@ krb5_get_host_realm(krb5_context context,
|
||||
host = hostname;
|
||||
}
|
||||
|
||||
addr.s_addr = inet_addr(host);
|
||||
hostent = gethostbyname (host);
|
||||
if (hostent == NULL && addr.s_addr != INADDR_NONE)
|
||||
hostent = gethostbyaddr ((const char *)&addr, sizeof(addr), AF_INET);
|
||||
if (hostent != NULL)
|
||||
host = hostent->h_addr;
|
||||
|
||||
*realms = malloc(2 * sizeof(char*));
|
||||
if (*realms == NULL)
|
||||
return ENOMEM;
|
||||
|
Reference in New Issue
Block a user