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 ++++++++++++------- perl-install/standalone/drakauth | 3 +-- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'perl-install') 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); diff --git a/perl-install/standalone/drakauth b/perl-install/standalone/drakauth index 6a43a2f87..d29f250ca 100755 --- a/perl-install/standalone/drakauth +++ b/perl-install/standalone/drakauth @@ -13,8 +13,7 @@ read_all_conf('', my $netc = {}, my $_intf = {}); my $in = 'interactive'->vnew('su'); - -my $authentication = {}; # TODO +my $authentication = authentication::get(); my $kind = authentication::to_kind($authentication); my $meta_class = { getVarsFromSh("/etc/sysconfig/system") }->{META_CLASS}; -- cgit v1.2.1