[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Tue Jan 26 02:20:03 UTC 2016


The branch, master has been updated
       via  a2894cf s3:lib: add braces around if-block in my_sam_name()
       via  d67d8e1 s3:lib: remove supefluous comments from map_my_name()
       via  6eaf40f s3:lib: fix white spaces in my_sam_name()
       via  dee38e0 vfs_shadow_copy2: documentation for snapsharepath
       via  bbb5a8a vfs_shadow_copy2: add tests for snapsharepath
       via  8433388 vfs_shadow_copy2: add snapsharepath parameter
       via  57dab20 vfs_shadow_copy2: remove basedir state variable
      from  500bc01 s3-parm: clean up defaults when removing global parameters

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


- Log -----------------------------------------------------------------
commit a2894cf4e0c733b14e645ae492b8cd1c13878900
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jan 21 12:46:40 2016 +0100

    s3:lib: add braces around if-block in my_sam_name()
    
    Clean-up after moving the function.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Tue Jan 26 03:19:18 CET 2016 on sn-devel-144

commit d67d8e194b221315cde56f4728935071eecb378b
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jan 21 12:45:42 2016 +0100

    s3:lib: remove supefluous comments from map_my_name()
    
    cleanup after moving
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 6eaf40f5a4ac2e7fe3b40176932acf7abd51279a
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jan 21 12:44:19 2016 +0100

    s3:lib: fix white spaces in my_sam_name()
    
    Clean-up after function has been moved.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit dee38e04d217a868721b622b5c9c22d3ba381790
Author: Uri Simchoni <uri at samba.org>
Date:   Tue Nov 3 13:21:58 2015 +0200

    vfs_shadow_copy2: documentation for snapsharepath
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit bbb5a8a9d545b4e3014bdcb96dd7c7d48cf0b8f7
Author: Uri Simchoni <uri at samba.org>
Date:   Tue Nov 3 11:15:52 2015 +0200

    vfs_shadow_copy2: add tests for snapsharepath
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 84333884ff34a75ceec8f966c1f7e6ad5566a4d2
Author: Uri Simchoni <uri at samba.org>
Date:   Tue Nov 3 10:57:13 2015 +0200

    vfs_shadow_copy2: add snapsharepath parameter
    
    This new parameter defines how to get from the snapshot's
    root directory to the share's root directory. It is an
    alternative to the "basedir" parameter, but functionally
    is a superset of basedir.
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 57dab2028d1e2616b65da0c315388233cfd36c1f
Author: Uri Simchoni <uri at samba.org>
Date:   Tue Nov 3 09:15:12 2015 +0200

    vfs_shadow_copy2: remove basedir state variable
    
    Remove the basedir state variable from the module-specific data
    of vfs_shadow_copy2 - this variable is not being used.
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 docs-xml/manpages/vfs_shadow_copy2.8.xml | 40 ++++++++++++++++++++
 selftest/target/Samba3.pm                |  8 ++++
 source3/lib/util_names.c                 | 12 ++----
 source3/modules/vfs_shadow_copy2.c       | 64 ++++++++++++++++++++++----------
 source3/script/tests/test_shadow_copy.sh |  1 +
 5 files changed, 98 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_shadow_copy2.8.xml b/docs-xml/manpages/vfs_shadow_copy2.8.xml
index 0bb95af..fbc0651 100644
--- a/docs-xml/manpages/vfs_shadow_copy2.8.xml
+++ b/docs-xml/manpages/vfs_shadow_copy2.8.xml
@@ -226,6 +226,46 @@
                 </varlistentry>
 
 		<varlistentry>
+		<term>shadow:snapsharepath = SNAPSHAREPATH
+		</term>
+		<listitem>
+		<para>
+		With this parameter, one can specify the path of the share's
+		root directory in snapshots, relative to the snapshot's
+		root directory. It is an alternative method to
+		<command>shadow:basedir</command>, allowing greater control.
+		</para>
+		<para>
+		For example, if within each
+		snapshot the files of the share have a
+		<command>path/to/share/</command> prefix, then
+		<command>shadow:snapsharepath</command> can be
+		set to <command>path/to/share</command>.
+		</para>
+		<para>
+		With this parameter, it is no longer assumed that a
+		snapshot represents an image of the original file system or
+		a portion of it. For example, a system could perform
+		backups of only files contained in shares, and then
+		expose the backup files in a logical structure:
+		</para>
+		<itemizedlist>
+		<listitem><para>share1/</para></listitem>
+		<listitem><para>share2/</para></listitem>
+		<listitem><para>.../</para></listitem>
+		</itemizedlist>
+		<para>
+		Note that the <command>shadow:snapdirseverywhere</command>
+		and the <command>shadow:basedir</command> options
+		are incompatible with <command>shadow:snapsharepath</command>
+		and disable <command>shadow:snapsharepath</command> setting.
+		</para>
+		<para>Example: shadow:snapsharepath = path/to/share</para>
+		<para>Default: shadow:snapsharepath = NOT SPECIFIED</para>
+                </listitem>
+		</varlistentry>
+
+		<varlistentry>
                 <term>shadow:sort = asc/desc
                 </term>
                 <listitem>
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index cd293a6..44dadfb 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1616,6 +1616,14 @@ sub provision($$$$$$$$)
 	shadow:mountpoint = $shadow_mntdir
 	shadow:snapdirseverywhere = yes
 
+[shadow8]
+	path = $shadow_shrdir
+	comment = previous versions using snapsharepath
+	vfs objects = shadow_copy2
+	shadow:mountpoint = $shadow_mntdir
+	shadow:snapdir = $shadow_tstdir/.snapshots
+	shadow:snapsharepath = share
+
 [shadow_wl]
 	path = $shadow_shrdir
 	comment = previous versions with wide links allowed
diff --git a/source3/lib/util_names.c b/source3/lib/util_names.c
index 802df5d..dc5c530 100644
--- a/source3/lib/util_names.c
+++ b/source3/lib/util_names.c
@@ -175,17 +175,13 @@ const char *get_global_sam_name(void)
 /******************************************************************
  Get the default domain/netbios name to be used when
  testing authentication.
-
- LEGACY: this function provides the legacy domain mapping used with
-	 the lp_map_untrusted_to_domain() parameter
 ******************************************************************/
 
 const char *my_sam_name(void)
 {
-       /* Standalone servers can only use the local netbios name */
-       if ( lp_server_role() == ROLE_STANDALONE )
-               return lp_netbios_name();
+	if (lp_server_role() == ROLE_STANDALONE) {
+		return lp_netbios_name();
+	}
 
-       /* Default to the DOMAIN name when not specified */
-       return lp_workgroup();
+	return lp_workgroup();
 }
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index cffca09..6e6b087 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -45,9 +45,8 @@ struct shadow_copy2_config {
 	bool fixinodes;
 	char *sort_order;
 	bool snapdir_absolute;
-	char *basedir;
 	char *mount_point;
-	char *rel_connectpath; /* share root, relative to the basedir */
+	char *rel_connectpath; /* share root, relative to a snapshot root */
 	char *snapshot_basepath; /* the absolute version of snapdir */
 };
 
@@ -1873,7 +1872,8 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
 	const char *snapdir;
 	const char *gmt_format;
 	const char *sort_order;
-	const char *basedir;
+	const char *basedir = NULL;
+	const char *snapsharepath = NULL;
 	const char *mount_point;
 
 	DEBUG(10, (__location__ ": cnum[%u], connectpath[%s]\n",
@@ -1996,6 +1996,7 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
 				  "relative ('%s'), but it has to be an "
 				  "absolute path. Disabling basedir.\n",
 				  basedir));
+			basedir = NULL;
 		} else {
 			char *p;
 			p = strstr(basedir, config->mount_point);
@@ -2005,31 +2006,58 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
 					  "mount point (%s). "
 					  "Disabling basedir\n",
 					  basedir, config->mount_point));
-			} else {
-				config->basedir = talloc_strdup(config,
-								basedir);
-				if (config->basedir == NULL) {
-					DEBUG(0, ("talloc_strdup() failed\n"));
-					errno = ENOMEM;
-					return -1;
-				}
+				basedir = NULL;
 			}
 		}
 	}
 
-	if (config->snapdirseverywhere && config->basedir != NULL) {
+	if (config->snapdirseverywhere && basedir != NULL) {
 		DEBUG(1, (__location__ " Warning: 'basedir' is incompatible "
 			  "with 'snapdirseverywhere'. Disabling basedir.\n"));
-		TALLOC_FREE(config->basedir);
+		basedir = NULL;
+	}
+
+	snapsharepath = lp_parm_const_string(SNUM(handle->conn), "shadow",
+					     "snapsharepath", NULL);
+	if (snapsharepath != NULL) {
+		if (snapsharepath[0] == '/') {
+			DBG_WARNING("Warning: 'snapsharepath' is "
+				    "absolute ('%s'), but it has to be a "
+				    "relative path. Disabling snapsharepath.\n",
+				    snapsharepath);
+			snapsharepath = NULL;
+		}
+		if (config->snapdirseverywhere && snapsharepath != NULL) {
+			DBG_WARNING("Warning: 'snapsharepath' is incompatible "
+				    "with 'snapdirseverywhere'. Disabling "
+				    "snapsharepath.\n");
+			snapsharepath = NULL;
+		}
+	}
+
+	if (basedir != NULL && snapsharepath != NULL) {
+		DBG_WARNING("Warning: 'snapsharepath' is incompatible with "
+			    "'basedir'. Disabling snapsharepath\n");
+		snapsharepath = NULL;
+	}
+
+	if (snapsharepath != NULL) {
+		config->rel_connectpath = talloc_strdup(config, snapsharepath);
+		if (config->rel_connectpath == NULL) {
+			DBG_ERR("talloc_strdup() failed\n");
+			errno = ENOMEM;
+			return -1;
+		}
 	}
 
-	if (config->basedir == NULL) {
-		config->basedir = config->mount_point;
+	if (basedir == NULL) {
+		basedir = config->mount_point;
 	}
 
-	if (strlen(config->basedir) != strlen(handle->conn->connectpath)) {
+	if (config->rel_connectpath == NULL &&
+	    strlen(basedir) != strlen(handle->conn->connectpath)) {
 		config->rel_connectpath = talloc_strdup(config,
-			handle->conn->connectpath + strlen(config->basedir));
+			handle->conn->connectpath + strlen(basedir));
 		if (config->rel_connectpath == NULL) {
 			DEBUG(0, ("talloc_strdup() failed\n"));
 			errno = ENOMEM;
@@ -2067,7 +2095,6 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
 
 	DEBUG(10, ("shadow_copy2_connect: configuration:\n"
 		   "  share root: '%s'\n"
-		   "  basedir: '%s'\n"
 		   "  mountpoint: '%s'\n"
 		   "  rel share root: '%s'\n"
 		   "  snapdir: '%s'\n"
@@ -2080,7 +2107,6 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
 		   "  sort order: %s\n"
 		   "",
 		   handle->conn->connectpath,
-		   config->basedir,
 		   config->mount_point,
 		   config->rel_connectpath,
 		   config->snapdir,
diff --git a/source3/script/tests/test_shadow_copy.sh b/source3/script/tests/test_shadow_copy.sh
index eecd5b8..171008d 100755
--- a/source3/script/tests/test_shadow_copy.sh
+++ b/source3/script/tests/test_shadow_copy.sh
@@ -278,6 +278,7 @@ test_shadow_copy_fixed shadow3 mount/base share "sub volume snapshots mounted un
 test_shadow_copy_fixed shadow4 . share "sub volume snapshots mounted outside"
 test_shadow_copy_fixed shadow5 mount/base/share "" "full volume snapshots and share mounted under volume"
 test_shadow_copy_fixed shadow6 . "" "full volume snapshots and share mounted outside"
+test_shadow_copy_fixed shadow8 . share "logical snapshot layout"
 
 # tests for snapshot everywhere - one snapshot location
 test_shadow_copy_fixed shadow7 mount base/share "'everywhere' full volume snapshots"


-- 
Samba Shared Repository



More information about the samba-cvs mailing list