[dovecot-cvs] dovecot/src/lib-auth auth-server-request.c,1.15,1.16

cras at dovecot.org cras at dovecot.org
Mon Oct 18 04:13:28 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-auth
In directory talvi:/tmp/cvs-serv24063/src/lib-auth

Modified Files:
	auth-server-request.c 
Log Message:
Implemented support for LOGIN-REFERRALS using "referral" and "reason"
parameters from auth server.



Index: auth-server-request.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-server-request.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- auth-server-request.c	13 Oct 2004 16:38:34 -0000	1.15
+++ auth-server-request.c	18 Oct 2004 01:13:25 -0000	1.16
@@ -201,14 +201,16 @@
 {
 	struct auth_request *request;
         struct auth_server_connection *next;
-	const char *error;
+	const char *error, *const *list;
 	unsigned int id;
 
-	error = strchr(args, '\t');
-	if (error != NULL)
-		error++;
+	list = t_strsplit(args, "\t");
+	if (list[0] == NULL) {
+		i_error("BUG: Authentication server sent broken OK line");
+		return FALSE;
+	}
 
-	id = (unsigned int)strtoul(args, NULL, 10);
+	id = (unsigned int)strtoul(list[0], NULL, 10);
 
 	request = hash_lookup(conn->requests, POINTER_CAST(id));
 	if (request == NULL) {
@@ -216,6 +218,14 @@
 		return TRUE;
 	}
 
+	if (list[1] == NULL) {
+		error = NULL;
+		list++;
+	} else {
+		error = *list[1] == '\0' ? NULL : list[1];
+		list += 2;
+	}
+
 	hash_remove(conn->requests, POINTER_CAST(request->id));
 	if (request->retrying) {
 		next = request->next_conn == NULL ? NULL :
@@ -241,7 +251,7 @@
 		}
 	}
 
-	request->callback(request, -1, error, NULL, request->context);
+	request->callback(request, -1, error, list, request->context);
 	auth_client_request_free(request);
 	return TRUE;
 }



More information about the dovecot-cvs mailing list