From: Timo Sirainen Date: Sat, 4 Apr 2020 20:55:21 +0000 (+0300) Subject: global: Use AUTH_CLIENT_PROTOCOL_MAJOR/MINOR_VERSION also for auth-master socket X-Git-Tag: 2.4.0~3932 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b38f0f3435680f765997c55d8b444d2909cd0ca1;p=thirdparty%2Fdovecot%2Fcore.git global: Use AUTH_CLIENT_PROTOCOL_MAJOR/MINOR_VERSION also for auth-master socket 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. --- diff --git a/src/auth/auth-client-connection.c b/src/auth/auth-client-connection.c index 9c1a7b604f..e15d0911c5 100644 --- a/src/auth/auth-client-connection.c +++ b/src/auth/auth-client-connection.c @@ -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?)"); diff --git a/src/auth/auth-master-connection.c b/src/auth/auth-master-connection.c index b2ff162d3d..8716e5aa7b 100644 --- a/src/auth/auth-master-connection.c +++ b/src/auth/auth-master-connection.c @@ -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); diff --git a/src/lib-auth/auth-master.c b/src/lib-auth/auth-master.c index 6d253518ca..e310dc1f26 100644 --- a/src/lib-auth/auth-master.c +++ b/src/lib-auth/auth-master.c @@ -11,15 +11,13 @@ #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 -#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, diff --git a/src/lib-login/master-auth.h b/src/lib-login/master-auth.h index 380f983d52..a167e89f1f 100644 --- a/src/lib-login/master-auth.h +++ b/src/lib-login/master-auth.h @@ -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) diff --git a/src/lib-login/master-login-auth.c b/src/lib-login/master-login-auth.c index a200c1de4a..ddc2ecd8eb 100644 --- a/src/lib-login/master-login-auth.c +++ b/src/lib-login/master-login-auth.c @@ -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; }