From 1791729abde0b6339465c7b8ee66998612c18259 Mon Sep 17 00:00:00 2001 From: freesource Date: Thu, 29 Nov 2001 04:24:46 +0000 Subject: [PATCH] This completes the NSS PAM interface, they both can be turned off or on via the Yard Box now. --- BootRoot/Yard.pm | 52 ++++++++++++++++++++++++----------------- BootRoot/YardBox.pm | 56 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 80 insertions(+), 28 deletions(-) diff --git a/BootRoot/Yard.pm b/BootRoot/Yard.pm index 488f0e7..4691628 100644 --- a/BootRoot/Yard.pm +++ b/BootRoot/Yard.pm @@ -486,45 +486,55 @@ sub read_contents_file { # Uses include_file sub extra_links { - my ($contents_file) = @_; + my ($contents_file, $nss_pam) = @_; #info(0, "PASS 2: Picking up extra files from links, and finding pam and nss service modules...\n"); info(0, "PASS 2: Picking up extra files from links...\n"); # First we find nss and pam stuff if asked for. + my $find_nss = $nss_pam->{60}{conf_nss}; + my $find_pam = $nss_pam->{61}{conf_pam}; - for my $file (keys %Included) { + if ( $find_nss == 1 || $find_pam == 1 ) { - ##### Use replacement file if specified - $file = $replaced_by{$file} if defined($replaced_by{$file}); + for my $file (keys %Included) { - ## Here's where some cool stuff happens - ## This can be turned on/off from the YardBox - ## pam service modules are check for dependencies, - ## mostly this translates into libnsl. + ##### Use replacement file if specified + $file = $replaced_by{$file} if defined($replaced_by{$file}); - ## NSS --freesource - if ( $file =~ m,/nsswitch.conf, ) { + ## Here's where some cool stuff happens + ## This can be turned on/off from the YardBox + ## pam service modules are check for dependencies, + ## mostly this translates into libnsl. --freesource + + ## NSS + if ( $find_nss == 1 ) { + if ( $file =~ m,/nsswitch.conf, ) { + + my @nss_libs = find_nss($file); + foreach ( @nss_libs ) { + $Included{$_} = 1; # adding on the run + } - my @nss_libs = find_nss($file); - foreach ( @nss_libs ) { - $Included{$_} = 1; # adding on the run + } } - } + ## PAM + if ( $find_pam == 1 ) { + if ( $file =~ m,/pam\.conf|/pam\.d/, ) { - ## PAM - if ( $file =~ m,/pam\.conf|/pam\.d/, ) { + my @pam_libs = find_pam($file); + foreach ( @pam_libs ) { + $Included{$_} = 1; # adding on the run + } - my @pam_libs = find_pam($file); - foreach ( @pam_libs ) { - $Included{$_} = 1; # adding on the run + } } - } + } # for loop - } + } # end for nss pam info(0,"\n"); diff --git a/BootRoot/YardBox.pm b/BootRoot/YardBox.pm index 938ee00..18a508e 100644 --- a/BootRoot/YardBox.pm +++ b/BootRoot/YardBox.pm @@ -143,11 +143,13 @@ my @menu_items = ( { path => '/File', { path => '/Edit/Settings/settings_separator', type => '' }, { path => '/Edit/Settings/NSS Config', - action => "1111", - type => '' }, + action => "60", + type => '', + callback => \&nss_pam }, { path => '/Edit/Settings/PAM Config', - action => '1112', - type => '' }, + action => '61', + type => '', + callback => \&nss_pam }, { path => '/Edit/Stages/' }, { path => '/Edit/Stages/one-by-one', @@ -602,9 +604,38 @@ sub check { } +############ +# NSS PAM # +############ + +my %nss_pam = ( + 60 => { + conf_nss => 1, + }, + 61 => { + conf_pam => 1, + }, +); + +sub nss_pam { + + my ($widget,$action) = @_; + + my @label = keys( % { $nss_pam{$action} } ); + # off + if ($nss_pam{$action}{$label[0]} == 1) { + $nss_pam{$action}{$label[0]} = 0; + } + # on + else { + $nss_pam{$action}{$label[0]} = 1; + } + +} + sub links_deps { - my $error = extra_links($changed_text); + my $error = extra_links($changed_text, \%nss_pam); return if $error && $error eq "ERROR"; $error = hard_links(); @@ -703,6 +734,7 @@ sub test { return if $error && $error eq "ERROR"; } + ######################### # CHECK STAGE VARIABLES # ######################### @@ -856,7 +888,11 @@ sub yard_box { # 34 test_passwd 1 (default) 0 # 35 test_pam 1 (default) 0 # 36 test_nss 1 (default) 0 - + # + # NSS PAM Conf HOH = %nss_pam + # ----------------------------------------- + # 60 conf_nss 1 (default) 0 + # 61 conf_nss 1 (default) 0 # Stages $one_by_one = $item_factory->get_item('/Edit/Stages/one-by-one'); @@ -992,6 +1028,12 @@ sub yard_box { my $test_nss = $item_factory->get_item('/Tests/nss'); $test_nss->active(1); + # PAM NSS Conf + my $conf_nss = $item_factory->get_item('/Edit/Settings/NSS Config'); + $conf_nss->active(1); + my $conf_pam = $item_factory->get_item('/Edit/Settings/PAM Config'); + $conf_pam->active(1); + #_______________________________________ # Create the GtkText widget $text = new Gtk::Text( undef, undef ); @@ -1807,7 +1849,7 @@ Selection Shortcuts Searching Shortcuts - Alt-S Search Template + Alt-S Search Template File Shortcuts