]> jfr.im git - solanum.git/blobdiff - ircd/authproc.c
ssld: avoid clang static analysis warning
[solanum.git] / ircd / authproc.c
index ff179160407905e34a50cfcb809915e374755f81..797d08064dacc23139281ef110fca8b40a0a1940 100644 (file)
@@ -153,14 +153,14 @@ str_to_cid(const char *str)
 }
 
 static inline struct Client *
-cid_to_client(uint32_t cid, bool delete)
+cid_to_client(uint32_t ncid, bool del)
 {
        struct Client *client_p;
 
-       if(delete)
-               client_p = rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(cid));
+       if(del)
+               client_p = rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(ncid));
        else
-               client_p = rb_dictionary_retrieve(cid_clients, RB_UINT_TO_POINTER(cid));
+               client_p = rb_dictionary_retrieve(cid_clients, RB_UINT_TO_POINTER(ncid));
 
        /* If the client's not found, that's okay, it may have already gone away.
         * --Elizafox */
@@ -169,14 +169,14 @@ cid_to_client(uint32_t cid, bool delete)
 }
 
 static inline struct Client *
-str_cid_to_client(const char *str, bool delete)
+str_cid_to_client(const char *str, bool del)
 {
-       uint32_t cid = str_to_cid(str);
+       uint32_t ncid = str_to_cid(str);
 
-       if(cid == 0)
+       if(ncid == 0)
                return NULL;
 
-       return cid_to_client(cid, delete);
+       return cid_to_client(ncid, del);
 }
 
 static void
@@ -275,13 +275,13 @@ parse_authd_reply(rb_helper * helper)
        ssize_t len;
        int parc;
        char buf[READBUF_SIZE];
-       char *parv[MAXPARA + 1];
+       char *parv[MAXPARA];
 
        while((len = rb_helper_read(helper, buf, sizeof(buf))) > 0)
        {
                struct authd_cb *cmd;
 
-               parc = rb_string_to_array(buf, parv, MAXPARA+1);
+               parc = rb_string_to_array(buf, parv, sizeof(parv));
                cmd = &authd_cmd_tab[(unsigned char)*parv[0]];
                if(cmd->fn != NULL)
                {
@@ -387,9 +387,6 @@ authd_abort_client(struct Client *client_p)
 static void
 restart_authd_cb(rb_helper * helper)
 {
-       rb_dictionary_iter iter;
-       struct Client *client_p;
-
        iwarn("authd: restart_authd_cb called, authd died?");
        sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd: restart_authd_cb called, authd died?");
 
@@ -615,7 +612,7 @@ 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, host, stats);
+       rb_dictionary_add(bl_stats, stats->host, stats);
 
        rb_helper_write(authd_helper, "O rbl %s %hhu %s :%s", host, iptype, filterbuf, reason);
 }
@@ -627,9 +624,9 @@ del_blacklist(const char *host)
        struct BlacklistStats *stats = rb_dictionary_retrieve(bl_stats, host);
        if(stats != NULL)
        {
+               rb_dictionary_delete(bl_stats, host);
                rb_free(stats->host);
                rb_free(stats);
-               rb_dictionary_delete(bl_stats, host);
        }
 
        rb_helper_write(authd_helper, "O rbl_del %s", host);
@@ -648,7 +645,8 @@ blacklist_delete(rb_dictionary_element *delem, void *unused)
 void
 del_blacklist_all(void)
 {
-       rb_dictionary_destroy(bl_stats, blacklist_delete, NULL);
+       if(bl_stats != NULL)
+               rb_dictionary_destroy(bl_stats, blacklist_delete, NULL);
        bl_stats = NULL;
 
        rb_helper_write(authd_helper, "O rbl_del_all");