summaryrefslogtreecommitdiffstats
path: root/usr.bin/keyinfo/keyinfo.pl
blob: 260a72479f987e9d7d318ed11bd9ecc453871fb5 (plain)
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
#!/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;

OpenPOWER on IntegriCloud