| 41 |
|
/* |
| 42 |
|
* status macros. |
| 43 |
|
*/ |
| 44 |
< |
#define STAT_CONNECTING 0x01 |
| 45 |
< |
#define STAT_HANDSHAKE 0x02 |
| 46 |
< |
#define STAT_ME 0x04 |
| 47 |
< |
#define STAT_UNKNOWN 0x08 |
| 48 |
< |
#define STAT_SERVER 0x10 |
| 49 |
< |
#define STAT_CLIENT 0x20 |
| 50 |
< |
|
| 51 |
< |
#define REG_NEED_USER 0x1U /**< User must send USER command */ |
| 52 |
< |
#define REG_NEED_NICK 0x2U /**< User must send NICK command */ |
| 53 |
< |
#define REG_NEED_CAP 0x4U /**< In middle of CAP negotiations */ |
| 54 |
< |
#define REG_INIT (REG_NEED_USER|REG_NEED_NICK) |
| 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) |
| 55 |
|
|
| 56 |
|
#define ID_or_name(x,client_p) ((IsCapable(client_p->from, CAP_TS6) && (x)->id[0]) ? (x)->id : (x)->name) |
| 57 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
|
| 98 |
< |
#define CAP_MULTI_PREFIX 0x00000001 |
| 99 |
< |
#define CAP_AWAY_NOTIFY 0x00000002 |
| 100 |
< |
#define CAP_UHNAMES 0x00000004 |
| 98 |
> |
#define CAP_MULTI_PREFIX 0x00000001U |
| 99 |
> |
#define CAP_AWAY_NOTIFY 0x00000002U |
| 100 |
> |
#define CAP_UHNAMES 0x00000004U |
| 101 |
|
|
| 102 |
|
#define HasCap(x, y) ((x)->localClient->cap_active & (y)) |
| 103 |
|
|
| 104 |
|
|
| 105 |
|
/* housekeeping flags */ |
| 106 |
< |
#define FLAGS_PINGSENT 0x00000001 /**< Unreplied ping sent */ |
| 107 |
< |
#define FLAGS_DEADSOCKET 0x00000002 /**< Local socket is dead--Exiting soon */ |
| 108 |
< |
#define FLAGS_KILLED 0x00000004 /**< Prevents "QUIT" from being sent for this */ |
| 109 |
< |
#define FLAGS_CLOSING 0x00000008 /**< Set when closing to suppress errors */ |
| 110 |
< |
#define FLAGS_GOTID 0x00000010 /**< Successful ident lookup achieved */ |
| 111 |
< |
#define FLAGS_NEEDID 0x00000020 /**< auth{} block say must use ident return */ |
| 112 |
< |
#define FLAGS_SENDQEX 0x00000040 /**< Sendq exceeded */ |
| 113 |
< |
#define FLAGS_IPHASH 0x00000080 /**< Iphashed this client */ |
| 114 |
< |
#define FLAGS_MARK 0x00000100 /**< Marked client */ |
| 115 |
< |
#define FLAGS_CANFLOOD 0x00000200 /**< Client has the ability to flood */ |
| 116 |
< |
#define FLAGS_EXEMPTGLINE 0x00000400 /**< Client can't be G-lined */ |
| 117 |
< |
#define FLAGS_EXEMPTKLINE 0x00000800 /**< Client is exempt from kline */ |
| 118 |
< |
#define FLAGS_NOLIMIT 0x00001000 /**< Client is exempt from limits */ |
| 119 |
< |
#define FLAGS_PING_COOKIE 0x00002000 /**< PING Cookie */ |
| 120 |
< |
#define FLAGS_IP_SPOOFING 0x00004000 /**< Client IP is spoofed */ |
| 121 |
< |
#define FLAGS_FLOODDONE 0x00008000 /**< Flood grace period has been ended. */ |
| 122 |
< |
#define FLAGS_EOB 0x00010000 /**< Server has sent us an EOB */ |
| 123 |
< |
#define FLAGS_HIDDEN 0x00020000 /**< A hidden server. Not shown in /links */ |
| 124 |
< |
#define FLAGS_BLOCKED 0x00040000 /**< Must wait for COMM_SELECT_WRITE */ |
| 125 |
< |
#define FLAGS_USERHOST 0x00080000 /**< Client is in userhost hash */ |
| 126 |
< |
#define FLAGS_BURSTED 0x00100000 /**< User was already bursted */ |
| 127 |
< |
#define FLAGS_EXEMPTRESV 0x00200000 /**< Client is exempt from RESV */ |
| 128 |
< |
#define FLAGS_GOTUSER 0x00400000 /**< If we received a USER command */ |
| 129 |
< |
#define FLAGS_FINISHED_AUTH 0x00800000 /**< Client has been released from auth */ |
| 130 |
< |
#define FLAGS_FLOOD_NOTICED 0x01000000 /**< Notice to opers about this flooder has been sent */ |
| 131 |
< |
#define FLAGS_SERVICE 0x02000000 /**< Client/server is a network service */ |
| 132 |
< |
#define FLAGS_AUTH_SPOOF 0x04000000 /**< User's hostname has been spoofed by an auth{} spoof */ |
| 133 |
< |
#define FLAGS_SSL 0x08000000 /**< User is connected via TLS/SSL */ |
| 134 |
< |
#define FLAGS_SQUIT 0x10000000 |
| 106 |
> |
#define FLAGS_PINGSENT 0x00000001U /**< Unreplied ping sent */ |
| 107 |
> |
#define FLAGS_DEADSOCKET 0x00000002U /**< Local socket is dead--Exiting soon */ |
| 108 |
> |
#define FLAGS_KILLED 0x00000004U /**< Prevents "QUIT" from being sent for this */ |
| 109 |
> |
#define FLAGS_CLOSING 0x00000008U /**< Set when closing to suppress errors */ |
| 110 |
> |
#define FLAGS_GOTID 0x00000010U /**< Successful ident lookup achieved */ |
| 111 |
> |
#define FLAGS_NEEDID 0x00000020U /**< auth{} block say must use ident return */ |
| 112 |
> |
#define FLAGS_SENDQEX 0x00000040U /**< Sendq exceeded */ |
| 113 |
> |
#define FLAGS_IPHASH 0x00000080U /**< Iphashed this client */ |
| 114 |
> |
#define FLAGS_MARK 0x00000100U /**< Marked client */ |
| 115 |
> |
#define FLAGS_CANFLOOD 0x00000200U /**< Client has the ability to flood */ |
| 116 |
> |
#define FLAGS_EXEMPTGLINE 0x00000400U /**< Client can't be G-lined */ |
| 117 |
> |
#define FLAGS_EXEMPTKLINE 0x00000800U /**< Client is exempt from kline */ |
| 118 |
> |
#define FLAGS_NOLIMIT 0x00001000U /**< Client is exempt from limits */ |
| 119 |
> |
#define FLAGS_PING_COOKIE 0x00002000U /**< PING Cookie */ |
| 120 |
> |
#define FLAGS_IP_SPOOFING 0x00004000U /**< Client IP is spoofed */ |
| 121 |
> |
#define FLAGS_FLOODDONE 0x00008000U /**< Flood grace period has been ended. */ |
| 122 |
> |
#define FLAGS_EOB 0x00010000U /**< Server has sent us an EOB */ |
| 123 |
> |
#define FLAGS_HIDDEN 0x00020000U /**< A hidden server. Not shown in /links */ |
| 124 |
> |
#define FLAGS_BLOCKED 0x00040000U /**< Must wait for COMM_SELECT_WRITE */ |
| 125 |
> |
#define FLAGS_USERHOST 0x00080000U /**< Client is in userhost hash */ |
| 126 |
> |
#define FLAGS_BURSTED 0x00100000U /**< User was already bursted */ |
| 127 |
> |
#define FLAGS_EXEMPTRESV 0x00200000U /**< Client is exempt from RESV */ |
| 128 |
> |
#define FLAGS_GOTUSER 0x00400000U /**< If we received a USER command */ |
| 129 |
> |
#define FLAGS_FINISHED_AUTH 0x00800000U /**< Client has been released from auth */ |
| 130 |
> |
#define FLAGS_FLOOD_NOTICED 0x01000000U /**< Notice to opers about this flooder has been sent */ |
| 131 |
> |
#define FLAGS_SERVICE 0x02000000U /**< Client/server is a network service */ |
| 132 |
> |
#define FLAGS_AUTH_SPOOF 0x04000000U /**< User's hostname has been spoofed by an auth{} spoof */ |
| 133 |
> |
#define FLAGS_SSL 0x08000000U /**< User is connected via TLS/SSL */ |
| 134 |
> |
#define FLAGS_SQUIT 0x10000000U |
| 135 |
|
|
| 136 |
|
#define HasFlag(x, y) ((x)->flags & (y)) |
| 137 |
|
#define AddFlag(x, y) ((x)->flags |= (y)) |
| 140 |
|
|
| 141 |
|
|
| 142 |
|
/* umodes, settable flags */ |
| 143 |
< |
#define UMODE_SERVNOTICE 0x00000001 /**< Server notices such as kill */ |
| 144 |
< |
#define UMODE_CCONN 0x00000002 /**< Client Connections */ |
| 145 |
< |
#define UMODE_REJ 0x00000004 /**< Bot Rejections */ |
| 146 |
< |
#define UMODE_SKILL 0x00000008 /**< Server Killed */ |
| 147 |
< |
#define UMODE_FULL 0x00000010 /**< Full messages */ |
| 148 |
< |
#define UMODE_SPY 0x00000020 /**< See STATS / LINKS */ |
| 149 |
< |
#define UMODE_DEBUG 0x00000040 /**< 'debugging' info */ |
| 150 |
< |
#define UMODE_NCHANGE 0x00000080 /**< Nick change notice */ |
| 151 |
< |
#define UMODE_WALLOP 0x00000100 /**< Send wallops to them */ |
| 152 |
< |
#define UMODE_INVISIBLE 0x00000200 /**< Makes user invisible */ |
| 153 |
< |
#define UMODE_BOTS 0x00000400 /**< Shows bots */ |
| 154 |
< |
#define UMODE_EXTERNAL 0x00000800 /**< Show servers introduced and splitting */ |
| 155 |
< |
#define UMODE_CALLERID 0x00001000 /**< Block unless caller id's */ |
| 156 |
< |
#define UMODE_SOFTCALLERID 0x00002000 /**< Block unless on common channel */ |
| 157 |
< |
#define UMODE_UNAUTH 0x00004000 /**< Show unauth connects here */ |
| 158 |
< |
#define UMODE_LOCOPS 0x00008000 /**< Show locops */ |
| 159 |
< |
#define UMODE_DEAF 0x00010000 /**< Don't receive channel messages */ |
| 160 |
< |
#define UMODE_REGISTERED 0x00020000 /**< User has identified for that nick. */ |
| 161 |
< |
#define UMODE_REGONLY 0x00040000 /**< Only registered nicks may PM */ |
| 162 |
< |
#define UMODE_HIDDEN 0x00080000 /**< Operator status is hidden */ |
| 163 |
< |
#define UMODE_OPER 0x00100000 /**< Operator */ |
| 164 |
< |
#define UMODE_ADMIN 0x00200000 /**< Admin on server */ |
| 165 |
< |
#define UMODE_FARCONNECT 0x00400000 /**< Can see remote client connects/exits */ |
| 166 |
< |
#define UMODE_HIDDENHOST 0x00800000 /**< User's host is hidden */ |
| 167 |
< |
#define UMODE_SSL 0x01000000 /**< User is connected via TLS/SSL */ |
| 168 |
< |
#define UMODE_WEBIRC 0x02000000 /**< User connected via a webirc gateway */ |
| 169 |
< |
#define UMODE_HIDEIDLE 0x04000000 /**< Hides idle and signon time in WHOIS */ |
| 170 |
< |
#define UMODE_HIDECHANS 0x08000000 /**< Hides channel list in WHOIS */ |
| 143 |
> |
#define UMODE_SERVNOTICE 0x00000001U /**< Server notices such as kill */ |
| 144 |
> |
#define UMODE_CCONN 0x00000002U /**< Client Connections */ |
| 145 |
> |
#define UMODE_REJ 0x00000004U /**< Bot Rejections */ |
| 146 |
> |
#define UMODE_SKILL 0x00000008U /**< Server Killed */ |
| 147 |
> |
#define UMODE_FULL 0x00000010U /**< Full messages */ |
| 148 |
> |
#define UMODE_SPY 0x00000020U /**< See STATS / LINKS */ |
| 149 |
> |
#define UMODE_DEBUG 0x00000040U /**< 'debugging' info */ |
| 150 |
> |
#define UMODE_NCHANGE 0x00000080U /**< Nick change notice */ |
| 151 |
> |
#define UMODE_WALLOP 0x00000100U /**< Send wallops to them */ |
| 152 |
> |
#define UMODE_INVISIBLE 0x00000200U /**< Makes user invisible */ |
| 153 |
> |
#define UMODE_BOTS 0x00000400U /**< Shows bots */ |
| 154 |
> |
#define UMODE_EXTERNAL 0x00000800U /**< Show servers introduced and splitting */ |
| 155 |
> |
#define UMODE_CALLERID 0x00001000U /**< Block unless caller id's */ |
| 156 |
> |
#define UMODE_SOFTCALLERID 0x00002000U /**< Block unless on common channel */ |
| 157 |
> |
#define UMODE_UNAUTH 0x00004000U /**< Show unauth connects here */ |
| 158 |
> |
#define UMODE_LOCOPS 0x00008000U /**< Show locops */ |
| 159 |
> |
#define UMODE_DEAF 0x00010000U /**< Don't receive channel messages */ |
| 160 |
> |
#define UMODE_REGISTERED 0x00020000U /**< User has identified for that nick. */ |
| 161 |
> |
#define UMODE_REGONLY 0x00040000U /**< Only registered nicks may PM */ |
| 162 |
> |
#define UMODE_HIDDEN 0x00080000U /**< Operator status is hidden */ |
| 163 |
> |
#define UMODE_OPER 0x00100000U /**< Operator */ |
| 164 |
> |
#define UMODE_ADMIN 0x00200000U /**< Admin on server */ |
| 165 |
> |
#define UMODE_FARCONNECT 0x00400000U /**< Can see remote client connects/exits */ |
| 166 |
> |
#define UMODE_HIDDENHOST 0x00800000U /**< User's host is hidden */ |
| 167 |
> |
#define UMODE_SSL 0x01000000U /**< User is connected via TLS/SSL */ |
| 168 |
> |
#define UMODE_WEBIRC 0x02000000U /**< User connected via a webirc gateway */ |
| 169 |
> |
#define UMODE_HIDEIDLE 0x04000000U /**< Hides idle and signon time in WHOIS */ |
| 170 |
> |
#define UMODE_HIDECHANS 0x08000000U /**< Hides channel list in WHOIS */ |
| 171 |
|
|
| 172 |
|
#define UMODE_ALL UMODE_SERVNOTICE |
| 173 |
|
|
| 175 |
|
#define AddUMode(x, y) ((x)->umodes |= (y)) |
| 176 |
|
#define DelUMode(x, y) ((x)->umodes &= ~(y)) |
| 177 |
|
|
| 178 |
– |
#define SEND_UMODES (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP |\ |
| 179 |
– |
UMODE_REGONLY | UMODE_REGISTERED | UMODE_ADMIN |\ |
| 180 |
– |
UMODE_HIDDEN | UMODE_HIDDENHOST | UMODE_SSL |\ |
| 181 |
– |
UMODE_WEBIRC | UMODE_CALLERID | UMODE_SOFTCALLERID|\ |
| 182 |
– |
UMODE_HIDECHANS) |
| 183 |
– |
|
| 184 |
– |
|
| 178 |
|
|
| 179 |
|
/* oper priv flags */ |
| 180 |
< |
#define OPER_FLAG_KILL_REMOTE 0x00000001 /**< Oper can global KILL */ |
| 181 |
< |
#define OPER_FLAG_KILL 0x00000002 /**< Oper can do local KILL */ |
| 182 |
< |
#define OPER_FLAG_UNKLINE 0x00000004 /**< Oper can use use UNKLINE command */ |
| 183 |
< |
#define OPER_FLAG_GLINE 0x00000008 /**< Oper can use GLINE command */ |
| 184 |
< |
#define OPER_FLAG_K 0x00000010 /**< Oper can use KLINE command */ |
| 185 |
< |
#define OPER_FLAG_XLINE 0x00000020 /**< Oper can use XLINE command */ |
| 186 |
< |
#define OPER_FLAG_DIE 0x00000040 /**< Oper can use DIE command */ |
| 187 |
< |
#define OPER_FLAG_REHASH 0x00000080 /**< Oper can use REHASH command */ |
| 188 |
< |
#define OPER_FLAG_ADMIN 0x00000100 /**< Oper can set user mode +a*/ |
| 189 |
< |
#define OPER_FLAG_REMOTEBAN 0x00000200 /**< Oper can set remote bans */ |
| 190 |
< |
#define OPER_FLAG_GLOBOPS 0x00000400 /**< Oper can use GLOBOPS command */ |
| 191 |
< |
#define OPER_FLAG_MODULE 0x00000800 /**< Oper can use MODULE commands */ |
| 192 |
< |
#define OPER_FLAG_RESTART 0x00001000 /**< Oper can use RESTART command */ |
| 193 |
< |
#define OPER_FLAG_DLINE 0x00002000 /**< Oper can use DLINE command */ |
| 194 |
< |
#define OPER_FLAG_UNDLINE 0x00004000 /**< Oper can use UNDLINE command */ |
| 195 |
< |
#define OPER_FLAG_SET 0x00008000 /**< Oper can use SET command */ |
| 196 |
< |
#define OPER_FLAG_SQUIT 0x00010000 /**< Oper can do local SQUIT */ |
| 197 |
< |
#define OPER_FLAG_SQUIT_REMOTE 0x00020000 /**< Oper can do global SQUIT */ |
| 198 |
< |
#define OPER_FLAG_CONNECT 0x00040000 /**< Oper can do local CONNECT */ |
| 199 |
< |
#define OPER_FLAG_CONNECT_REMOTE 0x00080000 /**< Oper can do global CONNECT */ |
| 200 |
< |
#define OPER_FLAG_WALLOPS 0x00100000 /**< Oper can use WALLOPS command */ |
| 201 |
< |
#define OPER_FLAG_LOCOPS 0x00200000 /**< Oper can use LOCOPS command */ |
| 202 |
< |
#define OPER_FLAG_UNXLINE 0x00400000 /**< Oper can use UNXLINE command */ |
| 180 |
> |
#define OPER_FLAG_KILL_REMOTE 0x00000001U /**< Oper can KILL remote users */ |
| 181 |
> |
#define OPER_FLAG_KILL 0x00000002U /**< Oper can KILL local users */ |
| 182 |
> |
#define OPER_FLAG_UNKLINE 0x00000004U /**< Oper can use UNKLINE command */ |
| 183 |
> |
#define OPER_FLAG_GLINE 0x00000008U /**< Oper can use GLINE command */ |
| 184 |
> |
#define OPER_FLAG_KLINE 0x00000010U /**< Oper can use KLINE command */ |
| 185 |
> |
#define OPER_FLAG_XLINE 0x00000020U /**< Oper can use XLINE command */ |
| 186 |
> |
#define OPER_FLAG_DIE 0x00000040U /**< Oper can use DIE command */ |
| 187 |
> |
#define OPER_FLAG_REHASH 0x00000080U /**< Oper can use REHASH command */ |
| 188 |
> |
#define OPER_FLAG_ADMIN 0x00000100U /**< Oper can set user mode +a */ |
| 189 |
> |
#define OPER_FLAG_REMOTEBAN 0x00000200U /**< Oper can set remote bans */ |
| 190 |
> |
#define OPER_FLAG_GLOBOPS 0x00000400U /**< Oper can use GLOBOPS command */ |
| 191 |
> |
#define OPER_FLAG_MODULE 0x00000800U /**< Oper can use MODULE command */ |
| 192 |
> |
#define OPER_FLAG_RESTART 0x00001000U /**< Oper can use RESTART command */ |
| 193 |
> |
#define OPER_FLAG_DLINE 0x00002000U /**< Oper can use DLINE command */ |
| 194 |
> |
#define OPER_FLAG_UNDLINE 0x00004000U /**< Oper can use UNDLINE command */ |
| 195 |
> |
#define OPER_FLAG_SET 0x00008000U /**< Oper can use SET command */ |
| 196 |
> |
#define OPER_FLAG_SQUIT 0x00010000U /**< Oper can do local SQUIT */ |
| 197 |
> |
#define OPER_FLAG_SQUIT_REMOTE 0x00020000U /**< Oper can do remote SQUIT */ |
| 198 |
> |
#define OPER_FLAG_CONNECT 0x00040000U /**< Oper can do local CONNECT */ |
| 199 |
> |
#define OPER_FLAG_CONNECT_REMOTE 0x00080000U /**< Oper can do remote CONNECT */ |
| 200 |
> |
#define OPER_FLAG_WALLOPS 0x00100000U /**< Oper can use WALLOPS command */ |
| 201 |
> |
#define OPER_FLAG_LOCOPS 0x00200000U /**< Oper can use LOCOPS command */ |
| 202 |
> |
#define OPER_FLAG_UNXLINE 0x00400000U /**< Oper can use UNXLINE command */ |
| 203 |
|
|
| 204 |
|
|
| 205 |
|
#define HasOFlag(x, y) (MyConnect(x) ? (x)->localClient->operflags & (y) : 0) |
| 328 |
|
spambot every time this gets to 0 */ |
| 329 |
|
time_t last_caller_id_time; |
| 330 |
|
time_t first_received_message_time; |
| 338 |
– |
time_t last_nick_change; |
| 331 |
|
time_t last_privmsg; /**< Last time we got a PRIVMSG */ |
| 332 |
|
time_t last_away; /**< Away since... */ |
| 333 |
|
|
| 334 |
|
int received_number_of_privmsgs; |
| 343 |
– |
unsigned int number_of_nick_changes; |
| 335 |
|
|
| 336 |
|
struct ListTask *list_task; |
| 337 |
|
|
| 346 |
|
|
| 347 |
|
struct |
| 348 |
|
{ |
| 349 |
< |
unsigned int count; /**< How many INVITE/KNOCK requests client has send */ |
| 350 |
< |
time_t last_attempt; /**< Last time the INVITE/KNOCK request was issued */ |
| 351 |
< |
} invite, knock; |
| 349 |
> |
unsigned int count; /**< How many INVITE/KNOCK/NICK requests client has sent */ |
| 350 |
> |
time_t last_attempt; /**< Last time the INVITE/KNOCK/NICK request was issued */ |
| 351 |
> |
} invite, knock, nick; |
| 352 |
|
|
| 353 |
|
struct AuthRequest auth; |
| 354 |
|
struct Listener *listener; /**< Listener accepted from */ |
| 440 |
|
extern struct Client me; |
| 441 |
|
extern dlink_list listing_client_list; |
| 442 |
|
extern dlink_list global_client_list; |
| 443 |
+ |
extern dlink_list global_server_list; /* global servers on the network */ |
| 444 |
|
extern dlink_list unknown_list; /* unknown clients ON this server only */ |
| 445 |
|
extern dlink_list local_client_list; /* local clients only ON this server */ |
| 446 |
|
extern dlink_list serv_list; /* local servers to this server ONLY */ |
| 455 |
– |
extern dlink_list global_serv_list; /* global servers on the network */ |
| 447 |
|
extern dlink_list oper_list; /* our opers, duplicated in local_client_list */ |
| 448 |
|
|
| 449 |
|
extern int accept_message(struct Client *, struct Client *); |