[SCM] Samba Shared Repository - branch master updated - 83f55e07557579cd0b9fe3972947fb2327990014

Günther Deschner gd at samba.org
Fri Oct 10 09:28:10 GMT 2008


The branch, master has been updated
       via  83f55e07557579cd0b9fe3972947fb2327990014 (commit)
      from  10f65cc4ca5a48b6f4dc8c4de23e59628b6f95b2 (commit)

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


- Log -----------------------------------------------------------------
commit 83f55e07557579cd0b9fe3972947fb2327990014
Author: Günther Deschner <gd at samba.org>
Date:   Tue Oct 7 18:54:08 2008 +0200

    krb5_locator: use wbcLookupDomainControllerEx() for query.
    
    Guenther

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

Summary of changes:
 source3/Makefile.in                     |    6 ++--
 source3/nsswitch/winbind_krb5_locator.c |   39 ++++++++++++++----------------
 2 files changed, 21 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 175dcb3..3ef197b 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1078,7 +1078,7 @@ LDBDEL_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbdel.o
 LDBMODIFY_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbmodify.o
 
 WINBIND_KRB5_LOCATOR_OBJ1 = nsswitch/winbind_krb5_locator.o
-WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ)
+WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(LIBREPLACE_OBJ)
 
 POPT_OBJ=../lib/popt/findme.o ../lib/popt/popt.o ../lib/popt/poptconfig.o \
           ../lib/popt/popthelp.o ../lib/popt/poptparse.o
@@ -2177,9 +2177,9 @@ bin/vlp at EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
 		$(LDAP_LIBS) $(KRB5LIBS) $(LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
 		@SONAMEFLAG@`basename $@`@NSSSONAMEVERSIONSUFFIX@
 
-bin/winbind_krb5_locator. at SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ)
+bin/winbind_krb5_locator. at SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ) @LIBWBCLIENT_SHARED@
 	@echo "Linking $@"
-	@$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) \
+	@$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) $(WINBIND_LIBS) \
 		@SONAMEFLAG@`basename $@`
 
 bin/pam_winbind. at SHLIBEXT@: $(BINARY_PREREQS) $(PAM_WINBIND_OBJ)
diff --git a/source3/nsswitch/winbind_krb5_locator.c b/source3/nsswitch/winbind_krb5_locator.c
index 7eecd13..b9e35bd 100644
--- a/source3/nsswitch/winbind_krb5_locator.c
+++ b/source3/nsswitch/winbind_krb5_locator.c
@@ -18,6 +18,7 @@
 */
 
 #include "nsswitch/winbind_client.h"
+#include "libwbclient/wbclient.h"
 
 #ifndef DEBUG_KRB5
 #undef DEBUG_KRB5
@@ -244,54 +245,50 @@ static void smb_krb5_locator_close(void *private_data)
 
 static bool ask_winbind(const char *realm, char **dcname)
 {
-	NSS_STATUS status;
-	struct winbindd_request request;
-	struct winbindd_response response;
+	wbcErr wbc_status;
 	const char *dc = NULL;
+	struct wbcDomainControllerInfoEx *dc_info = NULL;
+	uint32_t flags;
 
-	ZERO_STRUCT(request);
-	ZERO_STRUCT(response);
+	flags = WBC_LOOKUP_DC_KDC_REQUIRED |
+		WBC_LOOKUP_DC_IS_DNS_NAME |
+		WBC_LOOKUP_DC_RETURN_DNS_NAME |
+		WBC_LOOKUP_DC_IP_REQUIRED;
 
-	request.data.dsgetdcname.flags = 0x40020600;
-			/* DS_KDC_REQUIRED |
-			DS_IS_DNS_NAME |
-			DS_RETURN_DNS_NAME |
-			DS_IP_REQUIRED */
+	wbc_status = wbcLookupDomainControllerEx(realm, NULL, NULL, flags, &dc_info);
 
-	strncpy(request.data.dsgetdcname.domain_name, realm,
-		sizeof(request.data.dsgetdcname.domain_name)-1);
-
-	status = winbindd_request_response(WINBINDD_DSGETDCNAME,
-					   &request, &response);
-	if (status != NSS_STATUS_SUCCESS) {
+	if (!WBC_ERROR_IS_OK(wbc_status)) {
 #ifdef DEBUG_KRB5
 		fprintf(stderr,"[%5u]: smb_krb5_locator_lookup: failed with: %s\n",
-			(unsigned int)getpid(), nss_err_str(status));
+			(unsigned int)getpid(), wbcErrorString(wbc_status));
 #endif
 		return false;
 	}
 
-	if (response.data.dsgetdcname.dc_address[0] != '\0') {
-		dc = response.data.dsgetdcname.dc_address;
+	if (dc_info->dc_address) {
+		dc = dc_info->dc_address;
 		if (dc[0] == '\\') dc++;
 		if (dc[0] == '\\') dc++;
 	}
 
-	if (!dc && response.data.dsgetdcname.dc_unc[0] != '\0') {
-		dc = response.data.dsgetdcname.dc_unc;
+	if (!dc && dc_info->dc_unc) {
+		dc = dc_info->dc_unc;
 		if (dc[0] == '\\') dc++;
 		if (dc[0] == '\\') dc++;
 	}
 
 	if (!dc) {
+		wbcFreeMemory(dc_info);
 		return false;
 	}
 
 	*dcname = strdup(dc);
 	if (!*dcname) {
+		wbcFreeMemory(dc_info);
 		return false;
 	}
 
+	wbcFreeMemory(dc_info);
 	return true;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list