~ubuntu-branches/debian/sid/ircd-hybrid/sid

« back to all changes in this revision

Viewing changes to src/resv.c

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2015-04-19 15:53:09 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20150419155309-06y59x2at2ax5ou3
Tags: 1:8.2.7+dfsg.1-1
* Remove Suggests: hybserv since it doesn't really work with
  ircd-hybrid 8 and above
* New upstream release
  - update debian/copyright with minor changes
  - update config files from new reference.conf
  - fixes DoS from localhost clients (Closes: #782859)
  - supports SSL certficate chaining (Closes: #769741)
* Debconf configuration script no longer ignores the result of
  upgrade questions (Closes: #779082)
* Don't display upgrade warnings on new installs (Closes: #782883)
* Add NEWS item about updated configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3
3
 *
4
 
 *  Copyright (c) 2001-2014 ircd-hybrid development team
 
4
 *  Copyright (c) 2001-2015 ircd-hybrid development team
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
 
22
22
/*! \file resv.c
23
23
 * \brief Functions to reserve(jupe) a nick/channel.
24
 
 * \version $Id: resv.c 4564 2014-08-24 10:24:47Z michael $
 
24
 * \version $Id: resv.c 5346 2015-01-11 12:41:14Z michael $
25
25
 */
26
26
 
27
27
#include "stdinc.h"
53
53
struct MaskItem *
54
54
create_resv(const char *name, const char *reason, const dlink_list *list)
55
55
{
56
 
  dlink_node *ptr = NULL;
 
56
  dlink_node *node = NULL;
57
57
  struct MaskItem *conf = NULL;
58
58
  enum maskitem_type type;
59
59
 
74
74
 
75
75
  if (list)
76
76
  {
77
 
    DLINK_FOREACH(ptr, list->head)
 
77
    DLINK_FOREACH(node, list->head)
78
78
    {
79
79
      char nick[NICKLEN + 1];
80
80
      char user[USERLEN + 1];
81
81
      char host[HOSTLEN + 1];
82
82
      struct split_nuh_item nuh;
83
83
      struct exempt *exptr = NULL;
84
 
      char *s = ptr->data;
 
84
      char *s = node->data;
85
85
 
86
86
      if (strlen(s) == 2 && IsAlpha(*(s + 1) && IsAlpha(*(s + 2))))
87
87
      {
88
88
#ifdef HAVE_LIBGEOIP
89
89
        exptr = MyCalloc(sizeof(*exptr));
90
90
        exptr->name = xstrdup(s);
91
 
        exptr->coid = GeoIP_id_by_code(s);
 
91
        exptr->country_id = GeoIP_id_by_code(s);
92
92
        dlinkAdd(exptr, &exptr->node, &conf->exempt_list);
93
93
#endif
94
94
      }
121
121
int
122
122
resv_find_exempt(const struct Client *who, const struct MaskItem *conf)
123
123
{
124
 
  const dlink_node *ptr = NULL;
 
124
  const dlink_node *node = NULL;
125
125
 
126
 
  DLINK_FOREACH(ptr, conf->exempt_list.head)
 
126
  DLINK_FOREACH(node, conf->exempt_list.head)
127
127
  {
128
 
    const struct exempt *exptr = ptr->data;
 
128
    const struct exempt *exptr = node->data;
129
129
 
130
 
    if (exptr->coid)
 
130
    if (exptr->country_id)
131
131
    {
132
 
      if (exptr->coid == who->localClient->country_id)
 
132
      if (exptr->country_id == who->connection->country_id)
133
133
        return 1;
134
134
    }
135
135
    else if (!match(exptr->name, who->name) && !match(exptr->user, who->username))
141
141
            return 1;
142
142
          break;
143
143
        case HM_IPV4:
144
 
          if (who->localClient->aftype == AF_INET)
145
 
            if (match_ipv4(&who->localClient->ip, &exptr->addr, exptr->bits))
 
144
          if (who->connection->aftype == AF_INET)
 
145
            if (match_ipv4(&who->connection->ip, &exptr->addr, exptr->bits))
146
146
              return 1;
147
147
          break;
148
148
        case HM_IPV6:
149
 
          if (who->localClient->aftype == AF_INET6)
150
 
            if (match_ipv6(&who->localClient->ip, &exptr->addr, exptr->bits))
 
149
          if (who->connection->aftype == AF_INET6)
 
150
            if (match_ipv6(&who->connection->ip, &exptr->addr, exptr->bits))
151
151
              return 1;
152
152
          break;
153
153
        default:
169
169
struct MaskItem *
170
170
match_find_resv(const char *name)
171
171
{
172
 
  dlink_node *ptr = NULL;
 
172
  dlink_node *node = NULL;
173
173
 
174
174
  if (EmptyString(name))
175
175
    return NULL;
176
176
 
177
 
  DLINK_FOREACH(ptr, cresv_items.head)
 
177
  DLINK_FOREACH(node, cresv_items.head)
178
178
  {
179
 
    struct MaskItem *conf = ptr->data;
 
179
    struct MaskItem *conf = node->data;
180
180
 
181
181
    if (!match(conf->name, name))
182
182
      return conf;