]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-auth-client: auth-master - Properly parse SPID sent from server
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 11 Mar 2018 19:34:20 +0000 (20:34 +0100)
committerStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 27 Aug 2025 11:35:32 +0000 (13:35 +0200)
This is currently not used though.

src/lib-auth-client/auth-master-private.h
src/lib-auth-client/auth-master.c

index 5ad539810ff056a55baf18b7fbb1df493d36060f..8520c33fb21cb15c81198b1740a5fa63fd457f47 100644 (file)
@@ -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;
index 958067540b840fa59774240b48d77bfeadd2d14d..a1adf56a9b87509f4111e236dc902409026452c2 100644 (file)
@@ -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