]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: client protocol: Record minor version for authentication client connection.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 3 Jan 2018 18:26:33 +0000 (19:26 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 15 Jan 2018 11:25:13 +0000 (13:25 +0200)
src/auth/auth-client-connection.c
src/auth/auth-client-connection.h

index 702e507e7d026c2922527fcba46c82a19b7c4982..78293fd6b2b7f4b7ae95b1d6d28ee75e49d31b66 100644 (file)
@@ -269,16 +269,27 @@ static void auth_client_input(struct auth_client_connection *conn)
                        return;
 
                if (!conn->version_received) {
-                       /* make sure the major version matches */
+                       unsigned int vmajor, vminor;
+                       const char *p;
+
+                       /* split the version line */
                        if (strncmp(line, "VERSION\t", 8) != 0 ||
-                           !str_uint_equals(t_strcut(line + 8, '\t'),
-                                            AUTH_CLIENT_PROTOCOL_MAJOR_VERSION)) {
+                           str_parse_uint(line + 8, &vmajor, &p) < 0 ||
+                           *(p++) != '\t' || str_to_uint(p, &vminor) < 0) {
+                               i_error("Authentication client "
+                                       "sent invalid VERSION line: %s", line);
+                               auth_client_connection_destroy(&conn);
+                               return;
+                       }
+                       /* make sure the major version matches */
+                       if (vmajor != AUTH_MASTER_PROTOCOL_MAJOR_VERSION) {
                                i_error("Authentication client "
                                        "not compatible with this server "
                                        "(mixed old and new binaries?)");
                                auth_client_connection_destroy(&conn);
                                return;
                        }
+                       conn->version_minor = vminor;
                        conn->version_received = TRUE;
                        continue;
                }
index a42ec72415da26e281727e81acffab004dca4a76..91a693f3b68bd9be2f06b02c0d16aa4306812256 100644 (file)
@@ -13,6 +13,7 @@ struct auth_client_connection {
        struct istream *input;
        struct ostream *output;
 
+       unsigned int version_minor;
        unsigned int pid;
        unsigned int connect_uid;
        uint8_t cookie[MASTER_AUTH_COOKIE_SIZE];