changeset 22229:7e292e08a02e

imap-login: Fix storing ID NIL values into client_id
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 15 Jun 2017 12:46:47 +0300
parents f2cb5e620543
children b187ee84347f
files src/imap-login/imap-login-client.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/imap-login-client.c	Wed Jun 14 11:47:00 2017 +0300
+++ b/src/imap-login/imap-login-client.c	Thu Jun 15 12:46:47 2017 +0300
@@ -208,12 +208,15 @@
 	size_t kvlen = strlen(key) + 2 + 1 +
 		       (value == NULL ? 3 : strlen(value)) + 2;
 
-	if (value == NULL) {
-		/* do not try to process NIL value */
-		client_id_str = FALSE;
-	} else if (client->common.trusted && !client->id_logged) {
-		client_id_str = !client_update_info(client, key, value);
-		i_assert(client_id_str == !client_id_reserved_word(key));
+	if (client->common.trusted && !client->id_logged) {
+		if (value == NULL) {
+			/* do not try to process NIL values as client-info,
+			   but store them for non-reserved keys */
+			client_id_str = !client_id_reserved_word(key);
+		} else {
+			client_id_str = !client_update_info(client, key, value);
+			i_assert(client_id_str == !client_id_reserved_word(key));
+		}
 	} else {
 		client_id_str = !client_id_reserved_word(key);
 	}