diff options
37 files changed, 36 insertions, 116 deletions
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp index 32dd865fe..7ac05fe86 100644 --- a/src/cmd_kline.cpp +++ b/src/cmd_kline.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_kline::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_map.cpp b/src/cmd_map.cpp index 4ada9a68d..1bf7095e8 100644 --- a/src/cmd_map.cpp +++ b/src/cmd_map.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_map::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp index 93908d21d..a38d5fd0f 100644 --- a/src/cmd_modules.cpp +++ b/src/cmd_modules.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; char* itab[] = { "OnUserConnect", "OnUserQuit", "OnUserDisconnect", "OnUserJoin", "OnUserPart", "OnRehash", "OnServerRaw", diff --git a/src/cmd_motd.cpp b/src/cmd_motd.cpp index e1193e40b..114fab33f 100644 --- a/src/cmd_motd.cpp +++ b/src/cmd_motd.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_motd::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_names.cpp b/src/cmd_names.cpp index 5bd7c8235..5c3d76e05 100644 --- a/src/cmd_names.cpp +++ b/src/cmd_names.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_names::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp index 7b4ea1e98..7c2f44b04 100644 --- a/src/cmd_nick.cpp +++ b/src/cmd_nick.cpp @@ -61,7 +61,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_nick::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp index 0f968e0db..0b17e1efb 100644 --- a/src/cmd_notice.cpp +++ b/src/cmd_notice.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_notice::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp index 8ca165fa7..335077750 100644 --- a/src/cmd_oper.cpp +++ b/src/cmd_oper.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_oper::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp index 4198d0be4..5479e72f6 100644 --- a/src/cmd_part.cpp +++ b/src/cmd_part.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_part::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_pass.cpp b/src/cmd_pass.cpp index 9bc6c1ae7..94241dca5 100644 --- a/src/cmd_pass.cpp +++ b/src/cmd_pass.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_pass::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_ping.cpp b/src/cmd_ping.cpp index 5447efbfc..9ff61f606 100644 --- a/src/cmd_ping.cpp +++ b/src/cmd_ping.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_ping::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_pong.cpp b/src/cmd_pong.cpp index b77c42f10..a9a443f6f 100644 --- a/src/cmd_pong.cpp +++ b/src/cmd_pong.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_pong::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp index 45a1e9dbc..82f8282b5 100644 --- a/src/cmd_privmsg.cpp +++ b/src/cmd_privmsg.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_privmsg::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp index 6f83be574..114525631 100644 --- a/src/cmd_quit.cpp +++ b/src/cmd_quit.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_quit::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp index 16fe3e058..693b8c99c 100644 --- a/src/cmd_rehash.cpp +++ b/src/cmd_rehash.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_rehash::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_restart.cpp b/src/cmd_restart.cpp index 48cf6e703..f7820187c 100644 --- a/src/cmd_restart.cpp +++ b/src/cmd_restart.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_restart::Handle (char **parameters, int pcnt, userrec *user) { @@ -85,7 +85,7 @@ void cmd_restart::Handle (char **parameters, int pcnt, userrec *user) // close ALL file descriptors send_error("Server restarting."); sleep(1); - for (int i = 0; i < 65536; i++) + for (int i = 0; i < MAX_DESCRIPTORS; i++) { shutdown(i,2); close(i); diff --git a/src/cmd_rules.cpp b/src/cmd_rules.cpp index d045bf210..7a435169b 100644 --- a/src/cmd_rules.cpp +++ b/src/cmd_rules.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_rules::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_server.cpp b/src/cmd_server.cpp index 264348ebb..e10a91b41 100644 --- a/src/cmd_server.cpp +++ b/src/cmd_server.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_server::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_squit.cpp b/src/cmd_squit.cpp index 6209081a3..81138bd7c 100644 --- a/src/cmd_squit.cpp +++ b/src/cmd_squit.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_squit::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index 00b7b2f47..33de60977 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -70,7 +70,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_stats::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_summon.cpp b/src/cmd_summon.cpp index 68b084781..3fbe19ac1 100644 --- a/src/cmd_summon.cpp +++ b/src/cmd_summon.cpp @@ -49,19 +49,6 @@ using namespace std; #include "command_parse.h" #include "cmd_summon.h" -extern ServerConfig* Config; -extern InspIRCd* ServerInstance; -extern int MODCOUNT; -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern time_t TIME; -extern user_hash clientlist; -extern chan_hash chanlist; -extern whowas_hash whowas; -extern std::vector<userrec*> all_opers; -extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; - void cmd_summon::Handle (char **parameters, int pcnt, userrec *user) { WriteServ(user->fd,"445 %s :SUMMON has been disabled (depreciated command)",user->nick); diff --git a/src/cmd_time.cpp b/src/cmd_time.cpp index 8da4a0486..dca93aadc 100644 --- a/src/cmd_time.cpp +++ b/src/cmd_time.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_time::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp index 644c9ccc3..d3377c33f 100644 --- a/src/cmd_topic.cpp +++ b/src/cmd_topic.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_topic::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp index e757896ae..7253931de 100644 --- a/src/cmd_trace.cpp +++ b/src/cmd_trace.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_trace::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_unloadmodule.cpp b/src/cmd_unloadmodule.cpp index 353933ef4..55f41bd4d 100644 --- a/src/cmd_unloadmodule.cpp +++ b/src/cmd_unloadmodule.cpp @@ -21,46 +21,21 @@ using namespace std; #include "inspircd_io.h" #include <time.h> #include <string> -#ifdef GCC3 -#include <ext/hash_map> -#else -#include <hash_map> -#endif -#include <map> -#include <sstream> -#include <vector> -#include <deque> #include "users.h" #include "ctables.h" #include "globals.h" #include "modules.h" #include "dynamic.h" -#include "wildcard.h" #include "message.h" #include "commands.h" -#include "mode.h" -#include "xline.h" #include "inspstring.h" -#include "dnsqueue.h" #include "helperfuncs.h" #include "hashcomp.h" #include "socketengine.h" #include "typedefs.h" -#include "command_parse.h" #include "cmd_unloadmodule.h" -extern ServerConfig* Config; extern InspIRCd* ServerInstance; -extern int MODCOUNT; -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern time_t TIME; -extern user_hash clientlist; -extern chan_hash chanlist; -extern whowas_hash whowas; -extern std::vector<userrec*> all_opers; -extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; void cmd_unloadmodule::Handle (char **parameters, int pcnt, userrec *user) { @@ -75,4 +50,3 @@ void cmd_unloadmodule::Handle (char **parameters, int pcnt, userrec *user) } } - diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp index 3d1754af3..96042898f 100644 --- a/src/cmd_user.cpp +++ b/src/cmd_user.cpp @@ -60,14 +60,13 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_user::Handle (char **parameters, int pcnt, userrec *user) { - log(DEBUG,"Handling USER from cmd_user class!"); if (user->registered < 3) { - if (isident(parameters[0]) == 0) { + if (!isident(parameters[0])) { // This kinda Sucks, According to the RFC thou, its either this, // or "You have already registered" :p -- Craig WriteServ(user->fd,"461 %s USER :Not enough parameters",user->nick); diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp index 07e2b1255..555aa1953 100644 --- a/src/cmd_userhost.cpp +++ b/src/cmd_userhost.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_userhost::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_users.cpp b/src/cmd_users.cpp index e7be615f4..118d3c64f 100644 --- a/src/cmd_users.cpp +++ b/src/cmd_users.cpp @@ -21,47 +21,16 @@ using namespace std; #include "inspircd_io.h" #include <time.h> #include <string> -#ifdef GCC3 -#include <ext/hash_map> -#else -#include <hash_map> -#endif -#include <map> -#include <sstream> -#include <vector> -#include <deque> #include "users.h" #include "ctables.h" #include "globals.h" -#include "modules.h" -#include "dynamic.h" -#include "wildcard.h" #include "message.h" #include "commands.h" -#include "mode.h" -#include "xline.h" -#include "inspstring.h" -#include "dnsqueue.h" #include "helperfuncs.h" #include "hashcomp.h" -#include "socketengine.h" #include "typedefs.h" -#include "command_parse.h" #include "cmd_users.h" -extern ServerConfig* Config; -extern InspIRCd* ServerInstance; -extern int MODCOUNT; -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern time_t TIME; -extern user_hash clientlist; -extern chan_hash chanlist; -extern whowas_hash whowas; -extern std::vector<userrec*> all_opers; -extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; - void cmd_users::Handle (char **parameters, int pcnt, userrec *user) { WriteServ(user->fd,"445 %s :USERS has been disabled (depreciated command)",user->nick); diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp index 8cd1c60c5..0b130b00f 100644 --- a/src/cmd_wallops.cpp +++ b/src/cmd_wallops.cpp @@ -49,18 +49,9 @@ using namespace std; #include "command_parse.h" #include "cmd_wallops.h" -extern ServerConfig* Config; -extern InspIRCd* ServerInstance; extern int MODCOUNT; extern std::vector<Module*> modules; extern std::vector<ircd_module*> factory; -extern time_t TIME; -extern user_hash clientlist; -extern chan_hash chanlist; -extern whowas_hash whowas; -extern std::vector<userrec*> all_opers; -extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; void cmd_wallops::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index bc3c090dd..1ce2564b8 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_who::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp index 9361fed39..6a6ccda5b 100644 --- a/src/cmd_whois.cpp +++ b/src/cmd_whois.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_whois::Handle (char **parameters, int pcnt, userrec *user) { diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp index 40f1488a0..408c697f2 100644 --- a/src/cmd_whowas.cpp +++ b/src/cmd_whowas.cpp @@ -60,7 +60,7 @@ extern chan_hash chanlist; extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> local_users; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; void cmd_whowas::Handle (char **parameters, int pcnt, userrec* user) { diff --git a/src/commands.cpp b/src/commands.cpp index 599ccdb80..d63d54584 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -87,7 +87,7 @@ extern std::vector<userrec*> local_users; // This table references users by file descriptor. // its an array to make it VERY fast, as all lookups are referenced // by an integer, meaning there is no need for a scan/search operation. -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; char* CleanFilename(char* name) { diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index fd39aa0b1..059f89be6 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -56,8 +56,8 @@ extern InspIRCd* ServerInstance; extern time_t TIME; extern char lowermap[255]; static char list[MAXBUF]; -extern userrec* fd_ref_table[65536]; -static char already_sent[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; +static char already_sent[MAX_DESCRIPTORS]; extern std::vector<userrec*> all_opers; extern user_hash clientlist; extern chan_hash chanlist; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 8f5c997ed..b690c2d87 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -83,7 +83,7 @@ time_t TIME = time(NULL), OLDTIME = time(NULL); // This table references users by file descriptor. // its an array to make it VERY fast, as all lookups are referenced // by an integer, meaning there is no need for a scan/search operation. -userrec* fd_ref_table[65536]; +userrec* fd_ref_table[MAX_DESCRIPTORS]; Server* MyServer = new Server; ServerConfig *Config = new ServerConfig; diff --git a/src/modules.cpp b/src/modules.cpp index 74e69d380..0706184d4 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -60,7 +60,7 @@ extern std::vector<InspSocket*> module_sockets; extern std::vector<userrec*> local_users; extern time_t TIME; class Server; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; extern user_hash clientlist; extern chan_hash chanlist; diff --git a/src/userprocess.cpp b/src/userprocess.cpp index c4541c29a..0d45c1f9c 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -72,7 +72,7 @@ extern std::vector<userrec*> local_users; extern InspIRCd* ServerInstance; extern ServerConfig *Config; -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; char data[65536]; extern user_hash clientlist; |