changeset 21772:5379a8dd5937

auth: Accept forward_fields from auth client
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Mon, 20 Feb 2017 20:36:58 +0200
parents 4cc995a5f002
children 606a4b7ccb21
files src/auth/auth-request.c src/lib-auth/auth-client-request.c src/lib-auth/auth-client.h src/login-common/client-common.h src/login-common/sasl-server.c
diffstat 5 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request.c	Thu Mar 16 13:36:23 2017 +0200
+++ b/src/auth/auth-request.c	Mon Feb 20 20:36:58 2017 +0200
@@ -405,6 +405,9 @@
 		request->debug = TRUE;
 	else if (strcmp(key, "client_id") == 0)
 		request->client_id = p_strdup(request->pool, value);
+	else if (strcmp(key, "forward_fields") == 0)
+		auth_fields_import_prefixed(request->extra_fields,
+					    "forward_", value, 0);
 	else
 		return FALSE;
 	/* NOTE: keep in sync with auth_request_export() */
--- a/src/lib-auth/auth-client-request.c	Thu Mar 16 13:36:23 2017 +0200
+++ b/src/lib-auth/auth-client-request.c	Mon Feb 20 20:36:58 2017 +0200
@@ -90,6 +90,11 @@
 		str_append(str, "\tclient_id=");
 		str_append_tabescaped(str, info->client_id);
 	}
+	if (info->forward_fields != NULL &&
+	    *info->forward_fields != '\0') {
+		str_append(str, "\tforward_fields=");
+		str_append_tabescaped(str, info->forward_fields);
+	}
 	if (info->initial_resp_base64 != NULL) {
 		str_append(str, "\tresp=");
 		str_append_tabescaped(str, info->initial_resp_base64);
--- a/src/lib-auth/auth-client.h	Thu Mar 16 13:36:23 2017 +0200
+++ b/src/lib-auth/auth-client.h	Mon Feb 20 20:36:58 2017 +0200
@@ -43,6 +43,7 @@
 	const char *cert_username;
 	const char *local_name;
 	const char *client_id;
+	const char *forward_fields;
 	enum auth_request_flags flags;
 
 	struct ip_addr local_ip, remote_ip, real_local_ip, real_remote_ip;
--- a/src/login-common/client-common.h	Thu Mar 16 13:36:23 2017 +0200
+++ b/src/login-common/client-common.h	Mon Feb 20 20:36:58 2017 +0200
@@ -127,6 +127,7 @@
 	const char *session_id, *listener_name, *postlogin_socket_path;
 	const char *local_name;
 	string_t *client_id;
+	string_t *forward_fields;
 
 	int fd;
 	struct istream *input;
--- a/src/login-common/sasl-server.c	Thu Mar 16 13:36:23 2017 +0200
+++ b/src/login-common/sasl-server.c	Mon Feb 20 20:36:58 2017 +0200
@@ -373,6 +373,8 @@
 	info.real_remote_port = client->real_remote_port;
 	if (client->client_id != NULL)
 		info.client_id = str_c(client->client_id);
+	if (client->forward_fields != NULL)
+		info.forward_fields = str_c(client->forward_fields);
 	info.initial_resp_base64 = initial_resp_base64;
 
 	client->auth_request =