[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Mon Oct 19 10:45:42 MDT 2009


The branch, master has been updated
       via  10bd521... wbinfo: use wbcLookupDomainControllerEx for wbinfo --dsgetdcname.
       via  110a40d... libwbclient: fix wbcLookupDomainController().
       via  71cfbf9... s4-smbtorture: test wbcLookupDomainController{Ex} in WINBIND-WBCLIENT.
       via  dbd0399... gitignore: remove old netlogon prototypes.
      from  abeb794... s4:torture "cldap" test - restore the removed constraints and add more

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 10bd52184959335d779aae52f9178c0441c70da9
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 19 16:54:37 2009 +0200

    wbinfo: use wbcLookupDomainControllerEx for wbinfo --dsgetdcname.
    
    Guenther

commit 110a40d4bc043d2bb2316480e6ba66ece1bf04ad
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 19 16:55:15 2009 +0200

    libwbclient: fix wbcLookupDomainController().
    
    Found by WINBIND-WBCLIENT torture test.
    
    Guenther

commit 71cfbf958cbb26dcc050bab9fd05b38556128d4f
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 16 13:39:24 2009 +0200

    s4-smbtorture: test wbcLookupDomainController{Ex} in WINBIND-WBCLIENT.
    
    Guenther

commit dbd03997e1af1e659507b1142f29d0463e8ad295
Author: Günther Deschner <gd at samba.org>
Date:   Mon Oct 19 18:41:15 2009 +0200

    gitignore: remove old netlogon prototypes.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                            |    2 -
 nsswitch/libwbclient/tests/wbclient.c |   37 ++++++++++++++++++++++++++++
 nsswitch/libwbclient/wbc_util.c       |    5 ++-
 nsswitch/wbinfo.c                     |   43 +++++++++++++-------------------
 4 files changed, 58 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitignore b/.gitignore
index 1d6420a..3a752f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -193,8 +193,6 @@ source4/libcli/libcli_proto.h
 libcli/nbt/nbtname.h
 libcli/smb/smb_common_proto.h
 source4/libcli/nbt/nbt_proto.h
-source4/libcli/ndr_netlogon_proto.h
-source4/libcli/netlogon_proto.h
 source4/libcli/raw/raw_proto.h
 source4/libcli/resolve/lp_proto.h
 source4/libcli/resolve/proto.h
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 5a55a43..23fad63 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -268,6 +268,41 @@ static bool test_wbc_trusts(struct torture_context *tctx)
 	return true;
 }
 
+static bool test_wbc_lookupdc(struct torture_context *tctx)
+{
+	const char *domain_name = NULL;
+	struct wbcInterfaceDetails *details;
+	struct wbcDomainControllerInfo *dc_info;
+
+	torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
+		"wbcInterfaceDetails failed");
+
+	domain_name = talloc_strdup(tctx, details->netbios_domain);
+	wbcFreeMemory(details);
+
+	torture_assert_wbc_ok(tctx, wbcLookupDomainController(domain_name, 0, &dc_info),
+		"wbcLookupDomainController failed");
+
+	return true;
+}
+
+static bool test_wbc_lookupdcex(struct torture_context *tctx)
+{
+	const char *domain_name = NULL;
+	struct wbcInterfaceDetails *details;
+	struct wbcDomainControllerInfoEx *dc_info;
+
+	torture_assert_wbc_ok(tctx, wbcInterfaceDetails(&details),
+		"wbcInterfaceDetails failed");
+
+	domain_name = talloc_strdup(tctx, details->netbios_domain);
+	wbcFreeMemory(details);
+
+	torture_assert_wbc_ok(tctx, wbcLookupDomainControllerEx(domain_name, NULL, NULL, 0, &dc_info),
+		"wbcLookupDomainControllerEx failed");
+
+	return true;
+}
 
 
 struct torture_suite *torture_wbclient(void)
@@ -284,6 +319,8 @@ struct torture_suite *torture_wbclient(void)
 	torture_suite_add_simple_test(suite, "wbcListUsers", test_wbc_users);
 	torture_suite_add_simple_test(suite, "wbcListGroups", test_wbc_groups);
 	torture_suite_add_simple_test(suite, "wbcListTrusts", test_wbc_trusts);
+	torture_suite_add_simple_test(suite, "wbcLookupDomainController", test_wbc_lookupdc);
+	torture_suite_add_simple_test(suite, "wbcLookupDomainControllerEx", test_wbc_lookupdcex);
 
 	return suite;
 }
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c
index 24b5922..16828ae 100644
--- a/nsswitch/libwbclient/wbc_util.c
+++ b/nsswitch/libwbclient/wbc_util.c
@@ -486,7 +486,8 @@ wbcErr wbcLookupDomainController(const char *domain,
 	ZERO_STRUCT(request);
 	ZERO_STRUCT(response);
 
-	strncpy(request.domain_name, domain, sizeof(request.domain_name)-1);
+	strncpy(request.data.dsgetdcname.domain_name, domain,
+		sizeof(request.data.dsgetdcname.domain_name)-1);
 
 	request.flags = flags;
 
@@ -500,7 +501,7 @@ wbcErr wbcLookupDomainController(const char *domain,
 					&response);
 	BAIL_ON_WBC_ERROR(wbc_status);
 
-	dc->dc_name = talloc_strdup(dc, response.data.dc_name);
+	dc->dc_name = talloc_strdup(dc, response.data.dsgetdcname.dc_unc);
 	BAIL_ON_PTR_ERROR(dc->dc_name, wbc_status);
 
 	*dc_info = dc;
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 219ec24..d3d9250 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;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list