test_smbclient_s3.sh: Use correct separator in "list with backup privilege" test
authorChristof Schmitt <cs@samba.org>
Fri, 16 Mar 2018 20:52:14 +0000 (13:52 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 6 Apr 2018 15:58:38 +0000 (17:58 +0200)
Samba selftest uses the forward slash as winbind separator and in the
USERNAME passed to the test. "net sam rights" expect the backslash. Map
the separator used in selftest to a backslash to avoid creating an
incorrect username DOMAIN\DOMAIN/USERNAME.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13312

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/script/tests/test_smbclient_s3.sh

index 03f7b276d91c90cd697d2de6a470df0c14403cea..cc0d69dfb6e65e6301e59dc47fae539216dd562c 100755 (executable)
@@ -643,13 +643,17 @@ test_backup_privilege_list()
 {
     tmpfile=$PREFIX/smbclient_backup_privilege_list
 
+    # selftest uses the forward slash as a separator, but "net sam rights
+    # grant" requires the backslash separator
+    USER_TMP=$(printf '%s' "$USERNAME" | tr '/' '\\')
+
     # If we don't have a DOMAIN component to the username, add it.
-    echo "$USERNAME" | grep '\\' 2>&1
+    printf '%s' "$USER_TMP" | grep '\\' 2>&1
     ret=$?
     if [ $ret != 0 ] ; then
-       priv_username="$DOMAIN\\$USERNAME"
+       priv_username="$DOMAIN\\$USER_TMP"
     else
-       priv_username=$USERNAME
+       priv_username="$USER_TMP"
     fi
 
     $NET sam rights grant $priv_username SeBackupPrivilege 2>&1