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/trunk/modules/m_dline.c (file contents):
Revision 1628 by michael, Thu Nov 1 21:08:56 2012 UTC vs.
Revision 1632 by michael, Sun Nov 4 15:37:10 2012 UTC

# Line 28 | Line 28
28   #include "client.h"
29   #include "irc_string.h"
30   #include "sprintf_irc.h"
31 + #include "conf.h"
32   #include "ircd.h"
33   #include "hostmask.h"
34   #include "numeric.h"
35   #include "fdlist.h"
36   #include "s_bsd.h"
36 #include "conf.h"
37   #include "log.h"
38   #include "s_misc.h"
39   #include "send.h"
# Line 51 | Line 51
51   * side effects - tkline as given is placed
52   */
53   static void
54 < apply_dline(struct Client *source_p, struct AccessItem *aconf,
54 > apply_dline(struct Client *source_p, struct MaskItem *conf,
55              time_t tkline_time)
56   {
57    if (tkline_time)
58    {
59 <    aconf->hold = CurrentTime + tkline_time;
59 >    conf->hold = CurrentTime + tkline_time;
60      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
61                           "%s added temporary %d min. D-Line for [%s] [%s]",
62                           get_oper_name(source_p), tkline_time/60,
63 <                         aconf->host, aconf->reason);
63 >                         conf->host, conf->reason);
64      sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]",
65                 MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
66 <               source_p->name, tkline_time/60, aconf->host);
66 >               source_p->name, tkline_time/60, conf->host);
67      ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]",
68 <         get_oper_name(source_p), tkline_time/60, aconf->host, aconf->reason);
68 >         get_oper_name(source_p), tkline_time/60, conf->host, conf->reason);
69    }
70    else
71    {
72      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
73                           "%s added D-Line for [%s] [%s]",
74 <                         get_oper_name(source_p), aconf->host, aconf->reason);
74 >                         get_oper_name(source_p), conf->host, conf->reason);
75      sendto_one(source_p, ":%s NOTICE %s :Added D-Line [%s]",
76                 MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
77 <               source_p->name, aconf->host);
77 >               source_p->name, conf->host);
78      ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]",
79 <         get_oper_name(source_p), aconf->host, aconf->reason);
79 >         get_oper_name(source_p), conf->host, conf->reason);
80  
81    }
82  
83 <  SetConfDatabase(aconf);
84 <  aconf->setat = CurrentTime;
85 <  add_conf_by_address(CONF_DLINE, aconf);
83 >  SetConfDatabase(conf);
84 >  conf->setat = CurrentTime;
85 >  add_conf_by_address(CONF_DLINE, conf);
86    rehashed_klines = 1;
87   }
88  
# Line 95 | Line 95 | static int
95   remove_dline_match(const char *host)
96   {
97    struct irc_ssaddr iphost, *piphost;
98 <  struct AccessItem *aconf;
98 >  struct MaskItem *conf;
99    int t;
100  
101    if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
# Line 114 | Line 114 | remove_dline_match(const char *host)
114      piphost = NULL;
115    }
116  
117 <  if ((aconf = find_conf_by_address(host, piphost, CONF_DLINE, t, NULL, NULL, 0)))
117 >  if ((conf = find_conf_by_address(host, piphost, CONF_DLINE, t, NULL, NULL, 0)))
118    {
119 <    if (IsConfDatabase(aconf))
119 >    if (IsConfDatabase(conf))
120      {
121 <      delete_one_address_conf(host, aconf);
121 >      delete_one_address_conf(host, conf);
122        return 1;
123      }
124    }
# Line 146 | Line 146 | mo_dline(struct Client *client_p, struct
146    const char *creason;
147    const struct Client *target_p = NULL;
148    struct irc_ssaddr daddr;
149 <  struct AccessItem *aconf=NULL;
149 >  struct MaskItem *conf=NULL;
150    time_t tkline_time=0;
151    int bits, t;
152    const char *current_date = NULL;
# Line 238 | Line 238 | mo_dline(struct Client *client_p, struct
238  
239    parse_netmask(dlhost, &daddr, NULL);
240  
241 <  if ((aconf = find_dline_conf(&daddr, t)) != NULL)
241 >  if ((conf = find_dline_conf(&daddr, t)) != NULL)
242    {
243 <    creason = aconf->reason ? aconf->reason : def_reason;
244 <    if (IsConfExemptKline(aconf))
243 >    creason = conf->reason ? conf->reason : def_reason;
244 >    if (IsConfExemptKline(conf))
245        sendto_one(source_p,
246                   ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
247 <                 me.name, source_p->name, dlhost, aconf->host, creason);
247 >                 me.name, source_p->name, dlhost, conf->host, creason);
248      else
249        sendto_one(source_p,
250                   ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
251 <                 me.name, source_p->name, dlhost, aconf->host, creason);
251 >                 me.name, source_p->name, dlhost, conf->host, creason);
252      return;
253    }
254  
# Line 258 | Line 258 | mo_dline(struct Client *client_p, struct
258    if (!valid_comment(source_p, reason, 1))
259      return;
260  
261 <  aconf = map_to_conf(make_conf_item(DLINE_TYPE));
262 <  DupString(aconf->host, dlhost);
261 >  conf = conf_make(CONF_DLINE);
262 >  DupString(conf->host, dlhost);
263  
264    if (tkline_time != 0)
265      snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
# Line 267 | Line 267 | mo_dline(struct Client *client_p, struct
267    else
268      snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
269  
270 <  DupString(aconf->reason, buffer);
271 <  apply_dline(source_p, aconf, tkline_time);
270 >  DupString(conf->reason, buffer);
271 >  apply_dline(source_p, conf, tkline_time);
272    rehashed_klines = 1;
273   }
274  
# Line 281 | Line 281 | ms_dline(struct Client *client_p, struct
281    const char *creason;
282    const struct Client *target_p = NULL;
283    struct irc_ssaddr daddr;
284 <  struct AccessItem *aconf=NULL;
284 >  struct MaskItem *conf=NULL;
285    time_t tkline_time=0;
286    int bits, t;
287    const char *current_date = NULL;
# Line 305 | Line 305 | ms_dline(struct Client *client_p, struct
305    dlhost = parv[3];
306    reason = parv[4];
307  
308 <  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
308 >  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
309                                source_p->username, source_p->host,
310                                SHARED_DLINE))
311    {
# Line 357 | Line 357 | ms_dline(struct Client *client_p, struct
357  
358      parse_netmask(dlhost, &daddr, NULL);
359  
360 <    if ((aconf = find_dline_conf(&daddr, t)) != NULL)
360 >    if ((conf = find_dline_conf(&daddr, t)) != NULL)
361      {
362 <      creason = aconf->reason ? aconf->reason : def_reason;
363 <      if (IsConfExemptKline(aconf))
362 >      creason = conf->reason ? conf->reason : def_reason;
363 >      if (IsConfExemptKline(conf))
364          sendto_one(source_p,
365                     ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
366 <                   me.name, source_p->name, dlhost, aconf->host, creason);
366 >                   me.name, source_p->name, dlhost, conf->host, creason);
367        else
368          sendto_one(source_p,
369                     ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
370 <                   me.name, source_p->name, dlhost, aconf->host, creason);
370 >                   me.name, source_p->name, dlhost, conf->host, creason);
371        return;
372      }
373  
# Line 377 | Line 377 | ms_dline(struct Client *client_p, struct
377      if (!valid_comment(source_p, reason, 1))
378        return;
379  
380 <    aconf = map_to_conf(make_conf_item(DLINE_TYPE));
381 <    DupString(aconf->host, dlhost);
380 >    conf = conf_make(CONF_DLINE);
381 >    DupString(conf->host, dlhost);
382  
383      if (tkline_time != 0)
384        snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
# Line 386 | Line 386 | ms_dline(struct Client *client_p, struct
386      else
387        snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
388  
389 <    DupString(aconf->reason, buffer);
390 <    apply_dline(source_p, aconf, tkline_time);
389 >    DupString(conf->reason, buffer);
390 >    apply_dline(source_p, conf, tkline_time);
391      rehashed_klines = 1;
392    }
393   }
# Line 469 | Line 469 | me_undline(struct Client *client_p, stru
469    if (!IsClient(source_p) || !match(parv[1], me.name))
470      return;
471  
472 <  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE,
472 >  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE,
473                                     source_p->servptr->name,
474                                     source_p->username, source_p->host,
475                                     SHARED_UNDLINE))

Diff Legend

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