From df93256cccd635dfbcaffe5d3240956bdd60ecb4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 3 Jun 2005 07:04:44 +0000 Subject: read existing authentication conf (only minimal support for now) --- perl-install/authentication.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'perl-install/authentication.pm') diff --git a/perl-install/authentication.pm b/perl-install/authentication.pm index 7a73e0c7c..c59bc2d2e 100644 --- a/perl-install/authentication.pm +++ b/perl-install/authentication.pm @@ -194,9 +194,14 @@ sub ask_root_password_and_authentication { sub get() { - my $system_auth = cat_("/etc/pam.d/system-auth"); + my @pam_kinds = get_pam_authentication_kinds(); + my @kinds = grep { intersection(\@pam_kinds, $kind2pam_kind{$_}) } keys %kind2pam_kind; - { md5 => $system_auth =~ /md5/, shadow => $system_auth =~ /shadow/ }; + my $system_auth = cat_("/etc/pam.d/system-auth"); + { + md5 => $system_auth =~ /md5/, shadow => $system_auth =~ /shadow/, + if_(@kinds, $kinds[0] => ''), + }; } sub set { @@ -383,6 +388,11 @@ sub get_raw_pam_authentication() { \%before_deny; } +sub get_pam_authentication_kinds() { + my $before_deny = get_raw_pam_authentication(); + map { s/pam_//; $_ } keys %{$before_deny->{auth}}; +} + sub set_pam_authentication { my (@authentication_kinds) = @_; @@ -447,11 +457,6 @@ sub set_pam_authentication { } "$::prefix/etc/pam.d/system-auth"; } -sub get_pam_authentication_kinds() { - my $before_deny = get_raw_pam_authentication(); - map { s/pam_//; $_ } keys %{$before_deny->{auth}}; -} - sub set_nsswitch_priority { my (@kinds) = @_; my @known = qw(nis ldap winbind); -- cgit v1.2.1