File: fake-kadmin

package info (click to toggle)
krb5-wallet 1.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,192 kB
  • sloc: perl: 13,083; ansic: 6,287; sh: 2,373; sql: 1,884; makefile: 274
file content (28 lines) | stat: -rwxr-xr-x 685 bytes parent folder | download
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
#!/usr/bin/perl
#
# Fake kadmin.local used to test the keytab backend.
#
# Written by Russ Allbery <eagle@eyrie.org>
# Copyright 2007, 2014
#     The Board of Trustees of the Leland Stanford Junior University
#
# SPDX-License-Identifier: MIT

use strict;
use warnings;

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