From: Björn Baumbach Date: Thu, 14 Mar 2019 13:04:28 +0000 (+0100) Subject: samba-tool tests: add additional tests for "samba-tool user edit" command X-Git-Tag: ldb-2.0.5~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=824c98ac225b58ca9fba7fb18e4a39157ed174df;p=thirdparty%2Fsamba.git samba-tool tests: add additional tests for "samba-tool user edit" command Especially test handling of base64 encoded attribute values here. Add selftest/knownfail.d/samba_tool.user_edit. Tests fail, because: - can not work with ldif without a trailing new line - can not handle base64 strings BUG: https://bugzilla.samba.org/show_bug.cgi?id=14003 Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/samba_tool/user_edit.sh b/python/samba/tests/samba_tool/user_edit.sh index 166d45ae4d6..0535efedbdd 100755 --- a/python/samba/tests/samba_tool/user_edit.sh +++ b/python/samba/tests/samba_tool/user_edit.sh @@ -16,6 +16,13 @@ PASSWORD="$3" STpath=$(pwd) . $STpath/testprogs/blackbox/subunit.sh +display_name="Björn" +display_name_b64="QmrDtnJu" +display_name_new="Renamed Bjoern" +# attribute value including control character +# echo -e "test \a string" | base64 +display_name_con_b64="dGVzdCAHIHN0cmluZwo=" + tmpeditor=$(mktemp --suffix .sh -p $STpath/bin samba-tool-editor-XXXXXXXX) chmod +x $tmpeditor @@ -39,6 +46,89 @@ EOF -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" } +# Test edit user - add base64 attributes +add_attribute_base64() { + # create editor.sh + cat >$tmpeditor < \${user_ldif}.tmp +echo "displayName:: $display_name_b64" >> \${user_ldif}.tmp + +mv \${user_ldif}.tmp \$user_ldif +EOF + + $PYTHON ${STpath}/source4/scripting/bin/samba-tool user edit \ + sambatool1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +get_attribute_base64() { + $PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \ + sambatool1 --attributes=displayName \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +delete_attribute() { + # create editor.sh + cat >$tmpeditor <> \${user_ldif}.tmp +mv \${user_ldif}.tmp \$user_ldif +EOF + $PYTHON ${STpath}/source4/scripting/bin/samba-tool user edit \ + sambatool1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +# Test edit user - add base64 attribute value including control character +add_attribute_base64_control() { + # create editor.sh + cat >$tmpeditor < \${user_ldif}.tmp +echo "displayName:: $display_name_con_b64" >> \${user_ldif}.tmp + +mv \${user_ldif}.tmp \$user_ldif +EOF + $PYTHON ${STpath}/source4/scripting/bin/samba-tool user edit \ + sambatool1 --editor=$tmpeditor \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + +get_attribute_base64_control() { + $PYTHON ${STpath}/source4/scripting/bin/samba-tool user show \ + sambatool1 --attributes=displayName \ + -H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD" +} + + +# Test edit user - change base64 attribute value including control character +change_attribute_base64_control() { + # create editor.sh + cat >$tmpeditor <