[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Jul 12 08:17:01 MDT 2011


The branch, master has been updated
       via  110bf31 s4:winsdb: place wins.ldb in "state dir" instead of "lock dir"
       via  2ba1444 selftest/Samba4: use "state dir" for persistent files
       via  e10d7d9 s4:provision: place the sysvol share under "state dir" instead of "lock dir"
       via  1c5390e selftest/Samba4: setup "state dir" and "cache dir"
       via  c0eb56d s4:param: add "state dir" and "cache dir" options
      from  8a234cb s3:libsmb: remove unused cli_oplock_handler()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 110bf317d8459d4b93f39f789a21b5e74f045ff7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jul 12 13:52:54 2011 +0200

    s4:winsdb: place wins.ldb in "state dir" instead of "lock dir"
    
    It's not only a cache as we also support static records.
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Tue Jul 12 16:16:45 CEST 2011 on sn-devel-104

commit 2ba1444fbde9e459f67292ba5cdc79191d6c35ee
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jul 12 13:14:41 2011 +0200

    selftest/Samba4: use "state dir" for persistent files
    
    metze

commit e10d7d9941fe9a582a353eebfdd7eb46e8cc98c1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jul 12 13:49:18 2011 +0200

    s4:provision: place the sysvol share under "state dir" instead of "lock dir"
    
    metze

commit 1c5390e39fbc2090e2eb4ff8846519dac08854b4
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jul 12 13:12:50 2011 +0200

    selftest/Samba4: setup "state dir" and "cache dir"
    
    metze

commit c0eb56d1599fee0f0f5cf757b5381f56e04b74c1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jul 12 13:04:08 2011 +0200

    s4:param: add "state dir" and "cache dir" options
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 selftest/selftest.pl                               |   14 +++++
 selftest/target/Samba4.pm                          |   22 +++++---
 source4/nbt_server/wins/winsdb.c                   |    2 +-
 source4/param/loadparm.c                           |   20 +++++++
 source4/param/util.c                               |   56 ++++++++++++++++++++
 .../scripting/python/samba/provision/__init__.py   |   12 ++++-
 source4/setup/provision.smb.conf.dc                |    2 +
 source4/setup/provision.smb.conf.member            |    2 +
 source4/setup/provision.smb.conf.standalone        |    2 +
 source4/smbd/server.c                              |    2 +
 10 files changed, 124 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index d72c409..808be22 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -597,6 +597,18 @@ sub write_clientconf($$$)
 	        mkdir("$clientdir/lockdir", 0777);
 	}
 
+	if ( -d "$clientdir/statedir" ) {
+	        unlink <$clientdir/statedir/*>;
+	} else {
+	        mkdir("$clientdir/statedir", 0777);
+	}
+
+	if ( -d "$clientdir/cachedir" ) {
+	        unlink <$clientdir/cachedir/*>;
+	} else {
+	        mkdir("$clientdir/cachedir", 0777);
+	}
+
 	# this is ugly, but the ncalrpcdir needs exactly 0755
 	# otherwise tests fail.
 	my $mask = umask;
@@ -627,6 +639,8 @@ sub write_clientconf($$$)
 	print CF "
 	private dir = $clientdir/private
 	lock dir = $clientdir/lockdir
+	state dir = $clientdir/statedir
+	cache dir = $clientdir/cachedir
 	ncalrpc dir = $clientdir/ncalrpcdir
 	name resolve order = file bcast
 	panic action = $RealBin/gdb_backtrace \%PID\%
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index f238e14..2bb74ca 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -510,6 +510,8 @@ sub provision_raw_prepare($$$$$$$$$$)
 	$ctx->{privatedir} = "$prefix_abs/private";
 	$ctx->{ncalrpcdir} = "$prefix_abs/ncalrpc";
 	$ctx->{lockdir} = "$prefix_abs/lockdir";
+	$ctx->{statedir} = "$prefix_abs/statedir";
+	$ctx->{cachedir} = "$prefix_abs/cachedir";
 	$ctx->{winbindd_socket_dir} = "$prefix_abs/winbindd_socket";
 	$ctx->{winbindd_privileged_socket_dir} = "$prefix_abs/winbindd_privileged_socket";
 	$ctx->{ntp_signd_socket_dir} = "$prefix_abs/ntp_signd_socket";
@@ -525,6 +527,8 @@ sub provision_raw_prepare($$$$$$$$$$)
 	push(@{$ctx->{directories}}, $ctx->{etcdir});
 	push(@{$ctx->{directories}}, $ctx->{piddir});
 	push(@{$ctx->{directories}}, $ctx->{lockdir});
+	push(@{$ctx->{directories}}, $ctx->{statedir});
+	push(@{$ctx->{directories}}, $ctx->{cachedir});
 
 	$ctx->{smb_conf_extra_options} = "";
 
@@ -586,13 +590,15 @@ sub provision_raw_step1($$)
 [global]
 	acl:search = $acl
 	netbios name = $ctx->{netbiosname}
-	posix:eadb = $ctx->{lockdir}/eadb.tdb
+	posix:eadb = $ctx->{statedir}/eadb.tdb
 	workgroup = $ctx->{domain}
 	realm = $ctx->{realm}
 	private dir = $ctx->{privatedir}
 	pid directory = $ctx->{piddir}
 	ncalrpc dir = $ctx->{ncalrpcdir}
 	lock dir = $ctx->{lockdir}
+	state dir = $ctx->{statedir}
+	cache dir = $ctx->{cachedir}
 	winbindd socket directory = $ctx->{winbindd_socket_dir}
 	winbindd privileged socket directory = $ctx->{winbindd_privileged_socket_dir}
 	ntp signd socket directory = $ctx->{ntp_signd_socket_dir}
@@ -686,6 +692,8 @@ nogroup:x:65534:nobody
 		WINBINDD_SOCKET_DIR => $ctx->{winbindd_socket_dir},
 		NCALRPCDIR => $ctx->{ncalrpcdir},
 		LOCKDIR => $ctx->{lockdir},
+		STATEDIR => $ctx->{statedir},
+		CACHEDIR => $ctx->{cachedir},
 		SERVERCONFFILE => $ctx->{smb_conf},
 		CONFIGURATION => $configuration,
 		SOCKET_WRAPPER_DEFAULT_IFACE => $ctx->{swiface},
@@ -778,11 +786,11 @@ sub provision($$$$$$$$$)
 	ntvfs handler = simple
 
 [sysvol]
-	path = $ctx->{lockdir}/sysvol
+	path = $ctx->{statedir}/sysvol
 	read only = yes
 
 [netlogon]
-	path = $ctx->{lockdir}/sysvol/$ctx->{dnsname}/scripts
+	path = $ctx->{statedir}/sysvol/$ctx->{dnsname}/scripts
 	read only = no
 
 [cifsposix]
@@ -986,11 +994,11 @@ sub provision_vampire_dc($$$)
 	server max protocol = SMB2
 
 [sysvol]
-	path = $ctx->{lockdir}/sysvol
+	path = $ctx->{statedir}/sysvol
 	read only = yes
 
 [netlogon]
-	path = $ctx->{lockdir}/sysvol/$ctx->{dnsname}/scripts
+	path = $ctx->{statedir}/sysvol/$ctx->{dnsname}/scripts
 	read only = no
 
 ";
@@ -1151,11 +1159,11 @@ sub provision_rodc($$$)
 	server max protocol = SMB2
 
 [sysvol]
-	path = $ctx->{lockdir}/sysvol
+	path = $ctx->{statedir}/sysvol
 	read only = yes
 
 [netlogon]
-	path = $ctx->{lockdir}/sysvol/$ctx->{dnsname}/scripts
+	path = $ctx->{statedir}/sysvol/$ctx->{dnsname}/scripts
 	read only = yes
 
 [tmp]
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c
index 4a14860..6727445 100644
--- a/source4/nbt_server/wins/winsdb.c
+++ b/source4/nbt_server/wins/winsdb.c
@@ -975,7 +975,7 @@ static bool winsdb_check_or_add_module_list(struct tevent_context *ev_ctx,
 		flags |= LDB_FLG_NOSYNC;
 	}
 
-	h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lpcfg_lock_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)),
+	h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lpcfg_state_path(h, lp_ctx, lpcfg_wins_url(lp_ctx)),
 				  NULL, NULL, flags);
 	if (!h->ldb) goto failed;
 
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index b890ad8..df8b054 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -1083,6 +1083,22 @@ static struct parm_struct parm_table[] = {
 		.enum_list	= NULL
 	},
 	{
+		.label		= "state dir",
+		.type		= P_STRING,
+		.p_class	= P_GLOBAL,
+		.offset		= GLOBAL_VAR(szStateDir),
+		.special	= NULL,
+		.enum_list	= NULL
+	},
+	{
+		.label		= "cache dir",
+		.type		= P_STRING,
+		.p_class	= P_GLOBAL,
+		.offset		= GLOBAL_VAR(szCacheDir),
+		.special	= NULL,
+		.enum_list	= NULL
+	},
+	{
 		.label		= "pid directory",
 		.type		= P_STRING,
 		.p_class	= P_GLOBAL,
@@ -1476,6 +1492,8 @@ FN_GLOBAL_BOOL(idmap_trusted_only, bIdmapTrustedOnly)
 FN_GLOBAL_STRING(private_dir, szPrivateDir)
 FN_GLOBAL_STRING(serverstring, szServerString)
 FN_GLOBAL_STRING(lockdir, szLockDir)
+FN_GLOBAL_STRING(statedir, szStateDir)
+FN_GLOBAL_STRING(cachedir, szCacheDir)
 FN_GLOBAL_STRING(ncalrpc_dir, ncalrpc_dir)
 FN_GLOBAL_STRING(dos_charset, dos_charset)
 FN_GLOBAL_STRING(unix_charset, unix_charset)
@@ -3263,6 +3281,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
 	lpcfg_do_global_parameter(lp_ctx, "pid directory", dyn_PIDDIR);
 	lpcfg_do_global_parameter(lp_ctx, "lock dir", dyn_LOCKDIR);
+	lpcfg_do_global_parameter(lp_ctx, "state dir", dyn_STATEDIR);
+	lpcfg_do_global_parameter(lp_ctx, "cache dir", dyn_CACHEDIR);
 	lpcfg_do_global_parameter(lp_ctx, "ncalrpc dir", dyn_NCALRPCDIR);
 
 	lpcfg_do_global_parameter(lp_ctx, "socket address", "");
diff --git a/source4/param/util.c b/source4/param/util.c
index b1a7a57..92672ec 100644
--- a/source4/param/util.c
+++ b/source4/param/util.c
@@ -101,6 +101,62 @@ char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
 }
 
 /**
+ A useful function for returning a path in the Samba state directory.
+**/
+char *lpcfg_state_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
+		       const char *name)
+{
+	char *fname, *dname;
+	if (name == NULL) {
+		return NULL;
+	}
+	if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
+		return talloc_strdup(mem_ctx, name);
+	}
+
+	dname = talloc_strdup(mem_ctx, lpcfg_statedir(lp_ctx));
+	trim_string(dname,"","/");
+
+	if (!directory_exist(dname)) {
+		mkdir(dname,0755);
+	}
+
+	fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
+
+	talloc_free(dname);
+
+	return fname;
+}
+
+/**
+ A useful function for returning a path in the Samba cache directory.
+**/
+char *lpcfg_cache_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
+		       const char *name)
+{
+	char *fname, *dname;
+	if (name == NULL) {
+		return NULL;
+	}
+	if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
+		return talloc_strdup(mem_ctx, name);
+	}
+
+	dname = talloc_strdup(mem_ctx, lpcfg_cachedir(lp_ctx));
+	trim_string(dname,"","/");
+
+	if (!directory_exist(dname)) {
+		mkdir(dname,0755);
+	}
+
+	fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
+
+	talloc_free(dname);
+
+	return fname;
+}
+
+/**
  * @brief Returns an absolute path to a file in the directory containing the current config file
  *
  * @param name File to find, relative to the config file directory.
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index 91c4ef7..7197940 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -714,13 +714,19 @@ def make_smbconf(smbconf, hostname, domain, realm, serverrole,
     if targetdir is not None:
         privatedir_line = "private dir = " + os.path.abspath(os.path.join(targetdir, "private"))
         lockdir_line = "lock dir = " + os.path.abspath(targetdir)
+        statedir_line = "state dir = " + os.path.abspath(targetdir)
+        cachedir_line = "cache dir = " + os.path.abspath(targetdir)
 
         lp.set("lock dir", os.path.abspath(targetdir))
+        lp.set("state dir", os.path.abspath(targetdir))
+        lp.set("cache dir", os.path.abspath(targetdir))
     else:
         privatedir_line = ""
         lockdir_line = ""
+        statedir_line = ""
+        cachedir_line = ""
 
-    sysvol = os.path.join(lp.get("lock dir"), "sysvol")
+    sysvol = os.path.join(lp.get("state dir"), "sysvol")
     netlogon = os.path.join(sysvol, realm.lower(), "scripts")
 
     setup_file(setup_path("provision.smb.conf.%s" % smbconfsuffix),
@@ -732,7 +738,9 @@ def make_smbconf(smbconf, hostname, domain, realm, serverrole,
             "NETLOGONPATH": netlogon,
             "SYSVOLPATH": sysvol,
             "PRIVATEDIR_LINE": privatedir_line,
-            "LOCKDIR_LINE": lockdir_line
+            "LOCKDIR_LINE": lockdir_line,
+            "STATEDIR_LINE": statedir_line,
+            "CACHEDIR_LINE": cachedir_line
             })
 
     # reload the smb.conf
diff --git a/source4/setup/provision.smb.conf.dc b/source4/setup/provision.smb.conf.dc
index f489f59..3fd2e77 100644
--- a/source4/setup/provision.smb.conf.dc
+++ b/source4/setup/provision.smb.conf.dc
@@ -5,6 +5,8 @@
 	server role     = ${SERVERROLE}
 	${PRIVATEDIR_LINE}
 	${LOCKDIR_LINE}
+	${STATEDIR_LINE}
+	${CACHEDIR_LINE}
 
 [netlogon]
 	path = ${NETLOGONPATH}
diff --git a/source4/setup/provision.smb.conf.member b/source4/setup/provision.smb.conf.member
index 96e5d0c..6c57b5a 100644
--- a/source4/setup/provision.smb.conf.member
+++ b/source4/setup/provision.smb.conf.member
@@ -5,3 +5,5 @@
 	server role     = ${SERVERROLE}
 	${PRIVATEDIR_LINE}
 	${LOCKDIR_LINE}
+	${STATEDIR_LINE}
+	${CACHEDIR_LINE}
diff --git a/source4/setup/provision.smb.conf.standalone b/source4/setup/provision.smb.conf.standalone
index 96e5d0c..6c57b5a 100644
--- a/source4/setup/provision.smb.conf.standalone
+++ b/source4/setup/provision.smb.conf.standalone
@@ -5,3 +5,5 @@
 	server role     = ${SERVERROLE}
 	${PRIVATEDIR_LINE}
 	${LOCKDIR_LINE}
+	${STATEDIR_LINE}
+	${CACHEDIR_LINE}
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 1be3b28..b0f683b 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -252,6 +252,8 @@ static void show_build(void)
 		CONFIG_OPTION(DATADIR),
 		CONFIG_OPTION(MODULESDIR),
 		CONFIG_OPTION(LOCKDIR),
+		CONFIG_OPTION(STATEDIR),
+		CONFIG_OPTION(CACHEDIR),
 		CONFIG_OPTION(PIDDIR),
 		CONFIG_OPTION(PRIVATE_DIR),
 		CONFIG_OPTION(SWATDIR),


-- 
Samba Shared Repository


More information about the samba-cvs mailing list