selftest:Samba3: provision the BUILTIN\Users group if the environment runs winbindd
authorMichael Adam <obnox@samba.org>
Fri, 23 Nov 2012 00:35:30 +0000 (01:35 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 3 Dec 2012 07:48:25 +0000 (08:48 +0100)
Note that in order to create a local group (alias), the id-allocator of
id-mapping is needed, so this can only work if winbindd is running.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
selftest/target/Samba3.pm

index 99f126c96df527b705417c94824f7180bd1217d9..ea2e21d6f313aa641879a52df06e62457ab78c70 100755 (executable)
@@ -1158,6 +1158,30 @@ sub wait_for_start($$$$$)
            return 1;
        }
 
+       if ($winbindd eq "yes") {
+           # note: creating builtin groups requires winbindd for the
+           # unix id allocator
+           $ret = system("WINBINDD_SOCKET_DIR=" . $envvars->{WINBINDD_SOCKET_DIR} . " " . Samba::bindir_path($self, "net") ." $envvars->{CONFIGURATION} sam createbuiltingroup Users");
+           if ($ret != 0) {
+               print "Failed to create BUILTIN\\Users group\n";
+               return 0;
+           }
+           my $count = 0;
+           do {
+               system(Samba::bindir_path($self, "net") . " $envvars->{CONFIGURATION} cache flush");
+               $ret = system("WINBINDD_SOCKET_DIR=" . $envvars->{WINBINDD_SOCKET_DIR} . " " . Samba::bindir_path($self, "wbinfo") . " --sid-to-gid=S-1-5-32-545");
+               if ($ret != 0) {
+                   sleep(2);
+               }
+               $count++;
+           } while ($ret != 0 && $count < 10);
+           if ($count == 10) {
+               print "WINBINDD not reachable after 20 seconds\n";
+               teardown_env($self, $envvars);
+               return 0;
+           }
+       }
+
        print $self->getlog_env($envvars);
 
        return 1;