Commit 2e1645a5 authored by Chris Busbey's avatar Chris Busbey

principle->principal

parent 87834dd6
...@@ -297,8 +297,8 @@ ZMQ_EXPORT char *zmq_msg_gets (zmq_msg_t *msg, char *property); ...@@ -297,8 +297,8 @@ ZMQ_EXPORT char *zmq_msg_gets (zmq_msg_t *msg, char *property);
#define ZMQ_IPC_FILTER_GID 60 #define ZMQ_IPC_FILTER_GID 60
#define ZMQ_CONNECT_RID 61 #define ZMQ_CONNECT_RID 61
#define ZMQ_GSSAPI_SERVER 62 #define ZMQ_GSSAPI_SERVER 62
#define ZMQ_GSSAPI_PRINCIPLE 63 #define ZMQ_GSSAPI_PRINCIPAL 63
#define ZMQ_GSSAPI_SERVICE_PRINCIPLE 64 #define ZMQ_GSSAPI_SERVICE_PRINCIPAL 64
/* Message options */ /* Message options */
#define ZMQ_MORE 1 #define ZMQ_MORE 1
......
...@@ -38,20 +38,20 @@ zmq::gssapi_client_t::gssapi_client_t (const options_t &options_) : ...@@ -38,20 +38,20 @@ zmq::gssapi_client_t::gssapi_client_t (const options_t &options_) :
mechs (), mechs (),
security_context_established (false) security_context_established (false)
{ {
const std::string::size_type service_size = options_.gss_service_principle.size(); const std::string::size_type service_size = options_.gss_service_principal.size();
service_name = static_cast <char *>(malloc(service_size+1)); service_name = static_cast <char *>(malloc(service_size+1));
assert(service_name); assert(service_name);
memcpy(service_name, options_.gss_service_principle.c_str(), service_size+1 ); memcpy(service_name, options_.gss_service_principal.c_str(), service_size+1 );
maj_stat = GSS_S_COMPLETE; maj_stat = GSS_S_COMPLETE;
if(!options_.gss_principle.empty()) if(!options_.gss_principal.empty())
{ {
const std::string::size_type principle_size = options_.gss_principle.size(); const std::string::size_type principal_size = options_.gss_principal.size();
principle_name = static_cast <char *>(malloc(principle_size+1)); principal_name = static_cast <char *>(malloc(principal_size+1));
assert(principle_name); assert(principal_name);
memcpy(principle_name, options_.gss_principle.c_str(), principle_size+1 ); memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
if (acquire_credentials (principle_name, &cred) != 0) if (acquire_credentials (principal_name, &cred) != 0)
maj_stat = GSS_S_FAILURE; maj_stat = GSS_S_FAILURE;
} }
......
...@@ -53,7 +53,7 @@ namespace zmq ...@@ -53,7 +53,7 @@ namespace zmq
connected connected
}; };
// Human-readable principle name of the service we are connecting to // Human-readable principal name of the service we are connecting to
char * service_name; char * service_name;
// Current FSM state // Current FSM state
......
...@@ -37,7 +37,7 @@ zmq::gssapi_mechanism_base_t::gssapi_mechanism_base_t (const options_t & options ...@@ -37,7 +37,7 @@ zmq::gssapi_mechanism_base_t::gssapi_mechanism_base_t (const options_t & options
recv_tok (), recv_tok (),
/// FIXME remove? in_buf (), /// FIXME remove? in_buf (),
target_name (GSS_C_NO_NAME), target_name (GSS_C_NO_NAME),
principle_name (NULL), principal_name (NULL),
maj_stat (GSS_S_COMPLETE), maj_stat (GSS_S_COMPLETE),
min_stat (0), min_stat (0),
init_sec_min_stat (0), init_sec_min_stat (0),
......
...@@ -67,7 +67,7 @@ namespace zmq ...@@ -67,7 +67,7 @@ namespace zmq
// Acquire security context credentials from the // Acquire security context credentials from the
// underlying mechanism. // underlying mechanism.
static int acquire_credentials (char * principle_name_, static int acquire_credentials (char * principal_name_,
gss_cred_id_t * cred_); gss_cred_id_t * cred_);
protected: protected:
...@@ -77,11 +77,11 @@ namespace zmq ...@@ -77,11 +77,11 @@ namespace zmq
// Opaque GSSAPI token for incoming data // Opaque GSSAPI token for incoming data
gss_buffer_desc recv_tok; gss_buffer_desc recv_tok;
// Opaque GSSAPI representation of principle // Opaque GSSAPI representation of principal
gss_name_t target_name; gss_name_t target_name;
// Human-readable principal name // Human-readable principal name
char * principle_name; char * principal_name;
// Status code returned by GSSAPI functions // Status code returned by GSSAPI functions
OM_uint32 maj_stat; OM_uint32 maj_stat;
......
...@@ -44,14 +44,14 @@ zmq::gssapi_server_t::gssapi_server_t (session_base_t *session_, ...@@ -44,14 +44,14 @@ zmq::gssapi_server_t::gssapi_server_t (session_base_t *session_,
security_context_established (false) security_context_established (false)
{ {
maj_stat = GSS_S_CONTINUE_NEEDED; maj_stat = GSS_S_CONTINUE_NEEDED;
if(!options_.gss_principle.empty()) if(!options_.gss_principal.empty())
{ {
const std::string::size_type principle_size = options_.gss_principle.size(); const std::string::size_type principal_size = options_.gss_principal.size();
principle_name = static_cast <char *>(malloc(principle_size+1)); principal_name = static_cast <char *>(malloc(principal_size+1));
assert(principle_name); assert(principal_name);
memcpy(principle_name, options_.gss_principle.c_str(), principle_size+1 ); memcpy(principal_name, options_.gss_principal.c_str(), principal_size+1 );
if (acquire_credentials (principle_name, &cred) != 0) if (acquire_credentials (principal_name, &cred) != 0)
maj_stat = GSS_S_FAILURE; maj_stat = GSS_S_FAILURE;
} }
} }
...@@ -199,16 +199,16 @@ void zmq::gssapi_server_t::send_zap_request () ...@@ -199,16 +199,16 @@ void zmq::gssapi_server_t::send_zap_request ()
rc = session->write_zap_msg (&msg); rc = session->write_zap_msg (&msg);
errno_assert (rc == 0); errno_assert (rc == 0);
//Principle frame // Principal frame
gss_buffer_desc principle; gss_buffer_desc principal;
gss_display_name(&min_stat, target_name, &principle, NULL); gss_display_name(&min_stat, target_name, &principal, NULL);
rc = msg.init_size (principle.length); rc = msg.init_size (principal.length);
errno_assert (rc == 0); errno_assert (rc == 0);
memcpy (msg.data (), principle.value, principle.length); memcpy (msg.data (), principal.value, principal.length);
rc = session->write_zap_msg (&msg); rc = session->write_zap_msg (&msg);
errno_assert (rc == 0); errno_assert (rc == 0);
gss_release_buffer(&min_stat, &principle); gss_release_buffer(&min_stat, &principal);
} }
int zmq::gssapi_server_t::receive_and_process_zap_reply () int zmq::gssapi_server_t::receive_and_process_zap_reply ()
......
...@@ -410,17 +410,17 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -410,17 +410,17 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
} }
break; break;
case ZMQ_GSSAPI_PRINCIPLE: case ZMQ_GSSAPI_PRINCIPAL:
if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) { if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
gss_principle.assign ((const char *) optval_, optvallen_); gss_principal.assign ((const char *) optval_, optvallen_);
mechanism = ZMQ_GSSAPI; mechanism = ZMQ_GSSAPI;
return 0; return 0;
} }
break; break;
case ZMQ_GSSAPI_SERVICE_PRINCIPLE: case ZMQ_GSSAPI_SERVICE_PRINCIPAL:
if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) { if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
gss_service_principle.assign ((const char *) optval_, optvallen_); gss_service_principal.assign ((const char *) optval_, optvallen_);
mechanism = ZMQ_GSSAPI; mechanism = ZMQ_GSSAPI;
as_server = 0; as_server = 0;
return 0; return 0;
...@@ -714,18 +714,18 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) ...@@ -714,18 +714,18 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
} }
break; break;
case ZMQ_GSSAPI_PRINCIPLE: case ZMQ_GSSAPI_PRINCIPAL:
if (*optvallen_ >= gss_principle.size () + 1) { if (*optvallen_ >= gss_principal.size () + 1) {
memcpy (optval_, gss_principle.c_str (), gss_principle.size () + 1); memcpy (optval_, gss_principal.c_str (), gss_principal.size () + 1);
*optvallen_ = gss_principle.size () + 1; *optvallen_ = gss_principal.size () + 1;
return 0; return 0;
} }
break; break;
case ZMQ_GSSAPI_SERVICE_PRINCIPLE: case ZMQ_GSSAPI_SERVICE_PRINCIPAL:
if (*optvallen_ >= gss_service_principle.size () + 1) { if (*optvallen_ >= gss_service_principal.size () + 1) {
memcpy (optval_, gss_service_principle.c_str (), gss_service_principle.size () + 1); memcpy (optval_, gss_service_principal.c_str (), gss_service_principal.size () + 1);
*optvallen_ = gss_service_principle.size () + 1; *optvallen_ = gss_service_principal.size () + 1;
return 0; return 0;
} }
break; break;
......
...@@ -156,9 +156,9 @@ namespace zmq ...@@ -156,9 +156,9 @@ namespace zmq
uint8_t curve_secret_key [CURVE_KEYSIZE]; uint8_t curve_secret_key [CURVE_KEYSIZE];
uint8_t curve_server_key [CURVE_KEYSIZE]; uint8_t curve_server_key [CURVE_KEYSIZE];
// Principles for GSSAPI mechanism // Principals for GSSAPI mechanism
std::string gss_principle; std::string gss_principal;
std::string gss_service_principle; std::string gss_service_principal;
// ID of the socket. // ID of the socket.
int socket_id; int socket_id;
......
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