1 |
95b003ff
|
Origo
|
#!/usr/bin/perl
|
2 |
|
|
# save_auth.cgi
|
3 |
|
|
# Save commands and allowed users
|
4 |
|
|
|
5 |
|
|
require './mon-lib.pl';
|
6 |
|
|
&ReadParse();
|
7 |
|
|
&error_setup($text{'auth_err'});
|
8 |
|
|
|
9 |
|
|
@types = &unique(split(/\s+/, $in{'types'}), &list_auth_types());
|
10 |
|
|
foreach $t (@types) {
|
11 |
|
|
local $m = $in{"${t}_mode"};
|
12 |
|
|
if ($m == 2) {
|
13 |
|
|
$out .= "$t:\n";
|
14 |
|
|
}
|
15 |
|
|
elsif ($m == 1) {
|
16 |
|
|
$out .= "$t:\tall\n";
|
17 |
|
|
}
|
18 |
|
|
elsif ($m == 0) {
|
19 |
|
|
local @users = split(/\s+/, $in{$t});
|
20 |
|
|
@users || &error(&text('auth_eusers', $t));
|
21 |
|
|
$out .= "$t:\t".join(",", @users)."\n";
|
22 |
|
|
}
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
$file = &mon_auth_file();
|
26 |
|
|
&open_tempfile(FILE, ">$file");
|
27 |
|
|
&print_tempfile(FILE, $out);
|
28 |
|
|
&close_tempfile(FILE);
|
29 |
|
|
|
30 |
|
|
&redirect("");
|