svn commit: samba r19206 - in branches/SAMBA_3_0/source: nsswitch
utils
gd at samba.org
gd at samba.org
Mon Oct 9 15:11:38 GMT 2006
Author: gd
Date: 2006-10-09 15:11:37 +0000 (Mon, 09 Oct 2006)
New Revision: 19206
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19206
Log:
Jeremy, for some reason storing a value-less entry in TDB does not work
anymore in 3_0. I'm just adding a time(NULL) as value for the
WINBINDD_OFFLINE key.
Guenther
Modified:
branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
branches/SAMBA_3_0/source/utils/smbcontrol.c
Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-10-09 14:33:56 UTC (rev 19205)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-10-09 15:11:37 UTC (rev 19206)
@@ -2523,7 +2523,6 @@
BOOL set_global_winbindd_state_offline(void)
{
TDB_DATA data;
- int err;
DEBUG(10,("set_global_winbindd_state_offline: offline requested.\n"));
@@ -2545,21 +2544,16 @@
return True;
}
-/* wcache->tdb->ecode = 0; */
-
data = tdb_fetch_bystring( wcache->tdb, "WINBINDD_OFFLINE" );
- /* As this is a key with no data we don't need to free, we
- check for existence by looking at tdb_err. */
-
- err = tdb_error(wcache->tdb);
-
- if (err == TDB_ERR_NOEXIST) {
+ if (!data.dptr || data.dsize != 4) {
DEBUG(10,("set_global_winbindd_state_offline: offline state not set.\n"));
+ SAFE_FREE(data.dptr);
return False;
} else {
DEBUG(10,("set_global_winbindd_state_offline: offline state set.\n"));
global_winbindd_offline_state = True;
+ SAFE_FREE(data.dptr);
return True;
}
}
Modified: branches/SAMBA_3_0/source/utils/smbcontrol.c
===================================================================
--- branches/SAMBA_3_0/source/utils/smbcontrol.c 2006-10-09 14:33:56 UTC (rev 19205)
+++ branches/SAMBA_3_0/source/utils/smbcontrol.c 2006-10-09 15:11:37 UTC (rev 19206)
@@ -882,25 +882,27 @@
5 times. */
for (retry = 0; retry < 5; retry++) {
- int err;
TDB_DATA d;
+ char buf[4];
+
ZERO_STRUCT(d);
+
+ SIVAL(buf, 0, time(NULL));
+ d.dptr = buf;
+ d.dsize = 4;
+
tdb_store_bystring(tdb, "WINBINDD_OFFLINE", d, TDB_INSERT);
ret = send_message(pid, MSG_WINBIND_OFFLINE, NULL, 0, False);
/* Check that the entry "WINBINDD_OFFLINE" still exists. */
- /* tdb->ecode = TDB_SUCCESS; */
d = tdb_fetch_bystring( tdb, "WINBINDD_OFFLINE" );
-
- /* As this is a key with no data we don't need to free, we
- check for existence by looking at tdb_err. */
-
- err = tdb_error(tdb);
-
- if (err == TDB_ERR_NOEXIST) {
+
+ if (!d.dptr || d.dsize != 4) {
+ SAFE_FREE(d.dptr);
DEBUG(10,("do_winbind_offline: offline state not set - retrying.\n"));
} else {
+ SAFE_FREE(d.dptr);
break;
}
}
More information about the samba-cvs
mailing list