Author: soliton
Date: Fri Oct 3 05:26:52 2008
New Revision: 29821
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29821&view=rev
Log:
* use the ip_log only when banning simple usernames
Modified:
trunk/src/server/server.cpp
Modified: trunk/src/server/server.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/server.cpp?rev=29821&r1=29820&r2=29821&view=diff
==============================================================================
--- trunk/src/server/server.cpp (original)
+++ trunk/src/server/server.cpp Fri Oct 3 05:26:52 2008
@@ -1268,7 +1268,7 @@
if (utils::isvalid_username(parameters)) {
bool found = false;
for (wesnothd::player_map::const_iterator pl =
players_.begin(); pl != players_.end(); ++pl) {
- if (parameters == pl->second.name().c_str()) {
+ if (parameters == pl->second.name()) {
parameters =
network::ip_address(pl->first);
found = true;
break;
@@ -1367,14 +1367,16 @@
}
}
if (!banned) {
- // If nobody was banned yet look in the logs
- for (std::map<std::string,
std::string>::const_iterator i = ip_log_.begin();
- i != ip_log_.end(); i++) {
- if
(utils::wildcard_string_match(i->first, target)) {
- banned = true;
- if (!is_ip_banned(i->second)) {
- std::string err =
ban_manager_.ban(i->second,parsed_time, reason, issuer_name, group);
- out << err;
+ // If nobody was banned yet check the ip_log
but only if a
+ // simple username was used to prevent
accidental bans.
+ if (utils::isvalid_username(target)) {
+ for (std::map<std::string,
std::string>::const_iterator i = ip_log_.begin();
+ i != ip_log_.end();
i++) {
+ if (i->first == target) {
+ banned = true;
+ if
(!is_ip_banned(i->second)) {
+ out <<
ban_manager_.ban(i->second, parsed_time, reason, issuer_name, group, target);
+ }
}
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits