]> jfr.im git - solanum.git/blobdiff - ircd/channel.c
recheck users after applying SASL account cloaks
[solanum.git] / ircd / channel.c
index 35a9afb64aea4e902d72f2ec0e8783567345e285..cb4bdd5ceda4758fb868c9d1542beeadc0783314 100644 (file)
@@ -26,7 +26,6 @@
 #include "channel.h"
 #include "chmode.h"
 #include "client.h"
-#include "common.h"
 #include "hash.h"
 #include "hook.h"
 #include "match.h"
@@ -39,7 +38,6 @@
 #include "s_conf.h"            /* ConfigFileEntry, ConfigChannel */
 #include "s_newconf.h"
 #include "logger.h"
-#include "ipv4_from_ipv6.h"
 #include "s_assert.h"
 
 struct config_channel_entry ConfigChannel;
@@ -128,10 +126,10 @@ send_channel_join(struct Channel *chptr, struct Client *client_p)
        if (!IsClient(client_p))
                return;
 
-       sendto_channel_local_with_capability(ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN, chptr, ":%s!%s@%s JOIN %s",
+       sendto_channel_local_with_capability(client_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN, chptr, ":%s!%s@%s JOIN %s",
                                             client_p->name, client_p->username, client_p->host, chptr->chname);
 
-       sendto_channel_local_with_capability(ALL_MEMBERS, CLICAP_EXTENDED_JOIN, NOCAPS, chptr, ":%s!%s@%s JOIN %s %s :%s",
+       sendto_channel_local_with_capability(client_p, ALL_MEMBERS, CLICAP_EXTENDED_JOIN, NOCAPS, chptr, ":%s!%s@%s JOIN %s %s :%s",
                                             client_p->name, client_p->username, client_p->host, chptr->chname,
                                             EmptyString(client_p->user->suser) ? "*" : client_p->user->suser,
                                             client_p->info);
@@ -337,23 +335,23 @@ invalidate_bancache_user(struct Client *client_p)
 /* check_channel_name()
  *
  * input       - channel name
- * output      - 1 if valid channel name, else 0
+ * output      - true if valid channel name, else false
  * side effects -
  */
-int
+bool
 check_channel_name(const char *name)
 {
        s_assert(name != NULL);
        if(name == NULL)
-               return 0;
+               return false;
 
        for (; *name; ++name)
        {
                if(!IsChanChar(*name))
-                       return 0;
+                       return false;
        }
 
-       return 1;
+       return true;
 }
 
 /* free_channel_list()
@@ -541,10 +539,10 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
               struct Client *who, struct membership *msptr,
               const char *s, const char *s2, const char **forward)
 {
-       char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
-       char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
-       char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
-       char src_ip4host[NICKLEN + USERLEN + HOSTLEN + 6];
+       char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
+       char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
+       char src_althost[NAMELEN + USERLEN + HOSTLEN + 6];
+       char src_ip4host[NAMELEN + USERLEN + HOSTLEN + 6];
        char *s3 = NULL;
        char *s4 = NULL;
        struct sockaddr_in ip4;
@@ -580,9 +578,8 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
                        s3 = src_althost;
                }
        }
-#ifdef RB_IPV6
-       if(who->localClient->ip.ss_family == AF_INET6 &&
-                       ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
+       if(GET_SS_FAMILY(&who->localClient->ip) == AF_INET6 &&
+                       rb_ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4))
        {
                sprintf(src_ip4host, "%s!%s@", who->name, who->username);
                s4 = src_ip4host + strlen(src_ip4host);
@@ -590,7 +587,6 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
                                s4, src_ip4host + sizeof src_ip4host - s4);
                s4 = src_ip4host;
        }
-#endif
 
        RB_DLINK_FOREACH(ptr, list->head)
        {
@@ -599,11 +595,8 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list,
                   match(actualBan->banstr, s2) ||
                   match_cidr(actualBan->banstr, s2) ||
                   match_extban(actualBan->banstr, who, chptr, CHFL_BAN) ||
-                  (s3 != NULL && match(actualBan->banstr, s3))
-#ifdef RB_IPV6
-                  ||
+                  (s3 != NULL && match(actualBan->banstr, s3)) ||
                   (s4 != NULL && (match(actualBan->banstr, s4) || match_cidr(actualBan->banstr, s4)))
-#endif
                   )
                        break;
                else
@@ -669,6 +662,7 @@ int
 is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr,
          const char *s, const char *s2, const char **forward)
 {
+#if 0
        if (chptr->last_checked_client != NULL &&
                who == chptr->last_checked_client &&
                chptr->last_checked_type == CHFL_BAN &&
@@ -681,6 +675,9 @@ is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr,
        chptr->last_checked_ts = rb_current_time();
 
        return chptr->last_checked_result;
+#else
+       return is_banned_list(chptr, &chptr->banlist, who, msptr, s, s2, forward);
+#endif
 }
 
 /* is_quieted()
@@ -694,6 +691,7 @@ int
 is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr,
           const char *s, const char *s2)
 {
+#if 0
        if (chptr->last_checked_client != NULL &&
                who == chptr->last_checked_client &&
                chptr->last_checked_type == CHFL_QUIET &&
@@ -706,6 +704,9 @@ is_quieted(struct Channel *chptr, struct Client *who, struct membership *msptr,
        chptr->last_checked_ts = rb_current_time();
 
        return chptr->last_checked_result;
+#else
+       return is_banned_list(chptr, &chptr->quietlist, who, msptr, s, s2, NULL);
+#endif
 }
 
 /* can_join()
@@ -721,9 +722,9 @@ can_join(struct Client *source_p, struct Channel *chptr, const char *key, const
        rb_dlink_node *invite = NULL;
        rb_dlink_node *ptr;
        struct Ban *invex = NULL;
-       char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
-       char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
-       char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
+       char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
+       char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
+       char src_althost[NAMELEN + USERLEN + HOSTLEN + 6];
        int use_althost = 0;
        int i = 0;
        hook_data_channel moduledata;
@@ -902,11 +903,11 @@ can_send(struct Channel *chptr, struct Client *source_p, struct membership *mspt
  * inputs       - flag 0 if PRIVMSG 1 if NOTICE. RFC
  *                says NOTICE must not auto reply
  *              - pointer to source Client
- *             - pointer to target channel
- * output      - 1 if target is under flood attack
+ *              - pointer to target channel
+ * output       - true if target is under flood attack
  * side effects        - check for flood attack on target chptr
  */
-int
+bool
 flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, char *chname)
 {
        int delta;
@@ -944,13 +945,13 @@ flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr,
                                sendto_one(source_p,
                                           ":%s NOTICE %s :*** Message to %s throttled due to flooding",
                                           me.name, source_p->name, chptr->chname);
-                       return 1;
+                       return true;
                }
                else
                        chptr->received_number_of_privmsgs++;
        }
 
-       return 0;
+       return false;
 }
 
 /* find_bannickchange_channel()
@@ -963,8 +964,8 @@ find_bannickchange_channel(struct Client *client_p)
        struct Channel *chptr;
        struct membership *msptr;
        rb_dlink_node *ptr;
-       char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
-       char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
+       char src_host[NAMELEN + USERLEN + HOSTLEN + 6];
+       char src_iphost[NAMELEN + USERLEN + HOSTLEN + 6];
 
        if (!MyClient(client_p))
                return NULL;
@@ -1261,7 +1262,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
        char *pbuf;
        const char *arg;
        int dir;
-       int arglen;
+       int arglen = 0;
 
        /* Now send to servers... */
        mc = 0;
@@ -1377,7 +1378,7 @@ resv_chan_forcepart(const char *name, const char *reason, int temp_time)
                        sendto_server(target_p, chptr, CAP_TS6, NOCAPS,
                                      ":%s PART %s", target_p->id, chptr->chname);
 
-                       sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s",
+                       sendto_channel_local(target_p, ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s",
                                             target_p->name, target_p->username,
                                             target_p->host, chptr->chname, target_p->name);