diff src/auth/auth-request-handler.c @ 4682:bc071307fc2a HEAD

Require that the "resp" parameter for AUTH command is the last.
author Timo Sirainen <tss@iki.fi>
date Sun, 15 Oct 2006 18:52:25 +0300
parents d83f2a6e1f45
children 1d042234c9f9
line wrap: on
line diff
--- a/src/auth/auth-request-handler.c	Sun Oct 15 18:42:58 2006 +0300
+++ b/src/auth/auth-request-handler.c	Sun Oct 15 18:52:25 2006 +0300
@@ -288,17 +288,27 @@
 
 		if (auth_request_import(request, name, arg))
 			;
-		else if (strcmp(name, "resp") == 0)
-			initial_resp = arg;
 		else if (strcmp(name, "valid-client-cert") == 0)
 			valid_client_cert = TRUE;
+		else if (strcmp(name, "resp") == 0) {
+			initial_resp = arg;
+			/* this must be the last parameter */
+			list++;
+			break;
+		}
+	}
+
+	if (*list != NULL) {
+		i_error("BUG: Authentication client %u "
+			"sent AUTH parameters after 'resp'",
+			handler->client_pid);
+		return FALSE;
 	}
 
 	if (request->service == NULL) {
 		i_error("BUG: Authentication client %u "
 			"didn't specify service in request",
 			handler->client_pid);
-		auth_request_unref(&request);
 		return FALSE;
 	}