Skip to content

Commit

Permalink
Fix fdb auth crash on old sqlquery
Browse files Browse the repository at this point in the history
Signed-off-by: mohitkhullar <mkhullar1@bloomberg.net>
  • Loading branch information
mohitkhullar committed Dec 3, 2024
1 parent 3a415b2 commit 334d6ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/db_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ static int check_user_password(struct sqlclntstate *clnt)
int password_rc = 0;
int valid_user;

clnt->authdata = get_authdata(clnt);
if ((gbl_uses_externalauth || gbl_uses_externalauth_connect) &&
(externalComdb2AuthenticateUserMakeRequest || debug_switch_ignore_null_auth_func()) &&
!clnt->admin && !clnt->current_user.bypass_auth) {
clnt->authdata = get_authdata(clnt);
if (!clnt->authdata && clnt->secure && !gbl_allow_anon_id_for_spmux)
return reject_anon_id(clnt);
if (gbl_externalauth_warn && !clnt->authdata) {
Expand Down
4 changes: 4 additions & 0 deletions plugins/remsql/fdb_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3298,6 +3298,8 @@ int fdb_send_2pc_begin(struct sqlclntstate *clnt, fdb_msg_t *msg, fdb_tran_t *tr
msg->tv.coordinator_tier = coordinator_tier;
msg->tv.timestamp = timestamp;

clnt->authdata = get_authdata(clnt);

if (clnt->authdata && fdb_auth_enabled() && externalComdb2SerializeIdentity) {
rc = externalComdb2SerializeIdentity(clnt->authdata, &msg->tv.authdtalen, &msg->tv.authdta);
if (rc) {
Expand Down Expand Up @@ -3341,6 +3343,8 @@ int fdb_send_begin(struct sqlclntstate *clnt, fdb_msg_t *msg, fdb_tran_t *trans,
msg->tr.flags = flags;
msg->tr.seq = 0; /* the beginnings: there was a zero */

clnt->authdata = get_authdata(clnt);

if (clnt->authdata && fdb_auth_enabled() && externalComdb2SerializeIdentity) {
rc = externalComdb2SerializeIdentity(clnt->authdata, &msg->tr.authdtalen, &msg->tr.authdta);
if (rc) {
Expand Down

0 comments on commit 334d6ff

Please sign in to comment.