authsock.pl revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
#
# Copyright (C) 2011, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id: authsock.pl,v 1.3 2011/01/07 23:47:07 tbox Exp $
# test the update-policy external protocol
require 5.6.0;
my $path;
my $typeallowed = "A";
my $pidfile = "authsock.pid";
my $timeout = 0;
"type=s" => \$typeallowed,
"pidfile=s" => \$pidfile,
"timeout=i" => \$timeout);
if (!defined($path)) {
print("Usage: authsock.pl --path=<sockpath> --type=type --pidfile=pidfile\n");
exit(1);
}
unlink($path);
die "unable to create socket $path";
chmod 0777, $path;
# setup our pidfile
or die "unable to open pidfile $pidfile";
print $pid "$$\n";
close($pid);
if ($timeout != 0) {
# die after the given timeout
alarm($timeout);
}
printf("Badly formatted request\n");
next;
}
my ($signer,
$name,
$addr,
$type,
$key,
next;
}
printf("version=%u signer=%s name=%s addr=%s type=%s key=%s key_data_len=%u\n",
my $result;
if ($typeallowed eq $type) {
$result = 1;
} else {
$result = 0;
}
}