Handle hostnames with upper-case letters
[webmin.git] / nis / save_aliases.cgi
1 #!/usr/local/bin/perl
2 # save_aliases.cgi
3 # Create, update or delete an alias
4
5 require './nis-lib.pl';
6 &ReadParse();
7
8 ($t, $lnums, $alias) = &table_edit_setup($in{'table'}, $in{'line'}, '[\s:]+');
9 if ($in{'delete'}) {
10         # Just delete the alias
11         &table_delete($t, $lnums);
12         }
13 else {
14         # Validate inputs and save the alias
15         &error_setup($text{'aliases_err'});
16         $in{'from'} =~ /^[^:@ ]+$/ || &error($text{'aliases_efrom'});
17         @to = split(/\s+/, $in{'to'});
18         @to || &error($text{'aliases_eto'});
19         @alias = ( $in{'from'}, join(",", @to) );
20         if ($in{'line'} eq '') {
21                 &table_add($t, ":", \@alias);
22                 }
23         else {
24                 &table_update($t, $lnums, ":", \@alias);
25                 }
26         }
27 &apply_table_changes() if (!$config{'manual_build'});
28 &redirect("edit_tables.cgi?table=$in{'table'}");
29