Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2005-09-23 01:16:01 UTC
Modified files:
ChangeLog ircd/channel.c
Log message:
Fix bug #1298149 and a similar desynch for channel keys.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.704 ircu2.10/ChangeLog:1.705
--- ircu2.10/ChangeLog:1.704 Thu Sep 22 13:42:20 2005
+++ ircu2.10/ChangeLog Thu Sep 22 18:15:49 2005
@@ -1,5 +1,12 @@
2005-09-22 Michael Poole <[EMAIL PROTECTED]>
+ * ircd/channel.c (mode_parse_key): Only accept the new key when
+ the current one is empty or "greater" than the new one.
+ (mode_parse_upass): Likewise, for upass.
+ (mode_parse_apass): Likewise, for apass.
+
+2005-09-22 Michael Poole <[EMAIL PROTECTED]>
+
* ircd/gline.c (gline_checkmask): Add missing digit in mask length
check.
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.153 ircu2.10/ircd/channel.c:1.154
--- ircu2.10/ircd/channel.c:1.153 Wed Sep 14 11:55:27 2005
+++ ircu2.10/ircd/channel.c Thu Sep 22 18:15:51 2005
@@ -19,7 +19,7 @@
*/
/** @file
* @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.153 2005/09/14 18:55:27 entrope Exp $
+ * @version $Id: channel.c,v 1.154 2005/09/23 01:15:51 entrope Exp $
*/
#include "config.h"
@@ -2326,10 +2326,11 @@
modebuf_mode_string(state->mbuf, state->dir | flag_p[0], t_str, 0);
if (state->flags & MODE_PARSE_SET) {
- if (state->dir == MODE_ADD) /* set the new key */
- ircd_strncpy(state->chptr->mode.key, t_str, KEYLEN);
- else /* remove the old key */
+ if (state->dir == MODE_DEL) /* remove the old key */
*state->chptr->mode.key = '\0';
+ else if (!state->chptr->mode.key[0]
+ || ircd_strcmp(t_str, state->chptr->mode.key) < 0)
+ ircd_strncpy(state->chptr->mode.key, t_str, KEYLEN);
}
}
@@ -2430,10 +2431,11 @@
modebuf_mode_string(state->mbuf, state->dir | flag_p[0], t_str, 0);
if (state->flags & MODE_PARSE_SET) {
- if (state->dir == MODE_ADD) /* set the new upass */
- ircd_strncpy(state->chptr->mode.upass, t_str, KEYLEN);
- else /* remove the old upass */
+ if (state->dir == MODE_DEL) /* remove the old upass */
*state->chptr->mode.upass = '\0';
+ else if (state->chptr->mode.upass[0] == '\0'
+ || ircd_strcmp(t_str, state->chptr->mode.upass) < 0)
+ ircd_strncpy(state->chptr->mode.upass, t_str, KEYLEN);
}
}
@@ -2538,8 +2540,14 @@
if (state->flags & MODE_PARSE_SET) {
if (state->dir == MODE_ADD) { /* set the new apass */
+ /* Only accept the new apass if there is no current apass
+ * (e.g. when a user sets it) or the new one is "less" than the
+ * old (for resolving conflicts during burst).
+ */
+ if (state->chptr->mode.apass[0] == '\0'
+ || ircd_strcmp(t_str, state->chptr->mode.apass) < 0)
+ ircd_strncpy(state->chptr->mode.apass, t_str, KEYLEN);
/* Make it VERY clear to the user that this is a one-time password */
- ircd_strncpy(state->chptr->mode.apass, t_str, KEYLEN);
if (MyUser(state->sptr)) {
send_reply(state->sptr, RPL_APASSWARN_SET, state->chptr->mode.apass);
send_reply(state->sptr, RPL_APASSWARN_SECRET, state->chptr->chname,
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches