aboutsummaryrefslogtreecommitdiffstats
path: root/whisper
diff options
context:
space:
mode:
Diffstat (limited to 'whisper')
-rw-r--r--whisper/mailserver/mailserver.go6
-rw-r--r--whisper/mailserver/server_test.go5
2 files changed, 7 insertions, 4 deletions
diff --git a/whisper/mailserver/mailserver.go b/whisper/mailserver/mailserver.go
index 6555fd5c0..a889c2bd2 100644
--- a/whisper/mailserver/mailserver.go
+++ b/whisper/mailserver/mailserver.go
@@ -17,7 +17,6 @@
package mailserver
import (
- "bytes"
"encoding/binary"
"fmt"
@@ -175,7 +174,10 @@ func (s *WMailServer) validateRequest(peerID []byte, request *whisper.Envelope)
if len(src)-len(peerID) == 1 {
src = src[1:]
}
- if !bytes.Equal(peerID, src) {
+
+ // if you want to check the signature, you can do it here. e.g.:
+ // if !bytes.Equal(peerID, src) {
+ if src == nil {
log.Warn(fmt.Sprintf("Wrong signature of p2p request"))
return false, 0, 0, topic
}
diff --git a/whisper/mailserver/server_test.go b/whisper/mailserver/server_test.go
index c8e0a553a..63864c1e6 100644
--- a/whisper/mailserver/server_test.go
+++ b/whisper/mailserver/server_test.go
@@ -167,8 +167,9 @@ func singleRequest(t *testing.T, server *WMailServer, env *whisper.Envelope, p *
src[0]++
ok, lower, upper, topic = server.validateRequest(src, request)
- if ok {
- t.Fatalf("request validation false positive, seed: %d (lower: %d, upper: %d).", seed, lower, upper)
+ if !ok {
+ // request should be valid regardless of signature
+ t.Fatalf("request validation false negative, seed: %d (lower: %d, upper: %d).", seed, lower, upper)
}
}