2 # Parent e1de3d14c9df051e11288e8de6181e4989e3b138
4 diff -r e1de3d14c9df doc/readme.iauth
5 --- a/doc/readme.iauth Sat Jul 20 09:18:24 2013 +0200
6 +++ b/doc/readme.iauth Sat Jul 20 09:23:57 2013 +0200
8 Compatibility: ircd does not include the <capacity> information.
9 The <id> should be ignored: ircd sends 0 and ircu sends -1.
12 +Syntax: <id> W <password> <username> <hostname> <ip>
13 +Comments: Indicates the client's webirc information. This is an
14 + Undernet extension and ircd does not send it. It is enabled by the
15 + iauth instance requesting the U policy.
17 X - Extension Query Reply
18 Syntax: <id> X <servername> <routing> :<reply>
19 Example: -1 X channels.undernet.org 5/127.0.0.1/6667 :OK kev Logged in
20 diff -r e1de3d14c9df include/handlers.h
21 --- a/include/handlers.h Sat Jul 20 09:18:24 2013 +0200
22 +++ b/include/handlers.h Sat Jul 20 09:23:57 2013 +0200
24 extern int m_unregistered(struct Client*, struct Client*, int, char*[]);
25 extern int m_unsupported(struct Client*, struct Client*, int, char*[]);
26 extern int m_user(struct Client*, struct Client*, int, char*[]);
27 +extern int m_webirc(struct Client*, struct Client*, int, char*[]);
28 extern int m_userhost(struct Client*, struct Client*, int, char*[]);
29 extern int m_userip(struct Client*, struct Client*, int, char*[]);
30 extern int m_version(struct Client*, struct Client*, int, char*[]);
31 diff -r e1de3d14c9df include/msg.h
32 --- a/include/msg.h Sat Jul 20 09:18:24 2013 +0200
33 +++ b/include/msg.h Sat Jul 20 09:23:57 2013 +0200
35 #define TOK_USER "USER"
36 #define CMD_USER MSG_USER, TOK_USER
38 +#define MSG_WEBIRC "WEBIRC" /* WEBI */
39 +#define TOK_WEBIRC "WEBIRC"
40 +#define CMD_WEBIRC MSG_WEBIRC, TOK_WEBIRC
43 #define MSG_NICK "NICK" /* NICK */
45 #define CMD_NICK MSG_NICK, TOK_NICK
46 diff -r e1de3d14c9df include/s_auth.h
47 --- a/include/s_auth.h Sat Jul 20 09:18:24 2013 +0200
48 +++ b/include/s_auth.h Sat Jul 20 09:23:57 2013 +0200
55 extern void start_auth(struct Client *);
56 extern int auth_ping_timeout(struct Client *);
57 +extern int auth_set_webirc(struct AuthRequest *auth, const char *password, const char *username, const char *hostname, struct irc_in_addr *ip);
58 extern int auth_set_pong(struct AuthRequest *auth, unsigned int cookie);
59 extern int auth_set_user(struct AuthRequest *auth, const char *username, const char *hostname, const char *servername, const char *userinfo);
60 extern int auth_set_nick(struct AuthRequest *auth, const char *nickname);
61 diff -r e1de3d14c9df ircd/Makefile.in
62 --- a/ircd/Makefile.in Sat Jul 20 09:18:24 2013 +0200
63 +++ b/ircd/Makefile.in Sat Jul 20 09:23:57 2013 +0200
72 diff -r e1de3d14c9df ircd/m_webirc.c
73 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74 +++ b/ircd/m_webirc.c Sat Jul 20 09:23:57 2013 +0200
77 + * IRC - Internet Relay Chat, ircd/m_webirc.c
78 + * Copyright (C) 1990 Jarkko Oikarinen and
79 + * University of Oulu, Computing Center
81 + * See file AUTHORS in IRC package for additional names of
84 + * This program is free software; you can redistribute it and/or modify
85 + * it under the terms of the GNU General Public License as published by
86 + * the Free Software Foundation; either version 1, or (at your option)
87 + * any later version.
89 + * This program is distributed in the hope that it will be useful,
90 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
91 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92 + * GNU General Public License for more details.
94 + * You should have received a copy of the GNU General Public License
95 + * along with this program; if not, write to the Free Software
96 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
98 + * $Id: m_webirc.c,v 1.25 2005/09/13 15:17:46 entrope Exp $
102 + * m_functions execute protocol messages on this server:
104 + * cptr is always NON-NULL, pointing to a *LOCAL* client
105 + * structure (with an open socket connected!). This
106 + * identifies the physical socket where the message
107 + * originated (or which caused the m_function to be
108 + * executed--some m_functions may call others...).
110 + * sptr is the source of the message, defined by the
111 + * prefix part of the message if present. If not
112 + * or prefix not found, then sptr==cptr.
114 + * (!IsServer(cptr)) => (cptr == sptr), because
115 + * prefixes are taken *only* from servers...
118 + * (sptr == cptr) => the message didn't
121 + * (sptr != cptr && IsServer(sptr) means
122 + * the prefix specified servername. (?)
124 + * (sptr != cptr && !IsServer(sptr) means
125 + * that message originated from a remote
126 + * user (not local).
130 + * (!IsServer(sptr)) means that, sptr can safely
131 + * taken as defining the target structure of the
132 + * message in this server.
134 + * *Always* true (if 'parse' and others are working correct):
136 + * 1) sptr->from == cptr (note: cptr->from == cptr)
138 + * 2) MyConnect(sptr) <=> sptr == cptr (e.g. sptr
139 + * *cannot* be a local connection, unless it's
140 + * actually cptr!). [MyConnect(x) should probably
141 + * be defined as (x == x->from) --msa ]
143 + * parc number of variable parameter strings (if zero,
144 + * parv is allowed to be NULL)
146 + * parv a NULL terminated list of parameter pointers,
148 + * parv[0], sender (prefix string), if not present
149 + * this points to an empty string.
150 + * parv[1]...parv[parc-1]
151 + * pointers to additional parameters
152 + * parv[parc] == NULL, *always*
154 + * note: it is guaranteed that parv[0]..parv[parc-1] are all
155 + * non-NULL pointers.
159 +#include "channel.h"
163 +#include "ircd_features.h"
164 +#include "ircd_log.h"
165 +#include "ircd_reply.h"
166 +#include "ircd_string.h"
169 +#include "numeric.h"
170 +#include "numnicks.h"
177 +/* #include <assert.h> -- Now using assert in ircd_log.h */
180 + * ms_webirc - server message handler
182 + * parv[0] - sender prefix
183 + * parv[1] - password
184 + * parv[2] - fake username
185 + * parv[3] - fake hostname
186 + * parv[4] - fake ip address
189 +int m_webirc(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
191 + struct irc_in_addr ip;
193 + if (parc < 5 || EmptyString(parv[4]))
194 + return need_more_params(sptr,"WEBIRC");
196 + if (!ircd_aton(&ip, parv[4]))
197 + return exit_client(cptr, cptr, &me, "Invalid IP address specified for WEBIRC");
199 + return auth_set_webirc(cli_auth(cptr), parv[1], parv[2], parv[3], &ip);
201 diff -r e1de3d14c9df ircd/parse.c
202 --- a/ircd/parse.c Sat Jul 20 09:18:24 2013 +0200
203 +++ b/ircd/parse.c Sat Jul 20 09:23:57 2013 +0200
205 { m_user, m_registered, m_ignore, m_registered, m_ignore }
210 + 0, MAXPARA, MFLG_SLOW, 0, NULL,
211 + /* UNREG, CLIENT, SERVER, OPER, SERVICE */
212 + { m_webirc, m_registered, m_ignore, m_registered, m_ignore }
217 0, MAXPARA, MFLG_SLOW, 0, NULL,
218 diff -r e1de3d14c9df ircd/s_auth.c
219 --- a/ircd/s_auth.c Sat Jul 20 09:18:24 2013 +0200
220 +++ b/ircd/s_auth.c Sat Jul 20 09:23:57 2013 +0200
221 @@ -1041,6 +1041,23 @@
222 return check_auth_finished(auth);
225 +int auth_set_webirc(struct AuthRequest *auth, const char *password, const char *username, const char *hostname, struct irc_in_addr *ip)
227 + struct Client *cptr;
229 + assert(auth != NULL);
231 + cptr = auth->client;
233 + if (!FlagHas(&auth->flags, AR_NEEDS_NICK) || !FlagHas(&auth->flags, AR_NEEDS_USER))
234 + return exit_client(cptr, cptr, &me, "WEBIRC must not be used after USER or NICK");
236 + if (IAuthHas(iauth, IAUTH_UNDERNET))
237 + sendto_iauth(cptr, "W %s %s %s %s", password, username, hostname, ircd_ntoa(ip));
242 /** Record a user's claimed username and userinfo.
243 * @param[in] auth Authorization request for client.
244 * @param[in] username Client's asserted username.