[Freeciv-Dev] (PR#15101) add more robust reject connection logging
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15101 >
attached for both stable and trunk. This standardizes the message and add
messages for all calls to reject_new_connection(). I'm committing this
real soon.
-mike
Index: server/connecthand.c
===================================================================
--- server/connecthand.c (revision 11427)
+++ server/connecthand.c (working copy)
@@ -242,8 +242,8 @@
if (!is_valid_username(req->username)) {
my_snprintf(msg, sizeof(msg), _("Invalid username '%s'"), req->username);
reject_new_connection(msg, pconn);
- freelog(LOG_NORMAL, _("Rejected connection from %s with invalid name."),
- pconn->addr);
+ freelog(LOG_NORMAL, _("%s was rejected: Invalid name [%s]."),
+ req->username, pconn->addr);
return FALSE;
}
@@ -253,9 +253,8 @@
my_snprintf(msg, sizeof(msg), _("'%s' already connected."),
req->username);
reject_new_connection(msg, pconn);
- freelog(LOG_NORMAL,
- _("Rejected connection from %s with duplicate login name."),
- aconn->addr);
+ freelog(LOG_NORMAL, _("%s was rejected: Duplicate login name [%s]."),
+ req->username, pconn->addr);
return FALSE;
}
} conn_list_iterate_end;
Index: server/auth.c
===================================================================
--- server/auth.c (revision 11427)
+++ server/auth.c (working copy)
@@ -141,6 +141,8 @@
} else {
reject_new_connection(_("Guests are not allowed on this server. "
"Sorry."), pconn);
+ freelog(LOG_NORMAL, _("%s was rejected: Guests not allowed."),
+ req->username);
return FALSE;
}
} else {
@@ -167,6 +169,9 @@
reject_new_connection(_("There was an error reading the user database "
"and guest logins are not allowed. Sorry"),
pconn);
+ freelog(LOG_NORMAL,
+ _("%s was rejected: Database error and guests not allowed."),
+ req->username);
return FALSE;
}
break;
@@ -188,6 +193,10 @@
} else {
reject_new_connection(_("This server allows only preregistered "
"users. Sorry."), pconn);
+ freelog(LOG_NORMAL,
+ _("%s was rejected: Only preregister users allowed."),
+ req->username);
+
return FALSE;
}
break;
@@ -214,6 +223,9 @@
if (!is_good_password(password, msg)) {
if (pconn->server.auth_tries++ >= MAX_AUTH_TRIES) {
reject_new_connection(_("Sorry, too many wrong tries..."), pconn);
+ freelog(LOG_NORMAL, _("%s was rejected: Too many wrong password "
+ "verifies for new user."), req->username);
+
return FALSE;
} else {
dsend_packet_authentication_req(pconn, AUTH_NEWUSER_RETRY, msg);
@@ -270,6 +282,9 @@
if (pconn->server.auth_tries >= MAX_AUTH_TRIES) {
pconn->server.status = AS_NOT_ESTABLISHED;
reject_new_connection(_("Sorry, too many wrong tries..."), pconn);
+ freelog(LOG_NORMAL,
+ _("%s was rejected: Too many wrong password tries."),
+ req->username);
close_connection(pconn);
} else {
struct packet_authentication_req request;
@@ -288,6 +303,10 @@
if (time(NULL) >= pconn->server.auth_settime + MAX_WAIT_TIME) {
pconn->server.status = AS_NOT_ESTABLISHED;
reject_new_connection(_("Sorry, your connection timed out..."), pconn);
+ freelog(LOG_NORMAL,
+ _("%s was rejected: Connection timeout waiting for password."),
+ req->username);
+
close_connection(pconn);
}
break;
- [Freeciv-Dev] (PR#15101) add more robust reject connection logging,
Mike Kaufman <=
|
|