3 # Update a module line in a service
5 require './pam-lib.pl';
7 &error_setup($text{'mod_err'});
8 @pam = &get_pam_config();
9 $pam = $pam[$in{'idx'}];
11 &lock_file($pam->{'file'});
14 $mod = $pam->{'mods'}->[$in{'midx'}];
15 &delete_module($pam->{'name'}, $mod);
20 $mod = { 'type' => $in{'_type'},
21 'module' => $in{'_module'} };
22 $module = $in{'_module'};
25 # Existing module entry
26 $mod = $pam->{'mods'}->[$in{'midx'}];
27 $module = $mod->{'module'};
30 $mod->{'control'} = $in{'control'};
32 if (-r "./$module.pl") {
35 if (!$module_has_no_args) {
36 foreach $a (split(/\s+/, $mod->{'args'})) {
37 if ($a =~ /^([^\s=]+)=(\S*)$/) {
44 &parse_module_args($pam, $mod, \%args);
45 foreach $a (keys %args) {
46 if ($args{$a} eq "") {
50 push(@args, "$a=$args{$a}");
53 $mod->{'args'} = join(" ", @args);
57 # Args entered manually
58 $mod->{'args'} = $in{'args'};
62 # Add the PAM module entry
63 &create_module($pam->{'name'}, $mod);
66 # Update the existing entry
67 &modify_module($pam->{'name'}, $mod);
70 &unlock_file($pam->{'file'});
71 &webmin_log($in{'delete'} ? "delete" : $in{'_module'} ? "create" : "modify",
72 "mod", $pam->{'name'}, $mod);
73 &redirect("edit_pam.cgi?idx=$in{'idx'}");