/usr/sbin/lprng_index_certs is in lprng 3.8.B-2.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #!/bin/sh
# make an index in the certificate directory
#
usage () {
echo "usage: lprng_index_certs [certdir]" >&2
echo " default directory $CA_DIR" >&2
exit 1
}
ssl_program=/usr/bin/openssl
CA_CERT=/etc/lprng/ssl.ca/ca.crt
case "$1" in
--TEMP=* )
CA_DIR=`expr "$1" : "--TEMP=\(.*\)"`
shift
;;
esac
if [ "$1" != "" ] ; then
CA_DIR=$1
fi
if [ "$CA_DIR" = "" ] ; then
CA_DIR=${CA_CERT}
fi
if [ -f $CA_DIR ] ; then
CA_DIR=`dirname ${CA_DIR}`
fi
if [ ! -d $CA_DIR ] ; then
echo "directory $CA_DIR does not exist" >&2
usage
fi
set -e
cd $CA_DIR
for file in *.crt; do
if [ ".`grep SKIPME $file`" != . ]; then
echo dummy | awk '{ printf("%-15s ... Skipped\n", file); }' "file=$file";
else
n=0;
while [ 1 ]; do
hash="`$ssl_program x509 -noout -hash <$file`";
if [ -r "$hash.$n" ]; then
n=`expr $n + 1`;
else
echo dummy | awk '{ printf("%-15s ... %s\n", file, hash); }' "file=$file" "hash=$hash.$n";
ln -s $file $hash.$n;
break;
fi;
done;
fi;
done
|