Prohibit same +A and +U pass; fix IAuth crash (#1193808), invite
authorMichael Poole <mdpoole@troilus.org>
Tue, 3 May 2005 03:47:42 +0000 (03:47 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 3 May 2005 03:47:42 +0000 (03:47 +0000)
forwarding bug (also reported by jast), and IP numnick parsing bug.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1393 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/numeric.h
ircd/channel.c
ircd/ircd_auth.c
ircd/m_invite.c
ircd/numnicks.c
ircd/s_err.c

index 106d3c51c8bfe0ed554453d6a3a488301a060adf..bca220a7f69c320ee9996e6cb5e7e23b7a7197d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2005-05-02  Michael Poole <mdpoole@troilus.org>
+
+       * include/numeric.h (ERR_UPASS_SAME_APASS): New error message when
+       trying to set +U pass to the same as the +A pass.
+
+       * ircd/channel.c (mode_parse_upass): Use it.
+
+       * ircd/ircd_auth.c (iauth_exit_client): Only send ExitUser if
+       there is an active IAuth connection, fixing PR#1193808.
+       (iauth_dispose_request): Only delete the timer if it is active.
+
+       * ircd/m_invite.c (m_invite): Always forward the invite in the
+       correct direction, and then skip it as 'one' if announcing.
+       (ms_invite): Likewise.
+
+       * ircd/numnicks.c (base64toip): Do not interpret AAAAAA as
+       ::ffff:0.0.0.0; keep it as ::.
+
+       * ircd/s_err.c (replyTable): Add ERR_UPASS_SAME_APASS.
+
 2005-05-01  Michael Poole <mdpoole@troilus.org>
 
        * doc/readme.log: Document IAUTH log target, remove docs for
index bf82848fcae761ade2ecb00ad1ae0ed9bc7c0194..c3bbfabc95bf89f3b283b8d84ffda76b1780cc6e 100644 (file)
@@ -463,7 +463,8 @@ extern const struct Numeric* get_error_numeric(int err);
 #define ERR_UPASSNOTSET      554       /* Undernet extension */
 #define ERR_NOMANAGER_LONG   555       /* Undernet extension */
 #define ERR_NOMANAGER_SHORT  556       /* Undernet extension */
-#define ERR_LASTERROR        557
+#define ERR_UPASS_SAME_APASS 557        /* Undernet extension */
+#define ERR_LASTERROR        558
 
 /*     RPL_LOGON            600        dalnet,unreal
        RPL_LOGOFF           601        dalnet,unreal
index 2d6ce01660f5984d3fbe9c75fa43ae99a81a66c3..f5d78add9e2a167dddf3e55fc5d399046c9671c7 100644 (file)
@@ -2484,6 +2484,11 @@ mode_parse_upass(struct ParseState *state, int *flag_p)
       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 &&
index 8b76a160cab521c84c94000b3b7d76e9e37e9b6a..29affeedee5428db91df00061bf61b1d6b922841 100644 (file)
@@ -721,10 +721,10 @@ void iauth_exit_client(struct Client *cptr)
     iauth_dispose_request(iauth_active, cli_iauth(cptr));
     cli_iauth(cptr) = NULL;
   }
-  if (!i_GetConnected(iauth_active))
-    return;
-  iauth_send(iauth_active, "ExitUser %x", cptr);
-  iauth_write(iauth_active);
+  if (iauth_active && i_GetConnected(iauth_active)) {
+    iauth_send(iauth_active, "ExitUser %x", cptr);
+    iauth_write(iauth_active);
+  }
 }
 
 /** Find pending request with a particular ID.
@@ -754,7 +754,7 @@ static struct IAuthRequest *iauth_find_request(struct IAuth *iauth, char *id)
 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 478ff5b0ca016abfd24df5c07ba68540d53bc9c7..c550263b28a0611eb0504a543dc04ec04b5d8be4 100644 (file)
@@ -180,6 +180,9 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   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)) {
@@ -190,7 +193,7 @@ int m_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
                                        "%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);
     }
@@ -280,8 +283,11 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     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)) {
@@ -291,12 +297,10 @@ int ms_invite(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
                                      "%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 bf11b7e1df73e953d84ad75256d64c79c297d7d2..9dd051dea3cacf8a00b871c314f9a2dba4c36d49 100644 (file)
@@ -502,9 +502,12 @@ void base64toip(const char* input, struct irc_in_addr* addr)
   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 4b03b3ddffd5b75262f40900aeee929dc0da8ae1..d834944f0f94526d57e268ae5f1c12abcfc2b1c3 100644 (file)
@@ -1146,7 +1146,7 @@ static Numeric replyTable[] = {
 /* 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" },
 /* 557 */
-  { 0 },
+  { ERR_UPASS_SAME_APASS, "%s :Cannot use the same pass for both admin (+A) and user (+U) pass.", "557" },
 /* 558 */
   { 0 },
 /* 559 */