Fix for unknown responses from Dovecot authenticator. Fixes: #954
authorNigel Metheringham <nigel@exim.org>
Fri, 5 Mar 2010 16:11:11 +0000 (16:11 +0000)
committerNigel Metheringham <nigel@exim.org>
Fri, 5 Mar 2010 16:11:11 +0000 (16:11 +0000)
doc/doc-txt/ChangeLog
src/src/auths/dovecot.c

index ded8fb8bf933f4462b3377f7fbea2335f3d450d8..f39f006e68eb2b1e2b3a34f9e9f1976e7ce07352 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.604 2010/03/05 16:08:15 nm4 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.605 2010/03/05 16:11:11 nm4 Exp $
 
 Change log file for Exim from version 4.21
 -------------------------------------------
@@ -18,6 +18,9 @@ NM/02 Bugzilla 961: Spacing fix (syntax error) on Makefile directives for NetBSD
 NM/03 Bugzilla 955: Documentation fix for max_rcpts.
       Patch from Andreas Metzler
 
+NM/04 Bugzilla 954: Fix for unknown responses from Dovecot authenticator.
+      Patch from Kirill Miazine
+
 
 Exim version 4.71
 -----------------
index 9893dac22104f4ee038e8831a4d46a7c81753803..78505722f648d9d9ab6495ec70a97c040f3d2d02 100644 (file)
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/auths/dovecot.c,v 1.11 2009/10/26 13:18:54 nm4 Exp $ */
+/* $Cambridge: exim/src/src/auths/dovecot.c,v 1.12 2010/03/05 16:11:11 nm4 Exp $ */
 
 /*
  * Copyright (c) 2004 Andrey Panin <pazke@donpac.ru>
@@ -209,35 +209,23 @@ int auth_dovecot_server(auth_instance *ablock, uschar *data)
                HDEBUG(D_auth) debug_printf("received: %s\n", buffer);
                nargs = strcut(buffer, args, sizeof(args) / sizeof(args[0]));
 
-               switch (toupper(*args[0])) {
-               case 'C':
+               /* Code below rewritten by Kirill Miazine (km@krot.org). Only check commands that
+                  Exim will need. Original code also failed if Dovecot server sent unknown
+                  command. E.g. COOKIE in version 1.1 of the protocol would cause troubles. */
+               if (Ustrcmp(args[0], US"CUID") == 0) {
                        CHECK_COMMAND("CUID", 1, 1);
                        cuid = Uatoi(args[1]);
-                       break;
-
-               case 'D':
-                       CHECK_COMMAND("DONE", 0, 0);
-                       cont = 0;
-                       break;
-
-               case 'M':
-                       CHECK_COMMAND("MECH", 1, INT_MAX);
-                       if (strcmpic(US args[1], ablock->public_name) == 0)
-                               found = 1;
-                       break;
-
-               case 'S':
-                       CHECK_COMMAND("SPID", 1, 1);
-                       break;
-
-               case 'V':
+               } else if (Ustrcmp(args[0], US"VERSION") == 0) {
                        CHECK_COMMAND("VERSION", 2, 2);
                        if (Uatoi(args[1]) != VERSION_MAJOR)
                                OUT("authentication socket protocol version mismatch");
-                       break;
-
-               default:
-                       goto out;
+               } else if (Ustrcmp(args[0], US"MECH") == 0) {
+                       CHECK_COMMAND("MECH", 1, INT_MAX);
+                       if (strcmpic(US args[1], ablock->public_name) == 0)
+                               found = 1;
+               } else if (Ustrcmp(args[0], US"DONE") == 0) {
+                       CHECK_COMMAND("DONE", 0, 0);
+                       cont = 0;
                }
        }