Thread: [IRC-Dev CVS] SF.net SVN: irc-dev:[195] ircd/trunk
Brought to you by:
zolty
From: <zo...@us...> - 2008-08-15 00:11:05
|
Revision: 195 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=195&view=rev Author: zolty Date: 2008-08-15 00:11:13 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Soporte completo Tabla F Modified Paths: -------------- ircd/trunk/TODO.es ircd/trunk/ircd/ddb_events.c ircd/trunk/ircd/ircd_features.c Modified: ircd/trunk/TODO.es =================================================================== --- ircd/trunk/TODO.es 2008-08-14 21:11:51 UTC (rev 194) +++ ircd/trunk/TODO.es 2008-08-15 00:11:13 UTC (rev 195) @@ -10,7 +10,6 @@ -------------------------------------------------------------------------------------- - [D] Implementar tabla o de Operadores - [D] Implementar tabla p de Privilegios - - [D] Implementar tabla f de Features ALTA PRIORIDAD -------------------------------------------------------------------------------------- Modified: ircd/trunk/ircd/ddb_events.c =================================================================== --- ircd/trunk/ircd/ddb_events.c 2008-08-14 21:11:51 UTC (rev 194) +++ ircd/trunk/ircd/ddb_events.c 2008-08-15 00:11:13 UTC (rev 195) @@ -30,6 +30,8 @@ #include "client.h" #include "hash.h" #include "ircd.h" +#include "ircd_alloc.h" +#include "ircd_chattr.h" #include "ircd_snprintf.h" #include "ircd_tea.h" #include "msg.h" @@ -37,6 +39,7 @@ #include "s_user.h" #include "send.h" +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -48,6 +51,7 @@ static void ddb_events_table_c(char *key, char *content, int update); static void ddb_events_table_d(char *key, char *content, int update); +static void ddb_events_table_f(char *key, char *content, int update); static void ddb_events_table_o(char *key, char *content, int update); static void ddb_events_table_n(char *key, char *content, int update); static void ddb_events_table_v(char *key, char *content, int update); @@ -69,6 +73,7 @@ ddb_events_table[DDB_CHANDB] = ddb_events_table_c; ddb_events_table[DDB_CHANDB2] = ddb_events_table_d; + ddb_events_table[DDB_FEATUREDB] = ddb_events_table_f; ddb_events_table[DDB_ILINEDB] = 0; ddb_events_table[DDB_NICKDB] = ddb_events_table_n; ddb_events_table[DDB_OPERDB] = ddb_events_table_o; @@ -231,6 +236,51 @@ #endif } +/** Handle events on Features Table. + * @param[in] key Key of registry. + * @param[in] content Content of registry. + * @param[in] update Update of registry or no. + */ +static void +ddb_events_table_f(char *key, char *content, int update) +{ + static char *keytemp = NULL; + static int key_len = 0; + int i = 0; + + if ((strlen(key) + 1 > key_len) || (!keytemp)) + { + key_len = strlen(key) + 1; + if (keytemp) + MyFree(keytemp); + keytemp = MyMalloc(key_len); + + assert(0 != keytemp); + } + strcpy(keytemp, key); + while (keytemp[i]) + { + keytemp[i] = ToUpper(keytemp[i]); + i++; + } + + if (content) + { + char *tempa[2]; + tempa[0] = keytemp; + tempa[1] = content; + + feature_set(&me, tempa, 2); + } + else + { + char *tempb[1]; + tempb[0] = keytemp; + + feature_set(&me, tempb, 1); + } +} + /** Handle events on Nick Table. * @param[in] key Key of registry. * @param[in] content Content of registry. Modified: ircd/trunk/ircd/ircd_features.c =================================================================== --- ircd/trunk/ircd/ircd_features.c 2008-08-14 21:11:51 UTC (rev 194) +++ ircd/trunk/ircd/ircd_features.c 2008-08-15 00:11:13 UTC (rev 195) @@ -315,6 +315,9 @@ #define FEAT_OPER 0x0100 /**< set to display only to opers */ #define FEAT_MYOPER 0x0200 /**< set to display only to local opers */ #define FEAT_NODISP 0x0400 /**< feature must never be displayed */ +#if defined(DDB) +#define FEAT_DDB 0x0800 /**< feature ajusted via DDB */ +#endif #define FEAT_READ 0x1000 /**< feature is read-only (for now, perhaps?) */ @@ -602,7 +605,16 @@ int i, change = 0, tmp; const char *t_str; struct FeatureDesc *feat; +#if defined(DDB) + int byddb = 0; + if (from == &me) + { + byddb = 1; + from = NULL; + } +#endif + if (from && !HasPriv(from, PRIV_SET)) return send_reply(from, ERR_NOPRIVILEGES); @@ -612,6 +624,22 @@ else log_write(LS_CONFIG, L_ERROR, 0, "Not enough fields in F line"); } else if ((feat = feature_desc(from, fields[0]))) { /* find feature */ +#if defined(DDB) + if (byddb) + { + if (count < 2) + feat->flags &= ~FEAT_DDB; + else + feat->flags |= FEAT_DDB; + + } else if (feat->flags & FEAT_DDB) { + if (from) { + sendcmdto_one(&me, CMD_NOTICE, from, "%C :The feature has been setted by DDB", from); + send_reply(from, ERR_NOFEATURE, fields[0]); + } + return 0; + } +#endif if (from && feat->flags & FEAT_READ) return send_reply(from, ERR_NOFEATURE, fields[0]); @@ -767,6 +795,16 @@ if (count < 1) /* check arguments */ need_more_params(from, "RESET"); else if ((feat = feature_desc(from, fields[0]))) { /* get descriptor */ +#if defined(DDB) + if (feat->flags & FEAT_DDB) { + if (from) { + sendcmdto_one(&me, CMD_NOTICE, from, "%C :The feature has been setted by DDB", from); + send_reply(from, ERR_NOFEATURE, fields[0]); + } + return 0; + } +#endif + if (from && feat->flags & FEAT_READ) return send_reply(from, ERR_NOFEATURE, fields[0]); @@ -878,6 +916,10 @@ int i; for (i = 0; features[i].type; i++) { +#if defined(DDB) + if (features[i].flags & FEAT_DDB) + continue; +#endif features[i].flags &= ~FEAT_MARK; /* clear the marks... */ if (features[i].unmark) /* call the unmark callback if necessary */ (*features[i].unmark)(); @@ -893,6 +935,11 @@ for (i = 0; features[i].type; i++) { change = 0; +#if defined(DDB) + if (features[i].flags & FEAT_DDB) + continue; +#endif + switch (feat_type(&features[i])) { case FEAT_NONE: if (features[i].mark && @@ -984,25 +1031,61 @@ case FEAT_INT: /* Report an F-line with integer values */ +#if defined(DDB) + if (features[i].flags & FEAT_DDB) { + send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %d (setted by DDB)", + features[i].type, features[i].v_int); + break; + } else if (features[i].flags & FEAT_MARK) /* it's been changed */ +#else if (features[i].flags & FEAT_MARK) /* it's been changed */ +#endif send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %d", features[i].type, features[i].v_int); break; case FEAT_UINT: /* Report an F-line with unsigned values */ +#if defined(DDB) + if (features[i].flags & FEAT_DDB) { + send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %u (setted by DDB)", + features[i].type, features[i].v_int); + break; + } else if (features[i].flags & FEAT_MARK) /* it's been changed */ +#else if (features[i].flags & FEAT_MARK) /* it's been changed */ +#endif send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %u", features[i].type, features[i].v_int); break; case FEAT_BOOL: /* Report an F-line with boolean values */ +#if defined(DDB) + if (features[i].flags & FEAT_DDB) { + send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %s (setted by DDB)", + features[i].type, features[i].v_int ? "TRUE" : "FALSE"); + break; + } else if (features[i].flags & FEAT_MARK) /* it's been changed */ +#else if (features[i].flags & FEAT_MARK) /* it's been changed */ +#endif send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %s", features[i].type, features[i].v_int ? "TRUE" : "FALSE"); break; case FEAT_STR: /* Report an F-line with string values */ +#if defined(DDB) + if (features[i].flags & FEAT_DDB) { + if (features[i].v_str) + send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %s (setted by DDB)", + features[i].type, features[i].v_str); + else + send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s (setted by DDB)", + features[i].type); + break; + } else if (features[i].flags & FEAT_MARK) { /* it's been changed */ +#else if (features[i].flags & FEAT_MARK) { /* it's been changed */ +#endif if (features[i].v_str) send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %s", features[i].type, features[i].v_str); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <zo...@us...> - 2008-08-15 18:53:59
|
Revision: 198 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=198&view=rev Author: zolty Date: 2008-08-15 18:54:05 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Soporte de RESTART/DIE diferido Modified Paths: -------------- ircd/trunk/include/ircd.h ircd/trunk/include/send.h ircd/trunk/ircd/ddb.c ircd/trunk/ircd/engine_devpoll.c ircd/trunk/ircd/engine_epoll.c ircd/trunk/ircd/engine_kqueue.c ircd/trunk/ircd/engine_poll.c ircd/trunk/ircd/engine_select.c ircd/trunk/ircd/ircd.c ircd/trunk/ircd/ircd_signal.c ircd/trunk/ircd/m_die.c ircd/trunk/ircd/m_restart.c ircd/trunk/ircd/send.c Modified: ircd/trunk/include/ircd.h =================================================================== --- ircd/trunk/include/ircd.h 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/include/ircd.h 2008-08-15 18:54:05 UTC (rev 198) @@ -45,6 +45,15 @@ int pid_fd; /**< File descriptor for process id file. */ }; +/** Describes pending exit. */ +struct PendingExit +{ + int restart; /**< Pending exit is for a restart. */ + char* who; /**< Who initiated the exit. */ + char* message; /**< Message to emit. */ + time_t time; /**< Absolute time at which to exit. */ +}; + /* * Macros */ @@ -61,13 +70,21 @@ #define MAJOR_PROTOCOL "10" /**< Current protocol version. */ #define BASE_VERSION "u2.10" /**< Base name of IRC daemon version. */ +#define PEND_INT_LONG 300 /**< Length of long message interval. */ +#define PEND_INT_MEDIUM 60 /**< Length of medium message interval. */ +#define PEND_INT_SHORT 30 /**< Length of short message interval. */ +#define PEND_INT_END 10 /**< Length of the end message interval. */ +#define PEND_INT_LAST 1 /**< Length of last message interval. */ + /* * Proto types */ -extern void server_die(const char* message); extern void server_panic(const char* message); -extern void server_restart(const char* message); +extern void exit_cancel(struct Client *who); +extern void exit_schedule(int restart, time_t when, struct Client *who, + const char *message); + extern struct Client me; extern time_t CurrentTime; extern struct Client* GlobalClientList; Modified: ircd/trunk/include/send.h =================================================================== --- ircd/trunk/include/send.h 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/include/send.h 2008-08-15 18:54:05 UTC (rev 198) @@ -139,4 +139,7 @@ unsigned int mask, time_t *rate, const char *pattern, ...); +/* Send server notice to all local users */ +extern void sendto_lusers(const char *pattern, ...); + #endif /* INCLUDED_send_h */ Modified: ircd/trunk/ircd/ddb.c =================================================================== --- ircd/trunk/ircd/ddb.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/ddb.c 2008-08-15 18:54:05 UTC (rev 198) @@ -244,6 +244,7 @@ sendto_opmask(0, SNO_OLDSNO, "Lo: %d Hashtable_Lo: %d Hi: %d Hashtable_Hi %d", lo, ddb_hashtable_lo[table], hi, ddb_hashtable_hi[table]); +#if 0 if ((ddb_hashtable_hi[table] != hi) || (ddb_hashtable_lo[table] != lo)) { struct DLink *lp; @@ -266,6 +267,7 @@ } } else +#endif { ddb_db_hash_write(table); @@ -744,7 +746,7 @@ else if (IsServer(acptr)) sendcmdto_one(&me, CMD_ERROR, acptr, ":Terminated by %s", exitmsg); } - server_die(exitmsg); + exit_schedule(0, 0, 0, exitmsg); } /** Finalizes the %DDB subsystem. Modified: ircd/trunk/ircd/engine_devpoll.c =================================================================== --- ircd/trunk/ircd/engine_devpoll.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/engine_devpoll.c 2008-08-15 18:54:05 UTC (rev 198) @@ -316,7 +316,7 @@ timer_add(timer_init(&clear_error), error_clear, 0, TT_PERIODIC, ERROR_EXPIRE_TIME); else if (errors > DEVPOLL_ERROR_THRESHOLD) /* too many errors... */ - server_restart("too many /dev/poll errors"); + exit_schedule(1, 0, 0, ""too many /dev/poll errors"); } /* old code did a sleep(1) here; with usage these days, * that may be too expensive Modified: ircd/trunk/ircd/engine_epoll.c =================================================================== --- ircd/trunk/ircd/engine_epoll.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/engine_epoll.c 2008-08-15 18:54:05 UTC (rev 198) @@ -278,7 +278,7 @@ timer_add(timer_init(&clear_error), error_clear, 0, TT_PERIODIC, ERROR_EXPIRE_TIME); else if (errors > EPOLL_ERROR_THRESHOLD) - server_restart("too many epoll errors"); + exit_schedule(1, 0, 0, "too many epoll errors"); } continue; } Modified: ircd/trunk/ircd/engine_kqueue.c =================================================================== --- ircd/trunk/ircd/engine_kqueue.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/engine_kqueue.c 2008-08-15 18:54:05 UTC (rev 198) @@ -345,7 +345,7 @@ timer_add(timer_init(&clear_error), error_clear, 0, TT_PERIODIC, ERROR_EXPIRE_TIME); else if (errors > KQUEUE_ERROR_THRESHOLD) /* too many errors... */ - server_restart("too many kevent errors"); + exit_schedule(1, 0, 0, "too many kevent errors"); } /* old code did a sleep(1) here; with usage these days, * that may be too expensive Modified: ircd/trunk/ircd/engine_poll.c =================================================================== --- ircd/trunk/ircd/engine_poll.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/engine_poll.c 2008-08-15 18:54:05 UTC (rev 198) @@ -303,7 +303,7 @@ timer_add(timer_init(&clear_error), error_clear, 0, TT_PERIODIC, ERROR_EXPIRE_TIME); else if (errors > POLL_ERROR_THRESHOLD) /* too many errors... */ - server_restart("too many poll errors"); + exit_schedule(1, 0, 0, "too many poll errors"); } /* old code did a sleep(1) here; with usage these days, * that may be too expensive Modified: ircd/trunk/ircd/engine_select.c =================================================================== --- ircd/trunk/ircd/engine_select.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/engine_select.c 2008-08-15 18:54:05 UTC (rev 198) @@ -296,7 +296,7 @@ timer_add(timer_init(&clear_error), error_clear, 0, TT_PERIODIC, ERROR_EXPIRE_TIME); else if (errors > SELECT_ERROR_THRESHOLD) /* too many errors... */ - server_restart("too many select errors"); + exit_schedule(1, 0, 0, "too many select errors"); } /* old code did a sleep(1) here; with usage these days, * that may be too expensive Modified: ircd/trunk/ircd/ircd.c =================================================================== --- ircd/trunk/ircd/ircd.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/ircd.c 2008-08-15 18:54:05 UTC (rev 198) @@ -40,6 +40,7 @@ #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_signal.h" +#include "ircd_snprintf.h" #include "ircd_string.h" #include "jupe.h" #include "list.h" @@ -121,6 +122,7 @@ static struct Timer connect_timer; /**< timer structure for try_connections() */ static struct Timer ping_timer; /**< timer structure for check_pings() */ static struct Timer destruct_event_timer; /**< timer structure for exec_expired_destruct_events() */ +static struct Timer countdown_timer; /**< timer structure for exit_countdown() */ /** Daemon information. */ static struct Daemon thisServer = { 0, 0, 0, 0, 0, 0, -1 }; @@ -129,83 +131,290 @@ int running = 1; -/*---------------------------------------------------------------------------- - * API: server_die - *--------------------------------------------------------------------------*/ -/** Terminate the server with a message. - * @param[in] message Message to log and send to operators. +/** + * Perform a restart or die, sending and logging all necessary messages. + * @param[in] pe Pointer to structure describing pending exit. */ -void server_die(const char *message) +static void pending_exit(struct PendingExit *pe) { - /* log_write will send out message to both log file and as server notice */ - log_write(LS_SYSTEM, L_CRIT, 0, "Server terminating: %s", message); + static int looping = 0; + enum LogLevel level = pe->restart ? L_WARNING : L_CRIT; + const char *what = pe->restart ? "restarting" : "terminating"; + + if (looping++) /* increment looping to prevent looping */ + return; + + if (pe->message) { + sendto_lusers("Server %s: %s", what, pe->message); + + if (pe->who) { /* write notice to log */ + log_write(LS_SYSTEM, level, 0, "%s %s server: %s", pe->who, what, + pe->message); + sendcmdto_serv(&me, CMD_SQUIT, 0, "%s 0 :%s %s server: %s", + cli_name(&me), pe->who, what, pe->message); + } else { + log_write(LS_SYSTEM, level, 0, "Server %s: %s", what, pe->message); + sendcmdto_serv(&me, CMD_SQUIT, 0, "%s 0 :Server %s: %s", + cli_name(&me), what, pe->message); + } + } else { /* just notify of the restart/termination */ + sendto_lusers("Server %s...", what); + + if (pe->who) { /* write notice to log */ + log_write(LS_SYSTEM, level, 0, "%s %s server...", pe->who, what); + sendcmdto_serv(&me, CMD_SQUIT, 0, "%s 0 :%s %s server...", + cli_name(&me), pe->who, what); + } else { + log_write(LS_SYSTEM, level, 0, "Server %s...", what); + sendcmdto_serv(&me, CMD_SQUIT, 0, "%s 0 :Server %s...", + cli_name(&me), what); + } + } + + /* now let's perform the restart or exit */ flush_connections(0); - close_connections(1); - running = 0; - + #if defined(DDB) ddb_end(); #endif + + log_close(); + close_connections(!pe->restart || + !(thisServer.bootopt & (BOOT_TTY | BOOT_DEBUG | BOOT_CHKCONF))); + + if (!pe->restart) { /* just set running = 0 */ + running = 0; + return; + } + + /* OK, so we're restarting... */ + reap_children(); + + execv(SPATH, thisServer.argv); /* restart the server */ + + /* something failed; reopen the logs so we can complain */ + log_reopen(); + + log_write(LS_SYSTEM, L_CRIT, 0, "execv(%s,%s) failed: %m", SPATH, + *thisServer.argv); + + Debug((DEBUG_FATAL, "Couldn't restart server \"%s\": %s", SPATH, + (strerror(errno)) ? strerror(errno) : "")); + exit(8); } -/*---------------------------------------------------------------------------- - * API: server_panic - *--------------------------------------------------------------------------*/ -/** Immediately terminate the server with a message. - * @param[in] message Message to log, but not send to operators. +/** + * Issue server notice warning about impending restart or die. + * @param[in] pe Pointer to structure describing pending exit. + * @param[in] until How long until the exit (approximately). */ -void server_panic(const char *message) +static void countdown_notice(struct PendingExit *pe, time_t until) { - /* inhibit sending server notice--we may be panicking due to low memory */ - log_write(LS_SYSTEM, L_CRIT, LOG_NOSNOTICE, "Server panic: %s", message); - flush_connections(0); - log_close(); - close_connections(1); - exit(1); + const char *what = pe->restart ? "restarting" : "terminating"; + const char *units; + + if (until >= 60) { /* measure in minutes */ + until /= 60; /* so convert it to minutes */ + units = (until == 1) ? "minute" : "minutes"; + } else + units = (until == 1) ? "second" : "seconds"; + + /* send the message */ + if (pe->message) + sendto_lusers("Server %s in %d %s: %s", what, until, units, pe->message); + else + sendto_lusers("Server %s in %d %s...", what, until, units); +} + +static void exit_countdown(struct Event *ev); + +/** + * Performs a delayed pending exit, issuing server notices as appropriate. + * Reschedules exit_countdown() as needed. + * @param[in] ev Timer event. + */ +static void _exit_countdown(struct PendingExit *pe, int do_notice) +{ + time_t total, next, approx; + + if (CurrentTime >= pe->time) { /* time to do the exit */ + pending_exit(pe); + return; + } + + /* OK, we need to figure out how long to the next message and approximate + * how long until the actual exit. + */ + total = pe->time - CurrentTime; /* how long until exit */ + +#define t_adjust(interval, interval2) \ + do { \ + approx = next = total - (total % (interval)); \ + if (next >= total - (interval2)) { \ + next -= (interval); /* have to adjust next... */ \ + if (next < (interval)) /* slipped into next interval */ \ + next = (interval) - (interval2); \ + } else /* have to adjust approx... */ \ + approx += (interval); \ + } while (0) + + if (total > PEND_INT_LONG) /* in the long interval regime */ + t_adjust(PEND_INT_LONG, PEND_INT_MEDIUM); + else if (total > PEND_INT_MEDIUM) /* in the medium interval regime */ + t_adjust(PEND_INT_MEDIUM, PEND_INT_SHORT); + else if (total > PEND_INT_SHORT) /* in the short interval regime */ + t_adjust(PEND_INT_SHORT, PEND_INT_END); + else if (total > PEND_INT_END) /* in the end interval regime */ + t_adjust(PEND_INT_END, PEND_INT_LAST); + else if (total > PEND_INT_LAST) /* in the last message interval */ + t_adjust(PEND_INT_LAST, PEND_INT_LAST); + else { /* next event is to actually exit */ + next = 0; + approx = PEND_INT_LAST; + } + + /* convert next to an absolute timestamp */ + next = pe->time - next; + assert(next > CurrentTime); + + /* issue the warning notices... */ + if (do_notice) + countdown_notice(pe, approx); + + /* reschedule the timer... */ + timer_add(&countdown_timer, exit_countdown, pe, TT_ABSOLUTE, next); } -/*---------------------------------------------------------------------------- - * API: server_restart - *--------------------------------------------------------------------------*/ -/** Restart the server with a message. - * @param[in] message Message to log and send to operators. +/** + * Timer callback for _exit_countdown(). + * @param[in] ev Timer event. */ -void server_restart(const char *message) +static void exit_countdown(struct Event *ev) { - static int restarting = 0; + if (ev_type(ev) == ET_DESTROY) + return; /* do nothing with destroy events */ + + assert(ET_EXPIRE == ev_type(ev)); + + /* perform the event we were called to do */ + _exit_countdown(t_data(&countdown_timer), 1); +} - /* inhibit sending any server notices; we may be in a loop */ - log_write(LS_SYSTEM, L_WARNING, LOG_NOSNOTICE, "Restarting Server: %s", - message); - if (restarting++) /* increment restarting to prevent looping */ - return; +/** + * Cancel a pending exit. + * @param[in] who Client cancelling the impending exit. + */ +void exit_cancel(struct Client *who) +{ + const char *what; + struct PendingExit *pe; - sendto_opmask(0, SNO_OLDSNO, "Restarting server: %s", message); - Debug((DEBUG_NOTICE, "Restarting server...")); - flush_connections(0); + if (!t_onqueue(&countdown_timer)) + return; /* it's not running... */ + + pe = t_data(&countdown_timer); /* get the pending exit data */ + timer_del(&countdown_timer); /* delete the timer */ -#if defined(DDB) - ddb_end(); -#endif + if (who) { /* explicitly issued cancellation */ + /* issue a notice about the exit being canceled */ + sendto_lusers("Server %s CANCELED", + what = (pe->restart ? "restart" : "termination")); + + /* log the cancellation */ + if (IsUser(who)) + log_write(LS_SYSTEM, L_NOTICE, 0, "Server %s CANCELED by %s!%s@%s", what, + cli_name(who), cli_user(who)->username, cli_sockhost(who)); + else + log_write(LS_SYSTEM, L_NOTICE, 0, "Server %s CANCELED by %s", what, + cli_name(who)); + } + + /* release the pending exit structure */ + if (pe->who) + MyFree(pe->who); + if (pe->message) + MyFree(pe->message); + MyFree(pe); - log_close(); + /* Oh, and restore connections */ + refuse = 0; +} - close_connections(!(thisServer.bootopt & (BOOT_TTY | BOOT_DEBUG | BOOT_CHKCONF))); +/** + * Schedule a pending exit. Note that only real people issue delayed + * exits, so \a who should not be NULL if \a when is non-zero. + * @param[in] restart True if a restart is desired, false otherwise. + * @param[in] when Interval until the exit; 0 for immediate exit. + * @param[in] who Client issuing exit (or NULL). + * @param[in] message Message explaining exit. + */ +void exit_schedule(int restart, time_t when, struct Client *who, + const char *message) +{ + struct PendingExit *pe; - reap_children(); + /* first, let's cancel any pending exit */ + exit_cancel(0); + + /* now create a new pending exit */ + pe = MyMalloc(sizeof(struct PendingExit)); + pe->restart = restart; + + pe->time = when + CurrentTime; /* make time absolute */ + if (who) { /* save who issued it... */ + if (IsUser(who)) { + char nuhbuf[NICKLEN + USERLEN + HOSTLEN + 3]; + ircd_snprintf(0, nuhbuf, sizeof(nuhbuf), "%s!%s@%s", cli_name(who), + cli_user(who)->username, cli_sockhost(who)); + DupString(pe->who, nuhbuf); + } else + DupString(pe->who, cli_name(who)); + } else + pe->who = 0; + if (message) /* also save the message */ + DupString(pe->message, message); + else + pe->message = 0; - execv(SPATH, thisServer.argv); + /* let's refuse new connections... */ + refuse = 1; + + if (!when) { /* do it right now? */ + pending_exit(pe); + return; + } - /* Have to reopen since it has been closed above */ - log_reopen(); + assert(who); /* only people issue delayed exits */ + + /* issue a countdown notice... */ + countdown_notice(pe, when); - log_write(LS_SYSTEM, L_CRIT, 0, "execv(%s,%s) failed: %m", SPATH, - *thisServer.argv); - - Debug((DEBUG_FATAL, "Couldn't restart server \"%s\": %s", - SPATH, (strerror(errno)) ? strerror(errno) : "")); - exit(8); + /* log who issued the shutdown */ + if (pe->message) + log_write(LS_SYSTEM, L_NOTICE, 0, "Delayed server %s issued by %s: %s", + restart ? "restart" : "termination", pe->who, pe->message); + else + log_write(LS_SYSTEM, L_NOTICE, 0, "Delayed server %s issued by %s...", + restart ? "restart" : "termination", pe->who); + /* and schedule the timer */ + _exit_countdown(pe, 0); } + +/*---------------------------------------------------------------------------- + * API: server_panic + *--------------------------------------------------------------------------*/ +/** Immediately terminate the server with a message. + * @param[in] message Message to log, but not send to operators. + */ +void server_panic(const char *message) +{ + /* inhibit sending server notice--we may be panicking due to low memory */ + log_write(LS_SYSTEM, L_CRIT, LOG_NOSNOTICE, "Server panic: %s", message); + flush_connections(0); + log_close(); + close_connections(1); + exit(1); +} /*---------------------------------------------------------------------------- @@ -214,7 +423,7 @@ /** Handle out-of-memory condition. */ static void outofmemory(void) { Debug((DEBUG_FATAL, "Out of memory: restarting server...")); - server_restart("Out of Memory"); + exit_schedule(1, 0, 0, "Out of Memory"); } @@ -767,6 +976,7 @@ timer_add(timer_init(&connect_timer), try_connections, 0, TT_RELATIVE, 1); timer_add(timer_init(&ping_timer), check_pings, 0, TT_RELATIVE, 1); timer_add(timer_init(&destruct_event_timer), exec_expired_destruct_events, 0, TT_PERIODIC, 60); + timer_init(&countdown_timer); CurrentTime = time(NULL); Modified: ircd/trunk/ircd/ircd_signal.c =================================================================== --- ircd/trunk/ircd/ircd_signal.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/ircd_signal.c 2008-08-15 18:54:05 UTC (rev 198) @@ -89,7 +89,7 @@ assert(SIGTERM == sig_signal(ev_signal(ev))); assert(SIGTERM == ev_data(ev)); - server_die("received signal SIGTERM"); + exit_schedule(0, 0, 0, "Received signal SIGTERM"); } /** Signal callback for SIGHUP. @@ -116,7 +116,7 @@ assert(SIGINT == sig_signal(ev_signal(ev))); assert(SIGINT == ev_data(ev)); - server_restart("caught signal: SIGINT"); + exit_schedule(1, 0, 0, "Received signal SIGINT"); } /** Allocate a child callback record. Modified: ircd/trunk/ircd/m_die.c =================================================================== --- ircd/trunk/ircd/m_die.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/m_die.c 2008-08-15 18:54:05 UTC (rev 198) @@ -68,7 +68,7 @@ sendcmdto_one(&me, CMD_ERROR, acptr, ":Terminated by %s", get_client_name(sptr, HIDE_IP)); } - server_die("received DIE"); + exit_schedule(0, 0, 0, "Received DIE"); return 0; } Modified: ircd/trunk/ircd/m_restart.c =================================================================== --- ircd/trunk/ircd/m_restart.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/m_restart.c 2008-08-15 18:54:05 UTC (rev 198) @@ -52,7 +52,7 @@ return send_reply(sptr, ERR_NOPRIVILEGES); log_write(LS_SYSTEM, L_NOTICE, 0, "Server RESTART by %#C", sptr); - server_restart("received RESTART"); + exit_schedule(1, 0, 0, "Received RESTART"); return 0; } Modified: ircd/trunk/ircd/send.c =================================================================== --- ircd/trunk/ircd/send.c 2008-08-15 18:11:20 UTC (rev 197) +++ ircd/trunk/ircd/send.c 2008-08-15 18:54:05 UTC (rev 198) @@ -895,3 +895,32 @@ msgq_clean(mb); } + +/** Send a server notice to all local users on this server. + * @param[in] pattern Format string for server notice. + */ +void sendto_lusers(const char *pattern, ...) +{ + struct VarData vd; + struct Client *cptr; + struct MsgBuf *mb; + int i; + + /* Build the message we're going to send... */ + vd.vd_format = pattern; + va_start(vd.vd_args, pattern); + mb = msgq_make(0, ":%s " MSG_NOTICE " * :*** Notice -- %v", cli_name(&me), + &vd); + va_end(vd.vd_args); + + /* send it along */ + for (i = 0; i <= HighestFd; i++) { + if (!(cptr = LocalClientArray[i]) || !IsUser(cptr)) + continue; /* skip empty slots... */ + + send_buffer(cptr, mb, 1); /* send with high priority */ + } + + msgq_clean(mb); /* clean up after ourselves */ +} + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-08-15 20:04:08
|
Revision: 199 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=199&view=rev Author: zolty Date: 2008-08-15 20:04:12 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Soporte de REHASH, RESTART y DIE remotos Modified Paths: -------------- ircd/trunk/include/handlers.h ircd/trunk/include/ircd_features.h ircd/trunk/include/msg.h ircd/trunk/ircd/ircd_features.c ircd/trunk/ircd/m_die.c ircd/trunk/ircd/m_rehash.c ircd/trunk/ircd/m_restart.c ircd/trunk/ircd/parse.c Modified: ircd/trunk/include/handlers.h =================================================================== --- ircd/trunk/include/handlers.h 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/include/handlers.h 2008-08-15 20:04:12 UTC (rev 199) @@ -205,6 +205,7 @@ extern int ms_dbq(struct Client*, struct Client*, int, char*[]); extern int ms_destruct(struct Client*, struct Client*, int, char*[]); extern int ms_desynch(struct Client*, struct Client*, int, char*[]); +extern int ms_die(struct Client*, struct Client*, int, char*[]); extern int ms_end_of_burst(struct Client*, struct Client*, int, char*[]); extern int ms_end_of_burst_ack(struct Client*, struct Client*, int, char*[]); extern int ms_error(struct Client*, struct Client*, int, char*[]); @@ -230,6 +231,8 @@ extern int ms_privmsg(struct Client*, struct Client*, int, char*[]); extern int ms_privs(struct Client*, struct Client*, int, char*[]); extern int ms_quit(struct Client*, struct Client*, int, char*[]); +extern int ms_rehash(struct Client*, struct Client*, int, char*[]); +extern int ms_restart(struct Client*, struct Client*, int, char*[]); extern int ms_rping(struct Client*, struct Client*, int, char*[]); extern int ms_rpong(struct Client*, struct Client*, int, char*[]); extern int ms_server(struct Client*, struct Client*, int, char*[]); Modified: ircd/trunk/include/ircd_features.h =================================================================== --- ircd/trunk/include/ircd_features.h 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/include/ircd_features.h 2008-08-15 20:04:12 UTC (rev 199) @@ -203,6 +203,11 @@ FEAT_SPAM_JOINED_TIME, FEAT_SPAM_FJP_COUNT, + /* Really special features (tm) */ + FEAT_NETWORK_REHASH, + FEAT_NETWORK_RESTART, + FEAT_NETWORK_DIE, + #if 1 /* TRANSICION IRC-HISPANO */ FEAT_TRANSICION_HISPANO, #endif Modified: ircd/trunk/include/msg.h =================================================================== --- ircd/trunk/include/msg.h 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/include/msg.h 2008-08-15 20:04:12 UTC (rev 199) @@ -268,11 +268,11 @@ #define CMD_SERVSET MSG_SERVSET, TOK_SERVSET #define MSG_REHASH "REHASH" /* REHA */ -#define TOK_REHASH "REHASH" +#define TOK_REHASH "RH" #define CMD_REHASH MSG_REHASH, TOK_REHASH #define MSG_RESTART "RESTART" /* REST */ -#define TOK_RESTART "RESTART" +#define TOK_RESTART "RS" #define CMD_RESTART MSG_RESTART, TOK_RESTART #define MSG_CLOSE "CLOSE" /* CLOS */ @@ -280,7 +280,7 @@ #define CMD_CLOSE MSG_CLOSE, TOK_CLOSE #define MSG_DIE "DIE" /* DIE */ -#define TOK_DIE "DIE" +#define TOK_DIE "DI" #define CMD_DIE MSG_DIE, TOK_DIE #define MSG_HASH "HASH" /* HASH */ Modified: ircd/trunk/ircd/ircd_features.c =================================================================== --- ircd/trunk/ircd/ircd_features.c 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/ircd/ircd_features.c 2008-08-15 20:04:12 UTC (rev 199) @@ -535,6 +535,11 @@ F_I(SPAM_JOINED_TIME, 0, 60, 0), F_I(SPAM_FJP_COUNT, 0, 5, 0), + /* Really special features (tm) */ + F_B(NETWORK_REHASH, 0, 0, 0), + F_B(NETWORK_RESTART, 0, 0, 0), + F_B(NETWORK_DIE, 0, 0, 0), + #if 1 /* TRANSICION IRC-HISPANO */ F_B(TRANSICION_HISPANO, 0, 1, 0), #endif Modified: ircd/trunk/ircd/m_die.c =================================================================== --- ircd/trunk/ircd/m_die.c 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/ircd/m_die.c 2008-08-15 20:04:12 UTC (rev 199) @@ -27,6 +27,7 @@ #include "client.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" @@ -34,15 +35,69 @@ #include "numeric.h" #include "numnicks.h" #include "s_bsd.h" +#include "s_user.h" #include "send.h" /* #include <assert.h> -- Now using assert in ircd_log.h */ +/** Handle a DIE message from a server connection. + * + * \a parv has the following elements: + * \li \a parv[1] is the target server, or "*" for all. + * \li \a parv[2] is either "cancel" or a time interval in seconds + * \li \a parv[\a parc - 1] is the reason + * + * All fields must be present. Additionally, the time interval should + * not be 0 for messages sent to "*", as that may not function + * reliably due to buffering in the server. + * + * See @ref m_functions for discussion of the arguments. + * @param[in] cptr Client that sent us the message. + * @param[in] sptr Original source of message. + * @param[in] parc Number of arguments. + * @param[in] parv Argument vector. +*/ +int ms_die(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + const char *target, *when, *reason; + + if (parc < 4) + return need_more_params(sptr, "DIE"); + + target = parv[1]; + when = parv[2]; + reason = parv[parc - 1]; + + /* is it a message we should pay attention to? */ + if (target[0] != '*' || target[1] != '\0') { + if (hunt_server_cmd(sptr, CMD_DIE, cptr, 0, "%C %s :%s", 1, parc, parv) + != HUNTED_ISME) + return 0; + } else /* must forward the message */ + sendcmdto_serv(sptr, CMD_DIE, cptr, "* %s :%s", when, reason); + + /* OK, the message has been forwarded, but before we can act... */ + if (!feature_bool(FEAT_NETWORK_DIE)) + return 0; + + /* is it a cancellation? */ + if (!ircd_strcmp(when, "cancel")) + exit_cancel(sptr); /* cancel a pending exit */ + else /* schedule an exit */ + exit_schedule(0, atoi(when), sptr, reason); + + return 0; +} + /** Handle a DIE message from an operator. * - * \a parv is ignored. + * \a parv has the following elements: + * \li \a parv[1] is either "cancel" or a time interval in seconds + * \li \a parv[\a parc - 1] is the reason * + * Either the time interval or the reason (or both) may be omitted. + * * See @ref m_functions for discussion of the arguments. * @param[in] cptr Client that sent us the message. * @param[in] sptr Original source of message. @@ -51,23 +106,22 @@ */ int mo_die(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - struct Client *acptr; - int i; + time_t when = 0; + const char *reason = 0; if (!HasPriv(sptr, PRIV_DIE)) return send_reply(sptr, ERR_NOPRIVILEGES); - for (i = 0; i <= HighestFd; i++) - { - if (!(acptr = LocalClientArray[i])) - continue; - if (IsUser(acptr)) - sendcmdto_one(&me, CMD_NOTICE, acptr, "%C :Server Terminating. %s", - acptr, get_client_name(sptr, HIDE_IP)); - else if (IsServer(acptr)) - sendcmdto_one(&me, CMD_ERROR, acptr, ":Terminated by %s", - get_client_name(sptr, HIDE_IP)); - } + if (parc > 1 && !ircd_strcmp(parv[1], "cancel")) { + exit_cancel(sptr); /* cancel a pending exit */ + return 0; + } else if (parc > 2) { /* have both time and reason */ + when = atoi(parv[1]); + reason = parv[parc - 1]; + } else if (parc > 1 && !(when = atoi(parv[1]))) + reason = parv[parc - 1]; + + /* now, let's schedule the exit */ exit_schedule(0, 0, 0, "Received DIE"); return 0; Modified: ircd/trunk/ircd/m_rehash.c =================================================================== --- ircd/trunk/ircd/m_rehash.c 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/ircd/m_rehash.c 2008-08-15 20:04:12 UTC (rev 199) @@ -27,17 +27,92 @@ #include "client.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "motd.h" +#include "msg.h" #include "numeric.h" #include "s_conf.h" +#include "s_user.h" #include "send.h" #include "ssl.h" /* #include <assert.h> -- Now using assert in ircd_log.h */ +/** Handle a REHASH message from a server connection. + * + * \a parv has the following elements: + * \li \a parv[1] is the target server, or "*" for all. + * \li \a parv[2] (optional) is a flag indicating what to rehash + * + * The following flags are recognized: + * \li 'm' flushes the MOTD cache + * \li 'l' reopens the log files + * \li 's' reopens SSL pem file + * \li 'q' reloads the configuration file but does not rehash the DNS + * resolver + * \li the default is to reload the configuration file and restart the + * DNS resolver + * + * See @ref m_functions for discussion of the arguments. + * @param[in] cptr Client that sent us the message. + * @param[in] sptr Original source of message. + * @param[in] parc Number of arguments. + * @param[in] parv Argument vector. + */ +int ms_rehash(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + int flag = 0; + const char *target; + + if (parc < 2) + return need_more_params(sptr, "REHASH"); + + target = parv[1]; + + /* is it a message we should pay attention to? */ + if (target[0] != '*' || target[1] != '\0') { + if (hunt_server_cmd(sptr, CMD_REHASH, cptr, 0, parc > 2 ? "%C %s" : "%C", + 1, parc, parv) + != HUNTED_ISME) + return 0; + } else if (parc > 2) /* must forward the message with flags */ + sendcmdto_serv(sptr, CMD_REHASH, cptr, "* %s", parv[2]); + else /* just have to forward the message */ + sendcmdto_serv(sptr, CMD_REHASH, cptr, "*"); + + /* OK, the message has been forwarded, but before we can act... */ + if (!feature_bool(FEAT_NETWORK_REHASH)) + return 0; + + if (parc > 2) { /* special processing */ + if (*parv[2] == 'm') { + send_reply(sptr, SND_EXPLICIT | RPL_REHASHING, ":Flushing MOTD cache"); + motd_recache(); /* flush MOTD cache */ + return 0; + } else if (*parv[2] == 'l') { + send_reply(sptr, SND_EXPLICIT | RPL_REHASHING, ":Reopening log files"); + log_reopen(); /* reopen log files */ + return 0; +#ifdef USE_SSL + } else if (*parv[1] == 's') { + send_reply(sptr, SND_EXPLICIT | RPL_REHASHING, ":Reopening SSL pem file"); + ssl_init(); + return 0; +#endif + } else if (*parv[2] == 'q') + flag = 2; + } + + send_reply(sptr, RPL_REHASHING, configfile); + sendto_opmask(0, SNO_OLDSNO, "%C is rehashing Server config file", sptr); + log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr); + + return rehash(cptr, flag); +} + /** Handle a REHASH message from an operator connection. * * \a parv has the following elements: Modified: ircd/trunk/ircd/m_restart.c =================================================================== --- ircd/trunk/ircd/m_restart.c 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/ircd/m_restart.c 2008-08-15 20:04:12 UTC (rev 199) @@ -27,19 +27,76 @@ #include "client.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" +#include "msg.h" #include "numeric.h" #include "numnicks.h" +#include "s_user.h" #include "send.h" /* #include <assert.h> -- Now using assert in ircd_log.h */ + +/** Handle a RESTART message from a server connection. + * + * \a parv has the following elements: + * \li \a parv[1] is the target server, or "*" for all. + * \li \a parv[2] is either "cancel" or a time interval in seconds + * \li \a parv[\a parc - 1] is the reason + * + * All fields must be present. Additionally, the time interval should + * not be 0 for messages sent to "*", as that may not function + * reliably due to buffering in the server. + * + * See @ref m_functions for discussion of the arguments. + * @param[in] cptr Client that sent us the message. + * @param[in] sptr Original source of message. + * @param[in] parc Number of arguments. + * @param[in] parv Argument vector. + */ +int ms_restart(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + const char *target, *when, *reason; + + if (parc < 4) + return need_more_params(sptr, "RESTART"); + + target = parv[1]; + when = parv[2]; + reason = parv[parc - 1]; + + /* is it a message we should pay attention to? */ + if (target[0] != '*' || target[1] != '\0') { + if (hunt_server_cmd(sptr, CMD_RESTART, cptr, 0, "%C %s :%s", 1, parc, parv) + != HUNTED_ISME) + return 0; + } else /* must forward the message */ + sendcmdto_serv(sptr, CMD_RESTART, cptr, "* %s :%s", when, reason); + + /* OK, the message has been forwarded, but before we can act... */ + if (!feature_bool(FEAT_NETWORK_RESTART)) + return 0; + + /* is it a cancellation? */ + if (!ircd_strcmp(when, "cancel")) + exit_cancel(sptr); /* cancel a pending exit */ + else /* schedule an exit */ + exit_schedule(1, atoi(when), sptr, reason); + + return 0; +} + /** Handle a RESTART message from an operator connection. * - * \a parv is ignored. + * \a parv has the following elements: + * \li \a parv[1] is either "cancel" or a time interval in seconds + * \li \a parv[\a parc - 1] is the reason * + * Either the time interval or the reason (or both) may be omitted. + * * See @ref m_functions for discussion of the arguments. * @param[in] cptr Client that sent us the message. * @param[in] sptr Original source of message. @@ -48,11 +105,23 @@ */ int mo_restart(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { + time_t when = 0; + const char *reason = 0; + if (!HasPriv(sptr, PRIV_RESTART)) return send_reply(sptr, ERR_NOPRIVILEGES); - log_write(LS_SYSTEM, L_NOTICE, 0, "Server RESTART by %#C", sptr); - exit_schedule(1, 0, 0, "Received RESTART"); + if (parc > 1 && !ircd_strcmp(parv[1], "cancel")) { + exit_cancel(sptr); /* cancel a pending exit */ + return 0; + } else if (parc > 2) { /* have both time and reason */ + when = atoi(parv[1]); + reason = parv[parc - 1]; + } else if (parc > 1 && !(when = atoi(parv[1]))) + reason = parv[parc - 1]; + /* now, let's schedule the exit */ + exit_schedule(1, when, sptr, reason); + return 0; } Modified: ircd/trunk/ircd/parse.c =================================================================== --- ircd/trunk/ircd/parse.c 2008-08-15 18:54:05 UTC (rev 198) +++ ircd/trunk/ircd/parse.c 2008-08-15 20:04:12 UTC (rev 199) @@ -559,21 +559,21 @@ TOK_REHASH, 0, MAXPARA, MFLG_SLOW, 0, NULL, /* UNREG, CLIENT, SERVER, OPER, SERVICE */ - { m_unregistered, m_not_oper, m_ignore, mo_rehash, m_ignore } + { m_unregistered, m_not_oper, ms_rehash, mo_rehash, m_ignore } }, { MSG_RESTART, TOK_RESTART, 0, MAXPARA, MFLG_SLOW, 0, NULL, /* UNREG, CLIENT, SERVER, OPER, SERVICE */ - { m_unregistered, m_not_oper, m_ignore, mo_restart, m_ignore } + { m_unregistered, m_not_oper, ms_restart, mo_restart, m_ignore } }, { MSG_DIE, TOK_DIE, 0, MAXPARA, MFLG_SLOW, 0, NULL, /* UNREG, CLIENT, SERVER, OPER, SERVICE */ - { m_unregistered, m_not_oper, m_ignore, mo_die, m_ignore } + { m_unregistered, m_not_oper, ms_die, mo_die, m_ignore } }, { MSG_PROTO, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-08-15 20:28:35
|
Revision: 200 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=200&view=rev Author: zolty Date: 2008-08-15 20:28:43 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Sincronizacion Undernet y fix esteticos Modified Paths: -------------- ircd/trunk/include/channel.h ircd/trunk/include/client.h ircd/trunk/ircd/channel.c Modified: ircd/trunk/include/channel.h =================================================================== --- ircd/trunk/include/channel.h 2008-08-15 20:04:12 UTC (rev 199) +++ ircd/trunk/include/channel.h 2008-08-15 20:28:43 UTC (rev 200) @@ -101,6 +101,9 @@ /* Channel Visibility macros */ +#if defined(DDB) || defined(SERVICES) +#define MODE_OWNER CHFL_OWNER /**< +q Channel owner */ +#endif #define MODE_CHANOP CHFL_CHANOP /**< +o Chanop */ #define MODE_VOICE CHFL_VOICE /**< +v Voice */ #define MODE_PRIVATE 0x0004 /**< +p Private */ @@ -114,13 +117,10 @@ #define MODE_LIMIT 0x0400 /**< +l Limit */ #define MODE_REGONLY 0x0800 /**< +R Only +r users may join */ #define MODE_DELJOINS 0x1000 /**< New join messages are delayed */ -#define MODE_NOCOLOUR 0x2000 /**< No mIRC/ANSI colors/bold */ -#define MODE_NOCTCP 0x4000 /**< No channel CTCPs */ -#define MODE_NONOTICE 0x8000 /**< No channel notices */ -#if defined(DDB) || defined(SERVICES) -#define MODE_REGCHAN 0x10000 /**< +r Channel registered */ -#define MODE_OWNER CHFL_OWNER /**< +q Channel owner */ -#endif +#define MODE_REGISTERED 0x2000 /**< Channel marked as registered */ +#define MODE_NOCOLOUR 0x4000 /**< No mIRC/ANSI colors/bold */ +#define MODE_NOCTCP 0x8000 /**< No channel CTCPs */ +#define MODE_NONOTICE 0x10000 /**< No channel notices */ #define MODE_SAVE 0x20000 /**< save this mode-with-arg 'til * later */ #define MODE_FREE 0x40000 /**< string needs to be passed to @@ -142,7 +142,7 @@ #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS) /** Available Channel modes */ -#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDcCNuM" : "biklmnopstvrDcCNuM" +#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDRcCNuM" : "biklmnopstvrDRcCNuM" /** Available Channel modes that take parameters */ #define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "AbkloUv" : "bklov" #elif defined(DDB) || defined(SERVICES) @@ -160,7 +160,7 @@ #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT) /** Available Channel modes */ -#define infochanmodes "biklmnopstvrDcCNuM" +#define infochanmodes "biklmnopstvrDRcCNuM" /** Available Channel modes that take parameters */ #define infochanmodeswithparams "bklov" #endif Modified: ircd/trunk/include/client.h =================================================================== --- ircd/trunk/include/client.h 2008-08-15 20:04:12 UTC (rev 199) +++ ircd/trunk/include/client.h 2008-08-15 20:28:43 UTC (rev 200) @@ -73,9 +73,9 @@ /** String containing valid user modes, in no particular order. */ #if defined(DDB) || defined(SERVICES) -#define infousermodes "dioswkgxrRachBSZ" +#define infousermodes "dioOswkgxrRachBSZ" #else -#define infousermodes "dioswkgxRZ" +#define infousermodes "dioOswkgxRZ" #endif /** Operator privileges. */ @@ -548,10 +548,10 @@ /** Return non-zero if the client is an IRC operator (global or local). */ #if defined(DDB) -#define IsAnOper(x) (HasFlag(x, FLAG_OPER) || HasFlag(x, FLAG_LOCOP) || HasFlag(x, FLAG_ADMIN) || \ - HasFlag(x, FLAG_CODER) || HasFlag(x, FLAG_HELPOPER) || HasFlag(x, FLAG_BOT)) +#define IsAnOper(x) (IsOper(x) || IsLocOp(x) || IsAdmin(x) || \ + IsCoder(x) || IsHelpOper(x) || IsBot(x)) #else -#define IsAnOper(x) (HasFlag(x, FLAG_OPER) || HasFlag(x, FLAG_LOCOP)) +#define IsAnOper(x) (IsOper(x) || IsLocOp(x)) #endif /** Return non-zero if the client's connection is blocked. */ #define IsBlocked(x) HasFlag(x, FLAG_BLOCKED) @@ -577,7 +577,7 @@ /** Return non-zero if the client caused a net.burst. */ #define IsJunction(x) HasFlag(x, FLAG_JUNCTION) /** Return non-zero if the client has set mode +O (local operator). */ -#define IsLocOp(x) HasFlag(x, FLAG_LOCOP) +#define IsLocOp(x) (MyUser(x) && HasFlag(x, FLAG_LOCOP)) /** Return non-zero if the client has set mode +o (global operator). */ #define IsOper(x) HasFlag(x, FLAG_OPER) /** Return non-zero if the client has an active UDP ping request. */ Modified: ircd/trunk/ircd/channel.c =================================================================== --- ircd/trunk/ircd/channel.c 2008-08-15 20:04:12 UTC (rev 199) +++ ircd/trunk/ircd/channel.c 2008-08-15 20:28:43 UTC (rev 200) @@ -329,7 +329,7 @@ #elif defined(DDB) chptr->users = 0; - if (!(chptr->mode.mode & MODE_REGCHAN)) + if (!(chptr->mode.mode & MODE_REGISTERED)) destruct_channel(chptr); #else @@ -864,14 +864,11 @@ *mbuf++ = 'i'; if (chptr->mode.mode & MODE_NOPRIVMSGS) *mbuf++ = 'n'; + if (chptr->mode.mode & MODE_REGONLY) #if defined(UNDERNET) - if (chptr->mode.mode & MODE_REGONLY) *mbuf++ = 'r'; #elif defined(DDB) || defined(SERVICES) - if (chptr->mode.mode & MODE_REGCHAN) - *mbuf++ = 'r'; - if (chptr->mode.mode & MODE_REGONLY) - *mbuf++ = 'R'; + *mbuf++ = 'R'; #endif if (chptr->mode.mode & MODE_NOCOLOUR) *mbuf++ = 'c'; @@ -881,12 +878,18 @@ *mbuf++ = 'N'; if (chptr->mode.mode & MODE_NOQUITPARTS) *mbuf++ = 'u'; + if (chptr->mode.mode & MODE_MODERATENOREG) + *mbuf++ = 'M'; if (chptr->mode.mode & MODE_DELJOINS) *mbuf++ = 'D'; - if (chptr->mode.mode & MODE_MODERATENOREG) - *mbuf++ = 'M'; else if (MyUser(cptr) && (chptr->mode.mode & MODE_WASDELJOINS)) *mbuf++ = 'd'; + if (chptr->mode.mode & MODE_REGISTERED) +#if defined(UNDERNET) + *mbuf++ = 'R'; +#elif defined(DDB) || defined(SERVICES) + *mbuf++ = 'r'; +#endif if (chptr->mode.limit) { *mbuf++ = 'l'; ircd_snprintf(0, pbuf, buflen, "%u", chptr->mode.limit); @@ -1705,9 +1708,10 @@ MODE_INVITEONLY, 'i', MODE_NOPRIVMSGS, 'n', #if defined(UNDERNET) + MODE_REGISTERED, 'R', MODE_REGONLY, 'r', #elif defined(DDB) || defined(SERVICES) - MODE_REGCHAN, 'r', + MODE_REGISTERED, 'r', MODE_REGONLY, 'R', /* MODE_OWNER, 'q', */ #endif @@ -2222,12 +2226,9 @@ mode &= (MODE_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET | MODE_MODERATED | MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_REGONLY | -#if defined(DDB) || defined(SERVICES) - MODE_REGCHAN | -#endif MODE_NOCTCP | MODE_NONOTICE | MODE_NOQUITPARTS | MODE_NOCOLOUR | MODE_MODERATENOREG | - MODE_DELJOINS | MODE_WASDELJOINS); + MODE_DELJOINS | MODE_WASDELJOINS | MODE_REGISTERED); if (!(mode & ~(MODE_ADD | MODE_DEL))) /* don't add empty modes... */ return; @@ -2380,9 +2381,10 @@ /* MODE_BAN, 'b', */ MODE_LIMIT, 'l', #if defined(UNDERNET) + MODE_REGISTERED, 'R' MODE_REGONLY, 'r', #elif defined(DDB) || defined(SERVICES) - MODE_REGCHAN, 'r', + MODE_REGISTERED, 'r', MODE_REGONLY, 'R', /* MODE_OWNER, 'q', */ #endif @@ -3495,6 +3497,13 @@ if (!state->mbuf) return; + +#if defined(UNDERNET) + /* Local users are not permitted to change registration status */ + if (flag_p[0] == MODE_REGISTERED && !(state->flags & MODE_PARSE_FORCE) && + MyUser(state->sptr)) + return; +#endif if (state->dir == MODE_ADD) { state->add |= flag_p[0]; @@ -3544,10 +3553,11 @@ MODE_BAN, 'b', MODE_LIMIT, 'l', #if defined(UNDERNET) + MODE_REGISTERED, 'R', MODE_REGONLY, 'r', #elif defined(DDB) || defined(SERVICES) MODE_OWNER, 'q', - MODE_REGCHAN, 'r', + MODE_REGISTERED, 'r', MODE_REGONLY, 'R', #endif MODE_DELJOINS, 'D', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-08-15 20:42:56
|
Revision: 201 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=201&view=rev Author: zolty Date: 2008-08-15 20:43:04 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Transicion RENAME a SVSNICK Modified Paths: -------------- ircd/trunk/include/msg.h ircd/trunk/ircd/m_svsnick.c ircd/trunk/ircd/parse.c Modified: ircd/trunk/include/msg.h =================================================================== --- ircd/trunk/include/msg.h 2008-08-15 20:28:43 UTC (rev 200) +++ ircd/trunk/include/msg.h 2008-08-15 20:43:04 UTC (rev 201) @@ -389,9 +389,15 @@ #define MSG_SVSNICK "SVSNICK" /* SVSN */ #define TOK_SVSNICK "SN" #define CMD_SVSNICK MSG_SVSNICK, TOK_SVSNICK +#if 1 /* TRANSICION IRC-HISPANO */ +#define MSG_RENAME "RENAME" /* SVSN */ +#define TOK_RENAME "RENAME" +#define CMD_RENAME MSG_RENAME, TOK_RENAME +#endif + /* * Constants */ Modified: ircd/trunk/ircd/m_svsnick.c =================================================================== --- ircd/trunk/ircd/m_svsnick.c 2008-08-15 20:28:43 UTC (rev 200) +++ ircd/trunk/ircd/m_svsnick.c 2008-08-15 20:43:04 UTC (rev 201) @@ -66,8 +66,18 @@ assert(0 != IsServer(cptr)); - if (parc < 2) +#if 1 /* TRANSICION IRC-HISPANO */ + if (parc == 2) + { + parv[2] = "*"; + parc = 3; + } + else if (parc < 2) return 0; +#else + if (parc < 3) + return 0; +#endif if (!cli_uworld(sptr)) { @@ -78,7 +88,11 @@ return 0; } +#if 1 /* TRANSICION IRC-HISPANO */ + sendcmdto_serv(sptr, feature_bool(FEAT_TRANSICION_HISPANO) ? CMD_RENAME : CMD_SVSNICK, cptr, "%s :%s", parv[1], parv[2]); +#else sendcmdto_serv(sptr, CMD_SVSNICK, cptr, "%s :%s", parv[1], parv[2]); +#endif acptr = findNUser(parv[1]); Modified: ircd/trunk/ircd/parse.c =================================================================== --- ircd/trunk/ircd/parse.c 2008-08-15 20:28:43 UTC (rev 200) +++ ircd/trunk/ircd/parse.c 2008-08-15 20:43:04 UTC (rev 201) @@ -678,6 +678,15 @@ /* UNREG, CLIENT, SERVER, OPER, SERVICE */ { m_ignore, m_ignore, ms_svsnick, m_ignore, m_ignore } }, +#if 1 /* TRANSICION IRC-HISPANO */ + { + "RENAME", + "RENAME", + 0, MAXPARA, MFLG_SLOW, 0, NULL, + /* UNREG, CLIENT, SERVER, OPER, SERVICE */ + { m_ignore, m_ignore, ms_svsnick, m_ignore, m_ignore } + }, +#endif #endif /* This command is an alias for QUIT during the unregistered part of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-08-24 18:50:41
|
Revision: 206 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=206&view=rev Author: zolty Date: 2008-08-24 18:50:51 +0000 (Sun, 24 Aug 2008) Log Message: ----------- Auto usermode al conectar Modified Paths: -------------- ircd/trunk/include/ircd_features.h ircd/trunk/ircd/client.c ircd/trunk/ircd/ircd_features.c ircd/trunk/ircd/s_user.c Modified: ircd/trunk/include/ircd_features.h =================================================================== --- ircd/trunk/include/ircd_features.h 2008-08-23 21:42:48 UTC (rev 205) +++ ircd/trunk/include/ircd_features.h 2008-08-24 18:50:51 UTC (rev 206) @@ -55,6 +55,7 @@ FEAT_RANDOM_SEED, FEAT_DEFAULT_LIST_PARAM, FEAT_NICKNAMEHISTORYLENGTH, + FEAT_AUTOUSERMODES, FEAT_HOST_HIDING, FEAT_HIDDEN_HOST, FEAT_HIDDEN_IP, Modified: ircd/trunk/ircd/client.c =================================================================== --- ircd/trunk/ircd/client.c 2008-08-23 21:42:48 UTC (rev 205) +++ ircd/trunk/ircd/client.c 2008-08-24 18:50:51 UTC (rev 206) @@ -31,6 +31,7 @@ #include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" +#include "ircd_string.h" #include "list.h" #include "msgq.h" #include "numeric.h" @@ -83,6 +84,9 @@ assert(cli_verify(sptr)); + if (!EmptyString(feature_str(FEAT_AUTOUSERMODES))) + return feature_str(FEAT_AUTOUSERMODES); + for (link = cli_confs(sptr); link; link = link->next) { aconf = link->value.aconf; if ((aconf->status & CONF_CLIENT) && ConfUmode(aconf)) Modified: ircd/trunk/ircd/ircd_features.c =================================================================== --- ircd/trunk/ircd/ircd_features.c 2008-08-23 21:42:48 UTC (rev 205) +++ ircd/trunk/ircd/ircd_features.c 2008-08-24 18:50:51 UTC (rev 206) @@ -387,6 +387,7 @@ F_N(RANDOM_SEED, FEAT_NODISP, random_seed_set, 0, 0, 0, 0, 0, 0), F_S(DEFAULT_LIST_PARAM, FEAT_NULL, 0, list_set_default), F_U(NICKNAMEHISTORYLENGTH, 0, 800, whowas_realloc), + F_S(AUTOUSERMODES, FEAT_NULL, 0, 0), F_B(HOST_HIDING, 0, 1, 0), F_S(HIDDEN_HOST, FEAT_CASE, "users.irc-dev.net", 0), F_S(HIDDEN_IP, 0, "127.0.0.1", 0), Modified: ircd/trunk/ircd/s_user.c =================================================================== --- ircd/trunk/ircd/s_user.c 2008-08-23 21:42:48 UTC (rev 205) +++ ircd/trunk/ircd/s_user.c 2008-08-24 18:50:51 UTC (rev 206) @@ -411,7 +411,7 @@ if (tmpstr) { char *umodev[] = { NULL, NULL, NULL, NULL }; umodev[2] = tmpstr; - set_user_mode(cptr, sptr, 1, umodev, ALLOWMODES_ANY); + set_user_mode(cptr, sptr, 3, umodev, ALLOWMODES_ANY); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-08-24 19:44:26
|
Revision: 207 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=207&view=rev Author: zolty Date: 2008-08-24 19:44:36 +0000 (Sun, 24 Aug 2008) Log Message: ----------- Actualizacion TODO Modified Paths: -------------- ircd/trunk/TODO.es ircd/trunk/ircd/m_nick.c Modified: ircd/trunk/TODO.es =================================================================== --- ircd/trunk/TODO.es 2008-08-24 18:50:51 UTC (rev 206) +++ ircd/trunk/TODO.es 2008-08-24 19:44:36 UTC (rev 207) @@ -8,39 +8,34 @@ URGENTE -------------------------------------------------------------------------------------- + - [D] Comprobar paso por paso tabla n de Nicks + - [D] Comprobar paso por paso tabla i de Ilines - [D] Implementar tabla o de Operadores - [D] Implementar tabla p de Privilegios + - [G] Al hacerse ircop, sale la IP real en el Server Notice. + - [G] Mirar funcionamiento glines, no van. ALTA PRIORIDAD -------------------------------------------------------------------------------------- - - [G] Soporte de E-lines (excepciones a K-lines). - - [G] Poner uuna Feature para elegir entre salir o no el nombre del servidor en los - notices de auth y dnslookup al conectar. - - [D] U-lines a traves de la DDB. + - [D] U-lines a traves de la DDB. Usar tabla u de Uworld. - [D] Mejorar la inicializacion de las DDB con los eventos. - - [G] Con la introduccion de &his, comprobar TODO. + - [D] DDB: compactado. + - [D] DDB: Terminar de revisar el funcionamiento, drops y hashchecks. - PRIORIDAD MEDIA -------------------------------------------------------------------------------------- - - [D] DDB: compactado. - - [G] Caracter '~' en los nicks. - [G] Mostrar tiempo en formato humano en las G-lines y Jupes. - - [G] Enviar un Closing Link en los QUIT. + - [G] Enviar un Closing Link en los QUIT. - [G] Cuando nos silencian, que salga un numerico. - [G] Estudiar sobre la conveniencia de mandar privmsg globales al nick en vez de a la mascara. - [G] Si un global lo manda un ircop, que salga el prefijo de Mensaje global con la mascara o avisar mediante wallops global. - - [S] Buscar una forma para cifrar IPs con un cambio de clave de cifrado incluido. - - [S] Comando SVSMODE. - - [S] Comando SVSVHOST para cambiar la virtualhost. Estudiar alguna forma de propagarse - en el burst. - - [S] Comando /IDENTIFY y autentificacion NICK nick clave. PRIORIDAD BAJA -------------------------------------------------------------------------------------- + - [G] Soporte de E-lines (excepciones a K-lines). - [G] \xBFAmpliacion comando OPER para elegir clase? - [G] S-lines (Spoof Lines). - [G] Soporte Zlib para server<->server y client<->server (requiere @@ -60,9 +55,22 @@ - [G] Modo HalfOp (+h). - [G] Estudiar la viabilidad de "doble ban" cuando se banea a virtualhosts para que se banee tambi\xE9n a la IP real. + - [G] Con la introduccion de &his, comprobar TODO. + - [G] Poner uuna Feature para elegir entre salir o no el nombre del servidor en los + notices de auth y dnslookup al conectar. - [D] Estudiar tabla j de jupes para jupear nicks con un mensaje de descripcion. - + + +SIN PRIORIDAD (SERVICES o UNDERNET) +-------------------------------------------------------------------------------------- + - [S] Buscar una forma para cifrar IPs con un cambio de clave de cifrado incluido. + - [S] Comando SVSMODE. + - [S] Comando SVSVHOST para cambiar la virtualhost. Estudiar alguna forma de propagarse + en el burst. + - [S] Comando /IDENTIFY y autentificacion NICK nick clave. + + [18:11:32] <Tor> quote opmode torcum #opers,#lala [18:11:38] <Tor> quote opmode #opers +nk lalala [18:14:59] <Tor> burst de aways @@ -77,6 +85,7 @@ procesador), optimizando para 64 bits, y utilizando sse como funciones de coma flotante [16:04:35] <Daijo> el -pipe hace que compile en memoria xa tardar menos + DOCUMENTACION PENDIENTE -------------------------------------------------------------------------------------- - [G] Documentar para Doxygen el Watch @@ -254,7 +263,6 @@ - Modo WEBCHAT especifico - En el MOTD, la hora que salga con el timezone - Ojo con E-lines al hacer rehash -- Guardar clave cifrado en memoria en ASCII y BINARIO - Al mandar un notice a un canal que salga los mismos reply de erroes que con privmsg - Suspends y forbids por BDD de forma inmediata - Si un nodo hace bounce de modos/topic/kick/invite, hacer un -o @@ -269,59 +277,44 @@ - Meter lo de nick changed too fast en claves erroneas de +r y en ghost erroneos - En Users indicar el tiempo de arranque - Netride de topic -- Eliminacion de canales MODELESS que empiecen por @? (No hay canales modeless) - MOTD por BDD - Soporte de Ulines por BDD - Canales persistentes - Numerico de ircops, helpers e bots - Usuarios con k saltan targets y nicks seguidos -- Parche ~ en nicks -- Numeric modo +R +- Numeric modo +R en whois - Salir el +k en el WHO -- Numeric Bots +B -- Chequeo de caracteres raros en el BAN - Eline 223, silence 509 - Silence 510 -- +R y numerico 480 - +k sale part y quit -- Ping timeout y read error sin el to nick - E-lines y numeric 239 - cambiosde nicks demasiados rapido salia erro - 432 de Erroneus nickname por invalid nickname -- nicks prohibidos - Comprobador de TS - Restringir lista de silence - Formato humano en gline y stats g - Comando OPER pass clase - Class is full y class non-existent - Ojo con cambio de nick estando baneado, que no salga el notice -- nicks equivalentes -- nicks suspendidos - al hacer un quit, mandar el quit con el closing link -- Quit sin mensaje no sale ningun mensaje (Sale Quit a secas) +- Quit sin mensaje no sale ningun mensaje (sale quit a secas) - Reliable clock desactivado - Bug de +l 0 o negativos -- Names sin parametros no enought parameters - /Kick primero comprobar si esta y luego si tiene +k - whois nodo_inex nick devolver no such server (con ocultacion de servers funciona diferente?) - Mensajes autoghost - Ojo con ips en trace -- No permitir caracteres de control en nombre canal, ascii < 32 (creo que funciona, comprobar) -- En canales modeless no pueden empezar por +, #, &, @ - Los bans tienen que comprobar a la real y virtual - Cambiar mensaje "Cannot kill, kick or deop channel service - Campos adecuados en stats l - Mensaje de silenciado - Helpers pueden ver whois largos y modos extra -- Helpers salen en who 0 o - lag en el map -- al glinear sale la razon - Class full y mensaje al llenar la clase - Conexiones con clones no heredan targets - ZLIB - join OPER -- ip virtual en el path en los kill - mensaje global -- ircops no tienen limitado canales -- +X mira ip real y virtual en who - +- nicks equivalentes +- nicks prohibidos +- nicks suspendidos \ No newline at end of file Modified: ircd/trunk/ircd/m_nick.c =================================================================== --- ircd/trunk/ircd/m_nick.c 2008-08-24 18:50:51 UTC (rev 206) +++ ircd/trunk/ircd/m_nick.c 2008-08-24 19:44:36 UTC (rev 207) @@ -170,8 +170,10 @@ arg[IRCD_MIN(NICKLEN, feature_uint(FEAT_NICKLEN))] = '\0'; /* Soporte de nicks ~ */ +#if !defined(DDB) if ((s = strchr(arg, '~'))) *s = '\0'; +#endif strcpy(nick, arg); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-09-11 23:50:35
|
Revision: 209 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=209&view=rev Author: zolty Date: 2008-09-11 23:50:46 +0000 (Thu, 11 Sep 2008) Log Message: ----------- Tabla u de Uworld Modified Paths: -------------- ircd/trunk/include/ddb.h ircd/trunk/ircd/ddb.c ircd/trunk/ircd/ddb_events.c ircd/trunk/ircd/s_conf.c Modified: ircd/trunk/include/ddb.h =================================================================== --- ircd/trunk/include/ddb.h 2008-09-11 23:21:45 UTC (rev 208) +++ ircd/trunk/include/ddb.h 2008-09-11 23:50:46 UTC (rev 209) @@ -61,6 +61,8 @@ #define DDB_OPERDB 'o' /** Privileges table of %DDB Distributed Databases. */ #define DDB_PRIVSDB 'p' +/** Uworld table of %DDB Distributed Databases. */ +#define DDB_UWORLDDB 'u' /** Vhost table of %DDB Distributed Databases. */ #define DDB_VHOSTDB 'v' /** Config table of %DDB Distributed Databases. */ Modified: ircd/trunk/ircd/ddb.c =================================================================== --- ircd/trunk/ircd/ddb.c 2008-09-11 23:21:45 UTC (rev 208) +++ ircd/trunk/ircd/ddb.c 2008-09-11 23:50:46 UTC (rev 209) @@ -211,6 +211,7 @@ ddb_resident_table[DDB_NICKDB] = 32768; ddb_resident_table[DDB_OPERDB] = 256; ddb_resident_table[DDB_PRIVSDB] = 256; + ddb_resident_table[DDB_UWORLDDB] = 256; ddb_resident_table[DDB_VHOSTDB] = 256; ddb_resident_table[DDB_CONFIGDB] = 256; Modified: ircd/trunk/ircd/ddb_events.c =================================================================== --- ircd/trunk/ircd/ddb_events.c 2008-09-11 23:21:45 UTC (rev 208) +++ ircd/trunk/ircd/ddb_events.c 2008-09-11 23:50:46 UTC (rev 209) @@ -78,6 +78,7 @@ ddb_events_table[DDB_ILINEDB] = 0; ddb_events_table[DDB_NICKDB] = ddb_events_table_n; ddb_events_table[DDB_OPERDB] = ddb_events_table_o; + ddb_events_table[DDB_UWORLDDB] = 0; ddb_events_table[DDB_VHOSTDB] = ddb_events_table_v; ddb_events_table[DDB_CONFIGDB] = ddb_events_table_z; Modified: ircd/trunk/ircd/s_conf.c =================================================================== --- ircd/trunk/ircd/s_conf.c 2008-09-11 23:21:45 UTC (rev 208) +++ ircd/trunk/ircd/s_conf.c 2008-09-11 23:50:46 UTC (rev 209) @@ -933,6 +933,9 @@ { struct DLink *lp; struct SLink *sp; +#if defined(DDB) + struct Ddb *ddb; +#endif assert(cli_serv(cptr) != NULL); @@ -943,7 +946,15 @@ if (sp) cli_serv(cptr)->flags |= SFLAG_UWORLD; else + { +#if defined(DDB) + ddb = ddb_find_key(DDB_UWORLDDB, cli_name(cptr)); + if (ddb) + cli_serv(cptr)->flags |= SFLAG_UWORLD; + else +#endif cli_serv(cptr)->flags &= ~SFLAG_UWORLD; + } for (lp = cli_serv(cptr)->down; lp; lp = lp->next) update_uworld_flags(lp->value.cptr); @@ -988,9 +999,19 @@ stats_uworld(struct Client* to, const struct StatDesc* sd, char* param) { struct SLink *sp; +#if defined(DDB) + struct Ddb *ddb; +#endif for (sp = uworlds; sp; sp = sp->next) send_reply(to, RPL_STATSULINE, sp->value.cp); + +#if defined(DDB) + for (ddb = ddb_iterator_first(DDB_UWORLDDB); ddb; + ddb = ddb_iterator_next()) + send_reply(to, SND_EXPLICIT | RPL_STATSULINE, "U %s (setted by DDB)", + ddb_key(ddb)); +#endif } /** Free all memory associated with service mapping \a smap. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-09-12 00:10:56
|
Revision: 210 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=210&view=rev Author: zolty Date: 2008-09-12 00:11:06 +0000 (Fri, 12 Sep 2008) Log Message: ----------- Tabla J de Jupes Modified Paths: -------------- ircd/trunk/include/ddb.h ircd/trunk/ircd/ddb.c ircd/trunk/ircd/ddb_events.c ircd/trunk/ircd/hash.c ircd/trunk/ircd/m_nick.c Modified: ircd/trunk/include/ddb.h =================================================================== --- ircd/trunk/include/ddb.h 2008-09-11 23:50:46 UTC (rev 209) +++ ircd/trunk/include/ddb.h 2008-09-12 00:11:06 UTC (rev 210) @@ -55,6 +55,8 @@ #define DDB_FEATUREDB 'f' /** Ilines table of %DDB Distributed Databases. */ #define DDB_ILINEDB 'i' +/** Jupes table of %DDB Distributed Databases. */ +#define DDB_JUPEDB 'j' /** Nicks table of %DDB Distributed Databases. */ #define DDB_NICKDB 'n' /** Operators table of %DDB Distributed Databases. */ Modified: ircd/trunk/ircd/ddb.c =================================================================== --- ircd/trunk/ircd/ddb.c 2008-09-11 23:50:46 UTC (rev 209) +++ ircd/trunk/ircd/ddb.c 2008-09-12 00:11:06 UTC (rev 210) @@ -208,6 +208,7 @@ ddb_resident_table[DDB_CHANDB2] = 32768; ddb_resident_table[DDB_FEATUREDB] = 256; ddb_resident_table[DDB_ILINEDB] = 256; + ddb_resident_table[DDB_JUPEDB] = 256; ddb_resident_table[DDB_NICKDB] = 32768; ddb_resident_table[DDB_OPERDB] = 256; ddb_resident_table[DDB_PRIVSDB] = 256; Modified: ircd/trunk/ircd/ddb_events.c =================================================================== --- ircd/trunk/ircd/ddb_events.c 2008-09-11 23:50:46 UTC (rev 209) +++ ircd/trunk/ircd/ddb_events.c 2008-09-12 00:11:06 UTC (rev 210) @@ -76,6 +76,7 @@ ddb_events_table[DDB_CHANDB2] = ddb_events_table_d; ddb_events_table[DDB_FEATUREDB] = ddb_events_table_f; ddb_events_table[DDB_ILINEDB] = 0; + ddb_events_table[DDB_JUPEDB] = 0; ddb_events_table[DDB_NICKDB] = ddb_events_table_n; ddb_events_table[DDB_OPERDB] = ddb_events_table_o; ddb_events_table[DDB_UWORLDDB] = 0; Modified: ircd/trunk/ircd/hash.c =================================================================== --- ircd/trunk/ircd/hash.c 2008-09-11 23:50:46 UTC (rev 209) +++ ircd/trunk/ircd/hash.c 2008-09-12 00:11:06 UTC (rev 210) @@ -487,10 +487,20 @@ void stats_nickjupes(struct Client* to, const struct StatDesc* sd, char* param) { +#if defined(DDB) + struct Ddb *ddb; +#endif int i; for (i = 0; i < JUPEHASHSIZE; i++) if (jupeTable[i][0]) send_reply(to, RPL_STATSJLINE, jupeTable[i]); + +#if defined(DDB) + for (ddb = ddb_iterator_first(DDB_JUPEDB); ddb; + ddb = ddb_iterator_next()) + send_reply(to, SND_EXPLICIT | RPL_STATSJLINE, "J %s :%s (setted by DDB)", + ddb_key(ddb), ddb_content(ddb)); +#endif } /** Send more channels to a client in mid-LIST. Modified: ircd/trunk/ircd/m_nick.c =================================================================== --- ircd/trunk/ircd/m_nick.c 2008-09-11 23:50:46 UTC (rev 209) +++ ircd/trunk/ircd/m_nick.c 2008-09-12 00:11:06 UTC (rev 210) @@ -197,6 +197,14 @@ return 0; /* NICK message ignored */ } } + + ddb = ddb_find_key(DDB_JUPEDB, nick); + if (ddb) + { + send_reply(sptr, SND_EXPLICIT | ERR_NICKNAMEINUSE, "%s :Nickname is juped: %s", + nick, ddb_content(ddb)); + return 0; /* NICK message ignored */ + } #endif /* defined(DDB) */ /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-10-18 09:54:24
|
Revision: 214 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=214&view=rev Author: zolty Date: 2008-10-18 09:54:03 +0000 (Sat, 18 Oct 2008) Log Message: ----------- Deshabilito el SSL por defecto mientras no esta completo al 100% Modified Paths: -------------- ircd/trunk/configure ircd/trunk/configure.ac Modified: ircd/trunk/configure =================================================================== --- ircd/trunk/configure 2008-10-16 22:51:11 UTC (rev 213) +++ ircd/trunk/configure 2008-10-18 09:54:03 UTC (rev 214) @@ -10139,6 +10139,8 @@ fi +#Temporal +unet_cv_enable_ssl=no { echo "$as_me:$LINENO: checking whether to enable SSL" >&5 echo $ECHO_N "checking whether to enable SSL... $ECHO_C" >&6; } # Check whether --enable-ssl was given. Modified: ircd/trunk/configure.ac =================================================================== --- ircd/trunk/configure.ac 2008-10-16 22:51:11 UTC (rev 213) +++ ircd/trunk/configure.ac 2008-10-18 09:54:03 UTC (rev 214) @@ -295,6 +295,8 @@ fi dnl how about SSL support? +#Temporal +unet_cv_enable_ssl=no unet_TOGGLE([ssl], $unet_have_ssl, [Disable SSL support], [whether to enable SSL], [# Prohibit SSL support if ssl doesn't exist This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-10-25 20:36:50
|
Revision: 221 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=221&view=rev Author: zolty Date: 2008-10-25 20:36:42 +0000 (Sat, 25 Oct 2008) Log Message: ----------- Nuevos comandos administrativos, bajo compilacion condicional Modified Paths: -------------- ircd/trunk/include/handlers.h ircd/trunk/include/msg.h ircd/trunk/ircd/Makefile.am ircd/trunk/ircd/Makefile.in ircd/trunk/ircd/parse.c Added Paths: ----------- ircd/trunk/ircd/m_svsjoin.c ircd/trunk/ircd/m_svsmode.c ircd/trunk/ircd/m_svspart.c Modified: ircd/trunk/include/handlers.h =================================================================== --- ircd/trunk/include/handlers.h 2008-10-25 15:33:58 UTC (rev 220) +++ ircd/trunk/include/handlers.h 2008-10-25 20:36:42 UTC (rev 221) @@ -241,6 +241,9 @@ extern int ms_squit(struct Client*, struct Client*, int, char*[]); extern int ms_stats(struct Client*, struct Client*, int, char*[]); extern int ms_svsnick(struct Client*, struct Client*, int, char*[]); +extern int ms_svsmode(struct Client*, struct Client*, int, char*[]); +extern int ms_svsjoin(struct Client*, struct Client*, int, char*[]); +extern int ms_svspart(struct Client*, struct Client*, int, char*[]); extern int ms_topic(struct Client*, struct Client*, int, char*[]); extern int ms_trace(struct Client*, struct Client*, int, char*[]); extern int ms_uping(struct Client*, struct Client*, int, char*[]); Modified: ircd/trunk/include/msg.h =================================================================== --- ircd/trunk/include/msg.h 2008-10-25 15:33:58 UTC (rev 220) +++ ircd/trunk/include/msg.h 2008-10-25 20:36:42 UTC (rev 221) @@ -389,15 +389,27 @@ #define MSG_SVSNICK "SVSNICK" /* SVSN */ #define TOK_SVSNICK "SN" #define CMD_SVSNICK MSG_SVSNICK, TOK_SVSNICK + #if 1 /* TRANSICION IRC-HISPANO */ #define MSG_RENAME "RENAME" /* SVSN */ #define TOK_RENAME "RENAME" #define CMD_RENAME MSG_RENAME, TOK_RENAME - #endif +#define MSG_SVSMODE "SVSMODE" +#define TOK_SVSMODE "SM" +#define CMD_SVSMODE MSG_SVSMODE, TOK_SVSMODE +#define MSG_SVSJOIN "SVSJOIN" +#define TOK_SVSJOIN "SJ" +#define CMD_SVSJOIN MSG_SVSJOIN, TOK_SVSJOIN +#define MSG_SVSPART "SVSPART" +#define TOK_SVSPART "SL" +#define CMD_SVSPART MSG_SVSPART, TOK_SVSPART + + + /* * Constants */ Modified: ircd/trunk/ircd/Makefile.am =================================================================== --- ircd/trunk/ircd/Makefile.am 2008-10-25 15:33:58 UTC (rev 220) +++ ircd/trunk/ircd/Makefile.am 2008-10-25 20:36:42 UTC (rev 221) @@ -195,12 +195,18 @@ m_db.c \ m_dbq.c \ m_ghost.c \ - m_svsnick.c + m_svsnick.c \ + m_svsmode.c \ + m_svsjoin.c \ + m_svspart.c endif #if ENVIRONMENT_SERVICES #ircd_SOURCES += \ -# m_svsnick.c +# m_svsnick.c \ +# m_svsmode.c \ +# m_svsjoin.c \ +# m_svspart.c #endif Modified: ircd/trunk/ircd/Makefile.in =================================================================== --- ircd/trunk/ircd/Makefile.in 2008-10-25 15:33:58 UTC (rev 220) +++ ircd/trunk/ircd/Makefile.in 2008-10-25 20:36:42 UTC (rev 221) @@ -48,12 +48,18 @@ @ENVIRONMENT_DDB_TRUE@ m_db.c \ @ENVIRONMENT_DDB_TRUE@ m_dbq.c \ @ENVIRONMENT_DDB_TRUE@ m_ghost.c \ -@ENVIRONMENT_DDB_TRUE@ m_svsnick.c +@ENVIRONMENT_DDB_TRUE@ m_svsnick.c \ +@ENVIRONMENT_DDB_TRUE@ m_svsmode.c \ +@ENVIRONMENT_DDB_TRUE@ m_svsjoin.c \ +@ENVIRONMENT_DDB_TRUE@ m_svspart.c #if ENVIRONMENT_SERVICES #ircd_SOURCES += \ -# m_svsnick.c +# m_svsnick.c \ +# m_svsmode.c \ +# m_svsjoin.c \ +# m_svspart.c #endif @ENGINE_POLL_TRUE@am__append_2 = engine_poll.c @ENGINE_POLL_FALSE@am__append_3 = engine_select.c @@ -102,14 +108,16 @@ s_debug.c s_err.c s_misc.c s_numeric.c s_serv.c s_stats.c \ s_user.c send.c ssl.c uping.c userload.c watch.c whowas.c \ ddb.c ddb_db_native.c ddb_events.c ircd_tea.c m_bmode.c m_db.c \ - m_dbq.c m_ghost.c m_svsnick.c engine_poll.c engine_select.c \ - engine_devpoll.c engine_epoll.c engine_kqueue.c + m_dbq.c m_ghost.c m_svsnick.c m_svsmode.c m_svsjoin.c \ + m_svspart.c engine_poll.c engine_select.c engine_devpoll.c \ + engine_epoll.c engine_kqueue.c @ENVIRONMENT_DDB_TRUE@am__objects_1 = ddb.$(OBJEXT) \ @ENVIRONMENT_DDB_TRUE@ ddb_db_native.$(OBJEXT) \ @ENVIRONMENT_DDB_TRUE@ ddb_events.$(OBJEXT) ircd_tea.$(OBJEXT) \ @ENVIRONMENT_DDB_TRUE@ m_bmode.$(OBJEXT) m_db.$(OBJEXT) \ @ENVIRONMENT_DDB_TRUE@ m_dbq.$(OBJEXT) m_ghost.$(OBJEXT) \ -@ENVIRONMENT_DDB_TRUE@ m_svsnick.$(OBJEXT) +@ENVIRONMENT_DDB_TRUE@ m_svsnick.$(OBJEXT) m_svsmode.$(OBJEXT) \ +@ENVIRONMENT_DDB_TRUE@ m_svsjoin.$(OBJEXT) m_svspart.$(OBJEXT) @ENGINE_POLL_TRUE@am__objects_2 = engine_poll.$(OBJEXT) @ENGINE_POLL_FALSE@am__objects_3 = engine_select.$(OBJEXT) @ENGINE_DEVPOLL_TRUE@am__objects_4 = engine_devpoll.$(OBJEXT) @@ -535,7 +543,10 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_silence.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_squit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_stats.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_svsjoin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_svsmode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_svsnick.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_svspart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_time.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_topic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_trace.Po@am__quote@ Added: ircd/trunk/ircd/m_svsjoin.c =================================================================== --- ircd/trunk/ircd/m_svsjoin.c (rev 0) +++ ircd/trunk/ircd/m_svsjoin.c 2008-10-25 20:36:42 UTC (rev 221) @@ -0,0 +1,174 @@ +/* + * IRC-Dev IRCD - An advanced and innovative IRC Daemon, ircd/m_svsjoin.c + * + * Copyright (C) 2002-2008 IRC-Dev Development Team <de...@ir...> + * Copyright (C) 2008 Toni Garcia (zoltan) <zo...@ir...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +/** @file + * @brief Handlers for SVSJOIN command. + * @version $Id: m_svsnick.c,v 1.6 2007-04-22 13:56:21 zolty Exp $ + */ +#include "config.h" + +#include "channel.h" +#include "client.h" +#include "ddb.h" +#include "hash.h" +#include "ircd.h" +#include "ircd_features.h" +#include "ircd_log.h" +#include "ircd_string.h" +#include "msg.h" +#include "numeric.h" +#include "numnicks.h" +#include "s_user.h" +#include "send.h" + +/* #include <assert.h> -- Now using assert in ircd_log.h */ +#include <stdio.h> +#include <string.h> + + +/** Handle a SVSJOIN command from a server. + * See @ref m_functions for general discussion of parameters. + * + * \a parv has the following elements when \a sptr is a server: + * \li parv[1] is a nick + * \li \a parv[2] is a comma-separated list of channel names + * + * @param[in] cptr Client that sent us the message. + * @param[in] sptr Original source of message. + * @param[in] parc Number of arguments. + * @param[in] parv Argument vector. + */ +int ms_svsjoin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + struct Channel *chptr; + struct JoinBuf join; + struct JoinBuf create; + struct Client *acptr; + char *p = 0; + char *chanlist; + char *name; + + assert(0 != IsServer(cptr)); + + if (parc < 3) + return 0; + + if (!cli_uworld(sptr)) + { + sendcmdto_serv(&me, CMD_DESYNCH, 0, + ":HACK(2): Fail SVSJOIN for %s. From %C", parv[1], sptr); + sendto_opmask(0, SNO_HACK2, + "Fail SVSJOIN for %s. From %C", parv[1], sptr); + return 0; + } + + sendcmdto_serv(sptr, CMD_SVSJOIN, cptr, "%s :%s", parv[1], parv[2]); + + acptr = findNUser(parv[1]); + + if (!acptr || !MyUser(acptr)) + return 0; + + sendto_opmask(0, SNO_HACK4, + "SVSJOIN for %C, channels %s. From %C", acptr, parv[2], sptr); + + joinbuf_init(&join, acptr, acptr, JOINBUF_TYPE_JOIN, 0, 0); + joinbuf_init(&create, acptr, acptr, JOINBUF_TYPE_CREATE, 0, TStime()); + +#if 0 + chanlist = last0(acptr, acptr, parv[2]); /* find last "JOIN 0" */ + + for (name = ircd_strtok(&p, chanlist, ","); name; + name = ircd_strtok(&p, 0, ",")) { +#endif + for (name = ircd_strtok(&p, parv[2], ","); name; + name = ircd_strtok(&p, 0, ",")) { + + if (!IsChannelName(name) || !strIsIrcCh(name)) + { + /* bad channel name */ + continue; + } + + if (!(chptr = FindChannel(name))) { + if (((name[0] == '&') && !feature_bool(FEAT_LOCAL_CHANNELS)) + || strlen(name) >= IRCD_MIN(CHANNELLEN, feature_uint(FEAT_CHANNELLEN))) { + continue; + } + + if (!(chptr = get_channel(sptr, name, CGT_CREATE))) + continue; + +#if defined(UNDERNET) + joinbuf_join(&create, chptr, CHFL_CHANOP | CHFL_CHANNEL_MANAGER); +#else + joinbuf_join(&create, chptr, CHFL_CHANOP); +#endif + + } else if (find_member_link(chptr, sptr)) { + continue; /* already on channel */ + } else { + int flags = 0; +#if defined(DDB) + struct Ddb *ddb = ddb_find_key(DDB_CHANDB, chptr->chname); + + if (ddb && !ircd_strcmp(ddb_content(ddb), cli_name(sptr))) + flags = CHFL_OWNER; +#endif + + joinbuf_join(&join, chptr, flags); + cli_last_join(acptr) = CurrentTime; + + if (flags & CHFL_CHANOP) { + struct ModeBuf mbuf; + /* Always let the server op him: this is needed on a net with older servers + because they 'destruct' channels immediately when they become empty without + sending out a DESTRUCT message. As a result, they would always bounce a mode + (as HACK(2)) when the user ops himself. + (There is also no particularly good reason to have the user op himself.) + */ + modebuf_init(&mbuf, &me, acptr, chptr, MODEBUF_DEST_SERVER); +#if defined(UNDERNET) + modebuf_mode_client(&mbuf, MODE_ADD | MODE_CHANOP, acptr, (flags & CHFL_CHANNEL_MANAGER) ? 0 : 1)); +#elif defined(DDB) || defined(SERVICES) + modebuf_mode_client(&mbuf, MODE_ADD | MODE_CHANOP, acptr, 0); +#endif + modebuf_flush(&mbuf); + } + } + + del_invite(sptr, chptr); + + if (chptr->topic[0]) { + send_reply(acptr, RPL_TOPIC, chptr->chname, chptr->topic); + send_reply(acptr, RPL_TOPICWHOTIME, chptr->chname, chptr->topic_nick, + chptr->topic_time); + } + + do_names(acptr, chptr, NAMES_ALL|NAMES_EON); /* send /names list */ + } + + joinbuf_flush(&join); /* must be first, if there's a JOIN 0 */ + joinbuf_flush(&create); + + return 0; + +} Added: ircd/trunk/ircd/m_svsmode.c =================================================================== --- ircd/trunk/ircd/m_svsmode.c (rev 0) +++ ircd/trunk/ircd/m_svsmode.c 2008-10-25 20:36:42 UTC (rev 221) @@ -0,0 +1,88 @@ +/* + * IRC-Dev IRCD - An advanced and innovative IRC Daemon, ircd/m_svsmode.c + * + * Copyright (C) 2002-2008 IRC-Dev Development Team <de...@ir...> + * Copyright (C) 2008 Toni Garcia (zoltan) <zo...@ir...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +/** @file + * @brief Handlers for SVSMODE command. + * @version $Id: m_svsmode.c,v 1.6 2007-04-22 13:56:21 zolty Exp $ + */ +#include "config.h" + +#include "channel.h" +#include "client.h" +#include "hash.h" +#include "ircd.h" +#include "ircd_log.h" +#include "ircd_snprintf.h" +#include "ircd_string.h" +#include "msg.h" +#include "numnicks.h" +#include "s_conf.h" +#include "s_user.h" +#include "send.h" + +/* #include <assert.h> -- Now using assert in ircd_log.h */ +#include <stdio.h> +#include <string.h> + + +/** Handle a SVSMODE command from a server. + * See @ref m_functions for general discussion of parameters. + * + * \a parv[1] is a nick + * \a parv[2] is a new nick (* random nick) + * + * @param[in] cptr Client that sent us the message. + * @param[in] sptr Original source of message. + * @param[in] parc Number of arguments. + * @param[in] parv Argument vector. + */ +int ms_svsmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + struct Channel *chptr = 0; + + assert(0 != IsServer(cptr)); + + if (parc < 3) + return 0; + + if (!cli_uworld(sptr)) + { + sendcmdto_serv(&me, CMD_DESYNCH, 0, + ":HACK(2): Fail SVSMODE for %s. From %C", parv[1], sptr); + sendto_opmask(0, SNO_HACK2, + "Fail SVSMODE for %s. From %C", parv[1], sptr); + return 0; + } + + if (!IsChannelName(parv[1]) || !(chptr = FindChannel(parv[1]))) + { + struct Client *acptr; + + acptr = findNUser(parv[1]); + if (!acptr) + acptr = FindUser(parv[1]); + if (!acptr) + return 0; + } + + /* No change modes for channels */ + return 0; +} Added: ircd/trunk/ircd/m_svspart.c =================================================================== --- ircd/trunk/ircd/m_svspart.c (rev 0) +++ ircd/trunk/ircd/m_svspart.c 2008-10-25 20:36:42 UTC (rev 221) @@ -0,0 +1,132 @@ +/* + * IRC-Dev IRCD - An advanced and innovative IRC Daemon, ircd/m_svspart.c + * + * Copyright (C) 2002-2008 IRC-Dev Development Team <de...@ir...> + * Copyright (C) 2008 Toni Garcia (zoltan) <zo...@ir...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +/** @file + * @brief Handlers for SVSPART command. + * @version $Id: m_svsnick.c,v 1.6 2007-04-22 13:56:21 zolty Exp $ + */ +#include "config.h" + +#include "channel.h" +#include "client.h" +#include "hash.h" +#include "ircd.h" +#include "ircd_log.h" +#include "ircd_string.h" +#include "msg.h" +#include "numeric.h" +#include "numnicks.h" +#include "s_user.h" +#include "send.h" + +/* #include <assert.h> -- Now using assert in ircd_log.h */ +#include <stdio.h> +#include <string.h> + + +/** Handle a SVSPART command from a server. + * See @ref m_functions for general discussion of parameters. + * + * \a parv has the following elements when \a sptr is a server: + * \li parv[1] is a nick + * \li \a parv[2] is a comma-separated list of channel names + * \li \a parv[\a parc - 1] is the parting comment + * + * @param[in] cptr Client that sent us the message. + * @param[in] sptr Original source of message. + * @param[in] parc Number of arguments. + * @param[in] parv Argument vector. + */ +int ms_svspart(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + struct Channel *chptr; + struct Membership *member; + struct JoinBuf parts; + struct Client *acptr; + unsigned int flags = 0; + char *p = 0; + char *name; + + assert(0 != IsServer(cptr)); + + if (parc < 3) + return 0; + + if (!cli_uworld(sptr)) + { + sendcmdto_serv(&me, CMD_DESYNCH, 0, + ":HACK(2): Fail SVSPART for %s. From %C", parv[1], + sptr); + sendto_opmask(0, SNO_HACK2, + "Fail SVSPART for %s. From %C", parv[1], sptr); + return 0; + } + + if (parc > 3) + sendcmdto_serv(sptr, CMD_SVSPART, cptr, "%s %s :%s", parv[1], parv[2], parv[3]); + else + sendcmdto_serv(sptr, CMD_SVSPART, cptr, "%s %s", parv[1], parv[2]); + + acptr = findNUser(parv[1]); + + if (!acptr || !MyUser(acptr)) + return 0; + + sendto_opmask(0, SNO_HACK4, + "SVSPART for %C, channels %s. From %C", acptr, parv[2], sptr); + + /* init join/part buffer */ + joinbuf_init(&parts, acptr, cptr, JOINBUF_TYPE_PART, + (parc > 3 && !EmptyString(parv[parc - 1])) ? parv[parc - 1] : 0, + 0); + + /* scan through channel list */ + for (name = ircd_strtok(&p, parv[2], ","); name; + name = ircd_strtok(&p, 0, ",")) { + + chptr = get_channel(acptr, name, CGT_NO_CREATE); /* look up channel */ + + if (!chptr) { /* complain if there isn't such a channel */ + continue; + } + + if (!(member = find_member_link(chptr, acptr))) { /* complain if not on */ + continue; + } + + assert(!IsZombie(member)); /* Local users should never zombie */ + + if (!member_can_send_to_channel(member, 0)) + { + flags |= CHFL_BANNED; + /* Remote clients don't want to see a comment either. */ + parts.jb_comment = 0; + } + + if (IsDelayedJoin(member)) + flags |= CHFL_DELAYED; + + joinbuf_join(&parts, chptr, flags); /* part client from channel */ + + } + + return joinbuf_flush(&parts); /* flush channel parts */ +} Modified: ircd/trunk/ircd/parse.c =================================================================== --- ircd/trunk/ircd/parse.c 2008-10-25 15:33:58 UTC (rev 220) +++ ircd/trunk/ircd/parse.c 2008-10-25 20:36:42 UTC (rev 221) @@ -667,7 +667,7 @@ TOK_GHOST, 0, MAXPARA, MFLG_SLOW, 0, NULL, /* UNREG, CLIENT, SERVER, OPER, SERVICE */ - { m_unregistered, m_ghost, m_ignore, m_ignore, m_ignore } + { m_unregistered, m_ghost, m_ignore, m_ghost, m_ignore } }, #endif #if defined(DDB) || defined(SERVICES) @@ -678,6 +678,27 @@ /* UNREG, CLIENT, SERVER, OPER, SERVICE */ { m_ignore, m_ignore, ms_svsnick, m_ignore, m_ignore } }, + { + MSG_SVSMODE, + TOK_SVSMODE, + 0, MAXPARA, MFLG_SLOW, 0, NULL, + /* UNREG, CLIENT, SERVER, OPER, SERVICE */ + { m_ignore, m_ignore, ms_svsmode, m_ignore, m_ignore } + }, + { + MSG_SVSJOIN, + TOK_SVSJOIN, + 0, MAXPARA, MFLG_SLOW, 0, NULL, + /* UNREG, CLIENT, SERVER, OPER, SERVICE */ + { m_ignore, m_ignore, ms_svsjoin, m_ignore, m_ignore } + }, + { + MSG_SVSPART, + TOK_SVSPART, + 0, MAXPARA, MFLG_SLOW, 0, NULL, + /* UNREG, CLIENT, SERVER, OPER, SERVICE */ + { m_ignore, m_ignore, ms_svspart, m_ignore, m_ignore } + }, #if 1 /* TRANSICION IRC-HISPANO */ { "RENAME", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zo...@us...> - 2008-10-26 19:08:35
|
Revision: 222 http://irc-dev.svn.sourceforge.net/irc-dev/?rev=222&view=rev Author: zolty Date: 2008-10-26 19:08:25 +0000 (Sun, 26 Oct 2008) Log Message: ----------- Reescritura gestion de nicks aleatorios Modified Paths: -------------- ircd/trunk/ChangeLog.es ircd/trunk/TODO.es ircd/trunk/include/patchlevel.h ircd/trunk/include/s_user.h ircd/trunk/ircd/ddb_events.c ircd/trunk/ircd/m_nick.c ircd/trunk/ircd/m_svsnick.c Modified: ircd/trunk/ChangeLog.es =================================================================== --- ircd/trunk/ChangeLog.es 2008-10-25 20:36:42 UTC (rev 221) +++ ircd/trunk/ChangeLog.es 2008-10-26 19:08:25 UTC (rev 222) @@ -5,6 +5,17 @@ # # Insertar los nuevos cambios al principio de esta lista de cambios. # +2008-01-19 Toni Garc�a <zo...@ir...> 1.0.beta13 +svsmode +svsjoin +svspart +tabla j +tabla u +tabla f +tabla o (pendiente) +tabla p (pendiente) +modos usuario ahBXc + 2008-01-19 Toni Garc�a <zo...@ir...> 1.0.beta12 * Transicion con IRC-Hispano * Soporte de XMODE JCEA Modified: ircd/trunk/TODO.es =================================================================== --- ircd/trunk/TODO.es 2008-10-25 20:36:42 UTC (rev 221) +++ ircd/trunk/TODO.es 2008-10-26 19:08:25 UTC (rev 222) @@ -62,7 +62,6 @@ SIN PRIORIDAD (SERVICES o UNDERNET) -------------------------------------------------------------------------------------- - [S] Buscar una forma para cifrar IPs con un cambio de clave de cifrado incluido. - - [S] Comando SVSMODE. - [S] Comando SVSVHOST para cambiar la virtualhost. Estudiar alguna forma de propagarse en el burst. - [S] Comando /IDENTIFY y autentificacion NICK nick clave. @@ -316,12 +315,10 @@ - Jupe de nicks por tabla j - mensajes nicks ocupado ERR_NICKNAMEINUSE - nicklen dinamico -- tabla d - SVSMODE - SVSJOIN, SVSPART - SNO_SERVICE - SVSNICK -- auto +i - whois a un uline se muestra el servidor - nick baneado o canal +R/+M sin +r o esta +m no puede cambiar dfe nick - Reallen 70 Modified: ircd/trunk/include/patchlevel.h =================================================================== --- ircd/trunk/include/patchlevel.h 2008-10-25 20:36:42 UTC (rev 221) +++ ircd/trunk/include/patchlevel.h 2008-10-26 19:08:25 UTC (rev 222) @@ -20,7 +20,7 @@ * $Id: patchlevel.h,v 1.60 2008-01-19 19:25:58 zolty Exp $ * */ -#define PATCHLEVEL "12" +#define PATCHLEVEL "13" #define RELEASE "1.0.beta" Modified: ircd/trunk/include/s_user.h =================================================================== --- ircd/trunk/include/s_user.h 2008-10-25 20:36:42 UTC (rev 221) +++ ircd/trunk/include/s_user.h 2008-10-26 19:08:25 UTC (rev 222) @@ -115,6 +115,7 @@ extern int verify_pass_nick(char *nick, char *cryptpass, char *pass); #endif extern int do_nick_name(char* nick); +extern char *get_random_nick(struct Client* cptr); extern int set_nick_name(struct Client* cptr, struct Client* sptr, const char* nick, int parc, char* parv[], int flags); extern void send_umode_out(struct Client* cptr, struct Client* sptr, Modified: ircd/trunk/ircd/ddb_events.c =================================================================== --- ircd/trunk/ircd/ddb_events.c 2008-10-25 20:36:42 UTC (rev 221) +++ ircd/trunk/ircd/ddb_events.c 2008-10-26 19:08:25 UTC (rev 222) @@ -369,34 +369,13 @@ if (nick_renames) { - struct Client *acptr; - unsigned int v[2], k[2], x[2]; - char newnick[NICKLEN + 2]; + char *newnick; char tmp[100]; char *parv[3]; int flags = 0; + + newnick = get_random_nick(cptr); - k[0] = k[1] = x[0] = x[1] = 0; - - v[0] = base64toint(cli_yxx(cptr)); - v[1] = base64toint(cli_yxx(&me)); - - acptr = cptr; - - do - { - ircd_tea(v, k, x); - v[1] += 4096; - - if (x[0] >= 4294000000ul) - continue; - - ircd_snprintf(0, newnick, sizeof(newnick), "Guest%.6d", - (int)(x[0] % 1000000)); - acptr = FindUser(newnick); - } - while (acptr); - SetRenamed(flags); parv[0] = cli_name(cptr); Modified: ircd/trunk/ircd/m_nick.c =================================================================== --- ircd/trunk/ircd/m_nick.c 2008-10-25 20:36:42 UTC (rev 221) +++ ircd/trunk/ircd/m_nick.c 2008-10-26 19:08:25 UTC (rev 222) @@ -83,6 +83,46 @@ return (ch - nick); } +/** Get a random nickname. +* +* @param[in] cptr Client's requested nickname. +* @return A new nick. +*/ +char *get_random_nick(struct Client* cptr) +{ + struct Client* acptr; + char* newnick; + char nickout[NICKLEN + 1]; + unsigned int v[2], k[2], x[2]; + + k[0] = k[1] = x[0] = x[1] = 0; + + v[0] = base64toint(cli_yxx(cptr)); + v[1] = base64toint(cli_yxx(&me)); + + acptr = cptr; + + do + { + ircd_tea(v, k, x); + v[1] += 4096; + + if (x[0] >= 4294000000ul) + continue; + + ircd_snprintf(0, nickout, sizeof(nickout), "Guest%.6d", + (int)(x[0] % 1000000)); + + nickout[NICKLEN] = '\0'; + newnick = nickout; + + acptr = FindUser(newnick); + } + while (acptr); + + return newnick; +} + /** Handle a NICK message from a local connection. * * \a parv has the following elements: @@ -102,6 +142,7 @@ char* s; const char* client_name; int flags = 0; + int random_nick = 0; #if defined(DDB) struct Ddb *ddb; char *p; @@ -119,7 +160,7 @@ client_name = (*(cli_name(sptr))) ? cli_name(sptr) : "*"; #if 0 -/*TODO-ZOLTAN: Cosas de JCea, comprobar */ +/* TODO-ZOLTAN: Cosas de JCea, comprobar */ /* * Not change nick several times BEFORE to have completed your entrance * in the network. @@ -162,6 +203,17 @@ #endif /* defined(DDB) */ /* + * Special CASE + * NICK * + * Random nickname + */ + if ((strlen(parv[1]) == 1) && (*parv[1] == '*')) + { + parv[1] = get_random_nick(sptr); + random_nick = 1; + } + + /* * Don't let them send make us send back a really long string of * garbage */ @@ -173,7 +225,7 @@ #if !defined(DDB) if ((s = strchr(arg, '~'))) *s = '\0'; -#endif +#endif strcpy(nick, arg); @@ -186,24 +238,19 @@ } #if defined(DDB) - if (strlen(nick) == 11) - { - if ((strcmp(nick, "Guest000000") >= 0) && (strcmp(nick, "Guest999999") <= 0)) - { - if (FindClient(nick)) - send_reply(sptr, ERR_NICKNAMEINUSE, nick); - else - send_reply(sptr, ERR_ERRONEUSNICKNAME, nick); - return 0; /* NICK message ignored */ - } - } - - ddb = ddb_find_key(DDB_JUPEDB, nick); - if (ddb) + if (!random_nick) { - send_reply(sptr, SND_EXPLICIT | ERR_NICKNAMEINUSE, "%s :Nickname is juped: %s", - nick, ddb_content(ddb)); - return 0; /* NICK message ignored */ + struct Ddb *regj; + + for (regj = ddb_iterator_first(DDB_JUPEDB); regj; regj = ddb_iterator_next()) + { + if (!match(ddb_key(regj), nick)) + { + send_reply(sptr, SND_EXPLICIT | ERR_NICKNAMEINUSE, "%s :Nickname is juped: %s", + nick, ddb_content(regj)); + return 0; /* NICK message ignored */ + } + } } #endif /* defined(DDB) */ @@ -211,7 +258,7 @@ * Check if this is a LOCAL user trying to use a reserved (Juped) * nick, if so tell him that it's a nick in use... */ - if (isNickJuped(nick)) { + if (isNickJuped(nick) & !random_nick) { send_reply(sptr, ERR_NICKNAMEINUSE, nick); return 0; /* NICK message ignored */ } Modified: ircd/trunk/ircd/m_svsnick.c =================================================================== --- ircd/trunk/ircd/m_svsnick.c 2008-10-25 20:36:42 UTC (rev 221) +++ ircd/trunk/ircd/m_svsnick.c 2008-10-26 19:08:25 UTC (rev 222) @@ -91,7 +91,8 @@ sendcmdto_serv(sptr, CMD_SVSNICK, cptr, "%s :%s", parv[1], parv[2]); acptr = findNUser(parv[1]); - + if (!acptr) + acptr = FindUser(parv[1]); if (!acptr || !MyUser(acptr)) return 0; @@ -114,31 +115,8 @@ return 0; } else - { - unsigned int v[2], k[2], x[2]; + strcpy(newnick, get_random_nick(acptr)); - k[0] = k[1] = x[0] = x[1] = 0; - - v[0] = base64toint(cli_yxx(acptr)); - v[1] = base64toint(cli_yxx(&me)); - - bcptr = acptr; - - do - { - ircd_tea(v, k, x); - v[1] += 4096; - - if (x[0] >= 4294000000ul) - continue; - - ircd_snprintf(0, newnick, sizeof(newnick), "Guest%.6d", - (int)(x[0] % 1000000)); - bcptr = FindUser(newnick); - } - while (bcptr); - } - sendto_opmask(0, SNO_HACK4, "SVSNICK for %C, new nick %s. From %C", acptr, newnick, sptr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |