summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;