From daa18cae8d070815568e3f1e7a7809869fdb4923 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 12 Feb 2015 10:58:03 +0100 Subject: [PATCH] Ensure that any messages are being forwarded even on success packet --- src/sec-mod-auth.c | 4 ++++ src/worker-auth.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sec-mod-auth.c b/src/sec-mod-auth.c index 40cbb1a4..73465ddf 100644 --- a/src/sec-mod-auth.c +++ b/src/sec-mod-auth.c @@ -123,6 +123,10 @@ int send_sec_auth_reply(int cfd, sec_mod_st * sec, client_entry_st * entry, AUTH msg.user_name = entry->username; + if (entry->msg_str[0] != 0) { + msg.msg = entry->msg_str; + } + msg.has_sid = 1; msg.sid.data = entry->sid; msg.sid.len = sizeof(entry->sid); diff --git a/src/worker-auth.c b/src/worker-auth.c index 140ab67f..406520db 100644 --- a/src/worker-auth.c +++ b/src/worker-auth.c @@ -713,6 +713,8 @@ static int recv_auth_reply(worker_st * ws, int sd, char *txt, oclog(ws, LOG_DEBUG, "received auth reply message (value: %u)", (unsigned)msg->reply); + if (txt) txt[0] = 0; + switch (msg->reply) { case AUTH__REP__MSG: if (txt == NULL || msg->msg == NULL) { @@ -759,6 +761,9 @@ static int recv_auth_reply(worker_st * ws, int sd, char *txt, memcpy(ws->session_id, msg->dtls_session_id.data, msg->dtls_session_id.len); + if (msg->msg && txt) + strlcpy(txt, msg->msg, max_txt_size); + break; case AUTH__REP__FAILED: default: @@ -1323,7 +1328,6 @@ int post_auth_handler(worker_st * ws, unsigned http_ver) goto auth_fail; } - msg[0] = 0; ret = recv_auth_reply(ws, sd, msg, sizeof(msg)); if (sd != -1) { close(sd);