From: Stephan Bosch Date: Sat, 25 Nov 2017 14:57:16 +0000 (+0100) Subject: pop3-login: Properly recognize an empty SASL initial response. X-Git-Tag: 2.3.0.rc1~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=981f260cfa17a22faf4ff047e479e63cad01aa65;p=thirdparty%2Fdovecot%2Fcore.git pop3-login: Properly recognize an empty SASL initial response. Pass only the empty string to the auth service and not "=". --- diff --git a/src/pop3-login/client-authenticate.c b/src/pop3-login/client-authenticate.c index da419ef789..24b9030099 100644 --- a/src/pop3-login/client-authenticate.c +++ b/src/pop3-login/client-authenticate.c @@ -80,7 +80,7 @@ bool cmd_auth(struct pop3_client *pop3_client, const char *args) { struct client *client = &pop3_client->common; const struct auth_mech_desc *mech; - const char *mech_name, *p; + const char *mech_name, *init_resp, *p; if (*args == '\0') { /* Old-style SASL discovery, used by MS Outlook */ @@ -100,13 +100,21 @@ bool cmd_auth(struct pop3_client *pop3_client, const char *args) p = strchr(args, ' '); if (p == NULL) { mech_name = args; - args = NULL; + /* no initial response */ + init_resp = NULL; } else { mech_name = t_strdup_until(args, p); - args = p+1; + init_resp = p + 1; + if (*init_resp == '\0') { + /* no initial response */ + init_resp = NULL; + } else if (strcmp(init_resp, "=") == 0) { + /* empty initial response */ + init_resp = ""; + } } - (void)client_auth_begin(client, mech_name, args); + (void)client_auth_begin(client, mech_name, init_resp); return TRUE; }