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 4012 by michael, Thu Jun 19 18:29:02 2014 UTC vs.
Revision 7007 by michael, Fri Jan 1 00:09:08 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 48 | Line 48 | list_accepts(struct Client *source_p)
48    int len = 0;
49    char nicks[IRCD_BUFSIZE] = "";
50    char *t = nicks;
51 <  const dlink_node *ptr = NULL;
51 >  const dlink_node *node = NULL;
52  
53 <  /* :me.name 281 source_p->name :n1!u1@h1 n2!u2@2 ...\r\n */
54 <  /* 1       23456              78                    9 10 */
53 >  /* :me.name 281 source_p->name :n1!u1@h1 n2!u2@h2 ...\r\n */
54 >  /* 1       23456              78                     9 10 */
55    len = strlen(me.name) + strlen(source_p->name) + 10;
56  
57 <  DLINK_FOREACH(ptr, source_p->localClient->acceptlist.head)
57 >  DLINK_FOREACH(node, source_p->connection->acceptlist.head)
58    {
59 <    const struct split_nuh_item *accept_p = ptr->data;
59 >    const struct split_nuh_item *accept_p = node->data;
60      size_t masklen = strlen(accept_p->nickptr) +
61                       strlen(accept_p->userptr) +
62 <                     strlen(accept_p->hostptr) + 2;  /* +2 for !@ */
62 >                     strlen(accept_p->hostptr) + 3;  /* +3 for ! + @ + space */
63  
64 <    if ((t - nicks) + masklen + len  > IRCD_BUFSIZE)
64 >    if ((t - nicks) + masklen + len > IRCD_BUFSIZE)
65      {
66        *(t - 1) = '\0';
67        sendto_one_numeric(source_p, &me, RPL_ACCEPTLIST, nicks);
# Line 91 | Line 91 | list_accepts(struct Client *source_p)
91   static void
92   add_accept(const struct split_nuh_item *nuh, struct Client *source_p)
93   {
94 <  struct split_nuh_item *accept_p = MyCalloc(sizeof(*accept_p));
94 >  struct split_nuh_item *const accept_p = MyCalloc(sizeof(*accept_p));
95  
96    accept_p->nickptr = xstrdup(nuh->nickptr);
97    accept_p->userptr = xstrdup(nuh->userptr);
98    accept_p->hostptr = xstrdup(nuh->hostptr);
99  
100 <  dlinkAdd(accept_p, &accept_p->node, &source_p->localClient->acceptlist);
100 >  dlinkAdd(accept_p, &accept_p->node, &source_p->connection->acceptlist);
101  
102    list_accepts(source_p);
103   }
# Line 116 | Line 116 | add_accept(const struct split_nuh_item *
116   static int
117   m_accept(struct Client *source_p, int parc, char *parv[])
118   {
119 <  char *mask = NULL;
120 <  char *p = NULL;
119 >  struct split_nuh_item nuh;
120 >  struct split_nuh_item *accept_p = NULL;
121    char nick[NICKLEN + 1] = "";
122    char user[USERLEN + 1] = "";
123    char host[HOSTLEN + 1] = "";
124 <  struct split_nuh_item nuh;
125 <  struct split_nuh_item *accept_p = NULL;
124 >  char *p = NULL;
125 >  char *mask = collapse(parv[1]);
126  
127 <  if (EmptyString(parv[1]) || !strcmp(parv[1], "*"))
127 >  if (EmptyString(mask) || !strcmp(mask, "*"))
128    {
129      list_accepts(source_p);
130      return 0;
131    }
132  
133 <  for (mask = strtoken(&p, parv[1], ","); mask;
134 <       mask = strtoken(&p,    NULL, ","))
133 >  for (mask = strtok_r(mask, ",", &p); mask;
134 >       mask = strtok_r(NULL, ",", &p))
135    {
136      if (*mask == '-' && *++mask)
137      {
# Line 156 | Line 156 | m_accept(struct Client *source_p, int pa
156      }
157      else if (*mask)
158      {
159 <      if (dlink_list_length(&source_p->localClient->acceptlist) >=
160 <          ConfigFileEntry.max_accept)
159 >      if (dlink_list_length(&source_p->connection->acceptlist) >=
160 >          ConfigGeneral.max_accept)
161        {
162          sendto_one_numeric(source_p, &me, ERR_ACCEPTFULL);
163          return 0;
# Line 189 | Line 189 | m_accept(struct Client *source_p, int pa
189  
190   static struct Message accept_msgtab =
191   {
192 <  "ACCEPT", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
193 <  { m_unregistered, m_accept, m_ignore, m_ignore, m_accept, m_ignore }
192 >  .cmd = "ACCEPT",
193 >  .args_max = MAXPARA,
194 >  .handlers[UNREGISTERED_HANDLER] = m_unregistered,
195 >  .handlers[CLIENT_HANDLER] = m_accept,
196 >  .handlers[SERVER_HANDLER] = m_ignore,
197 >  .handlers[ENCAP_HANDLER] = m_ignore,
198 >  .handlers[OPER_HANDLER] = m_accept
199   };
200  
201   static void
# Line 207 | Line 212 | module_exit(void)
212  
213   struct module module_entry =
214   {
210  .node    = { NULL, NULL, NULL },
211  .name    = NULL,
215    .version = "$Revision$",
213  .handle  = NULL,
216    .modinit = module_init,
217    .modexit = module_exit,
216  .flags   = 0
218   };

Diff Legend

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