Author: Bleep <tomh@inxpress.net>
authorBleep <twhelvey1@home.com>
Tue, 28 Mar 2000 06:40:56 +0000 (06:40 +0000)
committerBleep <twhelvey1@home.com>
Tue, 28 Mar 2000 06:40:56 +0000 (06:40 +0000)
Log message:
Merge bugfixes from 2.10.10

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

ChangeLog.10
include/s_misc.h
include/send.h
ircd/channel.c
ircd/ircd.c
ircd/opercmds.c
ircd/packet.c
ircd/s_bsd.c
ircd/s_misc.c
ircd/send.c

index 95485d21f679a4cf0d547964b650860f350956be..2b08206338eeab4884134b9a40147967ac59764f 100644 (file)
@@ -1,10 +1,12 @@
 #
 # ChangeLog for ircu2.10.10
 #
-# $Id: ChangeLog.10,v 1.6 2000-03-28 00:52:14 bleep Exp $
+# $Id: ChangeLog.10,v 1.7 2000-03-28 06:40:56 bleep Exp $
 #
 # Insert new changes at beginning of the change list.
 #
+* Fix for Max Undernet Server bug --Bleep
+* Fix for PRIVMSG<->NOTICE translation from hubs --Bleep
 * Fix for Bogus protocol strings for P9 servers --Bleep
 * Hookup UPING code again, cleanups --Bleep
 * Convert numerics back to mask and shift extended numerics
index 7c82b170fdbf026e6478bc72e274b494e05977de..1dc068b60401841dd406bb647b9b3072be610ef9 100644 (file)
@@ -64,16 +64,16 @@ struct ServerStatistics {
 extern int check_registered(struct Client *sptr);
 extern int check_registered_user(struct Client *sptr);
 extern int exit_client(struct Client *cptr, struct Client *bcptr,
-    struct Client *sptr, char *comment);
+    struct Client *sptr, const char *comment);
 extern char *myctime(time_t value);
 extern int exit_client_msg(struct Client *cptr, struct Client *bcptr,
-                           struct Client *sptr, char *pattern, ...);
+                           struct Client *sptr, const char *pattern, ...);
 extern void initstats(void);
 extern char *date(time_t clock);
 extern const char* get_client_host(const struct Client *cptr);
 extern void get_sockhost(struct Client *cptr, char *host);
 extern int vexit_client_msg(struct Client *cptr, struct Client *bcptr,
-    struct Client *sptr, char *pattern, va_list vl);
+    struct Client *sptr, const char *pattern, va_list vl);
 extern void tstats(struct Client *cptr, char *name);
 
 extern struct ServerStatistics* ServerStats;
index 3b719d0b2794806a92bd0822586914b0749067c2..422e62b8938f9bcb9c65b829e31f16039af700a9 100644 (file)
@@ -14,16 +14,10 @@ struct Channel;
 struct Client;
 struct DBuf;
 
-/*
- * Macros
- */
-
-#define LastDeadComment(cptr) ((cptr)->info)
 
 /*
  * Prototypes
  */
-
 extern void send_buffer(struct Client* to, char* buf);
 extern void flush_sendq_except(const struct DBuf* one);
 
index 9fe8e42390cfd1e9cc2d91727f6e9d06af8a75a8..7fbf8e926d66cda8e4a109c360fff74fd01caba6 100644 (file)
@@ -2928,7 +2928,7 @@ modebuf_flush(struct ModeBuf *mbuf)
                     "]", app_source->name, mbuf->mb_channel->chname,
                     addbuf_i ? "+" : "", addbuf, rembuf_i ? "-" : "", rembuf,
                     addstr, remstr, mbuf->mb_channel->creationtime);
-      sendto_serv_butone(mbuf->connect, "%s " TOK_DESYNCH
+      sendto_serv_butone(mbuf->mb_connect, "%s " TOK_DESYNCH
                         " :HACK: %s MODE %s %s%s%s%s%s%s [" TIME_T_FMT "]",
                         NumServ(&me), app_source->name,
                         mbuf->mb_channel->chname, addbuf_i ? "+" : "", addbuf,
index 59dcbfda92f18611d3c5020e6ac501508b56da89..dc445cb5c675bec0abd46f174a1a9d782f6badad 100644 (file)
@@ -275,7 +275,7 @@ static time_t check_pings(void)
      * It's already done when "FLAGS_DEADSOCKET" is set.
      */
     if (IsDead(cptr)) {
-      exit_client(cptr, cptr, &me, LastDeadComment(cptr));
+      exit_client(cptr, cptr, &me, cptr->info);
       continue;
     }
 
index eb459866d61e7d315f42c41892d38a92fe90d2e3..bbc4cec48bbb1afc94371d93868b4ee08aa2d53f 100644 (file)
@@ -111,7 +111,7 @@ void report_configured_links(struct Client *sptr, int mask)
         sendto_one(sptr, rpl_str(p[1]),
             me.name, sptr->name, c, host, pass, name, port,
             get_conf_class(tmp));
-      else if ((tmp->status & CONF_SERVER))
+      else if ((tmp->status & (CONF_SERVER | CONF_HUB)))
         sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, "*", name,
             port, get_conf_class(tmp));
       else
index 35b5cff7c9410b679e658d256d1aa43c00bdcde1..2d2f873982a9c0f20df12ddfa4bebcd31d84b896 100644 (file)
@@ -100,7 +100,7 @@ int server_dopacket(struct Client* cptr, const char* buffer, int length)
        *  Socket is dead so exit
        */
       if (IsDead(cptr))
-        return exit_client(cptr, cptr, &me, LastDeadComment(cptr));
+        return exit_client(cptr, cptr, &me, cptr->info);
       endp = client_buffer;
     }
     else if (endp < client_buffer + BUFSIZE)
@@ -123,7 +123,7 @@ int client_dopacket(struct Client *cptr, unsigned int length)
   if (CPTR_KILLED == parse_client(cptr, cptr->buffer, cptr->buffer + length))
     return CPTR_KILLED;
   else if (IsDead(cptr))
-    return exit_client(cptr, cptr, &me, LastDeadComment(cptr));
+    return exit_client(cptr, cptr, &me, cptr->info);
 
   return 1;
 }
index 23877236c5285f26016526b5f154f42d81816bfa..eb5077ac33ad9c4a86e1bd95db1e6c0d77a7f703 100644 (file)
@@ -1032,10 +1032,10 @@ int read_message(time_t delay)
     }
     if (write_ready) {
       if (!on_write_unblocked(cptr) || IsDead(cptr)) {
-        const char* msg = (cptr->error) ? strerror(cptr->error) : LastDeadComment(cptr);
+        const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
         if (!msg)
           msg = "Unknown error";
-        exit_client(cptr, cptr, &me, (char*) msg);
+        exit_client(cptr, cptr, &me, msg);
         continue;
       }
     }
@@ -1051,7 +1051,7 @@ int read_message(time_t delay)
       flush_connections(poll_cptr[i]);
 #endif
     if (IsDead(cptr)) {
-      const char* msg = (cptr->error) ? strerror(cptr->error) : LastDeadComment(cptr);
+      const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
       if (!msg)
         msg = "Unknown error";
       exit_client(cptr, cptr, &me, (char*) msg);
@@ -1247,7 +1247,7 @@ int read_message(time_t delay)
       if (FD_ISSET(i, &write_set)) {
         --nfds;
         if (!on_write_unblocked(cptr) || IsDead(cptr)) {
-          const char* msg = (cptr->error) ? strerror(cptr->error) : LastDeadComment(cptr);
+          const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
           if (!msg)
             msg = "Unknown error";
           if (FD_ISSET(i, &read_set))
@@ -1271,7 +1271,7 @@ int read_message(time_t delay)
       flush_connections(LocalClientArray[i]);
 #endif
     if (IsDead(cptr)) {
-      const char* msg = (cptr->error) ? strerror(cptr->error) : LastDeadComment(cptr);
+      const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
       if (!msg)
         msg = "Unknown error";
       exit_client(cptr, cptr, &me, msg);
index 9d600b6e2b8cba6fbc457b1a1e1ec75b3dde5ffe..c910a00db7a46f6fbf085932989bffe26ebf67f2 100644 (file)
@@ -59,7 +59,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-static void exit_one_client(struct Client *, char *);
 
 static char *months[] = {
   "January", "February", "March", "April",
@@ -199,6 +198,111 @@ void get_sockhost(struct Client *cptr, char *host)
   ircd_strncpy(cptr->sockhost, s, HOSTLEN);
 }
 
+/*
+ * Exit one client, local or remote. Assuming for local client that
+ * all dependants already have been removed, and socket is closed.
+ *
+ * Rewritten by Run - 24 sept 94
+ *
+ * bcptr : client being (s)quitted
+ * sptr : The source (prefix) of the QUIT or SQUIT
+ *
+ * --Run
+ */
+static void exit_one_client(struct Client* bcptr, const char* comment)
+{
+  struct SLink *lp;
+
+  if (bcptr->serv && bcptr->serv->client_list)  /* Was SetServerYXX called ? */
+    ClearServerYXX(bcptr);      /* Removes server from server_list[] */
+  if (IsUser(bcptr)) {
+    /*
+     * clear out uping requests
+     */
+    if (IsUPing(bcptr))
+      uping_cancel(bcptr, 0);
+    /*
+     * Stop a running /LIST clean
+     */
+    if (MyUser(bcptr) && bcptr->listing) {
+      bcptr->listing->chptr->mode.mode &= ~MODE_LISTED;
+      MyFree(bcptr->listing);
+      bcptr->listing = NULL;
+    }
+    /*
+     * If a person is on a channel, send a QUIT notice
+     * to every client (person) on the same channel (so
+     * that the client can show the "**signoff" message).
+     * (Note: The notice is to the local clients *only*)
+     */
+    sendto_common_channels(bcptr, ":%s QUIT :%s", bcptr->name, comment);
+
+    remove_user_from_all_channels(bcptr);
+
+    /* Clean up invitefield */
+    while ((lp = bcptr->user->invited))
+      del_invite(bcptr, lp->value.chptr);
+
+    /* Clean up silencefield */
+    while ((lp = bcptr->user->silence))
+      del_silence(bcptr, lp->value.cp);
+
+    if (IsInvisible(bcptr))
+      --UserStats.inv_clients;
+    if (IsOper(bcptr))
+      --UserStats.opers;
+    if (MyConnect(bcptr))
+      Count_clientdisconnects(bcptr, UserStats);
+    else
+      Count_remoteclientquits(UserStats, bcptr);
+  }
+  else if (IsServer(bcptr))
+  {
+    /* Remove downlink list node of uplink */
+    remove_dlink(&bcptr->serv->up->serv->down, bcptr->serv->updown);
+    bcptr->serv->updown = 0;
+
+    if (MyConnect(bcptr))
+      Count_serverdisconnects(UserStats);
+    else
+      Count_remoteserverquits(UserStats);
+  }
+  else if (IsMe(bcptr))
+  {
+    sendto_ops("ERROR: tried to exit me! : %s", comment);
+    return;                     /* ...must *never* exit self! */
+  }
+  else if (IsUnknown(bcptr) || IsConnecting(bcptr) || IsHandshake(bcptr))
+    Count_unknowndisconnects(UserStats);
+
+  /*
+   * Update IPregistry
+   */
+  if (IsIPChecked(bcptr))
+    IPcheck_disconnect(bcptr);
+
+  /* 
+   * Remove from serv->client_list
+   * NOTE: user is *always* NULL if this is a server
+   */
+  if (bcptr->user) {
+    assert(!IsServer(bcptr));
+    /* bcptr->user->server->serv->client_list[IndexYXX(bcptr)] = NULL; */
+    RemoveYXXClient(bcptr->user->server, bcptr->yxx);
+  }
+
+  /* Remove bcptr from the client list */
+#ifdef DEBUGMODE
+  if (hRemClient(bcptr) != 0)
+    Debug((DEBUG_ERROR, "%p !in tab %s[%s] %p %p %p %d %d %p",
+          bcptr, bcptr->name, bcptr->from ? bcptr->from->sockhost : "??host",
+          bcptr->from, bcptr->next, bcptr->prev, bcptr->fd,
+          bcptr->status, bcptr->user));
+#else
+  hRemClient(bcptr);
+#endif
+  remove_client_from_list(bcptr);
+}
 /*
  * exit_downlinks - added by Run 25-9-94
  *
@@ -272,7 +376,7 @@ int exit_client(struct Client *cptr,    /* Connection being handled by
     struct Client* victim,              /* Client being killed */
     struct Client* killer,              /* The client that made the decision
                                    to remove this one, never NULL */
-    char *comment)              /* Reason for the exit */
+    const char* comment)              /* Reason for the exit */
 {
   struct Client* acptr = 0;
   struct DLink *dlp;
@@ -415,7 +519,7 @@ int exit_client(struct Client *cptr,    /* Connection being handled by
  * Exit client with formatted message, added 25-9-94 by Run
  */
 int vexit_client_msg(struct Client *cptr, struct Client *bcptr, struct Client *sptr,
-    char *pattern, va_list vl)
+    const char *pattern, va_list vl)
 {
   char msgbuf[1024];
   vsprintf_irc(msgbuf, pattern, vl);
@@ -423,7 +527,7 @@ int vexit_client_msg(struct Client *cptr, struct Client *bcptr, struct Client *s
 }
 
 int exit_client_msg(struct Client *cptr, struct Client *bcptr,
-    struct Client *sptr, char *pattern, ...)
+    struct Client *sptr, const char *pattern, ...)
 {
   va_list vl;
   char msgbuf[1024];
@@ -435,113 +539,6 @@ int exit_client_msg(struct Client *cptr, struct Client *bcptr,
   return exit_client(cptr, bcptr, sptr, msgbuf);
 }
 
-/*
- * Exit one client, local or remote. Assuming for local client that
- * all dependants already have been removed, and socket is closed.
- *
- * Rewritten by Run - 24 sept 94
- *
- * bcptr : client being (s)quitted
- * sptr : The source (prefix) of the QUIT or SQUIT
- *
- * --Run
- */
-static void exit_one_client(struct Client *bcptr, char *comment)
-{
-  struct SLink *lp;
-
-  if (bcptr->serv && bcptr->serv->client_list)  /* Was SetServerYXX called ? */
-    ClearServerYXX(bcptr);      /* Removes server from server_list[] */
-  if (IsUser(bcptr)) {
-    /*
-     * clear out uping requests
-     */
-    if (IsUPing(bcptr))
-      uping_cancel(bcptr, 0);
-    /*
-     * Stop a running /LIST clean
-     */
-    if (MyUser(bcptr) && bcptr->listing) {
-      bcptr->listing->chptr->mode.mode &= ~MODE_LISTED;
-      MyFree(bcptr->listing);
-      bcptr->listing = NULL;
-    }
-    /*
-     * If a person is on a channel, send a QUIT notice
-     * to every client (person) on the same channel (so
-     * that the client can show the "**signoff" message).
-     * (Note: The notice is to the local clients *only*)
-     */
-    sendto_common_channels(bcptr, ":%s QUIT :%s", bcptr->name, comment);
-
-    remove_user_from_all_channels(bcptr);
-
-    /* Clean up invitefield */
-    while ((lp = bcptr->user->invited))
-      del_invite(bcptr, lp->value.chptr);
-
-    /* Clean up silencefield */
-    while ((lp = bcptr->user->silence))
-      del_silence(bcptr, lp->value.cp);
-
-    if (IsInvisible(bcptr))
-      --UserStats.inv_clients;
-    if (IsOper(bcptr))
-      --UserStats.opers;
-    if (MyConnect(bcptr))
-      Count_clientdisconnects(bcptr, UserStats);
-    else
-      Count_remoteclientquits(UserStats, bcptr);
-  }
-  else if (IsServer(bcptr))
-  {
-    /* Remove downlink list node of uplink */
-    remove_dlink(&bcptr->serv->up->serv->down, bcptr->serv->updown);
-    bcptr->serv->updown = 0;
-
-    if (MyConnect(bcptr))
-      Count_serverdisconnects(UserStats);
-    else
-      Count_remoteserverquits(UserStats);
-  }
-  else if (IsMe(bcptr))
-  {
-    sendto_ops("ERROR: tried to exit me! : %s", comment);
-    return;                     /* ...must *never* exit self! */
-  }
-  else if (IsUnknown(bcptr) || IsConnecting(bcptr) || IsHandshake(bcptr))
-    Count_unknowndisconnects(UserStats);
-
-  /*
-   * Update IPregistry
-   */
-  if (IsIPChecked(bcptr))
-    IPcheck_disconnect(bcptr);
-
-  /* 
-   * Remove from serv->client_list
-   * NOTE: user is *always* NULL if this is a server
-   */
-  if (bcptr->user) {
-    assert(!IsServer(bcptr));
-    /* bcptr->user->server->serv->client_list[IndexYXX(bcptr)] = NULL; */
-    RemoveYXXClient(bcptr->user->server, bcptr->yxx);
-  }
-
-  /* Remove bcptr from the client list */
-#ifdef DEBUGMODE
-  if (hRemClient(bcptr) != 0)
-    Debug((DEBUG_ERROR, "%p !in tab %s[%s] %p %p %p %d %d %p",
-          bcptr, bcptr->name, bcptr->from ? bcptr->from->sockhost : "??host",
-          bcptr->from, bcptr->next, bcptr->prev, bcptr->fd,
-          bcptr->status, bcptr->user));
-#else
-  hRemClient(bcptr);
-#endif
-  remove_client_from_list(bcptr);
-}
-
-
 void initstats(void)
 {
   memset(&ircst, 0, sizeof(ircst));
index 6db5336a0a9e3bf4c468c1ce4f215b0c5e1555ea..c160a9eccae98883268da2fb26a1ca3d5e901c0f 100644 (file)
@@ -79,13 +79,14 @@ static void dead_link(struct Client *to, char *notice)
   DBufClear(&to->recvQ);
   DBufClear(&to->sendQ);
 
-  /* Keep a copy of the last comment, for later use... */
-  ircd_strncpy(LastDeadComment(to), notice, sizeof(LastDeadComment(to) - 1));
-  LastDeadComment(to)[sizeof(LastDeadComment(to)) - 1] = '\0';
+  /*
+   * Keep a copy of the last comment, for later use...
+   */
+  ircd_strncpy(to->info, notice, REALLEN);
 
   if (!IsUser(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
-    sendto_ops("%s for %s", LastDeadComment(to), to->name);
-  Debug((DEBUG_ERROR, LastDeadComment(to)));
+    sendto_ops("%s for %s", to->info, to->name);
+  Debug((DEBUG_ERROR, to->info));
 }
 
 static int can_send(struct Client* to)
@@ -371,6 +372,7 @@ void sendmsgto_channel_butone(struct Client *one, struct Client *from,
   int i;
   int flag=-1;
 
+  assert(0 != cmd);
   /* 
    * Precalculate the buffers we sent to the clients instead of doing an
    * expensive sprintf() per member that we send to.  We still have to
@@ -378,20 +380,14 @@ void sendmsgto_channel_butone(struct Client *one, struct Client *from,
    */
   if (IsServer(from)) {
     sprintf(userbuf,":%s %s %s :%s",
-        from->name, 
-        ((cmd[0] == 'P') ? MSG_PRIVATE : MSG_NOTICE),
-        chname, msg);
-    sprintf(servbuf,"%s " TOK_PRIVATE " %s :%s",
-        NumServ(from), chname, msg);
-  } else {
+            from->name, ('P' == *cmd) ? MSG_PRIVATE : MSG_NOTICE, chname, msg);
+    sprintf(servbuf,"%s %s %s :%s", NumServ(from), cmd, chname, msg);
+  }
+  else {
     sprintf(userbuf,":%s!%s@%s %s %s :%s",
-      from->name, from->username, from->user->host,
-      ((cmd[0] == 'P') ? MSG_PRIVATE : MSG_NOTICE),
-      chname, msg);
-    sprintf(servbuf,"%s%s %s %s :%s",
-      NumNick(from), 
-       ((cmd[0] == 'P') ? TOK_PRIVATE : TOK_NOTICE),
-     chname, msg);
+            from->name, from->username, from->user->host,
+            ('P' == *cmd) ? MSG_PRIVATE : MSG_NOTICE, chname, msg);
+    sprintf(servbuf,"%s%s %s %s :%s", NumNick(from), cmd, chname, msg);
   }
 
   ++sentalong_marker;