Skip to content

Commit

Permalink
auth: auth-client-connection: Log all errors via events
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and cmouse committed Mar 12, 2021
1 parent 19a40f3 commit 66ddc39
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/auth/auth-client-connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ auth_client_input_cpid(struct auth_client_connection *conn, const char *args)
i_assert(conn->pid == 0);

if (str_to_uint(args, &pid) < 0 || pid == 0) {
i_error("BUG: Authentication client said it's PID 0");
e_error(conn->event, "BUG: Authentication client said it's PID 0");
return FALSE;
}

Expand All @@ -129,7 +129,7 @@ auth_client_input_cpid(struct auth_client_connection *conn, const char *args)
}

if (old != NULL) {
i_error("BUG: Authentication client gave a PID "
e_error(conn->event, "BUG: Authentication client gave a PID "
"%u of existing connection", pid);
return FALSE;
}
Expand Down Expand Up @@ -201,7 +201,7 @@ auth_client_cancel(struct auth_client_connection *conn, const char *line)
unsigned int client_id;

if (str_to_uint(line, &client_id) < 0) {
i_error("BUG: Authentication client sent broken CANCEL");
e_error(conn->event, "BUG: Authentication client sent broken CANCEL");
return FALSE;
}

Expand Down Expand Up @@ -234,7 +234,7 @@ auth_client_handle_line(struct auth_client_connection *conn, const char *line)
return auth_client_cancel(conn, line + 7);
}

i_error("BUG: Authentication client sent unknown command: %s",
e_error(conn->event, "BUG: Authentication client sent unknown command: %s",
str_sanitize(line, 80));
return FALSE;
}
Expand All @@ -253,7 +253,7 @@ static void auth_client_input(struct auth_client_connection *conn)
return;
case -2:
/* buffer full */
i_error("BUG: Auth client %u sent us more than %d bytes",
e_error(conn->event, "BUG: Auth client %u sent us more than %d bytes",
conn->pid, (int)AUTH_CLIENT_MAX_LINE_LENGTH);
auth_client_connection_destroy(&conn);
return;
Expand All @@ -273,14 +273,14 @@ static void auth_client_input(struct auth_client_connection *conn)
if (!str_begins(line, "VERSION\t") ||
str_parse_uint(line + 8, &vmajor, &p) < 0 ||
*(p++) != '\t' || str_to_uint(p, &vminor) < 0) {
i_error("Authentication client "
e_error(conn->event, "Authentication client "
"sent invalid VERSION line: %s", line);
auth_client_connection_destroy(&conn);
return;
}
/* make sure the major version matches */
if (vmajor != AUTH_MASTER_PROTOCOL_MAJOR_VERSION) {
i_error("Authentication client "
e_error(conn->event, "Authentication client "
"not compatible with this server "
"(mixed old and new binaries?)");
auth_client_connection_destroy(&conn);
Expand All @@ -297,7 +297,7 @@ static void auth_client_input(struct auth_client_connection *conn)
return;
}
} else {
i_error("BUG: Authentication client sent "
e_error(conn->event, "BUG: Authentication client sent "
"unknown handshake command: %s",
str_sanitize(line, 80));
auth_client_connection_destroy(&conn);
Expand Down Expand Up @@ -412,7 +412,7 @@ static void auth_client_disconnected(struct auth_client_connection **_conn)
request_count = conn->request_handler == NULL ? 0 :
auth_request_handler_get_request_count(conn->request_handler);
if (request_count > 0) {
i_warning("auth client %u disconnected with %u "
e_error(conn->event, "auth client %u disconnected with %u "
"pending requests: %s", conn->pid, request_count,
err == 0 ? "EOF" : strerror(err));
}
Expand Down

0 comments on commit 66ddc39

Please sign in to comment.