mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 07:56:09 +00:00
fixed up comments from pr
This commit is contained in:
parent
5441db3d7d
commit
87834dd63f
@ -39,9 +39,22 @@ zmq::gssapi_client_t::gssapi_client_t (const options_t &options_) :
|
|||||||
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_principle.size();
|
||||||
service_name = new char[service_size+1];
|
service_name = static_cast <char *>(malloc(service_size+1));
|
||||||
|
assert(service_name);
|
||||||
memcpy(service_name, options_.gss_service_principle.c_str(), service_size+1 );
|
memcpy(service_name, options_.gss_service_principle.c_str(), service_size+1 );
|
||||||
|
|
||||||
|
maj_stat = GSS_S_COMPLETE;
|
||||||
|
if(!options_.gss_principle.empty())
|
||||||
|
{
|
||||||
|
const std::string::size_type principle_size = options_.gss_principle.size();
|
||||||
|
principle_name = static_cast <char *>(malloc(principle_size+1));
|
||||||
|
assert(principle_name);
|
||||||
|
memcpy(principle_name, options_.gss_principle.c_str(), principle_size+1 );
|
||||||
|
|
||||||
|
if (acquire_credentials (principle_name, &cred) != 0)
|
||||||
|
maj_stat = GSS_S_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
mechs.elements = NULL;
|
mechs.elements = NULL;
|
||||||
mechs.count = 0;
|
mechs.count = 0;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ zmq::gssapi_mechanism_base_t::gssapi_mechanism_base_t (const options_t & options
|
|||||||
/// FIXME remove? in_buf (),
|
/// FIXME remove? in_buf (),
|
||||||
target_name (GSS_C_NO_NAME),
|
target_name (GSS_C_NO_NAME),
|
||||||
principle_name (NULL),
|
principle_name (NULL),
|
||||||
maj_stat (GSS_S_CONTINUE_NEEDED),
|
maj_stat (GSS_S_COMPLETE),
|
||||||
min_stat (0),
|
min_stat (0),
|
||||||
init_sec_min_stat (0),
|
init_sec_min_stat (0),
|
||||||
ret_flags (0),
|
ret_flags (0),
|
||||||
@ -46,15 +46,6 @@ zmq::gssapi_mechanism_base_t::gssapi_mechanism_base_t (const options_t & options
|
|||||||
cred (GSS_C_NO_CREDENTIAL),
|
cred (GSS_C_NO_CREDENTIAL),
|
||||||
context (GSS_C_NO_CONTEXT)
|
context (GSS_C_NO_CONTEXT)
|
||||||
{
|
{
|
||||||
if(!options_.gss_principle.empty())
|
|
||||||
{
|
|
||||||
const std::string::size_type principle_size = options_.gss_principle.size();
|
|
||||||
principle_name = new char[principle_size+1];
|
|
||||||
memcpy(principle_name, options_.gss_principle.c_str(), principle_size+1 );
|
|
||||||
|
|
||||||
if (acquire_credentials (principle_name, &cred) != 0)
|
|
||||||
maj_stat = GSS_S_FAILURE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::gssapi_mechanism_base_t::~gssapi_mechanism_base_t ()
|
zmq::gssapi_mechanism_base_t::~gssapi_mechanism_base_t ()
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
#include "windows.hpp"
|
#include "windows.hpp"
|
||||||
@ -42,12 +43,26 @@ zmq::gssapi_server_t::gssapi_server_t (session_base_t *session_,
|
|||||||
state (recv_next_token),
|
state (recv_next_token),
|
||||||
security_context_established (false)
|
security_context_established (false)
|
||||||
{
|
{
|
||||||
|
maj_stat = GSS_S_CONTINUE_NEEDED;
|
||||||
|
if(!options_.gss_principle.empty())
|
||||||
|
{
|
||||||
|
const std::string::size_type principle_size = options_.gss_principle.size();
|
||||||
|
principle_name = static_cast <char *>(malloc(principle_size+1));
|
||||||
|
assert(principle_name);
|
||||||
|
memcpy(principle_name, options_.gss_principle.c_str(), principle_size+1 );
|
||||||
|
|
||||||
|
if (acquire_credentials (principle_name, &cred) != 0)
|
||||||
|
maj_stat = GSS_S_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::gssapi_server_t::~gssapi_server_t ()
|
zmq::gssapi_server_t::~gssapi_server_t ()
|
||||||
{
|
{
|
||||||
if(cred)
|
if(cred)
|
||||||
gss_release_cred(&min_stat, &cred);
|
gss_release_cred(&min_stat, &cred);
|
||||||
|
|
||||||
|
if(target_name)
|
||||||
|
gss_release_name(&min_stat, &target_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zmq::gssapi_server_t::next_handshake_command (msg_t *msg_)
|
int zmq::gssapi_server_t::next_handshake_command (msg_t *msg_)
|
||||||
@ -72,7 +87,6 @@ int zmq::gssapi_server_t::next_handshake_command (msg_t *msg_)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (maj_stat == GSS_S_COMPLETE) {
|
if (maj_stat == GSS_S_COMPLETE) {
|
||||||
gss_release_name(&min_stat, &target_name);
|
|
||||||
security_context_established = true;
|
security_context_established = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
|||||||
if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
|
if (optvallen_ > 0 && optvallen_ < 256 && optval_ != NULL) {
|
||||||
gss_service_principle.assign ((const char *) optval_, optvallen_);
|
gss_service_principle.assign ((const char *) optval_, optvallen_);
|
||||||
mechanism = ZMQ_GSSAPI;
|
mechanism = ZMQ_GSSAPI;
|
||||||
as_server = 1;
|
as_server = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user