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 2888 by michael, Tue Jan 21 17:47:11 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  m_dline.c: Bans a user.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2002 by the past and present ircd coders, and others.
4 > *  Copyright (c) 1997-2014 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 18 | Line 17
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   *  USA
20 < *
21 < *  $Id$
20 > */
21 >
22 > /*! \file m_dline.c
23 > * \brief Includes required functions for processing the DLINE/UNDLINE command.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
# Line 27 | Line 29
29   #include "channel.h"
30   #include "client.h"
31   #include "irc_string.h"
32 < #include "sprintf_irc.h"
32 > #include "conf.h"
33   #include "ircd.h"
34   #include "hostmask.h"
35   #include "numeric.h"
36   #include "fdlist.h"
37   #include "s_bsd.h"
38 < #include "s_conf.h"
37 < #include "s_log.h"
38 > #include "log.h"
39   #include "s_misc.h"
40   #include "send.h"
41   #include "hash.h"
42   #include "s_serv.h"
42 #include "s_gline.h"
43   #include "parse.h"
44   #include "modules.h"
45 + #include "conf_db.h"
46 + #include "memory.h"
47  
48  
49   /* apply_tdline()
# Line 51 | Line 53
53   * side effects - tkline as given is placed
54   */
55   static void
56 < apply_tdline(struct Client *source_p, struct ConfItem *conf,
57 <             const char *current_date, int tkline_time)
56 > apply_dline(struct Client *source_p, struct MaskItem *conf,
57 >            time_t tkline_time)
58   {
59 <  struct AccessItem *aconf;
60 <
61 <  aconf = map_to_conf(conf);
62 <  aconf->hold = CurrentTime + tkline_time;
59 >  if (tkline_time)
60 >  {
61 >    conf->until = CurrentTime + tkline_time;
62 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
63 >                         "%s added temporary %d min. D-Line for [%s] [%s]",
64 >                         get_oper_name(source_p), tkline_time/60,
65 >                         conf->host, conf->reason);
66 >    sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]",
67 >               MyConnect(source_p) ? me.name : ID_or_name(&me, source_p),
68 >               source_p->name, tkline_time/60, conf->host);
69 >    ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]",
70 >         get_oper_name(source_p), tkline_time/60, conf->host, conf->reason);
71 >  }
72 >  else
73 >  {
74 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
75 >                         "%s added D-Line for [%s] [%s]",
76 >                         get_oper_name(source_p), conf->host, conf->reason);
77 >    sendto_one(source_p, ":%s NOTICE %s :Added D-Line [%s]",
78 >               MyConnect(source_p) ? me.name : ID_or_name(&me, source_p),
79 >               source_p->name, conf->host);
80 >    ilog(LOG_TYPE_DLINE, "%s added D-Line for [%s] [%s]",
81 >         get_oper_name(source_p), conf->host, conf->reason);
82  
83 <  add_temp_line(conf);
63 <  sendto_realops_flags(UMODE_ALL, L_ALL,
64 <                       "%s added temporary %d min. D-Line for [%s] [%s]",
65 <                       get_oper_name(source_p), tkline_time/60,
66 <                       aconf->host, aconf->reason);
67 <
68 <  sendto_one(source_p, ":%s NOTICE %s :Added temporary %d min. D-Line [%s]",
69 <             MyConnect(source_p) ? me.name : ID_or_name(&me, source_p->from),
70 <             source_p->name, tkline_time/60, aconf->host);
71 <  ilog(LOG_TYPE_DLINE, "%s added temporary %d min. D-Line for [%s] [%s]",
72 <       source_p->name, tkline_time/60, aconf->host, aconf->reason);
83 >  }
84  
85 +  SetConfDatabase(conf);
86 +  conf->setat = CurrentTime;
87 +  add_conf_by_address(CONF_DLINE, conf);
88    rehashed_klines = 1;
89   }
90  
# Line 80 | Line 94 | apply_tdline(struct Client *source_p, st
94   * Side effects: Any matching tdlines are removed.
95   */
96   static int
97 < remove_tdline_match(const char *host)
97 > remove_dline_match(const char *host)
98   {
99 <  struct AccessItem *td_conf;
100 <  dlink_node *td_node;
101 <  struct irc_ssaddr addr, caddr;
102 <  int nm_t, cnm_t, bits, cbits;
89 <
90 <  nm_t = parse_netmask(host, &addr, &bits);
99 >  struct irc_ssaddr iphost, *piphost;
100 >  struct MaskItem *conf;
101 >  int t = 0;
102 >  int aftype = 0;
103  
104 <  DLINK_FOREACH(td_node, temporary_dlines.head)
104 >  if ((t = parse_netmask(host, &iphost, NULL)) != HM_HOST)
105    {
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))
106   #ifdef IPV6
107 <     || (nm_t == HM_IPV6 && bits == cbits && match_ipv6(&addr, &caddr, bits))
107 >    if (t == HM_IPV6)
108 >      aftype = AF_INET6;
109 >    else
110   #endif
111 <      )
111 >      aftype = AF_INET;
112 >    piphost = &iphost;
113 >  }
114 >  else
115 >    piphost = NULL;
116 >
117 >  if ((conf = find_conf_by_address(host, piphost, CONF_DLINE | 1, aftype, NULL, NULL, 0)))
118 >  {
119 >    if (IsConfDatabase(conf))
120      {
121 <      dlinkDelete(td_node, &temporary_dlines);
108 <      delete_one_address_conf(td_conf->host, td_conf);
121 >      delete_one_address_conf(host, conf);
122        return 1;
123      }
124    }
# Line 123 | Line 136 | remove_tdline_match(const char *host)
136   * side effects - D line is added
137   *
138   */
139 < static void
139 > static int
140   mo_dline(struct Client *client_p, struct Client *source_p,
141           int parc, char *parv[])
142   {
143 <  char def_reason[] = "<No reason specified>";
144 <  char *dlhost = NULL, *oper_reason = NULL, *reason = NULL;
143 >  char def_reason[] = CONF_NOREASON;
144 >  char *dlhost = NULL, *reason = NULL;
145    char *target_server = NULL;
146    const char *creason;
147    const struct Client *target_p = NULL;
148    struct irc_ssaddr daddr;
149 <  struct ConfItem *conf=NULL;
137 <  struct AccessItem *aconf=NULL;
149 >  struct MaskItem *conf=NULL;
150    time_t tkline_time=0;
151 <  int bits, t;
151 >  int bits = 0, aftype = 0, t = 0;
152    const char *current_date = NULL;
153    time_t cur_time;
154 <  char hostip[HOSTIPLEN];
154 >  char hostip[HOSTIPLEN + 1];
155    char buffer[IRCD_BUFSIZE];
156  
157    if (!HasOFlag(source_p, OPER_FLAG_DLINE))
158    {
159 <    sendto_one(source_p, form_str(ERR_NOPRIVS),
160 <               me.name, source_p->name, "kline");
161 <    return;
159 >    sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
160 >               source_p->name, "dline");
161 >    return 0;
162    }
163  
164    if (parse_aline("DLINE", source_p,  parc, parv, AWILD, &dlhost,
165                    NULL, &tkline_time, &target_server, &reason) < 0)
166 <    return;
166 >    return 0;
167  
168    if (target_server != NULL)
169    {
170 <    if (HasID(source_p))
171 <    {
172 <      sendto_server(NULL, NULL, CAP_DLN|CAP_TS6, NOCAPS,
161 <                    ":%s DLINE %s %lu %s :%s",
162 <                    source_p->id, target_server, (unsigned long)tkline_time,
163 <                    dlhost, reason);
164 <      sendto_server(NULL, NULL, CAP_DLN, CAP_TS6,
165 <                    ":%s DLINE %s %lu %s :%s",
166 <                    source_p->name, target_server, (unsigned long)tkline_time,
167 <                    dlhost, reason);
168 <    }
169 <    else
170 <      sendto_server(NULL, NULL, CAP_DLN, NOCAPS,
171 <                    ":%s DLINE %s %lu %s :%s",
172 <                    source_p->name, target_server, (unsigned long)tkline_time,
173 <                    dlhost, reason);
170 >    sendto_match_servs(source_p, target_server, CAP_DLN, "DLINE %s %lu %s :%s",
171 >                       target_server, (unsigned long)tkline_time,
172 >                       dlhost, reason);
173  
174      /* Allow ON to apply local kline as well if it matches */
175 <    if (!match(target_server, me.name))
176 <      return;
175 >    if (match(target_server, me.name))
176 >      return 0;
177    }
178    else
179      cluster_a_line(source_p, "DLINE", CAP_DLN, SHARED_DLINE,
# Line 182 | Line 181 | mo_dline(struct Client *client_p, struct
181  
182    if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST)
183    {
184 <    if ((target_p = find_chasing(client_p, source_p, dlhost, NULL)) == NULL)
185 <      return;
184 >    if ((target_p = find_chasing(source_p, dlhost, NULL)) == NULL)
185 >      return 0;
186  
187      if (!MyConnect(target_p))
188      {
189        sendto_one(source_p,
190                   ":%s NOTICE %s :Can't DLINE nick on another server",
191                   me.name, source_p->name);
192 <      return;
192 >      return 0;
193      }
194  
195      if (IsExemptKline(target_p))
196      {
197 <      sendto_one(source_p,
198 <                 ":%s NOTICE %s :%s is E-lined", me.name,
199 <                 source_p->name, target_p->name);
201 <      return;
197 >      sendto_one(source_p, ":%s NOTICE %s :%s is E-lined",
198 >                 me.name, source_p->name, target_p->name);
199 >      return 0;
200      }
201  
202      getnameinfo((struct sockaddr *)&target_p->localClient->ip,
# Line 214 | Line 212 | mo_dline(struct Client *client_p, struct
212      sendto_one(source_p,
213                 ":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.",
214                 me.name, source_p->name);
215 <    return;
215 >    return 0;
216    }
217  
218   #ifdef IPV6
219    if (t == HM_IPV6)
220 <    t = AF_INET6;
220 >    aftype = AF_INET6;
221    else
222   #endif
223 <    t = AF_INET;
223 >    aftype = AF_INET;
224  
225    parse_netmask(dlhost, &daddr, NULL);
226  
227 <  if ((aconf = find_dline_conf(&daddr, t)) != NULL)
227 >  if ((conf = find_dline_conf(&daddr, aftype)) != NULL)
228    {
229 <    creason = aconf->reason ? aconf->reason : def_reason;
230 <    if (IsConfExemptKline(aconf))
231 <      sendto_one(source_p,
232 <                 ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
233 <                 me.name, source_p->name, dlhost, aconf->host, creason);
229 >    creason = conf->reason ? conf->reason : def_reason;
230 >
231 >    if (IsConfExemptKline(conf))
232 >      sendto_one(source_p, ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
233 >                 me.name, source_p->name, dlhost, conf->host, creason);
234      else
235 <      sendto_one(source_p,
236 <                 ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
237 <                 me.name, source_p->name, dlhost, aconf->host, creason);
240 <    return;
235 >      sendto_one(source_p, ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
236 >                 me.name, source_p->name, dlhost, conf->host, creason);
237 >    return 0;
238    }
239  
240    cur_time = CurrentTime;
241    current_date = smalldate(cur_time);
242  
246  /* Look for an oper reason */
247  if ((oper_reason = strchr(reason, '|')) != NULL)
248    *oper_reason++ = '\0';
249
243    if (!valid_comment(source_p, reason, 1))
244 <    return;
244 >    return 0;
245  
246 <  conf = make_conf_item(DLINE_TYPE);
247 <  aconf = map_to_conf(conf);
255 <  DupString(aconf->host, dlhost);
246 >  conf = conf_make(CONF_DLINE);
247 >  conf->host = xstrdup(dlhost);
248  
249    if (tkline_time != 0)
258  {
250      snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
251               (int)(tkline_time/60), reason, current_date);
261    DupString(aconf->reason, buffer);
262    if (oper_reason != NULL)
263      DupString(aconf->oper_reason, oper_reason);
264    apply_tdline(source_p, conf, current_date, tkline_time);
265  }
252    else
267  {
253      snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
269    DupString(aconf->reason, buffer);
270    if (oper_reason != NULL)
271      DupString(aconf->oper_reason, oper_reason);
272    add_conf_by_address(CONF_DLINE, aconf);
273    write_conf_line(source_p, conf, current_date, cur_time);
274  }
254  
255 +  conf->reason = xstrdup(buffer);
256 +  apply_dline(source_p, conf, tkline_time);
257    rehashed_klines = 1;
258 +  return 0;
259   }
260  
261 < static void
261 > static int
262   ms_dline(struct Client *client_p, struct Client *source_p,
263           int parc, char *parv[])
264   {
265 <  char def_reason[] = "<No reason specified>";
266 <  char *dlhost, *oper_reason, *reason;
265 >  char def_reason[] = CONF_NOREASON;
266 >  char *dlhost, *reason;
267    const char *creason;
268    const struct Client *target_p = NULL;
269    struct irc_ssaddr daddr;
270 <  struct ConfItem *conf=NULL;
289 <  struct AccessItem *aconf=NULL;
270 >  struct MaskItem *conf=NULL;
271    time_t tkline_time=0;
272 <  int bits, t;
272 >  int bits = 0, aftype = 0, t = 0;
273    const char *current_date = NULL;
274    time_t cur_time;
275 <  char hostip[HOSTIPLEN];
275 >  char hostip[HOSTIPLEN + 1];
276    char buffer[IRCD_BUFSIZE];
277  
278    if (parc != 5 || EmptyString(parv[4]))
279 <    return;
279 >    return 0;
280  
281    /* parv[0]  parv[1]        parv[2]      parv[3]  parv[4] */
282    /* oper     target_server  tkline_time  host     reason  */
# Line 303 | Line 284 | ms_dline(struct Client *client_p, struct
284                       "DLINE %s %s %s :%s",
285                       parv[1], parv[2], parv[3], parv[4]);
286  
287 <  if (!match(parv[1], me.name))
288 <    return;
287 >  if (match(parv[1], me.name))
288 >    return 0;
289  
290    tkline_time = valid_tkline(parv[2], TK_SECONDS);
291    dlhost = parv[3];
292    reason = parv[4];
293  
294 <  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE, source_p->servptr->name,
294 >  if (HasFlag(source_p, FLAGS_SERVICE) ||
295 >      find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
296                                source_p->username, source_p->host,
297                                SHARED_DLINE))
298    {
299      if (!IsClient(source_p))
300 <      return;
300 >      return 0;
301 >
302      if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST)
303      {
304 <      if ((target_p = find_chasing(client_p, source_p, dlhost, NULL)) == NULL)
305 <        return;
304 >      if ((target_p = find_chasing(source_p, dlhost, NULL)) == NULL)
305 >        return 0;
306  
307        if (!MyConnect(target_p))
308        {
309          sendto_one(source_p,
310                     ":%s NOTICE %s :Can't DLINE nick on another server",
311                     me.name, source_p->name);
312 <        return;
312 >        return 0;
313        }
314  
315        if (IsExemptKline(target_p))
# Line 334 | Line 317 | ms_dline(struct Client *client_p, struct
317          sendto_one(source_p,
318                     ":%s NOTICE %s :%s is E-lined", me.name,
319                     source_p->name, target_p->name);
320 <        return;
320 >        return 0;
321        }
322  
323        getnameinfo((struct sockaddr *)&target_p->localClient->ip,
# Line 350 | Line 333 | ms_dline(struct Client *client_p, struct
333        sendto_one(source_p,
334                   ":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.",
335                   me.name, source_p->name);
336 <      return;
336 >      return 0;
337      }
338  
339   #ifdef IPV6
340      if (t == HM_IPV6)
341 <      t = AF_INET6;
341 >      aftype= AF_INET6;
342      else
343   #endif
344 <      t = AF_INET;
344 >      aftype = AF_INET;
345  
346      parse_netmask(dlhost, &daddr, NULL);
347  
348 <    if ((aconf = find_dline_conf(&daddr, t)) != NULL)
348 >    if ((conf = find_dline_conf(&daddr, aftype)) != NULL)
349      {
350 <      creason = aconf->reason ? aconf->reason : def_reason;
351 <      if (IsConfExemptKline(aconf))
350 >      creason = conf->reason ? conf->reason : def_reason;
351 >      if (IsConfExemptKline(conf))
352          sendto_one(source_p,
353                     ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
354 <                   me.name, source_p->name, dlhost, aconf->host, creason);
354 >                   me.name, source_p->name, dlhost, conf->host, creason);
355        else
356          sendto_one(source_p,
357                     ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
358 <                   me.name, source_p->name, dlhost, aconf->host, creason);
359 <      return;
358 >                   me.name, source_p->name, dlhost, conf->host, creason);
359 >      return 0;
360      }
361  
362      cur_time = CurrentTime;
363      current_date = smalldate(cur_time);
364  
382    /* Look for an oper reason */
383    if ((oper_reason = strchr(reason, '|')) != NULL)
384      *oper_reason++ = '\0';
385
365      if (!valid_comment(source_p, reason, 1))
366 <      return;
366 >      return 0;
367  
368 <    conf = make_conf_item(DLINE_TYPE);
369 <    aconf = map_to_conf(conf);
391 <    DupString(aconf->host, dlhost);
368 >    conf = conf_make(CONF_DLINE);
369 >    conf->host = xstrdup(dlhost);
370  
371      if (tkline_time != 0)
394    {
372        snprintf(buffer, sizeof(buffer), "Temporary D-line %d min. - %s (%s)",
373                 (int)(tkline_time/60), reason, current_date);
397      DupString(aconf->reason, buffer);
398      if (oper_reason != NULL)
399        DupString(aconf->oper_reason, oper_reason);
400      apply_tdline(source_p, conf, current_date, tkline_time);
401    }
374      else
403    {
375        snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
405      DupString(aconf->reason, buffer);
406      if (oper_reason != NULL)
407        DupString(aconf->oper_reason, oper_reason);
408      add_conf_by_address(CONF_DLINE, aconf);
409      write_conf_line(source_p, conf, current_date, cur_time);
410    }
376  
377 +    conf->reason = xstrdup(buffer);
378 +    apply_dline(source_p, conf, tkline_time);
379      rehashed_klines = 1;
380    }
381 +
382 +  return 0;
383   }
384  
385   /*
# Line 422 | Line 391 | ms_dline(struct Client *client_p, struct
391   **      parv[0] = sender nick
392   **      parv[1] = dline to remove
393   */
394 < static void
394 > static int
395   mo_undline(struct Client *client_p, struct Client *source_p,
396             int parc, char *parv[])
397   {
# Line 431 | Line 400 | mo_undline(struct Client *client_p, stru
400  
401    if (!HasOFlag(source_p, OPER_FLAG_UNDLINE))
402    {
403 <    sendto_one(source_p, form_str(ERR_NOPRIVS),
404 <               me.name, source_p->name, "undline");
405 <    return;
403 >    sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
404 >               source_p->name, "undline");
405 >    return 0;
406    }
407  
408    if (parc < 2 || EmptyString(parv[1]))
409    {
410      sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
411                 me.name, source_p->name, "UNDLINE");
412 <    return;
412 >    return 0;
413    }
414  
415    if (parse_aline("UNDLINE", source_p, parc, parv, 0, &user,
416                    &addr, NULL, &target_server, NULL) < 0)
417 <    return;
417 >    return 0;
418  
419    if (target_server != NULL)
420    {
# Line 453 | Line 422 | mo_undline(struct Client *client_p, stru
422                         "UNDLINE %s %s", target_server, addr);
423  
424      /* Allow ON to apply local unkline as well if it matches */
425 <    if (!match(target_server, me.name))
426 <      return;
425 >    if (match(target_server, me.name))
426 >      return 0;
427    }
428    else
429      cluster_a_line(source_p, "UNDLINE", CAP_UNDLN, SHARED_UNDLINE,
430                     "%s", addr);
431  
432 <  if (remove_tdline_match(addr))
464 <  {
465 <    sendto_one(source_p,
466 <               ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
467 <               me.name, source_p->name, addr);
468 <    sendto_realops_flags(UMODE_ALL, L_ALL,
469 <                         "%s has removed the temporary D-Line for: [%s]",
470 <                         get_oper_name(source_p), addr);
471 <    ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
472 <         source_p->name, addr);
473 <    return;
474 <  }
475 <
476 <  if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0)
432 >  if (remove_dline_match(addr))
433    {
434      sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
435                 me.name, source_p->name, addr);
436 <    sendto_realops_flags(UMODE_ALL, L_ALL,
437 <                         "%s has removed the D-Line for: [%s]",
438 <                         get_oper_name(source_p), addr);
436 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
437 >                         "%s has removed the D-Line for: [%s]",
438 >                         get_oper_name(source_p), addr);
439      ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
440           get_oper_name(source_p), addr);
441    }
442    else
443      sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found",
444                 me.name, source_p->name, addr);
445 +  return 0;
446   }
447  
448 < static void
449 < me_undline(struct Client *client_p, struct Client *source_p,
448 > static int
449 > ms_undline(struct Client *client_p, struct Client *source_p,
450             int parc, char *parv[])
451   {
452 <  const char *addr = NULL;
452 >  const char *addr = parv[1];
453  
454    if (parc != 3 || EmptyString(parv[2]))
455 <    return;
455 >    return 0;
456  
457 <  addr = parv[2];
457 >  sendto_match_servs(source_p, parv[1], CAP_UNDLN,
458 >                     "UNDLINE %s %s",
459 >                     parv[1], parv[2]);
460  
461 <  if (!IsClient(source_p) || !match(parv[1], me.name))
462 <    return;
461 >  if (!IsClient(source_p) || match(parv[1], me.name))
462 >    return 0;
463  
464 <  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE,
465 <                                   source_p->servptr->name,
466 <                                   source_p->username, source_p->host,
467 <                                   SHARED_UNDLINE))
464 >  if (HasFlag(source_p, FLAGS_SERVICE) ||
465 >      find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
466 >                              source_p->username, source_p->host,
467 >                              SHARED_UNDLINE))
468    {
469 <    if (remove_tdline_match(addr))
511 <    {
512 <      sendto_one(source_p,
513 <                 ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
514 <                 me.name, source_p->name, addr);
515 <      sendto_realops_flags(UMODE_ALL, L_ALL,
516 <                           "%s has removed the temporary D-Line for: [%s]",
517 <                           get_oper_name(source_p), addr);
518 <      ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
519 <           source_p->name, addr);
520 <      return;
521 <    }
522 <
523 <    if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0)
469 >    if (remove_dline_match(addr))
470      {
471        sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
472                   me.name, source_p->name, addr);
473 <      sendto_realops_flags(UMODE_ALL, L_ALL,
473 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
474                             "%s has removed the D-Line for: [%s]",
475                             get_oper_name(source_p), addr);
476        ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
# Line 534 | Line 480 | me_undline(struct Client *client_p, stru
480        sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found",
481                   me.name, source_p->name, addr);
482    }
537 }
483  
484 < static void
540 < ms_undline(struct Client *client_p, struct Client *source_p,
541 <           int parc, char *parv[])
542 < {
543 <  if (parc != 3 || EmptyString(parv[2]))
544 <    return;
545 <
546 <  sendto_match_servs(source_p, parv[1], CAP_UNDLN,
547 <                     "UNDLINE %s %s %s",
548 <                     parv[1], parv[2]);
549 <
550 <  me_undline(client_p, source_p, parc, parv);
484 >  return 0;
485   }
486  
487 < static struct Message dline_msgtab = {
487 > static struct Message dline_msgtab =
488 > {
489    "DLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
490 <   {m_unregistered, m_not_oper, ms_dline, m_ignore, mo_dline, m_ignore}
490 >  { m_unregistered, m_not_oper, ms_dline, m_ignore, mo_dline, m_ignore }
491   };
492  
493 < static struct Message undline_msgtab = {
493 > static struct Message undline_msgtab =
494 > {
495    "UNDLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
496 <   {m_unregistered, m_not_oper, ms_undline, m_ignore, mo_undline, m_ignore}
496 >  { m_unregistered, m_not_oper, ms_undline, m_ignore, mo_undline, m_ignore }
497   };
498  
499   static void
# Line 578 | Line 514 | module_exit(void)
514    delete_capability("DLN");
515   }
516  
517 < struct module module_entry = {
517 > struct module module_entry =
518 > {
519    .node    = { NULL, NULL, NULL },
520    .name    = NULL,
521    .version = "$Revision$",

Diff Legend

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