]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-urlauth: Replace i_info() and i_error() calls with e_info() and e_error()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 2 Mar 2021 15:30:52 +0000 (17:30 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 11 Mar 2021 11:19:09 +0000 (11:19 +0000)
src/imap-urlauth/imap-urlauth-client.c
src/imap-urlauth/imap-urlauth-login.c

index 55b3170a745a471565dce96a014b61d6e6953196..c5acec9d86af47007b171e7a83780d121db3e900 100644 (file)
@@ -148,11 +148,12 @@ static int client_worker_connect(struct client *client)
        client->fd_ctrl = net_connect_unix_with_retries(socket_path, 1000);
        if (client->fd_ctrl < 0) {
                if (errno == EACCES) {
-                       i_error("imap-urlauth-client: %s",
+                       e_error(client->event, "imap-urlauth-client: %s",
                                eacces_error_get("net_connect_unix",
                                                 socket_path));
                } else {
-                       i_error("imap-urlauth-client: net_connect_unix(%s) failed: %m",
+                       e_error(client->event, "imap-urlauth-client: "
+                               "net_connect_unix(%s) failed: %m",
                                socket_path);
                }
                return -1;
@@ -169,10 +170,10 @@ static int client_worker_connect(struct client *client)
 
        if (ret <= 0) {
                if (ret < 0) {
-                       i_error("fd_send(%s, %d) failed: %m",
+                       e_error(client->event, "fd_send(%s, %d) failed: %m",
                                socket_path, client->fd_ctrl);
                } else {
-                       i_error("fd_send(%s, %d) failed to send byte",
+                       e_error(client->event, "fd_send(%s, %d) failed to send byte",
                                socket_path, client->fd_ctrl);
                }
                client_worker_disconnect(client);
@@ -183,7 +184,8 @@ static int client_worker_connect(struct client *client)
 
        /* send protocol version handshake */
        if (o_stream_send_str(client->ctrl_output, handshake) < 0) {
-               i_error("Error sending handshake to imap-urlauth worker: %m");
+               e_error(client->event,
+                       "Error sending handshake to imap-urlauth worker: %m");
                client_worker_disconnect(client);
                return -1;
        }
@@ -331,7 +333,7 @@ void client_destroy(struct client *client, const char *reason)
        i_assert(reason != NULL || client->disconnected);
 
        if (!client->disconnected)
-               i_info("Disconnected: %s", reason);
+               e_info(client->event, "Disconnected: %s", reason);
 
        imap_urlauth_client_count--;
        DLLIST_REMOVE(&imap_urlauth_clients, client);
@@ -366,7 +368,7 @@ void client_disconnect(struct client *client, const char *reason)
                return;
 
        client->disconnected = TRUE;
-       i_info("Disconnected: %s", reason);
+       e_info(client->event, "Disconnected: %s", reason);
 
        client->to_idle = timeout_add(0, client_destroy_timeout, client);
 }
index 7f1e58235d6b0045e9ce8d739abfc475d99cc890..e917a5b8d3d76c41348b06bca7ac28fe4773ea1a 100644 (file)
@@ -55,7 +55,8 @@ static void imap_urlauth_client_handle_input(struct client *client)
 
                if (!version_string_verify(line, "imap-urlauth",
                                IMAP_URLAUTH_PROTOCOL_MAJOR_VERSION)) {
-                       i_error("IMAP URLAUTH client not compatible with this server "
+                       e_error(client->event,
+                               "IMAP URLAUTH client not compatible with this server "
                                "(mixed old and new binaries?) %s", line);
                        client_destroy(client, "Version mismatch");
                        return;
@@ -71,14 +72,16 @@ static void imap_urlauth_client_handle_input(struct client *client)
        args = t_strsplit_tabescaped(line);
        if (str_array_length(args) < AUTH_ARG_COUNT ||
            strcmp(args[0], "AUTH") != 0 || str_to_pid(args[2], &pid) < 0) {
-               i_error("IMAP URLAUTH client sent unexpected AUTH input: %s", line);
+               e_error(client->event,
+                       "IMAP URLAUTH client sent unexpected AUTH input: %s", line);
                client_destroy(client, "Unexpected input");
                return;
        }
 
        /* only imap and submission have direct access to urlauth service */
        if (strcmp(args[1], "imap") != 0 && strcmp(args[1], "submission") != 0) {
-               i_error("IMAP URLAUTH accessed from inappropriate service: %s", args[1]);
+               e_error(client->event,
+                       "IMAP URLAUTH accessed from inappropriate service: %s", args[1]);
                client_destroy(client, "Unexpected input");
                return;
        }
@@ -86,7 +89,8 @@ static void imap_urlauth_client_handle_input(struct client *client)
        /* verify session pid if possible */
        if (net_getunixcred(client->fd, &cred) == 0 &&
            cred.pid != (pid_t)-1 && pid != cred.pid) {
-               i_error("IMAP URLAUTH client sent invalid session pid %ld in AUTH request: "
+               e_error(client->event,
+                       "IMAP URLAUTH client sent invalid session pid %ld in AUTH request: "
                        "it did not match peer credentials (pid=%ld, uid=%ld)",
                        (long)pid, (long)cred.pid, (long)cred.uid);
                client_destroy(client, "Invalid AUTH request");