diff options
author | bubulle <bubulle@alioth.debian.org> | 2012-06-26 14:48:20 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2012-06-26 14:48:20 +0000 |
commit | 375adb21660d080bbbef4c83e913371f1861e7a9 (patch) | |
tree | 226296e3074931e9fdeae114a64d3c0a472ddbf0 /nsswitch/winbind_krb5_locator.c | |
parent | ca664f15672b7f3fca7d1eb1beaabab5b9b81f27 (diff) | |
download | samba-375adb21660d080bbbef4c83e913371f1861e7a9.tar.gz |
merge upstream 3.6.6
git-svn-id: svn://svn.debian.org/svn/pkg-samba/trunk/samba@4136 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'nsswitch/winbind_krb5_locator.c')
-rw-r--r-- | nsswitch/winbind_krb5_locator.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/nsswitch/winbind_krb5_locator.c b/nsswitch/winbind_krb5_locator.c index e921caea59..385a156b94 100644 --- a/nsswitch/winbind_krb5_locator.c +++ b/nsswitch/winbind_krb5_locator.c @@ -182,7 +182,8 @@ static krb5_error_code smb_krb5_locator_call_cbfunc(const char *name, void *cbdata) { struct addrinfo *out = NULL; - int ret; + int ret = 0; + struct addrinfo *res = NULL; int count = 3; while (count) { @@ -206,16 +207,25 @@ static krb5_error_code smb_krb5_locator_call_cbfunc(const char *name, return KRB5_PLUGIN_NO_HANDLE; } - ret = cbfunc(cbdata, out->ai_socktype, out->ai_addr); + for (res = out; res; res = res->ai_next) { + if (!res->ai_addr || res->ai_addrlen == 0) { + continue; + } + + ret = cbfunc(cbdata, res->ai_socktype, res->ai_addr); + if (ret) { #ifdef DEBUG_KRB5 - if (ret) { - fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: " - "failed to call callback: %s (%d)\n", - (unsigned int)getpid(), error_message(ret), ret); - } + fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: " + "failed to call callback: %s (%d)\n", + (unsigned int)getpid(), error_message(ret), ret); #endif + break; + } + } - freeaddrinfo(out); + if (out) { + freeaddrinfo(out); + } return ret; } @@ -257,8 +267,7 @@ static bool ask_winbind(const char *realm, char **dcname) flags = WBC_LOOKUP_DC_KDC_REQUIRED | WBC_LOOKUP_DC_IS_DNS_NAME | - WBC_LOOKUP_DC_RETURN_DNS_NAME | - WBC_LOOKUP_DC_IP_REQUIRED; + WBC_LOOKUP_DC_RETURN_DNS_NAME; wbc_status = wbcLookupDomainControllerEx(realm, NULL, NULL, flags, &dc_info); @@ -270,12 +279,6 @@ static bool ask_winbind(const char *realm, char **dcname) return false; } - if (dc_info->dc_address) { - dc = dc_info->dc_address; - if (dc[0] == '\\') dc++; - if (dc[0] == '\\') dc++; - } - if (!dc && dc_info->dc_unc) { dc = dc_info->dc_unc; if (dc[0] == '\\') dc++; |