Handle hostnames with upper-case letters
[webmin.git] / usermin / download_cert.cgi
1 #!/usr/local/bin/perl
2 # Output the certificate in PEM or PKCS12 format
3
4 require './usermin-lib.pl';
5 &ReadParse();
6
7 &get_usermin_miniserv_config(\%miniserv);
8
9 if ($ENV{'PATH_INFO'} =~ /\.p12$/) {
10         # PKCS12 format
11         $data = &webmin::cert_pkcs12_data($miniserv{'keyfile'},
12                                           $miniserv{'certfile'});
13         $type = "application/x-pkcs12";
14         }
15 else {
16         # PEM format
17         $data = &webmin::cert_pem_data($miniserv{'certfile'} ||
18                                        $miniserv{'keyfile'});
19         $type = "text/plain";
20         }
21 if ($data) {
22         print "Content-type: $type\n\n";
23         print $data;
24         }
25 else {
26         &error($text{'ssl_edownload'});
27         }