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

Comparing ircd-hybrid/trunk/modules/m_encap.c (file contents):
Revision 4155 by michael, Wed Jul 2 18:24:06 2014 UTC vs.
Revision 9101 by michael, Wed Jan 1 09:58:45 2020 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 2003-2014 ircd-hybrid development team
4 > *  Copyright (c) 2003-2020 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 27 | Line 27
27   #include "stdinc.h"
28   #include "client.h"
29   #include "parse.h"
30 < #include "server.h"
30 > #include "server_capab.h"
31   #include "send.h"
32   #include "modules.h"
33   #include "irc_string.h"
# Line 40 | Line 40
40   * output       - none
41   * side effects - propagates subcommand to locally connected servers
42   */
43 < static int
43 > static void
44   ms_encap(struct Client *source_p, int parc, char *parv[])
45   {
46    char buffer[IRCD_BUFSIZE] = "", *ptr = buffer;
# Line 52 | Line 52 | ms_encap(struct Client *source_p, int pa
52  
53    for (i = 1; i < (unsigned int)parc - 1; ++i)
54    {
55 <    len = strlen(parv[i]) + 1;
55 >    len = strlen(parv[i]) + 1;  /* +1 for the space */
56  
57 +    /* Drop the whole command if this parameter would be truncated */
58      if ((cur_len + len) >= sizeof(buffer))
59 <      return 0;
59 >      return;
60  
61      snprintf(ptr, sizeof(buffer) - cur_len, "%s ", parv[i]);
62      cur_len += len;
# Line 68 | Line 69 | ms_encap(struct Client *source_p, int pa
69    else
70      snprintf(ptr, sizeof(buffer) - cur_len, ":%s", parv[parc - 1]);
71  
72 <  sendto_match_servs(source_p, parv[1], CAP_ENCAP,
72 >  sendto_match_servs(source_p, parv[1], CAPAB_ENCAP,
73                       "ENCAP %s", buffer);
74  
75    if (match(parv[1], me.name))
76 <    return 0;
76 >    return;
77  
78    if ((mptr = find_command(parv[2])) == NULL)
79 <    return 0;
79 >    return;
80  
81   #ifdef NOT_USED_YET
82    paramcount = mptr->parameters;
# Line 88 | Line 89 | ms_encap(struct Client *source_p, int pa
89  
90    if ((unsigned int)parc >= mptr->args_min)
91      mptr->handlers[ENCAP_HANDLER](source_p, parc, parv);
91  return 0;
92   }
93  
94   static struct Message encap_msgtab =
95   {
96 <  "ENCAP", 0, 0, 3, MAXPARA, MFLG_SLOW, 0,
97 <  { m_ignore, m_ignore, ms_encap, m_ignore, m_ignore, m_ignore }
96 >  .cmd = "ENCAP",
97 >  .args_min = 3,
98 >  .args_max = MAXPARA,
99 >  .handlers[UNREGISTERED_HANDLER] = m_ignore,
100 >  .handlers[CLIENT_HANDLER] = m_ignore,
101 >  .handlers[SERVER_HANDLER] = ms_encap,
102 >  .handlers[ENCAP_HANDLER] = m_ignore,
103 >  .handlers[OPER_HANDLER] = m_ignore
104   };
105  
106   static void
107   module_init(void)
108   {
109    mod_add_cmd(&encap_msgtab);
110 <  add_capability("ENCAP", CAP_ENCAP, 1);
110 >  capab_add("ENCAP", CAPAB_ENCAP);
111   }
112  
113   static void
114   module_exit(void)
115   {
116    mod_del_cmd(&encap_msgtab);
117 <  delete_capability("ENCAP");
117 >  capab_del("ENCAP");
118   }
119  
120   struct module module_entry =
121   {
116  .node    = { NULL, NULL, NULL },
117  .name    = NULL,
122    .version = "$Revision$",
119  .handle  = NULL,
123    .modinit = module_init,
124    .modexit = module_exit,
122  .flags   = 0
125   };

Diff Legend

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