diff src/imap-login/client-authenticate.c @ 4411:a2420b745cd5 HEAD

Added support for SASL-IR extension.
author Timo Sirainen <tss@iki.fi>
date Sat, 17 Jun 2006 20:19:29 +0300
parents 0e10b01960a0
children fc135e4c169e
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c	Sat Jun 17 20:11:30 2006 +0300
+++ b/src/imap-login/client-authenticate.c	Sat Jun 17 20:19:29 2006 +0300
@@ -238,16 +238,20 @@
 	/* we want only one argument: authentication mechanism name */
 	if (args[0].type != IMAP_ARG_ATOM && args[0].type != IMAP_ARG_STRING)
 		return -1;
-	if (args[1].type != IMAP_ARG_EOL)
-		return -1;
+	if (args[1].type != IMAP_ARG_EOL) {
+		/* optional SASL initial response */
+		if (args[1].type != IMAP_ARG_ATOM ||
+		    args[2].type != IMAP_ARG_EOL)
+			return -1;
+	}
 
 	mech_name = IMAP_ARG_STR(&args[0]);
 	if (*mech_name == '\0')
 		return 0;
 
 	client_ref(client);
-	sasl_server_auth_begin(&client->common, "IMAP", mech_name, NULL,
-			       sasl_callback);
+	sasl_server_auth_begin(&client->common, "IMAP", mech_name,
+			       IMAP_ARG_STR(&args[1]), sasl_callback);
 	if (!client->common.authenticating)
 		return 1;