svn commit: samba r23468 - in branches: SAMBA_3_0/source/registry SAMBA_3_0_26/source/registry

obnox at samba.org obnox at samba.org
Wed Jun 13 13:15:20 GMT 2007


Author: obnox
Date: 2007-06-13 13:15:16 +0000 (Wed, 13 Jun 2007)
New Revision: 23468

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

Log:
Open registry.tdb with sequence number.
Add a function to retrieve the registry db sequence number.

This is in preparation of loadparm integration of registry global
smb.conf options: this will allow to detect changes in order to trigger reload.

Michael


Modified:
   branches/SAMBA_3_0/source/registry/reg_db.c
   branches/SAMBA_3_0_26/source/registry/reg_db.c


Changeset:
Modified: branches/SAMBA_3_0/source/registry/reg_db.c
===================================================================
--- branches/SAMBA_3_0/source/registry/reg_db.c	2007-06-13 12:52:36 UTC (rev 23467)
+++ branches/SAMBA_3_0/source/registry/reg_db.c	2007-06-13 13:15:16 UTC (rev 23468)
@@ -31,6 +31,8 @@
 #define VALUE_PREFIX	"SAMBA_REGVAL"
 #define SECDESC_PREFIX  "SAMBA_SECDESC"
 
+#define REG_TDB_FLAGS TDB_SEQNUM
+
 /* List the deepest path into the registry.  All part components will be created.*/
 
 /* If you want to have a part of the path controlled by the tdb and part by
@@ -236,9 +238,9 @@
 	if ( tdb_reg )
 		return True;
 
-	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
+	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600)) )
 	{
-		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600);
 		if ( !tdb_reg ) {
 			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
 				lock_path("registry.tdb"), strerror(errno) ));
@@ -283,7 +285,7 @@
 	
 	become_root();
 
-	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
+	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600);
 	if ( !tdb_reg ) {
 		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
 		DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", 
@@ -321,6 +323,16 @@
 }
 
 /***********************************************************************
+ return the tdb sequence number of the registry tdb.
+ this is an indicator for the content of the registry
+ having changed. it will change upon regdb_init, too, though.
+ ***********************************************************************/
+int regdb_get_seqnum(void)
+{
+	return tdb_get_seqnum(tdb_reg);
+}
+
+/***********************************************************************
  Add subkey strings to the registry tdb under a defined key
  fmt is the same format as tdb_pack except this function only supports
  fstrings

Modified: branches/SAMBA_3_0_26/source/registry/reg_db.c
===================================================================
--- branches/SAMBA_3_0_26/source/registry/reg_db.c	2007-06-13 12:52:36 UTC (rev 23467)
+++ branches/SAMBA_3_0_26/source/registry/reg_db.c	2007-06-13 13:15:16 UTC (rev 23468)
@@ -31,6 +31,8 @@
 #define VALUE_PREFIX	"SAMBA_REGVAL"
 #define SECDESC_PREFIX  "SAMBA_SECDESC"
 
+#define REG_TDB_FLAGS TDB_SEQNUM
+
 /* List the deepest path into the registry.  All part components will be created.*/
 
 /* If you want to have a part of the path controlled by the tdb and part by
@@ -236,9 +238,9 @@
 	if ( tdb_reg )
 		return True;
 
-	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
+	if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600)) )
 	{
-		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+		tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR|O_CREAT, 0600);
 		if ( !tdb_reg ) {
 			DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
 				lock_path("registry.tdb"), strerror(errno) ));
@@ -283,7 +285,7 @@
 	
 	become_root();
 
-	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
+	tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, REG_TDB_FLAGS, O_RDWR, 0600);
 	if ( !tdb_reg ) {
 		result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
 		DEBUG(0,("regdb_open: Failed to open %s! (%s)\n", 
@@ -321,6 +323,16 @@
 }
 
 /***********************************************************************
+ return the tdb sequence number of the registry tdb.
+ this is an indicator for the content of the registry
+ having changed. it will change upon regdb_init, too, though.
+ ***********************************************************************/
+int regdb_get_seqnum(void)
+{
+	return tdb_get_seqnum(tdb_reg);
+}
+
+/***********************************************************************
  Add subkey strings to the registry tdb under a defined key
  fmt is the same format as tdb_pack except this function only supports
  fstrings



More information about the samba-cvs mailing list