3 # Save automatic unix user authentication options
5 require './acl-lib.pl';
7 &error_setup($text{'unix_err'});
8 $access{'unix'} && $access{'create'} && $access{'delete'} ||
9 &error($text{'unix_ecannot'});
11 # Parse Unix auth table
12 if (!$in{'unix_def'}) {
13 for($i=0; defined($mode = $in{"mode_$i"}); $i++) {
16 if ($mode == 2 && !$who) {
17 &error(&text('unix_ewhogroup', $i+1));
19 elsif ($mode == 3 && !$who) {
20 &error(&text('unix_ewhouser', $i+1));
23 push(@unix, [ $mode == 1 ? "*" :
24 $mode == 2 ? "\@$who" : $who, $to ]);
26 @unix || &error($text{'unix_enone'});
29 # Parse list of allowed users
30 @users = split(/\s+/, $in{"users"});
33 if ($u =~ /^\@(\S+)$/) {
34 defined(getgrnam($1)) ||
35 &error(&text('unix_egroup', "$1"));
37 elsif ($u =~ /^(\d*)-(\d*)$/ && ($1 || $2)) {
41 defined(getpwnam($u)) ||
42 &error(&text('unix_euser', $u));
46 if ($in{'shells_deny'}) {
47 -r $in{'shells'} || &error($text{'unix_eshell'});
50 &lock_file($ENV{'MINISERV_CONFIG'});
51 &get_miniserv_config(\%miniserv);
52 &save_unixauth(\%miniserv, \@unix);
53 delete($miniserv{"allowusers"});
54 delete($miniserv{"denyusers"});
55 if ($in{"access"} == 1) { $miniserv{"allowusers"} = join(' ', @users); }
56 elsif ($in{"access"} == 2) { $miniserv{"denyusers"} = join(' ', @users); }
57 if ($in{'shells_deny'}) {
58 $miniserv{'shells_deny'} = $in{'shells'};
61 delete($miniserv{'shells_deny'});
64 &has_command("sudo") || &error(&text('unix_esudo', "<tt>sudo</tt>"));
66 $@ && &error(&text('unix_esudomod', "<tt>IO::Pty</tt>"));
68 $miniserv{'sudo'} = $in{'sudo'};
69 $miniserv{'pamany'} = $in{'pamany'} ? $in{'pamany_user'} : undef;
70 &put_miniserv_config(\%miniserv);
71 &unlock_file($ENV{'MINISERV_CONFIG'});
72 if ($oldsudo != $in{'sudo'}) {