mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-29 12:18:04 +01:00
gssapi: drop unnecessary ifdefs
Problem: GSSAPI DRAFT code was made conditional on ZMQ_BUILD_DRAFT_API, but zmq_draft.h duplicates the DRAFT symbols definitions from zmq.h so this is unnecessary. Solution: drop the extra ifdefs
This commit is contained in:
@@ -52,11 +52,7 @@ zmq::gssapi_client_t::gssapi_client_t (const options_t &options_) :
|
|||||||
assert(service_name);
|
assert(service_name);
|
||||||
memcpy(service_name, options_.gss_service_principal.c_str(), service_size+1 );
|
memcpy(service_name, options_.gss_service_principal.c_str(), service_size+1 );
|
||||||
|
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
service_name_type = convert_nametype (options_.gss_service_principal_nt);
|
service_name_type = convert_nametype (options_.gss_service_principal_nt);
|
||||||
#else
|
|
||||||
service_name_type = GSS_C_NT_HOSTBASED_SERVICE;
|
|
||||||
#endif
|
|
||||||
maj_stat = GSS_S_COMPLETE;
|
maj_stat = GSS_S_COMPLETE;
|
||||||
if(!options_.gss_principal.empty())
|
if(!options_.gss_principal.empty())
|
||||||
{
|
{
|
||||||
@@ -65,11 +61,7 @@ zmq::gssapi_client_t::gssapi_client_t (const options_t &options_) :
|
|||||||
assert(principal_name);
|
assert(principal_name);
|
||||||
memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
|
memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
|
||||||
|
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
gss_OID name_type = convert_nametype (options_.gss_principal_nt);
|
gss_OID name_type = convert_nametype (options_.gss_principal_nt);
|
||||||
#else
|
|
||||||
gss_OID name_type = GSS_C_NT_HOSTBASED_SERVICE;
|
|
||||||
#endif
|
|
||||||
if (acquire_credentials (principal_name, &cred, name_type) != 0)
|
if (acquire_credentials (principal_name, &cred, name_type) != 0)
|
||||||
maj_stat = GSS_S_FAILURE;
|
maj_stat = GSS_S_FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ int zmq::gssapi_mechanism_base_t::process_ready (msg_t *msg_)
|
|||||||
}
|
}
|
||||||
const gss_OID zmq::gssapi_mechanism_base_t::convert_nametype (int zmq_nametype)
|
const gss_OID zmq::gssapi_mechanism_base_t::convert_nametype (int zmq_nametype)
|
||||||
{
|
{
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
switch (zmq_nametype) {
|
switch (zmq_nametype) {
|
||||||
case ZMQ_GSSAPI_NT_HOSTBASED:
|
case ZMQ_GSSAPI_NT_HOSTBASED:
|
||||||
return GSS_C_NT_HOSTBASED_SERVICE;
|
return GSS_C_NT_HOSTBASED_SERVICE;
|
||||||
@@ -335,7 +334,6 @@ const gss_OID zmq::gssapi_mechanism_base_t::convert_nametype (int zmq_nametype)
|
|||||||
return GSS_C_NT_USER_NAME;
|
return GSS_C_NT_USER_NAME;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,11 +58,7 @@ zmq::gssapi_server_t::gssapi_server_t (session_base_t *session_,
|
|||||||
principal_name = static_cast <char *>(malloc(principal_size+1));
|
principal_name = static_cast <char *>(malloc(principal_size+1));
|
||||||
assert(principal_name);
|
assert(principal_name);
|
||||||
memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
|
memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
gss_OID name_type = convert_nametype (options_.gss_principal_nt);
|
gss_OID name_type = convert_nametype (options_.gss_principal_nt);
|
||||||
#else
|
|
||||||
gss_OID name_type = GSS_C_NT_HOSTBASED_SERVICE;
|
|
||||||
#endif
|
|
||||||
if (acquire_credentials (principal_name, &cred, name_type) != 0)
|
if (acquire_credentials (principal_name, &cred, name_type) != 0)
|
||||||
maj_stat = GSS_S_FAILURE;
|
maj_stat = GSS_S_FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,10 +69,8 @@ zmq::options_t::options_t () :
|
|||||||
tcp_keepalive_intvl (-1),
|
tcp_keepalive_intvl (-1),
|
||||||
mechanism (ZMQ_NULL),
|
mechanism (ZMQ_NULL),
|
||||||
as_server (0),
|
as_server (0),
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
gss_principal_nt (ZMQ_GSSAPI_NT_HOSTBASED),
|
gss_principal_nt (ZMQ_GSSAPI_NT_HOSTBASED),
|
||||||
gss_service_principal_nt (ZMQ_GSSAPI_NT_HOSTBASED),
|
gss_service_principal_nt (ZMQ_GSSAPI_NT_HOSTBASED),
|
||||||
#endif
|
|
||||||
gss_plaintext (false),
|
gss_plaintext (false),
|
||||||
socket_id (0),
|
socket_id (0),
|
||||||
conflate (false),
|
conflate (false),
|
||||||
@@ -513,7 +511,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
case ZMQ_GSSAPI_PRINCIPAL_NAMETYPE:
|
case ZMQ_GSSAPI_PRINCIPAL_NAMETYPE:
|
||||||
if (is_int && (value == ZMQ_GSSAPI_NT_HOSTBASED
|
if (is_int && (value == ZMQ_GSSAPI_NT_HOSTBASED
|
||||||
|| value == ZMQ_GSSAPI_NT_USER_NAME
|
|| value == ZMQ_GSSAPI_NT_USER_NAME
|
||||||
@@ -522,6 +520,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE:
|
case ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE:
|
||||||
if (is_int && (value == ZMQ_GSSAPI_NT_HOSTBASED
|
if (is_int && (value == ZMQ_GSSAPI_NT_HOSTBASED
|
||||||
|| value == ZMQ_GSSAPI_NT_USER_NAME
|
|| value == ZMQ_GSSAPI_NT_USER_NAME
|
||||||
@@ -530,7 +529,6 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ZMQ_HANDSHAKE_IVL:
|
case ZMQ_HANDSHAKE_IVL:
|
||||||
@@ -965,7 +963,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
case ZMQ_GSSAPI_PRINCIPAL_NAMETYPE:
|
case ZMQ_GSSAPI_PRINCIPAL_NAMETYPE:
|
||||||
if (is_int) {
|
if (is_int) {
|
||||||
*value = gss_principal_nt;
|
*value = gss_principal_nt;
|
||||||
@@ -978,7 +976,6 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case ZMQ_HANDSHAKE_IVL:
|
case ZMQ_HANDSHAKE_IVL:
|
||||||
|
|||||||
@@ -198,11 +198,11 @@ namespace zmq
|
|||||||
// Principals for GSSAPI mechanism
|
// Principals for GSSAPI mechanism
|
||||||
std::string gss_principal;
|
std::string gss_principal;
|
||||||
std::string gss_service_principal;
|
std::string gss_service_principal;
|
||||||
#ifdef ZMQ_BUILD_DRAFT_API
|
|
||||||
// Name types GSSAPI principals
|
// Name types GSSAPI principals
|
||||||
int gss_principal_nt;
|
int gss_principal_nt;
|
||||||
int gss_service_principal_nt;
|
int gss_service_principal_nt;
|
||||||
#endif
|
|
||||||
// If true, gss encryption will be disabled
|
// If true, gss encryption will be disabled
|
||||||
bool gss_plaintext;
|
bool gss_plaintext;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user