[IRC-Dev CVS] SF.net SVN: irc-dev:[197] ircd/trunk
Brought to you by:
zolty
From: <zo...@us...> - 2008-08-15 18:11:13
|
Revision: 197 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=197&view=rev Author: zolty Date: 2008-08-15 18:11:20 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Soporte de exempt en conexiones Modified Paths: -------------- ircd/trunk/include/ircd.h ircd/trunk/include/listener.h ircd/trunk/ircd/ircd.c ircd/trunk/ircd/ircd_lexer.l ircd/trunk/ircd/ircd_parser.y ircd/trunk/ircd/listener.c ircd/trunk/ircd/m_dbq.c Modified: ircd/trunk/include/ircd.h =================================================================== --- ircd/trunk/include/ircd.h 2008-08-15 12:57:37 UTC (rev 196) +++ ircd/trunk/include/ircd.h 2008-08-15 18:11:20 UTC (rev 197) @@ -80,5 +80,6 @@ extern int running; extern int maxconnections; extern int maxclients; +extern int refuse; #endif /* INCLUDED_ircd_h */ Modified: ircd/trunk/include/listener.h =================================================================== --- ircd/trunk/include/listener.h 2008-08-15 12:57:37 UTC (rev 196) +++ ircd/trunk/include/listener.h 2008-08-15 18:11:20 UTC (rev 197) @@ -53,6 +53,8 @@ LISTEN_HIDDEN, /** Port accepts only server connections. */ LISTEN_SERVER, + /** Port is exempt from connection prohibitions. */ + LISTEN_EXEMPT, /** Port listens for IPv4 connections. */ LISTEN_IPV4, /** Port listens for IPv6 connections. */ @@ -85,6 +87,7 @@ #define listener_server(LISTENER) FlagHas(&(LISTENER)->flags, LISTEN_SERVER) #define listener_active(LISTENER) FlagHas(&(LISTENER)->flags, LISTEN_ACTIVE) +#define listener_exempt(LISTENER) FlagHas(&(LISTENER)->flags, LISTEN_EXEMPT) #ifdef USE_SSL #define listener_ssl(LISTENER) FlagHas(&(LISTENER)->flags, LISTEN_SSL) #endif Modified: ircd/trunk/ircd/ircd.c =================================================================== --- ircd/trunk/ircd/ircd.c 2008-08-15 12:57:37 UTC (rev 196) +++ ircd/trunk/ircd/ircd.c 2008-08-15 18:11:20 UTC (rev 197) @@ -113,6 +113,7 @@ int debuglevel = -1; /**< Server debug level */ char *debugmode = ""; /**< Server debug level */ int maxconnections = MAXCONNECTIONS; /**< Maximum number of open files */ +int refuse = 0; /**< Refuse new connecting clients */ int maxclients = -1; /**< Maximum number of clients */ static char *dpath = DPATH; /**< Working directory for daemon */ static char *dbg_client; /**< Client specifier for chkconf */ Modified: ircd/trunk/ircd/ircd_lexer.l =================================================================== --- ircd/trunk/ircd/ircd_lexer.l 2008-08-15 12:57:37 UTC (rev 196) +++ ircd/trunk/ircd/ircd_lexer.l 2008-08-15 18:11:20 UTC (rev 197) @@ -122,6 +122,7 @@ DIRECTOP return DIRECTOP; DISPLAY return TPRIV_DISPLAY; DNS return DNS; +EXEMPT return EXEMPT; FAST return FAST; FEATURES return FEATURES; FILE return TFILE; Modified: ircd/trunk/ircd/ircd_parser.y =================================================================== --- ircd/trunk/ircd/ircd_parser.y 2008-08-15 12:57:37 UTC (rev 196) +++ ircd/trunk/ircd/ircd_parser.y 2008-08-15 18:11:20 UTC (rev 197) @@ -199,6 +199,7 @@ %token OPER %token VHOST %token HIDDEN +%token EXEMPT %token SSLPORT %token MOTD %token JUPE @@ -842,7 +843,7 @@ port = 0; }; portitems: portitem portitems | portitem; -portitem: portnumber | portvhost | portvhostnumber | portmask | portserver | porthidden | portssl; +portitem: portnumber | portvhost | portvhostnumber | portmask | portserver | porthidden | portexempt | portssl; portnumber: PORT '=' address_family NUMBER ';' { if ($4 < 1 || $4 > 65535) { @@ -900,6 +901,14 @@ FlagClr(&listen_flags, LISTEN_HIDDEN); }; +portexempt: EXEMPT '=' YES ';' +{ + FlagSet(&listen_flags, LISTEN_EXEMPT); +} | EXEMPT '=' NO ';' +{ + FlagClr(&listen_flags, LISTEN_EXEMPT); +}; + portssl: SSLPORT '=' YES ';' { #ifdef USE_SSL Modified: ircd/trunk/ircd/listener.c =================================================================== --- ircd/trunk/ircd/listener.c 2008-08-15 12:57:37 UTC (rev 196) +++ ircd/trunk/ircd/listener.c 2008-08-15 18:11:20 UTC (rev 197) @@ -161,6 +161,8 @@ continue; flags[len++] = 'H'; } + if (FlagHas(&listener->flags, LISTEN_EXEMPT)) + flags[len++] = 'X'; if (FlagHas(&listener->flags, LISTEN_IPV4)) { flags[len++] = '4'; @@ -501,7 +503,9 @@ if (fd >= maxclients) { ++ServerStats->is_ref; - send(fd, "ERROR :All connections in use\r\n", 32, 0); + /* 11111111112222222222 3 3 */ + /* 12345678901234567890123456789 0 1 */ + send(fd, "ERROR :All connections in use\r\n", 31, 0); close(fd); return; } @@ -513,6 +517,8 @@ if (!listener_active(listener)) { ++ServerStats->is_ref; + /* 11111111112222 2 2 */ + /* 12345678901234567890123 4 5 */ send(fd, "ERROR :Use another port\r\n", 25, 0); close(fd); continue; @@ -523,10 +529,24 @@ if (!ipmask_check(&addr.addr, &listener->mask, listener->mask_bits)) { ++ServerStats->is_ref; + /* 11111111112222 2 2 */ + /* 12345678901234567890123 4 5 */ send(fd, "ERROR :Use another port\r\n", 25, 0); close(fd); continue; } + /* + * check to see if server is shutting down. + */ + if (refuse && !listener_exempt(listener)) + { + ++ServerStats->is_ref; + /* 111111111122222222223 3 3 */ + /* 123456789012345678901234567890 1 2 */ + send(fd, "ERROR :Server is shutting down\r\n", 32, 0); + close(fd); + continue; + } ++ServerStats->is_ac; /* nextping = CurrentTime; */ #ifdef USE_SSL Modified: ircd/trunk/ircd/m_dbq.c =================================================================== --- ircd/trunk/ircd/m_dbq.c 2008-08-15 12:57:37 UTC (rev 196) +++ ircd/trunk/ircd/m_dbq.c 2008-08-15 18:11:20 UTC (rev 197) @@ -72,7 +72,7 @@ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Incorrect parameters. Format: DBQ [<server>] <Table> <Key>", sptr); - return need_more_params(sptr, "DBQ");; + return need_more_params(sptr, "DBQ"); } if (parc == 3) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |