]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python: Reformat shell scripts
authorAndreas Schneider <asn@samba.org>
Mon, 21 Feb 2022 12:59:33 +0000 (13:59 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 3 Mar 2022 00:59:34 +0000 (00:59 +0000)
shfmt -f python/ | xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/pyasn1_regen.sh
python/samba/tests/samba_tool/computer_edit.sh
python/samba/tests/samba_tool/contact_edit.sh
python/samba/tests/samba_tool/group_edit.sh
python/samba/tests/samba_tool/user_edit.sh
python/samba/tests/test_pam_winbind.sh
python/samba/tests/test_pam_winbind_chauthtok.sh
python/samba/tests/test_pam_winbind_warn_pwd_expire.sh

index 2e3995688f2374235c2ad32aacb5566498b7363e..75b39888572a941d9c5537a392f2d046e857b6e0 100755 (executable)
@@ -12,7 +12,8 @@ PATH_TO_ASN1_INPUT_FILE=$2
 set -u
 set -e
 
-usage() {
+usage()
+{
        echo "usage: $0 PATH_TO_ASN1ATE_CHECKOUT PATH_TO_ASN1_INPUT_FILE > PATH_TO_PYASN1_OUTPUT_FILE"
 }
 
index 9830fe3f6816d726448ea76bbdb302ffb054ab2d..a52128c6589d44bba0e51862c6de635eb8a69799 100755 (executable)
@@ -3,10 +3,10 @@
 # Test for 'samba-tool computer edit'
 
 if [ $# -lt 3 ]; then
-cat <<EOF
+       cat <<EOF
 Usage: computer_edit.sh SERVER USERNAME PASSWORD
 EOF
-exit 1;
+       exit 1
 fi
 
 SERVER="$1"
@@ -26,13 +26,15 @@ display_name_con_b64="dGVzdCAHIHN0cmluZwo="
 tmpeditor=$(mktemp --suffix .sh -p $SELFTEST_TMPDIR samba-tool-editor-XXXXXXXX)
 chmod +x $tmpeditor
 
-create_test_computer() {
+create_test_computer()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                computer create testmachine1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-edit_computer() {
+edit_computer()
+{
        # create editor.sh
        # enable computer account
        cat >$tmpeditor <<-'EOF'
@@ -48,7 +50,8 @@ EOF
 }
 
 # Test edit computer - add base64 attributes
-add_attribute_base64() {
+add_attribute_base64()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -65,12 +68,14 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64() {
+get_attribute_base64()
+{
        ${STpath}/bin/ldbsearch '(sAMAccountName=testmachine1$)' displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_attribute() {
+delete_attribute()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -85,7 +90,8 @@ EOF
 }
 
 # Test edit computer - add base64 attribute value including control character
-add_attribute_base64_control() {
+add_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -101,13 +107,15 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
+get_attribute_base64_control()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \
                testmachine1 --attributes=displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_force_no_base64() {
+get_attribute_force_no_base64()
+{
        # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \
                testmachine1 --attributes=displayName \
@@ -115,7 +123,8 @@ get_attribute_force_no_base64() {
 }
 
 # Test edit computer - change base64 attribute value including control character
-change_attribute_base64_control() {
+change_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -130,7 +139,8 @@ EOF
 }
 
 # Test edit computer - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
-change_attribute_force_no_base64() {
+change_attribute_force_no_base64()
+{
        # create editor.sh
        # Expects that the original attribute is available as clear text,
        # because the LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
@@ -147,13 +157,15 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_changed_attribute_force_no_base64() {
+get_changed_attribute_force_no_base64()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool computer show \
-                testmachine1 --attributes=displayName \
-                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+               testmachine1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_computer() {
+delete_computer()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                computer delete testmachine1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
@@ -161,19 +173,19 @@ delete_computer() {
 
 failed=0
 
-testit "create_test_computer" create_test_computer || failed=`expr $failed + 1`
-testit "edit_computer" edit_computer || failed=`expr $failed + 1`
-testit "add_attribute_base64" add_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
-testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
-testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "delete_computer" delete_computer || failed=`expr $failed + 1`
+testit "create_test_computer" create_test_computer || failed=$(expr $failed + 1)
+testit "edit_computer" edit_computer || failed=$(expr $failed + 1)
+testit "add_attribute_base64" add_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit "delete_attribute" delete_attribute || failed=$(expr $failed + 1)
+testit "add_attribute_base64_control" add_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=$(expr $failed + 1)
+testit "change_attribute_base64_control" change_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "delete_computer" delete_computer || failed=$(expr $failed + 1)
 
 rm -f $tmpeditor
 
index 05eac69c4e623adaafff26de335a91628415cd7e..3c14ac8de264da15bd1fb20f36af95176195ce1a 100755 (executable)
@@ -3,10 +3,10 @@
 # Test for 'samba-tool contact edit'
 
 if [ $# -lt 3 ]; then
-cat <<EOF
+       cat <<EOF
 Usage: contact_edit.sh SERVER USERNAME PASSWORD
 EOF
-exit 1;
+       exit 1
 fi
 
 SERVER="$1"
@@ -15,7 +15,7 @@ PASSWORD="$3"
 
 samba_ldbsearch=ldbsearch
 if test -x $BINDIR/ldbsearch; then
-    samba_ldbsearch=$BINDIR/ldbsearch
+       samba_ldbsearch=$BINDIR/ldbsearch
 fi
 
 STpath=$(pwd)
@@ -31,14 +31,16 @@ display_name_con_b64="dGVzdCAHIHN0cmluZwo="
 tmpeditor=$(mktemp --suffix .sh -p $SELFTEST_TMPDIR samba-tool-editor-XXXXXXXX)
 chmod +x $tmpeditor
 
-create_test_contact() {
+create_test_contact()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                contact create testcontact1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
 # Test edit contact - add base64 attributes
-add_attribute_base64() {
+add_attribute_base64()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -55,13 +57,15 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64() {
+get_attribute_base64()
+{
        $samba_ldbsearch '(&(objectClass=contact)(name=testcontact1))' \
                displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_attribute() {
+delete_attribute()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -76,7 +80,8 @@ EOF
 }
 
 # Test edit contact - add base64 attribute value including control character
-add_attribute_base64_control() {
+add_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -92,21 +97,24 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
+get_attribute_base64_control()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool contact show \
                testcontact1 --attributes=displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_force_no_base64() {
-       # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
-       $PYTHON ${STpath}/source4/scripting/bin/samba-tool contact show \
-               testcontact1 --attributes=displayName \
-               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+get_attribute_force_no_base64()
+{
+       # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
+       $PYTHON ${STpath}/source4/scripting/bin/samba-tool contact show \
+               testcontact1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
 # Test edit contact - change base64 attribute value including control character
-change_attribute_base64_control() {
+change_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -121,7 +129,8 @@ EOF
 }
 
 # Test edit contact - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
-change_attribute_force_no_base64() {
+change_attribute_force_no_base64()
+{
        # create editor.sh
        # Expects that the original attribute is available as clear text,
        # because the LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
@@ -138,13 +147,15 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_changed_attribute_force_no_base64() {
+get_changed_attribute_force_no_base64()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool contact show \
-                testcontact1 --attributes=displayName \
-                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+               testcontact1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_contact() {
+delete_contact()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                contact delete testcontact1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
@@ -152,18 +163,18 @@ delete_contact() {
 
 failed=0
 
-testit "create_test_contact" create_test_contact || failed=`expr $failed + 1`
-testit "add_attribute_base64" add_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
-testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
-testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "delete_contact" delete_contact || failed=`expr $failed + 1`
+testit "create_test_contact" create_test_contact || failed=$(expr $failed + 1)
+testit "add_attribute_base64" add_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit "delete_attribute" delete_attribute || failed=$(expr $failed + 1)
+testit "add_attribute_base64_control" add_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=$(expr $failed + 1)
+testit "change_attribute_base64_control" change_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "delete_contact" delete_contact || failed=$(expr $failed + 1)
 
 rm -f $tmpeditor
 
index 4e8c6dffa2d8444d4cd0f5188976ad84f009e620..3db2c66ea603fd4d6a4dab56b558bc00bb6be634 100755 (executable)
@@ -3,10 +3,10 @@
 # Test for 'samba-tool group edit'
 
 if [ $# -lt 3 ]; then
-cat <<EOF
+       cat <<EOF
 Usage: group_edit.sh SERVER USERNAME PASSWORD
 EOF
-exit 1;
+       exit 1
 fi
 
 SERVER="$1"
@@ -15,7 +15,7 @@ PASSWORD="$3"
 
 samba_ldbsearch=ldbsearch
 if test -x $BINDIR/ldbsearch; then
-    samba_ldbsearch=$BINDIR/ldbsearch
+       samba_ldbsearch=$BINDIR/ldbsearch
 fi
 
 STpath=$(pwd)
@@ -31,34 +31,39 @@ display_name_con_b64="dGVzdCAHIHN0cmluZwo="
 tmpeditor=$(mktemp --suffix .sh -p $SELFTEST_TMPDIR samba-tool-editor-XXXXXXXX)
 chmod +x $tmpeditor
 
-create_test_group() {
+create_test_group()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                group add testgroup1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_test_group() {
+delete_test_group()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                group delete testgroup1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-create_test_user() {
+create_test_user()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                user create testuser1 --random-password \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_test_user() {
+delete_test_user()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                user delete testuser1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-add_member() {
+add_member()
+{
        user_dn=$($PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                user show testuser1 --attributes=dn \
-               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" | \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" |
                grep ^dn: | cut -d' ' -f2)
 
        # create editor.sh
@@ -77,14 +82,16 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_member() {
+get_member()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                group listmembers testgroup1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
 # Test edit group - add base64 attributes
-add_attribute_base64() {
+add_attribute_base64()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -101,12 +108,14 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64() {
+get_attribute_base64()
+{
        $samba_ldbsearch '(sAMAccountName=testgroup1)' displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_attribute() {
+delete_attribute()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -121,7 +130,8 @@ EOF
 }
 
 # Test edit group - add base64 attribute value including control character
-add_attribute_base64_control() {
+add_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -137,21 +147,24 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
+get_attribute_base64_control()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \
                testgroup1 --attributes=displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_force_no_base64() {
-       # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
-       $PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \
-               testgroup1 --attributes=displayName \
-               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+get_attribute_force_no_base64()
+{
+       # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
+       $PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \
+               testgroup1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
 # Test edit group - change base64 attribute value including control character
-change_attribute_base64_control() {
+change_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -166,7 +179,8 @@ EOF
 }
 
 # Test edit group - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
-change_attribute_force_no_base64() {
+change_attribute_force_no_base64()
+{
        # create editor.sh
        # Expects that the original attribute is available as clear text,
        # because the LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
@@ -183,30 +197,31 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_changed_attribute_force_no_base64() {
+get_changed_attribute_force_no_base64()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool group show \
-                testgroup1 --attributes=displayName \
-                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+               testgroup1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
 failed=0
 
-testit "create_test_group" create_test_group || failed=`expr $failed + 1`
-testit "create_test_user" create_test_user || failed=`expr $failed + 1`
-testit "add_member" add_member || failed=`expr $failed + 1`
-testit_grep "get_member" "^testuser1" get_member || failed=`expr $failed + 1`
-testit "add_attribute_base64" add_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
-testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
-testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "delete_test_group" delete_test_group || failed=`expr $failed + 1`
-testit "delete_test_user" delete_test_user || failed=`expr $failed + 1`
+testit "create_test_group" create_test_group || failed=$(expr $failed + 1)
+testit "create_test_user" create_test_user || failed=$(expr $failed + 1)
+testit "add_member" add_member || failed=$(expr $failed + 1)
+testit_grep "get_member" "^testuser1" get_member || failed=$(expr $failed + 1)
+testit "add_attribute_base64" add_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit "delete_attribute" delete_attribute || failed=$(expr $failed + 1)
+testit "add_attribute_base64_control" add_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=$(expr $failed + 1)
+testit "change_attribute_base64_control" change_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "delete_test_group" delete_test_group || failed=$(expr $failed + 1)
+testit "delete_test_user" delete_test_user || failed=$(expr $failed + 1)
 
 rm -f $tmpeditor
 
index cff646955dbb51f19b36cfa6818544fea7918548..81a62bb269c7b6367890b49a5b86e0c3b2e8a450 100755 (executable)
@@ -3,10 +3,10 @@
 # Test for 'samba-tool user edit'
 
 if [ $# -lt 3 ]; then
-cat <<EOF
+       cat <<EOF
 Usage: user_edit.sh SERVER USERNAME PASSWORD
 EOF
-exit 1;
+       exit 1
 fi
 
 SERVER="$1"
@@ -15,7 +15,7 @@ PASSWORD="$3"
 
 samba_ldbsearch=ldbsearch
 if test -x $BINDIR/ldbsearch; then
-    samba_ldbsearch=$BINDIR/ldbsearch
+       samba_ldbsearch=$BINDIR/ldbsearch
 fi
 
 STpath=$(pwd)
@@ -31,28 +31,31 @@ display_name_con_b64="dGVzdCAHIHN0cmluZwo="
 tmpeditor=$(mktemp --suffix .sh -p ${SELFTEST_TMPDIR} samba-tool-editor-XXXXXXXX)
 chmod +x $tmpeditor
 
-create_test_user() {
+create_test_user()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                user create sambatool1 --random-password \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-edit_user() {
+edit_user()
+{
        # create editor.sh
        cat >$tmpeditor <<-'EOF'
 #!/usr/bin/env bash
 user_ldif="$1"
 SED=$(which sed)
 $SED -i -e 's/userAccountControl: 512/userAccountControl: 514/' $user_ldif
-EOF
+       EOF
 
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
-       user edit sambatool1 --editor=$tmpeditor \
-       -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+               user edit sambatool1 --editor=$tmpeditor \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
 # Test edit user - add base64 attributes
-add_attribute_base64() {
+add_attribute_base64()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -69,12 +72,14 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64() {
+get_attribute_base64()
+{
        $samba_ldbsearch '(sAMAccountName=sambatool1)' displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_attribute() {
+delete_attribute()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -89,7 +94,8 @@ EOF
 }
 
 # Test edit user - add base64 attribute value including control character
-add_attribute_base64_control() {
+add_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -105,13 +111,15 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_base64_control() {
+get_attribute_base64_control()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \
                sambatool1 --attributes=displayName \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_attribute_force_no_base64() {
+get_attribute_force_no_base64()
+{
        # LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \
                sambatool1 --attributes=displayName \
@@ -119,7 +127,8 @@ get_attribute_force_no_base64() {
 }
 
 # Test edit user - change base64 attribute value including control character
-change_attribute_base64_control() {
+change_attribute_base64_control()
+{
        # create editor.sh
        cat >$tmpeditor <<EOF
 #!/usr/bin/env bash
@@ -134,7 +143,8 @@ EOF
 }
 
 # Test edit user - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
-change_attribute_force_no_base64() {
+change_attribute_force_no_base64()
+{
        # create editor.sh
        # Expects that the original attribute is available as clear text,
        # because the LDB_FLAG_FORCE_NO_BASE64_LDIF should be used here.
@@ -151,13 +161,15 @@ EOF
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-get_changed_attribute_force_no_base64() {
+get_changed_attribute_force_no_base64()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \
-                sambatool1 --attributes=displayName \
-                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
+               sambatool1 --attributes=displayName \
+               -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
-delete_user() {
+delete_user()
+{
        $PYTHON ${STpath}/source4/scripting/bin/samba-tool \
                user delete sambatool1 \
                -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
@@ -165,19 +177,19 @@ delete_user() {
 
 failed=0
 
-testit "create_test_user" create_test_user || failed=`expr $failed + 1`
-testit "edit_user" edit_user || failed=`expr $failed + 1`
-testit "add_attribute_base64" add_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit "delete_attribute" delete_attribute || failed=`expr $failed + 1`
-testit "add_attribute_base64_control" add_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=`expr $failed + 1`
-testit "change_attribute_base64_control" change_attribute_base64_control || failed=`expr $failed + 1`
-testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=`expr $failed + 1`
-testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=`expr $failed + 1`
-testit "delete_user" delete_user || failed=`expr $failed + 1`
+testit "create_test_user" create_test_user || failed=$(expr $failed + 1)
+testit "edit_user" edit_user || failed=$(expr $failed + 1)
+testit "add_attribute_base64" add_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit "delete_attribute" delete_attribute || failed=$(expr $failed + 1)
+testit "add_attribute_base64_control" add_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64_control" "^displayName:: $display_name_con_b64" get_attribute_base64_control || failed=$(expr $failed + 1)
+testit "change_attribute_base64_control" change_attribute_base64_control || failed=$(expr $failed + 1)
+testit_grep "get_attribute_base64" "^displayName:: $display_name_b64" get_attribute_base64 || failed=$(expr $failed + 1)
+testit_grep "get_attribute_force_no_base64" "^displayName: $display_name" get_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "change_attribute_force_no_base64" change_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit_grep "get_changed_attribute_force_no_base64" "^displayName: $display_name_new" get_changed_attribute_force_no_base64 || failed=$(expr $failed + 1)
+testit "delete_user" delete_user || failed=$(expr $failed + 1)
 
 rm -f $tmpeditor
 
index 5d4274153105aeecc0e0c44fc354aa123bf5449b..a4b9b5bb4a604beaacff1ecf7b066fbe6fc4eb35 100755 (executable)
@@ -23,10 +23,10 @@ service_dir="$SELFTEST_TMPDIR/pam_services"
 service_file="$service_dir/samba"
 
 mkdir $service_dir
-echo "auth        required    $pam_winbind debug debug_state $PAM_OPTIONS" > $service_file
-echo "account     required    $pam_winbind debug debug_state $PAM_OPTIONS" >> $service_file
-echo "password    required    $pam_winbind debug debug_state $PAM_OPTIONS" >> $service_file
-echo "session     required    $pam_winbind debug debug_state $PAM_OPTIONS" >> $service_file
+echo "auth        required    $pam_winbind debug debug_state $PAM_OPTIONS" >$service_file
+echo "account     required    $pam_winbind debug debug_state $PAM_OPTIONS" >>$service_file
+echo "password    required    $pam_winbind debug debug_state $PAM_OPTIONS" >>$service_file
+echo "session     required    $pam_winbind debug debug_state $PAM_OPTIONS" >>$service_file
 
 PAM_WRAPPER="1"
 export PAM_WRAPPER
index 12bb00afd09594c8149d3b77e33b83d97e87ce15..ea529923de0be1cfeecaed27db1bc6914e0b7230 100755 (executable)
@@ -22,13 +22,13 @@ samba_bindir="$BINDIR"
 samba_tool="$samba_bindir/samba-tool"
 
 if [ "$CREATE_USER" = yes ]; then
-    CREATE_SERVER="$1"
-    CREATE_USERNAME="$2"
-    CREATE_PASSWORD="$3"
-    shift 3
-    $PYTHON $samba_tool user create "$USERNAME" "$PASSWORD" -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
-    # reset password policies beside of minimum password age of 0 days
-    $PYTHON $samba_tool domain passwordsettings set --complexity=default --history-length=default --min-pwd-length=default --min-pwd-age=0 --max-pwd-age=default -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
+       CREATE_SERVER="$1"
+       CREATE_USERNAME="$2"
+       CREATE_PASSWORD="$3"
+       shift 3
+       $PYTHON $samba_tool user create "$USERNAME" "$PASSWORD" -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
+       # reset password policies beside of minimum password age of 0 days
+       $PYTHON $samba_tool domain passwordsettings set --complexity=default --history-length=default --min-pwd-length=default --min-pwd-age=0 --max-pwd-age=default -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
 fi
 
 PAM_WRAPPER_PATH="$BINDIR/default/third_party/pam_wrapper"
@@ -38,11 +38,11 @@ service_dir="$SELFTEST_TMPDIR/pam_services"
 service_file="$service_dir/samba"
 
 mkdir $service_dir
-echo "auth        required    $pam_winbind debug debug_state $PAM_OPTIONS" > $service_file
-echo "account     required    $pam_winbind debug debug_state $PAM_OPTIONS" >> $service_file
-echo "password    required    $PAM_SET_ITEMS_SO_PATH" >> $service_file
-echo "password    required    $pam_winbind debug debug_state $PAM_OPTIONS" >> $service_file
-echo "session     required    $pam_winbind debug debug_state $PAM_OPTIONS" >> $service_file
+echo "auth        required    $pam_winbind debug debug_state $PAM_OPTIONS" >$service_file
+echo "account     required    $pam_winbind debug debug_state $PAM_OPTIONS" >>$service_file
+echo "password    required    $PAM_SET_ITEMS_SO_PATH" >>$service_file
+echo "password    required    $pam_winbind debug debug_state $PAM_OPTIONS" >>$service_file
+echo "session     required    $pam_winbind debug debug_state $PAM_OPTIONS" >>$service_file
 
 PAM_WRAPPER_SERVICE_DIR="$service_dir"
 export PAM_WRAPPER_SERVICE_DIR
@@ -53,14 +53,14 @@ PAM_WRAPPER_DEBUGLEVEL=${PAM_WRAPPER_DEBUGLEVEL:="2"}
 export PAM_WRAPPER_DEBUGLEVEL
 
 case $PAM_OPTIONS in
-    *use_authtok*)
-        PAM_AUTHTOK="$NEWPASSWORD"
-        export PAM_AUTHTOK
-    ;;
-    *try_authtok*)
-        PAM_AUTHTOK="$NEWPASSWORD"
-        export PAM_AUTHTOK
-    ;;
+*use_authtok*)
+       PAM_AUTHTOK="$NEWPASSWORD"
+       export PAM_AUTHTOK
+       ;;
+*try_authtok*)
+       PAM_AUTHTOK="$NEWPASSWORD"
+       export PAM_AUTHTOK
+       ;;
 esac
 
 PAM_WRAPPER="1" PYTHONPATH="$PYTHONPATH:$PAM_WRAPPER_PATH:$(dirname $0)" $PYTHON -m samba.subunit.run samba.tests.pam_winbind_chauthtok
@@ -69,9 +69,9 @@ exit_code=$?
 rm -rf $service_dir
 
 if [ "$CREATE_USER" = yes ]; then
-    $PYTHON $samba_tool user delete "$USERNAME" -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
-    # reset password policies
-    $PYTHON $samba_tool domain passwordsettings set --complexity=default --history-length=default --min-pwd-length=default --min-pwd-age=default --max-pwd-age=default -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
+       $PYTHON $samba_tool user delete "$USERNAME" -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
+       # reset password policies
+       $PYTHON $samba_tool domain passwordsettings set --complexity=default --history-length=default --min-pwd-length=default --min-pwd-age=default --max-pwd-age=default -H "ldap://$CREATE_SERVER" -U "$CREATE_USERNAME%$CREATE_PASSWORD"
 fi
 
 exit $exit_code
index d2452d12511cc59d21e0530eeb39cdf9a72143ad..f8db9d1a5e4a1fbc177b10ff78d0d095ad34f3f8 100755 (executable)
@@ -41,10 +41,10 @@ export PAM_WRAPPER_DEBUGLEVEL
 WARN_PWD_EXPIRE="50"
 export WARN_PWD_EXPIRE
 
-echo "auth        required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" > $service_file
-echo "account     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >> $service_file
-echo "password    required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >> $service_file
-echo "session     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >> $service_file
+echo "auth        required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >$service_file
+echo "account     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >>$service_file
+echo "password    required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >>$service_file
+echo "session     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >>$service_file
 
 PYTHONPATH="$PYTHONPATH:$PAM_WRAPPER_PATH:$(dirname $0)" $PYTHON -m samba.subunit.run samba.tests.pam_winbind_warn_pwd_expire
 exit_code=$?
@@ -58,10 +58,10 @@ fi
 WARN_PWD_EXPIRE="0"
 export WARN_PWD_EXPIRE
 
-echo "auth        required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" > $service_file
-echo "account     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >> $service_file
-echo "password    required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >> $service_file
-echo "session     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >> $service_file
+echo "auth        required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >$service_file
+echo "account     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >>$service_file
+echo "password    required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >>$service_file
+echo "session     required    $pam_winbind debug debug_state warn_pwd_expire=$WARN_PWD_EXPIRE $PAM_OPTIONS" >>$service_file
 
 PYTHONPATH="$PYTHONPATH:$PAM_WRAPPER_PATH:$(dirname $0)" $PYTHON -m samba.subunit.run samba.tests.pam_winbind_warn_pwd_expire
 exit_code=$?