From: Stephan Bosch Date: Sun, 11 Mar 2018 19:34:20 +0000 (+0100) Subject: lib-auth-client: auth-master - Properly parse SPID sent from server X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ebe97d5514f94de0be193b68605ba80211b9d8e0;p=thirdparty%2Fdovecot%2Fcore.git lib-auth-client: auth-master - Properly parse SPID sent from server This is currently not used though. --- 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