/[svn]/ircd-hybrid/branches/8.2.x/modules/m_version.c
ViewVC logotype

Contents of /ircd-hybrid/branches/8.2.x/modules/m_version.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7329 - (show annotations)
Thu Feb 18 21:07:50 2016 UTC (6 years, 11 months ago) by michael
File MIME type: text/x-chdr
File size: 3837 byte(s)
- Now that we got time_t to work nicely on openbsd with snprintf's conversion specifiers,
  we ran into a similiar issue on Raspbian/ARMv7's time_t which is of signed 32 bit and
  doesn't cope at all with %j. Instead of doing tricks, get rid of time_t everywhere and
  forever and use uintmax_t instead which has at least a 'standardized' conversion specifier
  associated with it.

1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-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
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file m_version.c
23 * \brief Includes required functions for processing the VERSION command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "client.h"
29 #include "ircd.h"
30 #include "numeric.h"
31 #include "conf.h"
32 #include "server.h"
33 #include "user.h"
34 #include "send.h"
35 #include "parse.h"
36 #include "modules.h"
37 #include "isupport.h"
38
39
40 /* Option string. */
41 static const char serveropts[] =
42 {
43 'T',
44 'S',
45 #ifdef TS_CURRENT
46 '0' + TS_CURRENT,
47 #endif
48 /* ONLY do TS */
49 /* ALWAYS do TS_WARNINGS */
50 'o',
51 'w',
52 '\0'
53 };
54
55 /*! \brief VERSION command handler
56 *
57 * \param source_p Pointer to allocated Client struct from which the message
58 * originally comes from. This can be a local or remote client.
59 * \param parc Integer holding the number of supplied arguments.
60 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
61 * pointers.
62 * \note Valid arguments for this command are:
63 * - parv[0] = command
64 * - parv[1] = nickname/servername
65 */
66 static int
67 m_version(struct Client *source_p, int parc, char *parv[])
68 {
69 static uintmax_t last_used = 0;
70
71 if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
72 {
73 sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "VERSION");
74 return 0;
75 }
76
77 last_used = CurrentTime;
78
79 if (!ConfigServerHide.disable_remote_commands)
80 if (hunt_server(source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
81 return 0;
82
83 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
84 me.name, serveropts);
85 isupport_show(source_p);
86 return 0;
87 }
88
89 /*! \brief VERSION command handler
90 *
91 * \param source_p Pointer to allocated Client struct from which the message
92 * originally comes from. This can be a local or remote client.
93 * \param parc Integer holding the number of supplied arguments.
94 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
95 * pointers.
96 * \note Valid arguments for this command are:
97 * - parv[0] = command
98 * - parv[1] = nickname/servername
99 */
100 static int
101 ms_version(struct Client *source_p, int parc, char *parv[])
102 {
103 if (hunt_server(source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
104 return 0;
105
106 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
107 me.name, serveropts);
108 isupport_show(source_p);
109 return 0;
110 }
111
112 static struct Message version_msgtab =
113 {
114 .cmd = "VERSION",
115 .args_max = MAXPARA,
116 .handlers[UNREGISTERED_HANDLER] = m_unregistered,
117 .handlers[CLIENT_HANDLER] = m_version,
118 .handlers[SERVER_HANDLER] = ms_version,
119 .handlers[ENCAP_HANDLER] = m_ignore,
120 .handlers[OPER_HANDLER] = ms_version
121 };
122
123 static void
124 module_init(void)
125 {
126 mod_add_cmd(&version_msgtab);
127 }
128
129 static void
130 module_exit(void)
131 {
132 mod_del_cmd(&version_msgtab);
133 }
134
135 struct module module_entry =
136 {
137 .version = "$Revision$",
138 .modinit = module_init,
139 .modexit = module_exit,
140 };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28