2 # Bootstrap Samba and run a number of tests against it.
3 # Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
4 # Published under the GNU GPL, v3 or later.
15 my ($classname, $bindir, $binary_mapping,$ldap, $srcdir, $server_maxtime) = @_;
18 samba3
=> new Samba3
($bindir,$binary_mapping, $srcdir, $server_maxtime),
19 samba4
=> new Samba4
($bindir,$binary_mapping, $ldap, $srcdir, $server_maxtime),
27 my ($self, $envname, $path) = @_;
29 $ENV{ENVNAME
} = $envname;
31 my $env = $self->{samba4
}->setup_env($envname, $path);
32 if (defined($env) and $env ne "UNKNOWN") {
33 if (not defined($env->{target
})) {
34 $env->{target
} = $self->{samba4
};
36 } elsif (defined($env) and $env eq "UNKNOWN") {
37 $env = $self->{samba3
}->setup_env($envname, $path);
38 if (defined($env) and $env ne "UNKNOWN") {
39 if (not defined($env->{target
})) {
40 $env->{target
} = $self->{samba3
};
44 if (defined($env) and ($env eq "UNKNOWN")) {
45 warn("Samba can't provide environment '$envname'");
48 if (not defined $env) {
49 warn("failed to start up environment '$envname'");
56 my ($object, $path) = @_;
58 if (defined($object->{binary_mapping
}->{$path})) {
59 $path = $object->{binary_mapping
}->{$path};
62 my $valpath = "$object->{bindir}/$path";
64 return $valpath if (-f
$valpath);
68 sub nss_wrapper_winbind_so_path
($) {
70 my $ret = $ENV{NSS_WRAPPER_WINBIND_SO_PATH
};
71 if (not defined($ret)) {
72 $ret = bindir_path
($object, "default/nsswitch/libnss-winbind.so");
73 $ret = abs_path
($ret);
80 my ($ctx, $other_realms_stanza) = @_;
82 unless (open(KRB5CONF
, ">$ctx->{krb5_conf}")) {
83 warn("can't open $ctx->{krb5_conf}$?");
87 my $our_realms_stanza = mk_realms_stanza
($ctx->{realm
},
92 #Generated krb5.conf for $ctx->{realm}
95 default_realm = $ctx->{realm}
96 dns_lookup_realm = false
97 dns_lookup_kdc = false
100 allow_weak_crypto = yes
108 if (defined($ctx->{tlsdir
})) {
112 pkinit_anchors = FILE:$ctx->{tlsdir}/ca.pem
116 pkinit_identity = FILE:$ctx->{tlsdir}/kdc.pem,$ctx->{tlsdir}/key.pem
117 pkinit_anchors = FILE:$ctx->{tlsdir}/ca.pem
124 sub mk_realms_stanza
($$$$)
126 my ($realm, $dnsname, $domain, $kdc_ipv4) = @_;
128 my $realms_stanza = "
131 admin_server = $kdc_ipv4:88
132 default_domain = $dnsname
136 admin_server = $kdc_ipv4:88
137 default_domain = $dnsname
141 admin_server = $kdc_ipv4:88
142 default_domain = $dnsname
146 return $realms_stanza;
151 my ($netbiosname) = @_;
152 $netbiosname = lc($netbiosname);
155 $interfaces{"locals3dc2"} = 3;
156 $interfaces{"localmember3"} = 4;
157 $interfaces{"localshare4"} = 5;
159 $interfaces{"localktest6"} = 7;
160 $interfaces{"maptoguest"} = 8;
162 # 11-16 used by selftest.pl for client interfaces
164 $interfaces{"localdc"} = 21;
165 $interfaces{"localvampiredc"} = 22;
166 $interfaces{"s4member"} = 23;
167 $interfaces{"localrpcproxy"} = 24;
168 $interfaces{"dc5"} = 25;
169 $interfaces{"dc6"} = 26;
170 $interfaces{"dc7"} = 27;
171 $interfaces{"rodc"} = 28;
172 $interfaces{"localadmember"} = 29;
173 $interfaces{"plugindc"} = 30;
174 $interfaces{"localsubdc"} = 31;
175 $interfaces{"chgdcpass"} = 32;
176 $interfaces{"promotedvdc"} = 33;
177 $interfaces{"rfc2307member"} = 34;
179 # update lib/socket_wrapper/socket_wrapper.c
180 # #define MAX_WRAPPED_INTERFACES 32
181 # if you wish to have more than 32 interfaces
183 if (not defined($interfaces{$netbiosname})) {
187 return $interfaces{$netbiosname};
190 sub cleanup_child
($$)
192 my ($pid, $name) = @_;
193 my $childpid = waitpid($pid, WNOHANG
);
194 if ($childpid == 0) {
195 } elsif ($childpid < 0) {
196 printf STDERR
"%s child process %d isn't here any more\n",
200 printf STDERR
"%s child process %d, died with signal %d, %s coredump\n",
201 $name, $childpid, ($?
& 127), ($?
& 128) ?
'with' : 'without';
203 printf STDERR
"%s child process %d exited with value %d\n", $name, $childpid, $?
>> 8;