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

Comparing ircd-hybrid/trunk/src/conf.c (file contents):
Revision 1646 by michael, Wed Nov 7 21:02:43 2012 UTC vs.
Revision 2525 by michael, Sat Nov 2 17:07:38 2013 UTC

# Line 25 | Line 25
25   #include "stdinc.h"
26   #include "list.h"
27   #include "ircd_defs.h"
28 #include "balloc.h"
28   #include "conf.h"
29   #include "s_serv.h"
30   #include "resv.h"
# Line 45 | Line 44
44   #include "send.h"
45   #include "s_gline.h"
46   #include "memory.h"
47 + #include "mempool.h"
48   #include "irc_res.h"
49   #include "userhost.h"
50   #include "s_user.h"
# Line 53 | Line 53
53   #include "s_misc.h"
54   #include "conf_db.h"
55   #include "conf_class.h"
56 + #include "motd.h"
57  
58   struct config_server_hide ConfigServerHide;
59  
# Line 63 | Line 64 | dlink_list cluster_items = { NULL, NULL,
64   dlink_list oconf_items   = { NULL, NULL, 0 };
65   dlink_list uconf_items   = { NULL, NULL, 0 };
66   dlink_list xconf_items   = { NULL, NULL, 0 };
66 dlink_list rxconf_items  = { NULL, NULL, 0 };
67 dlink_list rkconf_items  = { NULL, NULL, 0 };
67   dlink_list nresv_items   = { NULL, NULL, 0 };
68 < dlink_list temporary_resv = { NULL, NULL, 0 };
68 > dlink_list cresv_items = { NULL, NULL, 0 };
69  
70   extern unsigned int lineno;
71   extern char linebuf[];
# Line 85 | Line 84 | static int verify_access(struct Client *
84   static int attach_iline(struct Client *, struct MaskItem *);
85   static struct ip_entry *find_or_add_ip(struct irc_ssaddr *);
86   static dlink_list *map_to_list(enum maskitem_type);
88 static struct MaskItem *find_regexp_kline(const char *[]);
87   static int find_user_host(struct Client *, char *, char *, char *, unsigned int);
88  
89  
# Line 104 | Line 102 | struct ip_entry
102   };
103  
104   static struct ip_entry *ip_hash_table[IP_HASH_SIZE];
105 < static BlockHeap *ip_entry_heap = NULL;
105 > static mp_pool_t *ip_entry_pool = NULL;
106   static int ip_entries_count = 0;
107  
108  
# Line 186 | Line 184 | conf_free(struct MaskItem *conf)
184    MyFree(conf->passwd);
185    MyFree(conf->spasswd);
186    MyFree(conf->reason);
187 +  MyFree(conf->certfp);
188    MyFree(conf->user);
189    MyFree(conf->host);
191  MyFree(conf->regexuser);
192  MyFree(conf->regexhost);
190   #ifdef HAVE_LIBCRYPTO
191    MyFree(conf->cipher_list);
192  
193    if (conf->rsa_public_key)
194      RSA_free(conf->rsa_public_key);
198
199  MyFree(conf->rsa_public_key_file);
195   #endif
196    DLINK_FOREACH_SAFE(ptr, ptr_next, conf->hub_list.head)
197    {
# Line 210 | Line 205 | conf_free(struct MaskItem *conf)
205      free_dlink_node(ptr);
206    }
207  
208 <  MyFree(conf);
214 < }
215 <
216 < static const struct shared_flags
217 < {
218 <  const unsigned int type;
219 <  const unsigned char letter;
220 < } flag_table[] = {
221 <  { SHARED_KLINE,   'K' },
222 <  { SHARED_UNKLINE, 'U' },
223 <  { SHARED_XLINE,   'X' },
224 <  { SHARED_UNXLINE, 'Y' },
225 <  { SHARED_RESV,    'Q' },
226 <  { SHARED_UNRESV,  'R' },
227 <  { SHARED_LOCOPS,  'L' },
228 <  { SHARED_DLINE,   'D' },
229 <  { SHARED_UNDLINE, 'E' },
230 <  { 0, '\0' }
231 < };
232 <
233 < /*
234 < * inputs       - pointer to client requesting confitem report
235 < *              - ConfType to report
236 < * output       - none
237 < * side effects -
238 < */
239 < void
240 < report_confitem_types(struct Client *source_p, enum maskitem_type type)
241 < {
242 <  dlink_node *ptr = NULL, *dptr = NULL;
243 <  struct MaskItem *conf = NULL;
244 <  const struct ClassItem *class = NULL;
245 <  const struct shared_flags *shared = NULL;
246 <  char buf[12];
247 <  char *p = NULL;
248 <
249 <  switch (type)
208 >  DLINK_FOREACH_SAFE(ptr, ptr_next, conf->exempt_list.head)
209    {
210 <  case CONF_XLINE:
252 <    DLINK_FOREACH(ptr, xconf_items.head)
253 <    {
254 <      conf = ptr->data;
255 <
256 <      sendto_one(source_p, form_str(RPL_STATSXLINE),
257 <                 me.name, source_p->name,
258 <                 conf->hold ? "x": "X", conf->count,
259 <                 conf->name, conf->reason);
260 <    }
261 <    break;
262 <
263 < #ifdef HAVE_LIBPCRE
264 <  case CONF_RXLINE:
265 <    DLINK_FOREACH(ptr, rxconf_items.head)
266 <    {
267 <      conf = ptr->data;
268 <
269 <      sendto_one(source_p, form_str(RPL_STATSXLINE),
270 <                 me.name, source_p->name,
271 <                 "XR", conf->count,
272 <                 conf->name, conf->reason);
273 <    }
274 <    break;
275 <
276 <  case CONF_RKLINE:
277 <    DLINK_FOREACH(ptr, rkconf_items.head)
278 <    {
279 <      conf = ptr->data;
210 >    struct exempt *exptr = ptr->data;
211  
212 <      sendto_one(source_p, form_str(RPL_STATSKLINE), me.name,
213 <                 source_p->name, "KR", conf->host, conf->user,
214 <                 conf->reason);
215 <    }
285 <    break;
286 < #endif
287 <
288 <  case CONF_ULINE:
289 <    shared = flag_table;
290 <    DLINK_FOREACH(ptr, uconf_items.head)
291 <    {
292 <      conf = ptr->data;
293 <
294 <      p = buf;
295 <
296 <      *p++ = 'c';
297 <      for (; shared->type; ++shared)
298 <        if (shared->type & conf->flags)
299 <          *p++ = shared->letter;
300 <        else
301 <          *p++ = ToLower(shared->letter);
302 <
303 <      sendto_one(source_p, form_str(RPL_STATSULINE),
304 <                 me.name, source_p->name, conf->name,
305 <                 conf->user?conf->user: "*",
306 <                 conf->host?conf->host: "*", buf);
307 <    }
308 <
309 <    shared = flag_table;
310 <    DLINK_FOREACH(ptr, cluster_items.head)
311 <    {
312 <      conf = ptr->data;
313 <
314 <      p = buf;
315 <
316 <      *p++ = 'C';
317 <      for (; shared->type; ++shared)
318 <        if (shared->type & conf->flags)
319 <          *p++ = shared->letter;
320 <        else
321 <          *p++ = ToLower(shared->letter);
322 <
323 <      sendto_one(source_p, form_str(RPL_STATSULINE),
324 <                 me.name, source_p->name, conf->name,
325 <                 "*", "*", buf);
326 <    }
327 <
328 <    break;
329 <
330 <  case CONF_OPER:
331 <    DLINK_FOREACH(ptr, oconf_items.head)
332 <    {
333 <      conf = ptr->data;
334 <
335 <      /* Don't allow non opers to see oper privs */
336 <      if (HasUMode(source_p, UMODE_OPER))
337 <        sendto_one(source_p, form_str(RPL_STATSOLINE),
338 <                   me.name, source_p->name, 'O', conf->user, conf->host,
339 <                   conf->name, oper_privs_as_string(conf->port),
340 <                   conf->class ? conf->class->name : "<default>");
341 <      else
342 <        sendto_one(source_p, form_str(RPL_STATSOLINE),
343 <                   me.name, source_p->name, 'O', conf->user, conf->host,
344 <                   conf->name, "0",
345 <                   conf->class ? conf->class->name : "<default>");
346 <    }
347 <    break;
348 <
349 <  case CONF_CLASS:
350 <    DLINK_FOREACH(ptr, class_get_list()->head)
351 <    {
352 <      class = ptr->data;
353 <      sendto_one(source_p, form_str(RPL_STATSYLINE),
354 <                 me.name, source_p->name, 'Y',
355 <                 class->name, class->ping_freq,
356 <                 class->con_freq,
357 <                 class->max_total, class->max_sendq,
358 <                 class->max_recvq,
359 <                 class->ref_count,
360 <                 class->number_per_cidr, class->cidr_bitlen_ipv4,
361 <                 class->number_per_cidr, class->cidr_bitlen_ipv6,
362 <                 class->active ? "active" : "disabled");
363 <    }
364 <    break;
365 <
366 <  case CONF_SERVICE:
367 <    DLINK_FOREACH(ptr, service_items.head)
368 <    {
369 <      conf = ptr->data;
370 <      sendto_one(source_p, form_str(RPL_STATSSERVICE),
371 <                 me.name, source_p->name, 'S', "*", conf->name, 0, 0);
372 <    }
373 <    break;
374 <
375 <  case CONF_SERVER:
376 <    DLINK_FOREACH(ptr, server_items.head)
377 <    {
378 <      p = buf;
379 <      conf = ptr->data;
380 <
381 <      buf[0] = '\0';
382 <
383 <      if (IsConfAllowAutoConn(conf))
384 <        *p++ = 'A';
385 <      if (IsConfSSL(conf))
386 <        *p++ = 'S';
387 <      if (buf[0] == '\0')
388 <        *p++ = '*';
389 <
390 <      *p = '\0';
391 <
392 <      /*
393 <       * Allow admins to see actual ips unless hide_server_ips is enabled
394 <       */
395 <      if (!ConfigServerHide.hide_server_ips && HasUMode(source_p, UMODE_ADMIN))
396 <        sendto_one(source_p, form_str(RPL_STATSCLINE),
397 <                   me.name, source_p->name, 'C', conf->host,
398 <                   buf, conf->name, conf->port,
399 <                   conf->class ? conf->class->name : "<default>");
400 <        else
401 <          sendto_one(source_p, form_str(RPL_STATSCLINE),
402 <                     me.name, source_p->name, 'C',
403 <                     "*@127.0.0.1", buf, conf->name, conf->port,
404 <                     conf->class ? conf->class->name : "<default>");
405 <    }
406 <    break;
407 <
408 <  case CONF_HUB:
409 <    DLINK_FOREACH(ptr, server_items.head)
410 <    {
411 <      conf = ptr->data;
412 <
413 <      DLINK_FOREACH(dptr, conf->hub_list.head)
414 <        sendto_one(source_p, form_str(RPL_STATSHLINE), me.name,
415 <                   source_p->name, 'H', dptr->data, conf->name, 0, "*");
416 <    }
417 <
418 <    DLINK_FOREACH(ptr, server_items.head)
419 <    {
420 <      conf = ptr->data;
421 <
422 <      DLINK_FOREACH(dptr, conf->leaf_list.head)
423 <        sendto_one(source_p, form_str(RPL_STATSLLINE), me.name,
424 <                   source_p->name, 'L', dptr->data, conf->name, 0, "*");
425 <    }
426 <
427 <    break;
428 <
429 <  default:
430 <    break;
212 >    MyFree(exptr->name);
213 >    MyFree(exptr->user);
214 >    MyFree(exptr->host);
215 >    MyFree(exptr);
216    }
217 +
218 +  MyFree(conf);
219   }
220  
221   /* check_client()
# Line 458 | Line 245 | check_client(struct Client *source_p)
245      case TOO_MANY:
246        sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
247                             "Too many on IP for %s (%s).",
248 <                           get_client_name(source_p, SHOW_IP),
249 <                           source_p->sockhost);
248 >                           get_client_name(source_p, SHOW_IP),
249 >                           source_p->sockhost);
250        ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.",
251 <           get_client_name(source_p, SHOW_IP));
251 >           get_client_name(source_p, SHOW_IP));
252        ++ServerStats.is_ref;
253        exit_client(source_p, &me, "No more connections allowed on that IP");
254        break;
# Line 469 | Line 256 | check_client(struct Client *source_p)
256      case I_LINE_FULL:
257        sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
258                             "auth{} block is full for %s (%s).",
259 <                           get_client_name(source_p, SHOW_IP),
260 <                           source_p->sockhost);
259 >                           get_client_name(source_p, SHOW_IP),
260 >                           source_p->sockhost);
261        ilog(LOG_TYPE_IRCD, "Too many connections from %s.",
262 <           get_client_name(source_p, SHOW_IP));
262 >           get_client_name(source_p, SHOW_IP));
263        ++ServerStats.is_ref;
264        exit_client(source_p, &me,
265 <                "No more connections allowed in your connection class");
265 >                  "No more connections allowed in your connection class");
266        break;
267  
268      case NOT_AUTHORIZED:
# Line 483 | Line 270 | check_client(struct Client *source_p)
270        /* jdc - lists server name & port connections are on */
271        /*       a purely cosmetical change */
272        sendto_realops_flags(UMODE_UNAUTH, L_ALL, SEND_NOTICE,
273 <                           "Unauthorized client connection from %s [%s] on [%s/%u].",
274 <                           get_client_name(source_p, SHOW_IP),
275 <                           source_p->sockhost,
276 <                           source_p->localClient->listener->name,
277 <                           source_p->localClient->listener->port);
273 >                           "Unauthorized client connection from %s [%s] on [%s/%u].",
274 >                           get_client_name(source_p, SHOW_IP),
275 >                           source_p->sockhost,
276 >                           source_p->localClient->listener->name,
277 >                           source_p->localClient->listener->port);
278        ilog(LOG_TYPE_IRCD,
279 <          "Unauthorized client connection from %s on [%s/%u].",
280 <          get_client_name(source_p, SHOW_IP),
281 <          source_p->localClient->listener->name,
282 <          source_p->localClient->listener->port);
279 >           "Unauthorized client connection from %s on [%s/%u].",
280 >           get_client_name(source_p, SHOW_IP),
281 >           source_p->localClient->listener->name,
282 >           source_p->localClient->listener->port);
283  
284        exit_client(source_p, &me, "You are not authorized to use this server");
285        break;
# Line 519 | Line 306 | check_client(struct Client *source_p)
306   static int
307   verify_access(struct Client *client_p)
308   {
309 <  struct MaskItem *conf = NULL, *rkconf = NULL;
309 >  struct MaskItem *conf = NULL;
310    char non_ident[USERLEN + 1] = { '~', '\0' };
524  const char *uhi[3];
311  
312    if (IsGotId(client_p))
313    {
314      conf = find_address_conf(client_p->host, client_p->username,
315 <                             &client_p->localClient->ip,
316 <                             client_p->localClient->aftype,
315 >                             &client_p->localClient->ip,
316 >                             client_p->localClient->aftype,
317                               client_p->localClient->passwd);
318    }
319    else
320    {
321 <    strlcpy(non_ident+1, client_p->username, sizeof(non_ident)-1);
321 >    strlcpy(non_ident + 1, client_p->username, sizeof(non_ident) - 1);
322      conf = find_address_conf(client_p->host,non_ident,
323 <                             &client_p->localClient->ip,
324 <                             client_p->localClient->aftype,
325 <                             client_p->localClient->passwd);
323 >                             &client_p->localClient->ip,
324 >                             client_p->localClient->aftype,
325 >                             client_p->localClient->passwd);
326    }
327  
542  uhi[0] = IsGotId(client_p) ? client_p->username : non_ident;
543  uhi[1] = client_p->host;
544  uhi[2] = client_p->sockhost;
545
546  rkconf = find_regexp_kline(uhi);
547
328    if (conf != NULL)
329    {
330 <    if (IsConfClient(conf) && !rkconf)
330 >    if (IsConfClient(conf))
331      {
332        if (IsConfRedir(conf))
333        {
# Line 555 | Line 335 | verify_access(struct Client *client_p)
335                     me.name, client_p->name,
336                     conf->name ? conf->name : "",
337                     conf->port);
338 <        return(NOT_AUTHORIZED);
338 >        return NOT_AUTHORIZED;
339        }
340  
341        if (IsConfDoIdentd(conf))
342 <        SetNeedId(client_p);
342 >        SetNeedId(client_p);
343  
344        /* Thanks for spoof idea amm */
345        if (IsConfDoSpoofIp(conf))
# Line 569 | Line 349 | verify_access(struct Client *client_p)
349                                 "%s spoofing: %s as %s",
350                                 client_p->name, client_p->host, conf->name);
351          strlcpy(client_p->host, conf->name, sizeof(client_p->host));
352 <        SetIPSpoof(client_p);
352 >        AddFlag(client_p, FLAGS_IP_SPOOFING | FLAGS_AUTH_SPOOF);
353        }
354  
355 <      return(attach_iline(client_p, conf));
355 >      return attach_iline(client_p, conf);
356      }
357 <    else if (rkconf || IsConfKill(conf) || (ConfigFileEntry.glines && IsConfGline(conf)))
357 >    else if (IsConfKill(conf) || (ConfigFileEntry.glines && IsConfGline(conf)))
358      {
579      /* XXX */
580      conf = rkconf ? rkconf : conf;
359        if (IsConfGline(conf))
360          sendto_one(client_p, ":%s NOTICE %s :*** G-lined", me.name,
361                     client_p->name);
362        sendto_one(client_p, ":%s NOTICE %s :*** Banned: %s",
363                   me.name, client_p->name, conf->reason);
364 <      return(BANNED_CLIENT);
364 >      return BANNED_CLIENT;
365      }
366    }
367  
368 <  return(NOT_AUTHORIZED);
368 >  return NOT_AUTHORIZED;
369   }
370  
371   /* attach_iline()
# Line 605 | Line 383 | attach_iline(struct Client *client_p, st
383    int a_limit_reached = 0;
384    unsigned int local = 0, global = 0, ident = 0;
385  
386 +  assert(conf->class);
387 +
388    ip_found = find_or_add_ip(&client_p->localClient->ip);
389    ip_found->count++;
390    SetIpHash(client_p);
391  
612  if (conf->class == NULL)
613    return NOT_AUTHORIZED;  /* If class is missing, this is best */
614
392    class = conf->class;
393  
394    count_user_host(client_p->username, client_p->host,
# Line 656 | Line 433 | attach_iline(struct Client *client_p, st
433   void
434   init_ip_hash_table(void)
435   {
436 <  ip_entry_heap = BlockHeapCreate("ip", sizeof(struct ip_entry),
660 <    2 * hard_fdlimit);
436 >  ip_entry_pool = mp_pool_new(sizeof(struct ip_entry), MP_CHUNK_SIZE_IP_ENTRY);
437    memset(ip_hash_table, 0, sizeof(ip_hash_table));
438   }
439  
# Line 706 | Line 482 | find_or_add_ip(struct irc_ssaddr *ip_in)
482    if (ip_entries_count >= 2 * hard_fdlimit)
483      garbage_collect_ip_entries();
484  
485 <  newptr = BlockHeapAlloc(ip_entry_heap);
485 >  newptr = mp_pool_get(ip_entry_pool);
486 >  memset(newptr, 0, sizeof(*newptr));
487    ip_entries_count++;
488    memcpy(&newptr->ip, ip_in, sizeof(struct irc_ssaddr));
489  
# Line 757 | Line 534 | remove_one_ip(struct irc_ssaddr *ip_in)
534      if (ptr->count > 0)
535        ptr->count--;
536      if (ptr->count == 0 &&
537 <        (CurrentTime-ptr->last_attempt) >= ConfigFileEntry.throttle_time)
537 >        (CurrentTime-ptr->last_attempt) >= ConfigFileEntry.throttle_time)
538      {
539        if (last_ptr != NULL)
540 <        last_ptr->next = ptr->next;
540 >        last_ptr->next = ptr->next;
541        else
542 <        ip_hash_table[hash_index] = ptr->next;
542 >        ip_hash_table[hash_index] = ptr->next;
543  
544 <      BlockHeapFree(ip_entry_heap, ptr);
544 >      mp_pool_release(ptr);
545        ip_entries_count--;
546        return;
547      }
# Line 867 | Line 644 | garbage_collect_ip_entries(void)
644            last_ptr->next = ptr->next;
645          else
646            ip_hash_table[i] = ptr->next;
647 <        BlockHeapFree(ip_entry_heap, ptr);
647 >        mp_pool_release(ptr);
648          ip_entries_count--;
649        }
650        else
# Line 971 | Line 748 | attach_connect_block(struct Client *clie
748    {
749      conf = ptr->data;
750  
751 <    if (match(conf->name, name) == 0 || match(conf->host, host) == 0)
751 >    if (match(conf->name, name) || match(conf->host, host))
752        continue;
753  
754      attach_conf(client_p, conf);
# Line 1003 | Line 780 | find_conf_name(dlink_list *list, const c
780      if (conf->type == type)
781      {
782        if (conf->name && (irccmp(conf->name, name) == 0 ||
783 <                         match(conf->name, name)))
783 >                         !match(conf->name, name)))
784        return conf;
785      }
786    }
# Line 1022 | Line 799 | map_to_list(enum maskitem_type type)
799   {
800    switch(type)
801    {
1025  case CONF_RKLINE:
1026    return(&rkconf_items);
1027    break;
1028  case CONF_RXLINE:
1029    return(&rxconf_items);
1030    break;
802    case CONF_XLINE:
803      return(&xconf_items);
804      break;
# Line 1037 | Line 808 | map_to_list(enum maskitem_type type)
808    case CONF_NRESV:
809      return(&nresv_items);
810      break;
811 +  case CONF_CRESV:
812 +    return(&cresv_items);
813    case CONF_OPER:
814      return(&oconf_items);
815      break;
# Line 1074 | Line 847 | find_matching_name_conf(enum maskitem_ty
847  
848    switch (type)
849    {
1077 #ifdef HAVE_LIBPCRE
1078  case CONF_RXLINE:
1079      DLINK_FOREACH(ptr, list_p->head)
1080      {
1081        conf = ptr->data;
1082        assert(conf->regexpname);
1083
1084        if (!ircd_pcre_exec(conf->regexuser, name))
1085          return conf;
1086      }
1087      break;
1088 #endif
850    case CONF_SERVICE:
851      DLINK_FOREACH(ptr, list_p->head)
852      {
# Line 1101 | Line 862 | find_matching_name_conf(enum maskitem_ty
862    case CONF_XLINE:
863    case CONF_ULINE:
864    case CONF_NRESV:
865 +  case CONF_CRESV:
866      DLINK_FOREACH(ptr, list_p->head)
867      {
868        conf = ptr->data;
869  
870        if (EmptyString(conf->name))
871 <        continue;
872 <      if ((name != NULL) && match_esc(conf->name, name))
871 >        continue;
872 >      if ((name != NULL) && !match(conf->name, name))
873        {
874 <        if ((user == NULL && (host == NULL)))
875 <          return conf;
876 <        if ((conf->flags & flags) != flags)
874 >        if ((user == NULL && (host == NULL)))
875 >          return conf;
876 >        if ((conf->flags & flags) != flags)
877            continue;
878 <        if (EmptyString(conf->user) || EmptyString(conf->host))
879 <          return conf;
880 <        if (match(conf->user, user) && match(conf->host, host))
881 <          return conf;
878 >        if (EmptyString(conf->user) || EmptyString(conf->host))
879 >          return conf;
880 >        if (!match(conf->user, user) && !match(conf->host, host))
881 >          return conf;
882        }
883      }
884        break;
# Line 1126 | Line 888 | find_matching_name_conf(enum maskitem_ty
888      {
889        conf = ptr->data;
890  
891 <      if ((name != NULL) && match(name, conf->name))
891 >      if ((name != NULL) && !match(name, conf->name))
892          return conf;
893 <      else if ((host != NULL) && match(host, conf->host))
893 >      else if ((host != NULL) && !match(host, conf->host))
894          return conf;
895      }
896      break;
# Line 1158 | Line 920 | find_exact_name_conf(enum maskitem_type
920  
921    switch(type)
922    {
1161  case CONF_RXLINE:
923    case CONF_XLINE:
924    case CONF_ULINE:
925    case CONF_NRESV:
926 +  case CONF_CRESV:
927  
928      DLINK_FOREACH(ptr, list_p->head)
929      {
930        conf = ptr->data;
931  
932        if (EmptyString(conf->name))
933 <        continue;
933 >        continue;
934      
935        if (irccmp(conf->name, name) == 0)
936        {
937 <        if ((user == NULL && (host == NULL)))
938 <          return (conf);
939 <        if (EmptyString(conf->user) || EmptyString(conf->host))
940 <          return (conf);
941 <        if (match(conf->user, user) && match(conf->host, host))
942 <          return (conf);
937 >        if ((user == NULL && (host == NULL)))
938 >          return conf;
939 >        if (EmptyString(conf->user) || EmptyString(conf->host))
940 >          return conf;
941 >        if (!match(conf->user, user) && !match(conf->host, host))
942 >          return conf;
943        }
944      }
945      break;
# Line 1196 | Line 958 | find_exact_name_conf(enum maskitem_type
958            return conf;
959          if (EmptyString(conf->user) || EmptyString(conf->host))
960            return NULL;
961 <        if (match(conf->user, who->username))
961 >        if (!match(conf->user, who->username))
962          {
963            switch (conf->htype)
964            {
965              case HM_HOST:
966 <              if (match(conf->host, who->host) || match(conf->host, who->sockhost))
966 >              if (!match(conf->host, who->host) || !match(conf->host, who->sockhost))
967                  if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
968                    return conf;
969                break;
# Line 1234 | Line 996 | find_exact_name_conf(enum maskitem_type
996        conf = ptr->data;
997  
998        if (EmptyString(conf->name))
999 <        continue;
999 >        continue;
1000      
1001        if (name == NULL)
1002        {
1003 <        if (EmptyString(conf->host))
1004 <          continue;
1005 <        if (irccmp(conf->host, host) == 0)
1006 <          return(conf);
1003 >        if (EmptyString(conf->host))
1004 >          continue;
1005 >        if (irccmp(conf->host, host) == 0)
1006 >          return conf;
1007        }
1008        else if (irccmp(conf->name, name) == 0)
1009 <      {
1248 <          return (conf);
1249 <      }
1009 >        return conf;
1010      }
1011 +
1012      break;
1013  
1014    default:
1015      break;
1016    }
1017 <  return(NULL);
1017 >
1018 >  return NULL;
1019   }
1020  
1021   /* rehash()
# Line 1284 | Line 1046 | rehash(int sig)
1046    load_conf_modules();
1047  
1048    rehashed_klines = 1;
1287 /* XXX */
1288  if (ConfigLoggingEntry.use_logging)
1289    log_close_all();
1049  
1050 <  return(0);
1050 >  return 0;
1051   }
1052  
1053   /* set_default_conf()
# Line 1325 | Line 1084 | set_default_conf(void)
1084    ServerInfo.specific_ipv6_vhost = 0;
1085  
1086    ServerInfo.max_clients = MAXCLIENTS_MAX;
1087 +  ServerInfo.max_nick_length = 9;
1088 +  ServerInfo.max_topic_length = 80;
1089  
1090    ServerInfo.hub = 0;
1091    ServerInfo.dns_host.sin_addr.s_addr = 0;
# Line 1333 | Line 1094 | set_default_conf(void)
1094    AdminInfo.email = NULL;
1095    AdminInfo.description = NULL;
1096  
1097 <  log_close_all();
1097 >  log_del_all();
1098  
1099    ConfigLoggingEntry.use_logging = 1;
1100  
1101    ConfigChannel.disable_fake_channels = 0;
1341  ConfigChannel.restrict_channels = 0;
1102    ConfigChannel.knock_delay = 300;
1103    ConfigChannel.knock_delay_channel = 60;
1104    ConfigChannel.max_chans_per_user = 25;
1105    ConfigChannel.max_chans_per_oper = 50;
1346  ConfigChannel.quiet_on_ban = 1;
1106    ConfigChannel.max_bans = 25;
1107    ConfigChannel.default_split_user_count = 0;
1108    ConfigChannel.default_split_server_count = 0;
# Line 1354 | Line 1113 | set_default_conf(void)
1113    ConfigServerHide.links_delay = 300;
1114    ConfigServerHide.hidden = 0;
1115    ConfigServerHide.hide_servers = 0;
1116 +  ConfigServerHide.hide_services = 0;
1117    ConfigServerHide.hidden_name = xstrdup(NETWORK_NAME_DEFAULT);
1118    ConfigServerHide.hide_server_ips = 0;
1119 +  ConfigServerHide.disable_remote_commands = 0;
1120  
1121    
1122    ConfigFileEntry.service_name = xstrdup(SERVICE_NAME_DEFAULT);
1123    ConfigFileEntry.max_watch = WATCHSIZE_DEFAULT;
1124 +  ConfigFileEntry.cycle_on_host_change = 1;
1125    ConfigFileEntry.glines = 0;
1126    ConfigFileEntry.gline_time = 12 * 3600;
1127    ConfigFileEntry.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
# Line 1370 | Line 1132 | set_default_conf(void)
1132    ConfigFileEntry.hide_spoof_ips = 1;
1133    ConfigFileEntry.ignore_bogus_ts = 0;
1134    ConfigFileEntry.disable_auth = 0;
1373  ConfigFileEntry.disable_remote = 0;
1135    ConfigFileEntry.kill_chase_time_limit = 90;
1136    ConfigFileEntry.default_floodcount = 8;
1137    ConfigFileEntry.failed_oper_notice = 1;
# Line 1389 | Line 1150 | set_default_conf(void)
1150    ConfigFileEntry.stats_k_oper_only = 1;  /* masked */
1151    ConfigFileEntry.stats_i_oper_only = 1;  /* masked */
1152    ConfigFileEntry.stats_P_oper_only = 0;
1153 +  ConfigFileEntry.stats_u_oper_only = 0;
1154    ConfigFileEntry.caller_id_wait = 60;
1155    ConfigFileEntry.opers_bypass_callerid = 0;
1156    ConfigFileEntry.pace_wait = 10;
# Line 1441 | Line 1203 | read_conf(FILE *file)
1203  
1204    set_default_conf(); /* Set default values prior to conf parsing */
1205    conf_parser_ctx.pass = 1;
1206 <  yyparse();          /* pick up the classes first */
1206 >  yyparse();          /* pick up the classes first */
1207  
1208    rewind(file);
1209  
# Line 1457 | Line 1219 | read_conf(FILE *file)
1219   * start DNS lookups of all hostnames in the conf
1220   * line and convert an IP addresses in a.b.c.d number for to IP#s.
1221   */
1222 < static void
1222 > void
1223   lookup_confhost(struct MaskItem *conf)
1224   {
1225    struct addrinfo hints, *res;
1226  
1465  if (has_wildcards(conf->host))
1466  {
1467    ilog(LOG_TYPE_IRCD, "Host/server name error: (%s) (%s)",
1468         conf->host, conf->name);
1469    return;
1470  }
1471
1227    /* Do name lookup now on hostnames given and store the
1228     * ip numbers in conf structure.
1229     */
# Line 1528 | Line 1283 | conf_connect_allowed(struct irc_ssaddr *
1283    return 0;
1284   }
1285  
1531 static struct MaskItem *
1532 find_regexp_kline(const char *uhi[])
1533 {
1534 #ifdef HAVE_LIBPCRE
1535  const dlink_node *ptr = NULL;
1536
1537  DLINK_FOREACH(ptr, rkconf_items.head)
1538  {
1539    struct MaskItem *aptr = ptr->data;
1540
1541    assert(aptr->regexuser);
1542    assert(aptr->regexhost);
1543
1544    if (!ircd_pcre_exec(aptr->regexuser, uhi[0]) &&
1545        (!ircd_pcre_exec(aptr->regexhost, uhi[1]) ||
1546         !ircd_pcre_exec(aptr->regexhost, uhi[2])))
1547      return aptr;
1548  }
1549 #endif
1550  return NULL;
1551 }
1552
1553 /* find_kill()
1554 *
1555 * inputs       - pointer to client structure
1556 * output       - pointer to struct MaskItem if found
1557 * side effects - See if this user is klined already,
1558 *                and if so, return struct MaskItem pointer
1559 */
1560 struct MaskItem *
1561 find_kill(struct Client *client_p)
1562 {
1563  struct MaskItem *conf = NULL;
1564  const char *uhi[3];
1565
1566  uhi[0] = client_p->username;
1567  uhi[1] = client_p->host;
1568  uhi[2] = client_p->sockhost;
1569
1570  assert(client_p != NULL);
1571
1572  conf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
1573                              CONF_KLINE, client_p->localClient->aftype,
1574                              client_p->username, NULL, 1);
1575  if (conf == NULL)
1576    conf = find_regexp_kline(uhi);
1577
1578  return conf;
1579 }
1580
1581 struct MaskItem *
1582 find_gline(struct Client *client_p)
1583 {
1584  struct MaskItem *conf;
1585
1586  assert(client_p != NULL);
1587
1588  conf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
1589                              CONF_GLINE, client_p->localClient->aftype,
1590                              client_p->username, NULL, 1);
1591  return conf;
1592 }
1593
1286   /* cleanup_tklines()
1287   *
1288   * inputs       - NONE
# Line 1604 | Line 1296 | cleanup_tklines(void *notused)
1296    hostmask_expire_temporary();
1297    expire_tklines(&xconf_items);
1298    expire_tklines(&nresv_items);
1299 <  expire_tklines(&resv_channel_list);
1299 >  expire_tklines(&cresv_items);
1300   }
1301  
1302   /* expire_tklines()
# Line 1624 | Line 1316 | expire_tklines(dlink_list *tklist)
1316    {
1317      conf = ptr->data;
1318  
1319 <    if (!conf->hold || conf->hold > CurrentTime)
1319 >    if (!conf->until || conf->until > CurrentTime)
1320        continue;
1321  
1322      if (conf->type == CONF_XLINE)
# Line 1634 | Line 1326 | expire_tklines(dlink_list *tklist)
1326                                 "Temporary X-line for [%s] expired", conf->name);
1327        conf_free(conf);
1328      }
1329 <    else if (conf->type == CONF_NRESV)
1329 >    else if (conf->type == CONF_NRESV || conf->type == CONF_CRESV)
1330      {
1331        if (ConfigFileEntry.tkline_expire_notices)
1332          sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1333                                 "Temporary RESV for [%s] expired", conf->name);
1334        conf_free(conf);
1335      }
1644    else if (conf->type == CONF_CRESV)
1645    {
1646      if (ConfigFileEntry.tkline_expire_notices)
1647        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1648                               "Temporary RESV for [%s] expired", conf->name);
1649      delete_channel_resv(conf);
1650    }
1336    }
1337   }
1338  
# Line 1662 | Line 1347 | static const struct oper_privs
1347    const unsigned int flag;
1348    const unsigned char c;
1349   } flag_list[] = {
1350 <  { OPER_FLAG_ADMIN,       'A' },
1351 <  { OPER_FLAG_REMOTEBAN,   'B' },
1352 <  { OPER_FLAG_DIE,         'D' },
1353 <  { OPER_FLAG_GLINE,       'G' },
1354 <  { OPER_FLAG_REHASH,      'H' },
1355 <  { OPER_FLAG_K,           'K' },
1356 <  { OPER_FLAG_OPERWALL,    'L' },
1357 <  { OPER_FLAG_N,           'N' },
1358 <  { OPER_FLAG_GLOBAL_KILL, 'O' },
1359 <  { OPER_FLAG_REMOTE,      'R' },
1360 <  { OPER_FLAG_OPER_SPY,    'S' },
1361 <  { OPER_FLAG_UNKLINE,     'U' },
1362 <  { OPER_FLAG_X,           'X' },
1350 >  { OPER_FLAG_ADMIN,          'A' },
1351 >  { OPER_FLAG_REMOTEBAN,      'B' },
1352 >  { OPER_FLAG_DIE,            'D' },
1353 >  { OPER_FLAG_GLINE,          'G' },
1354 >  { OPER_FLAG_REHASH,         'H' },
1355 >  { OPER_FLAG_K,              'K' },
1356 >  { OPER_FLAG_OPERWALL,       'L' },
1357 >  { OPER_FLAG_KILL,           'N' },
1358 >  { OPER_FLAG_KILL_REMOTE,    'O' },
1359 >  { OPER_FLAG_CONNECT,        'P' },
1360 >  { OPER_FLAG_CONNECT_REMOTE, 'Q' },
1361 >  { OPER_FLAG_SQUIT,          'R' },
1362 >  { OPER_FLAG_SQUIT_REMOTE,   'S' },
1363 >  { OPER_FLAG_UNKLINE,        'U' },
1364 >  { OPER_FLAG_X,              'X' },
1365    { 0, '\0' }
1366   };
1367  
# Line 1719 | Line 1406 | get_oper_name(const struct Client *clien
1406  
1407        if (IsConfOperator(conf))
1408        {
1409 <        snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1409 >        snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1410                   client_p->username, client_p->host, conf->name);
1411 <        return buffer;
1411 >        return buffer;
1412        }
1413      }
1414  
# Line 1732 | Line 1419 | get_oper_name(const struct Client *clien
1419    }
1420  
1421    snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1422 <           client_p->username, client_p->host, client_p->servptr->name);
1422 >           client_p->username, client_p->host, client_p->servptr->name);
1423    return buffer;
1424   }
1425  
# Line 1771 | Line 1458 | read_conf_files(int cold)
1458      else
1459      {
1460        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1461 <                           "Unable to read configuration file '%s': %s",
1462 <                           filename, strerror(errno));
1461 >                           "Unable to read configuration file '%s': %s",
1462 >                           filename, strerror(errno));
1463        return;
1464      }
1465    }
# Line 1783 | Line 1470 | read_conf_files(int cold)
1470    read_conf(conf_parser_ctx.conf_file);
1471    fclose(conf_parser_ctx.conf_file);
1472  
1473 +  log_reopen_all();
1474 +
1475 +  add_isupport("NICKLEN", NULL, ServerInfo.max_nick_length);
1476    add_isupport("NETWORK", ServerInfo.network_name, -1);
1477 <  snprintf(chanmodes, sizeof(chanmodes), "beI:%d",
1478 <           ConfigChannel.max_bans);
1477 >
1478 >  snprintf(chanmodes, sizeof(chanmodes), "beI:%d", ConfigChannel.max_bans);
1479    add_isupport("MAXLIST", chanmodes, -1);
1480    add_isupport("MAXTARGETS", NULL, ConfigFileEntry.max_targets);
1791
1481    add_isupport("CHANTYPES", "#", -1);
1482  
1483    snprintf(chanlimit, sizeof(chanlimit), "#:%d",
1484 <           ConfigChannel.max_chans_per_user);
1484 >           ConfigChannel.max_chans_per_user);
1485    add_isupport("CHANLIMIT", chanlimit, -1);
1486 <  snprintf(chanmodes, sizeof(chanmodes), "%s",
1798 <           "beI,k,l,imnprstORS");
1486 >  snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,imnprstORS");
1487    add_isupport("CHANNELLEN", NULL, LOCAL_CHANNELLEN);
1488 <
1801 <  add_isupport("EXCEPTS", "e", -1);
1802 <  add_isupport("INVEX", "I", -1);
1488 >  add_isupport("TOPICLEN", NULL, ServerInfo.max_topic_length);
1489    add_isupport("CHANMODES", chanmodes, -1);
1490  
1491    /*
# Line 1822 | Line 1508 | clear_out_old_conf(void)
1508    struct MaskItem *conf;
1509    dlink_list *free_items [] = {
1510      &server_items,   &oconf_items,
1511 <     &uconf_items,   &xconf_items, &rxconf_items, &rkconf_items,
1512 <     &nresv_items, &cluster_items,  &service_items, NULL
1511 >     &uconf_items,   &xconf_items,
1512 >     &nresv_items, &cluster_items,  &service_items, &cresv_items, NULL
1513    };
1514  
1515    dlink_list ** iterator = free_items; /* C is dumb */
# Line 1844 | Line 1530 | clear_out_old_conf(void)
1530        if (conf->type == CONF_SERVER || conf->type == CONF_OPER)
1531        {
1532          if (!conf->ref_count)
1533 <          conf_free(conf);
1533 >          conf_free(conf);
1534        }
1535 <      else if (conf->type == CONF_XLINE  ||
1850 <               conf->type == CONF_RXLINE ||
1851 <               conf->type == CONF_RKLINE)
1535 >      else if (conf->type == CONF_XLINE)
1536        {
1537 <        if (!conf->hold)
1537 >        if (!conf->until)
1538            conf_free(conf);
1539        }
1540        else
# Line 1858 | Line 1542 | clear_out_old_conf(void)
1542      }
1543    }
1544  
1545 +  motd_clear();
1546 +
1547    /*
1548     * don't delete the class table, rather mark all entries
1549     * for deletion. The table is cleaned up by class_delete_marked. - avalon
# Line 1898 | Line 1584 | clear_out_old_conf(void)
1584                                                 SSL_OP_NO_TLSv1);
1585   #endif
1586  
1901  /* clean out old resvs from the conf */
1902  clear_conf_resv();
1903
1587    /* clean out AdminInfo */
1588    MyFree(AdminInfo.name);
1589    AdminInfo.name = NULL;
# Line 1915 | Line 1598 | clear_out_old_conf(void)
1598    /* clean out general */
1599    MyFree(ConfigFileEntry.service_name);
1600    ConfigFileEntry.service_name = NULL;
1918
1919  delete_isupport("INVEX");
1920  delete_isupport("EXCEPTS");
1601   }
1602  
1603   /* conf_add_class_to_conf()
# Line 1929 | Line 1609 | clear_out_old_conf(void)
1609   void
1610   conf_add_class_to_conf(struct MaskItem *conf, const char *class_name)
1611   {
1932  struct ClassItem *class = NULL;
1933
1612    if (class_name == NULL)
1613    {
1614      conf->class = class_default;
1615  
1616      if (conf->type == CONF_CLIENT)
1617        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1618 <                           "Warning *** Defaulting to default class for %s@%s",
1619 <                           conf->user, conf->host);
1618 >                           "Warning *** Defaulting to default class for %s@%s",
1619 >                           conf->user, conf->host);
1620      else
1621        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1622 <                           "Warning *** Defaulting to default class for %s",
1623 <                           conf->name);
1622 >                           "Warning *** Defaulting to default class for %s",
1623 >                           conf->name);
1624    }
1625    else
1626      conf->class = class_find(class_name, 1);
# Line 1951 | Line 1629 | conf_add_class_to_conf(struct MaskItem *
1629    {
1630      if (conf->type == CONF_CLIENT)
1631        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1632 <                           "Warning *** Defaulting to default class for %s@%s",
1633 <                           conf->user, conf->host);
1632 >                           "Warning *** Defaulting to default class for %s@%s",
1633 >                           conf->user, conf->host);
1634      else
1635        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1636 <                           "Warning *** Defaulting to default class for %s",
1637 <                           conf->name);
1636 >                           "Warning *** Defaulting to default class for %s",
1637 >                           conf->name);
1638      conf->class = class_default;
1639    }
1640   }
1641  
1964 /* conf_add_server()
1965 *
1966 * inputs       - pointer to config item
1967 *              - pointer to link count already on this conf
1968 * output       - NONE
1969 * side effects - Add a connect block
1970 */
1971 int
1972 conf_add_server(struct MaskItem *conf, const char *class_name)
1973 {
1974  conf_add_class_to_conf(conf, class_name);
1975
1976  if (EmptyString(conf->host) || EmptyString(conf->name))
1977  {
1978    sendto_realops_flags(UMODE_ALL, L_ALL,  SEND_NOTICE,
1979                         "Bad connect block");
1980    ilog(LOG_TYPE_IRCD, "Bad connect block");
1981    return -1;
1982  }
1983
1984  if (EmptyString(conf->passwd))
1985  {
1986    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1987                         "Bad connect block, name %s",
1988                         conf->name);
1989    ilog(LOG_TYPE_IRCD, "Bad connect block, host %s", conf->name);
1990    return -1;
1991  }
1992
1993  lookup_confhost(conf);
1994
1995  return 0;
1996 }
1997
1642   /* yyerror()
1643   *
1644   * inputs       - message from parser
# Line 2010 | Line 1654 | yyerror(const char *msg)
1654      return;
1655  
1656    strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1657 <  sendto_realops_flags(UMODE_ALL, L_ALL,  SEND_NOTICE,
1657 >  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1658 >                       "\"%s\", line %u: %s: %s",
1659 >                       conffilebuf, lineno + 1, msg, newlinebuf);
1660 >  ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
1661 >       conffilebuf, lineno + 1, msg, newlinebuf);
1662 > }
1663 >
1664 > void
1665 > conf_error_report(const char *msg)
1666 > {
1667 >  char newlinebuf[IRCD_BUFSIZE];
1668 >
1669 >  strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1670 >  sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1671                         "\"%s\", line %u: %s: %s",
1672                         conffilebuf, lineno + 1, msg, newlinebuf);
1673    ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
# Line 2028 | Line 1685 | yyerror(const char *msg)
1685   * Originally written by Dianora (Diane, db@db.net)
1686   */
1687   time_t
1688 < valid_tkline(const char *p, int minutes)
1688 > valid_tkline(const char *data, const int minutes)
1689   {
1690 +  const unsigned char *p = (const unsigned char *)data;
1691 +  unsigned char tmpch = '\0';
1692    time_t result = 0;
1693  
1694 <  for (; *p; ++p)
1694 >  while ((tmpch = *p++))
1695    {
1696 <    if (!IsDigit(*p))
1696 >    if (!IsDigit(tmpch))
1697        return 0;
1698  
1699      result *= 10;
1700 <    result += ((*p) & 0xF);
1700 >    result += (tmpch & 0xF);
1701    }
1702  
1703    /*
# Line 2054 | Line 1713 | valid_tkline(const char *p, int minutes)
1713     * of this calculation
1714     */
1715    if (!minutes)
1716 <    result = result / (time_t)60;
1716 >    result = result / 60;
1717  
1718    if (result > MAX_TDKLINE_TIME)
1719      result = MAX_TDKLINE_TIME;
1720  
1721 <  result = result * (time_t)60;  /* turn it into seconds */
1721 >  result = result * 60;  /* turn it into seconds */
1722  
1723    return result;
1724   }
1725  
1726 + /* valid_wild_card_simple()
1727 + *
1728 + * inputs       - data to check for sufficient non-wildcard characters
1729 + * outputs      - 1 if valid, else 0
1730 + * side effects - none
1731 + */
1732 + int
1733 + valid_wild_card_simple(const char *data)
1734 + {
1735 +  const unsigned char *p = (const unsigned char *)data;
1736 +  unsigned char tmpch = '\0';
1737 +  int nonwild = 0;
1738 +
1739 +  while ((tmpch = *p++))
1740 +  {
1741 +    if (tmpch == '\\')
1742 +    {
1743 +      ++p;
1744 +      if (++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
1745 +        return 1;
1746 +    }
1747 +    else if (!IsMWildChar(tmpch))
1748 +    {
1749 +      if (++nonwild >= ConfigFileEntry.min_nonwildcard_simple)
1750 +        return 1;
1751 +    }
1752 +  }
1753 +
1754 +  return 0;
1755 + }
1756 +
1757   /* valid_wild_card()
1758   *
1759   * input        - pointer to client
# Line 2075 | Line 1765 | valid_tkline(const char *p, int minutes)
1765   int
1766   valid_wild_card(struct Client *source_p, int warn, int count, ...)
1767   {
2078  char *p;
1768    char tmpch;
1769    int nonwild = 0;
1770    va_list args;
# Line 2096 | Line 1785 | valid_wild_card(struct Client *source_p,
1785  
1786    while (count--)
1787    {
1788 <    p = va_arg(args, char *);
1788 >    const char *p = va_arg(args, const char *);
1789      if (p == NULL)
1790        continue;
1791  
# Line 2152 | Line 1841 | valid_wild_card(struct Client *source_p,
1841   */
1842   int
1843   parse_aline(const char *cmd, struct Client *source_p,
1844 <            int parc, char **parv,
1845 <            int parse_flags, char **up_p, char **h_p, time_t *tkline_time,
1846 <            char **target_server, char **reason)
1844 >            int parc, char **parv,
1845 >            int parse_flags, char **up_p, char **h_p, time_t *tkline_time,
1846 >            char **target_server, char **reason)
1847   {
1848    int found_tkline_time=0;
1849    static char def_reason[] = "No Reason";
# Line 2176 | Line 1865 | parse_aline(const char *cmd, struct Clie
1865      else
1866      {
1867        sendto_one(source_p, ":%s NOTICE %s :temp_line not supported by %s",
1868 <                 me.name, source_p->name, cmd);
1868 >                 me.name, source_p->name, cmd);
1869        return -1;
1870      }
1871    }
# Line 2211 | Line 1900 | parse_aline(const char *cmd, struct Clie
1900  
1901        if (target_server == NULL)
1902        {
1903 <        sendto_one(source_p, ":%s NOTICE %s :ON server not supported by %s",
1904 <                   me.name, source_p->name, cmd);
1905 <        return -1;
1903 >        sendto_one(source_p, ":%s NOTICE %s :ON server not supported by %s",
1904 >                   me.name, source_p->name, cmd);
1905 >        return -1;
1906        }
1907  
1908        if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
# Line 2225 | Line 1914 | parse_aline(const char *cmd, struct Clie
1914  
1915        if (parc == 0 || EmptyString(*parv))
1916        {
1917 <        sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
1918 <                   me.name, source_p->name, cmd);
1919 <        return -1;
1917 >        sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
1918 >                   me.name, source_p->name, cmd);
1919 >        return -1;
1920        }
1921  
1922        *target_server = *parv;
# Line 2240 | Line 1929 | parse_aline(const char *cmd, struct Clie
1929         * caller probably NULL'd it first, but no harm to do it again -db
1930         */
1931        if (target_server != NULL)
1932 <        *target_server = NULL;
1932 >        *target_server = NULL;
1933      }
1934    }
1935  
# Line 2266 | Line 1955 | parse_aline(const char *cmd, struct Clie
1955      {
1956        *reason = *parv;
1957        if (!valid_comment(source_p, *reason, 1))
1958 <        return -1;
1958 >        return -1;
1959      }
1960      else
1961        *reason = def_reason;
# Line 2305 | Line 1994 | find_user_host(struct Client *source_p,
1994      {
1995        *(hostp++) = '\0';                       /* short and squat */
1996        if (*user_host_or_nick)
1997 <        strlcpy(luser, user_host_or_nick, USERLEN*4 + 1); /* here is my user */
1997 >        strlcpy(luser, user_host_or_nick, USERLEN*4 + 1); /* here is my user */
1998        else
1999 <        strcpy(luser, "*");
1999 >        strcpy(luser, "*");
2000 >
2001        if (*hostp)
2002 <        strlcpy(lhost, hostp, HOSTLEN + 1);    /* here is my host */
2002 >        strlcpy(lhost, hostp, HOSTLEN + 1);    /* here is my host */
2003        else
2004 <        strcpy(lhost, "*");
2004 >        strcpy(lhost, "*");
2005      }
2006      else
2007      {
2008        luser[0] = '*';             /* no @ found, assume its *@somehost */
2009 <      luser[1] = '\0';    
2009 >      luser[1] = '\0';
2010        strlcpy(lhost, user_host_or_nick, HOSTLEN*4 + 1);
2011      }
2012      
# Line 2327 | Line 2017 | find_user_host(struct Client *source_p,
2017      /* Try to find user@host mask from nick */
2018      /* Okay to use source_p as the first param, because source_p == client_p */
2019      if ((target_p =
2020 <        find_chasing(source_p, source_p, user_host_or_nick, NULL)) == NULL)
2020 >        find_chasing(source_p, user_host_or_nick, NULL)) == NULL)
2021        return 0;
2022  
2023      if (IsExemptKline(target_p))
2024      {
2025        if (!IsServer(source_p))
2026 <        sendto_one(source_p,
2027 <                   ":%s NOTICE %s :%s is E-lined",
2028 <                   me.name, source_p->name, target_p->name);
2026 >        sendto_one(source_p,
2027 >                   ":%s NOTICE %s :%s is E-lined",
2028 >                   me.name, source_p->name, target_p->name);
2029        return 0;
2030      }
2031  
# Line 2429 | Line 2119 | cluster_a_line(struct Client *source_p,
2119  
2120      if (conf->flags & cluster_type)
2121        sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab,
2122 <                         "%s %s %s", command, conf->name, buffer);
2122 >                         "%s %s %s", command, conf->name, buffer);
2123    }
2124   }
2125  
# Line 2480 | Line 2170 | split_nuh(struct split_nuh_item *const i
2170      if (iptr->nickptr && *iptr->nuhmask != '\0')
2171        strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize);
2172  
2173 <    if ((q = strchr(++p, '@'))) {
2173 >    if ((q = strchr(++p, '@')))
2174 >    {
2175        *q++ = '\0';
2176  
2177        if (*p != '\0')

Diff Legend

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