Fix bugs in rehashing pseudo commands and in kill handling.
authorMichael Poole <mdpoole@troilus.org>
Sun, 21 Aug 2005 13:46:08 +0000 (13:46 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sun, 21 Aug 2005 13:46:08 +0000 (13:46 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1462 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/s_conf.h
ircd/ircd_parser.y
ircd/m_kill.c
ircd/s_conf.c

index a24d16813ab2e0d0c5b566e991a3d6050990ea3c..fd931fd70805d80dd08674cc1ef1feaf03fe5be9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-08-21  Michael Poole <mdpoole@troilus.org>
+
+       * include/s_conf.h (free_mapping): Declare new function.
+
+       * ircd/ircd_parser.y (pseudoblock): Use it.
+
+       * ircd/s_conf.c (free_mapping): Define it.
+       (close_mappings): New function.
+       (rehash): Call close_mappings() before reading file.
+
+       * ircd/m_kill.c (do_kill): Revert 2005-08-18 change.
+
 2005-08-19  Michael Poole <mdpoole@troilus.org>
 
        * ircd/parse.c (tok_tree): Re-add token tree structure.
index 0907f9b5343b9fc1a536c32d854c8d77f2ee6697..301e9ab2f3b30e4f9f49efa4303505421c2afe9b 100644 (file)
@@ -186,6 +186,7 @@ extern const char *find_quarantine(const char* chname);
 extern void lookup_confhost(struct ConfItem *aconf);
 extern void conf_parse_userhost(struct ConfItem *aconf, char *host);
 extern struct ConfItem *conf_debug_iline(const char *client);
+extern void free_mapping(struct s_map *smap);
 
 extern void yyerror(const char *msg);
 
index 2ce1b6c79cf129c07cfdc7551b6965bdbaafbba6..934f9231b917152a72790d4dd3ec409bf8db5d6e 100644 (file)
@@ -959,16 +959,7 @@ pseudoitems '}' ';'
   }
   else
   {
-    struct nick_host *nh, *next;
-    for (nh = smap->services; nh; nh = next)
-    {
-      next = nh->next;
-      MyFree(nh);
-    }
-    MyFree(smap->name);
-    MyFree(smap->command);
-    MyFree(smap->prepend);
-    MyFree(smap);
+    free_mapping(smap);
   }
   smap = NULL;
 };
index d90ffe7f1dad65a5d7bed101d2530c9ea5113633..9c4f0e02673e5d09d02909cf4807386f1428c9a4 100644 (file)
@@ -155,7 +155,7 @@ static int do_kill(struct Client* cptr, struct Client* sptr,
                  victim, "%C :%s %s", victim, feature_bool(FEAT_HIS_KILLWHO)
                  ? feature_str(FEAT_HIS_SERVERNAME) : cli_name(sptr), msg);
   return exit_client_msg(cptr, victim, feature_bool(FEAT_HIS_KILLWHO)
-                        ? &his : sptr, "Killed (%s %s)",
+                        ? &me : sptr, "Killed (%s %s)",
                         feature_bool(FEAT_HIS_KILLWHO) ?
                         feature_str(FEAT_HIS_SERVERNAME) : cli_name(sptr),
                         msg);
index 21e101831ad8c5fdc315cf938e6ef2bae91cfd0e..14328f6518e222ddfb42fda146b88c41001fe0d5 100644 (file)
@@ -876,6 +876,35 @@ attach_conf_uworld(struct Client *cptr)
     attach_conf_uworld(lp->value.cptr);
 }
 
+/** Free all memory associated with service mapping \a smap.
+ * @param smap[in] The mapping to free.
+ */
+void free_mapping(struct s_map *smap)
+{
+  struct nick_host *nh, *next;
+  for (nh = smap->services; nh; nh = next)
+  {
+    next = nh->next;
+    MyFree(nh);
+  }
+  MyFree(smap->name);
+  MyFree(smap->command);
+  MyFree(smap->prepend);
+  MyFree(smap);
+}
+
+/** Unregister and free all current service mappings. */
+static void close_mappings(void)
+{
+  struct s_map *map, *next;
+
+  for (map = GlobalServiceMapList; map; map = next) {
+    next = map->next;
+    unregister_mapping(map);
+    free_mapping(map);
+  }
+}
+
 /** Reload the configuration file.
  * @param cptr Client that requested rehash (if a signal, &me).
  * @param sig Type of rehash (0 = oper-requested, 1 = signal, 2 =
@@ -934,6 +963,7 @@ int rehash(struct Client *cptr, int sig)
   class_mark_delete();
   mark_listeners_closing();
   iauth_mark_closing();
+  close_mappings();
 
   read_configuration_file();