ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_accept.c
(Generate patch)

Comparing ircd-hybrid/branches/8.2.x/modules/m_accept.c (file contents):
Revision 4546 by michael, Fri Aug 22 08:46:38 2014 UTC vs.
Revision 7686 by michael, Thu Aug 18 17:32:04 2016 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 2000-2014 ircd-hybrid development team
4 > *  Copyright (c) 2000-2016 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 15 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# Line 45 | Line 45
45   static void
46   list_accepts(struct Client *source_p)
47   {
48  int len = 0;
48    char nicks[IRCD_BUFSIZE] = "";
49    char *t = nicks;
50 <  const dlink_node *ptr = NULL;
50 >  dlink_node *node;
51  
52 <  /* :me.name 281 source_p->name :n1!u1@h1 n2!u2@h2 ...\r\n */
52 >  /* :me.name 281 source_p->name :n1!u1@h1 n2!u2@h2 ...\r\n */
53    /* 1       23456              78                     9 10 */
54 <  len = strlen(me.name) + strlen(source_p->name) + 10;
54 >  int len = strlen(me.name) + strlen(source_p->name) + 10;
55  
56 <  DLINK_FOREACH(ptr, source_p->localClient->acceptlist.head)
56 >  DLINK_FOREACH(node, source_p->connection->acceptlist.head)
57    {
58 <    const struct split_nuh_item *accept_p = ptr->data;
58 >    const struct split_nuh_item *accept_p = node->data;
59      size_t masklen = strlen(accept_p->nickptr) +
60                       strlen(accept_p->userptr) +
61                       strlen(accept_p->hostptr) + 3;  /* +3 for ! + @ + space */
# Line 91 | Line 90 | list_accepts(struct Client *source_p)
90   static void
91   add_accept(const struct split_nuh_item *nuh, struct Client *source_p)
92   {
93 <  struct split_nuh_item *accept_p = MyCalloc(sizeof(*accept_p));
93 >  struct split_nuh_item *const accept_p = xcalloc(sizeof(*accept_p));
94  
95    accept_p->nickptr = xstrdup(nuh->nickptr);
96    accept_p->userptr = xstrdup(nuh->userptr);
97    accept_p->hostptr = xstrdup(nuh->hostptr);
98  
99 <  dlinkAdd(accept_p, &accept_p->node, &source_p->localClient->acceptlist);
99 >  dlinkAdd(accept_p, &accept_p->node, &source_p->connection->acceptlist);
100  
101    list_accepts(source_p);
102   }
# Line 116 | Line 115 | add_accept(const struct split_nuh_item *
115   static int
116   m_accept(struct Client *source_p, int parc, char *parv[])
117   {
118 <  char *mask = NULL;
119 <  char *p = NULL;
118 >  struct split_nuh_item nuh;
119 >  struct split_nuh_item *accept_p = NULL;
120    char nick[NICKLEN + 1] = "";
121    char user[USERLEN + 1] = "";
122    char host[HOSTLEN + 1] = "";
123 <  struct split_nuh_item nuh;
124 <  struct split_nuh_item *accept_p = NULL;
123 >  char *p = NULL;
124 >  char *mask = collapse(parv[1]);
125  
126 <  if (EmptyString(parv[1]) || !strcmp(parv[1], "*"))
126 >  if (EmptyString(mask) || !strcmp(mask, "*"))
127    {
128      list_accepts(source_p);
129      return 0;
130    }
131  
132 <  for (mask = strtoken(&p, parv[1], ","); mask;
133 <       mask = strtoken(&p,    NULL, ","))
132 >  for (mask = strtok_r(mask, ",", &p); mask;
133 >       mask = strtok_r(NULL, ",", &p))
134    {
135      if (*mask == '-' && *++mask)
136      {
# Line 156 | Line 155 | m_accept(struct Client *source_p, int pa
155      }
156      else if (*mask)
157      {
158 <      if (dlink_list_length(&source_p->localClient->acceptlist) >=
158 >      if (dlink_list_length(&source_p->connection->acceptlist) >=
159            ConfigGeneral.max_accept)
160        {
161          sendto_one_numeric(source_p, &me, ERR_ACCEPTFULL);
# Line 189 | Line 188 | m_accept(struct Client *source_p, int pa
188  
189   static struct Message accept_msgtab =
190   {
191 <  "ACCEPT", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
192 <  { m_unregistered, m_accept, m_ignore, m_ignore, m_accept, m_ignore }
191 >  .cmd = "ACCEPT",
192 >  .args_max = MAXPARA,
193 >  .handlers[UNREGISTERED_HANDLER] = m_unregistered,
194 >  .handlers[CLIENT_HANDLER] = m_accept,
195 >  .handlers[SERVER_HANDLER] = m_ignore,
196 >  .handlers[ENCAP_HANDLER] = m_ignore,
197 >  .handlers[OPER_HANDLER] = m_accept
198   };
199  
200   static void
# Line 207 | Line 211 | module_exit(void)
211  
212   struct module module_entry =
213   {
210  .node    = { NULL, NULL, NULL },
211  .name    = NULL,
214    .version = "$Revision$",
213  .handle  = NULL,
215    .modinit = module_init,
216    .modexit = module_exit,
216  .flags   = 0
217   };

Diff Legend

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