]> git.pld-linux.org Git - packages/dovecot.git/commitdiff
- rel 3; also add local_name expansion variable auto/th/dovecot-2.2.25-3
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 20 Oct 2016 12:18:10 +0000 (14:18 +0200)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 20 Oct 2016 12:18:10 +0000 (14:18 +0200)
dovecot-local-name.patch
dovecot.spec

index c25cb6c69021750a30d740c622a70173a0c53b80..b1be551bd71e73c0d7250ef08843d340c3112aa7 100644 (file)
@@ -70,3 +70,177 @@ index e8cc010..87a24da 100644
                return FALSE;
  
        return TRUE;
+From fe791e96fdf796f7d8997ee0515b163dc5eddd72 Mon Sep 17 00:00:00 2001
+From: Aki Tuomi <aki.tuomi@dovecot.fi>
+Date: Tue, 18 Oct 2016 00:37:32 +0300
+Subject: [PATCH] auth: Pass local_name to auth-request
+
+This allows using local_name in various places,
+such as passdb/userdb queries.
+---
+ src/auth/auth-request-var-expand.c   | 5 +++++
+ src/auth/auth-request-var-expand.h   | 2 +-
+ src/auth/auth-request.c              | 4 ++++
+ src/auth/auth-request.h              | 2 +-
+ src/lib-auth/auth-client-request.c   | 4 +++-
+ src/lib-auth/auth-client.h           | 1 +
+ src/login-common/client-common.h     | 1 +
+ src/login-common/login-settings.c    | 2 ++
+ src/login-common/sasl-server.c       | 1 +
+ src/login-common/ssl-proxy-openssl.c | 1 +
+ 10 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/src/auth/auth-request-var-expand.c b/src/auth/auth-request-var-expand.c
+index 312d393..4fd2dcb 100644
+--- a/src/auth/auth-request-var-expand.c
++++ b/src/auth/auth-request-var-expand.c
+@@ -45,6 +45,7 @@ auth_request_var_expand_static_tab[AUTH_REQUEST_VAR_TAB_COUNT+1] = {
+       { '\0', NULL, "auth_user" },
+       { '\0', NULL, "auth_username" },
+       { '\0', NULL, "auth_domain" },
++      { '\0', NULL, "local_name" },
+       /* be sure to update AUTH_REQUEST_VAR_TAB_COUNT */
+       { '\0', NULL, NULL }
+ };
+@@ -166,6 +167,10 @@ auth_request_get_var_expand_table_full(const struct auth_request *auth_request,
+       tab[32].value = strchr(auth_user, '@');
+       if (tab[32].value != NULL)
+               tab[32].value = escape_func(tab[32].value+1, auth_request);
++      if (auth_request->local_name != NULL)
++              tab[33].value = escape_func(auth_request->local_name, auth_request);
++      else
++              tab[33].value = "";
+       return ret_tab;
+ }
+diff --git a/src/auth/auth-request-var-expand.h b/src/auth/auth-request-var-expand.h
+index a7cafdd..0d228da 100644
+--- a/src/auth/auth-request-var-expand.h
++++ b/src/auth/auth-request-var-expand.h
+@@ -8,7 +8,7 @@ auth_request_escape_func_t(const char *string,
+ #define AUTH_REQUEST_VAR_TAB_USER_IDX 0
+ #define AUTH_REQUEST_VAR_TAB_USERNAME_IDX 1
+ #define AUTH_REQUEST_VAR_TAB_DOMAIN_IDX 2
+-#define AUTH_REQUEST_VAR_TAB_COUNT 33
++#define AUTH_REQUEST_VAR_TAB_COUNT 34
+ extern const struct var_expand_table
+ auth_request_var_expand_static_tab[AUTH_REQUEST_VAR_TAB_COUNT+1];
+diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c
+index 7a60c97..8b38f83 100644
+--- a/src/auth/auth-request.c
++++ b/src/auth/auth-request.c
+@@ -319,6 +319,8 @@ void auth_request_export(struct auth_request *request, string_t *dest)
+               str_printfa(dest, "\treal_lport=%u", request->real_local_port);
+       if (request->real_remote_port != 0)
+               str_printfa(dest, "\treal_rport=%u", request->real_remote_port);
++      if (request->local_name != 0)
++              str_printfa(dest, "\tlocal_name=%s", request->local_name);
+       if (request->session_id != NULL)
+               str_printfa(dest, "\tsession=%s", request->session_id);
+       if (request->debug)
+@@ -377,6 +379,8 @@ bool auth_request_import_info(struct auth_request *request,
+               (void)net_str2port(value, &request->real_local_port);
+       else if (strcmp(key, "real_rport") == 0)
+               (void)net_str2port(value, &request->real_remote_port);
++      else if (strcmp(key, "local_name") == 0)
++              request->local_name = p_strdup(request->pool, value);
+       else if (strcmp(key, "session") == 0)
+               request->session_id = p_strdup(request->pool, value);
+       else if (strcmp(key, "debug") == 0)
+diff --git a/src/auth/auth-request.h b/src/auth/auth-request.h
+index 54772ee..63fb838 100644
+--- a/src/auth/auth-request.h
++++ b/src/auth/auth-request.h
+@@ -74,7 +74,7 @@ struct auth_request {
+       time_t delay_until;
+       pid_t session_pid;
+-      const char *service, *mech_name, *session_id;
++      const char *service, *mech_name, *session_id, *local_name;
+       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;
+diff --git a/src/lib-auth/auth-client-request.c b/src/lib-auth/auth-client-request.c
+index fde65bf..968dc98 100644
+--- a/src/lib-auth/auth-client-request.c
++++ b/src/lib-auth/auth-client-request.c
+@@ -80,7 +80,9 @@ static void auth_server_send_new_request(struct auth_server_connection *conn,
+       if (info->real_remote_port != 0 &&
+           info->real_remote_port != info->remote_port)
+               str_printfa(str, "\treal_rport=%u", info->real_remote_port);
+-
++      if (info->local_name != NULL &&
++          *info->local_name != '\0')
++              str_printfa(str, "\tlocal_name=%s", info->local_name);
+       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 59cf3d4..45b346b 100644
+--- a/src/lib-auth/auth-client.h
++++ b/src/lib-auth/auth-client.h
+@@ -41,6 +41,7 @@ struct auth_request_info {
+       const char *service;
+       const char *session_id;
+       const char *cert_username;
++      const char *local_name;
+       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 715c22f..864af1c 100644
+--- a/src/login-common/client-common.h
++++ b/src/login-common/client-common.h
+@@ -117,6 +117,7 @@ struct client {
+       const struct login_settings *set;
+       const struct master_service_ssl_settings *ssl_set;
+       const char *session_id, *listener_name, *postlogin_socket_path;
++      const char *local_name;
+       int fd;
+       struct istream *input;
+diff --git a/src/login-common/login-settings.c b/src/login-common/login-settings.c
+index 05be020..ace5dae 100644
+--- a/src/login-common/login-settings.c
++++ b/src/login-common/login-settings.c
+@@ -120,6 +120,7 @@ login_set_var_expand_table(const struct master_service_settings_input *input)
+               { 'r', NULL, "rip" },
+               { 'p', NULL, "pid" },
+               { 's', NULL, "service" },
++              { '\0', NULL, "local_name" },
+               { '\0', NULL, NULL }
+       };
+       struct var_expand_table *tab;
+@@ -131,6 +132,7 @@ login_set_var_expand_table(const struct master_service_settings_input *input)
+       tab[1].value = net_ip2addr(&input->remote_ip);
+       tab[2].value = my_pid;
+       tab[3].value = input->service;
++      tab[4].value = input->local_name;
+       return tab;
+ }
+diff --git a/src/login-common/sasl-server.c b/src/login-common/sasl-server.c
+index 5d6d29c..097b83d 100644
+--- a/src/login-common/sasl-server.c
++++ b/src/login-common/sasl-server.c
+@@ -360,6 +360,7 @@ void sasl_server_auth_begin(struct client *client,
+       info.local_ip = client->local_ip;
+       info.remote_ip = client->ip;
+       info.local_port = client->local_port;
++      info.local_name = client->local_name;
+       info.remote_port = client->remote_port;
+       info.real_local_ip = client->real_local_ip;
+       info.real_remote_ip = client->real_remote_ip;
+diff --git a/src/login-common/ssl-proxy-openssl.c b/src/login-common/ssl-proxy-openssl.c
+index 0f17fad..a17ce66 100644
+--- a/src/login-common/ssl-proxy-openssl.c
++++ b/src/login-common/ssl-proxy-openssl.c
+@@ -1149,6 +1149,7 @@ static void ssl_servername_callback(SSL *ssl, int *al ATTR_UNUSED,
+                                                 &client->ssl_set,
+                                                 &other_sets);
+       }
++      client->local_name = p_strdup(client->pool, host);
+       ctx = ssl_server_context_get(client->set, client->ssl_set);
+       SSL_set_SSL_CTX(ssl, ctx->ctx);
+ }
index e4ad56b91cd59c28c5c912072f3e3629e8d45685..51a8c653349b7cf058a3d9672ae6e30f6d99adbb 100644 (file)
@@ -12,7 +12,7 @@ Summary:      IMAP and POP3 server written with security primarily in mind
 Summary(pl.UTF-8):     Serwer IMAP i POP3 pisany głównie z myślą o bezpieczeństwie
 Name:          dovecot
 Version:       2.2.25
-Release:       2
+Release:       3
 Epoch:         1
 License:       MIT (libraries), LGPL v2.1 (the rest)
 Group:         Networking/Daemons
This page took 0.049916 seconds and 4 git commands to generate.