summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-10-19 16:54:37 +0200
committerKarolin Seeger <kseeger@samba.org>2009-11-26 11:39:35 +0100
commitaca7c592de3b3580e8072dd96d09ddeee4d09095 (patch)
treed9a03748e0e9dd95baf4b4f1e4976cb73d044ea3 /nsswitch
parentdd397285472dbbe3363cdf1a031e4c0fe9ccfa55 (diff)
downloadsamba-aca7c592de3b3580e8072dd96d09ddeee4d09095.tar.gz
wbinfo: use wbcLookupDomainControllerEx for wbinfo --dsgetdcname.
Guenther (cherry picked from commit 10bd52184959335d779aae52f9178c0441c70da9) (cherry picked from commit a63fb1555646dbfbcc993fc298aa4b51bee77eed)
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/wbinfo.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 219ec24fbaa..d3d9250e81f 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -688,36 +688,29 @@ static bool wbinfo_getdcname(const char *domain_name)
/* Find a DC */
static bool wbinfo_dsgetdcname(const char *domain_name, uint32_t flags)
{
- struct winbindd_request request;
- struct winbindd_response response;
-
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
-
- fstrcpy(request.data.dsgetdcname.domain_name, domain_name);
- request.data.dsgetdcname.flags = flags;
-
- request.flags |= DS_DIRECTORY_SERVICE_REQUIRED;
-
- /* Send request */
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct wbcDomainControllerInfoEx *dc_info;
+ char *str = NULL;
- if (winbindd_request_response(WINBINDD_DSGETDCNAME, &request,
- &response) != NSS_STATUS_SUCCESS) {
- d_fprintf(stderr, "Could not find dc for %s\n", domain_name);
+ wbc_status = wbcLookupDomainControllerEx(domain_name, NULL, NULL,
+ flags | DS_DIRECTORY_SERVICE_REQUIRED,
+ &dc_info);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ printf("Could not find dc for %s\n", domain_name);
return false;
}
- /* Display response */
+ wbcGuidToString(dc_info->domain_guid, &str);
- d_printf("%s\n", response.data.dsgetdcname.dc_unc);
- d_printf("%s\n", response.data.dsgetdcname.dc_address);
- d_printf("%d\n", response.data.dsgetdcname.dc_address_type);
- d_printf("%s\n", response.data.dsgetdcname.domain_guid);
- d_printf("%s\n", response.data.dsgetdcname.domain_name);
- d_printf("%s\n", response.data.dsgetdcname.forest_name);
- d_printf("0x%08x\n", response.data.dsgetdcname.dc_flags);
- d_printf("%s\n", response.data.dsgetdcname.dc_site_name);
- d_printf("%s\n", response.data.dsgetdcname.client_site_name);
+ d_printf("%s\n", dc_info->dc_unc);
+ d_printf("%s\n", dc_info->dc_address);
+ d_printf("%d\n", dc_info->dc_address_type);
+ d_printf("%s\n", str);
+ d_printf("%s\n", dc_info->domain_name);
+ d_printf("%s\n", dc_info->forest_name);
+ d_printf("0x%08x\n", dc_info->dc_flags);
+ d_printf("%s\n", dc_info->dc_site_name);
+ d_printf("%s\n", dc_info->client_site_name);
return true;
}