[SCM] Samba Shared Repository - branch master updated

David Disseldorp ddiss at samba.org
Fri Jun 8 07:25:02 MDT 2012


The branch, master has been updated
       via  80d3702 build: do not run fsrvp tests as part of selftest
       via  53c62bc s4-torture: fsrvp test suite
       via  34aa2bd doc: add FSRVP commands to rpcclient man page
       via  ac7b60a s3-rpcclient: add fsrvp commands
       via  2836787 idl: add File Server Remote VSS Protocol idl
      from  03767f5 samba_util: mark smb_panic as _NORETURN_.

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


- Log -----------------------------------------------------------------
commit 80d37023d10ac9cb7c71566933c5613631ce38b8
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Jun 5 20:02:04 2012 +0200

    build: do not run fsrvp tests as part of selftest
    
    Autobuild-User(master): David Disseldorp <ddiss at samba.org>
    Autobuild-Date(master): Fri Jun  8 15:24:45 CEST 2012 on sn-devel-104

commit 53c62bca2f1a1dcb07c70aba67c17a51c2a4eab8
Author: David Disseldorp <ddiss at samba.org>
Date:   Fri Mar 9 16:02:19 2012 +0100

    s4-torture: fsrvp test suite
    
    Covers most operations defined by the File Server Remote VSS Protocol.

commit 34aa2bd74912ea3e9afe7c8899bbbf028ee00765
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Apr 3 14:17:35 2012 +0200

    doc: add FSRVP commands to rpcclient man page

commit ac7b60a17bd4c4dbfaa2d9bb9e1d246800940928
Author: David Disseldorp <ddiss at samba.org>
Date:   Mon Mar 26 17:34:52 2012 +0200

    s3-rpcclient: add fsrvp commands
    
    fss_create_expose connects to an FSRVP server and negotiates the
    creation and exposure of a share shadow-copy.
    shadow-copies of multiple shares can be requested with a single
    fss_create_expose request.
    
    ddiss at plati:~> bin/rpcclient -k -U 'LURCH\administrator%password' \
                                 ncacn_np:lutze[sign]
    rpcclient $> fss_create_expose backup ro hyper
    381884f2-b578-45ea-b8d2-cf82491f4011: shadow-copy set created
    ...
    share hyper@{B6137E21-9CBB-4547-A21D-E7AD40D0874B} exposed as a snapshot
    of \\lutze\hyper
    
    fss_delete removes the shadow-copy share:
    rpcclient $> fss_delete hyper 381884f2-b578-45ea-b8d2-cf82491f4011 \
                            b6137e21-9cbb-4547-a21d-e7ad40d0874
    
    Shadow-copies can be created read-write or read-only.
    Experimenting with Windows Server "8" beta, a recovery complete call is
    required after creating a read-write (ATTR_AUTO_RECOVERY) shadow copy.
    Otherwise subsequent creation requests fail with
    FSRVP_E_SHADOW_COPY_SET_IN_PROGRESS.

commit 2836787daa8e78efc7dd166c4f462ca392b3c4c2
Author: David Disseldorp <ddiss at samba.org>
Date:   Tue Feb 21 14:04:42 2012 +0100

    idl: add File Server Remote VSS Protocol idl
    
    MS-FSRVP preview documents used as reference.
    H_ERROR codes should be moved to a more generic file.

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

Summary of changes:
 docs-xml/manpages-3/rpcclient.1.xml |   45 +++
 librpc/idl/fsrvp.idl                |  113 ++++++
 librpc/idl/wscript_build            |    4 +-
 librpc/wscript_build                |   12 +-
 selftest/skip                       |    1 +
 source3/Makefile.in                 |    8 +-
 source3/librpc/rpc/rpc_common.c     |    4 +
 source3/rpcclient/cmd_fss.c         |  656 +++++++++++++++++++++++++++++++++++
 source3/rpcclient/rpcclient.c       |    2 +
 source3/wscript_build               |    3 +-
 source4/torture/rpc/fsrvp.c         |  571 ++++++++++++++++++++++++++++++
 source4/torture/rpc/rpc.c           |    1 +
 source4/torture/wscript_build       |    4 +-
 13 files changed, 1416 insertions(+), 8 deletions(-)
 create mode 100644 librpc/idl/fsrvp.idl
 create mode 100644 source3/rpcclient/cmd_fss.c
 create mode 100644 source4/torture/rpc/fsrvp.c


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/rpcclient.1.xml b/docs-xml/manpages-3/rpcclient.1.xml
index 275acf9..4e3d30c 100644
--- a/docs-xml/manpages-3/rpcclient.1.xml
+++ b/docs-xml/manpages-3/rpcclient.1.xml
@@ -427,6 +427,51 @@ Comma Separated list of Files
 	</refsect2>
 
 	<refsect2>
+	<title>FSRVP</title>
+	<variablelist>
+
+	<varlistentry><term>fss_is_path_sup</term>
+		<listitem>
+			<para>Check whether a share supports shadow-copy
+			requests</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry><term>fss_get_sup_version</term>
+		<listitem>
+			<para>Get supported FSRVP version from server</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry><term>fss_create_expose</term>
+		<listitem>
+			<para>Request shadow-copy creation and exposure</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry><term>fss_delete</term>
+		<listitem>
+			<para>Request shadow-copy share deletion</para>
+	</listitem>
+	</varlistentry>
+	<varlistentry><term>fss_has_shadow_copy</term>
+		<listitem>
+			<para>Check for an associated share shadow-copy</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry><term>fss_get_mapping</term>
+		<listitem>
+			<para>Get shadow-copy share mapping information</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry><term>fss_recovery_complete</term>
+		<listitem>
+			<para>Flag read-write snapshot as recovery complete,
+			allowing further shadow-copy requests</para>
+		</listitem>
+	</varlistentry>
+
+	</variablelist>
+	</refsect2>
+
+	<refsect2>
 	<title>GENERAL COMMANDS</title>
 
 	<variablelist>
diff --git a/librpc/idl/fsrvp.idl b/librpc/idl/fsrvp.idl
new file mode 100644
index 0000000..d61545b
--- /dev/null
+++ b/librpc/idl/fsrvp.idl
@@ -0,0 +1,113 @@
+#include "idl_types.h"
+
+/*
+ * File Server Remote VSS Protocol Definitions
+ */
+
+import "misc.idl";
+
+[ uuid("a8e0653c-2744-4389-a61d-7373df8b2292"),
+  version(1.0),
+  endpoint("ncacn_np:[\\pipe\\FssagentRpc]"),
+  helpstring("File Server Remote VSS Protocol"),
+  pointer_default(unique)
+] interface FileServerVssAgent
+{
+	const uint32 FSRVP_E_BAD_STATE = 0x80042301;
+	const uint32 FSRVP_E_SHADOW_COPY_SET_IN_PROGRESS = 0x80042316;
+	const uint32 FSRVP_E_NOT_SUPPORTED = 0x8004230C;
+	const uint32 FSRVP_E_WAIT_TIMEOUT = 0x00000102;
+	const uint32 FSRVP_E_WAIT_FAILED = 0xFFFFFFFF;
+	const uint32 FSRVP_E_OBJECT_ALREADY_EXISTS = 0x8004230D;
+	const uint32 FSRVP_E_OBJECT_NOT_FOUND = 0x80042308;
+	const uint32 FSRVP_E_BAD_ID = 0x80042302;	/* wire, not documented */
+
+	/* TODO move these to generic herror defines or COM in orpc.idl */
+	const uint32 E_ACCESSDENIED = 0x80070005;
+	const uint32 E_INVALIDARG = 0x80070057;
+	const uint32 E_OUTOFMEMORY = 0x80000002;
+
+	typedef struct {
+		GUID ShadowCopySetId;
+		GUID ShadowCopyId;
+		[string,charset(UTF16)] uint16 *ShareNameUNC;
+		[string,charset(UTF16)] uint16 *ShadowCopyShareName;
+		NTTIME tstamp;
+	} fssagent_share_mapping_1;
+
+	typedef union {
+		[case(1)] fssagent_share_mapping_1 *ShareMapping1;
+		[default];
+	} fssagent_share_mapping;
+
+	const uint32 FSRVP_RPC_VERSION_1 = 0x000000001;
+	DWORD fss_GetSupportedVersion(
+		[in] uint8 magic[52],		/* wire */
+		[out] uint32 *MinVersion,
+		[out] uint32 *MaxVersion);
+
+	const uint32 ATTR_PERSISTENT = 0x00000001;
+	const uint32 ATTR_NO_AUTO_RECOVERY = 0x00000002;
+	const uint32 ATTR_NO_AUTO_RELEASE = 0x00000008;
+	const uint32 ATTR_NO_WRITERS = 0x00000010;
+	const uint32 ATTR_FILE_SHARE = 0x04000000;
+	const uint32 ATTR_AUTO_RECOVERY = 0x00400000;
+
+	const uint32 FSRVP_CTX_BACKUP = 0x00000000;
+	const uint32 FSRVP_CTX_FILE_SHARE_BACKUP = 0x00000010;
+	const uint32 FSRVP_CTX_NAS_ROLLBACK = 0x00000019;
+	const uint32 FSRVP_CTX_APP_ROLLBACK = 0x00000009;
+	DWORD fss_SetContext(
+		[in] uint32 Context);
+
+	DWORD fss_StartShadowCopySet(
+		[in] GUID ClientShadowCopySetId,
+		[out] GUID *pShadowCopySetId);
+
+	DWORD fss_AddToShadowCopySet(
+		[in] GUID ClientShadowCopyId,
+		[in] GUID ShadowCopySetId,
+		[in] [string,charset(UTF16)] uint16 *ShareName,
+		[out] GUID *pShadowCopyId);
+
+	DWORD fss_CommitShadowCopySet(
+		[in] GUID ShadowCopySetId,
+		[in] uint32 TimeOutInMilliseconds);
+
+	DWORD fss_ExposeShadowCopySet(
+		[in] GUID ShadowCopySetId,
+		[in] uint32 TimeOutInMilliseconds);
+
+	DWORD fss_RecoveryCompleteShadowCopySet(
+		[in] GUID ShadowCopySetId);
+
+	DWORD fss_AbortShadowCopySet(
+		[in] GUID ShadowCopySetId);
+
+	DWORD fss_IsPathSupported(
+		[in] [string,charset(UTF16)] uint16 *ShareName,
+		[in] uint8 magic[52],				/* wire */
+		[out] boolean32 *SupportedByThisProvider,
+		[out] [string,charset(UTF16)] uint16 **OwnerMachineName);
+
+	DWORD fss_IsPathShadowCopied(
+		[in] [string,charset(UTF16)] uint16 *ShareName,
+		[out] boolean32 *ShadowCopyPresent,
+		[out] int32 *ShadowCopyCompatibility);
+
+	DWORD fss_GetShareMapping(
+		[in] GUID ShadowCopyId,
+		[in] GUID ShadowCopySetId,
+		[in] [string,charset(UTF16)] uint16 *ShareName,
+		[in] uint32 Level,
+		[out,switch_is(Level)] fssagent_share_mapping *ShareMapping);
+
+	DWORD fss_DeleteShareMapping(
+		[in] GUID ShadowCopySetId,
+		[in] GUID ShadowCopyId,
+		[in] [string,charset(UTF16)] uint16 *ShareName);
+
+	DWORD fss_PrepareShadowCopySet(
+		[in] GUID ShadowCopySetId,
+		[in] uint32 TimeOutInMilliseconds);
+}
diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build
index c90edf1..58d3181 100644
--- a/librpc/idl/wscript_build
+++ b/librpc/idl/wscript_build
@@ -12,7 +12,7 @@ bld.SAMBA_PIDL_LIST('PIDL',
                        drsblobs.idl efs.idl frstrans.idl mgmt.idl netlogon.idl
                        notify.idl
                        policyagent.idl scerpc.idl svcctl.idl wkssvc.idl eventlog6.idl backupkey.idl
-                       printcap.idl''',
+                       fsrvp.idl''',
                     options='--header --ndr-parser --samba3-ndr-server --server --client --python',
                     output_dir='../gen_ndr')
 
@@ -27,7 +27,7 @@ bld.SAMBA_PIDL_LIST('PIDL',
                     output_dir='../gen_ndr')
 
 bld.SAMBA_PIDL_LIST('PIDL',
-                    'rap.idl ntprinting.idl preg.idl ioctl.idl',
+                    'rap.idl ntprinting.idl preg.idl ioctl.idl printcap.idl',
                     options='--header --ndr-parser',
                     output_dir='../gen_ndr')
 
diff --git a/librpc/wscript_build b/librpc/wscript_build
index a94ff8d..46570ae 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -285,6 +285,11 @@ bld.SAMBA_SUBSYSTEM('NDR_COMPRESSION',
     deps='z LZXPRESS'
     )
 
+bld.SAMBA_SUBSYSTEM('NDR_FSRVP',
+	source='gen_ndr/ndr_fsrvp.c',
+	public_deps='ndr'
+	)
+
 bld.SAMBA_SUBSYSTEM('NDR_DCERPC',
     source='gen_ndr/ndr_dcerpc.c',
     public_deps='ndr',
@@ -579,12 +584,17 @@ bld.SAMBA_SUBSYSTEM('NDR_IOCTL',
     public_deps='ndr'
     )
 
+bld.SAMBA_SUBSYSTEM('RPC_NDR_FSRVP',
+	source='gen_ndr/ndr_fsrvp_c.c',
+	public_deps='dcerpc-binding NDR_FSRVP'
+	)
+
 # a grouping library for NDR subsystems that may be used by more than one target
 bld.SAMBA_LIBRARY('ndr-samba',
     source=[],
     deps='''NDR_DRSBLOBS NDR_DRSUAPI NDR_IDMAP NDR_NTLMSSP NDR_SCHANNEL NDR_MGMT
     NDR_DNSP NDR_EPMAPPER NDR_XATTR NDR_UNIXINFO NDR_NAMED_PIPE_AUTH NDR_DCOM
-    NDR_NTPRINTING''',
+    NDR_NTPRINTING NDR_FSRVP''',
     private_library=True,
     grouping_library=True
     )
diff --git a/selftest/skip b/selftest/skip
index f2f6b69..174f257 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -76,6 +76,7 @@
 ^samba4.rpc.frsapi							# Not provided by Samba 4
 ^samba4.rpc.ntsvcs							# Not provided by Samba 4
 ^samba4.rpc.dfs								# Not provided by Samba 4
+^samba4.rpc.fsrvp							# fsrvp server support not yet provided
 ^samba4.*.base.samba3.*						# Samba3-specific test
 ^samba4.*.raw.samba3.*						# Samba3-specific test
 ^samba4.rpc..*samba3.*						# Samba3-specific test
diff --git a/source3/Makefile.in b/source3/Makefile.in
index fe05250..9271baa 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -380,6 +380,8 @@ LIBCLI_NETLOGON_OBJ = autoconf/librpc/gen_ndr/ndr_netlogon_c.o \
 
 LIBCLI_EPMAPPER_OBJ = autoconf/librpc/gen_ndr/ndr_epmapper_c.o
 
+LIBCLI_FSRVP_OBJ = autoconf/librpc/gen_ndr/ndr_fsrvp_c.o
+
 LIBNDR_GEN_OBJ = autoconf/librpc/gen_ndr/ndr_wkssvc.o \
 		 $(LIBNDR_GEN_OBJ0) \
 		 autoconf/librpc/gen_ndr/ndr_dfs.o \
@@ -393,7 +395,8 @@ LIBNDR_GEN_OBJ = autoconf/librpc/gen_ndr/ndr_wkssvc.o \
 		 autoconf/librpc/gen_ndr/ndr_dssetup.o \
 		 autoconf/librpc/gen_ndr/ndr_epmapper.o \
 		 autoconf/librpc/gen_ndr/ndr_ntsvcs.o \
-		 $(LIBNDR_SPOOLSS_OBJ)
+		 $(LIBNDR_SPOOLSS_OBJ) \
+		 autoconf/librpc/gen_ndr/ndr_fsrvp.o
 
 # this includes only the low level parse code, not stuff
 # that requires knowledge of security contexts
@@ -1089,7 +1092,7 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
 		 rpcclient/cmd_shutdown.o rpcclient/cmd_test.o \
 		 rpcclient/cmd_wkssvc.o rpcclient/cmd_ntsvcs.o \
 		 rpcclient/cmd_drsuapi.o rpcclient/cmd_eventlog.o \
-		 rpcclient/cmd_winreg.o \
+		 rpcclient/cmd_winreg.o rpcclient/cmd_fss.o \
 		 $(DISPLAY_SEC_OBJ)
 
 RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
@@ -1111,6 +1114,7 @@ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
 	     $(LIBCLI_SAMR_OBJ) \
 	     $(LIBCLI_WINREG_OBJ) \
 	     $(LIBCLI_NETLOGON_OBJ) \
+	     $(LIBCLI_FSRVP_OBJ) \
 	     $(RPC_CLIENT_SCHANNEL_OBJ) \
 	     rpc_client/init_netlogon.o \
 	     rpc_client/init_samr.o
diff --git a/source3/librpc/rpc/rpc_common.c b/source3/librpc/rpc/rpc_common.c
index 65e3205..1219b2d 100644
--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -35,6 +35,7 @@
 #include "../librpc/gen_ndr/ndr_ntsvcs.h"
 #include "../librpc/gen_ndr/ndr_epmapper.h"
 #include "../librpc/gen_ndr/ndr_drsuapi.h"
+#include "../librpc/gen_ndr/ndr_fsrvp.h"
 
 static const char *get_pipe_name_from_iface(
 	TALLOC_CTX *mem_ctx, const struct ndr_interface_table *interface)
@@ -140,6 +141,9 @@ static bool initialize_interfaces(void)
 	if (!smb_register_ndr_interface(&ndr_table_drsuapi)) {
 		return false;
 	}
+	if (!smb_register_ndr_interface(&ndr_table_FileServerVssAgent)) {
+		return false;
+	}
 	return true;
 }
 
diff --git a/source3/rpcclient/cmd_fss.c b/source3/rpcclient/cmd_fss.c
new file mode 100644
index 0000000..56d9141
--- /dev/null
+++ b/source3/rpcclient/cmd_fss.c
@@ -0,0 +1,656 @@
+/*
+ * Unix SMB/CIFS implementation.
+ *
+ * File Server Remote VSS Protocol (FSRVP) client
+ *
+ * Copyright (C) David Disseldorp 2012
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "rpcclient.h"
+#include "../librpc/gen_ndr/ndr_fsrvp.h"
+#include "../librpc/gen_ndr/ndr_fsrvp_c.h"
+
+struct fss_context_map {
+	uint32_t ctx_val;
+	const char *ctx_str;
+	const char *ctx_desc;
+};
+struct fss_context_map ctx_map[] = {
+	{
+		.ctx_val = FSRVP_CTX_BACKUP,
+		.ctx_str = "backup",
+		.ctx_desc = "auto-release, non-persistent shadow-copy.",
+	},
+	{
+		.ctx_val = FSRVP_CTX_FILE_SHARE_BACKUP,
+		.ctx_str = "file_share_backup",
+		.ctx_desc = "auto-release, non-persistent shadow-copy created "
+			    "without writer involvement.",
+	},
+	{
+		.ctx_val = FSRVP_CTX_NAS_ROLLBACK,
+		.ctx_str = "nas_rollback",
+		.ctx_desc = "non-auto-release, persistent shadow-copy created "
+			    "without writer involvement.",
+	},
+	{
+		.ctx_val = FSRVP_CTX_APP_ROLLBACK,
+		.ctx_str = "app_rollback",
+		.ctx_desc = "non-auto-release, persistent shadow-copy.",
+	},
+	{ 0, NULL, NULL },
+};
+
+static bool map_fss_ctx_str(const char *ctx_str,
+			    uint32_t *ctx_val)
+{
+	int i;
+
+	for (i = 0; ctx_map[i].ctx_str != NULL; i++) {
+		if (!strcmp(ctx_map[i].ctx_str, ctx_str)) {
+			*ctx_val = ctx_map[i].ctx_val;
+			return true;
+		}
+	}
+	return false;
+}
+
+static void cmd_fss_is_path_sup_usage(const char *script_name)
+{
+	printf("usage: %s [share_name]\n", script_name);
+}
+
+static NTSTATUS cmd_fss_is_path_sup(struct rpc_pipe_client *cli,
+				    TALLOC_CTX *mem_ctx, int argc,
+				    const char **argv)
+{
+	NTSTATUS status;
+	struct fss_IsPathSupported r;
+	struct dcerpc_binding_handle *b = cli->binding_handle;
+
+	if (argc != 2) {
+		cmd_fss_is_path_sup_usage(argv[0]);
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+
+	ZERO_STRUCT(r);
+	r.in.ShareName = talloc_asprintf(mem_ctx, "%s\\%s",
+					 cli->srv_name_slash, argv[1]);
+	if (r.in.ShareName == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	status = dcerpc_fss_IsPathSupported_r(b, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(0, ("IsPathSupported failed with UNC %s\n",
+			  r.in.ShareName));
+		return NT_STATUS_UNSUCCESSFUL;
+	} else if (r.out.result) {
+		DEBUG(0, ("failed IsPathSupported response: 0x%x\n",
+			  r.out.result));
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+	printf("UNC %s %s shadow copy requests\n", r.in.ShareName,
+	       *r.out.SupportedByThisProvider ? "supports" : "does not support");
+
+	return NT_STATUS_OK;
+}
+
+static void cmd_fss_get_sup_version_usage(const char *script_name)
+{
+	printf("usage: %s\n", script_name);
+}
+
+static NTSTATUS cmd_fss_get_sup_version(struct rpc_pipe_client *cli,
+				    TALLOC_CTX *mem_ctx, int argc,
+				    const char **argv)
+{
+	NTSTATUS status;
+	struct fss_GetSupportedVersion r;
+	struct dcerpc_binding_handle *b = cli->binding_handle;
+
+	if (argc != 1) {
+		cmd_fss_get_sup_version_usage(argv[0]);
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+
+	ZERO_STRUCT(r);
+	status = dcerpc_fss_GetSupportedVersion_r(b, mem_ctx, &r);
+	if (!NT_STATUS_IS_OK(status) || (r.out.result != 0)) {
+		DEBUG(0, ("GetSupportedVersion failed: %s result: 0x%x\n",
+			  nt_errstr(status), r.out.result));
+		return NT_STATUS_UNSUCCESSFUL;
+	}
+	printf("server %s supports FSRVP versions from %u to %u\n",
+	       cli->desthost, *r.out.MinVersion, *r.out.MaxVersion);
+
+	return NT_STATUS_OK;
+}
+
+static void cmd_fss_create_expose_usage(const char *script_name)
+{
+	int i;
+
+	printf("usage: %s [fss_context] [ro|rw] [share1] <share2> ...\n"
+	       "[fss_context] values:\n", script_name);
+	for (i = 0; ctx_map[i].ctx_str != NULL; i++) {
+		printf("\t%s: %s\n", ctx_map[i].ctx_str, ctx_map[i].ctx_desc);
+	}
+}
+
+static NTSTATUS cmd_fss_create_expose_parse(TALLOC_CTX *mem_ctx, int argc,
+					    const char **argv,
+					    const char *desthost,
+					    uint32_t *fss_ctx_val,
+					    int *num_maps,
+					 struct fssagent_share_mapping_1 **maps)
+{
+	int num_non_share_args = 3;
+	int num_share_args;
+	int i;
+	struct fssagent_share_mapping_1 *map_array;
+
+	if (argc < 4) {
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
+	if (!map_fss_ctx_str(argv[1], fss_ctx_val)) {
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
+	if (!strcmp(argv[2], "rw")) {
+		/* shadow-copy is created as read-write */
+		*fss_ctx_val |= ATTR_AUTO_RECOVERY;
+	} else if (strcmp(argv[2], "ro")) {
+		return NT_STATUS_INVALID_PARAMETER;
+	}
+
+	num_share_args = argc - num_non_share_args;
+	map_array = talloc_array(mem_ctx, struct fssagent_share_mapping_1,
+				 num_share_args);
+	if (map_array == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
+


-- 
Samba Shared Repository


More information about the samba-cvs mailing list