changeset 4416:fc135e4c169e HEAD

Don't crash if the initial response isn't given for AUTHENTICATE..
author Timo Sirainen <tss@iki.fi>
date Sat, 17 Jun 2006 22:48:36 +0300
parents b91816cd1d16
children 1eda19d6f1a7
files src/imap-login/client-authenticate.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c	Sat Jun 17 22:32:14 2006 +0300
+++ b/src/imap-login/client-authenticate.c	Sat Jun 17 22:48:36 2006 +0300
@@ -233,7 +233,7 @@
 
 int cmd_authenticate(struct imap_client *client, struct imap_arg *args)
 {
-	const char *mech_name;
+	const char *mech_name, *init_resp = NULL;
 
 	/* we want only one argument: authentication mechanism name */
 	if (args[0].type != IMAP_ARG_ATOM && args[0].type != IMAP_ARG_STRING)
@@ -243,6 +243,7 @@
 		if (args[1].type != IMAP_ARG_ATOM ||
 		    args[2].type != IMAP_ARG_EOL)
 			return -1;
+		init_resp = IMAP_ARG_STR(&args[1]);
 	}
 
 	mech_name = IMAP_ARG_STR(&args[0]);
@@ -251,7 +252,7 @@
 
 	client_ref(client);
 	sasl_server_auth_begin(&client->common, "IMAP", mech_name,
-			       IMAP_ARG_STR(&args[1]), sasl_callback);
+			       init_resp, sasl_callback);
 	if (!client->common.authenticating)
 		return 1;