summaryrefslogtreecommitdiff
path: root/selftest/target
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-01-08 18:38:08 +0100
committerRalph Boehme <slow@samba.org>2018-01-10 01:01:24 +0100
commit0f5b1bd9e2d16702a7be674fcd4ba4328d6befc1 (patch)
tree0e7b8fe6f9d2fe223c38f8e352e8799eeeb777da /selftest/target
parenta206cf2dc11159b0e9ebe4d1d1d23e4365bd2a8c (diff)
downloadsamba-0f5b1bd9e2d16702a7be674fcd4ba4328d6befc1.tar.gz
selftest: fix creation of builtin users in wait_for_start
If "BUILTIN\Users" already exists, attempting to create it would fail, so we should check for the existence prior to the creation. It is unclear *why* the mapping sometimes already exist and sometime not. There are two places where they would have been created: 1. libnet_join_add_dom_rids_to_builtins tries to add the mapping when joining a domain, but at that point winbindd isn't running 2. when a user is authenticated in smbd, which clearly can't have happended when in the function wait_for_start Go figure... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'selftest/target')
-rwxr-xr-xselftest/target/Samba3.pm27
1 files changed, 23 insertions, 4 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 851460c502b..0f41b0ea1c0 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2333,6 +2333,7 @@ force_user:x:$gid_force_user:
sub wait_for_start($$$$$)
{
my ($self, $envvars, $nmbd, $winbindd, $smbd) = @_;
+ my $cmd;
my $ret;
if ($nmbd eq "yes") {
@@ -2366,8 +2367,7 @@ sub wait_for_start($$$$$)
if ($winbindd eq "yes") {
print "checking for winbindd\n";
my $count = 0;
- my $cmd = "";
- $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
+ $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
$cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
$cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
$cmd .= Samba::bindir_path($self, "wbinfo") . " --ping-dc";
@@ -2419,9 +2419,28 @@ sub wait_for_start($$$$$)
return 1;
}
+ # note: creating builtin groups requires winbindd for the
+ # unix id allocator
+ my $create_builtin_users = "no";
if ($winbindd eq "yes") {
- # note: creating builtin groups requires winbindd for the
- # unix id allocator
+ $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
+ $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
+ $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
+ $cmd .= Samba::bindir_path($self, "wbinfo") . " --sid-to-gid=S-1-5-32-545";
+ my $wbinfo_out = qx($cmd 2>&1);
+ if ($? != 0) {
+ # wbinfo doesn't give us a better error code then
+ # WBC_ERR_DOMAIN_NOT_FOUND, but at least that's
+ # different then WBC_ERR_WINBIND_NOT_AVAILABLE
+ if ($wbinfo_out !~ /WBC_ERR_DOMAIN_NOT_FOUND/) {
+ print("Failed to run \"wbinfo --sid-to-gid=S-1-5-32-545\": $wbinfo_out");
+ teardown_env($self, $envvars);
+ return 0;
+ }
+ $create_builtin_users = "yes";
+ }
+ }
+ if ($create_builtin_users eq "yes") {
$ret = system("SELFTEST_WINBINDD_SOCKET_DIR=" . $envvars->{SELFTEST_WINBINDD_SOCKET_DIR} . " " . Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} sam createbuiltingroup Users");
if ($ret != 0) {
print "Failed to create BUILTIN\\Users group\n";