From 321a8ffea91583535a7cddf7b970cff7f9414b4c Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Mon, 16 Sep 2013 15:09:55 +0200 Subject: [PATCH] NULL mechanism was not dealing with ZAP denials properly --- src/null_mechanism.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/null_mechanism.cpp b/src/null_mechanism.cpp index b123cea4..f4ea9e75 100644 --- a/src/null_mechanism.cpp +++ b/src/null_mechanism.cpp @@ -242,24 +242,28 @@ int zmq::null_mechanism_t::receive_and_process_zap_reply () // Address delimiter frame if (msg [0].size () > 0) { + rc = -1; errno = EPROTO; goto error; } // Version frame if (msg [1].size () != 3 || memcmp (msg [1].data (), "1.0", 3)) { + rc = -1; errno = EPROTO; goto error; } // Request id frame if (msg [2].size () != 1 || memcmp (msg [2].data (), "1", 1)) { + rc = -1; errno = EPROTO; goto error; } // Status code frame if (msg [3].size () != 3 || memcmp (msg [3].data (), "200", 3)) { + rc = -1; errno = EACCES; goto error; }