summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNiko Tyni <ntyni@iki.fi>2008-03-19 19:22:55 +0100
committerNiko Tyni <ntyni@iki.fi>2008-03-19 19:22:55 +0100
commitb6edbe8a83658ca1b35e502e6353e9b3d3762073 (patch)
tree1bff21b92810ae9cbeaeeda817c848087eb0a20c /lib
parent53c31b5e314f2717f730969974cd6ef36d9fe76c (diff)
downloadsmokeping-b6edbe8a83658ca1b35e502e6353e9b3d3762073.tar.gz
smokeping-b6edbe8a83658ca1b35e502e6353e9b3d3762073.tar.xz
undo the previous change: it is arguably cleaner to send+expect the protocol number only with signed data
Diffstat (limited to 'lib')
-rw-r--r--lib/Smokeping/Master.pm2
-rw-r--r--lib/Smokeping/Slave.pm10
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;