aboutsummaryrefslogtreecommitdiff
path: root/tests/data/fake-kadmin
blob: 039d8b20498c1c11237853dd7b796ff328ffbf7b (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
#!/usr/bin/perl -w
# $Id$
#
# fake-kadmin -- Fake kadmin.local used to test the keytab backend.
#
# Written by Russ Allbery <rra@stanford.edu>
# Copyright 2007 Board of Trustees, Leland Stanford Jr. University
# See LICENSE for licensing terms.

unless ($ARGV[0] eq '-q' && @ARGV == 2) {
    die "invalid arguments\n";
}
my @command = split (' ', $ARGV[1]);
unless ("@command[0..3]" eq 'ktadd -q -norandkey -k') {
    die "invalid command @command\n";
}
if ($command[5] eq 'error@EXAMPLE.ORG') {
    warn "Some bad stuff\n";
    exit 1;
}
open (OUT, '>', $command[4]) or die "cannot create $command[4]: $!\n";
print OUT $command[5], "\n";
close OUT;
exit 0;