Skip to content

Commit 028b33f

Browse files
committed
gssapi: fail if client sets wrong principal
Problem: if client sets ZMQ_GSSAPI_PRINCIPAL to a name for which credentials cannot be obtained, authentication proceeds with default credentials. Check whether an error occurred acquiring credentials before proceding to initialize the security context. Fixes zeromq#2531
1 parent 92a4989 commit 028b33f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/gssapi_client.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ zmq::mechanism_t::status_t zmq::gssapi_client_t::status () const
166166

167167
int zmq::gssapi_client_t::initialize_context ()
168168
{
169+
// principal was specified but credentials could not be acquired
170+
if (principal_name != NULL && cred == NULL)
171+
return -1;
172+
169173
// First time through, import service_name into target_name
170174
if (target_name == GSS_C_NO_NAME) {
171175
send_tok.value = service_name;

0 commit comments

Comments
 (0)