diff options
author | Christof Schmitt <christof.schmitt@us.ibm.com> | 2013-02-21 12:33:23 -0700 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-03-09 08:18:43 +0100 |
commit | 6ac0bdc4513bb5a7bf9ecf0cd0986f6122f96dba (patch) | |
tree | e8975a4bb3cd9a7ab87549906c6a9a0c99e63c69 /selftest | |
parent | 8241dafdb832808f0b88a7d83095105e7d532fa4 (diff) | |
download | samba-6ac0bdc4513bb5a7bf9ecf0cd0986f6122f96dba.tar.gz samba-6ac0bdc4513bb5a7bf9ecf0cd0986f6122f96dba.tar.bz2 samba-6ac0bdc4513bb5a7bf9ecf0cd0986f6122f96dba.zip |
Add testcase for idmap_rfc2307 module
Create a new test environment with 'idmap config DOMAIN : backend =
rfc2307'. A new test script adds LDAP records and queries them again for
the mapped uid and gid.
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Mar 9 08:18:43 CET 2013 on sn-devel-104
Diffstat (limited to 'selftest')
-rw-r--r-- | selftest/target/Samba.pm | 1 | ||||
-rwxr-xr-x | selftest/target/Samba3.pm | 79 | ||||
-rw-r--r-- | selftest/target/Samba4.pm | 6 |
3 files changed, 86 insertions, 0 deletions
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm index d8110536b2..fa18985433 100644 --- a/selftest/target/Samba.pm +++ b/selftest/target/Samba.pm @@ -171,6 +171,7 @@ sub get_interface($) $interfaces{"localsubdc"} = 31; $interfaces{"chgdcpass"} = 32; $interfaces{"promotedvdc"} = 33; + $interfaces{"rfc2307member"} = 34; # update lib/socket_wrapper/socket_wrapper.c # #define MAX_WRAPPED_INTERFACES 32 diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index c71419d4ba..8d9c4b9310 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -331,6 +331,85 @@ sub setup_admember($$$$) return $ret; } +sub setup_admember_rfc2307($$$$) +{ + 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 WITH idmap_rfc2307 config..."; + + my $member_options = " + security = ads + server signing = on + workgroup = $dcvars->{DOMAIN} + realm = $dcvars->{REALM} + idmap config $dcvars->{DOMAIN} : backend = rfc2307 + idmap config $dcvars->{DOMAIN} : range = 2000000-2999999 + idmap config $dcvars->{DOMAIN} : ldap_server = ad + idmap config $dcvars->{DOMAIN} : bind_path_user = ou=idmap,dc=samba,dc=example,dc=com + idmap config $dcvars->{DOMAIN} : bind_path_group = ou=idmap,dc=samba,dc=example,dc=com +"; + + my $ret = $self->provision($prefix, + "RFC2307MEMBER", + "loCalMemberPass", + $member_options); + + $ret or return undef; + + close(USERMAP); + $ret->{DOMAIN} = $dcvars->{DOMAIN}; + $ret->{REALM} = $dcvars->{REALM}; + + my $ctx; + my $prefix_abs = abs_path($prefix); + $ctx = {}; + $ctx->{krb5_conf} = "$prefix_abs/lib/krb5.conf"; + $ctx->{domain} = $dcvars->{DOMAIN}; + $ctx->{realm} = $dcvars->{REALM}; + $ctx->{dnsname} = lc($dcvars->{REALM}); + $ctx->{kdc_ipv4} = $dcvars->{SERVER_IP}; + Samba::mk_krb5_conf($ctx, ""); + + $ret->{KRB5_CONFIG} = $ctx->{krb5_conf}; + + my $net = Samba::bindir_path($self, "net"); + my $cmd = ""; + $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; + $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; + $cmd .= "$net join $ret->{CONFIGURATION}"; + $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}"; + + if (system($cmd) != 0) { + warn("Join failed\n$cmd"); + return undef; + } + + # We need world access to this share, as otherwise the domain + # administrator from the AD domain provided by Samba4 can't + # access the share for tests. + chmod 0777, "$prefix/share"; + + if (not $self->check_or_start($ret, "yes", "yes", "yes")) { + return undef; + } + + $ret->{DC_SERVER} = $dcvars->{SERVER}; + $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP}; + $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME}; + $ret->{DC_USERNAME} = $dcvars->{USERNAME}; + $ret->{DC_PASSWORD} = $dcvars->{PASSWORD}; + + # Special case, this is called from Samba4.pm but needs to use the Samba3 check_env and get_log_env + $ret->{target} = $self; + + return $ret; +} + sub setup_simpleserver($$) { my ($self, $path) = @_; diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 05541d944f..6f694143dd 100644 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -1661,6 +1661,12 @@ sub setup_env($$$) return $target3->setup_admember("$path/s3member", $self->{vars}->{dc}, 29); } elsif ($envname eq "plugin_s4_dc") { return $self->setup_plugin_s4_dc("$path/plugin_s4_dc"); + } elsif ($envname eq "s3member_rfc2307") { + if (not defined($self->{vars}->{dc})) { + $self->setup_dc("$path/dc"); + } + return $target3->setup_admember_rfc2307("$path/s3member_rfc2307", + $self->{vars}->{dc}, 34); } else { return "UNKNOWN"; } |