The branch, master has been updated via 8fc04d2ce31 selftest: Initialize DC_SERVER/etc variables in one place via 31c5d4c969c selftest: Add helper function to avoid repeated {DC_SERVER}=x via bc4c04380f1 selftest: Remove need for $RODC_DC_SERVER env variable via b348045955b selftest: Remove unused environment variables via ab37446230c tests: Tweak DRS tests to avoid unnecessary env variables via aeadf75c24a selftest: Export DC conf path for special cases via 8f9bb790bc3 selftest: Add common function to return cmd environment variables from a87660b3c47 third_party/nss_wrapper/wscript: check for libnsl and libsocket
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 8fc04d2ce314bd246eeac1b8aad2fa1c98049c37 Author: Tim Beale <timbe...@catalyst.net.nz> Date: Mon Feb 18 09:28:37 2019 +1300 selftest: Initialize DC_SERVER/etc variables in one place It's simpler to do setup DC_SERVER/etc in the same place we set SERVER/etc. (Rather than initializing them for every single testenv, like we were doing). Signed-off-by: Tim Beale <timbe...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Andrew Bartlett <abart...@samba.org> Autobuild-Date(master): Mon Feb 18 07:24:05 CET 2019 on sn-devel-144 commit 31c5d4c969c584c54ec20b0f9ae4d0a18d517b4c Author: Tim Beale <timbe...@catalyst.net.nz> Date: Wed Feb 13 15:52:00 2019 +1300 selftest: Add helper function to avoid repeated {DC_SERVER}=x For every 2-DC testenv we setup, we copy the $DC_SERVER value of the dependent testenv (i.e. the PDC) into the env variables for the new testenv. This means DC_SERVER always points to the PDC (or first DC). This adds a helper function to avoid repeating this code for every 2-DC environment we setup. Signed-off-by: Tim Beale <timbe...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit bc4c04380f1446c3732644cd656ff387b1d40188 Author: Tim Beale <timbe...@catalyst.net.nz> Date: Wed Feb 13 15:37:24 2019 +1300 selftest: Remove need for $RODC_DC_SERVER env variable Same deal as earlier patch - we can use the $SERVER env variable instead and avoid the need for this extra variable. Signed-off-by: Tim Beale <timbe...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit b348045955b728e88d3d261dff9996f07f01f2bb Author: Tim Beale <timbe...@catalyst.net.nz> Date: Wed Feb 13 14:50:12 2019 +1300 selftest: Remove unused environment variables We only really want generic environment variables. For 2+ DC environments, we have the $SERVER and $DC_SERVER (aka PDC) variables. However, lots of testenvs also export really specific environment variables, e.g. VAMPIRE_2000_DC_SERVER_IP (despite that testenv being only used for a single test case). Previously the <testenv>_SERVER variable was used for DRS tests, but we can avoid the need to do this now. The other variables are not used at all. The RODC and TRUST environment variables are still used by a few tests. SUBDOM_DC_SERVER is only used within Samba4.pm and not exported. Signed-off-by: Tim Beale <timbe...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit ab37446230c50a71dac7e7e00baf6cbfe937f60a Author: Tim Beale <timbe...@catalyst.net.nz> Date: Wed Feb 13 15:23:29 2019 +1300 tests: Tweak DRS tests to avoid unnecessary env variables Each DC used in a DRS test has its own '<testenv>_SERVER' environment variable, e.g. VAMPIRE_DC_SERVER. These variables are only used by test.py for DRS, but they're not actually needed. The $SERVER environment variable holds the same information, so we can just use this in test.py instead. Signed-off-by: Tim Beale <timbe...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit aeadf75c24a4af4143e389e2b27d3a90899fb638 Author: Tim Beale <timbe...@catalyst.net.nz> Date: Mon Feb 11 17:15:22 2019 +1300 selftest: Export DC conf path for special cases In a few rare cases, a test needs to assert aspects both client-side and server-side aspects. A typical example would be the audit logging, which is exercising client-side behaviour, but also asserting the server-side logging. Usually this has involved a kludge in tests.py to either use socket-wrapper explicitly, or hardcode in the server smb.conf path. This patch exposes the existing SERVERCONFFILE env variable to the tests. DC_SERVERCONFFILE has been added for 2 DC testenvs, where we need the PDC's smb.conf. The benefit of doing this way is the filepath/testenv-dependency logic is all self-contained with the Perl code, and it doesn't bleed out into tests.py as well. Signed-off-by: Tim Beale <timbe...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 8f9bb790bc3b2f587267b9ec01be603b4082e39e Author: Tim Beale <timbe...@catalyst.net.nz> Date: Wed Jan 30 16:31:40 2019 +1300 selftest: Add common function to return cmd environment variables We prefix samba-tool commands with a bunch of WRAPPER/CONF environment variables, in order for the command to work properly. These variables are duplicated all over the place in the selftest code. This patch adds a helper function to return the variables, so we can reduce the required code down to a single line in a lot of places. A couple of exceptions I've left alone: - drs replicate, which omits the RESOLV_WRAPPER_CONF/_HOSTS variables (I'm not sure whether that's deliberate or not). - create_backup(), which uses the backupfromdc's krb5.conf rather than the new testenv. Signed-off-by: Tim Beale <timbe...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: selftest/selftest.pl | 50 +----- selftest/target/Samba4.pm | 295 +++++++------------------------ source4/scripting/devel/selftest-vars.sh | 12 -- source4/selftest/tests.py | 30 ++-- 4 files changed, 86 insertions(+), 301 deletions(-) Changeset truncated at 500 lines: diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 3ee266c4d0a..9aea62a3d2a 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -821,9 +821,6 @@ my @exported_envvars = ( # stuff related to a trusted domain "TRUST_SERVER", - "TRUST_SERVER_IP", - "TRUST_SERVER_IPV6", - "TRUST_NETBIOSNAME", "TRUST_USERNAME", "TRUST_PASSWORD", "TRUST_DOMAIN", @@ -837,46 +834,6 @@ my @exported_envvars = ( "DC_NETBIOSNAME", "DC_NETBIOSALIAS", - # domain member - "MEMBER_SERVER", - "MEMBER_SERVER_IP", - "MEMBER_SERVER_IPV6", - "MEMBER_NETBIOSNAME", - "MEMBER_NETBIOSALIAS", - - # rpc proxy controller stuff - "RPC_PROXY_SERVER", - "RPC_PROXY_SERVER_IP", - "RPC_PROXY_SERVER_IPV6", - "RPC_PROXY_NETBIOSNAME", - "RPC_PROXY_NETBIOSALIAS", - - # domain controller stuff for Vampired DC - "VAMPIRE_DC_SERVER", - "VAMPIRE_DC_SERVER_IP", - "VAMPIRE_DC_SERVER_IPV6", - "VAMPIRE_DC_NETBIOSNAME", - "VAMPIRE_DC_NETBIOSALIAS", - - # domain controller stuff for RODC - "RODC_DC_SERVER", - "RODC_DC_SERVER_IP", - "RODC_DC_SERVER_IPV6", - "RODC_DC_NETBIOSNAME", - - # domain controller stuff for FL 2000 Vampired DC - "VAMPIRE_2000_DC_SERVER", - "VAMPIRE_2000_DC_SERVER_IP", - "VAMPIRE_2000_DC_SERVER_IPV6", - "VAMPIRE_2000_DC_NETBIOSNAME", - "VAMPIRE_2000_DC_NETBIOSALIAS", - - "PROMOTED_DC_SERVER", - "PROMOTED_DC_SERVER_IP", - "PROMOTED_DC_SERVER_IPV6", - "PROMOTED_DC_NETBIOSNAME", - "PROMOTED_DC_NETBIOSALIAS", - # server stuff "SERVER", "SERVER_IP", @@ -885,6 +842,13 @@ my @exported_envvars = ( "NETBIOSALIAS", "SAMSID", + # only use these 2 as a last resort. Some tests need to test both client- + # side and server-side. In this case, run as default client, ans access + # server's smb.conf as needed, typically using: + # param.LoadParm(filename_for_non_global_lp=os.environ['SERVERCONFFILE']) + "SERVERCONFFILE", + "DC_SERVERCONFFILE", + # user stuff "USERNAME", "USERID", diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 179a93ec06c..e4b05997a0c 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -475,6 +475,25 @@ sub get_dns_hub_env($) return undef; } +# Returns the environmental variables that we pass to samba-tool commands +sub get_cmd_env_vars +{ + my ($self, $localenv) = @_; + + my $cmd_env = "NSS_WRAPPER_HOSTS='$localenv->{NSS_WRAPPER_HOSTS}' "; + $cmd_env .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$localenv->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; + if (defined($localenv->{RESOLV_WRAPPER_CONF})) { + $cmd_env .= "RESOLV_WRAPPER_CONF=\"$localenv->{RESOLV_WRAPPER_CONF}\" "; + } else { + $cmd_env .= "RESOLV_WRAPPER_HOSTS=\"$localenv->{RESOLV_WRAPPER_HOSTS}\" "; + } + $cmd_env .= " KRB5_CONFIG=\"$localenv->{KRB5_CONFIG}\" "; + $cmd_env .= "KRB5CCNAME=\"$localenv->{KRB5_CCACHE}\" "; + $cmd_env .= "RESOLV_CONF=\"$localenv->{RESOLV_CONF}\" "; + + return $cmd_env; +} + sub setup_namespaces($$:$$) { my ($self, $localenv, $upn_array, $spn_array) = @_; @@ -493,16 +512,7 @@ sub setup_namespaces($$:$$) my $samba_tool = Samba::bindir_path($self, "samba-tool"); - my $cmd_env = "NSS_WRAPPER_HOSTS='$localenv->{NSS_WRAPPER_HOSTS}' "; - $cmd_env .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$localenv->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($localenv->{RESOLV_WRAPPER_CONF})) { - $cmd_env .= "RESOLV_WRAPPER_CONF=\"$localenv->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd_env .= "RESOLV_WRAPPER_HOSTS=\"$localenv->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd_env .= " KRB5_CONFIG=\"$localenv->{KRB5_CONFIG}\" "; - $cmd_env .= "KRB5CCNAME=\"$localenv->{KRB5_CCACHE}\" "; - $cmd_env .= "RESOLV_CONF=\"$localenv->{RESOLV_CONF}\" "; + my $cmd_env = $self->get_cmd_env_vars($localenv); my $cmd_config = " $localenv->{CONFIGURATION}"; @@ -522,9 +532,7 @@ sub setup_trust($$$$$) my ($self, $localenv, $remoteenv, $type, $extra_args) = @_; $localenv->{TRUST_SERVER} = $remoteenv->{SERVER}; - $localenv->{TRUST_SERVER_IP} = $remoteenv->{SERVER_IP}; - $localenv->{TRUST_SERVER_IPV6} = $remoteenv->{SERVER_IPV6}; - $localenv->{TRUST_NETBIOSNAME} = $remoteenv->{NETBIOSNAME}; + $localenv->{TRUST_USERNAME} = $remoteenv->{USERNAME}; $localenv->{TRUST_PASSWORD} = $remoteenv->{PASSWORD}; $localenv->{TRUST_DOMAIN} = $remoteenv->{DOMAIN}; @@ -534,16 +542,7 @@ sub setup_trust($$$$$) my $samba_tool = Samba::bindir_path($self, "samba-tool"); # setup the trust - my $cmd_env = "NSS_WRAPPER_HOSTS='$localenv->{NSS_WRAPPER_HOSTS}' "; - $cmd_env .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$localenv->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($localenv->{RESOLV_WRAPPER_CONF})) { - $cmd_env .= "RESOLV_WRAPPER_CONF=\"$localenv->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd_env .= "RESOLV_WRAPPER_HOSTS=\"$localenv->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd_env .= " KRB5_CONFIG=\"$localenv->{KRB5_CONFIG}\" "; - $cmd_env .= "KRB5CCNAME=\"$localenv->{KRB5_CCACHE}\" "; - $cmd_env .= "RESOLV_CONF=\"$localenv->{RESOLV_CONF}\" "; + my $cmd_env = $self->get_cmd_env_vars($localenv); my $cmd_config = " $localenv->{CONFIGURATION}"; my $cmd_creds = $cmd_config; @@ -907,21 +906,30 @@ nogroup:x:65534:nobody return undef; } + # Return the environment variables for the new testenv DC. + # Note that we have SERVER_X and DC_SERVER_X variables (which have the same + # value initially). In a 2 DC setup, $DC_SERVER_X will always be the PDC. my $ret = { KRB5_CONFIG => $ctx->{krb5_conf}, KRB5_CCACHE => $ctx->{krb5_ccache}, MITKDC_CONFIG => $ctx->{mitkdc_conf}, PIDDIR => $ctx->{piddir}, SERVER => $ctx->{hostname}, + DC_SERVER => $ctx->{hostname}, SERVER_IP => $ctx->{ipv4}, + DC_SERVER_IP => $ctx->{ipv4}, SERVER_IPV6 => $ctx->{ipv6}, + DC_SERVER_IPV6 => $ctx->{ipv6}, NETBIOSNAME => $ctx->{netbiosname}, + DC_NETBIOSNAME => $ctx->{netbiosname}, DOMAIN => $ctx->{domain}, USERNAME => $ctx->{username}, + DC_USERNAME => $ctx->{username}, REALM => $ctx->{realm}, DNSNAME => $ctx->{dnsname}, SAMSID => $ctx->{samsid}, PASSWORD => $ctx->{password}, + DC_PASSWORD => $ctx->{password}, LDAPDIR => $ctx->{ldapdir}, LDAP_INSTANCE => $ctx->{ldap_instance}, SELFTEST_WINBINDD_SOCKET_DIR => $ctx->{winbindd_socket_dir}, @@ -1265,6 +1273,22 @@ $extra_smbconf_shares return $self->provision_raw_step2($ctx, $ret); } +# For multi-DC testenvs, we want $DC_SERVER to always be the PDC (i.e. the +# original DC) in the testenv. $SERVER is always the joined DC that we are +# actually running the test against +sub set_pdc_env_vars +{ + my ($self, $env, $dcvars) = @_; + + $env->{DC_SERVER} = $dcvars->{DC_SERVER}; + $env->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP}; + $env->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6}; + $env->{DC_SERVERCONFFILE} = $dcvars->{SERVERCONFFILE}; + $env->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME}; + $env->{DC_USERNAME} = $dcvars->{DC_USERNAME}; + $env->{DC_PASSWORD} = $dcvars->{DC_PASSWORD}; +} + sub provision_s4member($$$$$) { my ($self, $prefix, $dcvars, $hostname, $more_conf) = @_; @@ -1307,16 +1331,7 @@ rpc_server:tcpip = no } my $samba_tool = Samba::bindir_path($self, "samba-tool"); - my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' "; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($ret->{RESOLV_WRAPPER_CONF})) { - $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" "; - $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" "; + my $cmd = $self->get_cmd_env_vars($ret); $cmd .= "$samba_tool domain join $ret->{CONFIGURATION} $dcvars->{REALM} member"; $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD}"; $cmd .= " --machinepass=machine$ret->{PASSWORD}"; @@ -1326,20 +1341,8 @@ rpc_server:tcpip = no return undef; } - $ret->{MEMBER_SERVER} = $ret->{SERVER}; - $ret->{MEMBER_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{MEMBER_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{MEMBER_NETBIOSNAME} = $ret->{NETBIOSNAME}; - $ret->{MEMBER_USERNAME} = $ret->{USERNAME}; - $ret->{MEMBER_PASSWORD} = $ret->{PASSWORD}; - $ret->{DOMSID} = $dcvars->{DOMSID}; - $ret->{DC_SERVER} = $dcvars->{DC_SERVER}; - $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME}; - $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME}; - $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD}; + $self->set_pdc_env_vars($ret, $dcvars); return $ret; } @@ -1390,16 +1393,7 @@ sub provision_rpc_proxy($$$) my $samba_tool = Samba::bindir_path($self, "samba-tool"); # The joind runs in the context of the rpc_proxy/member for now - my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' "; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($ret->{RESOLV_WRAPPER_CONF})) { - $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" "; - $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" "; + my $cmd = $self->get_cmd_env_vars($ret); $cmd .= "$samba_tool domain join $ret->{CONFIGURATION} $dcvars->{REALM} member"; $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD}"; $cmd .= " --machinepass=machine$ret->{PASSWORD}"; @@ -1438,20 +1432,8 @@ sub provision_rpc_proxy($$$) return undef; } - $ret->{RPC_PROXY_SERVER} = $ret->{SERVER}; - $ret->{RPC_PROXY_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{RPC_PROXY_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{RPC_PROXY_NETBIOSNAME} = $ret->{NETBIOSNAME}; - $ret->{RPC_PROXY_USERNAME} = $ret->{USERNAME}; - $ret->{RPC_PROXY_PASSWORD} = $ret->{PASSWORD}; - $ret->{DOMSID} = $dcvars->{DOMSID}; - $ret->{DC_SERVER} = $dcvars->{DC_SERVER}; - $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME}; - $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME}; - $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD}; + $self->set_pdc_env_vars($ret, $dcvars); return $ret; } @@ -1496,16 +1478,7 @@ sub provision_promoted_dc($$$) } my $samba_tool = Samba::bindir_path($self, "samba-tool"); - my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' "; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($ret->{RESOLV_WRAPPER_CONF})) { - $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" "; - $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" "; + my $cmd = $self->get_cmd_env_vars($ret); $cmd .= "$samba_tool domain join $ret->{CONFIGURATION} $dcvars->{REALM} MEMBER --realm=$dcvars->{REALM}"; $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD}"; $cmd .= " --machinepass=machine$ret->{PASSWORD}"; @@ -1516,16 +1489,7 @@ sub provision_promoted_dc($$$) } my $samba_tool = Samba::bindir_path($self, "samba-tool"); - my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' "; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($ret->{RESOLV_WRAPPER_CONF})) { - $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" "; - $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" "; + my $cmd = $self->get_cmd_env_vars($ret); $cmd .= "$samba_tool domain dcpromo $ret->{CONFIGURATION} $dcvars->{REALM} DC --realm=$dcvars->{REALM}"; $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD}"; $cmd .= " --machinepass=machine$ret->{PASSWORD} --use-ntvfs --dns-backend=BIND9_DLZ"; @@ -1535,17 +1499,7 @@ sub provision_promoted_dc($$$) return undef; } - $ret->{PROMOTED_DC_SERVER} = $ret->{SERVER}; - $ret->{PROMOTED_DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{PROMOTED_DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{PROMOTED_DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - - $ret->{DC_SERVER} = $dcvars->{DC_SERVER}; - $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME}; - $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME}; - $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD}; + $self->set_pdc_env_vars($ret, $dcvars); return $ret; } @@ -1600,16 +1554,7 @@ sub provision_vampire_dc($$$) } my $samba_tool = Samba::bindir_path($self, "samba-tool"); - my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' "; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($ret->{RESOLV_WRAPPER_CONF})) { - $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" "; - $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" "; + my $cmd = $self->get_cmd_env_vars($ret); $cmd .= "$samba_tool domain join $ret->{CONFIGURATION} $dcvars->{REALM} DC --realm=$dcvars->{REALM}"; $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD} --domain-critical-only"; $cmd .= " --machinepass=machine$ret->{PASSWORD} --use-ntvfs"; @@ -1620,23 +1565,7 @@ sub provision_vampire_dc($$$) return undef; } - if ($fl == "2000") { - $ret->{VAMPIRE_2000_DC_SERVER} = $ret->{SERVER}; - $ret->{VAMPIRE_2000_DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{VAMPIRE_2000_DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{VAMPIRE_2000_DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - } else { - $ret->{VAMPIRE_DC_SERVER} = $ret->{SERVER}; - $ret->{VAMPIRE_DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{VAMPIRE_DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{VAMPIRE_DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - } - $ret->{DC_SERVER} = $dcvars->{DC_SERVER}; - $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME}; - $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME}; - $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD}; + $self->set_pdc_env_vars($ret, $dcvars); $ret->{DC_REALM} = $dcvars->{DC_REALM}; return $ret; @@ -1683,16 +1612,7 @@ sub provision_subdom_dc($$$) Samba::mk_mitkdc_conf($ctx, abs_path(Samba::bindir_path($self, "shared"))); my $samba_tool = Samba::bindir_path($self, "samba-tool"); - my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' "; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($ret->{RESOLV_WRAPPER_CONF})) { - $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" "; - $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" "; + my $cmd = $self->get_cmd_env_vars($ret); $cmd .= "$samba_tool domain join $ret->{CONFIGURATION} $ctx->{dnsname} subdomain "; $cmd .= "--parent-domain=$dcvars->{REALM} -U$dcvars->{DC_USERNAME}\@$dcvars->{REALM}\%$dcvars->{DC_PASSWORD}"; $cmd .= " --machinepass=machine$ret->{PASSWORD} --use-ntvfs"; @@ -1704,16 +1624,8 @@ sub provision_subdom_dc($$$) } $ret->{SUBDOM_DC_SERVER} = $ret->{SERVER}; - $ret->{SUBDOM_DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{SUBDOM_DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{SUBDOM_DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - $ret->{DC_SERVER} = $dcvars->{DC_SERVER}; - $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $dcvars->{DC_NETBIOSNAME}; - $ret->{DC_USERNAME} = $dcvars->{DC_USERNAME}; - $ret->{DC_PASSWORD} = $dcvars->{DC_PASSWORD}; + $self->set_pdc_env_vars($ret, $dcvars); return $ret; } @@ -1762,12 +1674,6 @@ sub provision_ad_dc_ntvfs($$) return undef; } $ret->{NETBIOSALIAS} = "localdc1-a"; - $ret->{DC_SERVER} = $ret->{SERVER}; - $ret->{DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - $ret->{DC_USERNAME} = $ret->{USERNAME}; - $ret->{DC_PASSWORD} = $ret->{PASSWORD}; $ret->{DC_REALM} = $ret->{REALM}; return $ret; @@ -1808,12 +1714,6 @@ sub provision_fl2000dc($$) warn("Unable to add wins configuration"); return undef; } - $ret->{DC_SERVER} = $ret->{SERVER}; - $ret->{DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - $ret->{DC_USERNAME} = $ret->{USERNAME}; - $ret->{DC_PASSWORD} = $ret->{PASSWORD}; $ret->{DC_REALM} = $ret->{REALM}; return $ret; @@ -1847,12 +1747,6 @@ sub provision_fl2003dc($$$) return undef; } - $ret->{DC_SERVER} = $ret->{SERVER}; - $ret->{DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - $ret->{DC_USERNAME} = $ret->{USERNAME}; - $ret->{DC_PASSWORD} = $ret->{PASSWORD}; $ret->{DNS_FORWARDER1} = "127.0.0.$swiface1"; $ret->{DNS_FORWARDER2} = "127.0.0.$swiface2"; @@ -1907,12 +1801,6 @@ sub provision_fl2008r2dc($$$) warn("Unable to add wins configuration"); return undef; } - $ret->{DC_SERVER} = $ret->{SERVER}; - $ret->{DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - $ret->{DC_USERNAME} = $ret->{USERNAME}; - $ret->{DC_PASSWORD} = $ret->{PASSWORD}; $ret->{DC_REALM} = $ret->{REALM}; return $ret; @@ -1971,16 +1859,7 @@ sub provision_rodc($$$) } my $samba_tool = Samba::bindir_path($self, "samba-tool"); - my $cmd = "NSS_WRAPPER_HOSTS='$ret->{NSS_WRAPPER_HOSTS}' "; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - if (defined($ret->{RESOLV_WRAPPER_CONF})) { - $cmd .= "RESOLV_WRAPPER_CONF=\"$ret->{RESOLV_WRAPPER_CONF}\" "; - } else { - $cmd .= "RESOLV_WRAPPER_HOSTS=\"$ret->{RESOLV_WRAPPER_HOSTS}\" "; - } - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "KRB5CCNAME=\"$ret->{KRB5_CCACHE}\" "; - $cmd .= "RESOLV_CONF=\"$ret->{RESOLV_CONF}\" "; + my $cmd = $self->get_cmd_env_vars($ret); $cmd .= "$samba_tool domain join $ret->{CONFIGURATION} $dcvars->{REALM} RODC"; $cmd .= " -U$dcvars->{DC_USERNAME}\%$dcvars->{DC_PASSWORD}"; $cmd .= " --server=$dcvars->{DC_SERVER} --use-ntvfs"; @@ -2012,17 +1891,7 @@ sub provision_rodc($$$) Samba::mk_krb5_conf($ctx); Samba::mk_mitkdc_conf($ctx, abs_path(Samba::bindir_path($self, "shared"))); - $ret->{RODC_DC_SERVER} = $ret->{SERVER}; - $ret->{RODC_DC_SERVER_IP} = $ret->{SERVER_IP}; - $ret->{RODC_DC_SERVER_IPV6} = $ret->{SERVER_IPV6}; - $ret->{RODC_DC_NETBIOSNAME} = $ret->{NETBIOSNAME}; - - $ret->{DC_SERVER} = $dcvars->{DC_SERVER}; -- Samba Shared Repository