2 # Update one LDAP switch
4 if (-r 'ldap-client-lib.pl') {
5 require './ldap-client-lib.pl';
8 require './nis-lib.pl';
10 require './switch-lib.pl';
12 &error_setup($text{'eswitch_err'});
14 # Get the current service
15 &lock_file($nsswitch_config_file);
16 $conf = &get_nsswitch_config();
17 ($switch) = grep { $_->{'name'} eq $in{'name'} } @$conf;
18 $switch || &error($text{'eswitch_egone'});
20 # Validate and store inputs
22 for($i=0; defined($src = $in{"src_$i"}); $i++) {
24 $s = { 'src' => $src };
25 foreach $st (&list_switch_statuses()) {
26 if ($in{"status_".$st."_".$i}) {
27 $s->{$st} = $in{"status_".$st."_".$i};
32 @srcs || &error($text{'eswitch_enone'});
33 $switch->{'srcs'} = \@srcs;
36 &save_nsswitch_config($switch);
37 &unlock_file($nsswitch_config_file);
38 &webmin_log("modify", "switch", $switch->{'name'});
40 &redirect("list_switches.cgi");