[patch] give idmap plugins access to winbindd's ads connection

Johann Hanne jhml at gmx.net
Tue Nov 9 15:55:42 GMT 2004


Hi,

this patch adds a function named get_winbindd_ads_handle() to
winbindd_util.c which returns the ads handle used by winbindd (only if in
ads mode of course). This is useful for the idmap_ad plugin (included in the
xad_oss packages from padl), which can then reuse the ads connection instead
of creating a new one, which is somewhat inelegant.

Comments, please?

Cheers, Johann
-------------- next part --------------
diff -uNr samba-3.0.8.orig/source/nsswitch/winbindd.h samba-3.0.8/source/nsswitch/winbindd.h
--- samba-3.0.8.orig/source/nsswitch/winbindd.h	2004-10-25 23:04:57.000000000 +0200
+++ samba-3.0.8/source/nsswitch/winbindd.h	2004-11-09 07:42:40.684109965 +0100
@@ -204,6 +204,8 @@
 
 	/* setup the list of alternate names for the domain, if any */
 	NTSTATUS (*alternate_name)(struct winbindd_domain *domain);
+
+	ADS_STRUCT *(*get_ads_handle)(struct winbindd_domain *domain);
 };
 
 /* Used to glue a policy handle and cli_state together */
diff -uNr samba-3.0.8.orig/source/nsswitch/winbindd_ads.c samba-3.0.8/source/nsswitch/winbindd_ads.c
--- samba-3.0.8.orig/source/nsswitch/winbindd_ads.c	2004-10-25 23:04:57.000000000 +0200
+++ samba-3.0.8/source/nsswitch/winbindd_ads.c	2004-11-09 07:42:40.687109148 +0100
@@ -970,7 +970,8 @@
 	sequence_number,
 	trusted_domains,
 	domain_sid,
-	alternate_name
+	alternate_name,
+	ads_cached_connection
 };
 
 #endif
diff -uNr samba-3.0.8.orig/source/nsswitch/winbindd_cache.c samba-3.0.8/source/nsswitch/winbindd_cache.c
--- samba-3.0.8.orig/source/nsswitch/winbindd_cache.c	2004-10-25 23:04:57.000000000 +0200
+++ samba-3.0.8/source/nsswitch/winbindd_cache.c	2004-11-09 07:44:13.093936115 +0100
@@ -1377,6 +1377,15 @@
 	}
 }
 
+static ADS_STRUCT *get_ads_handle(struct winbindd_domain *domain)
+{
+        if (domain->backend->get_ads_handle!=NULL) {
+                return domain->backend->get_ads_handle(domain);
+        }
+
+        return NULL;
+}
+
 /* the ADS backend methods are exposed via this structure */
 struct winbindd_methods cache_methods = {
 	True,
@@ -1391,5 +1400,6 @@
 	sequence_number,
 	trusted_domains,
 	domain_sid,
-	alternate_name
+	alternate_name,
+	get_ads_handle
 };
diff -uNr samba-3.0.8.orig/source/nsswitch/winbindd_passdb.c samba-3.0.8/source/nsswitch/winbindd_passdb.c
--- samba-3.0.8.orig/source/nsswitch/winbindd_passdb.c	2004-10-25 23:04:57.000000000 +0200
+++ samba-3.0.8/source/nsswitch/winbindd_passdb.c	2004-11-09 07:42:40.691108059 +0100
@@ -392,5 +392,6 @@
 	sequence_number,
 	trusted_domains,
 	domain_sid,
-	alternate_name
+	alternate_name,
+	NULL
 };
diff -uNr samba-3.0.8.orig/source/nsswitch/winbindd_rpc.c samba-3.0.8/source/nsswitch/winbindd_rpc.c
--- samba-3.0.8.orig/source/nsswitch/winbindd_rpc.c	2004-10-25 23:04:57.000000000 +0200
+++ samba-3.0.8/source/nsswitch/winbindd_rpc.c	2004-11-09 07:42:40.693107514 +0100
@@ -970,5 +970,6 @@
 	sequence_number,
 	trusted_domains,
 	domain_sid,
-	alternate_name
+	alternate_name,
+	NULL
 };
diff -uNr samba-3.0.8.orig/source/nsswitch/winbindd_util.c samba-3.0.8/source/nsswitch/winbindd_util.c
--- samba-3.0.8.orig/source/nsswitch/winbindd_util.c	2004-10-25 23:04:57.000000000 +0200
+++ samba-3.0.8/source/nsswitch/winbindd_util.c	2004-11-09 07:42:52.334936147 +0100
@@ -1041,3 +1041,14 @@
 	/* Failure */
 }
 
+ADS_STRUCT *get_winbindd_ads_handle(struct winbindd_domain *domain)
+{
+        ADS_STRUCT *ads;
+
+        if (domain->methods->get_ads_handle!=NULL) {
+                ads=domain->methods->get_ads_handle(domain);
+                return ads;
+        }
+
+        return NULL;
+}


More information about the samba-technical mailing list