This archive is retained to ensure existing URLs remain functional. It will not contain any emails sent to this mailing list after July 1, 2024. For all messages, including those sent before and after this date, please visit the new location of the archive at https://mailman.ripe.net/archives/list/[email protected]/
[patch] Support for GNU Privacy Guard [2.3.0]
- Previous message (by thread): New DB release 2.3.1
- Next message (by thread): [patch] Support for GNU Privacy Guard [2.3.0]
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Paul Gampe
paulg at apnic.net
Wed Oct 13 04:54:15 CEST 1999
Hello All, I have modified the RIPE Whois database code version 2.3.0 to support the (public domain) GNU Privacy Guard program instead of the (commercial) PGP International program for the PGP authentication. The patch is attached. I'll port this patch to 2.3.1 in the next week or so. GNU Privacy Guard does not use any patented algorithms and is under the GPL licence, so you do not need to purchase any licences to use it. Adding support for both PGP and GNU PG to the RIPE whois database was not that straightforward so this work is not yet in production. I would appreciate any feedback on anyone who decides to try it. GNU Privacy Guard and PGP International can both be used to update the database as GNU PG supports PGPi 5.x keys as well as the IETF standard for OpenPGP (RFC2440). Thanks to the RIPE-NCC for making their code available as always! Paulg. References:: GNU Privacy Guard: http://www.gnupg.org PGP International: http://www.pgpi.org OpenPGP WG: http://www.ietf.org/html.charters/openpgp-charter.html __________________________________________________________________________ For PGP Key ID B49E3514, mailto:paulg at apnic.net send mail with Subject: pgp-key-request phoneto:+61-7-3367-0490 Paul Gampe - Technical Team - APNIC Pty Ltd faxto:+61-7-3367-0482 __________________________________________________________________________ -------------- next part -------------- Index: pkginfo =================================================================== RCS file: /usr/local/cvs/ripe/whoisd/pkginfo,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** pkginfo 1999/08/27 08:20:31 1.3 --- pkginfo 1999/10/13 02:24:06 1.4 *************** *** 1,7 **** PKG="ripedb" ! NAME="RIPE Database Software - v2.3.0" ! VERSION=2.3.0 ARCH=i386 CATEGORY=application ! DESC="RIPE Database Software - Client and Server - v2.3.0" EMAIL="paulg at apnic.net" --- 1,7 ---- PKG="ripedb" ! NAME="RIPE Database Software - v2.3.0 - with GNU Privacy Guard Support" ! VERSION=2.3.0-gpg ARCH=i386 CATEGORY=application ! DESC="RIPE Database - Client and Server - v2.3.0 - with GNU Privacy Guard" EMAIL="paulg at apnic.net" Index: etc/ripedb.config-dist =================================================================== RCS file: /usr/local/cvs/ripe/whoisd/etc/ripedb.config-dist,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** ripedb.config-dist 1999/08/27 08:20:31 1.3 --- ripedb.config-dist 1999/10/13 02:24:06 1.4 *************** *** 19,25 **** # ############################################################################# # ! # $Id: ripedb.config-dist,v 1.3 1999/08/27 08:20:31 paulg Exp $ # # This is the RIPE database software main configuration file. # Almost all tools that manage the databases use some parts of this --- 19,25 ---- # ############################################################################# # ! # $Id: ripedb.config-dist,v 1.4 1999/10/13 02:24:06 paulg Exp $ # # This is the RIPE database software main configuration file. # Almost all tools that manage the databases use some parts of this *************** *** 307,313 **** # only include this if your perl5 and system don't do setpriority(2) #RENICECMD /usr/ucb/renice ! # PGPCMD # # PGPV and PGPK are the full pathnames of your PGP5.0i executables # --- 307,314 ---- # only include this if your perl5 and system don't do setpriority(2) #RENICECMD /usr/ucb/renice ! # PGPCMD (PGP or GNU Privacy Guard) ! # you can define GPG or (PGPV and PGPK) but not both. # # PGPV and PGPK are the full pathnames of your PGP5.0i executables # *************** *** 322,328 **** --- 323,342 ---- #PGPPATH /home/roman/ripedb/.pgp + # GPG is the full pathname of your GNU Privacy Guard Executable # + # comment these out if you don't want to support PGP authentication + # via the GNU Privacy Guard: gpg program + + #GPG /opt/gnupg/bin/gpg + + # GNUPGHOME is the directory where PGP process stores server's public key + # ring and where it might read the configuration file options (which is not + # needed for normal operations) + + #GNUPGHOME /var/opt/ripedb/.pgp + + # # MAILCMD is the command into which a composed e-mail is given as standard # input, to be send as mail. The message piped into this command has ALL # the necessary mail header to process the mail: *************** *** 440,445 **** --- 454,460 ---- # REPLYBANNER * This is a local APNIC MIRROR database mirror * # REPLYBANNER * please use whois.apnic.net for normal queries! * # REPLYBANNER ************************************************** + REPLYBANNER % Rights restricted by copyright. See http://www.apnic.net/db/dbcopyright.html # # What to display if no match was found *************** *** 851,965 **** COUNTRY AD ad COUNTRY AE ae COUNTRY AL al COUNTRY AM am COUNTRY AO ao COUNTRY AT at COUNTRY AU au COUNTRY AZ az COUNTRY BD bd COUNTRY BE be COUNTRY BF bf COUNTRY BG bg COUNTRY BH bh COUNTRY BN bn COUNTRY BT bt COUNTRY BY by COUNTRY CA ca COUNTRY CH ch COUNTRY CM cm COUNTRY CN cn COUNTRY CS cs ! COUNTRY CZ cz COUNTRY CY cy COUNTRY DE de COUNTRY DK dk COUNTRY DZ dz COUNTRY EE ee COUNTRY EG eg COUNTRY ES es COUNTRY EU eu COUNTRY FI fi COUNTRY FJ FJ COUNTRY FO fo COUNTRY FR fr COUNTRY GB gb COUNTRY GH gh COUNTRY GL gl COUNTRY GR gr COUNTRY GU gu COUNTRY HK hk COUNTRY HR hr COUNTRY HU hu COUNTRY ID id COUNTRY IE ie COUNTRY IL il COUNTRY IN in COUNTRY IR ir COUNTRY IS is COUNTRY IT it COUNTRY JO jo COUNTRY JP jp COUNTRY KE ke COUNTRY KG kg COUNTRY KR kr COUNTRY KW kw COUNTRY KZ kz COUNTRY LA la COUNTRY LB lb COUNTRY LI li COUNTRY LK lk COUNTRY LU lu COUNTRY LV lv ! COUNTRY LT lt COUNTRY MA ma COUNTRY MC mc COUNTRY MD md COUNTRY MK mk COUNTRY MN mn COUNTRY MO mo COUNTRY MT mt COUNTRY MU mu COUNTRY MY my COUNTRY NC nc COUNTRY NE ne COUNTRY NG ng COUNTRY NL nl COUNTRY NO no COUNTRY NP np COUNTRY NZ nz COUNTRY OM om COUNTRY PF pf COUNTRY PG pg COUNTRY PH ph COUNTRY PK pk COUNTRY PL pl COUNTRY PT pt COUNTRY QA qa COUNTRY RO ro COUNTRY RU ru COUNTRY SA sa COUNTRY SE se COUNTRY SG sg COUNTRY SI si COUNTRY SK sk COUNTRY SM sm COUNTRY SN sn COUNTRY SU su COUNTRY TH th COUNTRY TN tn COUNTRY TO to COUNTRY TR tr COUNTRY TW tw COUNTRY UA ua COUNTRY UG ug COUNTRY US us COUNTRY UZ uz COUNTRY VN vn COUNTRY YE ye COUNTRY YU yu COUNTRY ZA za COUNTRY ZM zm # And some funny translations for the yobbos --- 866,1105 ---- COUNTRY AD ad COUNTRY AE ae + COUNTRY AF af + COUNTRY AG ag + COUNTRY AI ai COUNTRY AL al COUNTRY AM am + COUNTRY AN an COUNTRY AO ao + COUNTRY AQ aq + COUNTRY AR ar + COUNTRY AS as COUNTRY AT at COUNTRY AU au + COUNTRY AW aw COUNTRY AZ az + COUNTRY BA ba + COUNTRY BB bb COUNTRY BD bd COUNTRY BE be COUNTRY BF bf COUNTRY BG bg COUNTRY BH bh + COUNTRY BI bi + COUNTRY BJ bj + COUNTRY BM bm COUNTRY BN bn + COUNTRY BO bo COUNTRY BT bt + COUNTRY BV bv + COUNTRY BW bw COUNTRY BY by + COUNTRY BZ bz COUNTRY CA ca + COUNTRY CC cc + COUNTRY CF cf + COUNTRY CG cg COUNTRY CH ch + COUNTRY CI ci + COUNTRY CK ck + COUNTRY CL cl COUNTRY CM cm COUNTRY CN cn + COUNTRY CO co + COUNTRY CR cr COUNTRY CS cs ! COUNTRY CU cu ! COUNTRY CV cv ! COUNTRY CX cx COUNTRY CY cy + COUNTRY CZ cz COUNTRY DE de + COUNTRY DJ dj COUNTRY DK dk + COUNTRY DM dm + COUNTRY DO do COUNTRY DZ dz + COUNTRY EC ec COUNTRY EE ee COUNTRY EG eg + COUNTRY EH eh + COUNTRY ER er COUNTRY ES es + COUNTRY ET et COUNTRY EU eu COUNTRY FI fi COUNTRY FJ FJ + COUNTRY FK fk + COUNTRY FM fm COUNTRY FO fo COUNTRY FR fr + COUNTRY GA ga COUNTRY GB gb + COUNTRY GD gd + COUNTRY GE ge + COUNTRY GF gf COUNTRY GH gh + COUNTRY GI gi COUNTRY GL gl + COUNTRY GM gm + COUNTRY GN gn + COUNTRY GP gp + COUNTRY GQ gq COUNTRY GR gr + COUNTRY GS gs + COUNTRY GT gt COUNTRY GU gu + COUNTRY GW gw + COUNTRY GY gy COUNTRY HK hk + COUNTRY HM hm + COUNTRY HN hn COUNTRY HR hr + COUNTRY HT ht COUNTRY HU hu COUNTRY ID id COUNTRY IE ie COUNTRY IL il COUNTRY IN in + COUNTRY IO io + COUNTRY IQ iq COUNTRY IR ir COUNTRY IS is COUNTRY IT it + COUNTRY JM jm COUNTRY JO jo COUNTRY JP jp COUNTRY KE ke COUNTRY KG kg + COUNTRY KH kh + COUNTRY KI ki + COUNTRY KM km + COUNTRY KN kn + COUNTRY KP kp COUNTRY KR kr COUNTRY KW kw + COUNTRY KY ky COUNTRY KZ kz COUNTRY LA la COUNTRY LB lb + COUNTRY LC lc COUNTRY LI li COUNTRY LK lk + COUNTRY LT lt COUNTRY LU lu COUNTRY LV lv ! COUNTRY LY ly COUNTRY MA ma COUNTRY MC mc COUNTRY MD md + COUNTRY MG mg + COUNTRY MH mh COUNTRY MK mk + COUNTRY MM mm COUNTRY MN mn COUNTRY MO mo + COUNTRY MP mp + COUNTRY MQ mq + COUNTRY MR mr + COUNTRY MS ms COUNTRY MT mt COUNTRY MU mu + COUNTRY MV mv + COUNTRY MW mw + COUNTRY MX mx COUNTRY MY my + COUNTRY MZ mz + COUNTRY NA na COUNTRY NC nc COUNTRY NE ne + COUNTRY NF nf COUNTRY NG ng + COUNTRY NI ni COUNTRY NL nl COUNTRY NO no COUNTRY NP np + COUNTRY NR nr + COUNTRY NU nu COUNTRY NZ nz COUNTRY OM om + COUNTRY PA pa + COUNTRY PE pe COUNTRY PF pf COUNTRY PG pg COUNTRY PH ph COUNTRY PK pk COUNTRY PL pl + COUNTRY PM pm + COUNTRY PN pn + COUNTRY PR pr COUNTRY PT pt + COUNTRY PW pw + COUNTRY PY py COUNTRY QA qa + COUNTRY RE re COUNTRY RO ro COUNTRY RU ru + COUNTRY RW rw COUNTRY SA sa + COUNTRY SB sb + COUNTRY SC sc + COUNTRY sd sd COUNTRY SE se COUNTRY SG sg + COUNTRY SH sh COUNTRY SI si + COUNTRY SJ sj COUNTRY SK sk + COUNTRY SL sl COUNTRY SM sm COUNTRY SN sn + COUNTRY SO so + COUNTRY SR sr + COUNTRY ST st COUNTRY SU su + COUNTRY SV sv + COUNTRY SY sy + COUNTRY SZ sz + COUNTRY TC tc + COUNTRY TD td + COUNTRY TF tf + COUNTRY TG tg COUNTRY TH th + COUNTRY TJ tj + COUNTRY TK tk + COUNTRY TM tm COUNTRY TN tn COUNTRY TO to + COUNTRY TP tp COUNTRY TR tr + COUNTRY TT tt + COUNTRY TV tv COUNTRY TW tw + COUNTRY TZ tz COUNTRY UA ua COUNTRY UG ug + COUNTRY UM um COUNTRY US us + COUNTRY UY uy COUNTRY UZ uz + COUNTRY VA va + COUNTRY VC vc + COUNTRY VE ve + COUNTRY VG vg + COUNTRY VI VI COUNTRY VN vn + COUNTRY VU vu + COUNTRY WF wf + COUNTRY WS ws COUNTRY YE ye + COUNTRY YT yt COUNTRY YU yu COUNTRY ZA za COUNTRY ZM zm + COUNTRY ZR zr + COUNTRY ZW zw # And some funny translations for the yobbos Index: src/maintainer.pl =================================================================== RCS file: /usr/local/cvs/ripe/whoisd/src/maintainer.pl,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -c -r1.1.1.3 -r1.2 *** maintainer.pl 1999/08/26 03:46:16 1.1.1.3 --- maintainer.pl 1999/10/13 02:24:06 1.2 *************** *** 22,33 **** # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: maintainer.pl,v 1.1.1.3 1999/08/26 03:46:16 paulg Exp $ # # $RCSfile: maintainer.pl,v $ ! # $Revision: 1.1.1.3 $ # $Author: paulg $ ! # $Date: 1999/08/26 03:46:16 $ # There is a few global variables it will use for authorisation: # --- 22,33 ---- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: maintainer.pl,v 1.2 1999/10/13 02:24:06 paulg Exp $ # # $RCSfile: maintainer.pl,v $ ! # $Revision: 1.2 $ # $Author: paulg $ ! # $Date: 1999/10/13 02:24:06 $ # There is a few global variables it will use for authorisation: # *************** *** 293,298 **** --- 293,299 ---- } $key = $1; + # what is $Main::KEYID? print "In CheckPGP. Message KEYID = $Main::KEYID, Mntner KEYID = $key\n" if ($opt_V); Index: src/pgp.pl =================================================================== RCS file: /usr/local/cvs/ripe/whoisd/src/pgp.pl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** pgp.pl 1999/01/27 05:41:37 1.1.1.1 --- pgp.pl 1999/10/13 02:24:06 1.2 *************** *** 20,31 **** # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: pgp.pl,v 1.1.1.1 1999/01/27 05:41:37 paulg Exp $ # # $RCSfile: pgp.pl,v $ ! # $Revision: 1.1.1.1 $ # $Author: paulg $ ! # $Date: 1999/01/27 05:41:37 $ require "adderror.pl"; require "defines.pl"; --- 20,31 ---- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: pgp.pl,v 1.2 1999/10/13 02:24:06 paulg Exp $ # # $RCSfile: pgp.pl,v $ ! # $Revision: 1.2 $ # $Author: paulg $ ! # $Date: 1999/10/13 02:24:06 $ require "adderror.pl"; require "defines.pl"; *************** *** 38,100 **** # on the features and the bugs # of PGP 5.0i. sub genPGPkc { ! local(*object, $type) = @_; ! my($rtcode) = $O_OK; ! my($state) = 0; # used in state machines in this subroutine ! return $O_OK unless $have_pgp; ! print "starting genPGPkc(" . $object{'kc'} . ")\n" if $opt_V; ! # do some simple syntax checks for the key (we do it here ! # instead of sub checksyntax because here we got the complete ! # key in one piece, instead of line by line): ! ! $state = 0; # 0 = waiting for header, 1 = header, 2 = key, 3 = end ! ! foreach (split(/\n/, $object{"ce"})) { ! if ($state == 0 && /^-----BEGIN PGP PUBLIC KEY BLOCK-----$/) { ! $state = 1; ! next; ! } ! if ($state == 1 && /^\s*$/) { ! $state = 2; ! next; ! } ! next if $state == 1 && /^[^:]+:.*$/; ! ! if ($state == 2 && /^-----END PGP PUBLIC KEY BLOCK-----$/) { ! $state = 3; ! next; ! } ! next if $state == 2 && /^[A-Za-z0-9\+\/=]+$/; # allowed radix 64 chars ! ! # we get this far only if the format is not correct ! adderror(*object, 'the format of the PGP key in the "certif" attribute is ' ! . 'invalid'); ! return $O_ERROR; ! } ! ! if ($state != 3) { # state must be 3 if we reached the end of the key ! adderror(*object, 'the format of the PGP key in the "certif" attribute is ' ! . 'invalid'); ! return $O_ERROR; ! } ! ! # Put they key to a temporary file to be fed to PGP: ! ! my($temp_key) = $TMPDIR . "/pgp_key.$$"; ! my($temp_pgp_dir) = $TMPDIR . "/pgp_dir.$$"; ! ! unless (open(KEY, ">$temp_key")) { ! syslog("ERRLOG", "genPGPkc: open(.., >$temp_key): $!"); ! adderror(*object, "Cannot create a temporary file for PGP/1: $!"); ! return $O_ERROR; ! } ! print KEY $object{"ce"}; ! close(KEY); # The PGP 5.0i is broken, it doesn't honor the command line switches # which are used to specify the location of the keyring. In order # to work around this, we need to set the PGPPATH environment --- 38,100 ---- # on the features and the bugs # of PGP 5.0i. sub genPGPkc { ! local(*object, $type) = @_; ! my($rtcode) = $O_OK; ! my($state) = 0; # used in state machines in this subroutine ! return $O_OK unless $have_pgp; ! print "starting genPGPkc(" . $object{'kc'} . ")\n" if $opt_V; ! # do some simple syntax checks for the key (we do it here ! # instead of sub checksyntax because here we got the complete ! # key in one piece, instead of line by line): ! ! $state = 0; # 0 = waiting for header, 1 = header, 2 = key, 3 = end ! ! foreach (split(/\n/, $object{"ce"})) { ! if ($state == 0 && /^-----BEGIN PGP PUBLIC KEY BLOCK-----$/) { ! $state = 1; ! next; ! } ! if ($state == 1 && /^\s*$/) { ! $state = 2; ! next; ! } ! next if $state == 1 && /^[^:]+:.*$/; ! ! if ($state == 2 && /^-----END PGP PUBLIC KEY BLOCK-----$/) { ! $state = 3; ! next; ! } ! next if $state == 2 && /^[A-Za-z0-9\+\/=]+$/; # allowed radix 64 chars ! ! # we get this far only if the format is not correct ! adderror(*object, 'the format of the PGP key in the "certif" attribute is ' ! . 'invalid'); ! return $O_ERROR; ! } ! ! if ($state != 3) { # state must be 3 if we reached the end of the key ! adderror(*object, 'the format of the PGP key in the "certif" attribute is ' ! . 'invalid'); ! return $O_ERROR; ! } ! ! # Put they key to a temporary file to be fed to PGP: ! ! my($temp_key) = $TMPDIR . "/pgp_key.$$"; ! my($temp_pgp_dir) = $TMPDIR . "/pgp_dir.$$"; + unless (open(KEY, ">$temp_key")) { + syslog("ERRLOG", "genPGPkc: open(.., >$temp_key): $!"); + adderror(*object, "Cannot create a temporary file for PGP/1: $!"); + return $O_ERROR; + } + print KEY $object{"ce"}; + close(KEY); + # The PGP 5.0i is broken, it doesn't honor the command line switches # which are used to specify the location of the keyring. In order # to work around this, we need to set the PGPPATH environment *************** *** 102,249 **** # of just specifying the temporary keyring path on the command line # (as documented in the manual): ! unless (mkdir($temp_pgp_dir, 0777)) { ! syslog("ERRLOG", "genPGPkc: mkdir($temp_pgp_dir): $!"); ! adderror(*object, "Cannot create a temporary directory for PGP: $!"); ! unlink($temp_key); ! return $O_ERROR; ! } ! my($orig_pgp_dir); ! $orig_pgp_dir = $ENV{"PGPPATH"} if defined($ENV{"PGPPATH"}); ! $ENV{"PGPPATH"} = $temp_pgp_dir; # Add the key to the temporary keyring and check the output: ! unless(open(PGPADD, "$PGPK -a --batchmode=1 $temp_key 2>&1 |")) { ! syslog("ERRLOG", "genPGPkc: open(PGPADD, $PGPK -a --batchmode=1 " ! . "$temp_key 2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/1: $!"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! # Get all useful information from the PGP process: ! my($pgp_keyid, @pgp_uids, $pgp_ok); ! ! while (<PGPADD>) { ! # Look for error messages from PGP. This is extremely ugly but PGP 5 seems ! # to be an unfinished program so it always returns 0 on exit ! if (m/^Unable to import keyfile/) { ! eatit(*PGPADD); ! adderror(*object, "Error in certificate"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! # If the above is successful the key will be in the local key ring ! # Look for the keyid. Will not find secret keys. Careful with the contents ! # of the database keyring! ! if (/^pub.*0x([0-9a-fA-F]{8}).*Sign.*/) { ! if (defined($pgp_keyid)) { ! eatit(*PGPADD); ! adderror(*object, "Too many public keys in the certification object"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! $pgp_keyid = uc($1); ! } ! ! # Look for the uids: ! if (/^uid\s+(.*)$/) { push @pgp_uids, $1 } ! ! # Look for PGP ok message: ! $pgp_ok = 1 if /^Keys added successfully/; ! } ! close(PGPADD); ! ! unlink($temp_key); # get rid of the temporary key file ! ! unless (defined($pgp_ok)) { ! adderror(*object, "Didn't get successful reply from PGP/1"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! unless (defined($pgp_keyid)) { ! adderror(*object, "Didn't find any PGP public keys in the object"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! # Check if the PGP key ID from the real key matches the key ID given in ! # the object: ! if (uc($object{"kc"}) ne "PGPKEY-$pgp_keyid") { ! adderror(*object, "Keyid for this certificate ($pgp_keyid) is not the " ! . "same as the PGPKEY field (" . $object{"kc"} . ")"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! # Set the owner attributes from the key. This ignores whatever the value ! # of this attribute happens to be in the message. ! $object{"ow"} = join("\n", @pgp_uids); ! ! # Get the fingerprint using the pgpk -ll command. ! # This ignores whatever the value of this attribute happens to be ! # in the message. ! unless (open(FINGERPR, "$PGPK -ll --batchmode=1 2>&1 |")) { ! syslog("ERRLOG", "genPGPkc: open(FINGERPR, $PGPK -ll --batchmode=1 " ! . "2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/2: $!"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! my($pgp_fp_found); ! ! while (<FINGERPR>) { ! if (/^pub/) { ! my($line) = scalar(<FINGERPR>); ! if ($line =~ /^f(?:16|20)\s+Fingerprint(?:16|20) = ([A-F\d ]+)$/) { ! if (defined($pgp_fp_found)) { ! eatit(*FINGERPR); ! adderror(*object, "Too many fingerprints in the key"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! $object{"fp"} = $1; ! $pgp_fp_found = 1; ! } ! } ! } ! close(FINGERPR); ! ! unless (defined($pgp_fp_found)) { ! adderror(*object, "Didn't find PGP key fingerprint"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! # Add the signing method (PGP). This ignores whatever the value of this ! # attribute happens to be in the message. ! $object{"mh"} = "PGP"; ! ! # Now all checks have been made and the information needed should be ! # extracted from the temporary keyfile. ! ! # forget the temporary directory setting ! if (defined($orig_pgp_dir)) { ! $ENV{"PGPPATH"} = $orig_pgp_dir; ! } else { ! delete $ENV{"PGPPATH"}; ! } ! # Clean up the mess we've left and exit: ! rm_tmpdir($temp_pgp_dir); ! print "ending genPGPkc\n" if $opt_V; ! return $rtcode; } # addPGPkey(*object, $type) --- 102,329 ---- # of just specifying the temporary keyring path on the command line # (as documented in the manual): ! unless (mkdir($temp_pgp_dir, 0777)) { ! syslog("ERRLOG", "genPGPkc: mkdir($temp_pgp_dir): $!"); ! adderror(*object, "Cannot create a temporary directory for PGP: $!"); ! unlink($temp_key); ! return $O_ERROR; ! } ! my($orig_pgp_dir); ! if (defined $PGPK) { ! $orig_pgp_dir = $ENV{"PGPPATH"} if defined($ENV{"PGPPATH"}); ! $ENV{"PGPPATH"} = $temp_pgp_dir; ! } elsif (defined $GPG) { ! $orig_pgp_dir = $ENV{"GNUPGHOME"} if defined($ENV{"GNUPGHOME"}); ! $ENV{"GNUPGHOME"} = $temp_pgp_dir; ! } # Add the key to the temporary keyring and check the output: ! if (defined $PGPK) { ! unless(open(PGPADD, "$PGPK -a --batchmode=1 $temp_key 2>&1 |")) { ! syslog("ERRLOG", "genPGPkc: open(PGPADD, $PGPK -a --batchmode=1 " ! . "$temp_key 2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/1: $!"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } elsif (defined $GPG) { ! my $cmd = "$GPG --batch --import $temp_key 2>&1"; ! unless(open(PGPADD, "$cmd |")) { ! syslog("ERRLOG", "genPGPkc: open(PGPADD, $cmd |): $!"); ! adderror(*object, "Cannot start PGP process/1: $!"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } ! ! # Get all useful information from the PGP process: ! my($pgp_keyid, @pgp_uids, $pgp_ok); ! ! while (<PGPADD>) { ! # Look for error messages from PGP. This is extremely ugly but PGP 5 seems ! # to be an unfinished program so it always returns 0 on exit ! if (defined $PGPK) { ! if (m/^Unable to import keyfile/) { ! eatit(*PGPADD); ! adderror(*object, "Error in certificate"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } elsif (defined $GPG) { ! if (m/^no valid OpenPGP data found/) { ! eatit(*PGPADD); ! adderror(*object, "Error in certificate"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } ! ! # If the above is successful the key will be in the local key ring ! # Look for the keyid. Will not find secret keys. Careful with the contents ! # of the database keyring! ! if (defined $PGPK) { ! if (/^pub.*0x([0-9a-fA-F]{8}).*Sign.*/) { ! if (defined($pgp_keyid)) { ! eatit(*PGPADD); ! adderror(*object, "Too many public keys in the certification object"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! $pgp_keyid = uc($1); ! } ! } elsif (defined $GPG) { ! if (/^gpg: key ([0-9a-fA-F]{8}):/) { ! if (defined($pgp_keyid)) { ! eatit(*PGPADD); ! adderror(*object, "Too many public keys in the certification object"); ! unlink($temp_key); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! $pgp_keyid = uc($1); ! } ! } ! ! # Look for the uids: ! # TODO: GPG does not give this info during import. ! if (/^uid\s+(.*)$/) { push @pgp_uids, $1 } ! ! # Look for PGP ok message: ! if (defined $PGPK) { ! $pgp_ok = 1 if /^Keys added successfully/; ! } elsif (defined $GPG) { ! $pgp_ok = 1 if /^gpg:\s+imported: 1/; ! } ! } ## while ! ! close(PGPADD); ! ! unlink($temp_key); # get rid of the temporary key file ! ! unless (defined($pgp_ok)) { ! adderror(*object, "Didn't get successful reply from PGP/1"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! unless (defined($pgp_keyid)) { ! adderror(*object, "Didn't find any PGP public keys in the object"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! # Check if the PGP key ID from the real key matches the key ID given in ! # the object: ! if (uc($object{"kc"}) ne "PGPKEY-$pgp_keyid") { ! adderror(*object, "Keyid for this certificate ($pgp_keyid) is not the " ! . "same as the PGPKEY field (" . $object{"kc"} . ")"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! # Get the fingerprint using the pgpk -ll command. ! # This ignores whatever the value of this attribute happens to be ! # in the message. ! if (defined $PGPK) { ! unless (open(FINGERPR, "$PGPK -ll --batchmode=1 2>&1 |")) { ! syslog("ERRLOG", "genPGPkc: open(FINGERPR, $PGPK -ll --batchmode=1 " ! . "2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/2: $!"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } elsif (defined $GPG) { ! unless (open(FINGERPR, "$GPG --batch --fingerprint 2>&1 |")) { ! syslog("ERRLOG", "genPGPkc: open(FINGERPR, $GPG --batch " ! . "--fingerprint 2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/2: $!"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } ! ! my($pgp_fp_found); ! while (<FINGERPR>) { ! if (/^pub/) { ! # pub 1024D/F140257E 1998-07-26 paulg at apnic.net ! if ($GPG and /^pub\s+\S+\s+\S+\s+(.*)$/) { ! push @pgp_uids, $1; ! } ! my($line) = scalar(<FINGERPR>); ! if (defined $PGPK) { ! if ($line =~ /^f(?:16|20)\s+Fingerprint(?:16|20) = ([A-F\d ]+)$/) { ! if (defined($pgp_fp_found)) { ! eatit(*FINGERPR); ! adderror(*object, "Too many fingerprints in the key"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! $object{"fp"} = $1; ! $pgp_fp_found = 1; ! } ! } elsif (defined $GPG) { ! if ($line =~ /Key fingerprint = ([A-F\d ]+)$/) { ! if (defined($pgp_fp_found)) { ! eatit(*FINGERPR); ! adderror(*object, "Too many fingerprints in the key"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! $object{"fp"} = $1; ! $pgp_fp_found = 1; ! } ! } ! } ! } ! close(FINGERPR); ! unless (defined($pgp_fp_found)) { ! adderror(*object, "Didn't find PGP key fingerprint"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! # Set the owner attributes from the key. This ignores whatever the value ! # of this attribute happens to be in the message. ! $object{"ow"} = join("\n", @pgp_uids); ! ! # Add the signing method (PGP). This ignores whatever the value of this ! # attribute happens to be in the message. ! $object{"mh"} = "PGP"; ! ! # Now all checks have been made and the information needed should be ! # extracted from the temporary keyfile. ! ! # forget the temporary directory setting ! if (defined $PGPK) { ! if (defined($orig_pgp_dir)) { ! $ENV{"PGPPATH"} = $orig_pgp_dir; ! } else { ! delete $ENV{"PGPPATH"}; ! } ! } elsif (defined $GPG) { ! if (defined($orig_pgp_dir)) { ! $ENV{"GNUPGHOME"} = $orig_pgp_dir; ! } else { ! delete $ENV{"GNUPGHOME"}; ! } ! } ! ! # Clean up the mess we've left and exit: ! rm_tmpdir($temp_pgp_dir); ! ! print "ending genPGPkc\n" if $opt_V; ! ! return $rtcode; } # addPGPkey(*object, $type) *************** *** 251,301 **** # Add PGP key from a certificate object to the main keyring sub addPGPkey { ! local(*object, $type) = @_; ! return $O_OK unless $have_pgp; ! my($temp_key) = $TMPDIR . "/pgp_key.$$"; ! print "starting addPGPkey(" . $object{'kc'} . ")\n" if $opt_V; ! # Put they key to a temporary file to be fed to PGP: ! unless (open(KEY, ">$temp_key")) { ! syslog("ERRLOG", "addPGPkey: open(.., >$temp_key): $!"); ! adderror(*object, "Cannot create a temporary file for PGP/2: $!"); ! return $O_ERROR; ! } ! print KEY $object{"ce"}; ! close(KEY); ! ! lockPGPring(); ! ! unless (open(PGPK, "$PGPK -a --batchmode=1 $temp_key 2>&1 |")) { ! syslog("ERRLOG", "addPGPkey: open(PGPK, $PGPK -a --batchmode=1 " ! . "$temp_key 2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/3: $!"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! ! my($pgp_ok); ! ! while (<PGPK>) { ! $pgp_ok = 1 if /^Keys added successfully/; ! } ! close(PGPK); ! ! unless (defined($pgp_ok)) { ! adderror(*object, "Didn't get successful reply from PGP/3"); ! unlockPGPring(); ! unlink($temp_key); ! return $O_ERROR; ! } ! ! unlockPGPring(); ! unlink($temp_key); ! print "ending addPGPkey " . $object{'kc'} . "\n" if $opt_V; ! return $O_OK; } # delPGPkey($keyid) --- 331,395 ---- # Add PGP key from a certificate object to the main keyring sub addPGPkey { ! local(*object, $type) = @_; ! ! return $O_OK unless $have_pgp; ! my($temp_key) = $TMPDIR . "/pgp_key.$$"; ! print "starting addPGPkey(" . $object{'kc'} . ")\n" if $opt_V; ! # Put they key to a temporary file to be fed to PGP: ! unless (open(KEY, ">$temp_key")) { ! syslog("ERRLOG", "addPGPkey: open(.., >$temp_key): $!" ); ! adderror(*object, "Cannot create a temporary file for PGP/2: $!"); ! return $O_ERROR; ! } ! print KEY $object{"ce"}; ! close(KEY); ! ! lockPGPring(); ! if (defined $PGPK) { ! unless (open(PGPK, "$PGPK -a --batchmode=1 $temp_key 2>&1 |")) { ! syslog("ERRLOG", "addPGPkey: open(PGPK, $PGPK -a --batchmode=1 " ! . "$temp_key 2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/3: $!"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } elsif (defined $GPG) { ! unless (open(PGPK, "$GPG --import --batch $temp_key 2>&1 |")) { ! syslog("ERRLOG", "addPGPkey: open(PGPK, $PGPK --import --batch " ! . "$temp_key 2>&1 |): $!"); ! adderror(*object, "Cannot start PGP process/3: $!"); ! rm_tmpdir($temp_pgp_dir); ! return $O_ERROR; ! } ! } ! ! my($pgp_ok); ! ! while (<PGPK>) { ! if (defined $PGPK) { ! $pgp_ok = 1 if /^Keys added successfully/; ! } elsif (defined $GPG) { ! $pgp_ok = 1 if /^gpg:\s+imported: 1/; ! } ! } ! close(PGPK); ! ! unless (defined($pgp_ok)) { ! adderror(*object, "Didn't get successful reply from PGP/3"); ! unlockPGPring(); ! unlink($temp_key); ! return $O_ERROR; ! } ! ! unlockPGPring(); ! unlink($temp_key); ! print "ending addPGPkey " . $object{'kc'} . "\n" if $opt_V; ! return $O_OK; } # delPGPkey($keyid) *************** *** 303,337 **** # Delete PGP key from the keyring sub delPGPkey { ! my($keyid) = shift; ! print "starting delPGPkey($keyid)\n" if $opt_V; ! $keyid =~ s/^PGPKEY-//; ! return $O_ERROR unless $keyid =~ /^[0-9a-fA-F]+$/; # just a safeguard ! return $O_OK unless $have_pgp; ! lockPGPring(); ! unless (open(PGPK, "$PGPK -r --batchmode=1 0x$keyid 2>&1 |")) { ! syslog("ERRLOG", "delPGPkey: open(PGPK, $PGPK -r --batchmode=1 " ! . "0x$keyid 2>&1 |): $!"); ! return $O_ERROR; ! } ! my($removeok); ! while (<PGPK>) { ! $removeok = 1 if /^Removed\.$/; ! } ! close(PGPK); ! unlockPGPring(); ! print "ending delPGPkey " . $keyid . "\n" if $opt_V; ! return defined($removeok) ? $O_OK : $O_ERROR; } # checkPGPmsg($infile, $outfile) --- 397,444 ---- # Delete PGP key from the keyring sub delPGPkey { ! my($keyid) = shift; ! print "starting delPGPkey($keyid)\n" if $opt_V; ! $keyid =~ s/^PGPKEY-//; ! return $O_ERROR unless $keyid =~ /^[0-9a-fA-F]+$/; # just a safeguard ! return $O_OK unless $have_pgp; ! lockPGPring(); ! ! if (defined $PGPK) { ! unless (open(PGPK, "$PGPK -r --batchmode=1 0x$keyid 2>&1 |")) { ! syslog("ERRLOG", "delPGPkey: open(PGPK, $PGPK -r --batchmode=1 " ! . "0x$keyid 2>&1 |): $!"); ! return $O_ERROR; ! } ! } elsif (defined $GPG) { ! unless (open(PGPK, "$GPG --yes --delete-key --batch $keyid 2>&1 |")) { ! syslog("ERRLOG", "delPGPkey: open(PGPK, $PGPK --yes --delete-key " ! . " --batch $keyid 2>&1 |): $!"); ! return $O_ERROR; ! } ! } ! my($removeok); ! while (<PGPK>) { ! $removeok = 1 if /^Removed\.$/; ! } ! close(PGPK); ! if (defined $GPG) { ! my $exit_value = $? >> 8; ! $removeok = 1 if $exit_value == 0; ! } ! unlockPGPring(); ! print "ending delPGPkey " . $keyid . "\n" if $opt_V; ! return defined($removeok) ? $O_OK : $O_ERROR; } # checkPGPmsg($infile, $outfile) *************** *** 350,421 **** # if $status != undef, $id will contain the PGP key ID sub checkPGPmsg { ! my($in, $out) = @_; ! my($status, $id); ! return (undef, undef) unless $have_pgp; ! print "starting checkPGPsig($in, $out)\n" if $opt_V; ! return (undef, undef) unless -r $in; ! unlink($out) if -e $out; ! ! lockPGPring(); ! ! unless (open(PGPV, "$PGPV --batchmode=1 $in -o $out 2>&1 |")) { ! syslog("ERRLOG", "checkPGPmsg: open(PGPV, $PGPV --batchmode=1 $in -o $out " ! . "2>&1 |): $!"); ! return (-1, "Cannot start PGP process/4: $!"); ! } ! ! # 0 = waiting for good/bad, 1 = waiting for ID, 2 = eating garbage (yum yum) ! $state = 0; ! ! while (<PGPV>) { ! next if $state == 2; ! if ($state == 0) { ! if (/^Good signature made.+by key:$/) { ! $state = 1; ! $status = 2; ! } ! if (/^This signature applies to another message$/) { ! $state = 2; ! $status = -1; ! $id = "This signature applies to another message"; ! } ! if (/^BAD signature made.+by key:$/) { ! $state = 1; ! $status = 0; ! } ! if (/^Signature by unknown keyid: 0x([0-9a-fA-F]{8})/) { ! $state = 2; ! $status = 1; ! $id = $1; ! } ! if (/^Message is encrypted\.$/) { ! $state = 0; ! $status = 4; # will be changed to 0, 1 or 2 if there is a signature ! } ! if (/^Cannot decrypt message\./) { ! $state = 2; ! $status = 3; ! } ! next; ! } ! if ($state == 1) { ! $state = 2; ! $id = $1 if /^\s*\d+ bits, Key ID ([0-9a-fA-F]{8}),/; ! } ! } ! close(PGPV); ! unlockPGPring(); ! print "ending checkPGPsig\n" if $opt_V; ! $status = undef if defined($status) && $status == 2 && !defined($id); ! return ($status, $id); } # lockPGPring() --- 457,571 ---- # if $status != undef, $id will contain the PGP key ID sub checkPGPmsg { ! my($in, $out) = @_; ! my($status, $id); ! ! return (undef, undef) unless $have_pgp; ! print "starting checkPGPsig($in, $out)\n" if $opt_V; ! return (undef, undef) unless -r $in; ! unlink($out) if -e $out; ! ! lockPGPring(); ! ! if (defined $PGPV) { ! unless (open(PGPV, "$PGPV --batchmode=1 $in -o $out 2>&1 |")) { ! syslog("ERRLOG", "checkPGPmsg: open(PGPV, $PGPV --batchmode=1 $in -o $out " ! . "2>&1 |): $!"); ! return (-1, "Cannot start PGP process/4: $!"); ! } ! } elsif (defined $GPG) { ! unless (open(PGPV, "$GPG --always-trust --batch --output $out --decrypt $in 2>&1 |")) { ! syslog("ERRLOG", "checkPGPmsg: open(PGPV, $PGPV --always-trust --batch " ! . "--decrypt $in --output $out 2>&1 |): $!"); ! return (-1, "Cannot start PGP process/4: $!"); ! } ! } ! ! # 0 = waiting for good/bad, 1 = waiting for ID, 2 = eating garbage (yum yum) ! $state = 0; ! if (defined $PGPV) { ! while (<PGPV>) { ! next if $state == 2; ! if ($state == 0) { ! if (/^Good signature made.+by key:$/) { ! $state = 1; ! $status = 2; ! } ! if (/^This signature applies to another message$/) { ! $state = 2; ! $status = -1; ! $id = "This signature applies to another message"; ! } ! if (/^BAD signature made.+by key:$/) { ! $state = 1; ! $status = 0; ! } ! if (/^Signature by unknown keyid: 0x([0-9a-fA-F]{8})/) { ! $state = 2; ! $status = 1; ! $id = $1; ! } ! if (/^Message is encrypted\.$/) { ! $state = 0; ! $status = 4; # will be changed to 0, 1 or 2 if there is a signature ! } ! if (/^Cannot decrypt message\./) { ! $state = 2; ! $status = 3; ! } ! next; ! } ! if ($state == 1) { ! $state = 2; ! $id = $1 if /^\s*\d+ bits, Key ID ([0-9a-fA-F]{8}),/; ! } ! } ! } elsif (defined $GPG) { ! # 0 = waiting for ID, 1 = waiting for good/bad, 2 = eating garbage (yum yum) ! # gpg: Signature made Wed Sep 8 15:35:27 1999 EST using DSA key ID F140257E ! # gpg: Good signature from "paulg at apnic.net" ! # gpg: WARNING: Using untrusted key! ! while (<PGPV>) { ! next if $state == 2; ! if ($state == 0) { ! if (/key ID ([0-9a-fA-F]{8})/) { ! $state = 1; ! $id = $1; ! } ! } ! if ($state == 1) { ! if (/^gpg: Good signature from/) { ! $state = 2; ! $status = 2; ! } ! if (/^BAD signature from/) { ! $state = 2; ! $status = 0; ! } ! if (/^Can't check signature: public key not found/) { ! $state = 2; ! $status = 1; ! } ! if (/^Cannot decrypt message\./) { ! $state = 2; ! $status = 3; ! } ! } ! next; ! } # while ! } # gpg ! close(PGPV); ! unlockPGPring(); ! print "ending checkPGPsig\n" if $opt_V; ! $status = undef if defined($status) && $status == 2 && !defined($id); ! return ($status, $id); } # lockPGPring() *************** *** 425,446 **** # do any locking itself -- sigh) sub lockPGPring { ! my($lockfile) = $LOCKDIR . "/PGP.lock"; ! unless (open(LOCK, ">$lockfile")) { ! syslog("ERRLOG", "lockPGPring: open(>$lockfile): $!"); ! return 0; ! } ! return lock(LOCK); } sub unlockPGPring { ! my($lockfile) = $LOCKDIR . "/PGP.lock"; ! my($r) = unlock(LOCK); ! close(LOCK); ! return $r; } # rm_tmpdir($tmpdir) --- 575,596 ---- # do any locking itself -- sigh) sub lockPGPring { ! my($lockfile) = $LOCKDIR . "/PGP.lock"; ! unless (open(LOCK, ">$lockfile")) { ! syslog("ERRLOG", "lockPGPring: open(>$lockfile): $!"); ! return 0; ! } ! return lock(LOCK); } sub unlockPGPring { ! my($lockfile) = $LOCKDIR . "/PGP.lock"; ! my($r) = unlock(LOCK); ! close(LOCK); ! return $r; } # rm_tmpdir($tmpdir) *************** *** 448,464 **** # Delete temporary directory and all files in it sub rm_tmpdir { ! my($tmpdir) = shift; ! opendir(TMPDIR, $tmpdir) ! or return undef; ! foreach (readdir(TMPDIR)) { ! next if $_ eq '.' || $_ eq '..'; ! unlink("$tmpdir/$_"); ! } ! closedir(TMPDIR); ! return rmdir($tmpdir); } # eatit(*FH) --- 598,614 ---- # Delete temporary directory and all files in it sub rm_tmpdir { ! my($tmpdir) = shift; ! opendir(TMPDIR, $tmpdir) ! or return undef; ! foreach (readdir(TMPDIR)) { ! next if $_ eq '.' || $_ eq '..'; ! unlink("$tmpdir/$_"); ! } ! closedir(TMPDIR); ! return rmdir($tmpdir); } # eatit(*FH) *************** *** 467,478 **** # and close the file handle after that sub eatit { ! my($yummy) = shift; ! while (<$yummy>) { ! # munch munch; nothing here ! } ! close($yummy); } 1; --- 617,628 ---- # and close the file handle after that sub eatit { ! my($yummy) = shift; ! while (<$yummy>) { ! # munch munch; nothing here ! } ! close($yummy); } 1; Index: src/processdata.pl =================================================================== RCS file: /usr/local/cvs/ripe/whoisd/src/processdata.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** processdata.pl 1999/08/27 08:20:31 1.4 --- processdata.pl 1999/10/13 02:24:06 1.5 *************** *** 20,31 **** # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: processdata.pl,v 1.4 1999/08/27 08:20:31 paulg Exp $ # # $RCSfile: processdata.pl,v $ ! # $Revision: 1.4 $ # $Author: paulg $ ! # $Date: 1999/08/27 08:20:31 $ @INC = ("LIBDIR", @INC); --- 20,31 ---- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: processdata.pl,v 1.5 1999/10/13 02:24:06 paulg Exp $ # # $RCSfile: processdata.pl,v $ ! # $Revision: 1.5 $ # $Author: paulg $ ! # $Date: 1999/10/13 02:24:06 $ @INC = ("LIBDIR", @INC); *************** *** 418,424 **** my(@input); if ($input) { ! @input = split(/\n/, $input); } # log a copy of the message to UPDLOG before we process it --- 418,424 ---- my(@input); if ($input) { ! @input = split(/\n/, $input); } # log a copy of the message to UPDLOG before we process it *************** *** 455,516 **** last unless defined($_ = shift(@input)); $_ .= "\n"; # split above eats new-lines } else { ! last unless defined($_ = <>); } ! print LOG; ! unless ($have_pgp) { ! print COPY; ! next; ! } ! if ($cpst == 0 && /^-----BEGIN PGP SIGNED MESSAGE-----$/) { ! $cpst = 1; ! my($copyfile_signed) = $TMPDIR . "/dbupdscopy.$$." . @copyfiles_signed; ! push(@copyfiles_signed, $copyfile_signed); ! open(PGPCOPY, ">$copyfile_signed") or fatalerror("Cannot create $copyfile_signed: $!"); ! # fall through ! } ! if ($cpst == 0 && /^-----BEGIN PGP MESSAGE-----$/) { ! $cpst = 3; ! my($copyfile_signed) = $TMPDIR . "/dbupdscopy.$$." . @copyfiles_signed; ! push(@copyfiles_signed, $copyfile_signed); ! open(PGPCOPY, ">$copyfile_signed") or fatalerror("Cannot create $copyfile_signed: $!"); ! # fall through ! } ! if ($cpst == 0) { ! print COPY; ! next; ! } ! if ($cpst == 1 && /^-----BEGIN PGP SIGNATURE-----$/) { ! $cpst = 2; ! # fall through ! } ! if ($cpst == 2 && /^-----END PGP SIGNATURE-----$/) { ! $cpst = 0; ! print PGPCOPY; ! close(PGPCOPY); ! next; ! } ! if ($cpst == 3 && /^-----END PGP MESSAGE-----$/) { ! $cpst = 0; ! print PGPCOPY; ! close(PGPCOPY); ! next; ! } ! if ($cpst == 1 || $cpst == 2 || $cpst == 3) { ! print PGPCOPY; ! next; ! } ! fatalerror("Unknown cpst state: $cpst (should not happen)"); ! last; # not reached? } # discard (last) signed part if it is not properly finished --- 455,517 ---- last unless defined($_ = shift(@input)); $_ .= "\n"; # split above eats new-lines } else { ! last unless ($_ = <>); ! #last unless defined($_ = <>); } ! print LOG; ! unless ($have_pgp) { ! print COPY; ! next; ! } ! if ($cpst == 0 && /^-----BEGIN PGP SIGNED MESSAGE-----$/) { ! $cpst = 1; ! my($copyfile_signed) = $TMPDIR . "/dbupdscopy.$$." . @copyfiles_signed; ! push(@copyfiles_signed, $copyfile_signed); ! open(PGPCOPY, ">$copyfile_signed") or fatalerror("Cannot create $copyfile_signed: $!"); ! # fall through ! } ! if ($cpst == 0 && /^-----BEGIN PGP MESSAGE-----$/) { ! $cpst = 3; ! my($copyfile_signed) = $TMPDIR . "/dbupdscopy.$$." . @copyfiles_signed; ! push(@copyfiles_signed, $copyfile_signed); ! open(PGPCOPY, ">$copyfile_signed") or fatalerror("Cannot create $copyfile_signed: $!"); ! # fall through ! } ! if ($cpst == 0) { ! print COPY; ! next; ! } ! if ($cpst == 1 && /^-----BEGIN PGP SIGNATURE-----$/) { ! $cpst = 2; ! # fall through ! } ! if ($cpst == 2 && /^-----END PGP SIGNATURE-----$/) { ! $cpst = 0; ! print PGPCOPY; ! close(PGPCOPY); ! next; ! } ! if ($cpst == 3 && /^-----END PGP MESSAGE-----$/) { ! $cpst = 0; ! print PGPCOPY; ! close(PGPCOPY); ! next; ! } ! if ($cpst == 1 || $cpst == 2 || $cpst == 3) { ! print PGPCOPY; ! next; ! } ! fatalerror("Unknown cpst state: $cpst (should not happen)"); ! last; # not reached? } # discard (last) signed part if it is not properly finished Index: src/rconf.pl =================================================================== RCS file: /usr/local/cvs/ripe/whoisd/src/rconf.pl,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -c -r1.1.1.3 -r1.2 *** rconf.pl 1999/08/26 03:46:16 1.1.1.3 --- rconf.pl 1999/10/13 02:24:06 1.2 *************** *** 20,31 **** # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: rconf.pl,v 1.1.1.3 1999/08/26 03:46:16 paulg Exp $ # # $RCSfile: rconf.pl,v $ ! # $Revision: 1.1.1.3 $ # $Author: paulg $ ! # $Date: 1999/08/26 03:46:16 $ # # This routine reads all parameters from the configuration file # into scalars or associative arrays of the same name (uppercase). --- 20,31 ---- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: rconf.pl,v 1.2 1999/10/13 02:24:06 paulg Exp $ # # $RCSfile: rconf.pl,v $ ! # $Revision: 1.2 $ # $Author: paulg $ ! # $Date: 1999/10/13 02:24:06 $ # # This routine reads all parameters from the configuration file # into scalars or associative arrays of the same name (uppercase). *************** *** 315,324 **** if (/^MAILCMD\s+(.*)/) { $MAILCMD=$1; next;} ! if (/^PGPV\s+(.*)/) { $PGPV=$1; next;} ! if (/^PGPK\s+(.*)/) { $PGPK=$1; next;} if (/^PGPPATH\s+(.*)/) { $PGPPATH=$1; next;} if (/^CANUPD\s+(.+)$/) { foreach (split(/ /, $1)) { $CANUPD{$_}=1 if ($_); --- 315,327 ---- if (/^MAILCMD\s+(.*)/) { $MAILCMD=$1; next;} ! if (/^PGPV\s+(.*)/) { $PGPV=$1; next;} ! if (/^PGPK\s+(.*)/) { $PGPK=$1; next;} if (/^PGPPATH\s+(.*)/) { $PGPPATH=$1; next;} + if (/^GPG\s+(.*)/) { $GPG=$1; next;} + if (/^GNUPGHOME\s+(.*)/) { $GNUPGHOME=$1; next;} + if (/^CANUPD\s+(.+)$/) { foreach (split(/ /, $1)) { $CANUPD{$_}=1 if ($_); *************** *** 679,687 **** fatalerror("PGPPATH directory $PGPPATH does not exist") unless -d $PGPPATH; $ENV{"PGPPATH"} = $PGPPATH; ! } ! &ReplaceGlobalVars(*RIGHTS); # # read the attributes description file --- 682,707 ---- fatalerror("PGPPATH directory $PGPPATH does not exist") unless -d $PGPPATH; $ENV{"PGPPATH"} = $PGPPATH; ! } ! ! # check if we have GPG ! if (defined($GPG)) { ! if ($have_pgp) { ! fatalerror("Can not have both PGP and GPG defined"); ! } else { ! $have_pgp = 1; ! } ! } ! ! if (defined($GPG)) { ! fatalerror("GPG binary $GPG is not executable") unless -x $GPG; ! fatalerror("GNUPGHOME directory $GNUPGHOME does not exist") ! unless -d $GNUPGHOME; ! $ENV{"GNUPGHOME"} = $GNUPGHOME; ! } ! ! &ReplaceGlobalVars(*RIGHTS); # # read the attributes description file Index: src/whoisd.pl =================================================================== RCS file: /usr/local/cvs/ripe/whoisd/src/whoisd.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** whoisd.pl 1999/08/27 08:20:31 1.5 --- whoisd.pl 1999/10/13 02:24:06 1.6 *************** *** 20,31 **** # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: whoisd.pl,v 1.5 1999/08/27 08:20:31 paulg Exp $ # # $RCSfile: whoisd.pl,v $ ! # $Revision: 1.5 $ # $Author: paulg $ ! # $Date: 1999/08/27 08:20:31 $ # # --- 20,31 ---- # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ! # $Id: whoisd.pl,v 1.6 1999/10/13 02:24:06 paulg Exp $ # # $RCSfile: whoisd.pl,v $ ! # $Revision: 1.6 $ # $Author: paulg $ ! # $Date: 1999/10/13 02:24:06 $ # # *************** *** 2106,2111 **** --- 2106,2112 ---- } elsif ( $! =~ /No\s+more\s+process/i || $! =~ /memory/i || + $! =~ /Protocol error/i || $! =~ /unavailable/i || $! =~ /temporarily/i ) {
- Previous message (by thread): New DB release 2.3.1
- Next message (by thread): [patch] Support for GNU Privacy Guard [2.3.0]
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[ db-wg Archives ]