diff options
author | Björn Baumbach <bb@sernet.de> | 2019-03-15 12:59:09 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-07-04 02:07:20 +0000 |
commit | 33fe4817609106284856867c09f91398fc5ebfc2 (patch) | |
tree | 0c784e9ee9d74d30589e7fff3a0ba3d1c2baa57c /python/samba | |
parent | 4954118b81e96ef677b1965d06427d626855e73f (diff) | |
download | samba-33fe4817609106284856867c09f91398fc5ebfc2.tar.gz |
samba-tool tests: add test for 'samba-tool user edit', using LDB_FLAG_FORCE_NO_BASE64_LDIF
Test to edit a user: Change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF
Signed-off-by: Björn Baumbach <bb@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python/samba')
-rwxr-xr-x | python/samba/tests/samba_tool/user_edit.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/user_edit.sh b/python/samba/tests/samba_tool/user_edit.sh index 0535efedbdd..03fbd61ff5d 100755 --- a/python/samba/tests/samba_tool/user_edit.sh +++ b/python/samba/tests/samba_tool/user_edit.sh @@ -129,6 +129,30 @@ get_attribute_base64_control() { -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" } +# Test edit user - change attributes with LDB_FLAG_FORCE_NO_BASE64_LDIF +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. + cat >$tmpeditor <<EOF +#!/usr/bin/env bash +user_ldif="\$1" + +sed -i -e 's/displayName: $display_name/displayName: $display_name_new/' \ + \$user_ldif +EOF + + $PYTHON ${STpath}/source4/scripting/bin/samba-tool user edit \ + sambatool1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +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" +} + delete_user() { $PYTHON ${STpath}/source4/scripting/bin/samba-tool \ user delete sambatool1 \ @@ -146,6 +170,8 @@ testit "add_attribute_base64_control" add_attribute_base64_control || failed=`ex 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_control" "^displayName:: $display_name_b64" get_attribute_base64_control || 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 |