From 0b16a534b2036c16637ecc5e97f9dcd3e265049a Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Mon, 22 Feb 2010 16:29:02 +0100 Subject: Allow running the client with no key (generating no HMAC), for PING and DATE. --- emergencyc.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/emergencyc.pl b/emergencyc.pl index 5d59be1..c460dc1 100755 --- a/emergencyc.pl +++ b/emergencyc.pl @@ -45,7 +45,7 @@ if ( defined($opts{K}) ) { chomp $key; close $key_file; } -die "No key specified (use -K or -k option)" unless defined($key); +#die "No key specified (use -K or -k option)" unless defined($key); my $host = $opts{h} // "localhost"; my $port = $opts{p} // DEFAULT_PORT; @@ -64,10 +64,10 @@ sub curtime { $year+1900,$mon+1,$mday,$hour,$min,$sec); } -my $command = $ARGV[0] // "PING"; +my $command = scalar(@ARGV)?join(" ",@ARGV):"PING"; my $timestamp = $opts{t} // curtime; my $validate = "$command|$timestamp"; -my $mac_check = hmac_sha256_hex($validate, $key); +my $mac_check = defined($key)?hmac_sha256_hex($validate, $key):""; send $socket, "$command|$timestamp|$mac_check", 0, $haddr; my $buf; -- cgit v1.2.3