34 |
|
#include "ircd_defs.h" |
35 |
|
#include "dbuf.h" |
36 |
|
#include "channel.h" |
37 |
+ |
#include "s_auth.h" |
38 |
|
|
39 |
|
/* |
40 |
|
* status macros. |
101 |
|
#define HasCap(x, y) ((x)->localClient->cap_active & (y)) |
102 |
|
|
103 |
|
/* housekeeping flags */ |
104 |
< |
#define FLAGS_PINGSENT 0x00000001 /**< Unreplied ping sent */ |
105 |
< |
#define FLAGS_DEADSOCKET 0x00000002 /**< Local socket is dead--Exiting soon */ |
106 |
< |
#define FLAGS_KILLED 0x00000004 /**< Prevents "QUIT" from being sent for this */ |
107 |
< |
#define FLAGS_CLOSING 0x00000008 /**< set when closing to suppress errors */ |
108 |
< |
#define FLAGS_GOTID 0x00000010 /**< successful ident lookup achieved */ |
109 |
< |
#define FLAGS_NEEDID 0x00000020 /**< auth{} block say must use ident return */ |
110 |
< |
#define FLAGS_SENDQEX 0x00000040 /**< Sendq exceeded */ |
111 |
< |
#define FLAGS_IPHASH 0x00000080 /**< iphashed this client */ |
112 |
< |
#define FLAGS_MARK 0x00000100 /**< marked client */ |
113 |
< |
#define FLAGS_CANFLOOD 0x00000200 /**< client has the ability to flood */ |
114 |
< |
#define FLAGS_EXEMPTGLINE 0x00000400 /**< client can't be G-lined */ |
115 |
< |
#define FLAGS_EXEMPTKLINE 0x00000800 /**< client is exempt from kline */ |
116 |
< |
#define FLAGS_NOLIMIT 0x00001000 /**< client is exempt from limits */ |
117 |
< |
#define FLAGS_PING_COOKIE 0x00002000 /**< PING Cookie */ |
118 |
< |
#define FLAGS_IP_SPOOFING 0x00004000 /**< client IP is spoofed */ |
119 |
< |
#define FLAGS_FLOODDONE 0x00008000 /**< Flood grace period has been ended. */ |
120 |
< |
#define FLAGS_EOB 0x00010000 /**< server has sent us an EOB */ |
121 |
< |
#define FLAGS_HIDDEN 0x00020000 /**< a hidden server. not shown in /links */ |
122 |
< |
#define FLAGS_BLOCKED 0x00040000 /**< must wait for COMM_SELECT_WRITE */ |
123 |
< |
#define FLAGS_USERHOST 0x00080000 /**< client is in userhost hash */ |
124 |
< |
#define FLAGS_BURSTED 0x00100000 /**< user was already bursted */ |
125 |
< |
#define FLAGS_EXEMPTRESV 0x00200000 /**< client is exempt from RESV */ |
126 |
< |
#define FLAGS_GOTUSER 0x00400000 /**< if we received a USER command */ |
127 |
< |
#define FLAGS_FINISHED_AUTH 0x00800000 /**< Client has been released from auth */ |
128 |
< |
#define FLAGS_FLOOD_NOTICED 0x01000000 /**< Notice to opers about this flooder has been sent */ |
129 |
< |
#define FLAGS_SERVICE 0x02000000 /**< Client/server is a network service */ |
104 |
> |
#define FLAGS_PINGSENT 0x00000001 /**< Unreplied ping sent */ |
105 |
> |
#define FLAGS_DEADSOCKET 0x00000002 /**< Local socket is dead--Exiting soon */ |
106 |
> |
#define FLAGS_KILLED 0x00000004 /**< Prevents "QUIT" from being sent for this */ |
107 |
> |
#define FLAGS_CLOSING 0x00000008 /**< set when closing to suppress errors */ |
108 |
> |
#define FLAGS_GOTID 0x00000010 /**< successful ident lookup achieved */ |
109 |
> |
#define FLAGS_NEEDID 0x00000020 /**< auth{} block say must use ident return */ |
110 |
> |
#define FLAGS_SENDQEX 0x00000040 /**< Sendq exceeded */ |
111 |
> |
#define FLAGS_IPHASH 0x00000080 /**< iphashed this client */ |
112 |
> |
#define FLAGS_MARK 0x00000100 /**< marked client */ |
113 |
> |
#define FLAGS_CANFLOOD 0x00000200 /**< client has the ability to flood */ |
114 |
> |
#define FLAGS_EXEMPTGLINE 0x00000400 /**< client can't be G-lined */ |
115 |
> |
#define FLAGS_EXEMPTKLINE 0x00000800 /**< client is exempt from kline */ |
116 |
> |
#define FLAGS_NOLIMIT 0x00001000 /**< client is exempt from limits */ |
117 |
> |
#define FLAGS_PING_COOKIE 0x00002000 /**< PING Cookie */ |
118 |
> |
#define FLAGS_IP_SPOOFING 0x00004000 /**< client IP is spoofed */ |
119 |
> |
#define FLAGS_FLOODDONE 0x00008000 /**< Flood grace period has been ended. */ |
120 |
> |
#define FLAGS_EOB 0x00010000 /**< server has sent us an EOB */ |
121 |
> |
#define FLAGS_HIDDEN 0x00020000 /**< a hidden server. not shown in /links */ |
122 |
> |
#define FLAGS_BLOCKED 0x00040000 /**< must wait for COMM_SELECT_WRITE */ |
123 |
> |
#define FLAGS_USERHOST 0x00080000 /**< client is in userhost hash */ |
124 |
> |
#define FLAGS_BURSTED 0x00100000 /**< user was already bursted */ |
125 |
> |
#define FLAGS_EXEMPTRESV 0x00200000 /**< client is exempt from RESV */ |
126 |
> |
#define FLAGS_GOTUSER 0x00400000 /**< if we received a USER command */ |
127 |
> |
#define FLAGS_FINISHED_AUTH 0x00800000 /**< Client has been released from auth */ |
128 |
> |
#define FLAGS_FLOOD_NOTICED 0x01000000 /**< Notice to opers about this flooder has been sent */ |
129 |
> |
#define FLAGS_SERVICE 0x02000000 /**< Client/server is a network service */ |
130 |
> |
#define FLAGS_AUTH_SPOOF 0x04000000 /**< user's hostname has been spoofed by an auth{} spoof*/ |
131 |
> |
#define FLAGS_SSL 0x08000000 /**< User is connected via TLS/SSL */ |
132 |
|
|
133 |
|
#define HasFlag(x, y) ((x)->flags & (y)) |
134 |
|
#define AddFlag(x, y) ((x)->flags |= (y)) |
155 |
|
#define UMODE_UNAUTH 0x00008000 /**< show unauth connects here */ |
156 |
|
#define UMODE_LOCOPS 0x00010000 /**< show locops */ |
157 |
|
#define UMODE_DEAF 0x00020000 /**< don't receive channel messages */ |
158 |
< |
#define UMODE_CCONN_FULL 0x00040000 /**< add unused fields to connection monitoring */ |
159 |
< |
#define UMODE_REGISTERED 0x00080000 /**< User has identified for that nick. */ |
160 |
< |
#define UMODE_REGONLY 0x00100000 /**< Only registered nicks may PM */ |
161 |
< |
#define UMODE_HIDDEN 0x00200000 /**< Operator status is hidden */ |
162 |
< |
#define UMODE_OPER 0x00400000 /**< Operator */ |
163 |
< |
#define UMODE_ADMIN 0x00800000 /**< Admin on server */ |
158 |
> |
#define UMODE_REGISTERED 0x00040000 /**< User has identified for that nick. */ |
159 |
> |
#define UMODE_REGONLY 0x00080000 /**< Only registered nicks may PM */ |
160 |
> |
#define UMODE_HIDDEN 0x00100000 /**< Operator status is hidden */ |
161 |
> |
#define UMODE_OPER 0x00200000 /**< Operator */ |
162 |
> |
#define UMODE_ADMIN 0x00400000 /**< Admin on server */ |
163 |
> |
#define UMODE_FARCONNECT 0x00800000 /**< Can see remote client connects/exits */ |
164 |
> |
#define UMODE_HIDDENHOST 0x01000000 /**< User's host is hidden */ |
165 |
> |
#define UMODE_SSL 0x02000000 /**< User is connected via TLS/SSL */ |
166 |
> |
|
167 |
|
|
168 |
|
#define UMODE_ALL UMODE_SERVNOTICE |
169 |
|
|
173 |
|
|
174 |
|
#define SEND_UMODES (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP |\ |
175 |
|
UMODE_REGONLY | UMODE_REGISTERED | UMODE_ADMIN |\ |
176 |
< |
UMODE_HIDDEN) |
176 |
> |
UMODE_HIDDEN | UMODE_HIDDENHOST | UMODE_SSL) |
177 |
|
|
178 |
|
|
179 |
|
|
180 |
|
/* oper priv flags */ |
181 |
< |
#define OPER_FLAG_GLOBAL_KILL 0x00000001 /**< Oper can global kill */ |
182 |
< |
#define OPER_FLAG_REMOTE 0x00000002 /**> Oper can do squits/connects */ |
183 |
< |
#define OPER_FLAG_UNKLINE 0x00000004 /**< Oper can use unkline */ |
184 |
< |
#define OPER_FLAG_GLINE 0x00000008 /**< Oper can use gline */ |
185 |
< |
#define OPER_FLAG_N 0x00000010 /**< Oper can umode n */ |
186 |
< |
#define OPER_FLAG_K 0x00000020 /**< Oper can kill/kline */ |
187 |
< |
#define OPER_FLAG_X 0x00000040 /**< Oper can xline */ |
188 |
< |
#define OPER_FLAG_DIE 0x00000080 /**< Oper can die */ |
189 |
< |
#define OPER_FLAG_REHASH 0x00000100 /**< Oper can rehash */ |
190 |
< |
#define OPER_FLAG_ADMIN 0x00000200 /**< Oper can set umode +a */ |
191 |
< |
#define OPER_FLAG_OPERWALL 0x00000400 /**< Oper can use OPERWALL command */ |
192 |
< |
#define OPER_FLAG_OPER_SPY 0x00000800 /* */ |
193 |
< |
#define OPER_FLAG_REMOTEBAN 0x00001000 /**< Oper can set remote bans */ |
194 |
< |
#define OPER_FLAG_GLOBOPS 0x00002000 /**< Oper can use GLOBOPS command */ |
195 |
< |
#define OPER_FLAG_MODULE 0x00004000 /**< Oper can use MODULE commands */ |
196 |
< |
#define OPER_FLAG_RESTART 0x00008000 /**< Oper can use RESTART command */ |
197 |
< |
#define OPER_FLAG_DLINE 0x00010000 /**< Oper can use DLINE command */ |
198 |
< |
#define OPER_FLAG_UNDLINE 0x00020000 /**< Oper can use UNDLINE command */ |
199 |
< |
#define OPER_FLAG_SET 0x00040000 /**< Oper can use SET command */ |
181 |
> |
#define OPER_FLAG_KILL_REMOTE 0x00000001 /**< Oper can global kill */ |
182 |
> |
#define OPER_FLAG_KILL 0x00000002 /**< Oper can do local KILL */ |
183 |
> |
#define OPER_FLAG_UNKLINE 0x00000004 /**< Oper can use unkline */ |
184 |
> |
#define OPER_FLAG_GLINE 0x00000008 /**< Oper can use gline */ |
185 |
> |
#define OPER_FLAG_K 0x00000010 /**< Oper can kill/kline */ |
186 |
> |
#define OPER_FLAG_X 0x00000020 /**< Oper can xline */ |
187 |
> |
#define OPER_FLAG_DIE 0x00000040 /**< Oper can die */ |
188 |
> |
#define OPER_FLAG_REHASH 0x00000080 /**< Oper can rehash */ |
189 |
> |
#define OPER_FLAG_ADMIN 0x00000100 /**< Oper can set umode +a */ |
190 |
> |
#define OPER_FLAG_OPERWALL 0x00000200 /**< Oper can use OPERWALL command */ |
191 |
> |
#define OPER_FLAG_REMOTEBAN 0x00000400 /**< Oper can set remote bans */ |
192 |
> |
#define OPER_FLAG_GLOBOPS 0x00000800 /**< Oper can use GLOBOPS command */ |
193 |
> |
#define OPER_FLAG_MODULE 0x00001000 /**< Oper can use MODULE commands */ |
194 |
> |
#define OPER_FLAG_RESTART 0x00002000 /**< Oper can use RESTART command */ |
195 |
> |
#define OPER_FLAG_DLINE 0x00004000 /**< Oper can use DLINE command */ |
196 |
> |
#define OPER_FLAG_UNDLINE 0x00008000 /**< Oper can use UNDLINE command */ |
197 |
> |
#define OPER_FLAG_SET 0x00010000 /**< Oper can use SET command */ |
198 |
> |
#define OPER_FLAG_SQUIT 0x00020000 /**< Oper can do local SQUIT */ |
199 |
> |
#define OPER_FLAG_SQUIT_REMOTE 0x00040000 /**< Oper can do global SQUIT */ |
200 |
> |
#define OPER_FLAG_CONNECT 0x00080000 /**< Oper can do local CONNECT */ |
201 |
> |
#define OPER_FLAG_CONNECT_REMOTE 0x00100000 /**< Oper can do global CONNECT */ |
202 |
> |
#define OPER_FLAG_WALLOPS 0x00200000 /**< Oper can do WALLOPS */ |
203 |
> |
#define OPER_FLAG_LOCOPS 0x00400000 /**< Oper can do LOCOPS */ |
204 |
|
|
205 |
|
#define HasOFlag(x, y) (MyConnect(x) ? (x)->localClient->operflags & (y) : 0) |
206 |
|
#define AddOFlag(x, y) ((x)->localClient->operflags |= (y)) |
261 |
|
#define SetExemptResv(x) ((x)->flags |= FLAGS_EXEMPTRESV) |
262 |
|
#define SetIPSpoof(x) ((x)->flags |= FLAGS_IP_SPOOFING) |
263 |
|
#define IsIPSpoof(x) ((x)->flags & FLAGS_IP_SPOOFING) |
264 |
+ |
#define DelIPSpoof(x) ((x)->flags &= ~FLAGS_IP_SPOOFING) |
265 |
|
|
266 |
|
#define IsFloodDone(x) ((x)->flags & FLAGS_FLOODDONE) |
267 |
|
#define SetFloodDone(x) ((x)->flags |= FLAGS_FLOODDONE) |
315 |
|
{ |
316 |
|
dlink_node lclient_node; |
317 |
|
|
307 |
– |
char client_host[HOSTLEN + 1]; |
308 |
– |
char client_server[HOSTLEN + 1]; |
309 |
– |
|
318 |
|
unsigned int registration; |
319 |
|
unsigned int cap_client; /**< Client capabilities (from us) */ |
320 |
|
unsigned int cap_active; /**< Active capabilities (to us) */ |
329 |
|
time_t firsttime; /**< time client was created */ |
330 |
|
time_t since; /**< last time we parsed something */ |
331 |
|
time_t last_knock; /**< time of last knock */ |
332 |
< |
time_t last_join_time; /**< when this client last |
332 |
> |
time_t last_join_time; /**< when this client last |
333 |
|
joined a channel */ |
334 |
< |
time_t last_leave_time; /**< when this client last |
334 |
> |
time_t last_leave_time; /**< when this client last |
335 |
|
* left a channel */ |
336 |
< |
int join_leave_count; /**< count of JOIN/LEAVE in less than |
336 |
> |
int join_leave_count; /**< count of JOIN/LEAVE in less than |
337 |
|
MIN_JOIN_LEAVE_TIME seconds */ |
338 |
< |
int oper_warn_count_down; /**< warn opers of this possible |
338 |
> |
int oper_warn_count_down; /**< warn opers of this possible |
339 |
|
spambot every time this gets to 0 */ |
340 |
|
time_t last_caller_id_time; |
341 |
|
time_t first_received_message_time; |
356 |
|
uint64_t bytes; /**< Statistics: total bytes sent/received */ |
357 |
|
} recv, send; |
358 |
|
|
359 |
< |
struct AuthRequest *auth; |
359 |
> |
struct AuthRequest auth; |
360 |
|
struct Listener *listener; /**< listener accepted from */ |
361 |
|
dlink_list acceptlist; /**< clients I'll allow to talk to me */ |
362 |
|
dlink_list watches; /**< chain of Watch pointer blocks */ |
364 |
|
dlink_list invited; /**< chain of invite pointer blocks */ |
365 |
|
struct irc_ssaddr ip; |
366 |
|
int aftype; /**< Makes life easier for DNS res in IPV6 */ |
367 |
+ |
int country_id; /**< ID corresponding to a ISO 3166 country code */ |
368 |
|
|
369 |
|
char *passwd; |
370 |
|
fde_t fd; |
410 |
|
if dealing with timestamps */ |
411 |
|
char id[IDLEN + 1]; /**< client ID, unique ID per client */ |
412 |
|
/* |
413 |
< |
* client->username is the username from ident or the USER message, |
414 |
< |
* If the client is idented the USER message is ignored, otherwise |
415 |
< |
* the username part of the USER message is put here prefixed with a |
413 |
> |
* client->username is the username from ident or the USER message, |
414 |
> |
* If the client is idented the USER message is ignored, otherwise |
415 |
> |
* the username part of the USER message is put here prefixed with a |
416 |
|
* tilde depending on the auth{} block. Once a client has registered, |
417 |
|
* this field should be considered read-only. |
418 |
|
*/ |
426 |
|
char host[HOSTLEN + 1]; /* client's hostname */ |
427 |
|
|
428 |
|
/* |
429 |
< |
* client->info for unix clients will normally contain the info from the |
429 |
> |
* client->info for unix clients will normally contain the info from the |
430 |
|
* gcos field in /etc/passwd but anything can go here. |
431 |
|
*/ |
432 |
|
char info[REALLEN + 1]; /* Free form additional client info */ |
436 |
|
* string, this field should be considered read-only once the connection |
437 |
|
* has been made. (set in s_bsd.c only) |
438 |
|
*/ |
439 |
< |
char sockhost[HOSTIPLEN + 1]; /* This is the host name from the |
439 |
> |
char sockhost[HOSTIPLEN + 1]; /* This is the host name from the |
440 |
|
socket ip address as string */ |
441 |
+ |
char *certfp; |
442 |
|
}; |
443 |
|
|
444 |
|
|