Skip to content

Commit b604ade

Browse files
committed
WL#15524 Patch #1 "START TLS" for management API
Post push fix. Do not allow ndb_mgm_listen_event to return a socket that uses TLS since user can not access the corresponding SSL object thorugh the public MgmAPI. Change-Id: I2a741efe4f80db750419101ecabb03fb5e025346
1 parent d3aea14 commit b604ade

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

storage/ndb/src/mgmapi/mgmapi.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,7 +2464,7 @@ ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int nodeId,
24642464

24652465
int
24662466
ndb_mgm_listen_event_internal(NdbMgmHandle handle, const int filter[],
2467-
int parsable, ndb_socket_t* sock)
2467+
int parsable, ndb_socket_t* sock, bool allow_tls)
24682468
{
24692469
DBUG_ENTER("ndb_mgm_listen_event_internal");
24702470
CHECK_HANDLE(handle, -1);
@@ -2561,7 +2561,7 @@ ndb_mgm_listen_event_internal(NdbMgmHandle handle, const int filter[],
25612561
ndb_mgm::handle_ptr tmp_handle(ndb_mgm_create_handle());
25622562
tmp_handle->socket.init_from_new(sockfd);
25632563

2564-
if(handle->ssl_ctx)
2564+
if(allow_tls && handle->ssl_ctx)
25652565
{
25662566
ndb_mgm_set_ssl_ctx(tmp_handle.get(), handle->ssl_ctx);
25672567
ndb_mgm_start_tls(tmp_handle.get());
@@ -2588,7 +2588,8 @@ socket_t
25882588
ndb_mgm_listen_event(NdbMgmHandle handle, const int filter[])
25892589
{
25902590
ndb_socket_t s;
2591-
if(ndb_mgm_listen_event_internal(handle,filter,0,&s)<0)
2591+
constexpr bool no_tls = false;
2592+
if(ndb_mgm_listen_event_internal(handle, filter, 0, &s, no_tls)<0)
25922593
ndb_socket_invalidate(&s);
25932594
return ndb_socket_get_native(s);
25942595
}

storage/ndb/src/mgmapi/mgmapi_internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,7 @@ ndb_mgm_get_configuration2(NdbMgmHandle handle,
119119
enum ndb_mgm_node_type nodetype,
120120
int from_node = 0);
121121

122+
int ndb_mgm_listen_event_internal(NdbMgmHandle, const int filter[], int,
123+
ndb_socket_t*, bool allow_tls);
124+
122125
#endif

storage/ndb/src/mgmapi/ndb_logevent.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535

3636
#include "ndb_logevent.hpp"
3737

38-
extern
39-
int ndb_mgm_listen_event_internal(NdbMgmHandle, const int filter[],
40-
int, ndb_socket_t*);
41-
4238
struct ndb_logevent_error_msg {
4339
enum ndb_logevent_handle_error code;
4440
const char *msg;
@@ -87,7 +83,8 @@ ndb_mgm_create_logevent_handle(NdbMgmHandle mh,
8783
return nullptr;
8884

8985
ndb_socket_t sock;
90-
if(ndb_mgm_listen_event_internal(mh, filter, 1, &sock) < 0)
86+
constexpr bool allow_tls = true;
87+
if(ndb_mgm_listen_event_internal(mh, filter, 1, &sock, allow_tls) < 0)
9188
{
9289
free(h);
9390
return nullptr;

0 commit comments

Comments
 (0)