Handle hostnames with upper-case letters
[webmin.git] / apache / useradmin_update.pl
1
2 do 'apache-lib.pl';
3 do 'auth-lib.pl';
4
5 foreach $k (keys %config) {
6         if ($k =~ /^sync_(.*)$/) {
7                 push(@sync, [ $1, $config{$k} ]);
8                 }
9         }
10
11 # useradmin_create_user(&details)
12 sub useradmin_create_user
13 {
14 foreach $s (@sync) {
15         if ($s->[1] =~ /create/ && !&get_authuser($s->[0], $_[0]->{'user'})) {
16                 &lock_file($s->[0]);
17                 &create_authuser($s->[0], { 'user' => $_[0]->{'user'},
18                                             'pass' => $_[0]->{'pass'} });
19                 &unlock_file($s->[0]);
20                 }
21         }
22 }
23
24 # useradmin_delete_user(&details)
25 sub useradmin_delete_user
26 {
27 foreach $s (@sync) {
28         if ($s->[1] =~ /delete/) {
29                 &lock_file($s->[0]);
30                 &delete_authuser($s->[0], $_[0]->{'user'});
31                 &unlock_file($s->[0]);
32                 }
33         }
34 }
35
36 # useradmin_modify_user(&details)
37 sub useradmin_modify_user
38 {
39 foreach $s (@sync) {
40         if ($s->[1] =~ /modify/) {
41                 &lock_file($s->[0]);
42                 &save_authuser($s->[0], $_[0]->{'olduser'},
43                                { 'user' => $_[0]->{'user'},
44                                  'pass' => $_[0]->{'pass'} });
45                 &unlock_file($s->[0]);
46                 }
47         }
48 }
49
50 1;
51