[PATCH] no-cache option enabled

Klinger, John (N-CSC) john.klinger at lmco.com
Tue Feb 3 16:24:24 GMT 2004


The no-cache option was disabled due to an incorrect setting
in winbindd.c. This patch corrects that.

Also, the net_samlogon_cache.tdb was used at logon,
regardless of the no-cache option. This patch adds a check
before using that cache.

Diff based off of 3.0.1 release.

==============================

diff -ur 3.0.1/nsswitch/winbindd.c 3.0.1+/nsswitch/winbindd.c
--- 3.0.1/nsswitch/winbindd.c	Mon Feb  2 16:39:46 2004
+++ 3.0.1+/nsswitch/winbindd.c	Mon Feb  2 16:40:12 2004
@@ -785,7 +785,7 @@
 		{ "foreground", 'F', POPT_ARG_VAL, &Fork, False, "Daemon in foreground mode" },
 		{ "interactive", 'i', POPT_ARG_NONE, NULL, 'i', "Interactive mode" },
 		{ "single-daemon", 'Y', POPT_ARG_VAL, &opt_dual_daemon, False, "Single daemon mode" },
-		{ "no-caching", 'n', POPT_ARG_VAL, &opt_nocache, False, "Disable caching" },
+		{ "no-caching", 'n', POPT_ARG_VAL, &opt_nocache, True, "Disable caching" },
 		POPT_COMMON_SAMBA
 		POPT_TABLEEND
 	};
diff -ur 3.0.1/nsswitch/winbindd_group.c 3.0.1+/nsswitch/winbindd_group.c
--- 3.0.1/nsswitch/winbindd_group.c	Mon Feb  2 16:39:57 2004
+++ 3.0.1+/nsswitch/winbindd_group.c	Mon Feb  2 16:44:07 2004
@@ -25,6 +25,8 @@
 #include "includes.h"
 #include "winbindd.h"
 
+extern BOOL opt_nocache;
+
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
 
@@ -967,10 +969,12 @@
 		goto done;
 	}
 
-	/* Treat the info3 cache as authoritative as the
-	   lookup_usergroups() function may return cached data. */
-
-	if ((info3 = netsamlogon_cache_get(mem_ctx, &user_sid))) {
+	/* 
+	 * Treat the info3 cache as authoritative as the
+	 * lookup_usergroups() function may return cached data,
+	 * unless the no-cache option was specified for winbindd.
+	 */
+	if (! opt_nocache && (info3 = netsamlogon_cache_get(mem_ctx, &user_sid))) {
 
 		DEBUG(10, ("winbindd_getgroups: info3 has %d groups, %d other sids\n",
 			   info3->num_groups2, info3->num_other_sids));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no_cache.zip
Type: application/x-zip-compressed
Size: 805 bytes
Desc: no_cache.zip
Url : http://lists.samba.org/archive/samba-technical/attachments/20040203/004881fe/no_cache.bin


More information about the samba-technical mailing list