Added key fetching code to fingerserv
authortausq <>
Tue, 5 Oct 1999 00:54:29 +0000 (00:54 +0000)
committertausq <>
Tue, 5 Oct 1999 00:54:29 +0000 (00:54 +0000)
Added --no-default-keyring and --no-options to Util.pm

ud-fingerserv
web/Util.pm

index 0e49f03..915715d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: ud-fingerserv,v 1.1 1999/10/04 06:51:45 tausq Exp $
+# $Id: ud-fingerserv,v 1.2 1999/10/05 02:54:29 tausq Exp $
 
 # (c) 1999 Randolph Chung. Licensed under the GPL. <tausq@debian.org>
 
@@ -17,10 +17,12 @@ my %attrs = (
   'cn' => 'First name',
   'mn' => 'Middle name',
   'sn' => 'Last name',
-  'keyfingerprint' => 'Fingerprint'
+  'keyfingerprint' => 'Fingerprint',
+  'key' => 'Key block',
+  'ircnick' => 'IRC nickname'
 );
 
-my @summarykeys = ('cn', 'mn', 'sn', 'keyfingerprint');
+my @summarykeys = ('cn', 'mn', 'sn', 'ircnick', 'keyfingerprint', 'key');
 
 my ($ldap, $mesg, $dn, $entries, $data, %output, $key, $hostlist, $hostdetails, $selected, %summary);
 sub DieHandler {
@@ -61,6 +63,12 @@ while ($client = $server->accept()) {
   foreach $dn (sort {$entries->{$a}->{sn}->[0] <=> $entries->{$b}->{sn}->[0]} keys(%$entries)) {
     $data = $entries->{$dn};
 
+    $data->{key} = [];    
+    foreach (@{$data->{keyfingerprint}}) {
+      push (@{$data->{key}}, "\n".&Util::FetchKey($_));
+    }
+
+    print $client "$dn\n";
     if (!$fields) {
       foreach $key (@summarykeys) {
         foreach (@{$data->{$key}}) {
@@ -69,7 +77,7 @@ while ($client = $server->accept()) {
         }
       }
     } else {
-      print "$fields\n";
+#      print "$fields\n";
       foreach $key (split(/,/, $fields)) {
         foreach (@{$data->{$key}}) {
           print $client "$attrs{$key}: ";
index 4cbec32..89ef3fb 100644 (file)
@@ -6,6 +6,7 @@ use Crypt::Blowfish;
 
 my $blocksize = 8; # A blowfish block is 8 bytes
 my $configfile = "/etc/userdir-ldap/userdir-ldap.conf";
+#my $configfile = "./userdir-ldap.conf";
 
 my %config = &ReadConfigFile;
 
@@ -169,7 +170,7 @@ sub FormatFingerPrint {
 
 sub FetchKey {
   my $fingerprint = shift;
-  my ($out, $keyringparam);
+  my ($out, $keyringparam) = undef;
   
   foreach (split(/:/, $config{keyrings})) {
     $keyringparam .= "--keyring $_ ";
@@ -179,10 +180,10 @@ sub FetchKey {
   $fingerprint = "0x".$fingerprint;
 
   $/ = undef; # just suck it up ....
-  open(FP, "$config{gpg} $keyringparam --list-sigs --fingerprint $fingerprint|");
+  open(FP, "$config{gpg} --no-options --no-default-keyring $keyringparam --list-sigs --fingerprint $fingerprint|");
   $out = <FP>;
   close FP;
-  open(FP, "$config{gpg} $keyringparam --export -a $fingerprint|");
+  open(FP, "$config{gpg} --no-options --no-default-keyring $keyringparam --export -a $fingerprint|");
   $out .= <FP>;
   close FP;
   $/ = "\n";