Banning IPs at the World Server (Integrated into Rules)
I want to preface that I have not tested this code. I do believe that it will accomplish its goal (and I know that it compiles), but I don't have a dev server up to test it at the moment.
Give it a shot and let me know what you think. .\common\database.h Change: Code:
bool CheckNameFilter(const char* name); Code:
bool CheckNameFilter(const char* name); .\common\database.cpp After: Code:
int32 Database::CheckLogin(const char* name, const char* password, sint16* oStatus) { Code:
//Lieka Edit: Get Banned IP Address List - Only return false if the incoming connection's IP address is not present in the banned_ips table. After: Code:
case OP_EnterWorld: // Enter world Code:
//Lieka Edit Begin .\world\clientlist.h After: Code:
ClientListEntry* GetCLE(int32 iID); Code:
void RemoveBannedIPs(int32 bIP); //Lieka Edit .\world\clientlist.cpp After: Code:
ClientListEntry* ClientList::GetCLE(int32 iID) { Code:
//Lieka Edit Begin: Terminate all active sessions that exist with a banned IP. Code:
CREATE TABLE `Banned_IPs` ( Code:
Insert into rule_values values (0, 'World:UseBannedIPsTable', 0); World:UseBannedIPsTable = Toggle whether or not to check incoming client connections against the Banned_IPs table. Set this value to 0 to disable this feature. There is 1 table created from this: Banned_IPs = this table has 1 column "ip_address". Place IP addresses into this field that should be denied access to your server. If this code works well, I will create an in-game "#ipban <charname>" command to accompany it. Thanks, Dax |
very nice job, will let ya know how it works
|
heya Dax,
For this to work wouldn't you need to place this Code:
RULE_INT ( World, UseBannedIPsTable, 0 ) Please correct me if I'm wrong. |
You're right, it's in my code, but I missed it when I was doing my diff. Thanks Les.
Dax |
Updated: Banning IPs at the World Server (Integrated into Rules)
Ok, I apologize for letting these submissions sit here unfixed for a couple of weeks, but the good news is, I've had some time this week to make some necessary adjustments.
I basically completely reworked the way I was looking at IP banning - this way happens earlier and before the connection is added to the CLE, so it should be better for performance, etc (plus it actually works, where the other one didn't). Here's the run-down:
Let me know what you think. Required SQL: Code:
CREATE TABLE `banned_ips` ( Code:
diff C:/1106/zone/command.h C:/vztz/zone/command.h P.S. I would have just updated the thread in the submission forum, but it's locked. ;) |
Correction: Part of the MQWarp detector code got caught in the last diff. ;) Here's the diff without that part.
Code:
diff C:/1106/zone/command.h C:/vztz/zone/command.h |
Sorry, unlocked now and merged thread
|
Thanks Angelox.
|
This should magically appear in version 1116.
|
Slight delay here, there are some inconsistencies among the different versions of the code here. I tried to sort it out, but it would really help if someone has the working versions of the programs involved with this code in that I could work with...
|
I'm not quite sure what you're asking, but everything needed for this patch is in post 6. All of the code in posts above that are broken/obsolete and not needed. If that's not what you need, I apologize for the misunderstanding :)
EDIT: I should also note, some of the incorrect code from above is in the stock EQEmu source, and needs to be removed prior to updating us with the diff in post 6. |
Quote:
|
I have a diff worked out. The only problem is the format of world/clientlist.cpp is messed up, so when I edit I am unable to get a clean diff. When I work that out, I'll zip up the diff and the changed files and post.
|
Alright, this: http://projecteq.net/ipban.rar
Contains a diff of all required changes, as well as the changed files. As I said above, world/clientlist.cpp has corrupt line endings, so when I edit the file diff wants to remove and recreate the whole file, so I left it out of the diff. The file is in that package though, and the only change to clientlist.cpp is to find this block of code: Code:
//Lieka Edit Begin: Terminate all active sessions that exist with a banned IP. |
Updated code applied.
|
Quote:
|
All times are GMT -4. The time now is 04:58 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.