+2006-06-18 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/channel.c (mode_parse_key): Outside of burst, allow
+ overwriting of keys by a service when a key is already set.
+ (mode_parse_upass): Likewise. Instead, ignore new Upass during
+ burst if it is lexicographically greater than the current one.
+ (mode_parse_apas): Likewise for Apass, but only allow overwiting
+ an existing Apass in a BURST.
+
2006-06-18 Michael Poole <mdpoole@troilus.org>
* ircd/channel.c (modebuf_flush_int): Fix typo about changing
if (state->flags & MODE_PARSE_SET) {
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)
+ else
ircd_strncpy(state->chptr->mode.key, t_str, KEYLEN);
}
}
!ircd_strcmp(state->chptr->mode.upass, t_str))
return; /* no upass change */
+ /* Skip if this is a burst, we have a Upass already and the new Upass is
+ * after the old one alphabetically */
+ if ((state->flags & MODE_PARSE_BURST) &&
+ *(state->chptr->mode.upass) &&
+ ircd_strcmp(state->chptr->mode.upass, t_str) <= 0)
+ return;
+
if (state->flags & MODE_PARSE_BOUNCE) {
if (*state->chptr->mode.upass) /* reset old upass */
modebuf_mode_string(state->mbuf, MODE_DEL | flag_p[0],
if (state->flags & MODE_PARSE_SET) {
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)
+ else
ircd_strncpy(state->chptr->mode.upass, t_str, KEYLEN);
}
}
!ircd_strcmp(state->chptr->mode.apass, t_str))
return; /* no apass change */
+ /* Skip if this is a burst, we have an Apass already and the new Apass is
+ * after the old one alphabetically */
+ if ((state->flags & MODE_PARSE_BURST) &&
+ *(state->chptr->mode.apass) &&
+ ircd_strcmp(state->chptr->mode.apass, t_str) <= 0)
+ return;
+
if (state->flags & MODE_PARSE_BOUNCE) {
if (*state->chptr->mode.apass) /* reset old apass */
modebuf_mode_string(state->mbuf, MODE_DEL | flag_p[0],
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)
+ /* Only accept the new apass if there is no current apass or
+ * this is a BURST. */
+ if (state->chptr->mode.apass[0] == '\0' ||
+ (state->flags & MODE_PARSE_BURST))
ircd_strncpy(state->chptr->mode.apass, t_str, KEYLEN);
/* Make it VERY clear to the user that this is a one-time password */
if (MyUser(state->sptr)) {