From fa5c0e18e304946cdad4fa747f52af141a561934 Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Sat, 18 May 2013 11:53:10 +0100 Subject: [PATCH 1/3] Trivial fix to man page --- doc/zmq_curve.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/zmq_curve.txt b/doc/zmq_curve.txt index a2d255b6..da2bcfd4 100644 --- a/doc/zmq_curve.txt +++ b/doc/zmq_curve.txt @@ -23,7 +23,7 @@ options. Which peer binds, and which connects, is not relevant. NOTE: this isn't implemented and not fully defined. The server keypair needs to be persistent, and it would be sensible to define a format for -this in CurveZMQ +this as a CurveZMQ RFC. SEE ALSO From 73562112b831c61c95688d7ce3957ab2193b475d Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Sat, 18 May 2013 11:53:20 +0100 Subject: [PATCH 2/3] Whitespace fixes --- src/plain_mechanism.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plain_mechanism.cpp b/src/plain_mechanism.cpp index 2398251f..91e43c25 100644 --- a/src/plain_mechanism.cpp +++ b/src/plain_mechanism.cpp @@ -125,19 +125,20 @@ int zmq::plain_mechanism_t::hello_command (msg_t *msg_) const const std::string password = options.plain_password; zmq_assert (password.length () < 256); - const size_t command_size = 8 + 1 + username.length () + - 1 + password.length (); + const size_t command_size = 8 + 1 + username.length () + + 1 + password.length (); const int rc = msg_->init_size (command_size); errno_assert (rc == 0); - unsigned char *ptr = static_cast (msg_->data ()); - + unsigned char *ptr = static_cast (msg_->data ()); memcpy (ptr, "HELLO ", 8); ptr += 8; + *ptr++ = static_cast (username.length ()); memcpy (ptr, username.c_str (), username.length ()); ptr += username.length (); + *ptr++ = static_cast (password.length ()); memcpy (ptr, password.c_str (), password.length ()); ptr += password.length (); @@ -155,7 +156,6 @@ int zmq::plain_mechanism_t::process_hello_command (msg_t *msg_) errno = EPROTO; return -1; } - ptr += 8; bytes_left -= 8; @@ -194,7 +194,8 @@ int zmq::plain_mechanism_t::process_hello_command (msg_t *msg_) return -1; } - // TODO: Add user authentication + // TODO: Add user authentication + // Note: maybe use RFC 27 (ZAP) for this return 0; } From 31ee92f2fda594be8be57652a4fd5f83720f0ee8 Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Sun, 19 May 2013 10:01:33 +0100 Subject: [PATCH 3/3] stdint.h is not available on all platforms --- include/zmq.h | 16 +++++++++++++++- src/mechanism.hpp | 3 +-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/zmq.h b/include/zmq.h index 470f16bb..16448c36 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -27,7 +27,6 @@ extern "C" { #if !defined _WIN32_WCE #include #endif -#include #include #include #if defined _WIN32 @@ -53,6 +52,21 @@ extern "C" { # endif #endif +/* Define integer types needed for event interface */ +#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS +# include +#elif defined _MSC_VER && _MSC_VER < 1600 +# ifndef int32_t +typedef __int32 int32_t; +# endif +# ifndef uint16_t +typedef unsigned __int16 uint16_t; +# endif +#else +# include +#endif + + /******************************************************************************/ /* 0MQ versioning support. */ /******************************************************************************/ diff --git a/src/mechanism.hpp b/src/mechanism.hpp index 28ed0e14..2b8ff272 100644 --- a/src/mechanism.hpp +++ b/src/mechanism.hpp @@ -20,8 +20,7 @@ #ifndef __ZMQ_MECHANISM_HPP_INCLUDED__ #define __ZMQ_MECHANISM_HPP_INCLUDED__ -#include - +#include "stdint.hpp" #include "options.hpp" #include "blob.hpp"