]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_dline.c
Do not use get_oper_name() for a netwide server notice, it may be confusing.
[irc/rqf/shadowircd.git] / modules / m_dline.c
index 76442180708625942652d6139ff98d28cab52b7f..e54bacfff78d3207832316ea5acfe6730243e105 100644 (file)
@@ -100,6 +100,13 @@ mo_dline(struct Client *client_p, struct Client *source_p,
 
        if(parc >= loc+2 && !irccmp(parv[loc], "ON"))
        {
+               if(!IsOperRemoteBan(source_p))
+               {
+                       sendto_one(source_p, form_str(ERR_NOPRIVS),
+                               me.name, source_p->name, "remoteban");
+                       return 0;
+               }
+
                target_server = parv[loc+1];
                loc += 2;
        }
@@ -145,6 +152,13 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha
 
        if(parc >= 4 && !irccmp(parv[2], "ON"))
        {
+               if(!IsOperRemoteBan(source_p))
+               {
+                       sendto_one(source_p, form_str(ERR_NOPRIVS),
+                               me.name, source_p->name, "remoteban");
+                       return 0;
+               }
+
                target_server = parv[3];
                sendto_match_servs(source_p, target_server,
                                CAP_ENCAP, NOCAPS,
@@ -173,11 +187,7 @@ me_dline(struct Client *client_p, struct Client *source_p, int parc, const char
 
        if(!find_shared_conf(source_p->username, source_p->host,
                                source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE))
-       {
-               sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s",
-                               source_p->name, parv[1], parv[2]);
                return 0;
-       }
 
        apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3]));
 
@@ -253,16 +263,6 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
                return 0;
        }
 
-       /* Look for an oper reason */
-       if((oper_reason = strchr(reason, '|')) != NULL)
-       {
-               *oper_reason = '\0';
-               oper_reason++;
-
-               if(!EmptyString(oper_reason))
-                       aconf->spasswd = rb_strdup(oper_reason);
-       }
-
        if(ConfigFileEntry.non_redundant_klines)
        {
                if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL)
@@ -292,6 +292,16 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
        aconf->status = CONF_DLINE;
        aconf->host = rb_strdup(dlhost);
 
+       /* Look for an oper reason */
+       if((oper_reason = strchr(reason, '|')) != NULL)
+       {
+               *oper_reason = '\0';
+               oper_reason++;
+
+               if(!EmptyString(oper_reason))
+                       aconf->spasswd = rb_strdup(oper_reason);
+       }
+
        if(tdline_time > 0)
        {
                rb_snprintf(dlbuffer, sizeof(dlbuffer), 
@@ -303,7 +313,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
 
                if(EmptyString(oper_reason))
                {
-                       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+                       sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                             "%s added temporary %d min. D-Line for [%s] [%s]",
                                             get_oper_name(source_p), tdline_time / 60,
                                             aconf->host, reason);
@@ -313,7 +323,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
                }
                else
                {
-                       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+                       sendto_realops_snomask(SNO_GENERAL, L_ALL,
                                             "%s added temporary %d min. D-Line for [%s] [%s|%s]",
                                             get_oper_name(source_p), tdline_time / 60,
                                             aconf->host, reason, oper_reason);
@@ -329,7 +339,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
        {
                rb_snprintf(dlbuffer, sizeof(dlbuffer), "%s (%s)", reason, current_date);
                aconf->passwd = rb_strdup(dlbuffer);
-               add_conf_by_address(aconf->host, CONF_DLINE, NULL, aconf);
+               add_conf_by_address(aconf->host, CONF_DLINE, NULL, NULL, aconf);
                write_confitem(DLINE_TYPE, source_p, NULL, aconf->host, reason,
                               oper_reason, current_date, 0);
        }
@@ -457,7 +467,7 @@ apply_undline(struct Client *source_p, const char *cidr)
        }
 
        sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, aconf->host);
-       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+       sendto_realops_snomask(SNO_GENERAL, L_ALL,
                             "%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host);
        ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host);
        delete_one_address_conf(aconf->host, aconf);