| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (c) 1997-2014 ircd-hybrid development team |
| 4 |
> |
* Copyright (c) 1997-2015 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 |
| 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 |
|
|
| 41 |
|
/* |
| 42 |
|
* status macros. |
| 43 |
|
*/ |
| 44 |
< |
#define STAT_CONNECTING 0x00000001U |
| 45 |
< |
#define STAT_HANDSHAKE 0x00000002U |
| 46 |
< |
#define STAT_ME 0x00000004U |
| 47 |
< |
#define STAT_UNKNOWN 0x00000008U |
| 48 |
< |
#define STAT_SERVER 0x00000010U |
| 49 |
< |
#define STAT_CLIENT 0x00000020U |
| 50 |
< |
|
| 51 |
< |
#define REG_NEED_USER 0x00000001U /**< User must send USER command */ |
| 52 |
< |
#define REG_NEED_NICK 0x00000002U /**< User must send NICK command */ |
| 53 |
< |
#define REG_NEED_CAP 0x00000004U /**< In middle of CAP negotiations */ |
| 54 |
< |
#define REG_INIT (REG_NEED_USER|REG_NEED_NICK) |
| 44 |
> |
enum |
| 45 |
> |
{ |
| 46 |
> |
STAT_CONNECTING = 0x00000001U, |
| 47 |
> |
STAT_HANDSHAKE = 0x00000002U, |
| 48 |
> |
STAT_ME = 0x00000004U, |
| 49 |
> |
STAT_UNKNOWN = 0x00000008U, |
| 50 |
> |
STAT_SERVER = 0x00000010U, |
| 51 |
> |
STAT_CLIENT = 0x00000020U |
| 52 |
> |
}; |
| 53 |
> |
|
| 54 |
> |
enum |
| 55 |
> |
{ |
| 56 |
> |
REG_NEED_USER = 0x00000001U, /**< User must send USER command */ |
| 57 |
> |
REG_NEED_NICK = 0x00000002U, /**< User must send NICK command */ |
| 58 |
> |
REG_NEED_CAP = 0x00000004U, /**< In middle of CAP negotiations */ |
| 59 |
> |
REG_INIT = REG_NEED_USER | REG_NEED_NICK |
| 60 |
> |
}; |
| 61 |
|
|
| 62 |
< |
#define ID_or_name(x,client_p) ((IsCapable(client_p->from, CAP_TS6) && (x)->id[0]) ? (x)->id : (x)->name) |
| 62 |
> |
#define ID_or_name(x,client_p) ((IsServer(client_p->from) && (x)->id[0]) ? (x)->id : (x)->name) |
| 63 |
|
|
| 58 |
– |
#define IsRegistered(x) ((x)->status > STAT_UNKNOWN) |
| 64 |
|
#define IsConnecting(x) ((x)->status == STAT_CONNECTING) |
| 65 |
|
#define IsHandshake(x) ((x)->status == STAT_HANDSHAKE) |
| 66 |
|
#define IsMe(x) ((x)->status == STAT_ME) |
| 87 |
|
(x)->handler = HasUMode(x, UMODE_OPER) ? \ |
| 88 |
|
OPER_HANDLER : CLIENT_HANDLER; } |
| 89 |
|
|
| 90 |
< |
#define MyConnect(x) ((x)->localClient != NULL) |
| 90 |
> |
#define MyConnect(x) ((x)->connection != NULL) |
| 91 |
|
#define MyClient(x) (MyConnect(x) && IsClient(x)) |
| 92 |
|
|
| 93 |
|
/* |
| 94 |
|
* ts stuff |
| 95 |
|
*/ |
| 96 |
< |
#define TS_CURRENT 6 /**< Current TS protocol version */ |
| 97 |
< |
#define TS_MIN 6 /**< Minimum supported TS protocol version */ |
| 98 |
< |
#define TS_DOESTS 0x20000000 |
| 99 |
< |
#define DoesTS(x) ((x)->tsinfo == TS_DOESTS) |
| 100 |
< |
|
| 96 |
< |
|
| 96 |
> |
enum |
| 97 |
> |
{ |
| 98 |
> |
TS_CURRENT = 6, /**< Current TS protocol version */ |
| 99 |
> |
TS_MIN = 6 /**< Minimum supported TS protocol version */ |
| 100 |
> |
}; |
| 101 |
|
|
| 102 |
< |
#define CAP_MULTI_PREFIX 0x00000001U |
| 103 |
< |
#define CAP_AWAY_NOTIFY 0x00000002U |
| 104 |
< |
#define CAP_UHNAMES 0x00000004U |
| 102 |
> |
enum |
| 103 |
> |
{ |
| 104 |
> |
CAP_MULTI_PREFIX = 0x00000001U, |
| 105 |
> |
CAP_AWAY_NOTIFY = 0x00000002U, |
| 106 |
> |
CAP_UHNAMES = 0x00000004U, |
| 107 |
> |
CAP_EXTENDED_JOIN = 0x00000008U, |
| 108 |
> |
CAP_ACCOUNT_NOTIFY = 0x00000010U |
| 109 |
> |
}; |
| 110 |
|
|
| 111 |
< |
#define HasCap(x, y) ((x)->localClient->cap_active & (y)) |
| 111 |
> |
#define HasCap(x, y) ((x)->connection->cap_active & (y)) |
| 112 |
|
|
| 113 |
|
|
| 114 |
|
/* housekeeping flags */ |
| 115 |
< |
#define FLAGS_PINGSENT 0x00000001U /**< Unreplied ping sent */ |
| 116 |
< |
#define FLAGS_DEADSOCKET 0x00000002U /**< Local socket is dead--Exiting soon */ |
| 117 |
< |
#define FLAGS_KILLED 0x00000004U /**< Prevents "QUIT" from being sent for this */ |
| 118 |
< |
#define FLAGS_CLOSING 0x00000008U /**< Set when closing to suppress errors */ |
| 119 |
< |
#define FLAGS_GOTID 0x00000010U /**< Successful ident lookup achieved */ |
| 120 |
< |
#define FLAGS_NEEDID 0x00000020U /**< auth{} block say must use ident return */ |
| 121 |
< |
#define FLAGS_SENDQEX 0x00000040U /**< Sendq exceeded */ |
| 122 |
< |
#define FLAGS_IPHASH 0x00000080U /**< Iphashed this client */ |
| 123 |
< |
#define FLAGS_MARK 0x00000100U /**< Marked client */ |
| 124 |
< |
#define FLAGS_CANFLOOD 0x00000200U /**< Client has the ability to flood */ |
| 125 |
< |
#define FLAGS_EXEMPTGLINE 0x00000400U /**< Client can't be G-lined */ |
| 126 |
< |
#define FLAGS_EXEMPTKLINE 0x00000800U /**< Client is exempt from kline */ |
| 127 |
< |
#define FLAGS_NOLIMIT 0x00001000U /**< Client is exempt from limits */ |
| 128 |
< |
#define FLAGS_PING_COOKIE 0x00002000U /**< PING Cookie */ |
| 129 |
< |
#define FLAGS_IP_SPOOFING 0x00004000U /**< Client IP is spoofed */ |
| 130 |
< |
#define FLAGS_FLOODDONE 0x00008000U /**< Flood grace period has been ended. */ |
| 131 |
< |
#define FLAGS_EOB 0x00010000U /**< Server has sent us an EOB */ |
| 132 |
< |
#define FLAGS_HIDDEN 0x00020000U /**< A hidden server. Not shown in /links */ |
| 133 |
< |
#define FLAGS_BLOCKED 0x00040000U /**< Must wait for COMM_SELECT_WRITE */ |
| 134 |
< |
#define FLAGS_USERHOST 0x00080000U /**< Client is in userhost hash */ |
| 135 |
< |
#define FLAGS_BURSTED 0x00100000U /**< User was already bursted */ |
| 136 |
< |
#define FLAGS_EXEMPTRESV 0x00200000U /**< Client is exempt from RESV */ |
| 137 |
< |
#define FLAGS_GOTUSER 0x00400000U /**< If we received a USER command */ |
| 138 |
< |
#define FLAGS_FINISHED_AUTH 0x00800000U /**< Client has been released from auth */ |
| 139 |
< |
#define FLAGS_FLOOD_NOTICED 0x01000000U /**< Notice to opers about this flooder has been sent */ |
| 140 |
< |
#define FLAGS_SERVICE 0x02000000U /**< Client/server is a network service */ |
| 141 |
< |
#define FLAGS_AUTH_SPOOF 0x04000000U /**< User's hostname has been spoofed by an auth{} spoof */ |
| 142 |
< |
#define FLAGS_SSL 0x08000000U /**< User is connected via TLS/SSL */ |
| 143 |
< |
#define FLAGS_SQUIT 0x10000000U |
| 115 |
> |
enum |
| 116 |
> |
{ |
| 117 |
> |
FLAGS_PINGSENT = 0x00000001U, /**< Unreplied ping sent */ |
| 118 |
> |
FLAGS_DEADSOCKET = 0x00000002U, /**< Local socket is dead--Exiting soon */ |
| 119 |
> |
FLAGS_KILLED = 0x00000004U, /**< Prevents "QUIT" from being sent for this */ |
| 120 |
> |
FLAGS_CLOSING = 0x00000008U, /**< Set when closing to suppress errors */ |
| 121 |
> |
FLAGS_GOTID = 0x00000010U, /**< Successful ident lookup achieved */ |
| 122 |
> |
FLAGS_SENDQEX = 0x00000020U, /**< Sendq exceeded */ |
| 123 |
> |
FLAGS_IPHASH = 0x00000040U, /**< Iphashed this client */ |
| 124 |
> |
FLAGS_MARK = 0x00000080U, /**< Marked client */ |
| 125 |
> |
FLAGS_CANFLOOD = 0x00000100U, /**< Client has the ability to flood */ |
| 126 |
> |
FLAGS_EXEMPTKLINE = 0x00000200U, /**< Client is exempt from k-lines */ |
| 127 |
> |
FLAGS_NOLIMIT = 0x00000400U, /**< Client is exempt from limits */ |
| 128 |
> |
FLAGS_PING_COOKIE = 0x00000800U, /**< PING Cookie */ |
| 129 |
> |
FLAGS_FLOODDONE = 0x00001000U, /**< Flood grace period has been ended. */ |
| 130 |
> |
FLAGS_EOB = 0x00002000U, /**< Server has sent us an EOB */ |
| 131 |
> |
FLAGS_HIDDEN = 0x00004000U, /**< A hidden server. Not shown in /links */ |
| 132 |
> |
FLAGS_BLOCKED = 0x00008000U, /**< Must wait for COMM_SELECT_WRITE */ |
| 133 |
> |
FLAGS_USERHOST = 0x00010000U, /**< Client is in userhost hash */ |
| 134 |
> |
FLAGS_BURSTED = 0x00020000U, /**< User was already bursted */ |
| 135 |
> |
FLAGS_EXEMPTRESV = 0x00040000U, /**< Client is exempt from RESV */ |
| 136 |
> |
FLAGS_GOTUSER = 0x00080000U, /**< If we received a USER command */ |
| 137 |
> |
FLAGS_FINISHED_AUTH = 0x00100000U, /**< Client has been released from auth */ |
| 138 |
> |
FLAGS_FLOOD_NOTICED = 0x00200000U, /**< Notice to opers about this flooder has been sent */ |
| 139 |
> |
FLAGS_SERVICE = 0x00400000U, /**< Client/server is a network service */ |
| 140 |
> |
FLAGS_SSL = 0x00800000U, /**< User is connected via TLS/SSL */ |
| 141 |
> |
FLAGS_SQUIT = 0x01000000U, |
| 142 |
> |
FLAGS_EXEMPTXLINE = 0x02000000U /**< Client is exempt from x-lines */ |
| 143 |
> |
}; |
| 144 |
|
|
| 145 |
|
#define HasFlag(x, y) ((x)->flags & (y)) |
| 146 |
|
#define AddFlag(x, y) ((x)->flags |= (y)) |
| 147 |
|
#define DelFlag(x, y) ((x)->flags &= ~(y)) |
| 148 |
|
|
| 149 |
|
|
| 141 |
– |
|
| 150 |
|
/* umodes, settable flags */ |
| 151 |
< |
#define UMODE_SERVNOTICE 0x00000001U /**< Server notices such as kill */ |
| 152 |
< |
#define UMODE_CCONN 0x00000002U /**< Client Connections */ |
| 153 |
< |
#define UMODE_REJ 0x00000004U /**< Bot Rejections */ |
| 154 |
< |
#define UMODE_SKILL 0x00000008U /**< Server Killed */ |
| 155 |
< |
#define UMODE_FULL 0x00000010U /**< Full messages */ |
| 156 |
< |
#define UMODE_SPY 0x00000020U /**< See STATS / LINKS */ |
| 157 |
< |
#define UMODE_DEBUG 0x00000040U /**< 'debugging' info */ |
| 158 |
< |
#define UMODE_NCHANGE 0x00000080U /**< Nick change notice */ |
| 159 |
< |
#define UMODE_WALLOP 0x00000100U /**< Send wallops to them */ |
| 160 |
< |
#define UMODE_INVISIBLE 0x00000200U /**< Makes user invisible */ |
| 161 |
< |
#define UMODE_BOTS 0x00000400U /**< Shows bots */ |
| 162 |
< |
#define UMODE_EXTERNAL 0x00000800U /**< Show servers introduced and splitting */ |
| 163 |
< |
#define UMODE_CALLERID 0x00001000U /**< Block unless caller id's */ |
| 164 |
< |
#define UMODE_SOFTCALLERID 0x00002000U /**< Block unless on common channel */ |
| 165 |
< |
#define UMODE_UNAUTH 0x00004000U /**< Show unauth connects here */ |
| 166 |
< |
#define UMODE_LOCOPS 0x00008000U /**< Show locops */ |
| 167 |
< |
#define UMODE_DEAF 0x00010000U /**< Don't receive channel messages */ |
| 168 |
< |
#define UMODE_REGISTERED 0x00020000U /**< User has identified for that nick. */ |
| 169 |
< |
#define UMODE_REGONLY 0x00040000U /**< Only registered nicks may PM */ |
| 170 |
< |
#define UMODE_HIDDEN 0x00080000U /**< Operator status is hidden */ |
| 171 |
< |
#define UMODE_OPER 0x00100000U /**< Operator */ |
| 172 |
< |
#define UMODE_ADMIN 0x00200000U /**< Admin on server */ |
| 173 |
< |
#define UMODE_FARCONNECT 0x00400000U /**< Can see remote client connects/exits */ |
| 174 |
< |
#define UMODE_HIDDENHOST 0x00800000U /**< User's host is hidden */ |
| 175 |
< |
#define UMODE_SSL 0x01000000U /**< User is connected via TLS/SSL */ |
| 176 |
< |
#define UMODE_WEBIRC 0x02000000U /**< User connected via a webirc gateway */ |
| 177 |
< |
#define UMODE_HIDEIDLE 0x04000000U /**< Hides idle and signon time in WHOIS */ |
| 178 |
< |
#define UMODE_HIDECHANS 0x08000000U /**< Hides channel list in WHOIS */ |
| 179 |
< |
|
| 180 |
< |
#define UMODE_ALL UMODE_SERVNOTICE |
| 151 |
> |
enum |
| 152 |
> |
{ |
| 153 |
> |
UMODE_SERVNOTICE = 0x00000001U, /**< Server notices such as kill */ |
| 154 |
> |
UMODE_CCONN = 0x00000002U, /**< Can see client connection notices */ |
| 155 |
> |
UMODE_REJ = 0x00000004U, /**< Bot Rejections */ |
| 156 |
> |
UMODE_SKILL = 0x00000008U, /**< Server Killed */ |
| 157 |
> |
UMODE_FULL = 0x00000010U, /**< Full messages */ |
| 158 |
> |
UMODE_SPY = 0x00000020U, /**< See STATS / LINKS */ |
| 159 |
> |
UMODE_DEBUG = 0x00000040U, /**< 'debugging' info */ |
| 160 |
> |
UMODE_NCHANGE = 0x00000080U, /**< Nick change notice */ |
| 161 |
> |
UMODE_WALLOP = 0x00000100U, /**< Send wallops to them */ |
| 162 |
> |
UMODE_INVISIBLE = 0x00000200U, /**< Makes user invisible */ |
| 163 |
> |
UMODE_BOTS = 0x00000400U, /**< Shows bots */ |
| 164 |
> |
UMODE_EXTERNAL = 0x00000800U, /**< Show servers introduced and splitting */ |
| 165 |
> |
UMODE_CALLERID = 0x00001000U, /**< Block unless caller id's */ |
| 166 |
> |
UMODE_SOFTCALLERID = 0x00002000U, /**< Block unless on common channel */ |
| 167 |
> |
UMODE_UNAUTH = 0x00004000U, /**< Show unauth connects here */ |
| 168 |
> |
UMODE_LOCOPS = 0x00008000U, /**< Can see LOCOPS messages */ |
| 169 |
> |
UMODE_DEAF = 0x00010000U, /**< Don't receive channel messages */ |
| 170 |
> |
UMODE_REGISTERED = 0x00020000U, /**< User has identified for that nick. */ |
| 171 |
> |
UMODE_REGONLY = 0x00040000U, /**< Only registered nicks may PM */ |
| 172 |
> |
UMODE_HIDDEN = 0x00080000U, /**< IRC operator status is hidden */ |
| 173 |
> |
UMODE_OPER = 0x00100000U, /**< IRC operator */ |
| 174 |
> |
UMODE_ADMIN = 0x00200000U, /**< Admin on server */ |
| 175 |
> |
UMODE_FARCONNECT = 0x00400000U, /**< Can see remote client connects/exits */ |
| 176 |
> |
UMODE_HIDDENHOST = 0x00800000U, /**< User's host is hidden */ |
| 177 |
> |
UMODE_SSL = 0x01000000U, /**< User is connected via TLS/SSL */ |
| 178 |
> |
UMODE_WEBIRC = 0x02000000U, /**< User connected via a webirc gateway */ |
| 179 |
> |
UMODE_HIDEIDLE = 0x04000000U, /**< Hides idle and signon time in WHOIS */ |
| 180 |
> |
UMODE_HIDECHANS = 0x08000000U /**< Hides channel list in WHOIS */ |
| 181 |
> |
}; |
| 182 |
|
|
| 183 |
|
#define HasUMode(x, y) ((x)->umodes & (y)) |
| 184 |
|
#define AddUMode(x, y) ((x)->umodes |= (y)) |
| 186 |
|
|
| 187 |
|
|
| 188 |
|
/* oper priv flags */ |
| 189 |
< |
#define OPER_FLAG_KILL_REMOTE 0x00000001U /**< Oper can KILL remote users */ |
| 190 |
< |
#define OPER_FLAG_KILL 0x00000002U /**< Oper can KILL local users */ |
| 191 |
< |
#define OPER_FLAG_UNKLINE 0x00000004U /**< Oper can use UNKLINE command */ |
| 192 |
< |
#define OPER_FLAG_GLINE 0x00000008U /**< Oper can use GLINE command */ |
| 193 |
< |
#define OPER_FLAG_KLINE 0x00000010U /**< Oper can use KLINE command */ |
| 194 |
< |
#define OPER_FLAG_XLINE 0x00000020U /**< Oper can use XLINE command */ |
| 195 |
< |
#define OPER_FLAG_DIE 0x00000040U /**< Oper can use DIE command */ |
| 196 |
< |
#define OPER_FLAG_REHASH 0x00000080U /**< Oper can use REHASH command */ |
| 197 |
< |
#define OPER_FLAG_ADMIN 0x00000100U /**< Oper can set user mode +a */ |
| 198 |
< |
#define OPER_FLAG_REMOTEBAN 0x00000200U /**< Oper can set remote bans */ |
| 199 |
< |
#define OPER_FLAG_GLOBOPS 0x00000400U /**< Oper can use GLOBOPS command */ |
| 200 |
< |
#define OPER_FLAG_MODULE 0x00000800U /**< Oper can use MODULE command */ |
| 201 |
< |
#define OPER_FLAG_RESTART 0x00001000U /**< Oper can use RESTART command */ |
| 202 |
< |
#define OPER_FLAG_DLINE 0x00002000U /**< Oper can use DLINE command */ |
| 203 |
< |
#define OPER_FLAG_UNDLINE 0x00004000U /**< Oper can use UNDLINE command */ |
| 204 |
< |
#define OPER_FLAG_SET 0x00008000U /**< Oper can use SET command */ |
| 205 |
< |
#define OPER_FLAG_SQUIT 0x00010000U /**< Oper can do local SQUIT */ |
| 206 |
< |
#define OPER_FLAG_SQUIT_REMOTE 0x00020000U /**< Oper can do remote SQUIT */ |
| 207 |
< |
#define OPER_FLAG_CONNECT 0x00040000U /**< Oper can do local CONNECT */ |
| 208 |
< |
#define OPER_FLAG_CONNECT_REMOTE 0x00080000U /**< Oper can do remote CONNECT */ |
| 209 |
< |
#define OPER_FLAG_WALLOPS 0x00100000U /**< Oper can use WALLOPS command */ |
| 210 |
< |
#define OPER_FLAG_LOCOPS 0x00200000U /**< Oper can use LOCOPS command */ |
| 211 |
< |
#define OPER_FLAG_UNXLINE 0x00400000U /**< Oper can use UNXLINE command */ |
| 212 |
< |
|
| 213 |
< |
|
| 214 |
< |
#define HasOFlag(x, y) (MyConnect(x) ? (x)->localClient->operflags & (y) : 0) |
| 215 |
< |
#define AddOFlag(x, y) ((x)->localClient->operflags |= (y)) |
| 216 |
< |
#define DelOFlag(x, y) ((x)->localClient->operflags &= ~(y)) |
| 217 |
< |
#define ClrOFlag(x) ((x)->localClient->operflags = 0) |
| 189 |
> |
enum |
| 190 |
> |
{ |
| 191 |
> |
OPER_FLAG_KILL_REMOTE = 0x00000001U, /**< Oper can KILL remote users */ |
| 192 |
> |
OPER_FLAG_KILL = 0x00000002U, /**< Oper can KILL local users */ |
| 193 |
> |
OPER_FLAG_UNKLINE = 0x00000004U, /**< Oper can use UNKLINE command */ |
| 194 |
> |
OPER_FLAG_KLINE = 0x00000008U, /**< Oper can use KLINE command */ |
| 195 |
> |
OPER_FLAG_XLINE = 0x00000010U, /**< Oper can use XLINE command */ |
| 196 |
> |
OPER_FLAG_DIE = 0x00000020U, /**< Oper can use DIE command */ |
| 197 |
> |
OPER_FLAG_REHASH = 0x00000040U, /**< Oper can use REHASH command */ |
| 198 |
> |
OPER_FLAG_ADMIN = 0x00000080U, /**< Oper can set user mode +a */ |
| 199 |
> |
OPER_FLAG_REMOTEBAN = 0x00000100U, /**< Oper can set remote bans */ |
| 200 |
> |
OPER_FLAG_GLOBOPS = 0x00000200U, /**< Oper can use GLOBOPS command */ |
| 201 |
> |
OPER_FLAG_MODULE = 0x00000400U, /**< Oper can use MODULE command */ |
| 202 |
> |
OPER_FLAG_RESTART = 0x00000800U, /**< Oper can use RESTART command */ |
| 203 |
> |
OPER_FLAG_DLINE = 0x00001000U, /**< Oper can use DLINE command */ |
| 204 |
> |
OPER_FLAG_UNDLINE = 0x00002000U, /**< Oper can use UNDLINE command */ |
| 205 |
> |
OPER_FLAG_SET = 0x00004000U, /**< Oper can use SET command */ |
| 206 |
> |
OPER_FLAG_SQUIT = 0x00008000U, /**< Oper can do local SQUIT */ |
| 207 |
> |
OPER_FLAG_SQUIT_REMOTE = 0x00010000U, /**< Oper can do remote SQUIT */ |
| 208 |
> |
OPER_FLAG_CONNECT = 0x00020000U, /**< Oper can do local CONNECT */ |
| 209 |
> |
OPER_FLAG_CONNECT_REMOTE = 0x00040000U, /**< Oper can do remote CONNECT */ |
| 210 |
> |
OPER_FLAG_WALLOPS = 0x00080000U, /**< Oper can use WALLOPS command */ |
| 211 |
> |
OPER_FLAG_LOCOPS = 0x00100000U, /**< Oper can use LOCOPS command */ |
| 212 |
> |
OPER_FLAG_UNXLINE = 0x00200000U, /**< Oper can use UNXLINE command */ |
| 213 |
> |
OPER_FLAG_OPME = 0x00400000U /**< Oper can use OPME command */ |
| 214 |
> |
}; |
| 215 |
> |
|
| 216 |
> |
#define HasOFlag(x, y) (MyConnect(x) ? (x)->connection->operflags & (y) : 0) |
| 217 |
> |
#define AddOFlag(x, y) ((x)->connection->operflags |= (y)) |
| 218 |
> |
#define DelOFlag(x, y) ((x)->connection->operflags &= ~(y)) |
| 219 |
> |
#define ClrOFlag(x) ((x)->connection->operflags = 0) |
| 220 |
|
|
| 221 |
|
|
| 222 |
|
|
| 226 |
|
#define SetDead(x) ((x)->flags |= FLAGS_DEADSOCKET) |
| 227 |
|
#define IsClosing(x) ((x)->flags & FLAGS_CLOSING) |
| 228 |
|
#define SetClosing(x) ((x)->flags |= FLAGS_CLOSING) |
| 218 |
– |
#define SetCanFlood(x) ((x)->flags |= FLAGS_CANFLOOD) |
| 219 |
– |
#define IsCanFlood(x) ((x)->flags & FLAGS_CANFLOOD) |
| 229 |
|
#define IsDefunct(x) ((x)->flags & (FLAGS_DEADSOCKET|FLAGS_CLOSING|FLAGS_KILLED)) |
| 230 |
|
|
| 231 |
|
/* oper flags */ |
| 238 |
|
if (!HasUMode(x, UMODE_OPER) && !IsServer((x))) \ |
| 239 |
|
(x)->handler = CLIENT_HANDLER; } |
| 240 |
|
|
| 232 |
– |
#define SetSendQExceeded(x) ((x)->flags |= FLAGS_SENDQEX) |
| 233 |
– |
#define IsSendQExceeded(x) ((x)->flags & FLAGS_SENDQEX) |
| 234 |
– |
|
| 235 |
– |
#define SetIpHash(x) ((x)->flags |= FLAGS_IPHASH) |
| 236 |
– |
#define IsIpHash(x) ((x)->flags & FLAGS_IPHASH) |
| 237 |
– |
|
| 238 |
– |
#define SetUserHost(x) ((x)->flags |= FLAGS_USERHOST) |
| 239 |
– |
#define IsUserHostIp(x) ((x)->flags & FLAGS_USERHOST) |
| 240 |
– |
|
| 241 |
– |
#define SetPingSent(x) ((x)->flags |= FLAGS_PINGSENT) |
| 242 |
– |
#define IsPingSent(x) ((x)->flags & FLAGS_PINGSENT) |
| 243 |
– |
#define ClearPingSent(x) ((x)->flags &= ~FLAGS_PINGSENT) |
| 244 |
– |
|
| 245 |
– |
#define SetNeedId(x) ((x)->flags |= FLAGS_NEEDID) |
| 246 |
– |
#define IsNeedId(x) ((x)->flags & FLAGS_NEEDID) |
| 247 |
– |
|
| 248 |
– |
#define SetGotId(x) ((x)->flags |= FLAGS_GOTID) |
| 249 |
– |
#define IsGotId(x) ((x)->flags & FLAGS_GOTID) |
| 250 |
– |
|
| 251 |
– |
#define IsExemptKline(x) ((x)->flags & FLAGS_EXEMPTKLINE) |
| 252 |
– |
#define SetExemptKline(x) ((x)->flags |= FLAGS_EXEMPTKLINE) |
| 253 |
– |
#define IsExemptLimits(x) ((x)->flags & FLAGS_NOLIMIT) |
| 254 |
– |
#define SetExemptLimits(x) ((x)->flags |= FLAGS_NOLIMIT) |
| 255 |
– |
#define IsExemptGline(x) ((x)->flags & FLAGS_EXEMPTGLINE) |
| 256 |
– |
#define SetExemptGline(x) ((x)->flags |= FLAGS_EXEMPTGLINE) |
| 257 |
– |
#define IsExemptResv(x) ((x)->flags & FLAGS_EXEMPTRESV) |
| 258 |
– |
#define SetExemptResv(x) ((x)->flags |= FLAGS_EXEMPTRESV) |
| 259 |
– |
#define SetIPSpoof(x) ((x)->flags |= FLAGS_IP_SPOOFING) |
| 260 |
– |
#define IsIPSpoof(x) ((x)->flags & FLAGS_IP_SPOOFING) |
| 261 |
– |
|
| 241 |
|
#define IsFloodDone(x) ((x)->flags & FLAGS_FLOODDONE) |
| 263 |
– |
#define SetFloodDone(x) ((x)->flags |= FLAGS_FLOODDONE) |
| 264 |
– |
#define HasPingCookie(x) ((x)->flags & FLAGS_PING_COOKIE) |
| 265 |
– |
#define SetPingCookie(x) ((x)->flags |= FLAGS_PING_COOKIE) |
| 242 |
|
#define IsHidden(x) ((x)->flags & FLAGS_HIDDEN) |
| 267 |
– |
#define SetHidden(x) ((x)->flags |= FLAGS_HIDDEN) |
| 243 |
|
|
| 244 |
|
|
| 245 |
|
/*! \brief addr_mask_type enumeration */ |
| 250 |
|
MASK_IP /**< IP is masked. 255.255.255.255 is shown instead */ |
| 251 |
|
}; |
| 252 |
|
|
| 253 |
+ |
struct ServicesTag |
| 254 |
+ |
{ |
| 255 |
+ |
dlink_node node; |
| 256 |
+ |
char *tag; |
| 257 |
+ |
unsigned int numeric; |
| 258 |
+ |
unsigned int umodes; |
| 259 |
+ |
}; |
| 260 |
+ |
|
| 261 |
|
/*! \brief Server structure */ |
| 262 |
|
struct Server |
| 263 |
|
{ |
| 269 |
|
/*! \brief ListTask structure */ |
| 270 |
|
struct ListTask |
| 271 |
|
{ |
| 272 |
+ |
dlink_node node; /**< Embedded list node used to link into listing_client_list */ |
| 273 |
|
dlink_list show_mask; /**< Channels to show */ |
| 274 |
|
dlink_list hide_mask; /**< Channels to hide */ |
| 275 |
|
|
| 280 |
|
unsigned int created_max; |
| 281 |
|
unsigned int topicts_min; |
| 282 |
|
unsigned int topicts_max; |
| 283 |
+ |
char topic[TOPICLEN + 1]; |
| 284 |
|
}; |
| 285 |
|
|
| 286 |
< |
/*! \brief LocalUser structure |
| 286 |
> |
/*! \brief Connection structure |
| 287 |
|
* |
| 288 |
|
* Allocated only for local clients, that are directly connected |
| 289 |
|
* to \b this server with a socket. |
| 290 |
|
*/ |
| 291 |
< |
struct LocalUser |
| 291 |
> |
struct Connection |
| 292 |
|
{ |
| 293 |
|
dlink_node lclient_node; |
| 294 |
|
|
| 300 |
|
unsigned int operflags; /**< IRC Operator privilege flags */ |
| 301 |
|
unsigned int random_ping; /**< Holding a 32bit value used for PING cookies */ |
| 302 |
|
|
| 303 |
< |
unsigned int serial; /**< Used to enforce 1 send per nick */ |
| 303 |
> |
uint64_t serial; /**< Used to enforce 1 send per nick */ |
| 304 |
|
|
| 305 |
|
time_t lasttime; /**< ...should be only LOCAL clients? --msa */ |
| 306 |
|
time_t firsttime; /**< Time client was created */ |
| 314 |
|
time_t last_caller_id_time; |
| 315 |
|
time_t first_received_message_time; |
| 316 |
|
time_t last_privmsg; /**< Last time we got a PRIVMSG */ |
| 332 |
– |
time_t last_away; /**< Away since... */ |
| 317 |
|
|
| 318 |
|
int received_number_of_privmsgs; |
| 319 |
|
|
| 330 |
|
|
| 331 |
|
struct |
| 332 |
|
{ |
| 333 |
< |
unsigned int count; /**< How many INVITE/KNOCK/NICK requests client has sent */ |
| 334 |
< |
time_t last_attempt; /**< Last time the INVITE/KNOCK/NICK request was issued */ |
| 335 |
< |
} invite, knock, nick; |
| 333 |
> |
unsigned int count; /**< How many AWAY/INVITE/KNOCK/NICK requests client has sent */ |
| 334 |
> |
time_t last_attempt; /**< Last time the AWAY/INVITE/KNOCK/NICK request was issued */ |
| 335 |
> |
} away, invite, knock, nick; |
| 336 |
|
|
| 337 |
|
struct AuthRequest auth; |
| 338 |
|
struct Listener *listener; /**< Listener accepted from */ |
| 344 |
|
int aftype; /**< Makes life easier for DNS res in IPV6 */ |
| 345 |
|
int country_id; /**< ID corresponding to a ISO 3166 country code */ |
| 346 |
|
|
| 363 |
– |
char *passwd; |
| 347 |
|
fde_t fd; |
| 348 |
+ |
|
| 349 |
|
/* Anti-flood stuff. We track how many messages were parsed and how |
| 350 |
|
* many we were allowed in the current second, and apply a simple |
| 351 |
|
* decay to avoid flooding. |
| 354 |
|
int allow_read; /**< How many we're allowed to read in this second */ |
| 355 |
|
int sent_parsed; /**< How many messages we've parsed in this second */ |
| 356 |
|
|
| 357 |
< |
char* response; /**< Expected CHALLENGE response from client */ |
| 358 |
< |
char* auth_oper; /**< Operator to become if they supply the response */ |
| 357 |
> |
char *password; /**< Password supplied by the client/server */ |
| 358 |
> |
char *challenge_response; /**< Expected CHALLENGE response from client */ |
| 359 |
> |
char *challenge_operator; /**< Operator to become if they supply the response */ |
| 360 |
|
}; |
| 361 |
|
|
| 362 |
|
/*! \brief Client structure */ |
| 365 |
|
dlink_node node; |
| 366 |
|
dlink_node lnode; /**< Used for Server->servers/users */ |
| 367 |
|
|
| 368 |
< |
struct LocalUser *localClient; |
| 368 |
> |
struct Connection *connection; |
| 369 |
|
struct Client *hnext; /**< For client hash table lookups by name */ |
| 370 |
|
struct Client *idhnext; /**< For SID hash table lookups by sid */ |
| 371 |
|
struct Server *serv; /**< ...defined, if this is a server */ |
| 382 |
|
|
| 383 |
|
dlink_list whowas; |
| 384 |
|
dlink_list channel; /**< Chain of channel pointer blocks */ |
| 385 |
+ |
dlink_list svstags; /**< List of ServicesTag items */ |
| 386 |
|
|
| 387 |
|
char away[AWAYLEN + 1]; /**< Client's AWAY message. Can be set/unset via AWAY command */ |
| 388 |
|
char name[HOSTLEN + 1]; /**< Unique name for a client nick or host */ |
| 403 |
– |
char svid[SVIDLEN + 1]; /**< Services ID */ |
| 389 |
|
char id[IDLEN + 1]; /**< Client ID, unique ID per client */ |
| 390 |
+ |
char account[ACCOUNTLEN + 1]; /**< Services account */ |
| 391 |
|
|
| 392 |
|
/* |
| 393 |
|
* client->username is the username from ident or the USER message, |
| 427 |
|
extern dlink_list listing_client_list; |
| 428 |
|
extern dlink_list global_client_list; |
| 429 |
|
extern dlink_list global_server_list; /* global servers on the network */ |
| 444 |
– |
extern dlink_list unknown_list; /* unknown clients ON this server only */ |
| 430 |
|
extern dlink_list local_client_list; /* local clients only ON this server */ |
| 431 |
< |
extern dlink_list serv_list; /* local servers to this server ONLY */ |
| 431 |
> |
extern dlink_list local_server_list; /* local servers to this server ONLY */ |
| 432 |
> |
extern dlink_list unknown_list; /* unknown clients ON this server only */ |
| 433 |
|
extern dlink_list oper_list; /* our opers, duplicated in local_client_list */ |
| 434 |
|
|
| 435 |
|
extern int accept_message(struct Client *, struct Client *); |
| 436 |
< |
extern unsigned int idle_time_get(const struct Client *, const struct Client *); |
| 436 |
> |
extern unsigned int client_get_idle_time(const struct Client *, const struct Client *); |
| 437 |
|
extern struct split_nuh_item *find_accept(const char *, const char *, |
| 438 |
|
const char *, struct Client *, |
| 439 |
|
int (*)(const char *, const char *)); |
| 440 |
+ |
extern void client_attach_svstag(struct Client *, unsigned int, const char *, const char *const); |
| 441 |
+ |
extern void client_clear_svstags(struct Client *); |
| 442 |
|
extern void del_accept(struct split_nuh_item *, struct Client *); |
| 443 |
|
extern void del_all_accepts(struct Client *); |
| 444 |
|
extern void exit_client(struct Client *, const char *); |