Include accountname in totp url
[mirror/userdir-ldap-cgi.git] / fetchkey.cgi
1 #!/usr/bin/perl -wT
2
3 # $Id: fetchkey.cgi,v 1.4 2004/11/18 14:23:05 joey Exp $
4 # (c) 1999 Randolph Chung. Licensed under the GPL. <tausq@debian.org>
5
6 use lib '.';
7 use strict;
8 use CGI;
9 use Util;
10
11 # Global settings...
12 my %config = &Util::ReadConfigFile;
13 for my $key (keys %config) {
14     $key =~ /(.*)/;
15     $config{$key} = $1;
16 }
17
18 my $query = new CGI;
19 print "Content-type: text/plain\n\n";
20
21 my $fp = $query->param('fingerprint');
22 $fp =~ /^([A-Fa-f0-9]+)$/;
23 $fp = $1;
24
25 if ($fp) {
26   my $key = &Util::FetchKey($fp, 0);
27   if ($key) {
28     print $key;
29   } else {
30     print "Sorry, no key found matching fingerprint $fp\n";
31   }
32 } else {
33   print "No fingerprint given\n";
34 }
35
36 exit 0;
37