]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Use AUTH_CLIENT_PROTOCOL_MAJOR/MINOR_VERSION also for auth-master socket
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sat, 4 Apr 2020 20:55:21 +0000 (23:55 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 28 Jun 2022 08:10:53 +0000 (08:10 +0000)
Both auth-client and auth-master are using the same auth protocol. There's
no need to have separate version numbers for auth-master socket, it's just
confusing things. The auth server's auth-client version checking code was
already wrongly using AUTH_MASTER_PROTOCOL_MAJOR_VERSION.

src/auth/auth-client-connection.c
src/auth/auth-master-connection.c
src/lib-auth/auth-master.c
src/lib-login/master-auth.h
src/lib-login/master-login-auth.c

index 9c1a7b604fde9f8278afd13b75d0ae9c9e220b25..e15d0911c54bc55e028319addb2a2a8beea1672b 100644 (file)
@@ -277,7 +277,7 @@ static void auth_client_input(struct auth_client_connection *conn)
                                return;
                        }
                        /* make sure the major version matches */
-                       if (vmajor != AUTH_MASTER_PROTOCOL_MAJOR_VERSION) {
+                       if (vmajor != AUTH_CLIENT_PROTOCOL_MAJOR_VERSION) {
                                e_error(conn->event, "Authentication client "
                                        "not compatible with this server "
                                        "(mixed old and new binaries?)");
index b2ff162d3df1f41a67be2da4123bafcf3075e1c0..8716e5aa7b8bfff06ddd134343fdc18d1902ce27 100644 (file)
@@ -689,7 +689,7 @@ static void master_input(struct auth_master_connection *conn)
                /* make sure the major version matches */
                if (!str_begins(line, "VERSION\t", &args) ||
                    !str_uint_equals(t_strcut(args, '\t'),
-                                    AUTH_MASTER_PROTOCOL_MAJOR_VERSION)) {
+                                    AUTH_CLIENT_PROTOCOL_MAJOR_VERSION)) {
                        e_error(conn->event,
                                "Master not compatible with this server "
                                "(mixed old and new binaries?)");
@@ -787,8 +787,8 @@ auth_master_connection_create(struct auth *auth, int fd,
        event_set_log_message_callback(conn->event, auth_master_event_log_callback, conn);
 
        line = t_strdup_printf("VERSION\t%u\t%u\nSPID\t%s\n",
-                              AUTH_MASTER_PROTOCOL_MAJOR_VERSION,
-                              AUTH_MASTER_PROTOCOL_MINOR_VERSION,
+                              AUTH_CLIENT_PROTOCOL_MAJOR_VERSION,
+                              AUTH_CLIENT_PROTOCOL_MINOR_VERSION,
                               my_pid);
        o_stream_nsend_str(conn->output, line);
        DLLIST_PREPEND(&auth_master_connections, conn);
index 6d253518ca96c2af9797df0f0ca33ecd27f73975..e310dc1f267254373a912c6885d22b2632e1b98f 100644 (file)
 #include "str.h"
 #include "strescape.h"
 #include "connection.h"
+#include "auth-client-interface.h"
 #include "master-interface.h"
 #include "auth-client-private.h"
 #include "auth-master.h"
 
 #include <unistd.h>
 
-#define AUTH_PROTOCOL_MAJOR 1
-#define AUTH_PROTOCOL_MINOR 0
-
 #define AUTH_MASTER_IDLE_SECS 60
 
 #define MAX_INBUF_SIZE 8192
@@ -86,8 +84,8 @@ static const struct connection_settings auth_master_set = {
        .dont_send_version = TRUE,
        .service_name_in = "auth-master",
        .service_name_out = "auth-master",
-       .major_version = AUTH_PROTOCOL_MAJOR,
-       .minor_version = AUTH_PROTOCOL_MINOR,
+       .major_version = AUTH_CLIENT_PROTOCOL_MAJOR_VERSION,
+       .minor_version = AUTH_CLIENT_PROTOCOL_MINOR_VERSION,
        .unix_client_connect_msecs = 1000,
        .input_max_size = MAX_INBUF_SIZE,
        .output_max_size = MAX_OUTBUF_SIZE,
index 380f983d52d6662bc0193e23ffe6c42c8e8baaef..a167e89f1f564f4443fa3b732f96efd766ab1d29 100644 (file)
@@ -5,11 +5,6 @@
 
 struct master_service;
 
-/* Major version changes are not backwards compatible,
-   minor version numbers can be ignored. */
-#define AUTH_MASTER_PROTOCOL_MAJOR_VERSION 1
-#define AUTH_MASTER_PROTOCOL_MINOR_VERSION 1
-
 /* Authentication client process's cookie size */
 #define MASTER_AUTH_COOKIE_SIZE (128/8)
 
index a200c1de4aed9a9ba4535baab87eebedb84897a7..ddc2ecd8eb0dcb25cd4cf4d377153130fca814fb 100644 (file)
@@ -86,8 +86,8 @@ static const struct connection_settings master_login_auth_set = {
        .dont_send_version = TRUE,
        .service_name_in = "auth-master",
        .service_name_out = "auth-master",
-       .major_version = AUTH_MASTER_PROTOCOL_MAJOR_VERSION,
-       .minor_version = AUTH_MASTER_PROTOCOL_MINOR_VERSION,
+       .major_version = AUTH_CLIENT_PROTOCOL_MAJOR_VERSION,
+       .minor_version = AUTH_CLIENT_PROTOCOL_MINOR_VERSION,
        .unix_client_connect_msecs = 1000,
        .input_max_size = AUTH_MAX_INBUF_SIZE,
        .output_max_size = SIZE_MAX,
@@ -508,8 +508,8 @@ master_login_auth_connect(struct master_login_auth *auth)
 
        o_stream_nsend_str(auth->conn.output,
                t_strdup_printf("VERSION\t%u\t%u\n",
-                               AUTH_MASTER_PROTOCOL_MAJOR_VERSION,
-                               AUTH_MASTER_PROTOCOL_MINOR_VERSION));
+                               AUTH_CLIENT_PROTOCOL_MAJOR_VERSION,
+                               AUTH_CLIENT_PROTOCOL_MINOR_VERSION));
        return 0;
 }