aboutsummaryrefslogtreecommitdiff
path: root/mail/cone
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2003-08-15 02:49:45 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2003-08-15 02:49:45 +0000
commit69ce2b3499823eee6c2bbb2c0f8411e85a6dab93 (patch)
tree1f278028ded51bdb3a0392bd47604814547eed55 /mail/cone
parent982aa704c10b267d6ec53fb545edd2dde57b8324 (diff)
downloadports-69ce2b3499823eee6c2bbb2c0f8411e85a6dab93.tar.gz
ports-69ce2b3499823eee6c2bbb2c0f8411e85a6dab93.zip
Notes
Diffstat (limited to 'mail/cone')
-rw-r--r--mail/cone/Makefile52
-rw-r--r--mail/cone/distinfo1
-rw-r--r--mail/cone/pkg-deinstall8
-rw-r--r--mail/cone/pkg-descr4
-rw-r--r--mail/cone/pkg-install4
-rw-r--r--mail/cone/pkg-message14
-rw-r--r--mail/cone/pkg-plist313
-rw-r--r--mail/cone/scripts/c_rehash155
8 files changed, 551 insertions, 0 deletions
diff --git a/mail/cone/Makefile b/mail/cone/Makefile
new file mode 100644
index 000000000000..ddf01a1252ed
--- /dev/null
+++ b/mail/cone/Makefile
@@ -0,0 +1,52 @@
+# ports collection Makefile for: cone
+# Whom: Matthias Andree <matthias.andree@gmx.de>
+# Date created: 2003-06-19
+#
+# $FreeBSD$
+#
+
+PORTNAME= cone
+PORTVERSION= 0.52
+CATEGORIES= mail
+# This is for beta versions, leave it in please:
+#MASTER_SITES= http://www.courier-mta.org/beta/${PORTNAME}/
+# This is for release versions, leave it in please:
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= courier
+
+MAINTAINER= matthias.andree@gmx.de
+COMMENT= "Console based mail client with POP3/IMAP/SMAP support"
+
+LIB_DEPENDS= xml2.5:${PORTSDIR}/textproc/libxml2 \
+ aspell.15:${PORTSDIR}/textproc/aspell
+BUILD_DEPENDS= gpg:${PORTSDIR}/security/gnupg \
+ ${LOCALBASE}/lib/libncurses.so.5.3:${PORTSDIR}/devel/ncurses
+RUN_DEPENDS= gpg:${PORTSDIR}/security/gnupg \
+ ${LOCALBASE}/lib/libncurses.so.5.3:${PORTSDIR}/devel/ncurses
+
+USE_BZIP2= yes
+USE_PERL5= yes
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS= -C --without-db --prefix=${PREFIX} --exec-prefix=${PREFIX}
+
+CONFIGURE_ENV= REHASH=${SCRIPTDIR}/c_rehash LDFLAGS=-L${LOCALBASE}/lib \
+ CPPFLAGS=-I${LOCALBASE}/include
+CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
+MAN1= cone.1 leaf.1 mailtool.1
+
+do-install:
+ cd ${WRKSRC} && make install-strip
+
+post-install:
+ ${INSTALL_SCRIPT} ${WRKSRC}/sysconftool ${PREFIX}/sbin/cone-sysconftool
+ PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PORTNAME} POST-INSTALL
+ ${RM} -f ${PREFIX}/share/cone/rootcerts/.0
+ ${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+IGNORE= "does not build on FreeBSD versions before FreeBSD 5"
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/mail/cone/distinfo b/mail/cone/distinfo
new file mode 100644
index 000000000000..95c1e6dcc38a
--- /dev/null
+++ b/mail/cone/distinfo
@@ -0,0 +1 @@
+MD5 (cone-0.52.tar.bz2) = 7bdbea4ea8dbb8a1874224c552822bb5
diff --git a/mail/cone/pkg-deinstall b/mail/cone/pkg-deinstall
new file mode 100644
index 000000000000..9fa9cbcb4fae
--- /dev/null
+++ b/mail/cone/pkg-deinstall
@@ -0,0 +1,8 @@
+#! /bin/sh
+case "$2" in DEINSTALL)
+ if cmp -s "$PKG_PREFIX/etc/cone" "$PKG_PREFIX/etc/cone.dist" ; then
+ rm -f "$PKG_PREFIX/etc/cone"
+ else
+ echo "Modified $PKG_PREFIX/etc/cone left in place."
+ fi
+esac
diff --git a/mail/cone/pkg-descr b/mail/cone/pkg-descr
new file mode 100644
index 000000000000..f8d63bbecdb3
--- /dev/null
+++ b/mail/cone/pkg-descr
@@ -0,0 +1,4 @@
+Cone is a text-based mail client. Cone seamlessly handles multiple POP3,
+IMAP accounts, and local mail folders. Cone is also a simple newsreader.
+Cone is designed to be foolproof enough to be used by inexperienced users,
+but also offers advanced features for power users.
diff --git a/mail/cone/pkg-install b/mail/cone/pkg-install
new file mode 100644
index 000000000000..4e27f060a716
--- /dev/null
+++ b/mail/cone/pkg-install
@@ -0,0 +1,4 @@
+#! /bin/sh
+case "$2" in POST-INSTALL)
+ "$PKG_PREFIX/sbin/cone-sysconftool" "$PKG_PREFIX/etc/cone.dist" ;;
+esac
diff --git a/mail/cone/pkg-message b/mail/cone/pkg-message
new file mode 100644
index 000000000000..986552b41ede
--- /dev/null
+++ b/mail/cone/pkg-message
@@ -0,0 +1,14 @@
+
+--------------------------------------------------------------------------
+Note that Cone's CHARSET interpretation is different from FreeBSD's, so if
+you're using Cone with ISO8859* character sets, Cone may not start.
+Export a shell variable like this:
+
+setenv CHARSET ISO-8859-1 (for csh)
+
+CHARSET=ISO-8859-1
+export CHARSET (for sh/ksh/bash)
+
+Adjust the charset according to your locale, and mind the first dash.
+--------------------------------------------------------------------------
+
diff --git a/mail/cone/pkg-plist b/mail/cone/pkg-plist
new file mode 100644
index 000000000000..128d4f5ed90d
--- /dev/null
+++ b/mail/cone/pkg-plist
@@ -0,0 +1,313 @@
+bin/cone
+bin/leaf
+bin/mailtool
+sbin/cone-sysconftool
+etc/cone.dist
+libexec/cone
+share/cone/APPLICATION.PDF.filter
+share/cone/IMAGE.GIF.filter
+share/cone/IMAGE.JPEG.filter
+share/cone/IMAGE.PNG.filter
+share/cone/account-checknewmail.html
+share/cone/account-copymessagesto.html
+share/cone/account-createfolder.html
+share/cone/account-deletefolder.html
+share/cone/account-getfolderfrompath.html
+share/cone/account-getfolderfromstring.html
+share/cone/account-getfolderindexinfo.html
+share/cone/account-getfolderindexsize.html
+share/cone/account-getmessagecontent.html
+share/cone/account-getmessagecontentdecoded.html
+share/cone/account-getmessageenvelope.html
+share/cone/account-getmessagestructure.html
+share/cone/account-getparentfolder.html
+share/cone/account-getsubfolders.html
+share/cone/account-gettoplevelfolders.html
+share/cone/account-libmail-addmessage.html
+share/cone/account-login.html
+share/cone/account-logout.html
+share/cone/account-openfolder.html
+share/cone/account-readfolderinfo.html
+share/cone/account-removemessages.html
+share/cone/account-renamefolder.html
+share/cone/account-savefolderindexinfo.html
+share/cone/account-searchmessages.html
+share/cone/account-send.html
+share/cone/account-translatepath.html
+share/cone/account-updatefolderindexflags.html
+share/cone/account-updatefolderindexinfo.html
+share/cone/add.html
+share/cone/address.html
+share/cone/attributes.html
+share/cone/book.html
+share/cone/c1844.html
+share/cone/c1882.html
+share/cone/cone.hlp
+share/cone/cone.html
+share/cone/cone00index.html
+share/cone/cone01folderlist.html
+share/cone/cone02folderindex.html
+share/cone/cone03messageview.html
+share/cone/cone04writemessage.html
+share/cone/cone05setup.html
+share/cone/cone06newaccount.html
+share/cone/cone07remoteconfig.html
+share/cone/cone08gpg.html
+share/cone/cone09masterpassword.html
+share/cone/cone10encryption.html
+share/cone/envelope.html
+share/cone/faq.html
+share/cone/folder-addmessage.html
+share/cone/folder-clone.html
+share/cone/folder-create.html
+share/cone/folder-createsubfolder.html
+share/cone/folder-destroy.html
+share/cone/folder-getname.html
+share/cone/folder-getparentfolder.html
+share/cone/folder-getpath.html
+share/cone/folder-hasmessages.html
+share/cone/folder-hassubfolders.html
+share/cone/folder-isparentof.html
+share/cone/folder-open.html
+share/cone/folder-readfolderinfo.html
+share/cone/folder-readsubfolders.html
+share/cone/folder-renamefolder.html
+share/cone/folder-tostring.html
+share/cone/index.html
+share/cone/install.html
+share/cone/leaf.html
+share/cone/libmail.html
+share/cone/mail-checknewmail.html
+share/cone/mail-copymessagesto.html
+share/cone/mail-findfolder.html
+share/cone/mail-folderfromstring.html
+share/cone/mail-getfolderindexinfo.html
+share/cone/mail-getfolderindexsize.html
+share/cone/mail-getsendfolder.html
+share/cone/mail-hascapability.html
+share/cone/mail-homedir.html
+share/cone/mail-hostname.html
+share/cone/mail-isremoteurl.html
+share/cone/mail-loginurldecode.html
+share/cone/mail-loginurlencode.html
+share/cone/mail-logout.html
+share/cone/mail-open.html
+share/cone/mail-process.html
+share/cone/mail-readmsgattr.html
+share/cone/mail-readmsgcontent.html
+share/cone/mail-readmsgcontentdecoded.html
+share/cone/mail-readtoplevel.html
+share/cone/mail-removemessages.html
+share/cone/mail-resume.html
+share/cone/mail-savefolderindexinfo.html
+share/cone/mail-searchmessages.html
+share/cone/mail-setappcharset.html
+share/cone/mail-translatepath.html
+share/cone/mail-updatefolderindexflags.html
+share/cone/mail-updatefolderindexinfo.html
+share/cone/mail-updatenotify.html
+share/cone/mail-upper.html
+share/cone/mailtool.html
+share/cone/manpage.css
+share/cone/mimestruct.html
+share/cone/native.html
+share/cone/r6325.html
+share/cone/r6545.html
+share/cone/r7951.html
+share/cone/readme.html
+share/cone/rootcerts/aba-ecom-root-ca.pem
+share/cone/rootcerts/addtrust-class-1-ca-root.pem
+share/cone/rootcerts/addtrust-external-ca-root.pem
+share/cone/rootcerts/addtrust-public-ca-root.pem
+share/cone/rootcerts/addtrust-qualified-ca-root.pem
+share/cone/rootcerts/american-express-certificate-authority.pem
+share/cone/rootcerts/american-express-global-certificate.pem
+share/cone/rootcerts/baltimore-cybertrust-code-signing.pem
+share/cone/rootcerts/baltimore-cybertrust-mobile-root.pem
+share/cone/rootcerts/baltimore-cybertrust-root.pem
+share/cone/rootcerts/bankengine.pem
+share/cone/rootcerts/belsign-object-publishing-ca.pem
+share/cone/rootcerts/belsign-secure-server-ca.pem
+share/cone/rootcerts/betrusted-root-ca.pem
+share/cone/rootcerts/certengine.pem
+share/cone/rootcerts/class-1-public-primary-ocsp-responder.pem
+share/cone/rootcerts/class-2-public-primary-ocsp-responder.pem
+share/cone/rootcerts/class-3-public-primary-ocsp-responder.pem
+share/cone/rootcerts/cybertrust-japan-root-ca.pem
+share/cone/rootcerts/cybertrust-japan-secure-server.pem
+share/cone/rootcerts/deutsche-telekom-root-ca.pem
+share/cone/rootcerts/digital-signature-trust-co-dstca-00.pem
+share/cone/rootcerts/digital-signature-trust-co-dstca-01.pem
+share/cone/rootcerts/dst-rootca-x1.pem
+share/cone/rootcerts/dst-rootca-x2.pem
+share/cone/rootcerts/e-certify-ca.pem
+share/cone/rootcerts/e-certify-ra.pem
+share/cone/rootcerts/entrust-net-certification-authority.pem
+share/cone/rootcerts/entrust-net-client-certification-00.pem
+share/cone/rootcerts/entrust-net-client-certification-01.pem
+share/cone/rootcerts/entrust-net-secure-server-certification-00.pem
+share/cone/rootcerts/entrust-net-secure-server-certification-01.pem
+share/cone/rootcerts/equifax-equifax-premium-certificate.pem
+share/cone/rootcerts/equifax-equifax-secure-certificate.pem
+share/cone/rootcerts/equifax-secure-ebusiness-ca-1.pem
+share/cone/rootcerts/equifax-secure-equifax-secure-ebusiness.pem
+share/cone/rootcerts/equifax-secure-global-ebusiness.pem
+share/cone/rootcerts/fortengine.pem
+share/cone/rootcerts/globalsign-partners-ca.pem
+share/cone/rootcerts/globalsign-primary-class-1-ca.pem
+share/cone/rootcerts/globalsign-primary-class-2-ca.pem
+share/cone/rootcerts/globalsign-primary-class-3-ca.pem
+share/cone/rootcerts/globalsign-root-ca.pem
+share/cone/rootcerts/gp-root-2.pem
+share/cone/rootcerts/gp-root-3.pem
+share/cone/rootcerts/gp-root-4.pem
+share/cone/rootcerts/gp-root-5.pem
+share/cone/rootcerts/gte-cybertrust-global-root.pem
+share/cone/rootcerts/gte-cybertrust-root-5.pem
+share/cone/rootcerts/gte-cybertrust-root.pem
+share/cone/rootcerts/http-www-valicert-com-00.pem
+share/cone/rootcerts/http-www-valicert-com-01.pem
+share/cone/rootcerts/http-www-valicert-com-02.pem
+share/cone/rootcerts/http-www-valicert-net.pem
+share/cone/rootcerts/mailengine.pem
+share/cone/rootcerts/rsa-data-security-inc-secure-server.pem
+share/cone/rootcerts/secure-server-ocsp-responder.pem
+share/cone/rootcerts/tc-trustcenter-for-security-in-00.pem
+share/cone/rootcerts/tc-trustcenter-for-security-in-01.pem
+share/cone/rootcerts/tc-trustcenter-for-security-in-02.pem
+share/cone/rootcerts/tc-trustcenter-for-security-in-03.pem
+share/cone/rootcerts/tc-trustcenter-for-security-in-04.pem
+share/cone/rootcerts/thawte-personal-basic-ca.pem
+share/cone/rootcerts/thawte-personal-freemail-ca.pem
+share/cone/rootcerts/thawte-personal-premium-ca.pem
+share/cone/rootcerts/thawte-premium-server-ca.pem
+share/cone/rootcerts/thawte-server-ca.pem
+share/cone/rootcerts/thawte-timestamping-ca.pem
+share/cone/rootcerts/thawte-universal-ca-root.pem
+share/cone/rootcerts/traderengine.pem
+share/cone/rootcerts/usps-production-ca-1.pem
+share/cone/rootcerts/usps-root-ca.pem
+share/cone/rootcerts/verisign-class-1-public-primary.pem
+share/cone/rootcerts/verisign-class-2-public-primary.pem
+share/cone/rootcerts/verisign-class-3-public-primary.pem
+share/cone/rootcerts/verisign-class-4-public-primary.pem
+share/cone/rootcerts/verisign-inc-class-1-public-primary.pem
+share/cone/rootcerts/verisign-inc-class-2-public-primary.pem
+share/cone/rootcerts/verisign-inc-class-3-public-primary.pem
+share/cone/rootcerts/verisign-inc-verisign-trust-network-00.pem
+share/cone/rootcerts/verisign-inc-verisign-trust-network-01.pem
+share/cone/rootcerts/verisign-inc-verisign-trust-network-02.pem
+share/cone/rootcerts/verisign-inc-verisign-trust-network-03.pem
+share/cone/rootcerts/verisign-time-stamping-authority.pem
+share/cone/rootcerts/visa-visa-international-service.pem
+share/cone/rootcerts/xcert-ez-by-dst.pem
+share/cone/rootcerts/xcert-international-inc-xcert-root-00.pem
+share/cone/rootcerts/xcert-international-inc-xcert-root-01.pem
+share/cone/rootcerts/xcert-international-inc-xcert-root-02.pem
+share/cone/rootcerts/xcert-international-inc-xcert-root-03.pem
+share/cone/rootcerts/052e396b.0
+share/cone/rootcerts/0bb21872.0
+share/cone/rootcerts/0c364b2d.0
+share/cone/rootcerts/0e82f83a.0
+share/cone/rootcerts/11f154d6.0
+share/cone/rootcerts/128b9c8d.0
+share/cone/rootcerts/19899da5.0
+share/cone/rootcerts/1a147d5b.0
+share/cone/rootcerts/1bb6c7e0.0
+share/cone/rootcerts/256fd83b.0
+share/cone/rootcerts/2d047263.0
+share/cone/rootcerts/2edf7016.0
+share/cone/rootcerts/31044350.0
+share/cone/rootcerts/3ad48a91.0
+share/cone/rootcerts/3c58f906.0
+share/cone/rootcerts/3e7271e8.0
+share/cone/rootcerts/412bea73.0
+share/cone/rootcerts/418882ac.0
+share/cone/rootcerts/43d4bde2.0
+share/cone/rootcerts/4643210f.0
+share/cone/rootcerts/4d654d1d.0
+share/cone/rootcerts/5480ace1.0
+share/cone/rootcerts/54edfa5d.0
+share/cone/rootcerts/56e607f4.0
+share/cone/rootcerts/594f1775.0
+share/cone/rootcerts/5ee07a24.0
+share/cone/rootcerts/5f5e5caa.0
+share/cone/rootcerts/6166cb50.0
+share/cone/rootcerts/61f6c934.0
+share/cone/rootcerts/66eb5c17.0
+share/cone/rootcerts/66ec64da.0
+share/cone/rootcerts/6981fb07.0
+share/cone/rootcerts/6a15001a.0
+share/cone/rootcerts/6c55cf77.0
+share/cone/rootcerts/6d6ec79c.0
+share/cone/rootcerts/700b8679.0
+share/cone/rootcerts/709afd2b.0
+share/cone/rootcerts/72fa7371.0
+share/cone/rootcerts/73451336.0
+share/cone/rootcerts/739b7930.0
+share/cone/rootcerts/74c26bd0.0
+share/cone/rootcerts/7651b327.0
+share/cone/rootcerts/76d6205a.0
+share/cone/rootcerts/788c9bfc.0
+share/cone/rootcerts/7a9820c1.0
+share/cone/rootcerts/7d3cd826.0
+share/cone/rootcerts/7d453d8f.0
+share/cone/rootcerts/7e74191f.0
+share/cone/rootcerts/81447c6e.0
+share/cone/rootcerts/843b6c51.0
+share/cone/rootcerts/878cf4c6.0
+share/cone/rootcerts/8e6e2991.0
+share/cone/rootcerts/8efac7d4.0
+share/cone/rootcerts/8f7b96c4.0
+share/cone/rootcerts/95750816.0
+share/cone/rootcerts/97b4211c.0
+share/cone/rootcerts/a15b3b6b.0
+share/cone/rootcerts/a2be0f54.0
+share/cone/rootcerts/a2df7ad7.0
+share/cone/rootcerts/a38484ce.0
+share/cone/rootcerts/a3c60019.0
+share/cone/rootcerts/aaa45464.0
+share/cone/rootcerts/b0f3e76e.0
+share/cone/rootcerts/b5f329fa.0
+share/cone/rootcerts/ba386118.0
+share/cone/rootcerts/bb0a889c.0
+share/cone/rootcerts/bcdd5959.0
+share/cone/rootcerts/bffe8b5d.0
+share/cone/rootcerts/c19d42c7.0
+share/cone/rootcerts/c215bc69.0
+share/cone/rootcerts/c33a80d4.0
+share/cone/rootcerts/c527e4ab.0
+share/cone/rootcerts/c9bc75ba.0
+share/cone/rootcerts/ccf7ff0e.0
+share/cone/rootcerts/d2adc77d.0
+share/cone/rootcerts/d593166d.0
+share/cone/rootcerts/d78a75c7.0
+share/cone/rootcerts/db65db21.0
+share/cone/rootcerts/ddc328ff.0
+share/cone/rootcerts/dfd0b044.0
+share/cone/rootcerts/e268a4c5.0
+share/cone/rootcerts/e28f6bbc.0
+share/cone/rootcerts/e7b8d656.0
+share/cone/rootcerts/e9aaa9de.0
+share/cone/rootcerts/ed049835.0
+share/cone/rootcerts/ed524cf5.0
+share/cone/rootcerts/ed62f4e3.0
+share/cone/rootcerts/f10dd942.0
+share/cone/rootcerts/f4996e82.0
+share/cone/rootcerts/f73e89fd.0
+share/cone/search.html
+share/cone/smap1.html
+share/cone/store.html
+share/cone/synchronous.html
+share/cone/x8356.html
+share/cone/x8441.html
+share/cone/x8553.html
+share/cone/x8689.html
+share/cone/x8944.html
+share/cone/x9164.html
+share/cone/x9267.html
+share/cone/x9490.html
+share/cone/x9814.html
+share/cone/x9825.html
+@dirrm share/cone/rootcerts
+@dirrm share/cone
diff --git a/mail/cone/scripts/c_rehash b/mail/cone/scripts/c_rehash
new file mode 100644
index 000000000000..e5ef9d224ed7
--- /dev/null
+++ b/mail/cone/scripts/c_rehash
@@ -0,0 +1,155 @@
+#!/usr/bin/perl
+
+
+# Perl c_rehash script, scan all files in a directory
+# and add symbolic links to their hash values.
+
+my $openssl;
+
+my $dir = "/etc/ssl";
+
+if(defined $ENV{OPENSSL}) {
+ $openssl = $ENV{OPENSSL};
+} else {
+ $openssl = "openssl";
+ $ENV{OPENSSL} = $openssl;
+}
+
+if(! -f $openssl) {
+ my $found = 0;
+ foreach (split /:/, $ENV{PATH}) {
+ if(-f "$_/$openssl") {
+ $found = 1;
+ last;
+ }
+ }
+ if($found == 0) {
+ print STDERR "c_rehash: rehashing skipped ('openssl' program not available)\n";
+ exit 0;
+ }
+}
+
+if(@ARGV) {
+ @dirlist = @ARGV;
+} elsif($ENV{SSL_CERT_DIR}) {
+ @dirlist = split /:/, $ENV{SSL_CERT_DIR};
+} else {
+ $dirlist[0] = "$dir/certs";
+}
+
+
+foreach (@dirlist) {
+ if(-d $_ and -w $_) {
+ hash_dir($_);
+ }
+}
+
+sub hash_dir {
+ my %hashlist;
+ print "Doing $_[0]\n";
+ chdir $_[0];
+ opendir(DIR, ".");
+ my @flist = readdir(DIR);
+ # Delete any existing symbolic links
+ foreach (grep {/^[\da-f]+\.r{0,1}\d+$/} @flist) {
+ if(-l $_) {
+ unlink $_;
+ }
+ }
+ closedir DIR;
+ FILE: foreach $fname (grep {/\.pem$/} @flist) {
+ # Check to see if certificates and/or CRLs present.
+ my ($cert, $crl) = check_file($fname);
+ if(!$cert && !$crl) {
+ print STDERR "WARNING: $fname does not contain a certificate or CRL: skipping\n";
+ next;
+ }
+ link_hash_cert($fname) if($cert);
+ link_hash_crl($fname) if($crl);
+ }
+}
+
+sub check_file {
+ my ($is_cert, $is_crl) = (0,0);
+ my $fname = $_[0];
+ open IN, $fname;
+ while(<IN>) {
+ if(/^-----BEGIN (.*)-----/) {
+ my $hdr = $1;
+ if($hdr =~ /^(X509 |TRUSTED |)CERTIFICATE$/) {
+ $is_cert = 1;
+ last if($is_crl);
+ } elsif($hdr eq "X509 CRL") {
+ $is_crl = 1;
+ last if($is_cert);
+ }
+ }
+ }
+ close IN;
+ return ($is_cert, $is_crl);
+}
+
+
+# Link a certificate to its subject name hash value, each hash is of
+# the form <hash>.<n> where n is an integer. If the hash value already exists
+# then we need to up the value of n, unless its a duplicate in which
+# case we skip the link. We check for duplicates by comparing the
+# certificate fingerprints
+
+sub link_hash_cert {
+ my $fname = $_[0];
+ my ($hash, $fprint) = `$openssl x509 -hash -fingerprint -noout -in $fname`;
+ chomp $hash;
+ chomp $fprint;
+ $fprint =~ s/^.*=//;
+ $fprint =~ tr/://d;
+ my $suffix = 0;
+ # Search for an unused hash filename
+ while(exists $hashlist{"$hash.$suffix"}) {
+ # Hash matches: if fingerprint matches its a duplicate cert
+ if($hashlist{"$hash.$suffix"} eq $fprint) {
+ print STDERR "WARNING: Skipping duplicate certificate $fname\n";
+ return;
+ }
+ $suffix++;
+ }
+ $hash .= ".$suffix";
+ print "$fname => $hash\n";
+ $symlink_exists=eval {symlink("",""); 1};
+ if ($symlink_exists) {
+ symlink $fname, $hash;
+ } else {
+ system ("cp", $fname, $hash);
+ }
+ $hashlist{$hash} = $fprint;
+}
+
+# Same as above except for a CRL. CRL links are of the form <hash>.r<n>
+
+sub link_hash_crl {
+ my $fname = $_[0];
+ my ($hash, $fprint) = `$openssl crl -hash -fingerprint -noout -in $fname`;
+ chomp $hash;
+ chomp $fprint;
+ $fprint =~ s/^.*=//;
+ $fprint =~ tr/://d;
+ my $suffix = 0;
+ # Search for an unused hash filename
+ while(exists $hashlist{"$hash.r$suffix"}) {
+ # Hash matches: if fingerprint matches its a duplicate cert
+ if($hashlist{"$hash.r$suffix"} eq $fprint) {
+ print STDERR "WARNING: Skipping duplicate CRL $fname\n";
+ return;
+ }
+ $suffix++;
+ }
+ $hash .= ".r$suffix";
+ print "$fname => $hash\n";
+ $symlink_exists=eval {symlink("",""); 1};
+ if ($symlink_exists) {
+ symlink $fname, $hash;
+ } else {
+ system ("cp", $fname, $hash);
+ }
+ $hashlist{$hash} = $fprint;
+}