From: Aki Tuomi Date: Mon, 20 Feb 2017 18:36:58 +0000 (+0200) Subject: auth: Accept forward_fields from auth client X-Git-Tag: 2.2.29.rc1~136 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dcdece5d5ade183bd5a7384010d9c6166fb6e6e7;p=thirdparty%2Fdovecot%2Fcore.git auth: Accept forward_fields from auth client --- diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c index 9ba63e4986..ce10f38f05 100644 --- a/src/auth/auth-request.c +++ b/src/auth/auth-request.c @@ -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() */ diff --git a/src/lib-auth/auth-client-request.c b/src/lib-auth/auth-client-request.c index 33ae334aca..5c337b99c0 100644 --- a/src/lib-auth/auth-client-request.c +++ b/src/lib-auth/auth-client-request.c @@ -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); diff --git a/src/lib-auth/auth-client.h b/src/lib-auth/auth-client.h index f38c60b7a5..dba7a2cfe0 100644 --- a/src/lib-auth/auth-client.h +++ b/src/lib-auth/auth-client.h @@ -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; diff --git a/src/login-common/client-common.h b/src/login-common/client-common.h index 50c0b198db..f7628b581b 100644 --- a/src/login-common/client-common.h +++ b/src/login-common/client-common.h @@ -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; diff --git a/src/login-common/sasl-server.c b/src/login-common/sasl-server.c index 7f206e2e16..16100ff9ee 100644 --- a/src/login-common/sasl-server.c +++ b/src/login-common/sasl-server.c @@ -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 =