diff options
Diffstat (limited to 'usr.bin/keyinfo/keyinfo.pl')
-rw-r--r-- | usr.bin/keyinfo/keyinfo.pl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/usr.bin/keyinfo/keyinfo.pl b/usr.bin/keyinfo/keyinfo.pl new file mode 100644 index 0000000..260a724 --- /dev/null +++ b/usr.bin/keyinfo/keyinfo.pl @@ -0,0 +1,27 @@ +#!/usr/bin/suidperl +# +# Search /etc/skeykeys for the skey string for this user OR user specified +# in 1st parameter. +# +# $Id$ +# + +die "usage: keyinfo [user]\n" unless $#ARGV < 1; + +open(K, "/etc/skeykeys") || exit 1; + +if ($#ARGV == 0) { + $user = $ARGV[0]; +} else { + $user = (getpwuid($<))[0]; +} + +while (<K>) { + ($id, $seq, $serial) = split; + if ($id eq $user) { + printf "%d %s\n", $seq - 1, $serial; + exit 0; + } +} +exit 1; + |