Rev 5364: Changes of the registry also trigger a reload of
smb.conf. in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/
Michael Adam
ma at sernet.de
Mon Apr 16 23:01:55 GMT 2007
At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/
------------------------------------------------------------
revno: 5364
revision-id: ma at sernet.de-20070416230151-bfcfb70d496cc600
parent: ma at sernet.de-20070415225054-98f15a01f998d3c6
committer: Michael Adam <ma at sernet.de>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Tue 2007-04-17 01:01:51 +0200
message:
Changes of the registry also trigger a reload of smb.conf.
This is a first slighty hacked version of a registry watcher
in lp_file_list_changed. It uses the regdb sequence number
to decide whether the contents of the registry has changed.
The hack here is that the call to "registry_init_regdb()"
is now there in process_registry_shares() and and in
lp_file_list_changed(). It is needed in the latter function
because when a new smbd process is started, lp_file_list_changed
is called before lp_load(). Maybe, I have to think of a better
place to call regdb_init()...
modified:
source/param/loadparm.c loadparm.c-20060530022627-1efa1edb3eb0e897
=== modified file 'source/param/loadparm.c'
--- a/source/param/loadparm.c 2007-04-15 22:30:33 +0000
+++ b/source/param/loadparm.c 2007-04-16 23:01:51 +0000
@@ -80,6 +80,9 @@
#define INCLUDE_REGISTRY_NAME "registry"
#endif
+static int regdb_last_seqnum = 0;
+static BOOL include_registry_globals = False;
+
/* some helpful bits */
#define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
#define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
@@ -3084,6 +3087,24 @@
DEBUG(6, ("lp_file_list_changed()\n"));
+
+ /* hack - should't this go somewhere else?!
+ * now it is here and in process_registry_globals.
+ * so whichever function is called first wil init the
+ * regdb. here we need it for querying the regdb seqnum */
+ if (!registry_init_regdb()) {
+ DEBUG(1, ("Error initializing the registry.\n"));
+ return False;
+ }
+
+ if (include_registry_globals &&
+ (regdb_last_seqnum != regdb_get_seqnum()))
+ {
+ DEBUGADD(6, ("regdb seqnum changed: old = %d, new = %d\n",
+ regdb_last_seqnum, regdb_get_seqnum()));
+ return True;
+ }
+
while (f) {
pstring n2;
time_t mod_time;
@@ -3193,6 +3214,8 @@
smb_panic("Failed to create talloc context!");
}
+ include_registry_globals = True;
+
/* It might not bee to clean to have the initialization here.
* If the registry is already initialized, it does not do
* any harm. */
@@ -3231,7 +3254,7 @@
pfunc(valname, value->v.sz.str);
break;
default:
- /* ignore */
+ /* ignore other types */
break;
}
TALLOC_FREE(value);
@@ -3240,6 +3263,8 @@
ret = pfunc("registry shares", "yes");
+ regdb_last_seqnum = regdb_get_seqnum();
+
done:
talloc_destroy(ctx);
return ret;
More information about the samba-cvs
mailing list