Commit 30e2398e authored by Simon Giesecke's avatar Simon Giesecke Committed by Simon Giesecke

Problem: WSS-specific members and options are compiled without ZMQ_HAVE_WSS

Solution: properly guard members and options
parent 9e548bd5
...@@ -786,6 +786,7 @@ int zmq::options_t::setsockopt (int option_, ...@@ -786,6 +786,7 @@ int zmq::options_t::setsockopt (int option_,
} }
break; break;
#ifdef ZMQ_HAVE_WSS
case ZMQ_WSS_KEY_PEM: case ZMQ_WSS_KEY_PEM:
// TODO: check if valid certificate // TODO: check if valid certificate
wss_key_pem = std::string ((char *) optval_, optvallen_); wss_key_pem = std::string ((char *) optval_, optvallen_);
...@@ -804,7 +805,7 @@ int zmq::options_t::setsockopt (int option_, ...@@ -804,7 +805,7 @@ int zmq::options_t::setsockopt (int option_,
case ZMQ_WSS_TRUST_SYSTEM: case ZMQ_WSS_TRUST_SYSTEM:
return do_setsockopt_int_as_bool_strict (optval_, optvallen_, return do_setsockopt_int_as_bool_strict (optval_, optvallen_,
&wss_trust_system); &wss_trust_system);
#endif
#endif #endif
default: default:
......
...@@ -114,15 +114,20 @@ zmq::session_base_t::session_base_t (class io_thread_t *io_thread_, ...@@ -114,15 +114,20 @@ zmq::session_base_t::session_base_t (class io_thread_t *io_thread_,
_socket (socket_), _socket (socket_),
_io_thread (io_thread_), _io_thread (io_thread_),
_has_linger_timer (false), _has_linger_timer (false),
_addr (addr_), _addr (addr_)
#ifdef ZMQ_HAVE_WSS
,
_wss_hostname (NULL) _wss_hostname (NULL)
#endif
{ {
#ifdef ZMQ_HAVE_WSS
if (options_.wss_hostname.length () > 0) { if (options_.wss_hostname.length () > 0) {
_wss_hostname = _wss_hostname =
static_cast<char *> (malloc (options_.wss_hostname.length () + 1)); static_cast<char *> (malloc (options_.wss_hostname.length () + 1));
assert (_wss_hostname); assert (_wss_hostname);
strcpy (_wss_hostname, options_.wss_hostname.c_str ()); strcpy (_wss_hostname, options_.wss_hostname.c_str ());
} }
#endif
} }
const zmq::endpoint_uri_pair_t &zmq::session_base_t::get_endpoint () const const zmq::endpoint_uri_pair_t &zmq::session_base_t::get_endpoint () const
...@@ -145,8 +150,10 @@ zmq::session_base_t::~session_base_t () ...@@ -145,8 +150,10 @@ zmq::session_base_t::~session_base_t ()
if (_engine) if (_engine)
_engine->terminate (); _engine->terminate ();
#ifdef ZMQ_HAVE_WSS
if (_wss_hostname) if (_wss_hostname)
free (_wss_hostname); free (_wss_hostname);
#endif
LIBZMQ_DELETE (_addr); LIBZMQ_DELETE (_addr);
} }
......
...@@ -192,9 +192,11 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events ...@@ -192,9 +192,11 @@ class session_base_t : public own_t, public io_object_t, public i_pipe_events
// Protocol and address to use when connecting. // Protocol and address to use when connecting.
address_t *_addr; address_t *_addr;
#ifdef ZMQ_HAVE_WSS
// TLS handshake, we need to take a copy when the session is created, // TLS handshake, we need to take a copy when the session is created,
// in order to maintain the value at the creation time // in order to maintain the value at the creation time
char *_wss_hostname; char *_wss_hostname;
#endif
ZMQ_NON_COPYABLE_NOR_MOVABLE (session_base_t) ZMQ_NON_COPYABLE_NOR_MOVABLE (session_base_t)
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment