From 406478d22432ce0b02270a766d0c8e46372f3544 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Thu, 15 Apr 2010 00:46:33 +0200 Subject: [PATCH 01/26] Do not allow a topic change if a user may not send to the channel (resv, cmode +m, cmode +b, cmode +q, etc.). This is only checked for local users. For optimal compatibility, a failure for this reason still returns ERR_CHANOPRIVSNEEDED. Side effect: normal users cannot change topics of resv'ed channels, even if they have ops, just like they already cannot send messages. This only matters if resv_forcepart is disabled, as the user would have been removed from the channel otherwise. --- modules/m_topic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/m_topic.c b/modules/m_topic.c index 7e6206e4..55be75ae 100644 --- a/modules/m_topic.c +++ b/modules/m_topic.c @@ -114,7 +114,10 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char * return 0; } - if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr)) + if(((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || + is_chanop(msptr)) && + (!MyClient(source_p) || + can_send(chptr, source_p, msptr))) { char topic_info[USERHOST_REPLYLEN]; rb_sprintf(topic_info, "%s!%s@%s", From 0a01ecfa85ae5698d3bee9eb421ebb7b3c37acb5 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 18 Apr 2010 13:54:03 +0200 Subject: [PATCH 02/26] Fix crash if identify_service/identify_command were not specified in ircd.conf. --- src/s_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s_user.c b/src/s_user.c index d23a1933..4782304e 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -654,8 +654,8 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User * if(MyConnect(source_p) && source_p->localClient->passwd) { - if (ConfigFileEntry.identifyservice[0] != '\0' && - ConfigFileEntry.identifycommand[0] != '\0') + if (!EmptyString(ConfigFileEntry.identifyservice) && + !EmptyString(ConfigFileEntry.identifycommand)) { /* use user@server */ p = strchr(ConfigFileEntry.identifyservice, '@'); From a0ce140ed6a89fcc0201d3f2e36c598635a32cfa Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Thu, 29 Apr 2010 00:26:49 +0200 Subject: [PATCH 03/26] Improve technical documentation of BAN protocol. --- doc/technical/ts6-protocol.txt | 4 +++- modules/core/m_ban.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/technical/ts6-protocol.txt b/doc/technical/ts6-protocol.txt index 79ad1dc5..64beadbb 100644 --- a/doc/technical/ts6-protocol.txt +++ b/doc/technical/ts6-protocol.txt @@ -157,7 +157,9 @@ parameters: type, user mask, host mask, creation TS, duration, lifetime, oper, r Propagates a network wide ban. -The type is K for K:lines; other types are reserved. +The type is K for K:lines, R for resvs and X for X:lines; other types are +reserved. The user mask field is only used for K:lines; for resvs and X:lines +the field is ignored in input and sent as an asterisk. The creation TS indicates when this ban was last modified. An incoming ban MUST be ignored and not propagated if the creation TS is older than the creation TS diff --git a/modules/core/m_ban.c b/modules/core/m_ban.c index d966edd4..4ae6e066 100644 --- a/modules/core/m_ban.c +++ b/modules/core/m_ban.c @@ -116,6 +116,7 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p ptr = find_prop_ban(ntype, parv[2], parv[3]); if (ptr != NULL) { + /* We already know about this ban mask. */ aconf = ptr->data; if (aconf->created > created || (aconf->created == created && @@ -130,6 +131,11 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p aconf->host); return 0; } + /* act indicates if something happened (from the oper's + * point of view). This is the case if the ban was + * previously active (not deleted) or if the new ban + * is not a removal and not already expired. + */ act = !(aconf->status & CONF_ILLEGAL) || (hold != created && hold > rb_current_time()); if (lifetime > aconf->lifetime) @@ -137,6 +143,7 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p /* already expired, hmm */ if (aconf->lifetime <= rb_current_time()) return 0; + /* Deactivate, it will be reactivated later if appropriate. */ deactivate_conf(aconf, ptr); rb_free(aconf->user); aconf->user = NULL; @@ -151,6 +158,7 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p } else { + /* New ban mask. */ aconf = make_conf(); aconf->status = CONF_ILLEGAL | ntype; aconf->lifetime = lifetime; @@ -171,6 +179,13 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p aconf->passwd = rb_strndup(parv[parc - 1], p - parv[parc - 1] + 1); aconf->spasswd = rb_strdup(p + 1); } + /* The ban is fully filled in and in the prop_bans list + * but still deactivated. Now determine if it should be activated + * and send the server notices. + */ + /* We only reject *@* and the like here. + * Otherwise malformed bans are fairly harmless and can be removed. + */ switch (ntype) { case CONF_KILL: @@ -244,6 +259,11 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p aconf->user ? " " : "", aconf->host); } + /* If CONF_ILLEGAL is still set at this point, remove entries from the + * reject cache (for klines and xlines). + * If CONF_ILLEGAL is not set, add the ban to the type-specific data + * structure and take action on matched clients/channels. + */ switch (ntype) { case CONF_KILL: From 78e6b731e4210e6dc4de19bdc7ebc0184e84468a Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Fri, 30 Apr 2010 22:01:21 +0100 Subject: [PATCH 04/26] Rework ircd-side MLOCK enforcement: instead of trying to track modes locked on or off, instead keep a simple list of mode letters that are locked, and reject any change to those modes. --- include/channel.h | 5 ++--- modules/core/m_mode.c | 2 +- src/channel.c | 1 + src/chmode.c | 45 +++++++++---------------------------------- 4 files changed, 13 insertions(+), 40 deletions(-) diff --git a/include/channel.h b/include/channel.h index 923871ed..b7a80f4f 100644 --- a/include/channel.h +++ b/include/channel.h @@ -39,7 +39,6 @@ struct Client; struct Mode { unsigned int mode; - unsigned int off_mode; int limit; char key[KEYLEN]; unsigned int join_num; @@ -52,7 +51,7 @@ struct Channel { rb_dlink_node node; struct Mode mode; - struct Mode mode_lock; + char *mode_lock; char *topic; char *topic_info; time_t topic_time; @@ -264,7 +263,7 @@ void resv_chan_forcepart(const char *name, const char *reason, int temp_time); extern void set_channel_mode(struct Client *client_p, struct Client *source_p, struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]); extern void set_channel_mlock(struct Client *client_p, struct Client *source_p, - struct Channel *chptr, int parc, const char *parv[]); + struct Channel *chptr, const char *newmlock); extern struct ChannelMode chmode_table[256]; diff --git a/modules/core/m_mode.c b/modules/core/m_mode.c index 219b031c..4be9ab12 100644 --- a/modules/core/m_mode.c +++ b/modules/core/m_mode.c @@ -235,7 +235,7 @@ ms_mlock(struct Client *client_p, struct Client *source_p, int parc, const char return 0; if(IsServer(source_p)) - set_channel_mlock(client_p, source_p, chptr, parc - 3, parv + 3); + set_channel_mlock(client_p, source_p, chptr, parv[3]); return 0; } diff --git a/src/channel.c b/src/channel.c index 1a159f14..6c05cf1e 100644 --- a/src/channel.c +++ b/src/channel.c @@ -96,6 +96,7 @@ void free_channel(struct Channel *chptr) { rb_free(chptr->chname); + rb_free(chptr->mode_lock); rb_bh_free(channel_heap, chptr); } diff --git a/src/chmode.c b/src/chmode.c index ea0613ba..b345b8e1 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -516,7 +516,7 @@ chm_simple(struct Client *source_p, struct Channel *chptr, return; /* setting + */ - if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type) && !(chptr->mode_lock.off_mode & mode_type)) + if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type)) { /* if +f is disabled, ignore an attempt to set +QF locally */ if(!ConfigChannel.use_forward && MyClient(source_p) && @@ -533,7 +533,7 @@ chm_simple(struct Client *source_p, struct Channel *chptr, mode_changes[mode_count].mems = ALL_MEMBERS; mode_changes[mode_count++].arg = NULL; } - else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type) && !(chptr->mode_lock.mode & mode_type)) + else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type)) { chptr->mode.mode &= ~mode_type; @@ -1662,6 +1662,9 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, dir = MODE_QUERY; break; default: + /* If this mode char is locked, don't allow local users to change it. */ + if (MyClient(source_p) && chptr->mode_lock && strchr(chptr->mode_lock, c)) + continue; chmode_table[(unsigned char) c].set_func(fakesource_p, chptr, alevel, parc, &parn, parv, &errors, dir, c, @@ -1768,41 +1771,11 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, */ void set_channel_mlock(struct Client *client_p, struct Client *source_p, - struct Channel *chptr, int parc, const char *parv[]) + struct Channel *chptr, const char *newmlock) { - int dir = MODE_ADD; - const char *ml = parv[0]; - char c; - - memset(&chptr->mode_lock, '\0', sizeof(struct Mode)); - - for(; (c = *ml) != 0; ml++) - { - switch (c) - { - case '+': - dir = MODE_ADD; - break; - case '-': - dir = MODE_DEL; - break; - default: - if (chmode_table[(unsigned char) c].set_func == chm_simple) - switch(dir) - { - case MODE_ADD: - chptr->mode_lock.mode |= chmode_table[(unsigned char) c].mode_type; - chptr->mode_lock.off_mode &= ~chmode_table[(unsigned char) c].mode_type; - break; - case MODE_DEL: - chptr->mode_lock.off_mode |= chmode_table[(unsigned char) c].mode_type; - chptr->mode_lock.mode &= ~chmode_table[(unsigned char) c].mode_type; - break; - } - break; - } - } + rb_free(chptr->mode_lock); + chptr->mode_lock = rb_strdup(newmlock); sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s %s", - source_p->id, (long) chptr->channelts, chptr->chname, channel_mlock(chptr, &me)); + source_p->id, (long) chptr->channelts, chptr->chname, chptr->mode_lock); } From 6b8db2daf2e0307105a3dfab9bb5e0949b4bd5f9 Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Sun, 2 May 2010 20:42:46 +0100 Subject: [PATCH 05/26] Allow the final parameter of MLOCK to be empty, to remove an existing mlock --- include/channel.h | 1 - modules/core/m_mode.c | 2 +- src/chmode.c | 7 ++++--- src/s_serv.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/channel.h b/include/channel.h index b7a80f4f..01b7275c 100644 --- a/include/channel.h +++ b/include/channel.h @@ -241,7 +241,6 @@ extern void del_invite(struct Channel *chptr, struct Client *who); const char *channel_modes_real(struct Channel *chptr, struct Mode *mode, struct Client *who); #define channel_modes(chptr, who) channel_modes_real(chptr, &(chptr)->mode, who) -#define channel_mlock(chptr, who) channel_modes_real(chptr, &(chptr)->mode_lock, who) extern struct Channel *find_bannickchange_channel(struct Client *client_p); diff --git a/modules/core/m_mode.c b/modules/core/m_mode.c index 4be9ab12..ac020801 100644 --- a/modules/core/m_mode.c +++ b/modules/core/m_mode.c @@ -58,7 +58,7 @@ struct Message tmode_msgtab = { }; struct Message mlock_msgtab = { "MLOCK", 0, 0, 0, MFLG_SLOW, - {mg_ignore, mg_ignore, {ms_mlock, 4}, {ms_mlock, 4}, mg_ignore, mg_ignore} + {mg_ignore, mg_ignore, {ms_mlock, 3}, {ms_mlock, 3}, mg_ignore, mg_ignore} }; struct Message bmask_msgtab = { "BMASK", 0, 0, 0, MFLG_SLOW, diff --git a/src/chmode.c b/src/chmode.c index b345b8e1..38393b2a 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -1774,8 +1774,9 @@ set_channel_mlock(struct Client *client_p, struct Client *source_p, struct Channel *chptr, const char *newmlock) { rb_free(chptr->mode_lock); - chptr->mode_lock = rb_strdup(newmlock); + chptr->mode_lock = newmlock ? rb_strdup(newmlock) : NULL; - sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s %s", - source_p->id, (long) chptr->channelts, chptr->chname, chptr->mode_lock); + sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s :%s", + source_p->id, (long) chptr->channelts, chptr->chname, + chptr->mode_lock ? chptr->mode_lock : ""); } diff --git a/src/s_serv.c b/src/s_serv.c index 684e3a16..3b4778b6 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -659,9 +659,9 @@ burst_TS6(struct Client *client_p) chptr->topic); if(IsCapable(client_p, CAP_MLOCK)) - sendto_one(client_p, ":%s MLOCK %ld %s %s", + sendto_one(client_p, ":%s MLOCK %ld %s :%s", me.id, (long) chptr->channelts, chptr->chname, - channel_mlock(chptr, client_p)); + EmptyString(chptr->mode_lock) ? "" : chptr->mode_lock); hchaninfo.chptr = chptr; call_hook(h_burst_channel, &hchaninfo); From ca656bf81504489b07fd4940f4bc7b321d534dfc Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Sun, 2 May 2010 21:25:58 +0100 Subject: [PATCH 06/26] Fix compiler warning --- modules/m_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/m_info.c b/modules/m_info.c index 62d75f75..50fbac81 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -587,7 +587,7 @@ static struct InfoStruct info_table[] = { { "resv_forcepart", OUTPUT_BOOLEAN_YN, - { &ConfigChannel.resv_forcepart }, + &ConfigChannel.resv_forcepart, "Force-part local users on channel RESV" }, { From 3b8a6350f8de279e70a2ef07ed73a559bfd13331 Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Sun, 2 May 2010 21:29:22 +0100 Subject: [PATCH 07/26] Backed out changeset c57955c5225e Now that MLOCK is no longer stored as a struct Mode, this is unnecessary. --- include/channel.h | 4 +--- src/channel.c | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/include/channel.h b/include/channel.h index e37dd3ae..ec6690af 100644 --- a/include/channel.h +++ b/include/channel.h @@ -238,9 +238,7 @@ extern void channel_member_names(struct Channel *chptr, struct Client *, extern void del_invite(struct Channel *chptr, struct Client *who); -const char *channel_modes_real(struct Channel *chptr, struct Mode *mode, struct Client *who); -#define channel_modes(chptr, who) channel_modes_real(chptr, &(chptr)->mode, who) -#define channel_mlock(chptr, who) channel_modes_real(chptr, &(chptr)->mode_lock, who) +const char *channel_modes(struct Channel *chptr, struct Client *who); extern struct Channel *find_bannickchange_channel(struct Client *client_p); diff --git a/src/channel.c b/src/channel.c index 3b0516bd..c959687a 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1073,10 +1073,9 @@ set_channel_topic(struct Channel *chptr, const char *topic, const char *topic_in } } -/* channel_modes_real() +/* channel_modes() * * inputs - pointer to channel - * - pointer to channel Mode struct * - pointer to client * output - string with simple modes * side effects - result from previous calls overwritten @@ -1084,7 +1083,7 @@ set_channel_topic(struct Channel *chptr, const char *topic, const char *topic_in * Stolen from ShadowIRCd 4 --nenolod */ const char * -channel_modes_real(struct Channel *chptr, struct Mode *mode, struct Client *client_p) +channel_modes(struct Channel *chptr, struct Client *client_p) { int i; char buf1[BUFSIZE]; @@ -1097,40 +1096,40 @@ channel_modes_real(struct Channel *chptr, struct Mode *mode, struct Client *clie *pbuf = '\0'; for (i = 0; i < 256; i++) - if(mode->mode & chmode_flags[i]) + if(chptr->mode.mode & chmode_flags[i]) *mbuf++ = i; - if(mode->limit) + if(chptr->mode.limit) { *mbuf++ = 'l'; if(!IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %d", mode->limit); + pbuf += rb_sprintf(pbuf, " %d", chptr->mode.limit); } - if(*mode->key) + if(*chptr->mode.key) { *mbuf++ = 'k'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %s", mode->key); + pbuf += rb_sprintf(pbuf, " %s", chptr->mode.key); } - if(mode->join_num) + if(chptr->mode.join_num) { *mbuf++ = 'j'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %d:%d", mode->join_num, - mode->oin_time); + pbuf += rb_sprintf(pbuf, " %d:%d", chptr->mode.join_num, + chptr->mode.join_time); } - if(*mode->forward && (ConfigChannel.use_forward || !IsClient(client_p))) + if(*chptr->mode.forward && (ConfigChannel.use_forward || !IsClient(client_p))) { *mbuf++ = 'f'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %s", mode->forward); + pbuf += rb_sprintf(pbuf, " %s", chptr->mode.forward); } *mbuf = '\0'; From 73d83e6db02ef63c302ccda8815c45dd52aa8680 Mon Sep 17 00:00:00 2001 From: Stephen Bennett Date: Sun, 2 May 2010 22:18:13 +0100 Subject: [PATCH 08/26] Update MLOCK protocol documentation to match changes in code --- doc/technical/ts6-protocol.txt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/doc/technical/ts6-protocol.txt b/doc/technical/ts6-protocol.txt index 64beadbb..76e3fc29 100644 --- a/doc/technical/ts6-protocol.txt +++ b/doc/technical/ts6-protocol.txt @@ -457,21 +457,17 @@ Remote LUSERS request. Most servers ignore the server mask, treating it as '*'. MLOCK charybdis TS6 source: services server -parameters: channelTS, channel, cmode changes, opt. cmode parameters... +parameters: channelTS, channel, mode letters propagation: broadcast (restricted) -Propagates a channel mode lock change. +Propagates a channel mode lock change. If the channelTS is greater (newer) than the current TS of the channel, drop the message. -On input, only the limit on parameters per line restricts how many cmode -parameters can be present. Apart from this, arbitrary modes shall be -processed. Redundant modes may be dropped. For example, +n-n may be applied and -propagated as +n-n, -n or (if the channel was already -n) nothing, but not as -+n. - -The parameter for mode -k (removing a key) shall be ignored. +The final parameter is a list of mode letters that may not be changed by local +users. This applies to setting or unsetting simple modes, and changing or +removing mode parameters. An MLOCK message with no modes disables the MLOCK, therefore the MLOCK message always contains the literal MLOCK for simplicity. From 918d73d562e8b74fa1a5fa3332fe92f77bca8834 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 9 May 2010 00:30:51 +0200 Subject: [PATCH 09/26] openssl: Avoid cutting off OpenSSL errors at 119 chars. ERR_error_string() is just broken, as it returns at most 119 chars which means error messages are frequently truncated. Allow for 511 chars using ERR_error_string_n(). --- libratbox/src/openssl.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/libratbox/src/openssl.c b/libratbox/src/openssl.c index 81a8d17f..86df0b5d 100644 --- a/libratbox/src/openssl.c +++ b/libratbox/src/openssl.c @@ -287,6 +287,15 @@ verify_accept_all_cb(int preverify_ok, X509_STORE_CTX *x509_ctx) return 1; } +static const char * +get_ssl_error(unsigned long err) +{ + static char buf[512]; + + ERR_error_string_n(err, buf, sizeof buf); + return buf; +} + int rb_init_ssl(void) { @@ -299,7 +308,7 @@ rb_init_ssl(void) if(ssl_server_ctx == NULL) { rb_lib_log("rb_init_openssl: Unable to initialize OpenSSL server context: %s", - ERR_error_string(ERR_get_error(), NULL)); + get_ssl_error(ERR_get_error())); ret = 0; } /* Disable SSLv2, make the client use our settings */ @@ -311,7 +320,7 @@ rb_init_ssl(void) if(ssl_client_ctx == NULL) { rb_lib_log("rb_init_openssl: Unable to initialize OpenSSL client context: %s", - ERR_error_string(ERR_get_error(), NULL)); + get_ssl_error(ERR_get_error())); ret = 0; } return ret; @@ -332,7 +341,7 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile) { err = ERR_get_error(); rb_lib_log("rb_setup_ssl_server: Error loading certificate file [%s]: %s", cert, - ERR_error_string(err, NULL)); + get_ssl_error(err)); return 0; } @@ -347,7 +356,7 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile) { err = ERR_get_error(); rb_lib_log("rb_setup_ssl_server: Error loading keyfile [%s]: %s", keyfile, - ERR_error_string(err, NULL)); + get_ssl_error(err)); return 0; } @@ -363,7 +372,7 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile) err = ERR_get_error(); rb_lib_log ("rb_setup_ssl_server: Error loading DH params file [%s]: %s", - dhfile, ERR_error_string(err, NULL)); + dhfile, get_ssl_error(err)); BIO_free(bio); return 0; } @@ -374,7 +383,7 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile) { err = ERR_get_error(); rb_lib_log("rb_setup_ssl_server: Error loading DH params file [%s]: %s", - dhfile, ERR_error_string(err, NULL)); + dhfile, get_ssl_error(err)); } } return 1; @@ -609,7 +618,7 @@ rb_get_pseudo_random(void *buf, size_t length) const char * rb_get_ssl_strerror(rb_fde_t *F) { - return ERR_error_string(F->ssl_errno, NULL); + return get_ssl_error(F->ssl_errno); } int From 40e92fca0e5479bbd4d2f07408bd669400955a56 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 14 May 2010 08:49:26 -0500 Subject: [PATCH 11/26] Recommend EFNet's RBL instead of DroneBL due to trustworthiness issues. (StaticBox policy change as of May 14, 2010.) --- doc/example.conf | 4 ++-- doc/reference.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/example.conf b/doc/example.conf index 8c9dbf23..e1fbf2d3 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -370,8 +370,8 @@ serverhide { * See for more information. */ blacklist { - host = "dnsbl.dronebl.org"; - reject_reason = "${nick}, your IP (${ip}) is listed in DroneBL. For assistance, see http://dronebl.org/lookup_branded.do?ip=${ip}&network=${network-name}"; + host = "rbl.efnetrbl.org"; + reject_reason = "${nick}, your IP (${ip}) is listed in EFnet's RBL. For assistance, see http://efnetrbl.org/?i=${ip}"; # host = "ircbl.ahbl.org"; # reject_reason = "${nick}, your IP (${ip}) is listed in ${dnsbl-host} for having an open proxy. In order to protect ${network-name} from abuse, we are not allowing connections with open proxies to connect."; diff --git a/doc/reference.conf b/doc/reference.conf index 4c0e604b..03fc0412 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -806,8 +806,8 @@ serverhide { * See for more information. */ blacklist { - host = "dnsbl.dronebl.org"; - reject_reason = "${nick}, your IP (${ip}) is listed in DroneBL. For assistance, see http://dronebl.org/lookup_branded.do?ip=${ip}&network=${network-name}"; + host = "rbl.efnetrbl.org"; + reject_reason = "${nick}, your IP (${ip}) is listed in EFnet's RBL. For assistance, see http://efnetrbl.org/?i=${ip}"; # host = "ircbl.ahbl.org"; # reject_reason = "${nick}, your IP (${ip}) is listed in ${dnsbl-host} for having an open proxy. In order to protect ${network-name} from abuse, we are not allowing connections with open proxies to connect."; From 9e970ffd6dc81f82671ddab928c4c526b5d31a41 Mon Sep 17 00:00:00 2001 From: freenode!ChrisAM Date: Tue, 18 May 2010 22:53:22 -0400 Subject: [PATCH 12/26] Add help/opers/extban for users and opers. --- help/Makefile.in | 2 +- help/opers/extban | 35 +++++++++++++++++++++++++++++++++++ help/opers/index | 33 +++++++++++++++++---------------- help/users/index | 19 ++++++++++--------- 4 files changed, 63 insertions(+), 26 deletions(-) create mode 100644 help/opers/extban diff --git a/help/Makefile.in b/help/Makefile.in index 6c487bc0..534b36f8 100644 --- a/help/Makefile.in +++ b/help/Makefile.in @@ -16,7 +16,7 @@ SYMLINKS= topic accept cmode admin names links away whowas \ version kick who invite quit join list nick oper part \ time credits motd userhost users whois ison lusers \ user help pass error challenge knock ping pong \ - cprivmsg cnotice map trace chantrace + cprivmsg cnotice map trace chantrace extban all: build: diff --git a/help/opers/extban b/help/opers/extban new file mode 100644 index 00000000..90d86f1f --- /dev/null +++ b/help/opers/extban @@ -0,0 +1,35 @@ +MODE <+|-> $[~][:] + +Extended bans (ban conditionals) allow different checks than the usual +nick!user@host or nick!user@ip match to determine whether someone should +be banned, quieted, exempted or invited. + +Extended bans are of the form $[~][:]. The is one +character (case insensitive) and determines the type of match. Most types +allow or require an extra field . If the tilde (~) is present, the +result of the comparison will be negated, unless the ban is invalid in which +case it will never match. Invalid bans are ones where is missing but +required or where is otherwise invalid as noted below. + +Unless noted below, all types can be used with +b, +q, +e and +I. + + extb Type - DESCRIPTION +------------------------------------------------------------------------ + $a - Matches all logged in users + $a: - Matches users logged in with a username matching the mask + (* and ? wildcards) + $c: - Matches users who are on the given channel; this is only + valid if the channel exists and is not +s or +p. (The ops + of the channel the ban is on cannot necessarily see whether + the user is in the target channel, so it should not + influence whether they can join either.) + $o - Matches opers (most useful with +I) + $r: - Matches users with a realname (gecos) matching the mask + (* and ? wildcards); this can only be used with +b and +q + $s: - matches users connected to a server matching the mask + (* and ? wildcards); this can only be used with +b and +q + $j: - matches users who are or are not banned from a specified + channel + $x: - Bans all users with matching nick!user@host#gecos + $z - Matches all SSL users + diff --git a/help/opers/index b/help/opers/index index 56171ec4..d42f4f76 100644 --- a/help/opers/index +++ b/help/opers/index @@ -5,19 +5,20 @@ CHALLENGE CHANTRACE CLOSE CMODE CNOTICE CONNECT CPRIVMSG CREDITS DIE DLINE ERROR ETRACE HELP INDEX INFO INVITE -ISON JOIN KICK KILL -KLINE KNOCK LINKS LIST -LOCOPS LUSERS MAP MASKTRACE -MODLIST MODLOAD MODRELOAD MODRESTART -MODUNLOAD MOTD NAMES NICK -NOTICE OPER OPERSPY OPERWALL -PART PASS PING PONG -POST PRIVMSG QUIT REHASH -RESTART RESV SCAN SERVER -SET SJOIN SNOMASK SQUIT -STATS SVINFO TESTGECOS TESTLINE -TESTMASK TIME TOPIC TRACE -UHELP UMODE UNDLINE UNKLINE -UNREJECT UNRESV UNXLINE USER -USERHOST USERS VERSION WALLOPS -WHO WHOIS WHOWAS XLINE +EXTBAN ISON JOIN KICK +KILL KLINE KNOCK LINKS +LIST LOCOPS LUSERS MAP +MASKTRACE MODLIST MODLOAD MODRELOAD +MODRESTART MODUNLOAD MOTD NAMES +NICK NOTICE OPER OPERSPY +OPERWALL PART PASS PING +PONG POST PRIVMSG QUIT +REHASH RESTART RESV SCAN +SERVER SET SJOIN SNOMASK +SQUIT STATS SVINFO TESTGECOS +TESTLINE TESTMASK TIME TOPIC +TRACE UHELP UMODE UNDLINE +UNKLINE UNREJECT UNRESV UNXLINE +USER USERHOST USERS VERSION +WALLOPS WHO WHOIS WHOWAS +XLINE diff --git a/help/users/index b/help/users/index index 654cf5f5..5f65c0d9 100644 --- a/help/users/index +++ b/help/users/index @@ -2,12 +2,13 @@ Help topics available to users: ACCEPT ADMIN AWAY CHALLENGE CMODE CNOTICE CPRIVMSG CREDITS -ERROR HELP INDEX INFO -INVITE ISON JOIN KICK -KNOCK LINKS LIST LUSERS -MAP MOTD NAMES NICK -NOTICE OPER PART PASS -PING PONG PRIVMSG QUIT -STATS TIME TOPIC TRACE -UMODE USER USERHOST USERS -VERSION WHO WHOIS WHOWAS +ERROR EXTBAN HELP INDEX +INFO INVITE ISON JOIN +KICK KNOCK LINKS LIST +LUSERS MAP MOTD NAMES +NICK NOTICE OPER PART +PASS PING PONG PRIVMSG +QUIT STATS TIME TOPIC +TRACE UMODE USER USERHOST +USERS VERSION WHO WHOIS +WHOWAS From c86ef4438f6153cf17c4307d61de5673b4fa91d1 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Thu, 20 May 2010 00:23:32 +0200 Subject: [PATCH 13/26] dline help: add oper reason, clarify temps, add ON . --- help/opers/dline | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/help/opers/dline b/help/opers/dline index 75255f21..144c2d2a 100644 --- a/help/opers/dline +++ b/help/opers/dline @@ -1,10 +1,20 @@ -DLINE [duration] :[reason] +DLINE [duration] :[reason] [| oper reason] Adds a DLINE to the database which will deny any connections from the IP address of the banned client. The banned client will receive a message saying he/she is banned with reason [reason]. -Duration is optional, and is in minutes. +Duration is optional, and is in minutes. If specified, +the DLINE will not be saved in the database. + +If an oper reason is added (the pipe must be specified +to seperate the fields) this will be added into the +database but will not be shown to the user when they +are given the kline reason. + +DLINE [duration] ON irc.server :[reason] [| oper reason] +will dline the user on irc.server if irc.server accepts +remote dlines. irc.server can contain wildcards. - Requires Oper Priv: K From 15aa08eecb11efc5b81426ff8d0a74f829fa943f Mon Sep 17 00:00:00 2001 From: Elly Date: Tue, 1 Jun 2010 13:11:47 -0400 Subject: [PATCH 14/26] Fix memory leaks in PASS command, both in normal and repeated use. --- modules/m_pass.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/m_pass.c b/modules/m_pass.c index c331e25f..0c7636fe 100644 --- a/modules/m_pass.c +++ b/modules/m_pass.c @@ -67,10 +67,17 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char * memset(client_p->localClient->passwd, 0, strlen(client_p->localClient->passwd)); rb_free(client_p->localClient->passwd); + client_p->localClient->passwd = NULL; + } + + if (client_p->localClient->auth_user) + { + memset(client_p->localClient->auth_user, 0, + strlen(client_p->localClient->auth_user)); + rb_free(client_p->localClient->auth_user); + client_p->localClient->auth_user = NULL; } - client_p->localClient->passwd = rb_strndup(parv[1], PASSWDLEN); - if ((pass = strchr(buf, ':')) != NULL) { *pass++ = '\0'; From 15f92147c7e1c8d8412c65e810af584642325f21 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Wed, 9 Jun 2010 21:22:47 +0200 Subject: [PATCH 15/26] Make number_per_ident actually apply to unidented connections as well, as documented in reference.conf. Noticed by: spb --- src/s_conf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/s_conf.c b/src/s_conf.c index d8808c70..48192c9e 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -483,14 +483,13 @@ attach_iline(struct Client *client_p, struct ConfItem *aconf) int local_count = 0; int global_count = 0; int ident_count = 0; - int unidented = 0; + int unidented; if(IsConfExemptLimits(aconf)) return (attach_conf(client_p, aconf)); - if(*client_p->username == '~') - unidented = 1; - + unidented = !IsGotId(client_p) && !IsNoTilde(aconf) && + (!IsConfDoSpoofIp(aconf) || !strchr(aconf->info.name, '@')); /* find_hostname() returns the head of the list to search */ RB_DLINK_FOREACH(ptr, find_hostname(client_p->host)) From 76a2bba920471911ea4e12cd2565b0ab3260d85c Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Thu, 10 Jun 2010 22:16:07 +0200 Subject: [PATCH 16/26] Propagate changed away messages to other servers, even if the away status did not change. --- modules/m_away.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/m_away.c b/modules/m_away.c index 02b510d8..1cdd5ed7 100644 --- a/modules/m_away.c +++ b/modules/m_away.c @@ -90,16 +90,13 @@ m_away(struct Client *client_p, struct Client *source_p, int parc, const char *p return 0; } - if(source_p->user->away == NULL) - { allocate_away(source_p); + if(strncmp(source_p->user->away, parv[1], AWAYLEN - 1)) + { rb_strlcpy(source_p->user->away, parv[1], AWAYLEN); sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s AWAY :%s", use_id(source_p), source_p->user->away); - - } else { - rb_strlcpy(source_p->user->away, parv[1], AWAYLEN); } if(MyConnect(source_p)) From 545f0a0f075b58077079eb22db2b4929fbda9fee Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 Jun 2010 16:53:56 -0500 Subject: [PATCH 17/26] strip_colour(): strip ASCII 29 (mIRC 7 italics). --- include/inline/stringops.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/inline/stringops.h b/include/inline/stringops.h index 594109d2..a809e75a 100644 --- a/include/inline/stringops.h +++ b/include/inline/stringops.h @@ -58,6 +58,7 @@ strip_colour(char *string) case 22: case 23: case 27: + case 29: case 31: break; case 32: From 0770c9936ef1fc404f04fb4004adc8546abeba7a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 3 Jul 2010 00:44:55 -0500 Subject: [PATCH 18/26] Stop griefing through taunting while hiding behind CALLERID. This shouldn't provide any way for a client to get on a CALLERID list without authorization, as if a client is +g already, a CTCP request, for example, won't be replied to. --- modules/core/m_message.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/core/m_message.c b/modules/core/m_message.c index faca8137..e2dd4de6 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -726,6 +726,17 @@ msg_client(int p_or_n, const char *command, sendto_one_numeric(source_p, RPL_AWAY, form_str(RPL_AWAY), target_p->name, target_p->user->away); + /* + * XXX: Controversial? Allow target users to send replies through a +g. + * Rationale is that people can presently use +g as a way to taunt users, + * e.g. harass them and hide behind +g as a way of griefing. --nenolod + */ + if(MyClient(source_p) && IsSetCallerId(source_p) && !accept_message(target_p, source_p)) + { + rb_dlinkAddAlloc(target_p, &source_p->localClient->allow_list); + rb_dlinkAddAlloc(source_p, &target_p->on_allow_list); + } + if(MyClient(target_p)) { /* XXX Controversial? allow opers always to send through a +g */ From f5455d2cd5e6dd5169ce8006167fffa8475bc493 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 4 Jul 2010 17:14:56 +0200 Subject: [PATCH 19/26] Tweak auto-accept: * does not apply to NOTICE (as those may well be automated) * mirrors +g behaviour so that no useless accept entries are added for services * respects max_accept, if it would be exceeded the message is dropped with numeric 494 * check moved up so this is checked before floodcount/tgchange --- include/numeric.h | 2 ++ modules/core/m_message.c | 37 ++++++++++++++++++++++++++----------- src/messages.tab | 2 +- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/include/numeric.h b/include/numeric.h index 9a17db1c..65a6cee3 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -297,6 +297,8 @@ extern const char *form_str(int); #define ERR_NOOPERHOST 491 +#define ERR_OWNMODE 494 /* from bahamut -- jilles */ + #define ERR_UMODEUNKNOWNFLAG 501 #define ERR_USERSDONTMATCH 502 diff --git a/modules/core/m_message.c b/modules/core/m_message.c index e2dd4de6..2be4c1ed 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -682,6 +682,32 @@ msg_client(int p_or_n, const char *command, if(MyClient(source_p)) { + /* + * XXX: Controversial? Allow target users to send replies + * through a +g. Rationale is that people can presently use +g + * as a way to taunt users, e.g. harass them and hide behind +g + * as a way of griefing. --nenolod + */ + if(p_or_n != NOTICE && MyClient(source_p) && + IsSetCallerId(source_p) && + !accept_message(target_p, source_p) && + !IsOper(target_p)) + { + if(rb_dlink_list_length(&source_p->localClient->allow_list) < + ConfigFileEntry.max_accept) + { + rb_dlinkAddAlloc(target_p, &source_p->localClient->allow_list); + rb_dlinkAddAlloc(source_p, &target_p->on_allow_list); + } + else + { + sendto_one_numeric(source_p, ERR_OWNMODE, + form_str(ERR_OWNMODE), + target_p->name, "+g"); + return; + } + } + /* reset idle time for message only if its not to self * and its not a notice */ if(p_or_n != NOTICE) @@ -726,17 +752,6 @@ msg_client(int p_or_n, const char *command, sendto_one_numeric(source_p, RPL_AWAY, form_str(RPL_AWAY), target_p->name, target_p->user->away); - /* - * XXX: Controversial? Allow target users to send replies through a +g. - * Rationale is that people can presently use +g as a way to taunt users, - * e.g. harass them and hide behind +g as a way of griefing. --nenolod - */ - if(MyClient(source_p) && IsSetCallerId(source_p) && !accept_message(target_p, source_p)) - { - rb_dlinkAddAlloc(target_p, &source_p->localClient->allow_list); - rb_dlinkAddAlloc(source_p, &target_p->on_allow_list); - } - if(MyClient(target_p)) { /* XXX Controversial? allow opers always to send through a +g */ diff --git a/src/messages.tab b/src/messages.tab index 7d6562d1..8c78808e 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -515,7 +515,7 @@ static const char * replies[] = { /* 491 ERR_NOOPERHOST, */ ":No appropriate operator blocks were found for your host", /* 492 */ NULL, /* 493 */ NULL, -/* 494 */ NULL, +/* 494 ERR_OWNMODE, */ "%s :cannot answer you while you are %s, your message was not sent", /* 495 */ NULL, /* 496 */ NULL, /* 497 */ NULL, From 3645ce98697ad4e02b28144576d1cc858dc743ec Mon Sep 17 00:00:00 2001 From: Elly Date: Sun, 22 Aug 2010 23:21:38 -0400 Subject: [PATCH 20/26] Change oper-up message. --- src/messages.tab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/messages.tab b/src/messages.tab index 8c78808e..7e3f50fb 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -402,7 +402,7 @@ static const char * replies[] = { /* 378 RPL_WHOISHOST, */ "%s :is connecting from *@%s %s", /* 379 */ NULL, /* 380 */ NULL, -/* 381 RPL_YOUREOPER, */ ":%s 381 %s :You're a IRC operator! Did you know that? This message is FACTUAL.", +/* 381 RPL_YOUREOPER, */ ":%s 381 %s :IRCOP FLAG TURN ON", /* 382 RPL_REHASHING, */ ":%s 382 %s %s :Rehashing", /* 383 */ NULL, /* 384 RPL_MYPORTIS, */ NULL, From c3665aa9dc899bf3c128c642fb44feb1a23049e3 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 23 Aug 2010 17:03:37 -0500 Subject: [PATCH 21/26] Kill unsupported modules directory. --- configure.ac | 1 - unsupported/Makefile.in | 70 -------- unsupported/m_clearchan.c | 154 ------------------ unsupported/m_force.c | 291 ---------------------------------- unsupported/sno_channeljoin.c | 45 ------ 5 files changed, 561 deletions(-) delete mode 100644 unsupported/Makefile.in delete mode 100644 unsupported/m_clearchan.c delete mode 100644 unsupported/m_force.c delete mode 100644 unsupported/sno_channeljoin.c diff --git a/configure.ac b/configure.ac index e32a0532..7e9d7fb6 100644 --- a/configure.ac +++ b/configure.ac @@ -1160,7 +1160,6 @@ AC_CONFIG_FILES( \ bandb/Makefile \ ssld/Makefile \ extensions/Makefile \ - unsupported/Makefile \ src/Makefile \ modules/Makefile \ tools/Makefile \ diff --git a/unsupported/Makefile.in b/unsupported/Makefile.in deleted file mode 100644 index 4d553134..00000000 --- a/unsupported/Makefile.in +++ /dev/null @@ -1,70 +0,0 @@ -# -# Makefile.in for ircd/unsupported -# -# $Id: Makefile.in 3478 2007-05-24 15:10:06Z jilles $ -# -CC = @CC@ -RM = @RM@ -SED = @SED@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -CFLAGS = @IRC_CFLAGS@ -DIRCD_PREFIX=\"@prefix@\" -PICFLAGS = @PICFLAGS@ -MKDEP = @MKDEP@ -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SUID = @INSTALL_PROGRAM@ -o root -m 4755 -SHELL = /bin/sh -AUTOMODULEDIR = @moduledir@/unsupported - -SSL_LIBS = @SSL_LIBS@ -SSL_INCLUDES = @SSL_INCLUDES@ - -IRCDLIBS = @LIBS@ $(SSL_LIBS) - -INCLUDES = -I. -I../include -I../libcharybdis -I../libratbox/include $(SSL_INCLUDES) -CPPFLAGS = ${INCLUDES} @CPPFLAGS@ - -SRCS = \ - m_clearchan.c \ - m_force.c \ - sno_channeljoin.c - -OBJS = ${SRCS:.c=.so} - -default: build -build: all -all: $(OBJS) - -install: all - -@if test ! -d $(DESTDIR)$(AUTOMODULEDIR); then \ - mkdir $(DESTDIR)$(AUTOMODULEDIR); \ - fi - @echo "Installing modules into $(DESTDIR)$(AUTOMODULEDIR) .." - @for file in $(OBJS); do \ - $(INSTALL_DATA) $$file $(DESTDIR)$(AUTOMODULEDIR); \ - done - -.SUFFIXES: .so - -.c.so: - ${CC} ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} $< -o $@ - -.PHONY: depend clean distclean -depend: - @${MKDEP} ${CPPFLAGS} ${SRCS} > .depend - @sed s/\\\.o/\\\.so/ < .depend > .depend.tmp - @sed -e '/^# DO NOT DELETE THIS LINE/,$$d' Makefile.depend - @echo '# DO NOT DELETE THIS LINE!!!' >>Makefile.depend - @echo '# make depend needs it.' >>Makefile.depend - @cat .depend.tmp >>Makefile.depend - @mv Makefile.depend Makefile - @rm -f .depend.tmp .depend - -clean: - ${RM} -f *.so *~ - -distclean: clean - ${RM} -f Makefile - diff --git a/unsupported/m_clearchan.c b/unsupported/m_clearchan.c deleted file mode 100644 index 70c583db..00000000 --- a/unsupported/m_clearchan.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * IRC - Internet Relay Chat, contrib/m_clearchan.c - * Copyright (C) 2002 Hybrid Development Team - * Copyright (C) 2004 ircd-ratbox Development Team - * - * 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: m_clearchan.c 3161 2007-01-25 07:23:01Z nenolod $ - */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_user.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" - -static int mo_clearchan(struct Client *client_p, struct Client *source_p, - int parc, const char *parv[]); - -struct Message clearchan_msgtab = { - "CLEARCHAN", 0, 0, 0, MFLG_SLOW, - {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_clearchan, 2}} -}; - -mapi_clist_av1 clearchan_clist[] = { &clearchan_msgtab, NULL }; - -DECLARE_MODULE_AV1(clearchan, NULL, NULL, clearchan_clist, NULL, NULL, "$Revision: 3161 $"); - -/* -** mo_clearchan -** parv[1] = channel -*/ -static int -mo_clearchan(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -{ - struct Channel *chptr; - struct membership *msptr; - struct Client *target_p; - rb_dlink_node *ptr; - rb_dlink_node *next_ptr; - - /* admins only */ - if(!IsOperAdmin(source_p)) - { - sendto_one_notice(source_p, ":You have no A flag"); - return 0; - } - - - if((chptr = find_channel(parv[1])) == NULL) - { - sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, - form_str(ERR_NOSUCHCHANNEL), parv[1]); - return 0; - } - - if(IsMember(source_p, chptr)) - { - sendto_one_notice(source_p, ":*** Please part %s before using CLEARCHAN", parv[1]); - return 0; - } - - /* quickly make everyone a peon.. */ - RB_DLINK_FOREACH(ptr, chptr->members.head) - { - msptr = ptr->data; - msptr->flags &= ~CHFL_CHANOP | CHFL_VOICE; - } - - sendto_wallops_flags(UMODE_WALLOP, &me, - "CLEARCHAN called for [%s] by %s!%s@%s", - parv[1], source_p->name, source_p->username, source_p->host); - ilog(L_MAIN, "CLEARCHAN called for [%s] by %s!%s@%s", - parv[1], source_p->name, source_p->username, source_p->host); - - if(*chptr->chname != '&') - { - sendto_server(NULL, NULL, NOCAPS, NOCAPS, - ":%s WALLOPS :CLEARCHAN called for [%s] by %s!%s@%s", - me.name, parv[1], source_p->name, source_p->username, source_p->host); - - /* SJOIN the user to give them ops, and lock the channel */ - sendto_server(client_p, chptr, NOCAPS, NOCAPS, - ":%s SJOIN %ld %s +ntsi :@%s", - me.name, (long) (chptr->channelts - 1), - chptr->chname, source_p->name); - } - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN %s", - source_p->name, source_p->username, source_p->host, chptr->chname); - sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s", - me.name, chptr->chname, source_p->name); - - add_user_to_channel(chptr, source_p, CHFL_CHANOP); - - /* Take the TS down by 1, so we don't see the channel taken over - * again. */ - if(chptr->channelts) - chptr->channelts--; - - chptr->mode.mode = MODE_SECRET | MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS; - chptr->mode.key[0] = '\0'; - - RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head) - { - msptr = ptr->data; - target_p = msptr->client_p; - - /* skip the person we just added.. */ - if(is_chanop(msptr)) - continue; - - sendto_channel_local(ALL_MEMBERS, chptr, - ":%s KICK %s %s :CLEARCHAN", - source_p->name, chptr->chname, target_p->name); - - if(*chptr->chname != '&') - sendto_server(NULL, chptr, NOCAPS, NOCAPS, - ":%s KICK %s %s :CLEARCHAN", - source_p->name, chptr->chname, target_p->name); - - remove_user_from_channel(msptr); - } - - /* Join the user themselves to the channel down here, so they dont see a nicklist - * or people being kicked */ - sendto_one(source_p, ":%s!%s@%s JOIN %s", - source_p->name, source_p->username, source_p->host, chptr->chname); - - channel_member_names(chptr, source_p, 1); - - return 0; -} diff --git a/unsupported/m_force.c b/unsupported/m_force.c deleted file mode 100644 index 4a621f46..00000000 --- a/unsupported/m_force.c +++ /dev/null @@ -1,291 +0,0 @@ -/* contrib/m_force.c - * Copyright (C) 1996-2002 Hybrid Development Team - * Copyright (C) 2004 ircd-ratbox Development Team - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1.Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2.Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3.The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: m_force.c 3297 2007-03-28 14:49:48Z jilles $ - */ - -#include "stdinc.h" -#include "channel.h" -#include "class.h" -#include "client.h" -#include "common.h" -#include "match.h" -#include "ircd.h" -#include "hostmask.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "send.h" -#include "hash.h" -#include "s_serv.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" - -static int mo_forcejoin(struct Client *client_p, struct Client *source_p, - int parc, const char *parv[]); -static int mo_forcepart(struct Client *client_p, struct Client *source_p, - int parc, const char *parv[]); - -struct Message forcejoin_msgtab = { - "FORCEJOIN", 0, 0, 0, MFLG_SLOW, - {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_forcejoin, 3}} -}; - -struct Message forcepart_msgtab = { - "FORCEPART", 0, 0, 0, MFLG_SLOW, - {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_forcepart, 3}} -}; - -mapi_clist_av1 force_clist[] = { &forcejoin_msgtab, &forcepart_msgtab, NULL }; - -DECLARE_MODULE_AV1(force, NULL, NULL, force_clist, NULL, NULL, "$Revision: 3297 $"); - -/* - * m_forcejoin - * parv[1] = user to force - * parv[2] = channel to force them into - */ -static int -mo_forcejoin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -{ - struct Client *target_p; - struct Channel *chptr; - int type; - char mode; - char sjmode; - char *newch; - - if(!IsOperAdmin(source_p)) - { - sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin"); - return 0; - } - - if((hunt_server(client_p, source_p, ":%s FORCEJOIN %s %s", 1, parc, parv)) != HUNTED_ISME) - return 0; - - /* if target_p is not existant, print message - * to source_p and bail - scuzzy - */ - if((target_p = find_client(parv[1])) == NULL) - { - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, parv[1]); - return 0; - } - - if(!IsPerson(target_p)) - return 0; - - sendto_wallops_flags(UMODE_WALLOP, &me, - "FORCEJOIN called for %s %s by %s!%s@%s", - parv[1], parv[2], source_p->name, source_p->username, source_p->host); - ilog(L_MAIN, "FORCEJOIN called for %s %s by %s!%s@%s", - parv[1], parv[2], source_p->name, source_p->username, source_p->host); - sendto_server(NULL, NULL, NOCAPS, NOCAPS, - ":%s WALLOPS :FORCEJOIN called for %s %s by %s!%s@%s", - me.name, parv[1], parv[2], - source_p->name, source_p->username, source_p->host); - - /* select our modes from parv[2] if they exist... (chanop) */ - if(*parv[2] == '@') - { - type = CHFL_CHANOP; - mode = 'o'; - sjmode = '@'; - } - else if(*parv[2] == '+') - { - type = CHFL_VOICE; - mode = 'v'; - sjmode = '+'; - } - else - { - type = CHFL_PEON; - mode = sjmode = '\0'; - } - - if(mode != '\0') - parv[2]++; - - if((chptr = find_channel(parv[2])) != NULL) - { - if(IsMember(target_p, chptr)) - { - /* debugging is fun... */ - sendto_one_notice(source_p, ":*** Notice -- %s is already in %s", - target_p->name, chptr->chname); - return 0; - } - - add_user_to_channel(chptr, target_p, type); - - sendto_server(target_p, chptr, NOCAPS, NOCAPS, - ":%s SJOIN %ld %s + :%c%s", - me.name, (long) chptr->channelts, - chptr->chname, type ? sjmode : ' ', target_p->name); - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s", - target_p->name, target_p->username, - target_p->host, chptr->chname); - - if(type) - sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +%c %s", - me.name, chptr->chname, mode, target_p->name); - - if(chptr->topic != NULL) - { - sendto_one(target_p, form_str(RPL_TOPIC), me.name, - target_p->name, chptr->chname, chptr->topic); - sendto_one(target_p, form_str(RPL_TOPICWHOTIME), - me.name, source_p->name, chptr->chname, - chptr->topic_info, chptr->topic_time); - } - - channel_member_names(chptr, target_p, 1); - } - else - { - newch = LOCAL_COPY(parv[2]); - if(!check_channel_name(newch)) - { - sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, - source_p->name, (unsigned char *) newch); - return 0; - } - - /* channel name must begin with & or # */ - if(!IsChannelName(newch)) - { - sendto_one(source_p, form_str(ERR_BADCHANNAME), me.name, - source_p->name, (unsigned char *) newch); - return 0; - } - - /* newch can't be longer than CHANNELLEN */ - if(strlen(newch) > CHANNELLEN) - { - sendto_one_notice(source_p, ":Channel name is too long"); - return 0; - } - - chptr = get_or_create_channel(target_p, newch, NULL); - add_user_to_channel(chptr, target_p, CHFL_CHANOP); - - /* send out a join, make target_p join chptr */ - sendto_server(target_p, chptr, NOCAPS, NOCAPS, - ":%s SJOIN %ld %s +nt :@%s", me.name, - (long) chptr->channelts, chptr->chname, target_p->name); - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s", - target_p->name, target_p->username, - target_p->host, chptr->chname); - - chptr->mode.mode |= MODE_TOPICLIMIT; - chptr->mode.mode |= MODE_NOPRIVMSGS; - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt", me.name, chptr->chname); - - target_p->localClient->last_join_time = rb_current_time(); - channel_member_names(chptr, target_p, 1); - - /* we do this to let the oper know that a channel was created, this will be - * seen from the server handling the command instead of the server that - * the oper is on. - */ - sendto_one_notice(source_p, ":*** Notice -- Creating channel %s", chptr->chname); - } - return 0; -} - - -static int -mo_forcepart(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -{ - struct Client *target_p; - struct Channel *chptr; - struct membership *msptr; - - if(!IsOperAdmin(source_p)) - { - sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin"); - return 0; - } - - if((hunt_server(client_p, source_p, ":%s FORCEPART %s %s", 1, parc, parv)) != HUNTED_ISME) - return 0; - - /* if target_p == NULL then let the oper know */ - if((target_p = find_client(parv[1])) == NULL) - { - sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, parv[1]); - return 0; - } - - if(!IsClient(target_p)) - return 0; - - sendto_wallops_flags(UMODE_WALLOP, &me, - "FORCEPART called for %s %s by %s!%s@%s", - parv[1], parv[2], source_p->name, source_p->username, source_p->host); - ilog(L_MAIN, "FORCEPART called for %s %s by %s!%s@%s", - parv[1], parv[2], source_p->name, source_p->username, source_p->host); - sendto_server(NULL, NULL, NOCAPS, NOCAPS, - ":%s WALLOPS :FORCEPART called for %s %s by %s!%s@%s", - me.name, parv[1], parv[2], - source_p->name, source_p->username, source_p->host); - - if((chptr = find_channel(parv[2])) == NULL) - { - sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, - form_str(ERR_NOSUCHCHANNEL), parv[1]); - return 0; - } - - if((msptr = find_channel_membership(chptr, target_p)) == NULL) - { - sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, - form_str(ERR_USERNOTINCHANNEL), - parv[1], parv[2]); - return 0; - } - - sendto_server(target_p, chptr, NOCAPS, NOCAPS, - ":%s PART %s :%s", target_p->name, chptr->chname, target_p->name); - - sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s", - target_p->name, target_p->username, - target_p->host, chptr->chname, target_p->name); - - - remove_user_from_channel(msptr); - - return 0; -} diff --git a/unsupported/sno_channeljoin.c b/unsupported/sno_channeljoin.c deleted file mode 100644 index 9a9831f5..00000000 --- a/unsupported/sno_channeljoin.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * +j snomask: Channel join notices. - * --nenolod - * - * To be discussed: - * + part notices? - * - * $Id: sno_channeljoin.c 3478 2007-05-24 15:10:06Z jilles $ - */ - -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" - -static void -show_channeljoin(hook_data_channel_activity *info) -{ - sendto_realops_snomask(snomask_modes['j'], L_ALL, - "%s (%s@%s) has joined channel %s", info->client->name, - info->client->username, info->client->host, info->chptr->chname); -} - -mapi_hfn_list_av1 channeljoin_hfnlist[] = { - {"channel_join", (hookfn) show_channeljoin}, - {NULL, NULL} -}; - -static int -init(void) -{ - snomask_modes['j'] = find_snomask_slot(); - - return 0; -} - -static void -fini(void) -{ - snomask_modes['j'] = 0; -} - -DECLARE_MODULE_AV1(sno_channeljoin, init, fini, NULL, NULL, channeljoin_hfnlist, "$Revision: 3478 $"); From 32de9f4e677b591367911dab0d471a156382c97c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 23 Aug 2010 18:59:32 -0500 Subject: [PATCH 22/26] Add ERR_MLOCKRESTRICTED (735) to reflect bounces caused by MLOCK. --- include/numeric.h | 2 ++ src/messages.tab | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/numeric.h b/include/numeric.h index 65a6cee3..f89015c6 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -361,6 +361,8 @@ extern const char *form_str(int); #define RPL_ENDOFMONLIST 733 #define ERR_MONLISTFULL 734 +#define ERR_MLOCKRESTRICTED 735 + #define RPL_RSACHALLENGE2 740 #define RPL_ENDOFRSACHALLENGE2 741 diff --git a/src/messages.tab b/src/messages.tab index 7e3f50fb..0660e6c0 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -756,7 +756,7 @@ static const char * replies[] = { /* 732 RPL_MONLIST */ ":%s 732 %s :%s", /* 733 RPL_ENDOFMONLIST */ ":%s 733 %s :End of MONITOR list", /* 734 ERR_MONLISTFULL */ ":%s 734 %s %d %s :Monitor list is full", -/* 735 */ NULL, +/* 735 ERR_MLOCKRESTRICTED */ "%s %c :This mode cannot be set because it is restricted to Services only.", /* 736 */ NULL, /* 737 */ NULL, /* 738 */ NULL, From 01ed04abaf7c31f0cdd4683e0dc2e4f9bed607b1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 23 Aug 2010 19:04:46 -0500 Subject: [PATCH 23/26] Send numeric 735 on MLOCK policy-restricted mode changes that are ignored. --- src/chmode.c | 3 +++ src/messages.tab | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chmode.c b/src/chmode.c index 38393b2a..b6c761dd 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -1664,7 +1664,10 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, default: /* If this mode char is locked, don't allow local users to change it. */ if (MyClient(source_p) && chptr->mode_lock && strchr(chptr->mode_lock, c)) + { + sendto_one_numeric(source_p, ERR_MLOCKRESTRICTED, form_str(ERR_MLOCKRESTRICTED), chptr->name, c, chptr->mode_lock); continue; + } chmode_table[(unsigned char) c].set_func(fakesource_p, chptr, alevel, parc, &parn, parv, &errors, dir, c, diff --git a/src/messages.tab b/src/messages.tab index 0660e6c0..71600d56 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -756,7 +756,7 @@ static const char * replies[] = { /* 732 RPL_MONLIST */ ":%s 732 %s :%s", /* 733 RPL_ENDOFMONLIST */ ":%s 733 %s :End of MONITOR list", /* 734 ERR_MONLISTFULL */ ":%s 734 %s %d %s :Monitor list is full", -/* 735 ERR_MLOCKRESTRICTED */ "%s %c :This mode cannot be set because it is restricted to Services only.", +/* 735 ERR_MLOCKRESTRICTED */ "%s %c %s :MODE cannot be set due to channel having an active MLOCK restriction policy", /* 736 */ NULL, /* 737 */ NULL, /* 738 */ NULL, From 6fb6bd15aee5b47a5f7185fd0f951b2b26fa798d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 23 Aug 2010 20:22:59 -0500 Subject: [PATCH 24/26] Enforce TS rules on MLOCKs. --- configure | 182 ++++++++++++++++++++++++------------------ include/channel.h | 2 +- modules/core/m_join.c | 6 ++ modules/core/m_mode.c | 2 +- src/chmode.c | 13 +-- 5 files changed, 122 insertions(+), 83 deletions(-) diff --git a/configure b/configure index b5d115fa..2b1c0dac 100755 --- a/configure +++ b/configure @@ -1,12 +1,14 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for charybdis 3.3. +# Generated by GNU Autoconf 2.65 for charybdis 3.3. # # $Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $ # +# # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software -# Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. @@ -526,7 +528,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -exec 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, @@ -1366,7 +1369,7 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor YACC The `Yet Another C Compiler' implementation to use. Defaults to @@ -1442,7 +1445,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF charybdis configure 3.3 -generated by GNU Autoconf 2.64 +generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1491,7 +1494,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1528,7 +1531,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1657,7 +1660,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1734,7 +1737,7 @@ fi # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1966,7 +1969,7 @@ rm -f conftest.val fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval + as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2041,7 +2044,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by charybdis $as_me 3.3, which was -generated by GNU Autoconf 2.64. Invocation command line was +generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2294,7 +2297,7 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 @@ -2303,9 +2306,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in @@ -2715,32 +2718,30 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + int main () { -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -2802,10 +2803,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 @@ -2813,51 +2814,18 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { as_fn_set_status 77 as_fn_error "C compiler cannot create executables See \`config.log' for more details." "$LINENO" 5; }; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" @@ -2890,13 +2858,72 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." "$LINENO" 5; } fi -rm -f conftest$ac_cv_exeext +rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : @@ -3945,8 +3972,8 @@ $as_echo "$ac_try_echo"; } >&5 ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err fi + rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -9432,7 +9459,7 @@ _ACEOF fi -ac_config_files="$ac_config_files Makefile bandb/Makefile ssld/Makefile extensions/Makefile unsupported/Makefile src/Makefile modules/Makefile tools/Makefile doc/Makefile help/Makefile" +ac_config_files="$ac_config_files Makefile bandb/Makefile ssld/Makefile extensions/Makefile src/Makefile modules/Makefile tools/Makefile doc/Makefile help/Makefile" cat >confcache <<\_ACEOF @@ -9943,7 +9970,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by charybdis $as_me 3.3, which was -generated by GNU Autoconf 2.64. Invocation command line was +generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -9982,6 +10009,7 @@ Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit + --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -10001,10 +10029,11 @@ Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ charybdis config.status 3.3 -configured by $0, generated by GNU Autoconf 2.64, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.65, + with options \\"\$ac_cs_config\\" Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation @@ -10040,6 +10069,8 @@ do ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) @@ -10121,7 +10152,6 @@ do "bandb/Makefile") CONFIG_FILES="$CONFIG_FILES bandb/Makefile" ;; "ssld/Makefile") CONFIG_FILES="$CONFIG_FILES ssld/Makefile" ;; "extensions/Makefile") CONFIG_FILES="$CONFIG_FILES extensions/Makefile" ;; - "unsupported/Makefile") CONFIG_FILES="$CONFIG_FILES unsupported/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; @@ -10229,7 +10259,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -10243,7 +10273,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p diff --git a/include/channel.h b/include/channel.h index 34330cb3..032c0cda 100644 --- a/include/channel.h +++ b/include/channel.h @@ -261,7 +261,7 @@ void resv_chan_forcepart(const char *name, const char *reason, int temp_time); extern void set_channel_mode(struct Client *client_p, struct Client *source_p, struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]); extern void set_channel_mlock(struct Client *client_p, struct Client *source_p, - struct Channel *chptr, const char *newmlock); + struct Channel *chptr, const char *newmlock, int propagate); extern struct ChannelMode chmode_table[256]; diff --git a/modules/core/m_join.c b/modules/core/m_join.c index c01aba77..4106feb5 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -479,6 +479,9 @@ ms_join(struct Client *client_p, struct Client *source_p, int parc, const char * source_p->servptr->name, chptr->chname, modebuf, parabuf); *modebuf = *parabuf = '\0'; + + /* since we're dropping our modes, we want to clear the mlock as well. --nenolod */ + set_channel_mlock(client_p, source_p, chptr, NULL, FALSE); } if(!IsMember(source_p, chptr)) @@ -739,6 +742,9 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char /* Update capitalization in channel name, this makes the * capitalization timestamped like modes are -- jilles */ strcpy(chptr->chname, parv[2]); + + /* since we're dropping our modes, we want to clear the mlock as well. --nenolod */ + set_channel_mlock(client_p, source_p, chptr, NULL, FALSE); } if(*modebuf != '\0') diff --git a/modules/core/m_mode.c b/modules/core/m_mode.c index ac020801..86d1207f 100644 --- a/modules/core/m_mode.c +++ b/modules/core/m_mode.c @@ -235,7 +235,7 @@ ms_mlock(struct Client *client_p, struct Client *source_p, int parc, const char return 0; if(IsServer(source_p)) - set_channel_mlock(client_p, source_p, chptr, parv[3]); + set_channel_mlock(client_p, source_p, chptr, parv[3], TRUE); return 0; } diff --git a/src/chmode.c b/src/chmode.c index b6c761dd..0e9b12a0 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -1665,7 +1665,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, /* If this mode char is locked, don't allow local users to change it. */ if (MyClient(source_p) && chptr->mode_lock && strchr(chptr->mode_lock, c)) { - sendto_one_numeric(source_p, ERR_MLOCKRESTRICTED, form_str(ERR_MLOCKRESTRICTED), chptr->name, c, chptr->mode_lock); + sendto_one_numeric(source_p, ERR_MLOCKRESTRICTED, form_str(ERR_MLOCKRESTRICTED), chptr->chname, c, chptr->mode_lock); continue; } chmode_table[(unsigned char) c].set_func(fakesource_p, chptr, alevel, @@ -1774,12 +1774,15 @@ set_channel_mode(struct Client *client_p, struct Client *source_p, */ void set_channel_mlock(struct Client *client_p, struct Client *source_p, - struct Channel *chptr, const char *newmlock) + struct Channel *chptr, const char *newmlock, int propagate) { rb_free(chptr->mode_lock); chptr->mode_lock = newmlock ? rb_strdup(newmlock) : NULL; - sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s :%s", - source_p->id, (long) chptr->channelts, chptr->chname, - chptr->mode_lock ? chptr->mode_lock : ""); + if (propagate) + { + sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s :%s", + source_p->id, (long) chptr->channelts, chptr->chname, + chptr->mode_lock ? chptr->mode_lock : ""); + } } From 104228843420d8e54ade3ef52808dcf908df7aa7 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 23 Aug 2010 23:33:03 -0500 Subject: [PATCH 25/26] Clean up documentation. --- README.FIRST | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/README.FIRST b/README.FIRST index aef4008f..125ece9e 100644 --- a/README.FIRST +++ b/README.FIRST @@ -7,7 +7,7 @@ If you don't read this first, we won't help you. * - Reading INSTALL is now a must, as the old DPATH is now specified * * when configure is run. * * You now need to ./configure --prefix="/path/to/install/it" * - * will be installed with your ircd! * + * to specify the path that will be installed with your ircd! * ************************************************************************* ALSO, IF YOU ARE UPGRADING YOUR CURRENT SOURCE TREE, AND YOU TRY TO BUILD @@ -16,15 +16,6 @@ If you don't read this first, we won't help you. ******************************* REQUIREMENTS ********************************** -New Features - A short introduction: -- charybdis-3.x now has several major changes over previous version that you - will notice right away. - o SSL Client support. - o Connection Throttling. - -- Please see NEWS for more detailed changes. - - Necessary Requirements: - A supported platform (look below) From 101b7fcb55e22533d01b7c993f9714f9687788b4 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 23 Aug 2010 23:37:13 -0500 Subject: [PATCH 26/26] Most of this was out of date too. --- README.FIRST | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/README.FIRST b/README.FIRST index 125ece9e..8c23c45f 100644 --- a/README.FIRST +++ b/README.FIRST @@ -1,6 +1,3 @@ -If you don't read this first, we won't help you. -:-) - ******************************* IMPORTANT ************************************* *********** Note for those who dont bother reading docs ***************** @@ -20,9 +17,7 @@ Necessary Requirements: - A supported platform (look below) -- A working dynamic load library, unless - compiling as static, without module - support. +- A working dynamic load library. - A working lex. Solaris /usr/ccs/bin/lex appears to be broken, on this system flex @@ -32,9 +27,11 @@ Necessary Requirements: Feature Specific Requirements: - For SSL Clients, SSL Challenge controlled OPER feature, and encrypted server links, - a working OpenSSL library + a working OpenSSL library or GnuTLS library. CHALLENGE is not supported on GnuTLS + yet. -- For encrypted oper and (optional) server passwords, a working DES, MD5, or SHA library. +- For encrypted oper and (optional) server passwords, a working DES, MD5, or SHA library + implementing crypt(). ******************************************************************************* @@ -45,10 +42,10 @@ Feature Specific Requirements: - Please read doc/index.txt to get an overview of the current documentation. -- The files, /etc/services, /etc/protocols, and /etc/resolv.conf, MUST be - readable by the user running the server in order for ircd to start. - Errors from adns causing the ircd to refuse to start up are often related - to permission problems on these files. +- The files, /etc/services, /etc/protocols, and /etc/resolv.conf, SHOULD be + readable by the user running the server in order for ircd to start with + the correct settings. If these files are wrong, charybdis will try to use + 127.0.0.1 for a resolver as a last-ditch effort. - FREEBSD USERS: if you are compiling with ipv6 you may experience problems with ipv4 due to the way the socket code is written. To @@ -82,11 +79,7 @@ Feature Specific Requirements: Solaris 2.6/7/8 OpenBSD 2.8 NetBSD 1.4 - OpenVMS/Alpha 7.2 (static modules, no ssld) -- Please read NEWS for information about what is in this release +- Please read NEWS for information about what is in this release. - Other files recommended for reading: BUGS, INSTALL - --------------------------------------------------------------------------------- -$Id$