]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Accept forward_fields from auth client
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 20 Feb 2017 18:36:58 +0000 (20:36 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 21 Mar 2017 09:53:08 +0000 (11:53 +0200)
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

index 9ba63e498684da89a7638fac1f0b058f84591db0..ce10f38f0501faba9dcad1b48747d06977463a1b 100644 (file)
@@ -405,6 +405,9 @@ bool auth_request_import_info(struct auth_request *request,
                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() */
index 33ae334acab24b6f5584b6b45ca5ff790efebfc7..5c337b99c0a22adafb92b04edbe4cf3fd88dbcdc 100644 (file)
@@ -90,6 +90,11 @@ static void auth_server_send_new_request(struct auth_server_connection *conn,
                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);
index f38c60b7a5dafc99ec0f611d0b603d480ec1e515..dba7a2cfe0ae2e5b33a2bae1f35c942e4556cc5e 100644 (file)
@@ -43,6 +43,7 @@ struct auth_request_info {
        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;
index 50c0b198db4a9dd88dea4408bb316a6f4e71a7e3..f7628b581b64bcee46441ff29a88a4487a005c82 100644 (file)
@@ -127,6 +127,7 @@ struct client {
        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;
index 7f206e2e16f3cddda9ec197c725dc21d98434501..16100ff9eed97910371e4161c8bf8b85646c7597 100644 (file)
@@ -373,6 +373,8 @@ void sasl_server_auth_begin(struct client *client,
        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 =