summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-03-02 11:44:56 +1100
committerAndrew Bartlett <abartlet@samba.org>2012-03-02 03:48:05 +0100
commit10700f69b2ec552939471fb43f0913511860af6f (patch)
treed0886bf95f3fc04f4f4f5214ef84c6f8e242adcf
parentf1452a296429b79755235f4a480f0d5ea38ce178 (diff)
downloadsamba-10700f69b2ec552939471fb43f0913511860af6f.tar.gz
samba-10700f69b2ec552939471fb43f0913511860af6f.tar.bz2
samba-10700f69b2ec552939471fb43f0913511860af6f.zip
selftest: Establish a registry of socket wrapper IPs
This fixes a bug where chgdcpass was on the same IP as localsubdc, and will avoid similar mistakes in future. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Mar 2 03:48:05 CET 2012 on sn-devel-104
-rw-r--r--selftest/target/Samba.pm38
-rwxr-xr-xselftest/target/Samba3.pm20
-rw-r--r--selftest/target/Samba4.pm27
3 files changed, 56 insertions, 29 deletions
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm
index 445cbb250d..06b6472a6c 100644
--- a/selftest/target/Samba.pm
+++ b/selftest/target/Samba.pm
@@ -134,4 +134,42 @@ sub mk_realms_stanza($$$$)
return $realms_stanza;
}
+sub get_interface($)
+{
+ my ($netbiosname) = @_;
+ $netbiosname = lc($netbiosname);
+
+ my %interfaces = ();
+ $interfaces{"locals3dc2"} = 2;
+ $interfaces{"localmember3"} = 3;
+ $interfaces{"localshare4"} = 4;
+ $interfaces{"localserver5"} = 5;
+ $interfaces{"localktest6"} = 6;
+ $interfaces{"maptoguest"} = 7;
+
+ # 11-16 used by selftest.pl for client interfaces
+
+ $interfaces{"localdc"} = 21;
+ $interfaces{"localvampiredc"} = 22;
+ $interfaces{"s4member"} = 23;
+ $interfaces{"localrpcproxy"} = 24;
+ $interfaces{"dc5"} = 25;
+ $interfaces{"dc6"} = 26;
+ $interfaces{"dc7"} = 27;
+ $interfaces{"rodc"} = 28;
+ $interfaces{"localadmember"} = 29;
+ $interfaces{"plugindc"} = 30;
+ $interfaces{"localsubdc"} = 31;
+ $interfaces{"chgdcpass"} = 32;
+
+ # update lib/socket_wrapper/socket_wrapper.c
+ # #define MAX_WRAPPED_INTERFACES 32
+ # if you wish to have more than 32 interfaces
+
+ if (not defined($interfaces{$netbiosname})) {
+ die();
+ }
+
+ return $interfaces{$netbiosname};
+}
1;
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 9d74e7db48..0ea63db8c4 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -151,7 +151,6 @@ sub setup_s3dc($$)
my $vars = $self->provision($path,
"LOCALS3DC2",
- 2,
"locals3dc2pass",
$s3dc_options);
@@ -187,7 +186,6 @@ sub setup_member($$$)
";
my $ret = $self->provision($prefix,
"LOCALMEMBER3",
- 3,
"localmember3pass",
$member_options);
@@ -221,14 +219,14 @@ sub setup_member($$$)
sub setup_admember($$$$)
{
- my ($self, $prefix, $dcvars, $iface) = @_;
+ my ($self, $prefix, $dcvars) = @_;
# If we didn't build with ADS, pretend this env was never available
if (not $self->have_ads()) {
return "UNKNOWN";
}
- print "PROVISIONING S3 AD MEMBER$iface...";
+ print "PROVISIONING S3 AD MEMBER...";
my $member_options = "
security = ads
@@ -238,9 +236,8 @@ sub setup_admember($$$$)
";
my $ret = $self->provision($prefix,
- "LOCALADMEMBER$iface",
- $iface,
- "loCalMember${iface}Pass",
+ "LOCALADMEMBER",
+ "loCalMemberPass",
$member_options);
$ret or return undef;
@@ -308,7 +305,6 @@ sub setup_secshare($$)
my $vars = $self->provision($path,
"LOCALSHARE4",
- 4,
"local4pass",
$secshare_options);
@@ -338,7 +334,6 @@ sub setup_secserver($$$)
my $ret = $self->provision($prefix,
"LOCALSERVER5",
- 5,
"localserver5pass",
$secserver_options);
@@ -380,7 +375,6 @@ sub setup_ktest($$$)
my $ret = $self->provision($prefix,
"LOCALKTEST6",
- 6,
"localktest6pass",
$ktest_options);
@@ -467,7 +461,6 @@ map to guest = bad user
my $vars = $self->provision($path,
"maptoguest",
- 7,
"maptoguestpass",
$options);
@@ -674,14 +667,15 @@ sub check_or_start($$$$$) {
return 0;
}
-sub provision($$$$$$$)
+sub provision($$$$$$)
{
- my ($self, $prefix, $server, $swiface, $password, $extra_options, $no_delete_prefix) = @_;
+ my ($self, $prefix, $server, $password, $extra_options, $no_delete_prefix) = @_;
##
## setup the various environment variables we need
##
+ my $swiface = Samba::get_interface($server);
my %ret = ();
my $server_ip = "127.0.0.$swiface";
my $domain = "SAMBA-TEST";
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 38a434c7c7..12c7e0a905 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -445,11 +445,11 @@ Wfz/8alZ5aMezCQzXJyIaJsCLeKABosSwHcpAFmxlQ==
EOF
}
-sub provision_raw_prepare($$$$$$$$$$)
+sub provision_raw_prepare($$$$$$$$$)
{
my ($self, $prefix, $server_role, $hostname,
$domain, $realm, $functional_level,
- $swiface, $password, $kdc_ipv4) = @_;
+ $password, $kdc_ipv4) = @_;
my $ctx;
my $netbiosname = uc($hostname);
@@ -466,6 +466,9 @@ sub provision_raw_prepare($$$$$$$$$$)
warn("Unable to clean up");
}
+
+ my $swiface = Samba::get_interface($hostname);
+
$ctx->{prefix} = $prefix;
$ctx->{prefix_abs} = $prefix_abs;
@@ -723,16 +726,16 @@ sub provision_raw_step2($$$)
return $ret;
}
-sub provision($$$$$$$$$)
+sub provision($$$$$$$$)
{
my ($self, $prefix, $server_role, $hostname,
$domain, $realm, $functional_level,
- $swiface, $password, $kdc_ipv4, $extra_smbconf_options) = @_;
+ $password, $kdc_ipv4, $extra_smbconf_options) = @_;
my $ctx = $self->provision_raw_prepare($prefix, $server_role,
$hostname,
$domain, $realm, $functional_level,
- $swiface, $password, $kdc_ipv4);
+ $password, $kdc_ipv4);
$ctx->{tmpdir} = "$ctx->{prefix_abs}/tmp";
push(@{$ctx->{directories}}, "$ctx->{tmpdir}");
@@ -857,7 +860,6 @@ sub provision_member($$$)
"SAMBADOMAIN",
"samba.example.com",
"2008",
- 23,
"locMEMpass3",
$dcvars->{SERVER_IP},
"");
@@ -923,7 +925,6 @@ sub provision_rpc_proxy($$$)
"SAMBADOMAIN",
"samba.example.com",
"2008",
- 24,
"locRPCproxypass4",
$dcvars->{SERVER_IP},
$extra_smbconf_options);
@@ -997,7 +998,7 @@ sub provision_vampire_dc($$$)
"SAMBADOMAIN",
"samba.example.com",
"2008",
- 22, $dcvars->{PASSWORD},
+ $dcvars->{PASSWORD},
$dcvars->{SERVER_IP});
$ctx->{smb_conf_extra_options} = "
@@ -1056,7 +1057,7 @@ sub provision_subdom_dc($$$)
"SAMBASUBDOM",
"sub.samba.example.com",
"2008",
- 31, $dcvars->{PASSWORD},
+ $dcvars->{PASSWORD},
undef);
$ctx->{smb_conf_extra_options} = "
@@ -1119,7 +1120,6 @@ sub provision_dc($$)
"SAMBADOMAIN",
"samba.example.com",
"2008",
- 21,
"locDCpass1",
undef, "netbios aliases = localDC1-a");
@@ -1149,7 +1149,6 @@ sub provision_fl2000dc($$)
"SAMBA2000",
"samba2000.example.com",
"2000",
- 25,
"locDCpass5",
undef, "");
@@ -1172,7 +1171,6 @@ sub provision_fl2003dc($$)
"SAMBA2003",
"samba2003.example.com",
"2003",
- 26,
"locDCpass6",
undef, "");
@@ -1195,7 +1193,6 @@ sub provision_fl2008r2dc($$)
"SAMBA2008R2",
"samba2008R2.example.com",
"2008_R2",
- 27,
"locDCpass7",
undef, "");
@@ -1219,7 +1216,7 @@ sub provision_rodc($$$)
"SAMBADOMAIN",
"samba.example.com",
"2008",
- 28, $dcvars->{PASSWORD},
+ $dcvars->{PASSWORD},
$dcvars->{SERVER_IP});
unless ($ctx) {
return undef;
@@ -1306,7 +1303,6 @@ dcerpc endpoint servers = -unixinfo -rpcecho -spoolss -winreg -wkssvc -srvsvc
"PLUGINDOMAIN",
"plugin.samba.example.com",
"2008",
- 30,
"locDCpass1",
undef, $extra_smbconf_options);
@@ -1336,7 +1332,6 @@ sub provision_chgdcpass($$)
"CHDCDOMAIN",
"chgdcpassword.samba.example.com",
"2008",
- 31,
"chgDCpass1",
undef);