]> jfr.im git - solanum.git/blobdiff - modules/m_whois.c
ircd: Zero out the global_client_list
[solanum.git] / modules / m_whois.c
index 39b048148c84429ea860a19959e65afd0d0fab86..0fc0f4f7f3f9862914ba4fe5fc3ce4906ed2298d 100644 (file)
@@ -23,7 +23,6 @@
  */
 
 #include "stdinc.h"
-#include "common.h"
 #include "client.h"
 #include "hash.h"
 #include "channel.h"
@@ -41,7 +40,6 @@
 #include "modules.h"
 #include "hook.h"
 #include "s_newconf.h"
-#include "ipv4_from_ipv6.h"
 #include "ratelimit.h"
 #include "s_assert.h"
 
@@ -235,9 +233,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
        int tlen;
        hook_data_client hdata;
        int extra_space = 0;
-#ifdef RB_IPV6
        struct sockaddr_in ip4;
-#endif
 
        if(target_p->user == NULL)
        {
@@ -313,7 +309,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
                sendto_one_numeric(source_p, RPL_AWAY, form_str(RPL_AWAY),
                                   target_p->name, target_p->user->away);
 
-       if(IsOper(target_p) && (!ConfigFileEntry.hide_opers_in_whois || IsOper(source_p)))
+       if((!ConfigFileEntry.hide_opers_in_whois || IsOper(source_p)) && SeesOper(target_p, source_p))
        {
                sendto_one_numeric(source_p, RPL_WHOISOPERATOR, form_str(RPL_WHOISOPERATOR),
                                   target_p->name,
@@ -322,11 +318,14 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
                                    GlobalSetOptions.operstring));
        }
 
-       if(MyClient(target_p) && !EmptyString(target_p->localClient->opername) && IsOper(source_p))
+       if(!EmptyString(target_p->user->opername) && IsOper(target_p) && IsOper(source_p))
        {
                char buf[512];
+               const char *privset = "(missing)";
+               if (target_p->user->privset != NULL)
+                       privset = target_p->user->privset->name;
                snprintf(buf, sizeof(buf), "is opered as %s, privset %s",
-                           target_p->localClient->opername, target_p->localClient->privset->name);
+                           target_p->user->opername, privset);
                sendto_one_numeric(source_p, RPL_WHOISSPECIAL, form_str(RPL_WHOISSPECIAL),
                                   target_p->name, buf);
        }
@@ -366,11 +365,10 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
                                           form_str(RPL_WHOISACTUALLY),
                                           target_p->name, target_p->sockhost);
 
-#ifdef RB_IPV6
-               if (target_p->localClient->ip.ss_family == AF_INET6 &&
+               if (GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6 &&
                                (show_ip(source_p, target_p) ||
                                 (source_p == target_p && !IsIPSpoof(target_p))) &&
-                               ipv4_from_ipv6((struct sockaddr_in6 *)&target_p->localClient->ip, &ip4))
+                               rb_ipv4_from_ipv6((struct sockaddr_in6 *)&target_p->localClient->ip, &ip4))
                {
                        rb_inet_ntop_sock((struct sockaddr *)&ip4,
                                        buf, sizeof buf);
@@ -378,7 +376,6 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
                                        "%s :Underlying IPv4 is %s",
                                        target_p->name, buf);
                }
-#endif /* RB_IPV6 */
 
                sendto_one_numeric(source_p, RPL_WHOISIDLE, form_str(RPL_WHOISIDLE),
                                   target_p->name,