summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-02-22 15:29:02 (GMT)
committerDavid A. Madore <david+git@madore.org>2010-02-22 15:29:02 (GMT)
commit0b16a534b2036c16637ecc5e97f9dcd3e265049a (patch)
treeea3c590f965921be289613e2dc8e0536d70b4eb7
parentd0567f5c51be98e62bf011bf38b73e840eb8b338 (diff)
downloademergency-0b16a534b2036c16637ecc5e97f9dcd3e265049a.zip
emergency-0b16a534b2036c16637ecc5e97f9dcd3e265049a.tar.gz
emergency-0b16a534b2036c16637ecc5e97f9dcd3e265049a.tar.bz2
Allow running the client with no key (generating no HMAC), for PING and DATE.
-rwxr-xr-xemergencyc.pl6
1 files 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;