0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2011, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
93235c1cba839a88013063ff8c440849d95dd222Automatic Updater# $Id: authsock.pl,v 1.3 2011/01/07 23:47:07 tbox Exp $
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt# test the update-policy external protocol
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Huntif (!defined($path)) {
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt print("Usage: authsock.pl --path=<sockpath> --type=type --pidfile=pidfile\n");
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Huntmy $server = IO::Socket::UNIX->new(Local => $path, Type => SOCK_STREAM, Listen => 8) or
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt die "unable to create socket $path";
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt# setup our pidfile
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt or die "unable to open pidfile $pidfile";
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt # die after the given timeout
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt printf("Badly formatted request\n");
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt printf("Length mismatch %u %u\n", $req_len, length($buf)+8);
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt printf("version=%u signer=%s name=%s addr=%s type=%s key=%s key_data_len=%u\n",
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt $version, $signer, $name, $addr, $type, $key, length($key_data));
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt printf("allowed type %s == %s\n", $type, $typeallowed);
c23a9eed3ea86d92f42ef7296b9eeee1b54bb851Evan Hunt printf("disallowed type %s != %s\n", $type, $typeallowed);