From: Stefan Metzmacher Date: Tue, 5 Oct 2021 14:42:00 +0000 (+0200) Subject: selftest/Samba3: replace (winbindd => "yes", skip_wait => 1) with (winbindd => "offline") X-Git-Tag: ldb-2.5.0~370 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dc3c68c9a28f71888e3d6dd3b1f0bcdb8fa45de;p=thirdparty%2Fsamba.git selftest/Samba3: replace (winbindd => "yes", skip_wait => 1) with (winbindd => "offline") This is much more flexible and concentrates the logic in a single place. We'll use winbindd => "offline" in other places soon. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14870 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 804b19aa746..fdbba8411bc 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -912,34 +912,13 @@ sub provision_ad_member # Start winbindd in offline mode if (not $self->check_or_start( env_vars => $ret, - winbindd => "yes", - skip_wait => 1)) { + winbindd => "offline")) { return undef; } # Set socket dir again $ENV{SOCKET_WRAPPER_DIR} = $swrap_env; - print "checking for winbindd\n"; - my $count = 0; - my $rc = 0; - $cmd = "NSS_WRAPPER_PASSWD='$ret->{NSS_WRAPPER_PASSWD}' "; - $cmd .= "NSS_WRAPPER_GROUP='$ret->{NSS_WRAPPER_GROUP}' "; - $cmd .= "SELFTEST_WINBINDD_SOCKET_DIR=\"$ret->{SELFTEST_WINBINDD_SOCKET_DIR}\" "; - $cmd .= "$wbinfo --ping"; - - do { - $rc = system($cmd); - if ($rc != 0) { - sleep(1); - } - $count++; - } while ($rc != 0 && $count < 20); - if ($count == 20) { - print "WINBINDD not reachable after 20 seconds\n"; - teardown_env($self, $ret); - return undef; - } } else { if (not $self->check_or_start( env_vars => $ret, @@ -2110,7 +2089,6 @@ sub check_or_start($$) { my $winbindd = $args{winbindd} // "no"; my $smbd = $args{smbd} // "no"; my $child_cleanup = $args{child_cleanup}; - my $skip_wait = $args{skip_wait} // 0; my $STDIN_READER; @@ -2159,7 +2137,7 @@ sub check_or_start($$) { LOG_FILE => $env_vars->{WINBINDD_TEST_LOG}, PCAP_FILE => "env-$ENV{ENVNAME}-winbindd", }; - if ($winbindd ne "yes") { + if ($winbindd ne "yes" and $winbindd ne "offline") { $daemon_ctx->{SKIP_DAEMON} = 1; } @@ -2195,10 +2173,6 @@ sub check_or_start($$) { # close the parent's read-end of the pipe close($STDIN_READER); - if ($skip_wait) { - return 1; - } - return $self->wait_for_start($env_vars, $nmbd, $winbindd, $smbd); } @@ -3395,13 +3369,17 @@ sub wait_for_start($$$$$) } } - if ($winbindd eq "yes") { + if ($winbindd eq "yes" or $winbindd eq "offline") { print "checking for winbindd\n"; my $count = 0; $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"; + if ($winbindd eq "yes") { + $cmd .= Samba::bindir_path($self, "wbinfo") . " --ping-dc"; + } elsif ($winbindd eq "offline") { + $cmd .= Samba::bindir_path($self, "wbinfo") . " --ping"; + } do { $ret = system($cmd);