[IRC-Dev CVS] [CVS] Module ircd-ircdev: Change committed
Brought to you by:
zolty
From: Toni G. <zo...@us...> - 2005-05-07 22:24:03
|
CVSROOT : /cvsroot/irc-dev Module : ircd-ircdev Commit time: 2005-05-07 22:23:50 UTC Modified files: ChangeLog ChangeLog.es Doxyfile doc/en/log.txt include/ircd_log.h include/numeric.h include/patchlevel.h ircd/channel.c ircd/ddb.c ircd/ddb_db_native.c ircd/ddb_events.c ircd/engine_epoll.c ircd/ircd_auth.c ircd/ircd_log.c ircd/m_db.c ircd/m_invite.c ircd/m_join.c ircd/m_svsnick.c ircd/numnicks.c ircd/s_err.c ircd/s_misc.c ircd/s_stats.c ircd/s_user.c Log message: Author: zoltan <zo...@ir...> Log message: 2005-05-08 Toni García <zo...@ir...> 1.0.alpha32 * Fix de bugs ---------------------- diff included ---------------------- Index: ircd-ircdev/ChangeLog diff -u ircd-ircdev/ChangeLog:1.33 ircd-ircdev/ChangeLog:1.34 --- ircd-ircdev/ChangeLog:1.33 Sat May 7 05:43:28 2005 +++ ircd-ircdev/ChangeLog Sat May 7 15:23:39 2005 @@ -1,10 +1,13 @@ # # ChangeLog for ircd-ircdev # -# $Id: ChangeLog,v 1.33 2005/05/07 12:43:28 zolty Exp $ +# $Id: ChangeLog,v 1.34 2005/05/07 22:23:39 zolty Exp $ # # Insert new changes at beginning of the change list. # +2005-05-08 Toni García <zo...@ir...> 1.0.alpha32 + * Fix bugs + 2005-05-07 Toni García <zo...@ir...> 1.0.alpha31 * Native DB: Tables read and save * Burst DB Index: ircd-ircdev/ChangeLog.es diff -u ircd-ircdev/ChangeLog.es:1.33 ircd-ircdev/ChangeLog.es:1.34 --- ircd-ircdev/ChangeLog.es:1.33 Sat May 7 05:43:28 2005 +++ ircd-ircdev/ChangeLog.es Sat May 7 15:23:39 2005 @@ -1,10 +1,13 @@ # # Log de Cambios para ircd-ircdev # -# $Id: ChangeLog.es,v 1.33 2005/05/07 12:43:28 zolty Exp $ +# $Id: ChangeLog.es,v 1.34 2005/05/07 22:23:39 zolty Exp $ # # Insertar los nuevos cambios al principio de esta lista de cambios. # +2005-05-08 Toni García <zo...@ir...> 1.0.alpha32 + * Fix de bugs + 2005-05-07 Toni García <zo...@ir...> 1.0.alpha31 * DB nativo: Lectura y escritura de tablas * DB Burst Index: ircd-ircdev/Doxyfile diff -u ircd-ircdev/Doxyfile:1.3 ircd-ircdev/Doxyfile:1.4 --- ircd-ircdev/Doxyfile:1.3 Mon Mar 21 10:38:47 2005 +++ ircd-ircdev/Doxyfile Sat May 7 15:23:39 2005 @@ -41,7 +41,8 @@ # (Japanese with English messages), Korean, Norwegian, Polish, Portuguese, # Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. -OUTPUT_LANGUAGE = English +#OUTPUT_LANGUAGE = English +OUTPUT_LANGUAGE = Spanish # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, @@ -691,7 +692,7 @@ # The RTF output is optimised for Word 97 and may not look very pretty with # other RTF readers or editors. -GENERATE_RTF = NO +GENERATE_RTF = YES # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be Index: ircd-ircdev/doc/en/log.txt diff -u ircd-ircdev/doc/en/log.txt:1.1 ircd-ircdev/doc/en/log.txt:1.2 --- ircd-ircdev/doc/en/log.txt:1.1 Wed Jan 5 10:00:34 2005 +++ ircd-ircdev/doc/en/log.txt Sat May 7 15:23:39 2005 @@ -1,4 +1,4 @@ -$Id: log.txt,v 1.1 2005/01/05 18:00:34 zolty Exp $ +$Id: log.txt,v 1.2 2005/05/07 22:23:39 zolty Exp $ Older versions of ircd had no consistent way of logging various actions. Some things, such as G-lines, were written out to log files @@ -109,15 +109,15 @@ * SOCKET - Used to report problems with sockets. By default, log messages to this subsystem go nowhere. + * IAUTH - Used to report connects, disconnects and errors for the + IAuth authorization mechanism. By default, log messages to this + subsystem go to the "NETWORK" server notice mask. + * DEBUG - Used only when debugging is enabled. All log messages to this subsystem go either to the console or to the debug log file compiled into the server, as well as to the "DEBUG" server notice mask. This is the only subsystem with a default log file. - * OLDLOG - Not used anywhere. This is a left-over from when the - logging subsystem was first created. Log messages to this - subsystem go nowhere. - Configuration The true power of the logging subsystem comes from its extremely Index: ircd-ircdev/include/ircd_log.h diff -u ircd-ircdev/include/ircd_log.h:1.6 ircd-ircdev/include/ircd_log.h:1.7 --- ircd-ircdev/include/ircd_log.h:1.6 Wed Mar 23 10:34:25 2005 +++ ircd-ircdev/include/ircd_log.h Sat May 7 15:23:39 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief IRC logging interface. - * @version $Id: ircd_log.h,v 1.6 2005/03/23 18:34:25 zolty Exp $ + * @version $Id: ircd_log.h,v 1.7 2005/05/07 22:23:39 zolty Exp $ */ #ifndef INCLUDED_ircd_log_h #define INCLUDED_ircd_log_h @@ -70,8 +70,8 @@ LS_OPER, /**< Users becoming operators. */ LS_RESOLVER, /**< DNS resolver errors. */ LS_SOCKET, /**< Unexpected socket operation errors. */ + LS_IAUTH, /**< IAuth status. */ LS_DEBUG, /**< Debug messages. */ - LS_OLDLOG, /**< Old logging messages (no longer used). */ LS_LAST_SYSTEM /**< Count of valid LogSys values. */ }; Index: ircd-ircdev/include/numeric.h diff -u ircd-ircdev/include/numeric.h:1.12 ircd-ircdev/include/numeric.h:1.13 --- ircd-ircdev/include/numeric.h:1.12 Mon Apr 11 01:44:59 2005 +++ ircd-ircdev/include/numeric.h Sat May 7 15:23:39 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Declarations of numeric replies and supporting functions. - * @version $Id: numeric.h,v 1.12 2005/04/11 08:44:59 zolty Exp $ + * @version $Id: numeric.h,v 1.13 2005/05/07 22:23:39 zolty Exp $ */ #ifndef INCLUDED_numeric_h #define INCLUDED_numeric_h @@ -462,13 +462,14 @@ ERR_WHOLIMEXCEED 523 dalnet */ #define ERR_QUARANTINED 524 /* Undernet extension -Vampire */ -#define ERR_NOTLOWEROPLEVEL 550 /* Undernet extension */ -#define ERR_NOTMANAGER 551 /* Undernet extension */ -#define ERR_CHANSECURED 552 /* Undernet extension */ -#define ERR_UPASSSET 553 /* Undernet extension */ -#define ERR_UPASSNOTSET 554 /* Undernet extension */ -#define ERR_NOMANAGER_LONG 555 /* Undernet extension */ -#define ERR_NOMANAGER_SHORT 556 /* Undernet extension */ +#define ERR_NOTLOWEROPLEVEL 560 /* Undernet extension */ +#define ERR_NOTMANAGER 561 /* Undernet extension */ +#define ERR_CHANSECURED 562 /* Undernet extension */ +#define ERR_UPASSSET 563 /* Undernet extension */ +#define ERR_UPASSNOTSET 564 /* Undernet extension */ +#define ERR_NOMANAGER_LONG 565 /* Undernet extension */ +#define ERR_NOMANAGER_SHORT 566 /* Undernet extension */ +#define ERR_UPASS_SAME_APASS 567 /* Undernet extension */ #define RPL_LOGON 600 /* Dalnet extension */ #define RPL_LOGOFF 601 /* Dalnet extension */ Index: ircd-ircdev/include/patchlevel.h diff -u ircd-ircdev/include/patchlevel.h:1.32 ircd-ircdev/include/patchlevel.h:1.33 --- ircd-ircdev/include/patchlevel.h:1.32 Sat May 7 05:43:28 2005 +++ ircd-ircdev/include/patchlevel.h Sat May 7 15:23:40 2005 @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: patchlevel.h,v 1.32 2005/05/07 12:43:28 zolty Exp $ + * $Id: patchlevel.h,v 1.33 2005/05/07 22:23:40 zolty Exp $ * */ -#define PATCHLEVEL ".alpha31" +#define PATCHLEVEL ".alpha32" #define RELEASE "1.0" Index: ircd-ircdev/ircd/channel.c diff -u ircd-ircdev/ircd/channel.c:1.19 ircd-ircdev/ircd/channel.c:1.20 --- ircd-ircdev/ircd/channel.c:1.19 Sun Apr 24 15:18:05 2005 +++ ircd-ircdev/ircd/channel.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Channel management and maintanance - * @version $Id: channel.c,v 1.19 2005/04/24 22:18:05 zolty Exp $ + * @version $Id: channel.c,v 1.20 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -2624,6 +2624,11 @@ send_reply(state->sptr, ERR_UPASSNOTSET, state->chptr->chname, state->chptr->chname); return; } + /* cannot set a +U password that is the same as +A */ + if (state->dir == MODE_ADD && !ircd_strcmp(state->chptr->mode.apass, t_str)) { + send_reply(state->sptr, ERR_UPASS_SAME_APASS, state->chptr->chname); + return; + } /* can't add a upass if one is set, nor can one remove the wrong upass */ if ((state->dir == MODE_ADD && *state->chptr->mode.upass) || (state->dir == MODE_DEL && @@ -3535,7 +3540,9 @@ remove_user_from_channel(jbuf->jb_source, chan); } else { #if defined(UNDERNET) - int oplevel = chan->mode.apass[0] ? 0 : MAXOPLEVEL; + int oplevel = !chan->mode.apass[0] ? MAXOPLEVEL + : (flags & CHFL_CHANNEL_MANAGER) ? 0 + : 1; /* Add user to channel */ if ((chan->mode.mode & MODE_DELJOINS) && !(flags & CHFL_VOICED_OR_OPPED)) add_user_to_channel(chan, jbuf->jb_source, flags | CHFL_DELAYED, oplevel); @@ -3551,16 +3558,24 @@ /* send notification to all servers */ if (jbuf->jb_type != JOINBUF_TYPE_CREATE && !IsLocalChannel(chan->chname)) - sendcmdto_serv_butone(jbuf->jb_source, CMD_JOIN, jbuf->jb_connect, - "%H %Tu", chan, chan->creationtime); + { +#if defined(UNDERNET) + if (flags & CHFL_CHANOP) + sendcmdto_serv_butone(jbuf->jb_source, CMD_JOIN, jbuf->jb_connect, + "%u:%H %Tu", oplevel, chan, chan->creationtime); + else +#endif + sendcmdto_serv_butone(jbuf->jb_source, CMD_JOIN, jbuf->jb_connect, + "%H %Tu", chan, chan->creationtime); + } if (!((chan->mode.mode & MODE_DELJOINS) && !(flags & CHFL_VOICED_OR_OPPED))) { /* Send the notification to the channel */ sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_JOIN, chan, NULL, 0, "%H", chan); /* send an op, too, if needed */ - if (!MyUser(jbuf->jb_source) && jbuf->jb_type == JOINBUF_TYPE_CREATE) - sendcmdto_channel_butserv_butone(jbuf->jb_source, CMD_MODE, chan, NULL, 0, "%H +o %C", + if (flags & CHFL_CHANOP) + sendcmdto_channel_butserv_butone(&me, CMD_MODE, chan, NULL, 0, "%H +o %C", chan, jbuf->jb_source); } else if (MyUser(jbuf->jb_source)) sendcmdto_one(jbuf->jb_source, CMD_JOIN, jbuf->jb_source, ":%H", chan); Index: ircd-ircdev/ircd/ddb.c diff -u ircd-ircdev/ircd/ddb.c:1.7 ircd-ircdev/ircd/ddb.c:1.8 --- ircd-ircdev/ircd/ddb.c:1.7 Sat May 7 05:43:29 2005 +++ ircd-ircdev/ircd/ddb.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Implementation of Distributed DataBase. - * @version $Id: ddb.c,v 1.7 2005/05/07 12:43:29 zolty Exp $ + * @version $Id: ddb.c,v 1.8 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -31,6 +31,7 @@ #include "ircd_chattr.h" #include "ircd_log.h" #include "ircd_reply.h" +#include "ircd_snprintf.h" #include "ircd_string.h" #include "ircd_tea.h" #include "list.h" @@ -124,9 +125,11 @@ /* ID Mask Key Content */ if (content) - sprintf(buf, "%u %s %s %s", id, mask, key, content); + ircd_snprintf(0, buf, sizeof(buf), "%u %s %s %s", + id, mask, key, content); else - sprintf(buf, "%u %s %s", id, mask, key); + ircd_snprintf(0, buf, sizeof(buf), "%u %s %s", + id, mask, key); memset(buffer, 0, sizeof(buffer)); strncpy((char *)buffer, buf, sizeof(buffer) - 1); @@ -623,7 +626,7 @@ vsprintf(exitmsg2, pattern, vl); va_end(vl); - sprintf(exitmsg, "DDB Error: %s", exitmsg2); + ircd_snprintf(0, exitmsg, sizeof(exitmsg), "DDB Error: %s", exitmsg2); for (i = 0; i <= HighestFd; i++) { Index: ircd-ircdev/ircd/ddb_db_native.c diff -u ircd-ircdev/ircd/ddb_db_native.c:1.2 ircd-ircdev/ircd/ddb_db_native.c:1.3 --- ircd-ircdev/ircd/ddb_db_native.c:1.2 Sat May 7 05:43:29 2005 +++ ircd-ircdev/ircd/ddb_db_native.c Sat May 7 15:23:40 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief Native DataBase implementation of Distributed DataBase. - * @version $Id: ddb_db_native.c,v 1.2 2005/05/07 12:43:29 zolty Exp $ + * @version $Id: ddb_db_native.c,v 1.3 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -321,7 +321,7 @@ inttobase64(hash, ddb_hashtable_hi[table], 6); inttobase64(hash + 6, ddb_hashtable_lo[table], 6); - sprintf(path, "%c %s\n", table, hash); + ircd_snprintf(0, path, sizeof(path), "%c %s\n", table, hash); if (write(fd, path, strlen(path)) == -1) ddb_die("Error when saving table '%c' hashes (WRITE)", table); close(fd); Index: ircd-ircdev/ircd/ddb_events.c diff -u ircd-ircdev/ircd/ddb_events.c:1.2 ircd-ircdev/ircd/ddb_events.c:1.3 --- ircd-ircdev/ircd/ddb_events.c:1.2 Thu Apr 28 15:00:08 2005 +++ ircd-ircdev/ircd/ddb_events.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Events of Distributed DataBase. - * @version $Id: ddb_events.c,v 1.2 2005/04/28 22:00:08 zolty Exp $ + * @version $Id: ddb_events.c,v 1.3 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -29,6 +29,7 @@ #include "client.h" #include "hash.h" #include "ircd.h" +#include "ircd_snprintf.h" #include "ircd_tea.h" #include "msg.h" #include "numnicks.h" @@ -161,7 +162,8 @@ if (x[0] >= 4294000000ul) continue; - sprintf(newnick, "Guest%.6d", (int)(x[0] % 1000000)); + ircd_snprintf(0, newnick, sizeof(newnick), "Guest%.6d", + (int)(x[0] % 1000000)); acptr = FindUser(newnick); } while (acptr); @@ -170,7 +172,7 @@ parv[0] = cli_name(cptr); parv[1] = newnick; - sprintf(tmp, "%lu", TStime()); + ircd_snprintf(0, tmp, sizeof(tmp), "%T", TStime()); parv[2] = tmp; set_nick_name(cptr, cptr, newnick, 3, parv, flags); Index: ircd-ircdev/ircd/engine_epoll.c diff -u ircd-ircdev/ircd/engine_epoll.c:1.9 ircd-ircdev/ircd/engine_epoll.c:1.10 --- ircd-ircdev/ircd/engine_epoll.c:1.9 Mon Mar 21 10:39:06 2005 +++ ircd-ircdev/ircd/engine_epoll.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Linux epoll_*() event engine. - * @version $Id: engine_epoll.c,v 1.9 2005/03/21 18:39:06 zolty Exp $ + * @version $Id: engine_epoll.c,v 1.10 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -279,9 +279,9 @@ gen_ref_dec(sock); continue; } - } - - switch (s_state(sock)) { + } else if (events[i].events & EPOLLHUP) { + event_generate(ET_EOF, sock, 0); + } else switch (s_state(sock)) { case SS_CONNECTING: if (events[i].events & EPOLLOUT) /* connection completed */ event_generate(ET_CONNECT, sock, 0); @@ -294,12 +294,6 @@ case SS_NOTSOCK: case SS_CONNECTED: - if (events[i].events & EPOLLIN) - event_generate((events[i].events & EPOLLHUP) ? ET_EOF : ET_READ, sock, 0); - if (events[i].events & EPOLLOUT) - event_generate(ET_WRITE, sock, 0); - break; - case SS_DATAGRAM: case SS_CONNECTDG: if (events[i].events & EPOLLIN) Index: ircd-ircdev/ircd/ircd_auth.c diff -u ircd-ircdev/ircd/ircd_auth.c:1.5 ircd-ircdev/ircd/ircd_auth.c:1.6 --- ircd-ircdev/ircd/ircd_auth.c:1.5 Mon Mar 21 10:39:07 2005 +++ ircd-ircdev/ircd/ircd_auth.c Sat May 7 15:23:40 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief IAuth client implementation for an IRC server. - * @version $Id: ircd_auth.c,v 1.5 2005/03/21 18:39:07 zolty Exp $ + * @version $Id: ircd_auth.c,v 1.6 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" #include "client.h" @@ -245,6 +245,7 @@ memset(&i_addr(iauth), 0, sizeof(i_addr(iauth))); i_port(iauth) = port; iauth_active = iauth; + timer_init(&i_reconn_timer(iauth)); i_reconnect(iauth) = reconnect; iauth_reconnect(iauth); } @@ -313,7 +314,7 @@ if (t_active(&i_request_timer(iauth))) timer_del(&i_request_timer(iauth)); /* Disconnect from the server. */ - if (s_fd(&i_socket(iauth)) != -1) + if (i_GetConnected(iauth)) iauth_disconnect(iauth); /* Free memory. */ MyFree(iauth); @@ -400,7 +401,7 @@ { close(s_fd(&i_socket(iauth))); socket_del(&i_socket(iauth)); - s_fd(&i_socket(iauth)) = -1; + i_ClrConnected(iauth); } /** DNS completion callback for an %IAuth connection. @@ -411,11 +412,11 @@ { struct IAuth *iauth = vptr; if (!he) { - sendto_opmask_butone(0, SNO_OLDSNO, "IAuth connection to %s failed: host lookup failed", i_host(iauth)); + log_write(LS_IAUTH, L_NOTICE, 0, "IAuth connection to %s failed: host lookup failed", i_host(iauth)); } else { memcpy(&i_addr(iauth).addr, &he->addr, sizeof(i_addr(iauth).addr)); if (!irc_in_addr_valid(&i_addr(iauth).addr)) { - sendto_opmask_butone(0, SNO_OLDSNO, "IAuth connection to %s failed: host came back as unresolved", i_host(iauth)); + log_write(LS_IAUTH, L_NOTICE, 0, "IAuth connection to %s failed: host came back as unresolved", i_host(iauth)); return; } iauth_reconnect(iauth); @@ -437,9 +438,12 @@ static void iauth_schedule_reconnect(struct IAuth *iauth) { struct Timer *timer; - assert(!t_active(&i_reconn_timer(iauth))); - timer = timer_init(&i_reconn_timer(iauth)); - timer_add(timer, iauth_reconnect_ev, iauth, TT_RELATIVE, i_reconnect(iauth)); + timer = &i_reconn_timer(iauth); + if (t_onqueue(timer)) + timer_chg(timer, TT_RELATIVE, i_reconnect(iauth)); + else + timer_add(&i_reconn_timer(iauth), iauth_reconnect_ev, + iauth, TT_RELATIVE, i_reconnect(iauth)); } /** Initiate a (re-)connection to \a iauth. @@ -451,7 +455,12 @@ IOResult result; int fd; - Debug((DEBUG_INFO, "IAuth attempt connection to %s port %p.", i_host(iauth), i_port(iauth))); + if (i_GetConnected(iauth)) { + iauth_disconnect(iauth); + iauth_schedule_reconnect(iauth); + return; + } + log_write(LS_IAUTH, L_DEBUG, 0, "IAuth attempt connection to %s port %p.", i_host(iauth), i_port(iauth)); if (!irc_in_addr_valid(&i_addr(iauth).addr) && !ircd_aton(&i_addr(iauth).addr, i_host(iauth))) { i_query(iauth).vptr = iauth; @@ -461,26 +470,32 @@ } local = irc_in_addr_is_ipv4(&i_addr(iauth).addr) ? &VirtualHost_v4 : &VirtualHost_v6; fd = os_socket(local, SOCK_STREAM, "IAuth"); - if (fd < 0) + if (fd < 0) { + iauth_schedule_reconnect(iauth); return; + } if (!os_set_sockbufs(fd, SERVER_TCP_WINDOW, SERVER_TCP_WINDOW)) { - close(fd); - sendto_opmask_butone(0, SNO_OLDSNO, "IAuth reconnect unable to set socket buffers: %s", strerror(errno)); - return; + log_write(LS_IAUTH, L_WARNING, 0, "IAuth reconnect unable to set socket buffers: %s", strerror(errno)); + goto failure; } + s_fd(&i_socket(iauth)) = fd; result = os_connect_nonb(fd, &i_addr(iauth)); if (result == IO_FAILURE) { - close(fd); - sendto_opmask_butone(0, SNO_OLDSNO, "IAuth reconnect unable to initiate connection: %s", strerror(errno)); - return; + log_write(LS_IAUTH, L_NOTICE, 0, "IAuth reconnect unable to initiate connection: %s", strerror(errno)); + goto failure; } if (!socket_add(&i_socket(iauth), iauth_sock_callback, iauth, (result == IO_SUCCESS) ? SS_CONNECTED : SS_CONNECTING, SOCK_EVENT_READABLE | SOCK_EVENT_WRITABLE, fd)) { - close(fd); - sendto_opmask_butone(0, SNO_OLDSNO, "IAuth reconnect unable to add socket: %s", strerror(errno)); - return; + log_write(LS_IAUTH, L_WARNING, 0, "IAuth reconnect unable to add socket: %s", strerror(errno)); + goto failure; } + return; +failure: + close(fd); + i_ClrConnected(iauth); + iauth_schedule_reconnect(iauth); + return; } /** Read input from \a iauth. @@ -494,8 +509,11 @@ char readbuf[SERVER_TCP_WINDOW]; length = 0; - if (IO_FAILURE == os_recv_nonb(s_fd(&i_socket(iauth)), readbuf, sizeof(readbuf), &length)) - return; + if (IO_FAILURE == os_recv_nonb(s_fd(&i_socket(iauth)), readbuf, sizeof(readbuf), &length) + || length == 0) { + iauth_reconnect(iauth); + return; + } i_recvB(iauth) += length; if (i_recvB(iauth) > 1023) { i_recvK(iauth) += i_recvB(iauth) >> 10; @@ -609,13 +627,12 @@ i_ClrBlocked(iauth); iauth_write(iauth); break; - case ET_EOF: - iauth_disconnect(iauth); - break; case ET_ERROR: - sendto_opmask_butone(0, SNO_OLDSNO, "IAuth socket error: %s", strerror(ev_data(ev))); - log_write(LS_SOCKET, L_ERROR, 0, "IAuth socket error: %s", strerror(ev_data(ev))); + log_write(LS_IAUTH, L_ERROR, 0, "IAuth socket error: %s", strerror(ev_data(ev))); + /* and fall through to the ET_EOF case */ + case ET_EOF: iauth_disconnect(iauth); + iauth_schedule_reconnect(iauth); break; default: assert(0 && "Unrecognized event type"); @@ -632,7 +649,7 @@ { /* TODO: this could probably be more intelligent */ if (ev_type(ev) == ET_EXPIRE) { - sendto_opmask_butone(0, SNO_OLDSNO, "IAuth request timed out; reconnecting"); + log_write(LS_IAUTH, L_NOTICE, 0, "IAuth request timed out; reconnecting"); iauth_reconnect(t_data(ev_timer(ev))); } } @@ -683,6 +700,7 @@ /* Allocate and initialize IAuthRequest struct. */ if (!(iar = MyCalloc(1, sizeof(*iar)))) return exit_client(cptr, cptr, &me, "IAuth memory allocation failed"); + cli_iauth(cptr) = iar; iar->iar_next = &i_list_head(iauth); iar->iar_prev = i_list_head(iauth).iar_prev; iar->iar_client = cptr; @@ -704,8 +722,10 @@ if (cli_iauth(cptr)) { iauth_dispose_request(iauth_active, cli_iauth(cptr)); cli_iauth(cptr) = NULL; - } else if (IsIAuthed(cptr) && i_GetIClass(iauth_active)) { - /* TODO: report quit to iauth */ + } + if (iauth_active && i_GetConnected(iauth_active)) { + iauth_send(iauth_active, "ExitUser %x", cptr); + iauth_write(iauth_active); } } @@ -736,7 +756,7 @@ static void iauth_dispose_request(struct IAuth *iauth, struct IAuthRequest *iar) { assert(iar->iar_client != NULL); - if (iar->iar_timed) + if (iar->iar_timed && t_active(&i_request_timer(iauth))) timer_del(&i_request_timer(iauth)); cli_iauth(iar->iar_client) = NULL; iar->iar_prev->iar_next = iar->iar_next; Index: ircd-ircdev/ircd/ircd_log.c diff -u ircd-ircdev/ircd/ircd_log.c:1.9 ircd-ircdev/ircd/ircd_log.c:1.10 --- ircd-ircdev/ircd/ircd_log.c:1.9 Wed Mar 23 10:34:48 2005 +++ ircd-ircdev/ircd/ircd_log.c Sat May 7 15:23:40 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief IRC logging implementation. - * @version $Id: ircd_log.c,v 1.9 2005/03/23 18:34:48 zolty Exp $ + * @version $Id: ircd_log.c,v 1.10 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -165,8 +165,8 @@ S(OPER, -1, SNO_OLDREALOP), S(RESOLVER, -1, 0), S(SOCKET, -1, 0), + S(IAUTH, -1, SNO_NETWORK), S(DEBUG, -1, SNO_DEBUG), - S(OLDLOG, -1, 0), #undef S { LS_LAST_SYSTEM, 0, 0, -1, 0, -1, 0 } }; Index: ircd-ircdev/ircd/m_db.c diff -u ircd-ircdev/ircd/m_db.c:1.4 ircd-ircdev/ircd/m_db.c:1.5 --- ircd-ircdev/ircd/m_db.c:1.4 Sat May 7 05:43:29 2005 +++ ircd-ircdev/ircd/m_db.c Sat May 7 15:23:40 2005 @@ -22,7 +22,7 @@ */ /** @file * @brief Handlers for DB command. - * @version $Id: m_db.c,v 1.4 2005/05/07 12:43:29 zolty Exp $ + * @version $Id: m_db.c,v 1.5 2005/05/07 22:23:40 zolty Exp $ */ /* TODO-ZOLTAN * Traducidr los comentarios al ingles */ @@ -149,14 +149,15 @@ /* Desconectamos con todos los hubs menos el que nos envia la orden */ log_write(LS_DDB, L_INFO, 0, "DB Drop Table %c from %#C", table, cptr); - sprintf(ddb_buf, "DB DROP Table %c from %s", table, cli_name(cptr)); + ircd_snprintf(0, ddb_buf, sizeof(ddb_buf), "DB DROP Table %c from %s", + table, cli_name(cptr)); ddb_splithubs_butone(cptr, ddb_buf); /* Mandamos la respuesta de conformidad */ sendcmdto_one(&me, CMD_DB, cptr, "%s 0 E %s %c", cli_name(cptr), parv[4], table); - /* TODO-ZOLTAN: Cosa de ryden. Creo que hay que mandar a todos */ + /* TODO-ZOLTAN: Creo que hay que mandar a todos */ cli_serv(cptr)->ddb_open &= ~ddb_mask; /* Solicitamos de nuevo la tabla */ @@ -368,10 +369,10 @@ (cli_serv(lp->value.cptr)->ddb_open & ddb_mask)) { if (!delete) - sendcmdto_one(&me, CMD_DB, lp->value.cptr, "%s %u %c %s %s :%s", + sendcmdto_one(&me, CMD_DB, lp->value.cptr, "%s %u %c %s :%s", parv[1], id, table, parv[4], parv[5]); else - sendcmdto_one(&me, CMD_DB, lp->value.cptr, "%s %u %c %s %s", + sendcmdto_one(&me, CMD_DB, lp->value.cptr, "%s %u %c %s", parv[1], id, table, parv[4]); } } Index: ircd-ircdev/ircd/m_invite.c diff -u ircd-ircdev/ircd/m_invite.c:1.10 ircd-ircdev/ircd/m_invite.c:1.11 --- ircd-ircdev/ircd/m_invite.c:1.10 Thu Apr 28 15:00:08 2005 +++ ircd-ircdev/ircd/m_invite.c Sat May 7 15:23:40 2005 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_invite.c,v 1.10 2005/04/28 22:00:08 zolty Exp $ + * $Id: m_invite.c,v 1.11 2005/05/07 22:23:40 zolty Exp $ * */ @@ -179,6 +179,9 @@ if (MyConnect(acptr)) { add_invite(acptr, chptr); sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr); + } else { + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr), chptr, + chptr->creationtime); } if (!IsLocalChannel(chptr->chname) || MyConnect(acptr)) { @@ -189,7 +192,7 @@ "%H %C %C :%C has been invited by %C", chptr, acptr, sptr, acptr, sptr); /* Announce to servers with channel operators. */ - sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, SKIP_NONOPS, + sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS, "%s %H %Tu", cli_name(acptr), chptr, chptr->creationtime); } @@ -281,8 +284,11 @@ return 0; if (MyConnect(acptr)) { - add_invite(acptr, chptr); - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr); + add_invite(acptr, chptr); + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr); + } else { + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr), chptr, + chptr->creationtime); } if (feature_bool(FEAT_ANNOUNCE_INVITES)) { @@ -292,11 +298,10 @@ "%H %C %C :%C has been invited by %C", chptr, acptr, sptr, acptr, sptr); /* Announce to servers with channel operators. */ - sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, NULL, SKIP_NONOPS, + sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS, "%s %H %Tu", cli_name(acptr), chptr, chptr->creationtime); } return 0; } - Index: ircd-ircdev/ircd/m_join.c diff -u ircd-ircdev/ircd/m_join.c:1.10 ircd-ircdev/ircd/m_join.c:1.11 --- ircd-ircdev/ircd/m_join.c:1.10 Mon Mar 21 10:39:08 2005 +++ ircd-ircdev/ircd/m_join.c Sat May 7 15:23:40 2005 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_join.c,v 1.10 2005/03/21 18:39:08 zolty Exp $ + * $Id: m_join.c,v 1.11 2005/05/07 22:23:40 zolty Exp $ * */ @@ -169,9 +169,6 @@ struct Channel *chptr; struct JoinBuf join; struct JoinBuf create; -#if defined(UNDERNET) - struct ModeBuf mbuf; -#endif struct Gline *gline; unsigned int flags = 0; int i, j, k = 0; @@ -249,8 +246,7 @@ #if defined(UNDERNET) int is_level0_op = 0; if (!BadPtr(keys) && *chptr->mode.apass) { - /* Don't use compall for the apass, only a single key is allowed. - Test Apass first in case someone set Apass and upass equal. */ + /* Don't use compall for the apass, only a single key is allowed. */ if (strcmp(chptr->mode.apass, keys) == 0) { is_level0_op = 1; flags &= ~CHFL_DEOPPED; @@ -307,18 +303,6 @@ } /* else if ((i = can_join(sptr, chptr, keys))) */ joinbuf_join(&join, chptr, flags); -#if defined(UNDERNET) - if (is_level0_op) - { - joinbuf_flush(&join); - modebuf_init(&mbuf, &me, cptr, chptr, - MODEBUF_DEST_CHANNEL | /* Send mode to channel */ - MODEBUF_DEST_SERVER); /* And send it to the other servers */ - modebuf_mode_client(&mbuf, - MODE_ADD | MODE_CHANOP, sptr); /* Give ops to the level0 op */ - modebuf_flush(&mbuf); - } -#endif } else if (!(chptr = get_channel(sptr, name, CGT_CREATE))) continue; /* couldn't get channel */ else if (check_target_limit(sptr, chptr, chptr->chname, 1)) @@ -365,7 +349,7 @@ struct Membership *member; struct Channel *chptr; struct JoinBuf join; - unsigned int flags = 0; + unsigned int flags; time_t creation = 0; char *p = 0; char *chanlist; @@ -398,6 +382,21 @@ if (join0(&join, cptr, sptr, name)) /* did client do a JOIN 0? */ continue; +#if defined(UNDERNET) + if (name[0] == '0' && name[1] == ':') + { + flags = CHFL_CHANOP | CHFL_CHANNEL_MANAGER; + name += 2; + } + else if (name[0] == '1' && name[1] == ':') + { + flags = CHFL_CHANOP; + name += 2; + } + else + flags = CHFL_DEOPPED; +#endif + if (IsLocalChannel(name) || !IsChannelName(name)) { protocol_violation(cptr, "%s tried to join %s", cli_name(sptr), name); @@ -413,9 +412,9 @@ name,cli_name(sptr)); continue; } - flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0); + flags |= HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0; - /* when the network is 2.10.11+ then remove MAGIC_REMOTE_JOIN_TS */ + /* when the network is 2.10.11+ then remove MAGIC_REMOTE_JOIN_TS */ chptr->creationtime = creation ? creation : MAGIC_REMOTE_JOIN_TS; } else { /* We have a valid channel? */ @@ -430,12 +429,12 @@ chptr = FindChannel(name); } else - flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0); + flags |= HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0; /* Always copy the timestamp when it is older, that is the only way to ensure network-wide synchronization of creation times. */ if (creation && creation < chptr->creationtime) chptr->creationtime = creation; - } + } joinbuf_join(&join, chptr, flags); } Index: ircd-ircdev/ircd/m_svsnick.c diff -u ircd-ircdev/ircd/m_svsnick.c:1.1 ircd-ircdev/ircd/m_svsnick.c:1.2 --- ircd-ircdev/ircd/m_svsnick.c:1.1 Thu Mar 31 04:58:04 2005 +++ ircd-ircdev/ircd/m_svsnick.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Handlers for SVSNICK command. - * @version $Id: m_svsnick.c,v 1.1 2005/03/31 12:58:04 zolty Exp $ + * @version $Id: m_svsnick.c,v 1.2 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -122,7 +122,8 @@ if (x[0] >= 4294000000ul) continue; - sprintf(newnick, "Guest%.6d", (int)(x[0] % 1000000)); + ircd_snprintf(0, newnick, sizeof(newnick), "Guest%.6d", + (int)(x[0] % 1000000)); bcptr = FindUser(newnick); } while (bcptr); @@ -141,7 +142,7 @@ parv[1] = newnick; { char tmp[100]; - sprintf(tmp, "%lu", TStime()); + ircd_snprintf(0, tmp, sizeof(tmp), "%T", TStime()); parv[2] = tmp; } Index: ircd-ircdev/ircd/numnicks.c diff -u ircd-ircdev/ircd/numnicks.c:1.7 ircd-ircdev/ircd/numnicks.c:1.8 --- ircd-ircdev/ircd/numnicks.c:1.7 Fri Apr 22 09:22:13 2005 +++ ircd-ircdev/ircd/numnicks.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Implementation of numeric nickname operations. - * @version $Id: numnicks.c,v 1.7 2005/04/22 16:22:13 zolty Exp $ + * @version $Id: numnicks.c,v 1.8 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -505,9 +505,12 @@ memset(addr, 0, sizeof(*addr)); if (strlen(input) == 6) { unsigned int in = base64toint(input); - addr->in6_16[5] = htons(65535); - addr->in6_16[6] = htons(in >> 16); - addr->in6_16[7] = htons(in & 65535); + /* An all-zero address should stay that way. */ + if (in) { + addr->in6_16[5] = htons(65535); + addr->in6_16[6] = htons(in >> 16); + addr->in6_16[7] = htons(in & 65535); + } } else { unsigned int pos = 0; do { Index: ircd-ircdev/ircd/s_err.c diff -u ircd-ircdev/ircd/s_err.c:1.18 ircd-ircdev/ircd/s_err.c:1.19 --- ircd-ircdev/ircd/s_err.c:1.18 Thu Apr 28 15:00:09 2005 +++ ircd-ircdev/ircd/s_err.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Error handling support. - * @version $Id: s_err.c,v 1.18 2005/04/28 22:00:09 zolty Exp $ + * @version $Id: s_err.c,v 1.19 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -1146,22 +1146,6 @@ { 0 }, /* 549 */ { 0 }, -#if defined(UNDERNET) -/* 550 */ - { ERR_NOTLOWEROPLEVEL, "%s %s %hu %hu :Cannot %s someone with %s op-level", "550" }, -/* 551 */ - { ERR_NOTMANAGER, "%s :You must be channel Admin to add or remove a password. Use /JOIN %s <AdminPass>.", "551" }, -/* 552 */ - { ERR_CHANSECURED, "%s :Channel is older than 48 hours and secured. Cannot change Admin pass anymore", "552" }, -/* 553 */ - { ERR_UPASSSET, "%s :Cannot remove Admin pass (+A) while User pass (+U) is still set. First use /MODE %s -U <userpass>", "553" }, -/* 554 */ - { ERR_UPASSNOTSET, "%s :Cannot set user pass (+U) while Admin pass (+A) is set. First use /MODE %s +A <adminpass>", "554" }, - /* 555 */ - { ERR_NOMANAGER_LONG, "%s :Re-create the channel. The channel must be *empty* for 48 continuous hours before it can be recreated.", "555" }, - /* 556 */ - { ERR_NOMANAGER_SHORT, "%s :Re-create the channel. The channel must be *empty* for a minute or two before it can be recreated.", "556" }, -#else /* 550 */ { 0 }, /* 551 */ @@ -1176,13 +1160,30 @@ { 0 }, /* 556 */ { 0 }, -#endif /* 557 */ { 0 }, /* 558 */ { 0 }, /* 559 */ { 0 }, +#if defined(UNDERNET) +/* 560 */ + { ERR_NOTLOWEROPLEVEL, "%s %s %hu %hu :Cannot %s someone with %s op-level", "550" }, +/* 561 */ + { ERR_NOTMANAGER, "%s :You must be channel Admin to add or remove a password. Use /JOIN %s <AdminPass>.", "551" }, +/* 562 */ + { ERR_CHANSECURED, "%s :Channel is older than 48 hours and secured. Cannot change Admin pass anymore", "552" }, +/* 563 */ + { ERR_UPASSSET, "%s :Cannot remove Admin pass (+A) while User pass (+U) is still set. First use /MODE %s -U <userpass>", "553" }, +/* 564 */ + { ERR_UPASSNOTSET, "%s :Cannot set user pass (+U) while Admin pass (+A) is set. First use /MODE %s +A <adminpass>", "554" }, +/* 565 */ + { ERR_NOMANAGER_LONG, "%s :Re-create the channel. The channel must be *empty* for 48 continuous hours before it can be recreated.", "555" }, +/* 566 */ + { ERR_NOMANAGER_SHORT, "%s :Re-create the channel. The channel must be *empty* for a minute or two before it can be recreated.", "556" }, +/* 567 */ + { ERR_UPASS_SAME_APASS, "%s :Cannot use the same pass for both admin (+A) and user (+U) pass.", "567" }, +#else /* 560 */ { 0 }, /* 561 */ @@ -1199,6 +1200,7 @@ { 0 }, /* 567 */ { 0 }, +#endif /* 568 */ { 0 }, /* 569 */ Index: ircd-ircdev/ircd/s_misc.c diff -u ircd-ircdev/ircd/s_misc.c:1.9 ircd-ircdev/ircd/s_misc.c:1.10 --- ircd-ircdev/ircd/s_misc.c:1.9 Sat Apr 2 11:47:35 2005 +++ ircd-ircdev/ircd/s_misc.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Miscellaneous support functions. - * @version $Id: s_misc.c,v 1.9 2005/04/02 19:47:35 zolty Exp $ + * @version $Id: s_misc.c,v 1.10 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -251,9 +251,8 @@ --UserStats.opers; if (MyConnect(bcptr)) Count_clientdisconnects(bcptr, UserStats); - else { + else Count_remoteclientquits(UserStats, bcptr); - } } else if (IsServer(bcptr)) { @@ -290,7 +289,7 @@ /* bcptr->user->server->serv->client_list[IndexYXX(bcptr)] = NULL; */ RemoveYXXClient(cli_user(bcptr)->server, cli_yxx(bcptr)); if (IsIAuthed(bcptr) || cli_iauth(bcptr)) - iauth_exit_client(bcptr); + iauth_exit_client(bcptr); } /* Remove bcptr from the client list */ Index: ircd-ircdev/ircd/s_stats.c diff -u ircd-ircdev/ircd/s_stats.c:1.13 ircd-ircdev/ircd/s_stats.c:1.14 --- ircd-ircdev/ircd/s_stats.c:1.13 Thu Apr 28 15:00:09 2005 +++ ircd-ircdev/ircd/s_stats.c Sat May 7 15:23:40 2005 @@ -22,7 +22,7 @@ /** @file * @brief Report configuration lines and other statistics from this * server. - * @version $Id: s_stats.c,v 1.13 2005/04/28 22:00:09 zolty Exp $ + * @version $Id: s_stats.c,v 1.14 2005/05/07 22:23:40 zolty Exp $ * * Note: The info is reported in the order the server uses * it--not reversed as in ircd.conf! @@ -175,12 +175,15 @@ { if (aconf->status != CONF_CLIENT) continue; - if ((!wilds && (!match(aconf->host, param) || - !match(aconf->name, param))) || - (wilds && (!mmatch(param, aconf->host) || - !mmatch(param, aconf->name)))) + if (wilds ? ((aconf->host && !mmatch(aconf->host, param)) + || (aconf->name && !mmatch(aconf->name, param))) + : ((aconf->host && !match(param, aconf->host)) + || (aconf->name && !match(param, aconf->name)))) { - send_reply(to, RPL_STATSILINE, 'I', aconf->host, aconf->name, + send_reply(to, RPL_STATSILINE, + (aconf->host ? aconf->host : "*"), aconf->maximum, + (aconf->name && aconf->name[0] == ':' ? "0" : ""), + aconf->name ? aconf->name : "*", aconf->address.port, get_conf_class(aconf)); if (--count == 0) break; Index: ircd-ircdev/ircd/s_user.c diff -u ircd-ircdev/ircd/s_user.c:1.16 ircd-ircdev/ircd/s_user.c:1.17 --- ircd-ircdev/ircd/s_user.c:1.16 Thu Apr 28 15:00:09 2005 +++ ircd-ircdev/ircd/s_user.c Sat May 7 15:23:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief Miscellaneous user-related helper functions. - * @version $Id: s_user.c,v 1.16 2005/04/28 22:00:09 zolty Exp $ + * @version $Id: s_user.c,v 1.17 2005/05/07 22:23:40 zolty Exp $ */ #include "config.h" @@ -1738,9 +1738,7 @@ int i; struct Flags c_flags = cli_flags(cptr); - if (HasPriv(cptr, PRIV_PROPAGATE)) - FlagSet(&c_flags, FLAG_OPER); - else + if (!HasPriv(cptr, PRIV_PROPAGATE)) FlagClr(&c_flags, FLAG_OPER); for (i = 0; i < USERMODELIST_SIZE; ++i) ----------------------- End of diff ----------------------- |