summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-01-14 15:14:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-01-14 15:14:23 +0000
commit1107d112f09d042acae7ea7aaadc0db654b3ca1f (patch)
tree24fcad3eba55e143d211c5932be88aba1901a619
parentb78808c5d103a2a9041fe495868e1f8623c40066 (diff)
downloaddrakx-1107d112f09d042acae7ea7aaadc0db654b3ca1f.tar
drakx-1107d112f09d042acae7ea7aaadc0db654b3ca1f.tar.gz
drakx-1107d112f09d042acae7ea7aaadc0db654b3ca1f.tar.bz2
drakx-1107d112f09d042acae7ea7aaadc0db654b3ca1f.tar.xz
drakx-1107d112f09d042acae7ea7aaadc0db654b3ca1f.zip
fix switching back nsswitch.conf to local authentication (bugzilla #13024)
-rw-r--r--perl-install/authentication.pm27
1 files changed, 17 insertions, 10 deletions
diff --git a/perl-install/authentication.pm b/perl-install/authentication.pm
index 8321ff89a..01436cfe6 100644
--- a/perl-install/authentication.pm
+++ b/perl-install/authentication.pm
@@ -32,6 +32,16 @@ my %kind2pam_kind = (
SMBKRB => ['winbind'],
);
+my %kind2nsswitch = (
+ local => [],
+ SmartCard => [],
+ LDAP => ['ldap'],
+ NIS => ['nis'],
+ AD => ['ldap'],
+ winbind => ['winbind'],
+ SMBKRB => ['winbind'],
+);
+
sub kind2description() {
join('',
map {
@@ -197,6 +207,10 @@ sub set {
sshd_config_UsePAM(@$pam_modules > 0);
set_pam_authentication(@$pam_modules);
+ my $nsswitch = $kind2nsswitch{$kind} or log::l("kind2nsswitch does not know $kind");
+ $nsswitch ||= [];
+ set_nsswitch_priority(@$nsswitch);
+
if ($kind eq 'local') {
} elsif ($kind eq 'SmartCard') {
$in->do_pkgs->install('castella-pam');
@@ -208,8 +222,6 @@ sub set {
first($s =~ /namingContexts: (.+)/);
} or log::l("no ldap domain found on server $authentication->{LDAP_server}"), return;
- set_nsswitch_priority('ldap');
-
update_ldap_conf(
host => $authentication->{LDAP_server},
base => $domain,
@@ -221,8 +233,6 @@ sub set {
$in->do_pkgs->install(qw(nss_ldap pam_krb5 libsasl2-plug-gssapi));
my $port = "389";
- set_nsswitch_priority('ldap');
-
my $ssl = {
anonymous => 'off',
simple => 'off',
@@ -289,7 +299,6 @@ sub set {
$_ .= "$t $authentication->{NIS_server}\n" if eof;
} "$::prefix/etc/yp.conf";
- set_nsswitch_priority('nis');
#- no need to modify system-auth for nis
$when_network_is_up->(sub {
@@ -305,7 +314,6 @@ sub set {
my $domain = uc $netc->{WINDOMAIN};
$in->do_pkgs->install('samba-winbind');
- set_nsswitch_priority('winbind');
require network::smb;
network::smb::write_smb_conf($domain);
@@ -326,8 +334,6 @@ sub set {
configure_krb5_for_AD($authentication);
$in->do_pkgs->install('samba-winbind', 'pam_krb5', 'samba-server', 'samba-client');
- set_nsswitch_priority('winbind');
-
require network::smb;
network::smb::write_smb_ads_conf($domain,$realm);
@@ -440,10 +446,11 @@ sub get_pam_authentication_kinds() {
sub set_nsswitch_priority {
my (@kinds) = @_;
- # allowed: files nis ldap dns
+ my @known = qw(nis ldap winbind);
substInFile {
if (my ($database, $l) = /^(\s*(?:passwd|shadow|group|automount):\s*)(.*)/) {
- $_ = $database . join(' ', uniq('files', @kinds, split(' ', $l))) . "\n";
+ my @l = difference2([ split(' ', $l) ], \@known);
+ $_ = $database . join(' ', uniq('files', @kinds, @l)) . "\n";
}
} "$::prefix/etc/nsswitch.conf";
}