From 2b558f2096410b1afd2a6d5bde2862b4cc4fd587 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 31 Mar 2014 20:47:18 +1300 Subject: [PATCH] selftest: Set winbind separator = / This avoids a pile of shell-script escape pain, and fixes some tests. Andrew Bartlett Change-Id: Ie1d0e32ab484a5b0ddbc4073831fe6de27e38e92 Signed-off-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- nsswitch/tests/test_idmap_rfc2307.sh | 16 ++++++++-------- selftest/knownfail | 1 - selftest/selftest.pl | 1 + selftest/target/Samba3.pm | 1 + .../script/tests/test_wbinfo_sids2xids_int.py | 2 +- source3/selftest/tests.py | 14 +++++++------- source4/torture/winbind/struct_based.c | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/nsswitch/tests/test_idmap_rfc2307.sh b/nsswitch/tests/test_idmap_rfc2307.sh index d3087a171b5..cb60364016e 100755 --- a/nsswitch/tests/test_idmap_rfc2307.sh +++ b/nsswitch/tests/test_idmap_rfc2307.sh @@ -74,24 +74,24 @@ testit "add ldap group mapping record" $VALGRIND $ldbadd -H ldap://$DC_SERVER -U rm -f $PREFIX/tmpldbmodify -testit "wbinfo --name-to-sid" $wbinfo --name-to-sid "$DOMAIN\\$USERNAME" || failed=$(expr $failed + 1) -user_sid=$($wbinfo -n "$DOMAIN\\$USERNAME" | cut -d " " -f1) -echo "$DOMAIN\\$USERNAME resolved to $user_sid" +testit "wbinfo --name-to-sid" $wbinfo --name-to-sid "$DOMAIN/$USERNAME" || failed=$(expr $failed + 1) +user_sid=$($wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1) +echo "$DOMAIN/$USERNAME resolved to $user_sid" testit "wbinfo --sid-to-uid=$user_sid" $wbinfo --sid-to-uid=$user_sid || failed=$(expr $failed + 1) user_uid=$($wbinfo --sid-to-uid=$user_sid | cut -d " " -f1) -echo "$DOMAIN\\$USERNAME resolved to $user_uid" +echo "$DOMAIN/$USERNAME resolved to $user_uid" testit "test $user_uid -eq $USERUID" test $user_uid -eq $USERUID || failed=$(expr $failed + 1) # Not sure how to get group names with spaces to resolve through testit -#testit "wbinfo --name-to-sid" $wbinfo --name-to-sid="$DOMAIN\\$GROUPNAME" || failed=$(expr $failed + 1) -group_sid=$($wbinfo --name-to-sid="$DOMAIN\\$GROUPNAME" | cut -d " " -f1) -echo "$DOMAIN\\$GROUPNAME resolved to $group_sid" +#testit "wbinfo --name-to-sid" $wbinfo --name-to-sid="$DOMAIN/$GROUPNAME" || failed=$(expr $failed + 1) +group_sid=$($wbinfo --name-to-sid="$DOMAIN/$GROUPNAME" | cut -d " " -f1) +echo "$DOMAIN/$GROUPNAME resolved to $group_sid" testit "wbinfo --sid-to-gid=$group_sid" $wbinfo --sid-to-gid=$group_sid || failed=$(expr $failed + 1) group_gid=$($wbinfo --sid-to-gid=$group_sid | cut -d " " -f1) -echo "$DOMAIN\\$GROUPNAME resolved to $group_gid" +echo "$DOMAIN/$GROUPNAME resolved to $group_gid" testit "test $group_gid -eq $GROUPGID" test $group_gid -eq $GROUPGID || failed=$(expr $failed + 1) diff --git a/selftest/knownfail b/selftest/knownfail index 35dba207182..9e369c1588d 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -242,7 +242,6 @@ # # The Samba4 winbind does not cover the full winbind protocol, so these are expected # -^samba3.winbind.struct.info\(plugin_s4_dc\) ^samba3.winbind.struct.show_sequence\(plugin_s4_dc\) ^samba3.winbind.wbclient.wbcPingDc\(plugin_s4_dc\) ^samba3.winbind.wbclient.wbcPingDc2\(plugin_s4_dc\) diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 97b24ed8658..831ebd90f8d 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -545,6 +545,7 @@ sub write_clientconf($$$) resolv:host file = $prefix_abs/dns_host_file #We don't want to run 'speed' tests for very long torture:timelimit = 1 + winbind separator = / "; close(CF); } diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 59ad4d5dcbb..a6d85ccd6f1 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -1020,6 +1020,7 @@ sub provision($$$$$$) idmap config * : range = 100000-200000 winbind enum users = yes winbind enum groups = yes + winbind separator = / # min receivefile size = 4000 diff --git a/source3/script/tests/test_wbinfo_sids2xids_int.py b/source3/script/tests/test_wbinfo_sids2xids_int.py index 1b79e005dce..e9cd9abc69a 100755 --- a/source3/script/tests/test_wbinfo_sids2xids_int.py +++ b/source3/script/tests/test_wbinfo_sids2xids_int.py @@ -15,7 +15,7 @@ def flush_cache(): domain = subprocess.Popen([wbinfo, "--own-domain"], stdout=subprocess.PIPE).communicate()[0].strip() -domsid = subprocess.Popen([wbinfo, "-n", domain + "\\"], +domsid = subprocess.Popen([wbinfo, "-n", domain + "/"], stdout=subprocess.PIPE).communicate()[0] domsid = domsid.split(' ')[0] diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index bad66d32868..deea4a0a174 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -126,7 +126,7 @@ for env in ["s3dc", "member", "s3member", "dc", "s4member"]: for env in ["s3dc", "member", "s3member"]: plantestsuite("samba3.blackbox.smbclient_auth.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration]) - plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$SERVER\\\\$USERNAME', '$PASSWORD', smbclient3, configuration]) + plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$SERVER/$USERNAME', '$PASSWORD', smbclient3, configuration]) tests = ["--ping", "--separator", "--own-domain", @@ -144,10 +144,10 @@ for env in ["s3dc", "member", "s3member"]: #Didn't pass yet# "--domain-users", "--domain-groups", "--name-to-sid=$DC_USERNAME", - "--name-to-sid=$DOMAIN\\\\$DC_USERNAME", + "--name-to-sid=$DOMAIN/$DC_USERNAME", #Didn't pass yet# "--user-info=$USERNAME", - "--user-groups=$DOMAIN\\\\$DC_USERNAME", - "--authenticate=$DOMAIN\\\\$DC_USERNAME%$DC_PASSWORD", + "--user-groups=$DOMAIN/$DC_USERNAME", + "--authenticate=$DOMAIN/$DC_USERNAME%$DC_PASSWORD", "--allocate-uid", "--allocate-gid"] @@ -168,7 +168,7 @@ for env in ["member", "s3member"]: plantestsuite("samba3.blackbox.net_cred_change.(%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_net_cred_change.sh"), configuration]) env = "s3member" -t = "--krb5auth=$DOMAIN\\\\$DC_USERNAME%$DC_PASSWORD" +t = "--krb5auth=$DOMAIN/$DC_USERNAME%$DC_PASSWORD" plantestsuite("samba3.wbinfo_simple.(%s:local).%s" % (env, t), "%s:local" % env, [os.path.join(srcdir(), "nsswitch/tests/test_wbinfo_simple.sh"), t]) plantestsuite("samba3.ntlm_auth.krb5(ktest:local) old ccache", "ktest:local", [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_krb5.sh"), valgrindify(python), samba3srcdir, ntlm_auth3, '$PREFIX/ktest/krb5_ccache-2', '$SERVER', configuration]) @@ -187,13 +187,13 @@ for env in ["s3dc"]: plantestsuite("samba3.blackbox.smbclient_s3.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration]) for env in ["member", "s3member"]: - plantestsuite("samba3.blackbox.smbclient_s3.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER\\\\$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration]) + plantestsuite("samba3.blackbox.smbclient_s3.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER/$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration]) for env in ["s3dc"]: plantestsuite("samba3.blackbox.smbclient_s3.sign (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "--signing=required"]) for env in ["member", "s3member"]: - plantestsuite("samba3.blackbox.smbclient_s3.sign (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER\\\\$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "--signing=required"]) + plantestsuite("samba3.blackbox.smbclient_s3.sign (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER', '$SERVER/$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient3, wbinfo, net, configuration, "--signing=required"]) for env in ["s3dc"]: # encrypted diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c index 2bab94088a3..d47d068909f 100644 --- a/source4/torture/winbind/struct_based.c +++ b/source4/torture/winbind/struct_based.c @@ -1034,7 +1034,7 @@ static bool torture_winbind_struct_lookup_name_sid(struct torture_context *tortu get_winbind_domain(torture, &domain); do { count++; - invalid_name = talloc_asprintf(torture, "%s\\%s%u", + invalid_name = talloc_asprintf(torture, "%s/%s%u", domain, invalid_user, count); } while(name_is_in_list(invalid_name, (const char **)users) || -- 2.34.1