]> jfr.im git - solanum.git/blobdiff - ircd/authproc.c
librb mbedTLS: der_pubkey is used out of scope
[solanum.git] / ircd / authproc.c
index e1545bfc8e6e254c931870e17d169dc0b7eac89a..0b4f50d4e59258e26889d79a222ad7df8bd4661a 100644 (file)
@@ -4,7 +4,7 @@
  *
  *  Copyright (C) 2005 Aaron Sethman <androsyn@ratbox.org>
  *  Copyright (C) 2005-2012 ircd-ratbox development team
- *  Copyright (C) 2016 William Pitcock <nenolod@dereferenced.org>
+ *  Copyright (C) 2016 Ariadne Conill <ariadne@dereferenced.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -67,7 +67,7 @@ uint32_t cid;
 static rb_dictionary *cid_clients;
 static struct ev_entry *timeout_ev;
 
-rb_dictionary *bl_stats;
+rb_dictionary *dnsbl_stats;
 
 rb_dlink_list opm_list;
 struct OPMListener opm_listeners[LISTEN_LAST];
@@ -105,7 +105,7 @@ start_authd(void)
                        {
                                ierror("Unable to execute authd in %s or %s/bin",
                                        ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath);
-                               sendto_realops_snomask(SNO_GENERAL, L_ALL,
+                               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                                       "Unable to execute authd in %s or %s/bin",
                                                       ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath);
                                return 1;
@@ -127,12 +127,12 @@ start_authd(void)
        if(authd_helper == NULL)
        {
                ierror("Unable to start authd helper: %s", strerror(errno));
-               sendto_realops_snomask(SNO_GENERAL, L_ALL, "Unable to start authd helper: %s", strerror(errno));
+               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Unable to start authd helper: %s", strerror(errno));
                return 1;
        }
 
        ilog(L_MAIN, "authd helper started");
-       sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd helper started");
+       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "authd helper started");
        rb_helper_run(authd_helper);
        return 0;
 }
@@ -202,7 +202,10 @@ cmd_notice_client(int parc, char **parv)
 {
        struct Client *client_p;
 
-       if((client_p = str_cid_to_client(parv[1], false)) == NULL)
+       if ((client_p = str_cid_to_client(parv[1], false)) == NULL)
+               return;
+
+       if (IsAnyDead(client_p))
                return;
 
        sendto_one_notice(client_p, ":%s", parv[2]);
@@ -581,17 +584,17 @@ timeout_dead_authd_clients(void *notused __unused)
        }
 }
 
-/* Send a new blacklist to authd */
+/* Send a new DNSBL entry to authd */
 void
-add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_list *filters)
+add_dnsbl_entry(const char *host, const char *reason, uint8_t iptype, rb_dlink_list *filters)
 {
        rb_dlink_node *ptr;
-       struct BlacklistStats *stats = rb_malloc(sizeof(struct BlacklistStats));
+       struct DNSBLEntryStats *stats = rb_malloc(sizeof(*stats));
        char filterbuf[BUFSIZE] = "*";
        size_t s = 0;
 
-       if(bl_stats == NULL)
-               bl_stats = rb_dictionary_create("blacklist statistics", rb_strcasecmp);
+       if(dnsbl_stats == NULL)
+               dnsbl_stats = rb_dictionary_create("dnsbl statistics", rb_strcasecmp);
 
        /* Build a list of comma-separated values for authd.
         * We don't check for validity - do it elsewhere.
@@ -615,19 +618,19 @@ add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_lis
        stats->host = rb_strdup(host);
        stats->iptype = iptype;
        stats->hits = 0;
-       rb_dictionary_add(bl_stats, stats->host, stats);
+       rb_dictionary_add(dnsbl_stats, stats->host, stats);
 
        rb_helper_write(authd_helper, "O rbl %s %hhu %s :%s", host, iptype, filterbuf, reason);
 }
 
-/* Delete a blacklist */
+/* Delete a DNSBL entry. */
 void
-del_blacklist(const char *host)
+del_dnsbl_entry(const char *host)
 {
-       struct BlacklistStats *stats = rb_dictionary_retrieve(bl_stats, host);
+       struct DNSBLEntryStats *stats = rb_dictionary_retrieve(dnsbl_stats, host);
        if(stats != NULL)
        {
-               rb_dictionary_delete(bl_stats, host);
+               rb_dictionary_delete(dnsbl_stats, host);
                rb_free(stats->host);
                rb_free(stats);
        }
@@ -636,21 +639,21 @@ del_blacklist(const char *host)
 }
 
 static void
-blacklist_delete(rb_dictionary_element *delem, void *unused)
+dnsbl_delete_elem(rb_dictionary_element *delem, void *unused)
 {
-       struct BlacklistStats *stats = delem->data;
+       struct DNSBLEntryStats *stats = delem->data;
 
        rb_free(stats->host);
        rb_free(stats);
 }
 
-/* Delete all the blacklists */
+/* Delete all the DNSBL entries. */
 void
-del_blacklist_all(void)
+del_dnsbl_entry_all(void)
 {
-       if(bl_stats != NULL)
-               rb_dictionary_destroy(bl_stats, blacklist_delete, NULL);
-       bl_stats = NULL;
+       if(dnsbl_stats != NULL)
+               rb_dictionary_destroy(dnsbl_stats, dnsbl_delete_elem, NULL);
+       dnsbl_stats = NULL;
 
        rb_helper_write(authd_helper, "O rbl_del_all");
 }