ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_dline.c
(Generate patch)

Comparing:
ircd-hybrid-8/modules/m_dline.c (file contents), Revision 1301 by michael, Sat Mar 10 21:47:17 2012 UTC vs.
ircd-hybrid/trunk/modules/m_dline.c (file contents), Revision 1618 by michael, Tue Oct 30 21:04:38 2012 UTC

# Line 33 | Line 33
33   #include "numeric.h"
34   #include "fdlist.h"
35   #include "s_bsd.h"
36 < #include "s_conf.h"
37 < #include "s_log.h"
36 > #include "conf.h"
37 > #include "log.h"
38   #include "s_misc.h"
39   #include "send.h"
40   #include "hash.h"
# Line 58 | Line 58 | apply_tdline(struct Client *source_p, st
58  
59    aconf = map_to_conf(conf);
60    aconf->hold = CurrentTime + tkline_time;
61 +  SetConfTemporary(aconf);
62 +  add_conf_by_address(CONF_DLINE, aconf);
63  
64 <  add_temp_line(conf);
65 <  sendto_realops_flags(UMODE_ALL, L_ALL,
64 >
65 >  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
66                         "%s added temporary %d min. D-Line for [%s] [%s]",
67                         get_oper_name(source_p), tkline_time/60,
68                         aconf->host, aconf->reason);
# Line 82 | Line 84 | apply_tdline(struct Client *source_p, st
84   static int
85   remove_tdline_match(const char *host)
86   {
87 <  struct AccessItem *td_conf;
88 <  dlink_node *td_node;
89 <  struct irc_ssaddr addr, caddr;
88 <  int nm_t, cnm_t, bits, cbits;
89 <
90 <  nm_t = parse_netmask(host, &addr, &bits);
87 >  struct irc_ssaddr iphost, *piphost;
88 >  struct AccessItem *aconf;
89 >  int t;
90  
91 <  DLINK_FOREACH(td_node, temporary_dlines.head)
91 >  if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
92    {
94    td_conf = map_to_conf(td_node->data);
95    cnm_t   = parse_netmask(td_conf->host, &caddr, &cbits);
96
97    if (cnm_t != nm_t)
98      continue;
99
100    if ((nm_t == HM_HOST && !irccmp(td_conf->host, host)) ||
101        (nm_t == HM_IPV4 && bits == cbits && match_ipv4(&addr, &caddr, bits))
93   #ifdef IPV6
94 <     || (nm_t == HM_IPV6 && bits == cbits && match_ipv6(&addr, &caddr, bits))
94 >    if (t == HM_IPV6)
95 >      t = AF_INET6;
96 >    else
97   #endif
98 <      )
98 >      t = AF_INET;
99 >    piphost = &iphost;
100 >  }
101 >  else
102 >  {
103 >    t = 0;
104 >    piphost = NULL;
105 >  }
106 >
107 >  if ((aconf = find_conf_by_address(host, piphost, CONF_DLINE, t, NULL, NULL, 0)))
108 >  {
109 >    if (IsConfTemporary(aconf))
110      {
111 <      dlinkDelete(td_node, &temporary_dlines);
108 <      delete_one_address_conf(td_conf->host, td_conf);
111 >      delete_one_address_conf(host, aconf);
112        return 1;
113      }
114    }
# Line 139 | Line 142 | mo_dline(struct Client *client_p, struct
142    int bits, t;
143    const char *current_date = NULL;
144    time_t cur_time;
145 <  char hostip[HOSTIPLEN];
145 >  char hostip[HOSTIPLEN + 1];
146    char buffer[IRCD_BUFSIZE];
147  
148    if (!HasOFlag(source_p, OPER_FLAG_DLINE))
149    {
150      sendto_one(source_p, form_str(ERR_NOPRIVS),
151 <               me.name, source_p->name, "kline");
151 >               me.name, source_p->name, "dline");
152      return;
153    }
154  
# Line 157 | Line 160 | mo_dline(struct Client *client_p, struct
160    {
161      if (HasID(source_p))
162      {
163 <      sendto_server(NULL, NULL, CAP_DLN|CAP_TS6, NOCAPS,
163 >      sendto_server(NULL, CAP_DLN|CAP_TS6, NOCAPS,
164                      ":%s DLINE %s %lu %s :%s",
165                      source_p->id, target_server, (unsigned long)tkline_time,
166                      dlhost, reason);
167 <      sendto_server(NULL, NULL, CAP_DLN, CAP_TS6,
167 >      sendto_server(NULL, CAP_DLN, CAP_TS6,
168                      ":%s DLINE %s %lu %s :%s",
169                      source_p->name, target_server, (unsigned long)tkline_time,
170                      dlhost, reason);
171      }
172      else
173 <      sendto_server(NULL, NULL, CAP_DLN, NOCAPS,
173 >      sendto_server(NULL, CAP_DLN, NOCAPS,
174                      ":%s DLINE %s %lu %s :%s",
175                      source_p->name, target_server, (unsigned long)tkline_time,
176                      dlhost, reason);
# Line 291 | Line 294 | ms_dline(struct Client *client_p, struct
294    int bits, t;
295    const char *current_date = NULL;
296    time_t cur_time;
297 <  char hostip[HOSTIPLEN];
297 >  char hostip[HOSTIPLEN + 1];
298    char buffer[IRCD_BUFSIZE];
299  
300    if (parc != 5 || EmptyString(parv[4]))
# Line 465 | Line 468 | mo_undline(struct Client *client_p, stru
468      sendto_one(source_p,
469                 ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
470                 me.name, source_p->name, addr);
471 <    sendto_realops_flags(UMODE_ALL, L_ALL,
471 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
472                           "%s has removed the temporary D-Line for: [%s]",
473                           get_oper_name(source_p), addr);
474      ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
# Line 477 | Line 480 | mo_undline(struct Client *client_p, stru
480    {
481      sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
482                 me.name, source_p->name, addr);
483 <    sendto_realops_flags(UMODE_ALL, L_ALL,
483 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
484                           "%s has removed the D-Line for: [%s]",
485                           get_oper_name(source_p), addr);
486      ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
# Line 512 | Line 515 | me_undline(struct Client *client_p, stru
515        sendto_one(source_p,
516                   ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
517                   me.name, source_p->name, addr);
518 <      sendto_realops_flags(UMODE_ALL, L_ALL,
518 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
519                             "%s has removed the temporary D-Line for: [%s]",
520                             get_oper_name(source_p), addr);
521        ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
# Line 524 | Line 527 | me_undline(struct Client *client_p, stru
527      {
528        sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
529                   me.name, source_p->name, addr);
530 <      sendto_realops_flags(UMODE_ALL, L_ALL,
530 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
531                             "%s has removed the D-Line for: [%s]",
532                             get_oper_name(source_p), addr);
533        ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)