selftest: Add callout scripts for RPC SRVSVC share modifications
authorChristof Schmitt <cs@samba.org>
Fri, 12 Jun 2015 15:37:30 +0000 (08:37 -0700)
committerVolker Lendecke <vl@samba.org>
Thu, 18 Jun 2015 14:32:15 +0000 (16:32 +0200)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
selftest/target/Samba3.pm
source3/script/smbaddshare [new file with mode: 0755]
source3/script/smbchangeshare [new file with mode: 0755]
source3/script/smbdeleteshare [new file with mode: 0755]
source3/script/wscript_build

index 50898f2010d86a350ead14cf344a597b57bddccb..f7f663206c2ece60c627da2f0fc791385e182ecb 100755 (executable)
@@ -1214,6 +1214,11 @@ sub provision($$$$$$$$)
        # fsrvp server requires registry shares
        registry shares = yes
 
+       # Used by RPC SRVSVC tests
+       add share command = $bindir_abs/smbaddshare
+       change share command = $bindir_abs/smbchangeshare
+       delete share command = $bindir_abs/smbdeleteshare
+
        # Begin extra options
        $extra_options
        # End extra options
diff --git a/source3/script/smbaddshare b/source3/script/smbaddshare
new file mode 100755 (executable)
index 0000000..62f1bdf
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# smbaddshare
+#
+# Copyright (C) 2015 Christof Schmitt
+#
+# Example script that can be used with the 'add share command' config
+# option. This is mainly intended for use in the Samba selftest suite,
+# please review and adapt it before using elsewhere.
+#
+
+CONF="$1"
+SHARENAME="$2"
+SHAREPATH="$3"
+COMMENT="$4"
+MAX_CONN="$5"
+
+NETCONF="$BINDIR/net --configfile=$CONF conf"
+
+$NETCONF addshare "$SHARENAME" "$SHAREPATH" writeable=no guest_ok=no "$COMMENT"
+RC=$?
+if [[ $RC -ne 0 ]]; then
+       echo Failure during addshare: rc=$RC
+       exit $RC
+fi
+
+$NETCONF setparm "$SHARENAME" 'max connections' "$MAX_CONN"
+RC=$?
+if [[ $RC -ne 0 ]]; then
+       echo Failure during setparm for max connections: rc=$RC
+       exit $RC
+fi
diff --git a/source3/script/smbchangeshare b/source3/script/smbchangeshare
new file mode 100755 (executable)
index 0000000..2f3fa3b
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# smbchangeshare
+#
+# Copyright (C) 2015 Christof Schmitt
+#
+# Example script that can be used with the 'change share command'
+# config option. This is mainly intended for use in the Samba selftest
+# suite, please review and adapt it before using elsewhere.
+#
+
+CONF="$1"
+SHARENAME="$2"
+SHAREPATH="$3"
+COMMENT="$4"
+MAX_CONN="$5"
+CSC_POLICY="$6"
+
+NETCONF="$BINDIR/net --configfile=$CONF conf"
+
+$NETCONF setparm "$SHARENAME" 'path' "$SHAREPATH"
+RC=$?
+if [[ $RC -ne 0 ]]; then
+       echo Failure during setparm for path: rc=$RC
+       exit $RC
+fi
+
+$NETCONF setparm "$SHARENAME" 'comment' "$COMMENT"
+RC=$?
+if [[ $RC -ne 0 ]]; then
+       echo Failed during setparm for comment: rc=$RC
+       exit $RC
+fi
+
+$NETCONF setparm "$SHARENAME" 'max connections' "$MAX_CONN"
+RC=$?
+if [[ $RC -ne 0 ]]; then
+       echo Failure during setparm for max connections: rc=$RC
+       exit $RC
+fi
+
+$NETCONF setparm "$SHARENAME" 'csc policy' "$CSC_POLICY"
+RC=$?
+if [[ $RC -ne 0 ]]; then
+       echo Failure during setparm for csc policy: rc=$RC
+       exit $RC
+fi
diff --git a/source3/script/smbdeleteshare b/source3/script/smbdeleteshare
new file mode 100755 (executable)
index 0000000..8cd8d1f
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# smbdeleteshare
+#
+# Copyright (C) 2015 Christof Schmitt
+#
+# Example script that can be used with the 'delete share command'
+# config option. This is mainly intended for use in the Samba selftest
+# suite, please review and adapt it before using elsewhere.
+#
+
+CONF="$1"
+SHARENAME="$2"
+
+NETCONF="$BINDIR/net --configfile=$CONF conf"
+$NETCONF delshare "$SHARENAME"
+RC=$?
+if [[ $RC -ne 0 ]]; then
+       echo Failure during delshare command: rc=$RC
+       exit $RC
+fi
index fc59a65687cb871c90c740a6a9c72e44f4eed94a..56c904fe349fea81a2d9210b1d9e2e313f5ce365 100644 (file)
@@ -5,3 +5,8 @@ from samba_utils import MODE_755
 bld.INSTALL_FILES('${BINDIR}',
                  'smbtar',
                   chmod=MODE_755, flat=True)
+
+# Callout scripts for use in selftest environment
+bld.SAMBA_SCRIPT('smbaddshare', pattern='smbaddshare', installdir='.')
+bld.SAMBA_SCRIPT('smbchangeshare', pattern='smbchangeshare', installdir='.')
+bld.SAMBA_SCRIPT('smbdeleteshare', pattern='smbdeleteshare', installdir='.')