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

Comparing ircd-hybrid/trunk/src/client.c (file contents):
Revision 3247 by michael, Sun Mar 30 17:54:34 2014 UTC vs.
Revision 4086 by michael, Sat Jun 28 16:44:20 2014 UTC

# Line 27 | Line 27
27   #include "stdinc.h"
28   #include "list.h"
29   #include "client.h"
30 #include "channel_mode.h"
30   #include "event.h"
32 #include "fdlist.h"
31   #include "hash.h"
32   #include "irc_string.h"
33   #include "ircd.h"
36 #include "s_gline.h"
34   #include "numeric.h"
35 < #include "packet.h"
39 < #include "s_auth.h"
35 > #include "auth.h"
36   #include "s_bsd.h"
37   #include "conf.h"
38   #include "log.h"
39 < #include "s_misc.h"
40 < #include "s_serv.h"
39 > #include "misc.h"
40 > #include "server.h"
41   #include "send.h"
42   #include "whowas.h"
43 < #include "s_user.h"
48 < #include "dbuf.h"
43 > #include "user.h"
44   #include "memory.h"
45   #include "mempool.h"
46   #include "hostmask.h"
47   #include "listener.h"
53 #include "irc_res.h"
48   #include "userhost.h"
49   #include "watch.h"
50   #include "rng_mt.h"
# Line 117 | Line 111 | make_client(struct Client *from)
111   {
112    struct Client *client_p = mp_pool_get(client_pool);
113  
120  memset(client_p, 0, sizeof(*client_p));
121
114    if (!from)
115    {
116      client_p->from                      = client_p; /* 'from' of local client is self! */
117      client_p->localClient               = mp_pool_get(lclient_pool);
126
127    memset(client_p->localClient, 0, sizeof(*client_p->localClient));
128
118      client_p->localClient->since        = CurrentTime;
119      client_p->localClient->lasttime     = CurrentTime;
120      client_p->localClient->firsttime    = CurrentTime;
# Line 163 | Line 152 | free_client(struct Client *client_p)
152    assert(client_p->channel.head == NULL);
153    assert(dlink_list_length(&client_p->channel) == 0);
154    assert(dlink_list_length(&client_p->whowas) == 0);
155 <  assert(!IsServer(client_p) || (IsServer(client_p) && client_p->serv));
155 >  assert(!IsServer(client_p) || client_p->serv);
156  
157    MyFree(client_p->serv);
158    MyFree(client_p->certfp);
# Line 340 | Line 329 | check_unknowns_list(void)
329   void
330   check_conf_klines(void)
331   {
343  struct Client *client_p = NULL;       /* current local client_p being examined */
332    struct MaskItem *conf = NULL;
333 <  dlink_node *ptr, *next_ptr;
333 >  dlink_node *ptr = NULL, *ptr_next = NULL;
334  
335 <  DLINK_FOREACH_SAFE(ptr, next_ptr, local_client_list.head)
335 >  DLINK_FOREACH_SAFE(ptr, ptr_next, local_client_list.head)
336    {
337 <    client_p = ptr->data;
337 >    struct Client *client_p = ptr->data;
338  
339      /* If a client is already being exited
340       */
341      if (IsDead(client_p) || !IsClient(client_p))
342        continue;
343  
344 <    if ((conf = find_dline_conf(&client_p->localClient->ip,
345 <                                  client_p->localClient->aftype)))
344 >    if ((conf = find_conf_by_address(NULL, &client_p->localClient->ip, CONF_DLINE,
345 >                                     client_p->localClient->aftype, NULL, NULL, 1)))
346      {
359      if (conf->type == CONF_EXEMPT)
360        continue;
361
347        conf_try_ban(client_p, conf);
348        continue; /* and go examine next fd/client_p */
349      }
# Line 392 | Line 377 | check_conf_klines(void)
377    }
378  
379    /* also check the unknowns list for new dlines */
380 <  DLINK_FOREACH_SAFE(ptr, next_ptr, unknown_list.head)
380 >  DLINK_FOREACH_SAFE(ptr, ptr_next, unknown_list.head)
381    {
382 <    client_p = ptr->data;
382 >    struct Client *client_p = ptr->data;
383  
384 <    if ((conf = find_dline_conf(&client_p->localClient->ip,
385 <                                 client_p->localClient->aftype)))
384 >    if ((conf = find_conf_by_address(NULL, &client_p->localClient->ip, CONF_DLINE,
385 >                                     client_p->localClient->aftype, NULL, NULL, 1)))
386      {
387 <      if (conf->type == CONF_EXEMPT)
388 <        continue;
404 <
405 <      exit_client(client_p, "D-lined");
387 >      conf_try_ban(client_p, conf);
388 >      continue; /* and go examine next fd/client_p */
389      }
390    }
391   }
# Line 439 | Line 422 | conf_try_ban(struct Client *client_p, st
422        type_string = kline_string;
423        break;
424      case CONF_DLINE:
425 +      if (find_conf_by_address(NULL, &client_p->localClient->ip, CONF_EXEMPT,
426 +                               client_p->localClient->aftype, NULL, NULL, 1))
427 +        return;
428        type_string = dline_string;
429        break;
430      case CONF_GLINE:
# Line 586 | Line 572 | get_client_name(const struct Client *cli
572    }
573  
574    if (ConfigFileEntry.hide_spoof_ips)
575 <    if (type == SHOW_IP && IsIPSpoof(client_p))
575 >    if (IsIPSpoof(client_p) && type == SHOW_IP)
576        type = MASK_IP;
577  
578    /* And finally, let's get the host information, ip or name */
# Line 789 | Line 775 | exit_client(struct Client *source_p, con
775        dlinkDelete(&source_p->localClient->lclient_node, &local_client_list);
776  
777        if (source_p->localClient->list_task)
778 <        free_list_task(source_p->localClient->list_task, source_p);
778 >        free_list_task(source_p);
779  
780        watch_del_watch_list(source_p);
781        sendto_realops_flags(UMODE_CCONN, L_ALL, SEND_NOTICE,
# Line 829 | Line 815 | exit_client(struct Client *source_p, con
815                   source_p->host, comment);
816      }
817  
832    /*
833    ** Currently only server connections can have
834    ** depending remote clients here, but it does no
835    ** harm to check for all local clients. In
836    ** future some other clients than servers might
837    ** have remotes too...
838    **
839    ** Close the Client connection first and mark it
840    ** so that no messages are attempted to send to it.
841    ** Remember it makes source_p->from == NULL.
842    */
818      close_connection(source_p);
819    }
820    else if (IsClient(source_p) && HasFlag(source_p->servptr, FLAGS_EOB))

Diff Legend

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