]>
Commit | Line | Data |
---|---|---|
65d0c6dd P |
1 | # HG changeset patch |
2 | # Parent e1de3d14c9df051e11288e8de6181e4989e3b138 | |
3 | ||
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 | |
7 | @@ -235,6 +235,12 @@ | |
8 | Compatibility: ircd does not include the <capacity> information. | |
9 | The <id> should be ignored: ircd sends 0 and ircu sends -1. | |
10 | ||
11 | +W - WEBIRC | |
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. | |
16 | + | |
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 | |
23 | @@ -146,6 +146,7 @@ | |
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 | |
34 | @@ -68,6 +68,11 @@ | |
35 | #define TOK_USER "USER" | |
36 | #define CMD_USER MSG_USER, TOK_USER | |
37 | ||
38 | +#define MSG_WEBIRC "WEBIRC" /* WEBI */ | |
39 | +#define TOK_WEBIRC "WEBIRC" | |
40 | +#define CMD_WEBIRC MSG_WEBIRC, TOK_WEBIRC | |
41 | + | |
42 | + | |
43 | #define MSG_NICK "NICK" /* NICK */ | |
44 | #define TOK_NICK "N" | |
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 | |
49 | @@ -32,9 +32,11 @@ | |
50 | struct Client; | |
51 | struct AuthRequest; | |
52 | struct StatDesc; | |
53 | +struct irc_in_addr; | |
54 | ||
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 | |
64 | @@ -188,6 +188,7 @@ | |
65 | m_wallops.c \ | |
66 | m_wallusers.c \ | |
67 | m_wallvoices.c \ | |
68 | + m_webirc.c \ | |
69 | m_who.c \ | |
70 | m_whois.c \ | |
71 | m_whowas.c \ | |
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 | |
75 | @@ -0,0 +1,125 @@ | |
76 | +/* | |
77 | + * IRC - Internet Relay Chat, ircd/m_webirc.c | |
78 | + * Copyright (C) 1990 Jarkko Oikarinen and | |
79 | + * University of Oulu, Computing Center | |
80 | + * | |
81 | + * See file AUTHORS in IRC package for additional names of | |
82 | + * the programmers. | |
83 | + * | |
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. | |
88 | + * | |
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. | |
93 | + * | |
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. | |
97 | + * | |
98 | + * $Id: m_webirc.c,v 1.25 2005/09/13 15:17:46 entrope Exp $ | |
99 | + */ | |
100 | + | |
101 | +/* | |
102 | + * m_functions execute protocol messages on this server: | |
103 | + * | |
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...). | |
109 | + * | |
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. | |
113 | + * | |
114 | + * (!IsServer(cptr)) => (cptr == sptr), because | |
115 | + * prefixes are taken *only* from servers... | |
116 | + * | |
117 | + * (IsServer(cptr)) | |
118 | + * (sptr == cptr) => the message didn't | |
119 | + * have the prefix. | |
120 | + * | |
121 | + * (sptr != cptr && IsServer(sptr) means | |
122 | + * the prefix specified servername. (?) | |
123 | + * | |
124 | + * (sptr != cptr && !IsServer(sptr) means | |
125 | + * that message originated from a remote | |
126 | + * user (not local). | |
127 | + * | |
128 | + * combining | |
129 | + * | |
130 | + * (!IsServer(sptr)) means that, sptr can safely | |
131 | + * taken as defining the target structure of the | |
132 | + * message in this server. | |
133 | + * | |
134 | + * *Always* true (if 'parse' and others are working correct): | |
135 | + * | |
136 | + * 1) sptr->from == cptr (note: cptr->from == cptr) | |
137 | + * | |
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 ] | |
142 | + * | |
143 | + * parc number of variable parameter strings (if zero, | |
144 | + * parv is allowed to be NULL) | |
145 | + * | |
146 | + * parv a NULL terminated list of parameter pointers, | |
147 | + * | |
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* | |
153 | + * | |
154 | + * note: it is guaranteed that parv[0]..parv[parc-1] are all | |
155 | + * non-NULL pointers. | |
156 | + */ | |
157 | +#include "config.h" | |
158 | + | |
159 | +#include "channel.h" | |
160 | +#include "client.h" | |
161 | +#include "hash.h" | |
162 | +#include "ircd.h" | |
163 | +#include "ircd_features.h" | |
164 | +#include "ircd_log.h" | |
165 | +#include "ircd_reply.h" | |
166 | +#include "ircd_string.h" | |
167 | +#include "list.h" | |
168 | +#include "msg.h" | |
169 | +#include "numeric.h" | |
170 | +#include "numnicks.h" | |
171 | +#include "s_user.h" | |
172 | +#include "s_auth.h" | |
173 | +#include "s_misc.h" | |
174 | +#include "send.h" | |
175 | +#include "struct.h" | |
176 | + | |
177 | +/* #include <assert.h> -- Now using assert in ircd_log.h */ | |
178 | + | |
179 | +/* | |
180 | + * ms_webirc - server message handler | |
181 | + * | |
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 | |
187 | + * | |
188 | + */ | |
189 | +int m_webirc(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) | |
190 | +{ | |
191 | + struct irc_in_addr ip; | |
192 | + | |
193 | + if (parc < 5 || EmptyString(parv[4])) | |
194 | + return need_more_params(sptr,"WEBIRC"); | |
195 | + | |
196 | + if (!ircd_aton(&ip, parv[4])) | |
197 | + return exit_client(cptr, cptr, &me, "Invalid IP address specified for WEBIRC"); | |
198 | + | |
199 | + return auth_set_webirc(cli_auth(cptr), parv[1], parv[2], parv[3], &ip); | |
200 | +} | |
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 | |
204 | @@ -282,6 +282,13 @@ | |
205 | { m_user, m_registered, m_ignore, m_registered, m_ignore } | |
206 | }, | |
207 | { | |
208 | + MSG_WEBIRC, | |
209 | + TOK_WEBIRC, | |
210 | + 0, MAXPARA, MFLG_SLOW, 0, NULL, | |
211 | + /* UNREG, CLIENT, SERVER, OPER, SERVICE */ | |
212 | + { m_webirc, m_registered, m_ignore, m_registered, m_ignore } | |
213 | + }, | |
214 | + { | |
215 | MSG_AWAY, | |
216 | TOK_AWAY, | |
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); | |
223 | } | |
224 | ||
225 | +int auth_set_webirc(struct AuthRequest *auth, const char *password, const char *username, const char *hostname, struct irc_in_addr *ip) | |
226 | +{ | |
227 | + struct Client *cptr; | |
228 | + | |
229 | + assert(auth != NULL); | |
230 | + | |
231 | + cptr = auth->client; | |
232 | + | |
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"); | |
235 | + | |
236 | + if (IAuthHas(iauth, IAUTH_UNDERNET)) | |
237 | + sendto_iauth(cptr, "W %s %s %s %s", password, username, hostname, ircd_ntoa(ip)); | |
238 | + | |
239 | + return 0; | |
240 | +} | |
241 | + | |
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. |