selftest: Don't use global dirs when parsing customdc realm
authorTim Beale <timbeale@catalyst.net.nz>
Thu, 30 May 2019 02:55:52 +0000 (14:55 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 31 May 2019 06:34:36 +0000 (06:34 +0000)
When creating the customdc, testparm would default to using
/usr/local/samba sub-directories for creating sockets and lock files.
Instead, pass in the tmpdir we just created as an option to the command.

Normally this didn't cause a noticeable problem, however, if we run the
command with UID-wrapper but without socket-wrapper (i.e.
USE_NAMESPACES=1), then it fails completely.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 31 06:34:36 UTC 2019 on sn-devel-184

selftest/target/Samba4.pm

index d647a5c29a000ce451aacb68efb3973fa5b0b528..c661a109e643868102bd2ca25280250282c39ba1 100755 (executable)
@@ -3280,10 +3280,15 @@ sub get_backup_domain_realm
                return undef, undef;
        }
 
+       # make sure we don't try to create locks/sockets in the default install
+       # location (i.e. /usr/local/samba/)
+       my $options = "--option=\"private dir = $tmpdir\"";
+       $options .=  " --option=\"lock dir = $tmpdir\"";
+
        # now use testparm to read the values we're interested in
        my $testparm = Samba::bindir_path($self, "testparm");
-       my $domain = `$testparm $smbconf -sl --parameter-name=WORKGROUP`;
-       my $realm = `$testparm $smbconf -sl --parameter-name=REALM`;
+       my $domain = `$testparm $smbconf -sl --parameter-name=WORKGROUP $options`;
+       my $realm = `$testparm $smbconf -sl --parameter-name=REALM $options`;
        chomp $realm;
        chomp $domain;
        print "Backup-file REALM is $realm, DOMAIN is $domain\n";