From: Timo Sirainen Date: Thu, 27 Aug 2020 15:35:33 +0000 (+0300) Subject: lib-auth: Remove duplicate auth_client_connection.event X-Git-Tag: 2.3.13~262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01a112995ffe370c02f7d0763018e68982336f72;p=thirdparty%2Fdovecot%2Fcore.git lib-auth: Remove duplicate auth_client_connection.event It's already in auth_client_connection.conn.event. Just use it directly to avoid any confusion between them. --- diff --git a/src/lib-auth/auth-client-connection.c b/src/lib-auth/auth-client-connection.c index 2ecbb7b60d..472eba68c4 100644 --- a/src/lib-auth/auth-client-connection.c +++ b/src/lib-auth/auth-client-connection.c @@ -65,7 +65,7 @@ auth_server_input_mech(struct auth_client_connection *conn, struct auth_mech_desc mech_desc; if (args[0] == NULL) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server sent broken MECH line"); return -1; } @@ -101,7 +101,7 @@ auth_server_input_spid(struct auth_client_connection *conn, const char *const *args) { if (str_to_uint(args[0], &conn->server_pid) < 0) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server sent invalid PID"); return -1; } @@ -114,7 +114,7 @@ auth_server_input_cuid(struct auth_client_connection *conn, { if (args[0] == NULL || str_to_uint(args[0], &conn->connect_uid) < 0) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server sent broken CUID line"); return -1; } @@ -126,7 +126,7 @@ auth_server_input_cookie(struct auth_client_connection *conn, const char *const *args) { if (conn->cookie != NULL) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server already sent cookie"); return -1; } @@ -137,12 +137,12 @@ auth_server_input_cookie(struct auth_client_connection *conn, static int auth_server_input_done(struct auth_client_connection *conn) { if (array_count(&conn->available_auth_mechs) == 0) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server returned no mechanisms"); return -1; } if (conn->cookie == NULL) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server didn't send a cookie"); return -1; } @@ -163,7 +163,7 @@ auth_client_connection_handshake_line(struct connection *_conn, args[1] != NULL && args[2] != NULL) { if (str_to_uint(args[1], &major_version) < 0 || str_to_uint(args[2], &minor_version) < 0) { - e_error(conn->event, + e_error(conn->conn.event, "Auth server sent invalid version line: %s", line); return -1; @@ -188,7 +188,7 @@ auth_client_connection_handshake_line(struct connection *_conn, return auth_server_input_done(conn); } - e_error(conn->event, "Auth server sent unknown handshake: %s", line); + e_error(conn->conn.event, "Auth server sent unknown handshake: %s", line); return -1; } @@ -213,14 +213,14 @@ auth_server_lookup_request(struct auth_client_connection *conn, unsigned int id; if (id_arg == NULL || str_to_uint(id_arg, &id) < 0) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server input missing ID"); return -1; } request = hash_table_lookup(conn->requests, POINTER_CAST(id)); if (request == NULL) { - e_error(conn->event, + e_error(conn->conn.event, "Authentication server sent unknown id %u", id); return 0; } @@ -252,7 +252,7 @@ static int auth_server_input_cont(struct auth_client_connection *conn, int ret; if (str_array_length(args) < 2) { - e_error(conn->event, + e_error(conn->conn.event, "BUG: Authentication server sent broken CONT line"); return -1; } @@ -283,11 +283,11 @@ auth_client_connection_handle_line(struct auth_client_connection *conn, { const char *const *args; - e_debug(conn->event, "auth input: %s", line); + e_debug(conn->conn.event, "auth input: %s", line); args = t_strsplit_tabescaped(line); if (args[0] == NULL) { - e_error(conn->event, "Auth server sent empty line"); + e_error(conn->conn.event, "Auth server sent empty line"); return -1; } if (strcmp(args[0], "OK") == 0) @@ -297,7 +297,7 @@ auth_client_connection_handle_line(struct auth_client_connection *conn, else if (strcmp(args[0], "FAIL") == 0) return auth_server_input_fail(conn, args + 1); else { - e_error(conn->event, + e_error(conn->conn.event, "Auth server sent unknown response: %s", args[0]); return -1; } @@ -335,7 +335,6 @@ auth_client_connection_init(struct auth_client *client) conn->conn.event_parent = client->event; connection_init_client_unix(client->clist, &conn->conn, client->auth_socket_path); - conn->event = conn->conn.event; hash_table_create_direct(&conn->requests, pool, 100); i_array_init(&conn->available_auth_mechs, 8); @@ -373,7 +372,7 @@ auth_client_connection_remove_requests(struct auth_client_connection *conn, hash_table_clear(conn->requests, FALSE); if (request_count > 0) { - e_warning(conn->event, + e_warning(conn->conn.event, "Auth connection closed with %u pending requests " "(max %u secs, pid=%s, %s)", request_count, (unsigned int)(ioloop_time - oldest), @@ -419,7 +418,7 @@ static void auth_client_connection_destroy(struct connection *_conn) break; case CONNECTION_DISCONNECT_BUFFER_FULL: /* buffer full - can't happen unless auth is buggy */ - e_error(conn->event, + e_error(conn->conn.event, "BUG: Auth server sent us more than %d bytes of data", AUTH_SERVER_CONN_MAX_LINE_LENGTH); auth_client_connection_disconnect(conn, "Buffer full"); @@ -469,7 +468,7 @@ void auth_client_connection_deinit(struct auth_client_connection **_conn) static void auth_client_handshake_timeout(struct auth_client_connection *conn) { - e_error(conn->event, "Timeout waiting for handshake from auth server. " + e_error(conn->conn.event, "Timeout waiting for handshake from auth server. " "my pid=%u, input bytes=%"PRIuUOFF_T, conn->client->client_pid, conn->conn.input->v_offset); auth_client_connection_reconnect(conn, "auth server timeout"); @@ -499,11 +498,11 @@ int auth_client_connection_connect(struct auth_client_connection *conn) /* max. 1 second wait here. */ if (connection_client_connect(&conn->conn) < 0) { if (errno == EACCES) { - e_error(conn->event, "%s", + e_error(conn->conn.event, "%s", eacces_error_get("connect", conn->client->auth_socket_path)); } else { - e_error(conn->event, "connect(%s) failed: %m", + e_error(conn->conn.event, "connect(%s) failed: %m", conn->client->auth_socket_path); }; return -1; @@ -514,7 +513,7 @@ int auth_client_connection_connect(struct auth_client_connection *conn) AUTH_CLIENT_PROTOCOL_MINOR_VERSION, conn->client->client_pid); if (o_stream_send_str(conn->conn.output, handshake) < 0) { - e_warning(conn->event, + e_warning(conn->conn.event, "Error sending handshake to auth server: %s", o_stream_get_error(conn->conn.output)); auth_client_connection_disconnect(conn, diff --git a/src/lib-auth/auth-client-private.h b/src/lib-auth/auth-client-private.h index f7f8048d5a..36b24631ba 100644 --- a/src/lib-auth/auth-client-private.h +++ b/src/lib-auth/auth-client-private.h @@ -22,7 +22,6 @@ struct auth_client_request { struct auth_client_connection { struct connection conn; pool_t pool; - struct event *event; struct auth_client *client; time_t last_connect; diff --git a/src/lib-auth/auth-client-request.c b/src/lib-auth/auth-client-request.c index 50622d2480..629b77bcfa 100644 --- a/src/lib-auth/auth-client-request.c +++ b/src/lib-auth/auth-client-request.c @@ -353,7 +353,7 @@ void auth_client_send_cancel(struct auth_client *client, unsigned int id) const char *str = t_strdup_printf("CANCEL\t%u\n", id); if (o_stream_send_str(client->conn->conn.output, str) < 0) { - e_error(client->conn->event, + e_error(client->conn->conn.event, "Error sending request to auth server: %m"); } }