Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5558:5c31d0c83258 HEAD
Log an error and disconnect with unknown commands.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 16 Apr 2007 21:02:02 +0300 |
parents | 657406346288 |
children | 12b3d542146c |
files | src/auth/auth-client-connection.c src/auth/auth-master-connection.c |
diffstat | 2 files changed, 19 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-client-connection.c Mon Apr 16 17:14:30 2007 +0300 +++ b/src/auth/auth-client-connection.c Mon Apr 16 21:02:02 2007 +0300 @@ -7,6 +7,7 @@ #include "network.h" #include "array.h" #include "str.h" +#include "str-sanitize.h" #include "safe-memset.h" #include "auth-request-handler.h" #include "auth-client-interface.h" @@ -182,10 +183,9 @@ line + 5); } - /* ignore unknown command */ - if (conn->auth->verbose_debug) - i_info("client in (unknown command): %s", line); - return TRUE; + i_error("BUG: Authentication client sent unknown command: %s", + str_sanitize(line, 80)); + return FALSE; } static void auth_client_input(struct auth_client_connection *conn) @@ -234,6 +234,12 @@ auth_client_connection_destroy(&conn); return; } + } else { + i_error("BUG: Authentication client sent " + "unknown handshake command: %s", + str_sanitize(line, 80)); + auth_client_connection_destroy(&conn); + return; } }
--- a/src/auth/auth-master-connection.c Mon Apr 16 17:14:30 2007 +0300 +++ b/src/auth/auth-master-connection.c Mon Apr 16 21:02:02 2007 +0300 @@ -5,6 +5,7 @@ #include "buffer.h" #include "hash.h" #include "str.h" +#include "str-sanitize.h" #include "ioloop.h" #include "istream.h" #include "ostream.h" @@ -193,9 +194,15 @@ ret = master_input_request(conn, line + 8); else if (strncmp(line, "USER\t", 5) == 0) ret = master_input_user(conn, line + 5); - else { + else if (strncmp(line, "CPID\t", 5) == 0) { + i_error("Authentication client trying to connect to " + "master socket"); + ret = FALSE; + } else { /* ignore unknown command */ - ret = TRUE; + i_error("BUG: Unknown command in master socket: %s", + str_sanitize(line, 80)); + ret = FALSE; } t_pop();