From 981a9fad802cf50ffe4640e9f1a336eef3bd60e6 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Fri, 5 Mar 2010 16:11:11 +0000 Subject: [PATCH] Fix for unknown responses from Dovecot authenticator. Fixes: #954 --- doc/doc-txt/ChangeLog | 5 ++++- src/src/auths/dovecot.c | 38 +++++++++++++------------------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index ded8fb8bf..f39f006e6 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -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 ----------------- diff --git a/src/src/auths/dovecot.c b/src/src/auths/dovecot.c index 9893dac22..78505722f 100644 --- a/src/src/auths/dovecot.c +++ b/src/src/auths/dovecot.c @@ -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 @@ -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; } } -- 2.25.1