From ebe97d5514f94de0be193b68605ba80211b9d8e0 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Sun, 11 Mar 2018 20:34:20 +0100 Subject: [PATCH] lib-auth-client: auth-master - Properly parse SPID sent from server This is currently not used though. --- src/lib-auth-client/auth-master-private.h | 2 ++ src/lib-auth-client/auth-master.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lib-auth-client/auth-master-private.h b/src/lib-auth-client/auth-master-private.h index 5ad539810f..8520c33fb2 100644 --- a/src/lib-auth-client/auth-master-private.h +++ b/src/lib-auth-client/auth-master-private.h @@ -32,6 +32,8 @@ struct auth_master_connection { unsigned int timeout_msecs; + pid_t auth_server_pid; + bool connected:1; bool sent_handshake:1; bool aborted:1; diff --git a/src/lib-auth-client/auth-master.c b/src/lib-auth-client/auth-master.c index 958067540b..a1adf56a9b 100644 --- a/src/lib-auth-client/auth-master.c +++ b/src/lib-auth-client/auth-master.c @@ -195,10 +195,17 @@ auth_master_handshake_line(struct connection *_conn, const char *line) auth_request_lookup_abort(conn); return -1; } - } else if (strcmp(tmp[0], "SPID") == 0) { - return 1; + return 0; + } else if (strcmp(tmp[0], "SPID") != 0) { + return 0; } - return 0; + + if (str_to_pid(tmp[1], &conn->auth_server_pid) < 0) { + e_error(conn->event, + "Authentication server sent invalid SPID: %s", line); + return -1; + } + return 1; } static int -- 2.47.3