Handle hostnames with upper-case letters
[webmin.git] / webmin / change_ca.cgi
1 #!/usr/local/bin/perl
2 # change_ca.cgi
3 # Update the CA cert manually
4
5 require './webmin-lib.pl';
6 &ReadParseMime();
7 &lock_file($ENV{'MINISERV_CONFIG'});
8 &get_miniserv_config(\%miniserv);
9 if (!$miniserv{'ca'}) {
10         &setup_ca(\%miniserv);
11         }
12
13 &lock_file($miniserv{'ca'});
14 &open_tempfile(CA, ">$miniserv{'ca'}");
15 $in{'cert'} =~ s/\r//g;
16 $in{'cert'} =~ s/\n*$/\n/;
17 &print_tempfile(CA, $in{'cert'});
18 &close_tempfile(CA);
19 chmod(0700, $miniserv{'ca'});
20 &unlock_file($miniserv{'ca'});
21
22 unlink("$config_directory/acl/crl.pem");
23 &put_miniserv_config(\%miniserv);
24 &unlock_file($ENV{'MINISERV_CONFIG'});
25 &redirect("");
26 sleep(1);
27 &show_restart_page();
28 &webmin_log("changeca", undef, undef, \%in);