Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
abcb2243
Commit
abcb2243
authored
Sep 27, 2013
by
Mike Gatny
Committed by
Chris Busbey
Apr 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stubbed in TOKEN command
parent
4b1c851d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
3 deletions
+69
-3
gssapi_mechanism.cpp
src/gssapi_mechanism.cpp
+62
-2
gssapi_mechanism.hpp
src/gssapi_mechanism.hpp
+7
-1
No files found.
src/gssapi_mechanism.cpp
View file @
abcb2243
...
...
@@ -38,6 +38,7 @@ zmq::gssapi_mechanism_t::gssapi_mechanism_t (session_base_t *session_,
session
(
session_
),
peer_address
(
peer_address_
),
expecting_zap_reply
(
false
),
expecting_another_token
(
true
),
state
(
options
.
as_server
?
waiting_for_hello
:
sending_hello
)
{
}
...
...
@@ -64,7 +65,12 @@ int zmq::gssapi_mechanism_t::next_handshake_command (msg_t *msg_)
case
sending_initiate
:
rc
=
produce_initiate
(
msg_
);
if
(
rc
==
0
)
state
=
waiting_for_ready
;
state
=
waiting_for_token
;
break
;
case
sending_token
:
rc
=
produce_token
(
msg_
);
if
(
rc
==
0
)
state
=
waiting_for_ready
;
//state = expecting_another_token? waiting_for_token: waiting_for_ready;
break
;
case
sending_ready
:
rc
=
produce_ready
(
msg_
);
...
...
@@ -96,7 +102,12 @@ int zmq::gssapi_mechanism_t::process_handshake_command (msg_t *msg_)
case
waiting_for_initiate
:
rc
=
process_initiate
(
msg_
);
if
(
rc
==
0
)
state
=
sending_ready
;
state
=
sending_token
;
break
;
case
waiting_for_token
:
rc
=
process_token
(
msg_
);
if
(
rc
==
0
)
state
=
sending_ready
;
// state = expecting_another_token? sending_token: sending_ready;
break
;
case
waiting_for_ready
:
rc
=
process_ready
(
msg_
);
...
...
@@ -291,6 +302,55 @@ int zmq::gssapi_mechanism_t::process_initiate (msg_t *msg_)
return
parse_metadata
(
ptr
,
bytes_left
);
}
int
zmq
::
gssapi_mechanism_t
::
produce_token
(
msg_t
*
msg_
)
const
{
unsigned
char
*
const
command_buffer
=
(
unsigned
char
*
)
malloc
(
512
);
alloc_assert
(
command_buffer
);
unsigned
char
*
ptr
=
command_buffer
;
// Add command name
memcpy
(
ptr
,
"
\x05
TOKEN"
,
6
);
ptr
+=
6
;
// Add socket type property
const
char
*
socket_type
=
socket_type_string
(
options
.
type
);
ptr
+=
add_property
(
ptr
,
"Socket-Type"
,
socket_type
,
strlen
(
socket_type
));
// Add identity property
if
(
options
.
type
==
ZMQ_REQ
||
options
.
type
==
ZMQ_DEALER
||
options
.
type
==
ZMQ_ROUTER
)
{
ptr
+=
add_property
(
ptr
,
"Identity"
,
options
.
identity
,
options
.
identity_size
);
}
const
size_t
command_size
=
ptr
-
command_buffer
;
const
int
rc
=
msg_
->
init_size
(
command_size
);
errno_assert
(
rc
==
0
);
memcpy
(
msg_
->
data
(),
command_buffer
,
command_size
);
free
(
command_buffer
);
return
0
;
}
int
zmq
::
gssapi_mechanism_t
::
process_token
(
msg_t
*
msg_
)
{
const
unsigned
char
*
ptr
=
static_cast
<
unsigned
char
*>
(
msg_
->
data
());
size_t
bytes_left
=
msg_
->
size
();
if
(
bytes_left
<
6
||
memcmp
(
ptr
,
"
\x05
TOKEN"
,
6
))
{
errno
=
EPROTO
;
return
-
1
;
}
ptr
+=
6
;
bytes_left
-=
6
;
expecting_another_token
=
false
;
return
parse_metadata
(
ptr
,
bytes_left
);
}
int
zmq
::
gssapi_mechanism_t
::
produce_ready
(
msg_t
*
msg_
)
const
{
unsigned
char
*
const
command_buffer
=
(
unsigned
char
*
)
malloc
(
512
);
...
...
src/gssapi_mechanism.hpp
View file @
abcb2243
...
...
@@ -53,6 +53,8 @@ namespace zmq
waiting_for_welcome
,
sending_initiate
,
waiting_for_initiate
,
sending_token
,
waiting_for_token
,
sending_ready
,
waiting_for_ready
,
waiting_for_zap_reply
,
...
...
@@ -65,18 +67,22 @@ namespace zmq
// True iff we are awaiting reply from ZAP reply.
bool
expecting_zap_reply
;
// True iff we are awaiting another GSS token.
bool
expecting_another_token
;
state_t
state
;
int
produce_hello
(
msg_t
*
msg_
)
const
;
int
produce_welcome
(
msg_t
*
msg_
)
const
;
int
produce_initiate
(
msg_t
*
msg_
)
const
;
int
produce_token
(
msg_t
*
msg_
)
const
;
int
produce_ready
(
msg_t
*
msg_
)
const
;
int
process_hello
(
msg_t
*
msg_
);
int
process_welcome
(
msg_t
*
msg
);
int
process_ready
(
msg_t
*
msg_
);
int
process_initiate
(
msg_t
*
msg_
);
int
process_token
(
msg_t
*
msg_
);
int
process_ready
(
msg_t
*
msg_
);
void
send_zap_request
(
const
std
::
string
&
username
,
const
std
::
string
&
password
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment