Mercurial > dovecot > core-2.2
changeset 21766:494f0ac153a6
auth: Accept client_id from auth client
Client ID contains the ID client request string
for IMAP.
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Mon, 20 Feb 2017 18:58:21 +0200 |
parents | 91b94ecaa39d |
children | b86e6d2abf23 |
files | src/auth/auth-request.c src/auth/auth-request.h 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 | 6 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-request.c Thu Mar 09 14:08:40 2017 +0200 +++ b/src/auth/auth-request.c Mon Feb 20 18:58:21 2017 +0200 @@ -357,6 +357,8 @@ str_append(dest, "\tsuccessful"); if (request->mech_name != NULL) auth_str_add_keyvalue(dest, "mech", request->mech_name); + if (request->client_id != NULL) + auth_str_add_keyvalue(dest, "client_id", request->client_id); /* export passdb extra fields */ auth_request_export_fields(dest, request->extra_fields, "passdb_"); /* export any userdb fields */ @@ -401,6 +403,8 @@ request->session_id = p_strdup(request->pool, value); else if (strcmp(key, "debug") == 0) request->debug = TRUE; + else if (strcmp(key, "client_id") == 0) + request->client_id = p_strdup(request->pool, value); else return FALSE; /* NOTE: keep in sync with auth_request_export() */
--- a/src/auth/auth-request.h Thu Mar 09 14:08:40 2017 +0200 +++ b/src/auth/auth-request.h Mon Feb 20 18:58:21 2017 +0200 @@ -74,7 +74,7 @@ time_t delay_until; pid_t session_pid; - const char *service, *mech_name, *session_id, *local_name; + const char *service, *mech_name, *session_id, *local_name, *client_id; struct ip_addr local_ip, remote_ip, real_local_ip, real_remote_ip; in_port_t local_port, remote_port, real_local_port, real_remote_port;
--- a/src/lib-auth/auth-client-request.c Thu Mar 09 14:08:40 2017 +0200 +++ b/src/lib-auth/auth-client-request.c Mon Feb 20 18:58:21 2017 +0200 @@ -85,6 +85,11 @@ str_append(str, "\tlocal_name="); str_append_tabescaped(str, info->local_name); } + if (info->client_id != NULL && + *info->client_id != '\0') { + str_append(str, "\tclient_id="); + str_append_tabescaped(str, info->client_id); + } 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 09 14:08:40 2017 +0200 +++ b/src/lib-auth/auth-client.h Mon Feb 20 18:58:21 2017 +0200 @@ -42,6 +42,7 @@ const char *session_id; const char *cert_username; const char *local_name; + const char *client_id; 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 09 14:08:40 2017 +0200 +++ b/src/login-common/client-common.h Mon Feb 20 18:58:21 2017 +0200 @@ -125,6 +125,7 @@ const struct master_service_ssl_settings *ssl_set; const char *session_id, *listener_name, *postlogin_socket_path; const char *local_name; + string_t *client_id; int fd; struct istream *input;
--- a/src/login-common/sasl-server.c Thu Mar 09 14:08:40 2017 +0200 +++ b/src/login-common/sasl-server.c Mon Feb 20 18:58:21 2017 +0200 @@ -1,6 +1,7 @@ /* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */ #include "login-common.h" +#include "str.h" #include "base64.h" #include "buffer.h" #include "hex-binary.h" @@ -370,6 +371,8 @@ info.real_remote_ip = client->real_remote_ip; info.real_local_port = client->real_local_port; info.real_remote_port = client->real_remote_port; + if (client->client_id != NULL) + info.client_id = str_c(client->client_id); info.initial_resp_base64 = initial_resp_base64; client->auth_request =