File: 79_Dovecot-fix-protocol-sequence-for-version-2.4.0.patch

package info (click to toggle)
exim4 4.98.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,224 kB
  • sloc: ansic: 115,444; sh: 3,886; xml: 2,141; perl: 918; makefile: 510
file content (63 lines) | stat: -rw-r--r-- 2,244 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From c2ed759f5604625bf1d055d327864e7c2dd26c48 Mon Sep 17 00:00:00 2001
From: Timo Sirainen <timo@sirainen.com>
Date: Wed, 5 Feb 2025 10:53:58 +0000
Subject: [PATCH] Dovecot: fix protocol sequence for version 2.4.0

---
 src/auths/dovecot.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

--- a/src/auths/dovecot.c
+++ b/src/auths/dovecot.c
@@ -253,10 +253,11 @@ auth_dovecot_server(auth_instance * ablo
 auth_dovecot_options_block *ob =
        (auth_dovecot_options_block *) ablock->options_block;
 uschar buffer[DOVECOT_AUTH_MAXLINELEN];
 uschar *args[DOVECOT_AUTH_MAXFIELDCOUNT];
 uschar *auth_command;
+uschar *version_command;
 uschar *auth_extra_data = US"";
 uschar *p;
 int nargs, tmp;
 int crequid = 1, ret = DEFER;
 host_item host;
@@ -334,10 +335,23 @@ for (;;)
   if (Ustrcmp(args[0], US"VERSION") == 0)
     {
     CHECK_COMMAND("VERSION", 2, 2);
     if (Uatoi(args[1]) != VERSION_MAJOR)
       OUT("authentication socket protocol version mismatch");
+
+    version_command = string_sprintf("VERSION\t%d\t%d\n",
+	   VERSION_MAJOR, VERSION_MINOR);
+    
+    if ((
+    #ifndef DISABLE_TLS
+	cctx.tls_ctx ? tls_write(cctx.tls_ctx, version_command, Ustrlen(version_command), FALSE) :
+    #endif
+	write(cctx.sock, version_command, Ustrlen(version_command))) < 0)
+      HDEBUG(D_auth) debug_printf("error sending version_command: %s\n",
+	strerror(errno));
+    
+    HDEBUG(D_auth) debug_printf("  DOVECOT>> '%s'\n", version_command);
     }
   else if (Ustrcmp(args[0], US"MECH") == 0)
     {
     CHECK_COMMAND("MECH", 1, INT_MAX);
     have_mech_line = TRUE;
@@ -409,13 +423,13 @@ fprintf(f, "VERSION\t%d\t%d\r\nSERVICE\t
 
 Subsequently, the command was modified to add "secured" and "valid-client-
 cert" when relevant.
 ****************************************************************************/
 
-auth_command = string_sprintf("VERSION\t%d\t%d\nCPID\t%d\n"
+auth_command = string_sprintf("CPID\t%d\n"
        "AUTH\t%d\t%s\tservice=smtp\t%srip=%s\tlip=%s\tnologin\tresp=%s\n",
-       VERSION_MAJOR, VERSION_MINOR, getpid(), crequid,
+       getpid(), crequid,
        ablock->public_name, auth_extra_data, sender_host_address,
        interface_address, data);
 
 if ((
 #ifndef DISABLE_TLS