Commit 27547bc9 authored by Pieter Hintjens's avatar Pieter Hintjens

Problem: when libgssapi isn't available, GSSAPI options 'seem' to work

Solution: use same approach as for libsodium/CURVE, i.e. return EINVAL
if the library isn't present when libzmq builds, and the application
still tries to use these options in zmq_getsockopt/setsockopt.
parent 1beb54ce
......@@ -403,7 +403,9 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0;
}
break;
// If libgssapi isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBGSSAPI_KRB5
case ZMQ_GSSAPI_SERVER:
if (is_int && (value == 0 || value == 1)) {
as_server = value;
......@@ -411,7 +413,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0;
}
break;
case ZMQ_GSSAPI_PRINCIPAL:
if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
gss_principal.assign ((const char *) optval_, optvallen_);
......@@ -435,7 +437,8 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0;
}
break;
# endif
case ZMQ_HANDSHAKE_IVL:
if (is_int && value >= 0) {
handshake_ivl = value;
......@@ -741,6 +744,8 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
}
break;
// If libgssapi isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBGSSAPI_KRB5
case ZMQ_GSSAPI_SERVER:
if (is_int) {
*value = as_server && mechanism == ZMQ_GSSAPI;
......@@ -770,7 +775,8 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
return 0;
}
break;
#endif
case ZMQ_HANDSHAKE_IVL:
if (is_int) {
*value = handshake_ivl;
......
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