]> jfr.im git - solanum.git/blobdiff - ircd/s_user.c
ircd startup: avoid black magic with file descriptors
[solanum.git] / ircd / s_user.c
index 18104c6a649a07fc36912a2bf3c5286118645d79..b18df182ce3b3200c3c1aac8333c4569650ec941 100644 (file)
@@ -218,8 +218,9 @@ authd_check(struct Client *client_p, struct Client *source_p)
                        struct BlacklistStats *stats;
                        char *blacklist = source_p->preClient->auth.data;
 
-                       if((stats = rb_dictionary_retrieve(bl_stats, blacklist)) != NULL)
-                               stats->hits++;
+                       if(bl_stats != NULL)
+                               if((stats = rb_dictionary_retrieve(bl_stats, blacklist)) != NULL)
+                                       stats->hits++;
 
                        if(IsExemptKline(source_p) || IsConfExemptDNSBL(aconf))
                        {
@@ -366,9 +367,9 @@ register_local_user(struct Client *client_p, struct Client *source_p)
        {
                if(!(source_p->flags & FLAGS_PINGSENT) && source_p->localClient->random_ping == 0)
                {
-                       source_p->localClient->random_ping = (unsigned long) (rand() * rand()) << 1;
-                       sendto_one(source_p, "PING :%08lX",
-                                  (unsigned long) source_p->localClient->random_ping);
+                       source_p->localClient->random_ping = (uint32_t)(((rand() * rand()) << 1) | 1);
+                       sendto_one(source_p, "PING :%08X",
+                                  (unsigned int) source_p->localClient->random_ping);
                        source_p->flags |= FLAGS_PINGSENT;
                        return -1;
                }
@@ -620,7 +621,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
         */
        if(!*source_p->id)
        {
-               strcpy(source_p->id, generate_uid());
+               rb_strlcpy(source_p->id, generate_uid(), sizeof(source_p->id));
                add_to_id_hash(source_p->id, source_p);
        }