Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Sun, 16 Apr 2000 04:30:42 +0000 (04:30 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Sun, 16 Apr 2000 04:30:42 +0000 (04:30 +0000)
Log message:

fix for ircd_snprintf assigning negative numbers to a size_t; clean up
expire time handling to use offsets to CurrentTime, since that's definitely
monotonically increasing; remove local jupes/glines instead of simply
deactivating them; forgot one case in sendcmdto_one()

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

ChangeLog
ircd/gline.c
ircd/ircd_snprintf.c
ircd/jupe.c
ircd/send.c

index 1d53b4fe6c9d4678b7ce86d2733c2c51761bc97e..9f43dd7c7f4403e202ea88a2b14531fd4493eca3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2000-04-16  Kevin L. Mitchell  <klmitch@mit.edu>
+
+       * ircd/gline.c: make gline expire times relative to CurrentTime,
+       since that should be monotonically increasing, instead of
+       TStime(), which can be set backwards, and which can therefore
+       cause an expire time to increase; make local glines be removed
+       instead of just deactivated; don't let gline_find() look for
+       user@host glines if the mask being looked up is a channel mask
+
+       * ircd/send.c (vsendcmdto_one): forgot to account for the case
+       where origin is a server and destination is a user
+
+       * ircd/jupe.c: make jupe expire times relative to CurrentTime,
+       since that should be monotonically increasing, instead of
+       TStime(), which can be set backwards, and which can therefore
+       cause an expire time to increase; make local jupes be removed
+       instead of just deactivated
+
+       * ircd/ircd_snprintf.c: d'oh, thanks for catching that; short for
+       limit is fine.  any other warnings I should know about?
+
 2000-04-15  Thomas Helvey <tomh@inxpress.net>
 
        * ircd/*.c: const correctness and type safety cleanups to
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.89 2000-04-15 04:20:14 bleep Exp $
+# $Id: ChangeLog,v 1.90 2000-04-16 04:30:42 kev Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index f83ff6b012f83fe70382ebc99b84d707ca9a3c1f..03cfae6684bb001433f8e98267fd3eb5b0ab0032 100644 (file)
@@ -152,14 +152,14 @@ propagate_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
                          GlineIsActive(gline) ? '+' : '-', gline->gl_user,
                          GlineIsBadChan(gline) ? "" : "@",
                          GlineIsBadChan(gline) ? "" : gline->gl_host,
-                         gline->gl_expire - TStime(), gline->gl_lastmod,
+                         gline->gl_expire - CurrentTime, gline->gl_lastmod,
                          gline->gl_reason);
   else
     sendcmdto_serv_butone(cptr, CMD_GLINE, sptr, "* %c%s%s%s %Tu :%s",
                          GlineIsActive(gline) ? '+' : '-', gline->gl_user,
                          GlineIsBadChan(gline) ? "" : "@",
                          GlineIsBadChan(gline) ? "" : gline->gl_host,
-                         gline->gl_expire - TStime(), gline->gl_reason);
+                         gline->gl_expire - CurrentTime, gline->gl_reason);
 }
 
 int 
@@ -181,7 +181,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
     return 0;
   }
 
-  expire += TStime(); /* convert from lifetime to timestamp */
+  expire += CurrentTime; /* convert from lifetime to timestamp */
 
   /* NO_OLD_GLINE allows *@#channel to work correctly */
 #ifdef BADCHAN
@@ -204,7 +204,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
                 IsServer(sptr) ? sptr->name : sptr->user->server->name,
                 flags & GLINE_LOCAL ? "local" : "global",
                 flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
-                expire, reason);
+                expire + TSoffset, reason);
 
 #ifdef GPATH
   /* and log it */
@@ -212,15 +212,15 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
     write_log(GPATH, "# " TIME_T_FMT " %s adding %s %s for %s, expiring at "
              TIME_T_FMT ": %s\n", TStime(), sptr->name,
              flags & GLINE_LOCAL ? "local" : "global",
-             flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost, expire,
-             reason);
+             flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
+             expire + TSoffset, reason);
   else
     write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s adding %s %s for %s, "
              "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
              sptr->user->username, sptr->user->host,
              flags & GLINE_LOCAL ? "local" : "global",
-             flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost, expire,
-             reason);
+             flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
+             expire + TSoffset, reason);
 #endif /* GPATH */
 
   /* make the gline */
@@ -245,38 +245,40 @@ gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
               time_t lastmod)
 {
   assert(0 != gline);
+  assert(!GlineIsLocal(gline));
 
   gline->gl_flags |= GLINE_ACTIVE;
-  gline->gl_lastmod = lastmod;
+
+  if (gline->gl_lastmod >= lastmod) /* force lastmod to increase */
+    gline->gl_lastmod++;
+  else
+    gline->gl_lastmod = lastmod;
 
   /* Inform ops and log it */
-  sendto_op_mask(SNO_GLINE, "%s activating %s %s for %s%s%s, expiring at "
+  sendto_op_mask(SNO_GLINE, "%s activating global %s for %s%s%s, expiring at "
                 TIME_T_FMT ": %s",
                 IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                GlineIsLocal(gline) ? "local" : "global",
                 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
                 gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-                GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire,
-                gline->gl_reason);
+                GlineIsBadChan(gline) ? "" : gline->gl_host,
+                gline->gl_expire + TSoffset, gline->gl_reason);
 
 #ifdef GPATH
   if (IsServer(sptr))
-    write_log(GPATH, "# " TIME_T_FMT " %s activating %s %s for %s%s%s, "
+    write_log(GPATH, "# " TIME_T_FMT " %s activating global %s for %s%s%s, "
              "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             GlineIsLocal(gline) ? "local" : "global",
              GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
              gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire,
-             gline->gl_reason);
+             GlineIsBadChan(gline) ? "" : gline->gl_host,
+             gline->gl_expire + TSoffset, gline->gl_reason);
   else
-    write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s activating %s %s for "
+    write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s activating %s for "
              "%s%s%s, expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
              sptr->user->username, sptr->user->host,
-             GlineIsLocal(gline) ? "local" : "global",
              GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
              gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire,
-             gline->gl_reason);
+             GlineIsBadChan(gline) ? "" : gline->gl_host,
+             gline->gl_expire + TSoffset, gline->gl_reason);
 #endif /* GPATH */
 
   propagate_gline(cptr, sptr, gline);
@@ -290,40 +292,50 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
 {
   assert(0 != gline);
 
-  gline->gl_flags &= ~GLINE_ACTIVE;
-  gline->gl_lastmod = lastmod;
+  if (!GlineIsLocal(gline)) {
+    gline->gl_flags &= ~GLINE_ACTIVE;
+
+    if (gline->gl_lastmod >= lastmod)
+      gline->gl_lastmod++;
+    else
+      gline->gl_lastmod = lastmod;
+  }
 
   /* Inform ops and log it */
-  sendto_op_mask(SNO_GLINE, "%s deactivating %s %s for %s%s%s, expiring at "
+  sendto_op_mask(SNO_GLINE, "%s %s %s for %s%s%s, expiring at "
                 TIME_T_FMT ": %s",
                 IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                GlineIsLocal(gline) ? "local" : "global",
+                GlineIsLocal(gline) ? "removing local" :
+                "deactivating global",
                 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
                 gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-                GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire,
-                gline->gl_reason);
+                GlineIsBadChan(gline) ? "" : gline->gl_host,
+                gline->gl_expire + TSoffset, gline->gl_reason);
 
 #ifdef GPATH
   if (IsServer(sptr))
-    write_log(GPATH, "# " TIME_T_FMT " %s deactivating %s %s for %s%s%s, "
+    write_log(GPATH, "# " TIME_T_FMT " %s %s %s for %s%s%s, "
              "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             GlineIsLocal(gline) ? "local" : "global",
+             GlineIsLocal(gline) ? "removing local" : "deactivating global",
              GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
              gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire,
-             gline->gl_reason);
+             GlineIsBadChan(gline) ? "" : gline->gl_host,
+             gline->gl_expire + TSoffset, gline->gl_reason);
   else
-    write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s deactivating %s %s for "
+    write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s %s %s for "
              "%s%s%s, expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
              sptr->user->username, sptr->user->host,
-             GlineIsLocal(gline) ? "local" : "global",
+             GlineIsLocal(gline) ? "removing local" : "deactivating global",
              GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
              gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire,
-             gline->gl_reason);
+             GlineIsBadChan(gline) ? "" : gline->gl_host,
+             gline->gl_expire + TSoffset, gline->gl_reason);
 #endif /* GPATH */
 
-  propagate_gline(cptr, sptr, gline);
+  if (GlineIsLocal(gline))
+    gline_free(gline);
+  else
+    propagate_gline(cptr, sptr, gline);
 
   return 0;
 }
@@ -347,7 +359,12 @@ gline_find(char *userhost, unsigned int flags)
     }
   }
 
-  if ((flags & (GLINE_BADCHAN | GLINE_ANY)) == GLINE_BADCHAN)
+  if ((flags & (GLINE_BADCHAN | GLINE_ANY)) == GLINE_BADCHAN ||
+      *userhost == '#' || *userhost == '&' || *userhost == '+'
+#ifndef NO_OLD_GLINE
+      || userhost[2] == '#' || userhost[2] == '&' || userhost[2] == '+'
+#endif /* NO_OLD_GLINE */
+      )
     return 0;
 
   DupString(t_uh, userhost);
@@ -427,7 +444,7 @@ gline_burst(struct Client *cptr)
     else if (!GlineIsLocal(gline) && gline->gl_lastmod)
       sendcmdto_one(cptr, CMD_GLINE, &me, "* %c%s@%s %Tu %Tu :%s",
                    GlineIsActive(gline) ? '+' : '-', gline->gl_user,
-                   gline->gl_host, gline->gl_expire - TStime(),
+                   gline->gl_host, gline->gl_expire - CurrentTime,
                    gline->gl_lastmod, gline->gl_reason);
   }
 
@@ -439,7 +456,7 @@ gline_burst(struct Client *cptr)
     else if (!GlineIsLocal(gline) && gline->gl_lastmod)
       sendcmdto_one(cptr, CMD_GLINE, &me, "* %c%s %Tu %Tu :%s",
                    GlineIsActive(gline) ? '+' : '-', gline->gl_user,
-                   gline->gl_expire - TStime(), gline->gl_lastmod,
+                   gline->gl_expire - CurrentTime, gline->gl_lastmod,
                    gline->gl_reason);
   }
 }
@@ -454,7 +471,7 @@ gline_resend(struct Client *cptr, struct Gline *gline)
                GlineIsActive(gline) ? '+' : '-', gline->gl_user,
                GlineIsBadChan(gline) ? "" : "@",
                GlineIsBadChan(gline) ? "" : gline->gl_host,
-               gline->gl_expire - TStime(), gline->gl_lastmod,
+               gline->gl_expire - CurrentTime, gline->gl_lastmod,
                gline->gl_reason);
 
   return 0;
@@ -473,7 +490,7 @@ gline_list(struct Client *sptr, char *userhost)
     /* send gline information along */
     sendto_one(sptr, rpl_str(RPL_GLIST), me.name, sptr->name, gline->gl_user,
               GlineIsBadChan(gline) ? "" : "@",
-              GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire,
+              GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire + TSoffset,
               GlineIsLocal(gline) ? me.name : "*",
               GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
   } else {
@@ -484,7 +501,7 @@ gline_list(struct Client *sptr, char *userhost)
        gline_free(gline);
       else
        sendto_one(sptr, rpl_str(RPL_GLIST), me.name, sptr->name,
-                  gline->gl_user, "@", gline->gl_host, gline->gl_expire,
+                  gline->gl_user, "@", gline->gl_host, gline->gl_expire + TSoffset,
                   GlineIsLocal(gline) ? me.name : "*",
                   GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
     }
@@ -496,7 +513,7 @@ gline_list(struct Client *sptr, char *userhost)
        gline_free(gline);
       else
        sendto_one(sptr, rpl_str(RPL_GLIST), me.name, sptr->name,
-                  gline->gl_user, "", "", gline->gl_expire,
+                  gline->gl_user, "", "", gline->gl_expire + TSoffset,
                   GlineIsLocal(gline) ? me.name : "*",
                   GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
     }
@@ -520,7 +537,7 @@ gline_stats(struct Client *sptr)
       gline_free(gline);
     else
       sendto_one(sptr, rpl_str(RPL_STATSGLINE), me.name, sptr->name, 'G',
-                gline->gl_user, gline->gl_host, gline->gl_expire,
+                gline->gl_user, gline->gl_host, gline->gl_expire + TSoffset,
                 gline->gl_reason);
   }
 }
index d3ba6f03c648e7b8c9a8106116b6e0cbf67d4d2e..00d07827e9c379d38b0e54249b51b7e3c8998721 100644 (file)
@@ -78,7 +78,7 @@ struct BufData {
   size_t       buf_size;       /* maximum size of buffer */
   size_t       buf_overflow;   /* how much buffer has been overflowed */
   size_t       buf_loc;        /* where we are in the buffer */
-  size_t       limit;          /* max # of chars to convert */
+  short                limit;          /* max # of chars to convert */
   size_t       overflow;       /* how much we overflowed the limit */
 };
 
@@ -2038,9 +2038,6 @@ ircd_snprintf(struct Client *dest, char *buf, size_t buf_len,
 
   buf_s.buf = buf; /* initialize buffer settings */
   buf_s.buf_size = buf_len - 1;
-  /*
-   * XXX - assignment of -1 to size_t
-   */
   buf_s.limit = -1;
 
   va_start(args, format);
@@ -2063,9 +2060,6 @@ ircd_vsnprintf(struct Client *dest, char *buf, size_t buf_len,
 
   buf_s.buf = buf; /* initialize buffer settings */
   buf_s.buf_size = buf_len - 1;
-  /*
-   * XXX - assignment of -1 to size_t
-   */
   buf_s.limit = -1;
 
   doprintf(dest, &buf_s, format, args); /* fill the buffer */
index d9132ac58ab89c2bd5871465f81137a4ec6084d5..ae2d7c8321535bba4d6c64a86cb0ee45731208ab 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <assert.h>
 
-static struct Jupe* GlobalJupeList  = 0;
+static struct Jupe *GlobalJupeList = 0;
 
 static struct Jupe *
 make_jupe(char *server, char *reason, time_t expire, time_t lastmod,
@@ -91,7 +91,7 @@ propagate_jupe(struct Client *cptr, struct Client *sptr, struct Jupe *jupe)
 
   sendcmdto_serv_butone(cptr, CMD_JUPE, sptr, "* %c%s %Tu %Tu :%s",
                        JupeIsActive(jupe) ? '+' : '-', jupe->ju_server,
-                       jupe->ju_expire - TStime(), jupe->ju_lastmod,
+                       jupe->ju_expire - CurrentTime, jupe->ju_lastmod,
                        jupe->ju_reason);
 }
 
@@ -115,29 +115,25 @@ jupe_add(struct Client *cptr, struct Client *sptr, char *server, char *reason,
     return 0;
   }
 
-  expire += TStime(); /* convert from lifetime to timestamp */
+  expire += CurrentTime; /* convert from lifetime to timestamp */
 
   /* Inform ops and log it */
-  if (IsServer(sptr)) {
     sendto_op_mask(SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
-                  TIME_T_FMT ": %s", sptr->name, local ? "local " : "",
-                  server, expire, reason);
+                  TIME_T_FMT ": %s",
+                  IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                  local ? "local " : "", server, expire + TSoffset, reason);
+
 #ifdef JPATH
+  if (IsServer(sptr))
     write_log(JPATH, TIME_T_FMT " %s adding %sJUPE for %s, expiring at "
              TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             local ? "local " : "", server, expire, reason);
-#endif /* JPATH */
-  } else {
-    sendto_op_mask(SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
-                  TIME_T_FMT ": %s", sptr->user->server->name,
-                  local ? "local " : "", server, expire,
-                  reason);
-#ifdef JPATH
+             local ? "local " : "", server, expire + TSoffset, reason);
+  else
     write_log(JPATH, TIME_T_FMT, " %s!%s@%s adding %sJUPE for %s, expiring at "
              TIME_T_FMT ": %s\n", TStime(), sptr->name, sptr->user->username,
-             sptr->user->host, local ? "local " : "", server, expire, reason);
+             sptr->user->host, local ? "local " : "", server,
+             expire + TSoffset, reason);
 #endif /* JPATH */
-  }
 
   if (active) /* compute initial flags */
     flags |= JUPE_ACTIVE;
@@ -157,35 +153,32 @@ jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
              time_t lastmod)
 {
   assert(0 != jupe);
+  assert(!JupeIsLocal(jupe));
 
   jupe->ju_flags |= JUPE_ACTIVE;
-  jupe->ju_lastmod = lastmod;
+
+  if (jupe->ju_lastmod >= lastmod) /* force lastmod to increase */
+    jupe->ju_lastmod++;
+  else
+    jupe->ju_lastmod = lastmod;
 
   /* Inform ops and log it */
-  if (IsServer(sptr)) {
-    sendto_op_mask(SNO_NETWORK, "%s activating %sJUPE for %s, expiring at "
-                  TIME_T_FMT ": %s", sptr->name, JupeIsLocal(jupe) ?
-                  "local " : "", jupe->ju_server, jupe->ju_expire,
-                  jupe->ju_reason);
-#ifdef JPATH
-    write_log(JPATH, TIME_T_FMT " %s activating %sJUPE for %s, expiring at "
-             TIME_T_FMT ": %s\n", TStime(), sptr->name, JupeIsLocal(jupe) ?
-             "local " : "", jupe->ju_server, jupe->ju_expire,
-             jupe->ju_reason);
-#endif /* JPATH */
-  } else {
-    sendto_op_mask(SNO_NETWORK, "%s activating %sJUPE for %s, expiring at "
-                  TIME_T_FMT ": %s", sptr->user->server->name,
-                  JupeIsLocal(jupe) ? "local " : "", jupe->ju_server,
-                  jupe->ju_expire, jupe->ju_reason);
+  sendto_op_mask(SNO_NETWORK, "%s activating JUPE for %s, expiring at "
+                TIME_T_FMT ": %s",
+                IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
+
 #ifdef JPATH
-    write_log(JPATH, TIME_T_FMT, " %s!%s@%s activating %sJUPE for %s, "
+  if (IsServer(sptr))
+    write_log(JPATH, TIME_T_FMT " %s activating JUPE for %s, expiring at "
+             TIME_T_FMT ": %s\n", TStime(), sptr->name, jupe->ju_server,
+             jupe->ju_expire + TSoffset, jupe->ju_reason);
+  else
+    write_log(JPATH, TIME_T_FMT, " %s!%s@%s activating JUPE for %s, "
              "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             sptr->user->username, sptr->user->host, JupeIsLocal(jupe) ?
-             "local " : "", jupe->ju_server, jupe->ju_expire,
-             jupe->ju_reason);
+             sptr->user->username, sptr->user->host, jupe->ju_server,
+             jupe->ju_expire + TSoffset, jupe->ju_reason);
 #endif /* JPATH */
-  }
 
   propagate_jupe(cptr, sptr, jupe);
 
@@ -198,36 +191,40 @@ jupe_deactivate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
 {
   assert(0 != jupe);
 
-  jupe->ju_flags &= ~JUPE_ACTIVE;
-  jupe->ju_lastmod = lastmod;
+  if (!JupeIsLocal(jupe)) {
+    jupe->ju_flags &= ~JUPE_ACTIVE;
+
+    if (jupe->ju_lastmod >= lastmod) /* force lastmod to increase */
+      jupe->ju_lastmod++;
+    else
+      jupe->ju_lastmod = lastmod;
+  }
 
   /* Inform ops and log it */
-  if (IsServer(sptr)) {
-    sendto_op_mask(SNO_NETWORK, "%s deactivating %sJUPE for %s, expiring at "
-                  TIME_T_FMT ": %s", sptr->name, JupeIsLocal(jupe) ?
-                  "local " : "", jupe->ju_server, jupe->ju_expire,
-                  jupe->ju_reason);
-#ifdef JPATH
-    write_log(JPATH, TIME_T_FMT " %s deactivating %sJUPE for %s, expiring at "
-             TIME_T_FMT ": %s\n", TStime(), sptr->name, JupeIsLocal(jupe) ?
-             "local " : "", jupe->ju_server, jupe->ju_expire,
-             jupe->ju_reason);
-#endif /* JPATH */
-  } else {
-    sendto_op_mask(SNO_NETWORK, "%s deactivating %sJUPE for %s, expiring at "
-                  TIME_T_FMT ": %s", sptr->user->server->name,
-                  JupeIsLocal(jupe) ? "local " : "", jupe->ju_server,
-                  jupe->ju_expire, jupe->ju_reason);
+  sendto_op_mask(SNO_NETWORK, "%s %s JUPE for %s, expiring at " TIME_T_FMT
+                ": %s",
+                IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                JupeIsLocal(jupe) ? "removing local" : "deactivating",
+                jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
+
 #ifdef JPATH
-    write_log(JPATH, TIME_T_FMT, " %s!%s@%s deactivating %sJUPE for %s, "
+  if (IsServer(sptr))
+    write_log(JPATH, TIME_T_FMT " %s %s JUPE for %s, expiring at " TIME_T_FMT
+             ": %s\n", TStime(), sptr->name,
+             JupeIsLocal(jupe) ? "removing local" : "deactivating",
+             jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
+  else
+    write_log(JPATH, TIME_T_FMT, " %s!%s@%s %s JUPE for %s, "
              "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             sptr->user->username, sptr->user->host, JupeIsLocal(jupe) ?
-             "local " : "", jupe->ju_server, jupe->ju_expire,
-             jupe->ju_reason);
+             sptr->user->username, sptr->user->host,
+             JupeIsLocal(jupe) ? "removing local" : "deactivating",
+             jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
 #endif /* JPATH */
-  }
 
-  propagate_jupe(cptr, sptr, jupe);
+  if (JupeIsLocal(jupe))
+    jupe_free(jupe);
+  else
+    propagate_jupe(cptr, sptr, jupe);
 
   return 0;
 }
@@ -241,7 +238,7 @@ jupe_find(char *server)
   for (jupe = GlobalJupeList; jupe; jupe = sjupe) { /* go through jupes */
     sjupe = jupe->ju_next;
 
-    if (jupe->ju_expire <= TStime()) /* expire any that need expiring */
+    if (jupe->ju_expire <= CurrentTime) /* expire any that need expiring */
       jupe_free(jupe);
     else if (0 == ircd_strcmp(server, jupe->ju_server)) /* found it yet? */
       return jupe;
@@ -273,12 +270,12 @@ jupe_burst(struct Client *cptr)
   for (jupe = GlobalJupeList; jupe; jupe = sjupe) { /* go through jupes */
     sjupe = jupe->ju_next;
 
-    if (jupe->ju_expire <= TStime()) /* expire any that need expiring */
+    if (jupe->ju_expire <= CurrentTime) /* expire any that need expiring */
       jupe_free(jupe);
     else if (!JupeIsLocal(jupe)) /* forward global jupes */
       sendcmdto_one(cptr, CMD_JUPE, &me, "* %c%s %Tu %Tu :%s",
                    JupeIsActive(jupe) ? '+' : '-', jupe->ju_server,
-                   jupe->ju_expire - TStime(), jupe->ju_lastmod,
+                   jupe->ju_expire - CurrentTime, jupe->ju_lastmod,
                    jupe->ju_reason);
   }
 }
@@ -291,7 +288,8 @@ jupe_resend(struct Client *cptr, struct Jupe *jupe)
 
   sendcmdto_one(cptr, CMD_JUPE, &me, "* %c%s %Tu %Tu :%s",
                JupeIsActive(jupe) ? '+' : '-', jupe->ju_server,
-               jupe->ju_expire - TStime(), jupe->ju_lastmod, jupe->ju_reason);
+               jupe->ju_expire - CurrentTime, jupe->ju_lastmod,
+               jupe->ju_reason);
 
   return 0;
 }
@@ -308,19 +306,20 @@ jupe_list(struct Client *sptr, char *server)
 
     /* send jupe information along */
     sendto_one(sptr, rpl_str(RPL_JUPELIST), me.name, sptr->name,
-              jupe->ju_server, jupe->ju_expire, JupeIsLocal(jupe) ?
-              me.name : "*", JupeIsActive(jupe) ? '+' : '-', jupe->ju_reason);
+              jupe->ju_server, jupe->ju_expire + TSoffset,
+              JupeIsLocal(jupe) ? me.name : "*",
+              JupeIsActive(jupe) ? '+' : '-', jupe->ju_reason);
   } else {
     for (jupe = GlobalJupeList; jupe; jupe = sjupe) { /* go through jupes */
       sjupe = jupe->ju_next;
 
-      if (jupe->ju_expire <= TStime()) /* expire any that need expiring */
+      if (jupe->ju_expire <= CurrentTime) /* expire any that need expiring */
        jupe_free(jupe);
       else /* send jupe information along */
        sendto_one(sptr, rpl_str(RPL_JUPELIST), me.name, sptr->name,
-                  jupe->ju_server, jupe->ju_expire, JupeIsLocal(jupe) ?
-                  me.name : "*", JupeIsActive(jupe) ? '+' : '-',
-                  jupe->ju_reason);
+                  jupe->ju_server, jupe->ju_expire + TSoffset,
+                  JupeIsLocal(jupe) ? me.name : "*",
+                  JupeIsActive(jupe) ? '+' : '-', jupe->ju_reason);
     }
   }
 
index 5bdd1048c58e010a078fbf4a9a104478489e76a4..013c88c43ac9de91ae459190a258e5c6b0d89de4 100644 (file)
@@ -215,11 +215,15 @@ void vsendcmdto_one(struct Client *to, const char *cmd, const char *tok,
   vd.vd_format = pattern; /* set up the struct VarData for %v */
   vd.vd_args = vl;
 
-  if (MyUser(to)) /* :nick!user@host form; use cmd */
-    ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, ":%s!%s@%s %s %v",
-                 from->name, from->user->username, from->user->host,
-                 cmd, &vd);
-  else /* numeric form; use tok */
+  if (MyUser(to)) { /* :nick!user@host form; use cmd */
+    if (IsServer(from) || IsMe(from))
+      ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, ":%s %s %v",
+                   from->name, cmd, &vd);
+    else
+      ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, ":%s!%s@%s %s %v",
+                   from->name, from->user->username, from->user->host,
+                   cmd, &vd);
+  } else /* numeric form; use tok */
     ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, "%C %s %v", from, tok, &vd);
 
   send_buffer(to, sndbuf);