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
f3884f33
Commit
f3884f33
authored
Aug 16, 2017
by
sigiesec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: gssapi_server_t duplicates zap_client_t::send_zap_request
Solution: Use zap_client_t::send_zap_request
parent
6e8a0b31
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
75 deletions
+9
-75
gssapi_server.cpp
src/gssapi_server.cpp
+6
-75
gssapi_server.hpp
src/gssapi_server.hpp
+3
-0
No files found.
src/gssapi_server.cpp
View file @
f3884f33
...
...
@@ -48,6 +48,7 @@ zmq::gssapi_server_t::gssapi_server_t (session_base_t *session_,
gssapi_mechanism_base_t
(
options_
),
session
(
session_
),
peer_address
(
peer_address_
),
zap_client
(
session
,
peer_address
,
options
),
state
(
recv_next_token
),
security_context_established
(
false
)
{
...
...
@@ -153,84 +154,14 @@ int zmq::gssapi_server_t::process_handshake_command (msg_t *msg_)
int
zmq
::
gssapi_server_t
::
send_zap_request
()
{
int
rc
;
msg_t
msg
;
// Address delimiter frame
rc
=
msg
.
init
();
errno_assert
(
rc
==
0
);
msg
.
set_flags
(
msg_t
::
more
);
rc
=
session
->
write_zap_msg
(
&
msg
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
// Version frame
rc
=
msg
.
init_size
(
3
);
errno_assert
(
rc
==
0
);
memcpy
(
msg
.
data
(),
"1.0"
,
3
);
msg
.
set_flags
(
msg_t
::
more
);
rc
=
session
->
write_zap_msg
(
&
msg
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
// Request ID frame
rc
=
msg
.
init_size
(
1
);
errno_assert
(
rc
==
0
);
memcpy
(
msg
.
data
(),
"1"
,
1
);
msg
.
set_flags
(
msg_t
::
more
);
rc
=
session
->
write_zap_msg
(
&
msg
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
// Domain frame
rc
=
msg
.
init_size
(
options
.
zap_domain
.
length
());
errno_assert
(
rc
==
0
);
memcpy
(
msg
.
data
(),
options
.
zap_domain
.
c_str
(),
options
.
zap_domain
.
length
());
msg
.
set_flags
(
msg_t
::
more
);
rc
=
session
->
write_zap_msg
(
&
msg
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
// Address frame
rc
=
msg
.
init_size
(
peer_address
.
length
());
errno_assert
(
rc
==
0
);
memcpy
(
msg
.
data
(),
peer_address
.
c_str
(),
peer_address
.
length
());
msg
.
set_flags
(
msg_t
::
more
);
rc
=
session
->
write_zap_msg
(
&
msg
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
// Identity frame
rc
=
msg
.
init_size
(
options
.
identity_size
);
errno_assert
(
rc
==
0
);
memcpy
(
msg
.
data
(),
options
.
identity
,
options
.
identity_size
);
msg
.
set_flags
(
msg_t
::
more
);
rc
=
session
->
write_zap_msg
(
&
msg
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
// Mechanism frame
rc
=
msg
.
init_size
(
6
);
errno_assert
(
rc
==
0
);
memcpy
(
msg
.
data
(),
"GSSAPI"
,
6
);
msg
.
set_flags
(
msg_t
::
more
);
rc
=
session
->
write_zap_msg
(
&
msg
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
// Principal frame
gss_buffer_desc
principal
;
gss_display_name
(
&
min_stat
,
target_name
,
&
principal
,
NULL
);
gss_display_name
(
&
min_stat
,
target_name
,
&
principal
,
NULL
);
int
rc
=
zap_client
.
send_zap_request
(
"GSSAPI"
,
6
,
principal
.
value
,
principal
.
length
);
rc
=
msg
.
init_size
(
principal
.
length
);
errno_assert
(
rc
==
0
);
memcpy
(
msg
.
data
(),
principal
.
value
,
principal
.
length
);
rc
=
session
->
write_zap_msg
(
&
msg
);
gss_release_buffer
(
&
min_stat
,
&
principal
);
if
(
rc
!=
0
)
return
close_and_return
(
&
msg
,
-
1
);
gss_release_buffer
(
&
min_stat
,
&
principal
);
return
0
;
return
rc
;
}
int
zmq
::
gssapi_server_t
::
receive_and_process_zap_reply
()
...
...
src/gssapi_server.hpp
View file @
f3884f33
...
...
@@ -33,6 +33,7 @@
#ifdef HAVE_LIBGSSAPI_KRB5
#include "gssapi_mechanism_base.hpp"
#include "zap_client.hpp"
namespace
zmq
{
...
...
@@ -73,6 +74,8 @@ namespace zmq
const
std
::
string
peer_address
;
zap_client_t
zap_client
;
// Current FSM state
state_t
state
;
...
...
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