Handle hostnames with upper-case letters
[webmin.git] / dhcpd / edit_keys.cgi
1 #!/usr/bin/perl
2 # $Id: edit_keys.cgi,v 1.2 2005/04/16 14:30:21 jfranken Exp $
3 # File added 2005-04-15 by Johannes Franken <jfranken@jfranken.de>
4 # Distributed under the terms of the GNU General Public License, v2 or later
5 #
6 # * Display TSIG keys for updates to DNS servers
7 #
8
9 require './dhcpd-lib.pl';
10 require './params-lib.pl';
11 &ReadParse();
12 $conf = &get_config();
13 @keys = ( &find("key", $conf), { } );
14
15 # check acls
16 # %access = &get_module_acl();
17 # &error_setup($text{'eacl_aviol'});
18 # &error("$text{'eacl_np'} $text{'eacl_pss'}") if !&can('r',\%access,$sub);
19
20 if ($in{'new'}) {
21         &ui_print_header($desc, $text{'keys_create'}, "");
22         }
23 else {
24         &ui_print_header($desc, $text{'keys_edit'}, "");
25         $key = $sub->{'members'}->[$in{'idx'}];
26         }
27
28 print "<form action=save_keys.cgi>\n";
29 print "<table border>\n";
30 print "<tr $tb> <td><b>$text{'keys_id'}</b></td> ",
31       "<td><b>$text{'keys_alg'}</b></td> ",
32       "<td><b>$text{'keys_secret'}</b></td> </tr>\n";
33 for($i=0; $i<@keys; $i++) {
34         $k = $keys[$i];
35         print "<tr $cb>\n";
36         printf "<td><input name=id_$i size=15 value='%s'></td>\n",
37                 $k->{'value'};
38
39         @algs = ( "hmac-md5" );
40         $alg = &find_value("algorithm", $k->{'members'});
41         print "<td><select name=alg_$i>\n";
42         local $found;
43         foreach $a (@algs) {
44                 printf "<option %s>%s\n", $alg eq $a ? "selected" : "", $a;
45                 $found++ if ($alg eq $a);
46                 }
47         print "<option selected>$alg\n" if (!$found && $alg);
48         print "</select></td>\n";
49
50         printf "<td><input name=secret_$i size=64 value='%s'></td> </tr>\n",
51                 &find_value("secret", $k->{'members'});
52         }
53 print "</table>\n";
54 print "<input type=submit value=\"$text{'save'}\"></form>\n";
55
56 &ui_print_footer("", $text{'index_return'});
57