summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Vyatta/Login/RadiusServer.pm19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/Vyatta/Login/RadiusServer.pm b/lib/Vyatta/Login/RadiusServer.pm
index 275f9e47..9eec4aa3 100644
--- a/lib/Vyatta/Login/RadiusServer.pm
+++ b/lib/Vyatta/Login/RadiusServer.pm
@@ -29,8 +29,14 @@ my $PAM_RAD_AUTH = "/usr/share/pam-configs/radius";
my $PAM_RAD_SYSCONF = "/opt/vyatta/etc/pam_radius.cfg";
sub remove_pam_radius {
+ qx'sed -i -e \'/^passwd:.*mapuid[ \t]/s/mapuid[ \t]//\' \
+ -e \'/^passwd:.*[ \t]mapname/s/[ \t]mapname//\' \
+ -e \'/^group:.*[ \t]mapname/s/[ \t]mapname//\' \
+ -e \'s/[ \t]*$//\' \
+ /etc/nsswitch.conf';
+
system("DEBIAN_FRONTEND=noninteractive " .
- " pam-auth-update --package --remove radius") == 0
+ "pam-auth-update --package --remove radius") == 0
or die "pam-auth-update remove failed";
unlink($PAM_RAD_AUTH)
@@ -43,7 +49,16 @@ sub add_pam_radius {
system("DEBIAN_FRONTEND=noninteractive " .
"pam-auth-update --package radius") == 0
- or die "pam-auth-update add failed"
+ or die "pam-auth-update add failed";
+
+ qx'sed -i -e \'/\smapname/b\' \
+ -e \'/^passwd:/s/\s\s*/&mapuid /\' \
+ -e \'/^passwd:.*#/s/#.*/mapname &/\' \
+ -e \'/^passwd:[^#]*$/s/$/ mapname &/\' \
+ -e \'/^group:.*#/s/#.*/ mapname &/\' \
+ -e \'/^group:[^#]*$/s/: */&mapname /\' \
+ /etc/nsswitch.conf' == 0
+ or die "NSS configuration failed";
}
sub update {