summaryrefslogtreecommitdiffstats
path: root/selftest/checkpassword_arg1.sh
diff options
context:
space:
mode:
Diffstat (limited to 'selftest/checkpassword_arg1.sh')
-rwxr-xr-xselftest/checkpassword_arg1.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/selftest/checkpassword_arg1.sh b/selftest/checkpassword_arg1.sh
new file mode 100755
index 0000000..ecaeb2e
--- /dev/null
+++ b/selftest/checkpassword_arg1.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+
+set -e
+set -u
+
+ACCOUNT_NAME="${SAMBA_CPS_ACCOUNT_NAME}"
+INVALIDPW="$1"
+NEWPW=$(cat -)
+
+echo -n "${NEWPW}" | grep -q "^${INVALIDPW}\$" && {
+ echo "Found invalid password" >&1
+ exit 1
+}
+
+echo -n "${NEWPW}" | grep -q "^${ACCOUNT_NAME}\$" && {
+ echo "Password includes ACCOUNT_NAME" >&1
+ exit 1
+}
+
+exit 0