summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-10-19 16:54:37 +0200
committerGünther Deschner <gd@samba.org>2009-10-19 18:44:51 +0200
commit10bd52184959335d779aae52f9178c0441c70da9 (patch)
tree0a47ba4a9b344d9205921da9472e859b54a7f388
parent110a40d4bc043d2bb2316480e6ba66ece1bf04ad (diff)
downloadsamba-10bd52184959335d779aae52f9178c0441c70da9.tar.gz
samba-10bd52184959335d779aae52f9178c0441c70da9.tar.bz2
samba-10bd52184959335d779aae52f9178c0441c70da9.zip
wbinfo: use wbcLookupDomainControllerEx for wbinfo --dsgetdcname.
Guenther
-rw-r--r--nsswitch/wbinfo.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 219ec24fba..d3d9250e81 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;
}