diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 17:20:00 +0000 |
commit | 8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch) | |
tree | 4099e8021376c7d8c05bdf8503093d80e9c7bad0 /ctdb/tests/UNIT/eventscripts/stubs/testparm | |
parent | Initial commit. (diff) | |
download | samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip |
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | ctdb/tests/UNIT/eventscripts/stubs/testparm | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/ctdb/tests/UNIT/eventscripts/stubs/testparm b/ctdb/tests/UNIT/eventscripts/stubs/testparm new file mode 100755 index 0000000..3a97e91 --- /dev/null +++ b/ctdb/tests/UNIT/eventscripts/stubs/testparm @@ -0,0 +1,84 @@ +#!/bin/sh + +not_implemented() +{ + echo "testparm: option \"$1\" not implemented in stub" >&2 + exit 2 +} + +error() +{ + cat >&2 <<EOF +Load smb config files from ${CTDB_SYS_ETCDIR}/samba/smb.conf +rlimit_max: increasing rlimit_max (2048) to minimum Windows limit (16384) +EOF + + for i in $FAKE_SHARES; do + bi=$(basename "$i") + echo "Processing section \"[${bi}]\"" + done >&2 + + cat >&2 <<EOF +Loaded services file OK. +WARNING: 'workgroup' and 'netbios name' must differ. + +EOF + + exit 1 +} + +timeout() +{ + echo "$0: INTERNAL ERROR - timeout stub should avoid this" >&2 +} + +if [ -n "$FAKE_TESTPARM_FAIL" ]; then + error +fi + +if [ -n "$FAKE_TIMEOUT" ]; then + timeout +fi + +# Ensure that testparm always uses our canned configuration instead of +# the global one, unless some other file is specified. + +file="" +param="" +for i; do + case "$i" in + --parameter-name=*) param="${i#--parameter-name=}" ;; + -*) : ;; + *) file="$i" ;; + esac +done + +# Parse out parameter request +if [ -n "$param" ]; then + sed -n \ + -e "s|^[[:space:]]*${param}[[:space:]]*=[[:space:]]\(..*\)|\1|p" \ + "${file:-"${CTDB_SYS_ETCDIR}/samba/smb.conf"}" + exit 0 +fi + +if [ -n "$file" ]; then + # This should include the shares, since this is used when the + # samba eventscript caches the output. + cat "$file" +else + # We force our own smb.conf and add the shares. + cat "${CTDB_SYS_ETCDIR}/samba/smb.conf" + + for i in $FAKE_SHARES; do + bi=$(basename "$i") + cat <<EOF + +[${bi}] + path = $i + comment = fake share $bi + guest ok = no + read only = no + browsable = yes +EOF + done +fi |