From b6edbe8a83658ca1b35e502e6353e9b3d3762073 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Wed, 19 Mar 2008 18:22:55 +0000 Subject: undo the previous change: it is arguably cleaner to send+expect the protocol number only with signed data --- lib/Smokeping/Master.pm | 2 +- lib/Smokeping/Slave.pm | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Smokeping/Master.pm b/lib/Smokeping/Master.pm index 9e69b28..f8704a0 100644 --- a/lib/Smokeping/Master.pm +++ b/lib/Smokeping/Master.pm @@ -269,7 +269,7 @@ sub answer_slave { return; } } else { - print "Content-Type: text/plain\nProtocol: $PROTOCOL\n\nOK\n"; + print "Content-Type: text/plain\n\nOK\n"; }; return; } diff --git a/lib/Smokeping/Slave.pm b/lib/Smokeping/Slave.pm index 7cc3b7e..0931c80 100644 --- a/lib/Smokeping/Slave.pm +++ b/lib/Smokeping/Slave.pm @@ -93,16 +93,16 @@ sub submit_results { my $key = $response->header('Key'); my $protocol = $response->header('Protocol') || '?'; - if ($protocol ne $PROTOCOL){ - warn "WARNING $slave_cfg->{master_url} sent data with protocol $protocol. Expected $PROTOCOL."; - return undef; - } - if ($response->header('Content-Type') ne 'application/smokeping-config'){ warn "$data\n" unless $data =~ /OK/; Smokeping::do_debuglog("Sent data to Server. Server said $data"); return undef; }; + + if ($protocol ne $PROTOCOL){ + warn "WARNING $slave_cfg->{master_url} sent data with protocol $protocol. Expected $PROTOCOL."; + return undef; + } if (hmac_md5_hex($data,$slave_cfg->{shared_secret}) ne $key){ warn "WARNING $slave_cfg->{master_url} sent data with wrong key"; return undef; -- cgit v1.2.3-24-g4f1b