svn commit: samba r19975 - in branches/SAMBA_3_0/source/nsswitch: .

jra at samba.org jra at samba.org
Fri Dec 1 01:58:44 GMT 2006


Author: jra
Date: 2006-12-01 01:58:43 +0000 (Fri, 01 Dec 2006)
New Revision: 19975

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19975

Log:
Deal with 2 keytypes I messed previously (DR/DE).
Fix code that mistakenly assumed tdb_traverse
returned 0 or -1, it actually returns -1 or the
number of entries traversed. Add a static as another
way to return the bad cache value.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c	2006-12-01 00:06:35 UTC (rev 19974)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c	2006-12-01 01:58:43 UTC (rev 19975)
@@ -2596,6 +2596,8 @@
  Validate functions for all possible cache tdb keys.
 ***********************************************************************/
 
+static int bad_cache_entry;
+
 static int validate_seqnum(TDB_DATA kbuf, TDB_DATA dbuf)
 {
 	return 0;
@@ -2656,6 +2658,16 @@
 	return 0;
 }
 
+static int validate_dr(TDB_DATA kbuf, TDB_DATA dbuf)
+{
+	return 0;
+}
+
+static int validate_de(TDB_DATA kbuf, TDB_DATA dbuf)
+{
+	return 0;
+}
+
 static int validate_trustdoms(TDB_DATA kbuf, TDB_DATA dbuf)
 {
 	return 0;
@@ -2687,6 +2699,8 @@
 	{"UG/", validate_ug},
 	{"UA", validate_ua},
 	{"GM/", validate_gm},
+	{"DR/", validate_dr},
+	{"DE/", validate_de},
 	{"TRUSTDOMS/", validate_trustdoms},
 	{"WINBINDD_OFFLINE", validate_offline},
 	{NULL, NULL}
@@ -2708,6 +2722,11 @@
 			return key_val[i].validate_data_fn(kbuf, dbuf);
 		}
 	}
+
+	DEBUG(0,("cache_traverse_validate_fn: unknown cache entry\nkey :\n"));
+	dump_data(0, kbuf.dptr, kbuf.dsize);
+	DEBUG(0,("data :\n"));
+	dump_data(0, dbuf.dptr, dbuf.dsize);
 	return 1; /* terminate. */
 }
 
@@ -2789,15 +2808,19 @@
 		goto out;
 	}
 
+	DEBUG(10,("winbindd_validate_cache: cache %s freelist has %d entries\n",
+		cache_path, num_entries));
+
 	/* Now traverse the cache to validate it. */
-	if (tdb_traverse(tdb, cache_traverse_validate_fn, NULL)) {
+	num_entries = tdb_traverse(tdb, cache_traverse_validate_fn, NULL);
+	if (num_entries == -1 || bad_cache_entry) {
 		DEBUG(0,("winbindd_validate_cache: cache %s traverse failed\n",
 			cache_path));
 		goto out;
 	}
 
 	DEBUG(10,("winbindd_validate_cache: cache %s is good "
-		"freelist has %d entries\n", cache_path, num_entries));
+		"with %d entries\n", cache_path, num_entries));
 	ret = 0; /* Cache is good. */
 
   out:



More information about the samba-cvs mailing list