]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
*-login: Added postlogin_socket=path passdb extra field.
authorTimo Sirainen <tss@iki.fi>
Tue, 17 Nov 2015 15:26:56 +0000 (17:26 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 17 Nov 2015 15:26:56 +0000 (17:26 +0200)
By default e.g. "imap" or "pop3" is the post-login socket, but this can
override it. This could be used for example for per-user debugging (e.g.
setting executable to be run via strace or valgrind).

src/login-common/client-common-auth.c
src/login-common/client-common.h
src/login-common/sasl-server.c

index 90941c56d00594899c97802aaceb0eae4bc3d81a..94ae28f1ea55ec3c779e23652f74aa95aae68cdf 100644 (file)
@@ -133,8 +133,9 @@ static void client_auth_parse_args(struct client *client,
                                PROXY_SSL_FLAG_STARTTLS;
                        if (strcmp(value, "any-cert") == 0)
                                reply_r->ssl_flags |= PROXY_SSL_FLAG_ANY_CERT;
-               } else if (strcmp(key, "user") == 0) {
-                       /* already handled in login-common */
+               } else if (strcmp(key, "user") == 0 ||
+                          strcmp(key, "postlogin_socket") == 0) {
+                       /* already handled in sasl-server.c */
                } else if (client->set->auth_debug)
                        i_debug("Ignoring unknown passdb extra field: %s", key);
        }
index c4c85503e90d978ac736cd201ebc88b344f27f29..769b33a5cd686ec59950fd31f82e595009be1e4b 100644 (file)
@@ -113,7 +113,7 @@ struct client {
        struct ssl_proxy *ssl_proxy;
        const struct login_settings *set;
        const struct master_service_ssl_settings *ssl_set;
-       const char *session_id, *listener_name;
+       const char *session_id, *listener_name, *postlogin_socket_path;
 
        int fd;
        struct istream *input;
index 3a6e0d25d7496d956abed13ec4cd7b386def433f..6b7d695930c8e9821a01d8e46c3d9d02f788e290 100644 (file)
@@ -155,6 +155,7 @@ static void master_send_request(struct anvil_request *anvil_request)
 
        memset(&params, 0, sizeof(params));
        params.client_fd = client->fd;
+       params.socket_path = client->postlogin_socket_path;
        params.request = req;
        params.data = buf->data;
        master_auth_request_full(master_auth, &params, master_auth_callback,
@@ -246,6 +247,7 @@ authenticate_callback(struct auth_client_request *request,
                client->auth_request = NULL;
                client->auth_successes++;
                client->auth_passdb_args = p_strarray_dup(client->pool, args);
+               client->postlogin_socket_path = NULL;
 
                nologin = FALSE;
                for (i = 0; args[i] != NULL; i++) {
@@ -261,6 +263,9 @@ authenticate_callback(struct auth_client_request *request,
                                i_free(client->virtual_auth_user);
                                client->virtual_auth_user =
                                        i_strdup(args[i] + 10);
+                       } else if (strncmp(args[i], "postlogin_socket=", 17) == 0) {
+                               client->postlogin_socket_path =
+                                       p_strdup(client->pool, args[i] + 17);
                        } else if (strcmp(args[i], "nologin") == 0 ||
                                   strcmp(args[i], "proxy") == 0) {
                                /* user can't login */