mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-03 17:23:13 +02:00
Merge branch 'unreal60_dev' into unreal60_dev+watch
This commit is contained in:
@@ -998,8 +998,6 @@ help Rehash {
|
||||
" The flags are used to rehash other config files, valid flags are:";
|
||||
" -dns - Reinitializes and reloads the resolver";
|
||||
" -garbage - Force garbage collection";
|
||||
" -motd - Only re-read all MOTD, BOTMOTD, OPERMOTD and RULES files";
|
||||
" (including those in tld{} blocks)";
|
||||
" -tls - Reloads SSL/TLS certificates";
|
||||
}
|
||||
|
||||
|
||||
@@ -912,9 +912,7 @@ help Rehash {
|
||||
" -";
|
||||
" Die Flags werden benutzt, um andere Configdateien zu rehashen.";
|
||||
" Gültige Flags sind:";
|
||||
" -motd - Rehasht alle MOTD Dateien und RULES Dateien (incl. tld{})";
|
||||
" -opermotd - Rehasht die OPERMOTD";
|
||||
" -botmotd - Rehasht die BOTMOTD";
|
||||
" -dns - Rehasht der DNS resolver";
|
||||
" -garbage - bewirkt garbage collection";
|
||||
" Anmerkung des Übersetzers: Garbage collection (GC) (englisch,";
|
||||
" wörtlich deutsch: Mülleinsammeln, auch Freispeichersammlung) ist";
|
||||
|
||||
@@ -984,8 +984,6 @@ help Rehash {
|
||||
" -";
|
||||
" -dns - Reinicializa y recarga el resolver";
|
||||
" -garbage - Fuerza la eliminacion de basura";
|
||||
" -motd - Solo re-lee todos los archivos MOTD, BOTMOTD, OPERMOTD y RULES";
|
||||
" (incluidos los bloques de tld{} )";
|
||||
" -tls - Recarga los certificados SSL/TLS";
|
||||
};
|
||||
|
||||
|
||||
@@ -940,8 +940,6 @@ help Rehash {
|
||||
" Les flags valides sont :";
|
||||
" -dns - Réinitialise et recharge le résolveur";
|
||||
" -garbage - Force le nettoyage de la mémoire";
|
||||
" -motd - Ne recharge que les fichiers MOTD, BOTMOTD, OPERMOTD et RULES";
|
||||
" (dont ceux définis dans les tld{} blocks)";
|
||||
" -tls - Recharge les certificats SSL/TLS";
|
||||
}
|
||||
|
||||
|
||||
@@ -845,7 +845,6 @@ help Rehash {
|
||||
" Le flag disponibili sono:";
|
||||
" -dns - Inizializza e ricarica il risolutore DNS";
|
||||
" -garbage - Forza la pulizia dei file inutili";
|
||||
" -motd - Ricarica i file MOTD, BOTMOTD, OPERMOTD e RULES, inclusi quelli nei blocchi tld";
|
||||
" -tls - Ricarica i certificati SSL/TLS";
|
||||
}
|
||||
|
||||
|
||||
@@ -998,8 +998,6 @@ help Rehash {
|
||||
" De vlaggen worden gebruikt om andere configuratiebestanden te herhashen, geldige vlaggen zijn:";
|
||||
" -dns - Reinitialiseert en herlaadt de resolver";
|
||||
" -garbage - Forceer afvalverzameling";
|
||||
" -motd - Alleen alle MOTD-, BOTMOTD, OPERMOTD en RULES-bestanden opnieuw lezen";
|
||||
" (inclusief die in tld-blokken)";
|
||||
" -tls - Reloads SSL/TLS-certificaten";
|
||||
}
|
||||
|
||||
|
||||
@@ -1028,8 +1028,6 @@ help Rehash {
|
||||
" flagi to:";
|
||||
" -dns - Ponownie inicjalizuje i przeładowuje narzędzie rozpoznawania nazw DNS?";
|
||||
" -garbage - Wymusza zadziałanie mechanizmu oczyszczania (garbage collection)";
|
||||
" -motd - Odświeża tylko wszystkie pliki MOTD, BOTMOTD, OPERMOTD i RULES";
|
||||
" (włącznie z tymi podanymi w blokach tld {})";
|
||||
" -tls - Ponownie ładuje certyfikaty SSL/TLS";
|
||||
}
|
||||
|
||||
|
||||
@@ -1013,9 +1013,7 @@ help Rehash {
|
||||
" Список флагов:";
|
||||
" -dns - Переинециализация и перезагрузка преобразования адресов";
|
||||
" -garbage - Активирует \"сборщик мусора\"";
|
||||
" -motd - Перечитает все файлы MOTD, BOTMOTD, OPERMOTD и RULES (включая tld{})";
|
||||
" -tls - Перезагрузка сертификатов SSL/TLS";
|
||||
|
||||
}
|
||||
|
||||
help Restart {
|
||||
|
||||
@@ -871,8 +871,6 @@ help Rehash {
|
||||
" Flaglar, diğer config dosyalarını tekrar kullanmak için kullanılır, aşağıdakiler geçerli flaglardır:";
|
||||
" -dns - Yeniden başlatır ve yeniden yükler, çözümler";
|
||||
" -garbage - Değersiz dataların toplanmasını sağlar";
|
||||
" -motd - Tüm MOTD, BOTMOTD, OPERMOTD ve RULES dosyalarını tekrar okumasını sağlar";
|
||||
" (tld{}'de onlar dahil bloklar)";
|
||||
" -tls - SSL/TLS Sertifikaları yeniden okur";
|
||||
}
|
||||
|
||||
|
||||
@@ -99,19 +99,6 @@ set {
|
||||
*/
|
||||
convert-to-lowercase yes;
|
||||
|
||||
/* FULLSTATUS-ON-LOAD:
|
||||
* If enabled, then upon loading it will check all users that are currently
|
||||
* connected and give a status report about who it would have killed.
|
||||
* Note that it doesn't actually kill any currently connected users, it is for
|
||||
* informative purposes only.
|
||||
* This can be (very) useful if you use the module for the first time.
|
||||
* But you probably want to disable it after a while, since once the module
|
||||
* is actively dealing with randomly looking persons, it shouldn't report any
|
||||
* users anymore on load and then this check only eats useless CPU on /REHASH.
|
||||
* Enabled by default.
|
||||
*/
|
||||
fullstatus-on-load yes;
|
||||
|
||||
/* SHOW-FAILEDCONNECTS:
|
||||
* This will send out a notice whenever a randomly looking user has been catched
|
||||
* during connecting. Obviously this can be pretty noisy.
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
|
||||
#define MODEBUFLEN 200
|
||||
|
||||
#define ChannelExists(n) (find_channel(n, NULL))
|
||||
#define ChannelExists(n) (find_channel(n))
|
||||
|
||||
/* NOTE: Timestamps will be added to MODE-commands, so never make
|
||||
* RESYNCMODES and MODEPARAMS higher than MAXPARA-3. DALnet servers
|
||||
|
||||
@@ -176,6 +176,7 @@ struct Configuration {
|
||||
BroadcastChannelMessagesOption broadcast_channel_messages;
|
||||
AllowedChannelChars allowed_channelchars;
|
||||
HideIdleTimePolicy hide_idle_time;
|
||||
LogSnomask *log_snomasks;
|
||||
};
|
||||
|
||||
extern MODVAR Configuration iConf;
|
||||
|
||||
+12
-4
@@ -317,11 +317,13 @@ extern Ban *make_ban();
|
||||
extern User *make_user(Client *);
|
||||
extern Server *make_server();
|
||||
extern Client *make_client(Client *, Client *);
|
||||
extern Channel *make_channel(char *name);
|
||||
extern Member *find_channel_link(Member *, Channel *);
|
||||
extern char *pretty_mask(char *);
|
||||
extern void add_client_to_list(Client *);
|
||||
extern void remove_client_from_list(Client *);
|
||||
extern void initlists();
|
||||
extern void initlists(void);
|
||||
extern void initlist_channels(void);
|
||||
extern struct hostent *get_res(char *);
|
||||
extern struct hostent *gethost_byaddr(char *, Link *);
|
||||
extern struct hostent *gethost_byname(char *, Link *);
|
||||
@@ -336,7 +338,6 @@ extern void del_queries(char *);
|
||||
#define CHAN_HASH_TABLE_SIZE 32768
|
||||
#define WHOWAS_HASH_TABLE_SIZE 32768
|
||||
#define THROTTLING_HASH_TABLE_SIZE 8192
|
||||
#define hash_find_channel find_channel
|
||||
extern uint64_t siphash(const char *in, const char *k);
|
||||
extern uint64_t siphash_raw(const char *in, size_t len, const char *k);
|
||||
extern uint64_t siphash_nocase(const char *in, const char *k);
|
||||
@@ -353,7 +354,7 @@ extern Channel *hash_get_chan_bucket(uint64_t);
|
||||
extern Client *hash_find_client(const char *, Client *);
|
||||
extern Client *hash_find_id(const char *, Client *);
|
||||
extern Client *hash_find_nickatserver(const char *, Client *);
|
||||
extern Channel *find_channel(char *name, Channel *channel);
|
||||
extern Channel *find_channel(char *name);
|
||||
extern Client *hash_find_server(const char *, Client *);
|
||||
extern struct MODVAR ThrottlingBucket *ThrottlingHash[THROTTLING_HASH_TABLE_SIZE];
|
||||
|
||||
@@ -638,7 +639,6 @@ extern int spamfilter_getconftargets(char *s);
|
||||
extern void remove_oper_snomasks(Client *client);
|
||||
extern void remove_oper_modes(Client *client);
|
||||
extern char *spamfilter_inttostring_long(int v);
|
||||
extern Channel *get_channel(Client *cptr, char *chname, int flag);
|
||||
extern MODVAR char backupbuf[];
|
||||
extern int is_invited(Client *client, Channel *channel);
|
||||
extern void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *channel, int hide_local_modes);
|
||||
@@ -694,6 +694,7 @@ extern MODVAR int (*tkl_hash)(unsigned int c);
|
||||
extern MODVAR char (*tkl_typetochar)(int type);
|
||||
extern MODVAR int (*tkl_chartotype)(char c);
|
||||
extern MODVAR char *(*tkl_type_string)(TKL *tk);
|
||||
extern MODVAR char *(*tkl_type_config_string)(TKL *tk);
|
||||
extern MODVAR TKL *(*tkl_add_serverban)(int type, char *usermask, char *hostmask, char *reason, char *setby,
|
||||
time_t expire_at, time_t set_at, int soft, int flags);
|
||||
extern MODVAR TKL *(*tkl_add_banexception)(int type, char *usermask, char *hostmask, char *reason, char *set_by,
|
||||
@@ -774,6 +775,7 @@ extern MODVAR int (*watch_del)(char *nick, Client *client, int flags);
|
||||
extern MODVAR int (*watch_del_list)(Client *client, int flags);
|
||||
extern MODVAR Watch *(*watch_get)(char *nick);
|
||||
extern MODVAR int (*watch_check)(Client *client, int reply);
|
||||
extern MODVAR char *(*tkl_uhost)(TKL *tkl, char *buf, size_t buflen, int options);
|
||||
/* /Efuncs */
|
||||
|
||||
/* SSL/TLS functions */
|
||||
@@ -1088,14 +1090,20 @@ extern LogType log_type_stringtoval(char *str);
|
||||
extern char *log_type_valtostring(LogType v);
|
||||
#ifdef DEBUGMODE
|
||||
#define unreal_log(...) do_unreal_log(__VA_ARGS__, log_data_source(__FILE__, __LINE__, __FUNCTION__), NULL)
|
||||
#define unreal_log_raw(...) do_unreal_log_raw(__VA_ARGS__, log_data_source(__FILE__, __LINE__, __FUNCTION__), NULL)
|
||||
#else
|
||||
#define unreal_log(...) do_unreal_log(__VA_ARGS__, NULL)
|
||||
#define unreal_log_raw(...) do_unreal_log_raw(__VA_ARGS__, NULL)
|
||||
#endif
|
||||
extern void do_unreal_log(LogLevel loglevel, char *subsystem, char *event_id, Client *client, char *msg, ...) __attribute__((format(printf,5,0)));
|
||||
extern void do_unreal_log_raw(LogLevel loglevel, char *subsystem, char *event_id, Client *client, char *msg, ...);
|
||||
extern LogData *log_data_string(const char *key, const char *str);
|
||||
extern LogData *log_data_char(const char *key, const char c);
|
||||
extern LogData *log_data_integer(const char *key, int64_t integer);
|
||||
extern LogData *log_data_timestamp(const char *key, time_t ts);
|
||||
extern LogData *log_data_client(const char *key, Client *client);
|
||||
extern LogData *log_data_source(const char *file, int line, const char *function);
|
||||
extern LogData *log_data_socket_error(int fd);
|
||||
extern LogData *log_data_link_block(ConfigItem_link *link);
|
||||
extern LogData *log_data_tkl(const char *key, TKL *tkl);
|
||||
/* end of logging */
|
||||
|
||||
+3
-2
@@ -1695,12 +1695,11 @@ int hooktype_local_oper(Client *client, int add);
|
||||
int hooktype_local_pass(Client *client, char *password);
|
||||
|
||||
/** Called when a channel is created (function prototype for HOOKTYPE_CHANNEL_CREATE).
|
||||
* @param client The client
|
||||
* @param channel The channel that just got created
|
||||
* @note This function is not used much, use hooktype_local_join() and hooktype_remote_join() instead.
|
||||
* @return The return value is ignored (use return 0)
|
||||
*/
|
||||
int hooktype_channel_create(Client *client, Channel *channel);
|
||||
int hooktype_channel_create(Channel *channel);
|
||||
|
||||
/** Called when a channel is completely destroyed (function prototype for HOOKTYPE_CHANNEL_DESTROY).
|
||||
* @param channel The channel that is about to be destroyed
|
||||
@@ -2344,6 +2343,7 @@ enum EfunctionType {
|
||||
EFUNC_MTAGS_TO_STRING,
|
||||
EFUNC_TKL_CHARTOTYPE,
|
||||
EFUNC_TKL_TYPE_STRING,
|
||||
EFUNC_TKL_TYPE_CONFIG_STRING,
|
||||
EFUNC_CAN_SEND_TO_CHANNEL,
|
||||
EFUNC_CAN_SEND_TO_USER,
|
||||
EFUNC_BROADCAST_MD_GLOBALVAR,
|
||||
@@ -2373,6 +2373,7 @@ enum EfunctionType {
|
||||
EFUNC_WATCH_DEL_LIST,
|
||||
EFUNC_WATCH_GET,
|
||||
EFUNC_WATCH_CHECK,
|
||||
EFUNC_TKL_UHOST,
|
||||
};
|
||||
|
||||
/* Module flags */
|
||||
|
||||
+18
-6
@@ -234,11 +234,16 @@ typedef struct LogData {
|
||||
} LogData;
|
||||
|
||||
/** New log levels for unreal_log() */
|
||||
/* Note: the reason for these high numbers is so we can easily catch
|
||||
* if someone makes a mistake to use LOG_INFO (from syslog.h) instead
|
||||
* of the ULOG_xxx levels.
|
||||
*/
|
||||
typedef enum LogLevel {
|
||||
ULOG_INFO = 0,
|
||||
ULOG_WARN = 1,
|
||||
ULOG_ERROR = 2,
|
||||
ULOG_FATAL = 3
|
||||
ULOG_DEBUG = 1000,
|
||||
ULOG_INFO = 2000,
|
||||
ULOG_WARNING = 3000,
|
||||
ULOG_ERROR = 4000,
|
||||
ULOG_FATAL = 5000
|
||||
} LogLevel;
|
||||
|
||||
/** Logging types (text, json, etc) */
|
||||
@@ -248,6 +253,13 @@ typedef enum LogType {
|
||||
LOG_TYPE_JSON = 2,
|
||||
} LogType;
|
||||
|
||||
typedef struct LogSnomask LogSnomask;
|
||||
struct LogSnomask {
|
||||
LogSnomask *prev, *next;
|
||||
char *subsystem;
|
||||
long snomask;
|
||||
};
|
||||
|
||||
/*
|
||||
** 'offsetof' is defined in ANSI-C. The following definition
|
||||
** is not absolutely portable (I have been told), but so far
|
||||
@@ -1888,7 +1900,7 @@ struct ConfigItem_help {
|
||||
|
||||
struct ConfigItem_offchans {
|
||||
ConfigItem_offchans *prev, *next;
|
||||
char chname[CHANNELLEN+1];
|
||||
char name[CHANNELLEN+1];
|
||||
char *topic;
|
||||
};
|
||||
|
||||
@@ -2027,7 +2039,7 @@ struct Channel {
|
||||
Ban *invexlist; /**< List of invite exceptions (+I) */
|
||||
char *mode_lock; /**< Mode lock (MLOCK) applied to channel - usually by Services */
|
||||
ModData moddata[MODDATA_MAX_CHANNEL]; /**< Channel attached module data, used by the ModData system */
|
||||
char chname[1]; /**< Channel name */
|
||||
char name[CHANNELLEN+1]; /**< Channel name */
|
||||
};
|
||||
|
||||
/** user/channel member struct (channel->members).
|
||||
|
||||
+6
-6
@@ -106,19 +106,19 @@ void cmd_alias(Client *client, MessageTag *mtags, int parc, char *parv[], char *
|
||||
else if (alias->type == ALIAS_CHANNEL)
|
||||
{
|
||||
Channel *channel;
|
||||
if ((channel = find_channel(alias->nick, NULL)))
|
||||
if ((channel = find_channel(alias->nick)))
|
||||
{
|
||||
char *msg = parv[1];
|
||||
char *errmsg = NULL;
|
||||
if (can_send_to_channel(client, channel, &msg, &errmsg, 0))
|
||||
{
|
||||
if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_CHANMSG, cmd, channel->chname, 0, NULL))
|
||||
if (alias->spamfilter && match_spamfilter(client, parv[1], SPAMF_CHANMSG, cmd, channel->name, 0, NULL))
|
||||
return;
|
||||
new_message(client, NULL, &mtags);
|
||||
sendto_channel(channel, client, client->direction,
|
||||
PREFIX_ALL, 0, SEND_ALL|SKIP_DEAF, mtags,
|
||||
":%s PRIVMSG %s :%s",
|
||||
client->name, channel->chname, parv[1]);
|
||||
client->name, channel->name, parv[1]);
|
||||
free_message_tags(mtags);
|
||||
return;
|
||||
}
|
||||
@@ -241,19 +241,19 @@ void cmd_alias(Client *client, MessageTag *mtags, int parc, char *parv[], char *
|
||||
else if (format->type == ALIAS_CHANNEL)
|
||||
{
|
||||
Channel *channel;
|
||||
if ((channel = find_channel(format->nick, NULL)))
|
||||
if ((channel = find_channel(format->nick)))
|
||||
{
|
||||
char *msg = output;
|
||||
char *errmsg = NULL;
|
||||
if (!can_send_to_channel(client, channel, &msg, &errmsg, 0))
|
||||
{
|
||||
if (alias->spamfilter && match_spamfilter(client, output, SPAMF_CHANMSG, cmd, channel->chname, 0, NULL))
|
||||
if (alias->spamfilter && match_spamfilter(client, output, SPAMF_CHANMSG, cmd, channel->name, 0, NULL))
|
||||
return;
|
||||
new_message(client, NULL, &mtags);
|
||||
sendto_channel(channel, client, client->direction,
|
||||
PREFIX_ALL, 0, SEND_ALL|SKIP_DEAF, mtags,
|
||||
":%s PRIVMSG %s :%s",
|
||||
client->name, channel->chname, parv[1]);
|
||||
client->name, channel->name, parv[1]);
|
||||
free_message_tags(mtags);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -336,10 +336,10 @@ static void unload_extcmode_commit(Cmode *cmode)
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s -%c",
|
||||
me.name, channel->chname, cmode->flag);
|
||||
me.name, channel->name, cmode->flag);
|
||||
sendto_server(NULL, 0, 0, mtags,
|
||||
":%s MODE %s -%c 0",
|
||||
me.id, channel->chname, cmode->flag);
|
||||
me.id, channel->name, cmode->flag);
|
||||
free_message_tags(mtags);
|
||||
|
||||
channel->mode.extmode &= ~cmode->mode;
|
||||
@@ -360,17 +360,17 @@ static void unload_extcmode_commit(Cmode *cmode)
|
||||
char *param = cmode->get_param(GETPARASTRUCT(channel, cmode->flag));
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s -%c %s",
|
||||
me.name, channel->chname, cmode->flag, param);
|
||||
me.name, channel->name, cmode->flag, param);
|
||||
sendto_server(NULL, 0, 0, mtags,
|
||||
":%s MODE %s -%c %s 0",
|
||||
me.id, channel->chname, cmode->flag, param);
|
||||
me.id, channel->name, cmode->flag, param);
|
||||
} else {
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s -%c",
|
||||
me.name, channel->chname, cmode->flag);
|
||||
me.name, channel->name, cmode->flag);
|
||||
sendto_server(NULL, 0, 0, mtags,
|
||||
":%s MODE %s -%c 0",
|
||||
me.id, channel->chname, cmode->flag);
|
||||
me.id, channel->name, cmode->flag);
|
||||
}
|
||||
free_message_tags(mtags);
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ int (*tkl_hash)(unsigned int c);
|
||||
char (*tkl_typetochar)(int type);
|
||||
int (*tkl_chartotype)(char c);
|
||||
char *(*tkl_type_string)(TKL *tk);
|
||||
char *(*tkl_type_config_string)(TKL *tk);
|
||||
char *(*tkl_uhost)(TKL *tkl, char *buf, size_t buflen, int options);
|
||||
TKL *(*tkl_add_serverban)(int type, char *usermask, char *hostmask, char *reason, char *setby,
|
||||
time_t expire_at, time_t set_at, int soft, int flags);
|
||||
TKL *(*tkl_add_nameban)(int type, char *name, int hold, char *reason, char *setby,
|
||||
@@ -354,6 +356,7 @@ void efunctions_init(void)
|
||||
efunc_init_function(EFUNC_MTAGS_TO_STRING, mtags_to_string, &mtags_to_string_default_handler);
|
||||
efunc_init_function(EFUNC_TKL_CHARTOTYPE, tkl_chartotype, NULL);
|
||||
efunc_init_function(EFUNC_TKL_TYPE_STRING, tkl_type_string, NULL);
|
||||
efunc_init_function(EFUNC_TKL_TYPE_CONFIG_STRING, tkl_type_config_string, NULL);
|
||||
efunc_init_function(EFUNC_CAN_SEND_TO_CHANNEL, can_send_to_channel, NULL);
|
||||
efunc_init_function(EFUNC_BROADCAST_MD_GLOBALVAR, broadcast_md_globalvar, NULL);
|
||||
efunc_init_function(EFUNC_BROADCAST_MD_GLOBALVAR_CMD, broadcast_md_globalvar_cmd, NULL);
|
||||
@@ -381,5 +384,6 @@ void efunctions_init(void)
|
||||
efunc_init_function(EFUNC_WATCH_DEL_LIST, watch_del_list, NULL);
|
||||
efunc_init_function(EFUNC_WATCH_GET, watch_get, NULL);
|
||||
efunc_init_function(EFUNC_WATCH_CHECK, watch_check, NULL);
|
||||
efunc_init_function(EFUNC_TKL_UHOST, tkl_uhost, NULL);
|
||||
}
|
||||
|
||||
|
||||
+53
-33
@@ -47,6 +47,8 @@ MODVAR char modebuf[BUFSIZE];
|
||||
/** Parameter buffer (eg: "key 123") */
|
||||
MODVAR char parabuf[BUFSIZE];
|
||||
|
||||
static mp_pool_t *channel_pool = NULL;
|
||||
|
||||
/** This describes the letters, modes and options for core channel modes.
|
||||
* These are +ntmispklr and also the list modes +vhoaq and +beI.
|
||||
*/
|
||||
@@ -272,7 +274,7 @@ int add_listmode_ex(Ban **list, Client *client, Channel *channel, char *banid, c
|
||||
if (MyUser(client))
|
||||
{
|
||||
/* Only send the error to local clients */
|
||||
sendnumeric(client, ERR_BANLISTFULL, channel->chname, banid);
|
||||
sendnumeric(client, ERR_BANLISTFULL, channel->name, banid);
|
||||
}
|
||||
do_not_add = 1;
|
||||
}
|
||||
@@ -301,7 +303,7 @@ int add_listmode_ex(Ban **list, Client *client, Channel *channel, char *banid, c
|
||||
if (MyUser(client))
|
||||
{
|
||||
/* Only send the error to local clients */
|
||||
sendnumeric(client, ERR_BANLISTFULL, channel->chname, banid);
|
||||
sendnumeric(client, ERR_BANLISTFULL, channel->name, banid);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -928,47 +930,65 @@ int valid_channelname(const char *cname)
|
||||
return 1; /* Valid */
|
||||
}
|
||||
|
||||
/** Get existing channel 'chname' or create a new one.
|
||||
* @param client User creating or searching this channel
|
||||
* @param chname Channel name
|
||||
void initlist_channels(void)
|
||||
{
|
||||
channel_pool = mp_pool_new(sizeof(Channel), 512 * 1024);
|
||||
}
|
||||
|
||||
/** Create channel 'name' (or if it exists, return the existing one)
|
||||
* @param name Channel name
|
||||
* @param flag If set to 'CREATE' then the channel is
|
||||
* created if it does not exist.
|
||||
* @returns Pointer to channel (new or existing).
|
||||
* @note Be sure to call valid_channelname() first before
|
||||
* you blindly call this function!
|
||||
*/
|
||||
Channel *get_channel(Client *client, char *chname, int flag)
|
||||
Channel *make_channel(char *name)
|
||||
{
|
||||
Channel *channel;
|
||||
int len;
|
||||
int len;
|
||||
char *p;
|
||||
char namebuf[CHANNELLEN+1];
|
||||
|
||||
if (BadPtr(chname))
|
||||
if (BadPtr(name))
|
||||
return NULL;
|
||||
|
||||
len = strlen(chname);
|
||||
if (MyUser(client) && len > CHANNELLEN)
|
||||
/* Copy and silently truncate */
|
||||
strlcpy(namebuf, name, sizeof(namebuf));
|
||||
|
||||
/* Copied from valid_channelname(), the minimal requirements */
|
||||
for (p = namebuf; *p; p++)
|
||||
{
|
||||
len = CHANNELLEN;
|
||||
*(chname + CHANNELLEN) = '\0';
|
||||
}
|
||||
if ((channel = find_channel(chname, NULL)))
|
||||
return (channel);
|
||||
if (flag == CREATE)
|
||||
{
|
||||
channel = safe_alloc(sizeof(Channel) + len);
|
||||
strlcpy(channel->chname, chname, len + 1);
|
||||
if (channels)
|
||||
channels->prevch = channel;
|
||||
channel->topic = NULL;
|
||||
channel->topic_nick = NULL;
|
||||
channel->prevch = NULL;
|
||||
channel->nextch = channels;
|
||||
channel->creationtime = MyUser(client) ? TStime() : 0;
|
||||
channels = channel;
|
||||
add_to_channel_hash_table(chname, channel);
|
||||
irccounts.channels++;
|
||||
RunHook2(HOOKTYPE_CHANNEL_CREATE, client, channel);
|
||||
if (*p < 33 || *p == ',' || *p == ':')
|
||||
{
|
||||
*p = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Exists? Return it. */
|
||||
if ((channel = find_channel(name)))
|
||||
return channel;
|
||||
|
||||
channel = mp_pool_get(channel_pool);
|
||||
memset(channel, 0, sizeof(Channel));
|
||||
|
||||
strlcpy(channel->name, name, sizeof(channel->name));
|
||||
|
||||
if (channels)
|
||||
channels->prevch = channel;
|
||||
|
||||
channel->topic = NULL;
|
||||
channel->topic_nick = NULL;
|
||||
channel->prevch = NULL;
|
||||
channel->nextch = channels;
|
||||
channel->creationtime = TStime();
|
||||
channels = channel;
|
||||
add_to_channel_hash_table(channel->name, channel);
|
||||
irccounts.channels++;
|
||||
|
||||
RunHook(HOOKTYPE_CHANNEL_CREATE, channel);
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
@@ -1050,10 +1070,10 @@ int sub1_from_channel(Channel *channel)
|
||||
|
||||
if (channel->nextch)
|
||||
channel->nextch->prevch = channel->prevch;
|
||||
del_from_channel_hash_table(channel->chname, channel);
|
||||
del_from_channel_hash_table(channel->name, channel);
|
||||
|
||||
irccounts.channels--;
|
||||
safe_free(channel);
|
||||
mp_pool_release(channel);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1069,7 +1089,7 @@ void set_channel_mlock(Client *client, Channel *channel, const char *newmlock, i
|
||||
if (propagate)
|
||||
{
|
||||
sendto_server(client, 0, 0, NULL, ":%s MLOCK %lld %s :%s",
|
||||
client->id, (long long)channel->creationtime, channel->chname,
|
||||
client->id, (long long)channel->creationtime, channel->name,
|
||||
BadPtr(channel->mode_lock) ? "" : channel->mode_lock);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-13
@@ -195,9 +195,9 @@ extern void unload_all_unused_umodes(void);
|
||||
extern void unload_all_unused_extcmodes(void);
|
||||
extern void unload_all_unused_caps(void);
|
||||
extern void unload_all_unused_history_backends(void);
|
||||
|
||||
extern void log_snomask_setdefaultsettings(Configuration *i);
|
||||
extern void log_snomask_free_settings(Configuration *i);
|
||||
int reloadable_perm_module_unloaded(void);
|
||||
|
||||
int tls_tests(void);
|
||||
|
||||
/* Conf sub-sub-functions */
|
||||
@@ -1489,8 +1489,7 @@ void config_error(FORMAT_STRING(const char *format), ...)
|
||||
va_end(ap);
|
||||
if ((ptr = strchr(buffer, '\n')) != NULL)
|
||||
*ptr = '\0';
|
||||
ircd_log(LOG_ERROR, "config error: %s", buffer);
|
||||
sendto_realops("error: %s", buffer);
|
||||
unreal_log_raw(ULOG_ERROR, "config", "CONFIG_ERROR_GENERIC", NULL, buffer);
|
||||
if (remote_rehash_client)
|
||||
sendnotice(remote_rehash_client, "error: %s", buffer);
|
||||
/* We cannot live with this */
|
||||
@@ -1548,8 +1547,7 @@ void config_status(FORMAT_STRING(const char *format), ...)
|
||||
va_end(ap);
|
||||
if ((ptr = strchr(buffer, '\n')) != NULL)
|
||||
*ptr = '\0';
|
||||
ircd_log(LOG_ERROR, "%s", buffer);
|
||||
sendto_realops("%s", buffer);
|
||||
unreal_log_raw(ULOG_INFO, "config", "CONFIG_INFO_GENERIC", NULL, buffer);
|
||||
if (remote_rehash_client)
|
||||
sendnotice(remote_rehash_client, "%s", buffer);
|
||||
}
|
||||
@@ -1565,8 +1563,7 @@ void config_warn(FORMAT_STRING(const char *format), ...)
|
||||
va_end(ap);
|
||||
if ((ptr = strchr(buffer, '\n')) != NULL)
|
||||
*ptr = '\0';
|
||||
ircd_log(LOG_ERROR, "[warning] %s", buffer);
|
||||
sendto_realops("[warning] %s", buffer);
|
||||
unreal_log_raw(ULOG_WARNING, "config", "CONFIG_WARNING_GENERIC", NULL, buffer);
|
||||
if (remote_rehash_client)
|
||||
sendnotice(remote_rehash_client, "[warning] %s", buffer);
|
||||
}
|
||||
@@ -1741,6 +1738,7 @@ void free_iConf(Configuration *i)
|
||||
free_floodsettings(f);
|
||||
}
|
||||
i->floodsettings = NULL;
|
||||
log_snomask_free_settings(i);
|
||||
}
|
||||
|
||||
int config_test();
|
||||
@@ -1749,6 +1747,7 @@ void config_setdefaultsettings(Configuration *i)
|
||||
{
|
||||
char tmp[512];
|
||||
|
||||
log_snomask_setdefaultsettings(i);
|
||||
safe_strdup(i->oper_snomask, SNO_DEFOPER);
|
||||
i->ident_read_timeout = 7;
|
||||
i->ident_connect_timeout = 3;
|
||||
@@ -1872,6 +1871,7 @@ static void make_default_logblock(void)
|
||||
safe_strdup(ca->file, "ircd.log");
|
||||
convert_to_absolute_path(&ca->file, LOGDIR);
|
||||
ca->flags |= LOG_CHGCMDS|LOG_CLIENT|LOG_ERROR|LOG_KILL|LOG_KLINE|LOG_OPER|LOG_OVERRIDE|LOG_SACMDS|LOG_SERVER|LOG_SPAMFILTER|LOG_TKL;
|
||||
ca->type = LOG_TYPE_TEXT;
|
||||
ca->logfd = -1;
|
||||
AddListItem(ca, conf_log);
|
||||
}
|
||||
@@ -2233,7 +2233,7 @@ int init_conf(char *rootconf, int rehash)
|
||||
}
|
||||
else
|
||||
{
|
||||
config_error("IRCd configuration failed to load");
|
||||
unreal_log(ULOG_ERROR, "config", "CONFIG_NOT_LOADED", NULL, "IRCd configuration failed to load");
|
||||
Unload_all_testing_modules();
|
||||
unload_notloaded_includes();
|
||||
config_free(conf);
|
||||
@@ -2253,7 +2253,7 @@ int init_conf(char *rootconf, int rehash)
|
||||
RunHook0(HOOKTYPE_REHASH_COMPLETE);
|
||||
}
|
||||
postconf();
|
||||
config_status("Configuration loaded.");
|
||||
unreal_log(ULOG_INFO, "config", "CONFIG_LOADED", NULL, "Configuration loaded");
|
||||
clicap_post_rehash();
|
||||
unload_all_unused_mtag_handlers();
|
||||
return 0;
|
||||
@@ -9504,7 +9504,7 @@ int _conf_offchans(ConfigFile *conf, ConfigEntry *ce)
|
||||
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
|
||||
{
|
||||
ConfigItem_offchans *of = safe_alloc(sizeof(ConfigItem_offchans));
|
||||
strlcpy(of->chname, cep->ce_varname, CHANNELLEN+1);
|
||||
strlcpy(of->name, cep->ce_varname, CHANNELLEN+1);
|
||||
for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
|
||||
{
|
||||
if (!strcmp(cepp->ce_varname, "topic"))
|
||||
@@ -10796,8 +10796,7 @@ int rehash_internal(Client *client, int sig)
|
||||
loop.ircd_rehashing = 1; /* double checking.. */
|
||||
if (init_conf(configfile, 1) == 0)
|
||||
run_configuration();
|
||||
if (sig == 1)
|
||||
reread_motdsandrules();
|
||||
reread_motdsandrules();
|
||||
unload_all_unused_snomasks();
|
||||
unload_all_unused_umodes();
|
||||
unload_all_unused_extcmodes();
|
||||
|
||||
+8
-10
@@ -563,22 +563,20 @@ Client *find_person(char *name, Client *requester) /* TODO: this should have bee
|
||||
|
||||
/** Find a channel by name.
|
||||
* @param name The channel name to search for
|
||||
* @param default_result If the channel is not found, this value is returned.
|
||||
* @returns If the channel exists then the Channel is returned, otherwise default_result is returned.
|
||||
* @returns If the channel exists then the Channel is returned, otherwise NULL.
|
||||
*/
|
||||
Channel *find_channel(char *name, Channel *default_result)
|
||||
Channel *find_channel(char *name)
|
||||
{
|
||||
unsigned int hashv;
|
||||
Channel *tmp;
|
||||
Channel *channel;
|
||||
|
||||
hashv = hash_channel_name(name);
|
||||
|
||||
for (tmp = channelTable[hashv]; tmp; tmp = tmp->hnextch)
|
||||
{
|
||||
if (smycmp(name, tmp->chname) == 0)
|
||||
return tmp;
|
||||
}
|
||||
return default_result;
|
||||
for (channel = channelTable[hashv]; channel; channel = channel->hnextch)
|
||||
if (smycmp(name, channel->name) == 0)
|
||||
return channel;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
+33
-40
@@ -178,7 +178,9 @@ void server_reboot(char *mesg)
|
||||
{
|
||||
int i;
|
||||
Client *client;
|
||||
sendto_realops("Aieeeee!!! Restarting server... %s", mesg);
|
||||
unreal_log(ULOG_INFO, "main", "UNREALIRCD_RESTARTING", NULL,
|
||||
"Restarting server: $reason",
|
||||
log_data_string("reason", mesg));
|
||||
|
||||
list_for_each_entry(client, &lclient_list, lclient_node)
|
||||
(void) send_queued(client);
|
||||
@@ -371,10 +373,9 @@ void check_ping(Client *client)
|
||||
if (IsServer(client) || IsConnecting(client) ||
|
||||
IsHandshake(client) || IsTLSConnectHandshake(client))
|
||||
{
|
||||
sendto_umode_global(UMODE_OPER, "No response from %s, closing link",
|
||||
get_client_name(client, FALSE));
|
||||
ircd_log(LOG_ERROR, "No response from %s, closing link",
|
||||
get_client_name(client, FALSE));
|
||||
unreal_log(ULOG_ERROR, "link", "LINK_DISCONNECTED", client,
|
||||
"Lost server link to $client ($link_block.ip:$link_block.port): No response (Ping timeout)",
|
||||
client->serv->conf ? log_data_link_block(client->serv->conf) : NULL);
|
||||
}
|
||||
ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %lld seconds",
|
||||
(long long) (TStime() - client->local->lasttime));
|
||||
@@ -396,8 +397,10 @@ void check_ping(Client *client)
|
||||
(TStime() - client->local->lasttime) >= (ping + PINGWARNING))
|
||||
{
|
||||
SetPingWarning(client);
|
||||
sendto_realops("Warning, no response from %s for %d seconds",
|
||||
get_client_name(client, FALSE), PINGWARNING);
|
||||
unreal_log(ULOG_WARNING, "link", "LINK_UNRELIABLE", client,
|
||||
"Warning, no response from $client for $time_delta seconds",
|
||||
log_data_integer("time_delta", PINGWARNING),
|
||||
client->serv->conf ? log_data_link_block(client->serv->conf) : NULL);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -436,9 +439,6 @@ EVENT(check_deadsockets)
|
||||
/* No need to notify opers here. It's already done when dead socket is set */
|
||||
if (IsDeadSocket(client))
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "Closing deadsock: %d/%s", client->local->fd, client->name);
|
||||
#endif
|
||||
ClearDeadSocket(client); /* CPR. So we send the error. */
|
||||
exit_client(client, NULL, client->local->error_str ? client->local->error_str : "Dead socket");
|
||||
continue;
|
||||
@@ -450,9 +450,6 @@ EVENT(check_deadsockets)
|
||||
/* No need to notify opers here. It's already done when dead socket is set */
|
||||
if (IsDeadSocket(client))
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "Closing deadsock: %d/%s", client->local->fd, client->name);
|
||||
#endif
|
||||
ClearDeadSocket(client); /* CPR. So we send the error. */
|
||||
exit_client(client, NULL, client->local->error_str ? client->local->error_str : "Dead socket");
|
||||
continue;
|
||||
@@ -645,38 +642,35 @@ void detect_timeshift_and_warn(void)
|
||||
if (oldtimeofday == 0)
|
||||
oldtimeofday = timeofday; /* pretend everything is ok the first time.. */
|
||||
|
||||
if (mytdiff(timeofday, oldtimeofday) < NEGATIVE_SHIFT_WARN) {
|
||||
if (mytdiff(timeofday, oldtimeofday) < NEGATIVE_SHIFT_WARN)
|
||||
{
|
||||
/* tdiff = # of seconds of time set backwards (positive number! eg: 60) */
|
||||
time_t tdiff = oldtimeofday - timeofday;
|
||||
ircd_log(LOG_ERROR, "WARNING: Time running backwards! Clock set back ~%lld seconds (%lld -> %lld)",
|
||||
(long long)tdiff, (long long)oldtimeofday, (long long)timeofday);
|
||||
ircd_log(LOG_ERROR, "[TimeShift] Resetting a few timers to prevent IRCd freeze!");
|
||||
sendto_realops("WARNING: Time running backwards! Clock set back ~%lld seconds (%lld -> %lld)",
|
||||
(long long)tdiff, (long long)oldtimeofday, (long long)timeofday);
|
||||
unreal_log(ULOG_WARNING, "system", "SYSTEM_CLOCK_JUMP_BACKWARDS", NULL,
|
||||
"System clock jumped back in time ~$time_delta seconds ($time_from -> $time_to)",
|
||||
log_data_integer("time_delta", tdiff),
|
||||
log_data_timestamp("time_from", oldtimeofday),
|
||||
log_data_timestamp("time_to", timeofday));
|
||||
sendto_realops("Incorrect time for IRC servers is a serious problem. "
|
||||
"Time being set backwards (system clock changed) is "
|
||||
"even more serious and can cause clients to freeze, channels to be "
|
||||
"taken over, and other issues.");
|
||||
sendto_realops("Please be sure your clock is always synchronized before "
|
||||
"the IRCd is started!");
|
||||
sendto_realops("[TimeShift] Resetting a few timers to prevent IRCd freeze!");
|
||||
sendto_realops("Please be sure your clock is always synchronized before the IRCd is started!");
|
||||
fix_timers();
|
||||
} else
|
||||
if (mytdiff(timeofday, oldtimeofday) > POSITIVE_SHIFT_WARN) /* do not set too low or you get false positives */
|
||||
{
|
||||
/* tdiff = # of seconds of time set forward (eg: 60) */
|
||||
time_t tdiff = timeofday - oldtimeofday;
|
||||
ircd_log(LOG_ERROR, "WARNING: Time jumped ~%lld seconds ahead! (%lld -> %lld)",
|
||||
(long long)tdiff, (long long)oldtimeofday, (long long)timeofday);
|
||||
ircd_log(LOG_ERROR, "[TimeShift] Resetting some timers!");
|
||||
sendto_realops("WARNING: Time jumped ~%lld seconds ahead! (%lld -> %lld)",
|
||||
(long long)tdiff, (long long)oldtimeofday, (long long)timeofday);
|
||||
unreal_log(ULOG_WARNING, "system", "SYSTEM_CLOCK_JUMP_FORWARDS", NULL,
|
||||
"System clock jumped ~$time_delta seconds forward ($time_from -> $time_to)",
|
||||
log_data_integer("time_delta", tdiff),
|
||||
log_data_timestamp("time_from", oldtimeofday),
|
||||
log_data_timestamp("time_to", timeofday));
|
||||
sendto_realops("Incorrect time for IRC servers is a serious problem. "
|
||||
"Time being adjusted (by changing the system clock) "
|
||||
"more than a few seconds forward/backward can lead to serious issues.");
|
||||
sendto_realops("Please be sure your clock is always synchronized before "
|
||||
"the IRCd is started!");
|
||||
sendto_realops("[TimeShift] Resetting some timers!");
|
||||
sendto_realops("Please be sure your clock is always synchronized before the IRCd is started!");
|
||||
fix_timers();
|
||||
}
|
||||
|
||||
@@ -686,13 +680,11 @@ void detect_timeshift_and_warn(void)
|
||||
lasthighwarn = timeofday;
|
||||
if (timeofday - lasthighwarn > 300)
|
||||
{
|
||||
ircd_log(LOG_ERROR, "[TimeShift] The (IRCd) clock was set backwards. "
|
||||
"Waiting for time to be OK again. This will be in %lld seconds",
|
||||
(long long)(highesttimeofday - timeofday));
|
||||
sendto_realops("[TimeShift] The (IRCd) clock was set backwards. Timers, nick- "
|
||||
"and channel-timestamps are possibly incorrect. This message will "
|
||||
"repeat itself until we catch up with the original time, which will be "
|
||||
"in %lld seconds", (long long)(highesttimeofday - timeofday));
|
||||
unreal_log(ULOG_WARNING, "system", "SYSTEM_CLOCK_JUMP_BACKWARDS_PREVIOUSLY", NULL,
|
||||
"The system clock previously went backwards. Waiting for time to be OK again. This will be in $time_delta seconds.",
|
||||
log_data_integer("time_delta", highesttimeofday - timeofday),
|
||||
log_data_timestamp("time_from", highesttimeofday),
|
||||
log_data_timestamp("time_to", timeofday));
|
||||
lasthighwarn = timeofday;
|
||||
}
|
||||
} else {
|
||||
@@ -820,6 +812,7 @@ int InitUnrealIRCd(int argc, char *argv[])
|
||||
mp_pool_init();
|
||||
dbuf_init();
|
||||
initlists();
|
||||
initlist_channels();
|
||||
|
||||
early_init_ssl();
|
||||
#ifdef USE_LIBCURL
|
||||
@@ -1121,7 +1114,7 @@ int InitUnrealIRCd(int argc, char *argv[])
|
||||
}
|
||||
if (loop.config_test)
|
||||
{
|
||||
ircd_log(LOG_ERROR, "Configuration test passed OK");
|
||||
unreal_log(ULOG_INFO, "config", "CONFIG_PASSED", NULL, "Configuration test passed OK");
|
||||
fflush(stderr);
|
||||
exit(0);
|
||||
}
|
||||
@@ -1138,7 +1131,7 @@ int InitUnrealIRCd(int argc, char *argv[])
|
||||
openlog("ircd", LOG_PID | LOG_NDELAY, LOG_DAEMON);
|
||||
#endif
|
||||
run_configuration();
|
||||
ircd_log(LOG_ERROR, "UnrealIRCd started.");
|
||||
unreal_log(ULOG_INFO, "main", "UNREALIRCD_START", NULL, "UnrealIRCd started.");
|
||||
|
||||
read_motd(conf_files->botmotd_file, &botmotd);
|
||||
read_motd(conf_files->rules_file, &rules);
|
||||
@@ -1260,8 +1253,8 @@ void SocketLoop(void *dummy)
|
||||
}
|
||||
if (doreloadcert)
|
||||
{
|
||||
unreal_log(ULOG_INFO, "config", "CONFIG_RELOAD_TLS", NULL, "Reloading all SSL related data (./unrealircd reloadtls)");
|
||||
reinit_tls();
|
||||
sendto_realops_and_log("Reloading all SSL related data (./unrealircd reloadtls)");
|
||||
doreloadcert = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,21 @@
|
||||
|
||||
#include "unrealircd.h"
|
||||
|
||||
#define SNO_ALL INT_MAX
|
||||
|
||||
/* Forward declarations */
|
||||
static int valid_event_id(const char *s);
|
||||
static int valid_subsystem(const char *s);
|
||||
long log_to_snomask(LogLevel loglevel, char *subsystem, char *event_id);
|
||||
void do_unreal_log_internal(LogLevel loglevel, char *subsystem, char *event_id, Client *client, int expand_msg, char *msg, va_list vl);
|
||||
|
||||
json_t *json_string_possibly_null(char *s)
|
||||
{
|
||||
if (s)
|
||||
return json_string(s);
|
||||
return json_null();
|
||||
}
|
||||
|
||||
LogType log_type_stringtoval(char *str)
|
||||
{
|
||||
if (!strcmp(str, "json"))
|
||||
@@ -168,6 +183,7 @@ int config_run_log(ConfigFile *conf, ConfigEntry *ce)
|
||||
|
||||
ca = safe_alloc(sizeof(ConfigItem_log));
|
||||
ca->logfd = -1;
|
||||
ca->type = LOG_TYPE_TEXT; /* default */
|
||||
if (strchr(ce->ce_vardata, '%'))
|
||||
safe_strdup(ca->filefmt, ce->ce_vardata);
|
||||
else
|
||||
@@ -202,8 +218,30 @@ int config_run_log(ConfigFile *conf, ConfigEntry *ce)
|
||||
|
||||
// TODO: validate that all 'key' values are lowercase+underscore+digits in all functions below.
|
||||
|
||||
void json_expand_client_security_groups(json_t *parent, Client *client)
|
||||
{
|
||||
SecurityGroup *s;
|
||||
json_t *child = json_array();
|
||||
json_object_set_new(parent, "security-groups", child);
|
||||
|
||||
/* We put known-users or unknown-users at the beginning.
|
||||
* The latter is special and doesn't actually exist
|
||||
* in the linked list, hence the special code here,
|
||||
* and again later in the for loop to skip it.
|
||||
*/
|
||||
if (user_allowed_by_security_group_name(client, "known-users"))
|
||||
json_array_append_new(child, json_string("known-users"));
|
||||
else
|
||||
json_array_append_new(child, json_string("unknown-users"));
|
||||
|
||||
for (s = securitygroups; s; s = s->next)
|
||||
if (strcmp(s->name, "known-users") && user_allowed_by_security_group(client, s))
|
||||
json_array_append_new(child, json_string(s->name));
|
||||
}
|
||||
|
||||
void json_expand_client(json_t *j, char *key, Client *client, int detail)
|
||||
{
|
||||
char buf[BUFSIZE+1];
|
||||
json_t *child = json_object();
|
||||
json_object_set_new(j, key, child);
|
||||
|
||||
@@ -213,26 +251,49 @@ void json_expand_client(json_t *j, char *key, Client *client, int detail)
|
||||
json_object_set_new(child, "username", json_string(client->user->username));
|
||||
|
||||
if (client->user && *client->user->realhost)
|
||||
json_object_set_new(child, "host", json_string(client->user->realhost));
|
||||
json_object_set_new(child, "hostname", json_string(client->user->realhost));
|
||||
else if (client->local && *client->local->sockhost)
|
||||
json_object_set_new(child, "host", json_string(client->local->sockhost));
|
||||
json_object_set_new(child, "hostname", json_string(client->local->sockhost));
|
||||
else
|
||||
json_object_set_new(child, "host", json_string(GetIP(client)));
|
||||
json_object_set_new(child, "hostname", json_string(GetIP(client)));
|
||||
|
||||
json_object_set_new(child, "ip", json_string(GetIP(client)));
|
||||
json_object_set_new(child, "ip", json_string_possibly_null(client->ip));
|
||||
|
||||
if (client->user)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s!%s@%s", client->name, client->user->username, client->user->realhost);
|
||||
json_object_set_new(child, "nuh", json_string(buf));
|
||||
} else if (client->ip) {
|
||||
snprintf(buf, sizeof(buf), "%s@%s", client->name, client->ip);
|
||||
json_object_set_new(child, "nuh", json_string(buf));
|
||||
} else {
|
||||
json_object_set_new(child, "nuh", json_string(client->name));
|
||||
}
|
||||
|
||||
if (*client->info)
|
||||
json_object_set_new(child, "info", json_string(client->info));
|
||||
|
||||
if (client->srvptr && client->srvptr->name)
|
||||
json_object_set_new(child, "servername", json_string(client->srvptr->name));
|
||||
|
||||
if (IsLoggedIn(client))
|
||||
json_object_set_new(child, "account", json_string(client->user->svid));
|
||||
|
||||
if (IsUser(client))
|
||||
{
|
||||
json_object_set_new(child, "reputation", json_integer(GetReputation(client)));
|
||||
json_expand_client_security_groups(child, client);
|
||||
}
|
||||
}
|
||||
|
||||
void json_expand_channel(json_t *j, char *key, Channel *channel, int detail)
|
||||
{
|
||||
json_t *child = json_object();
|
||||
json_object_set_new(j, key, child);
|
||||
json_object_set_new(child, "name", json_string(channel->chname));
|
||||
json_object_set_new(child, "name", json_string(channel->name));
|
||||
}
|
||||
|
||||
char *timestamp_iso8601(void)
|
||||
char *timestamp_iso8601_now(void)
|
||||
{
|
||||
struct timeval t;
|
||||
struct tm *tm;
|
||||
@@ -242,6 +303,7 @@ char *timestamp_iso8601(void)
|
||||
gettimeofday(&t, NULL);
|
||||
sec = t.tv_sec;
|
||||
tm = gmtime(&sec);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_mon + 1,
|
||||
@@ -250,6 +312,32 @@ char *timestamp_iso8601(void)
|
||||
tm->tm_min,
|
||||
tm->tm_sec,
|
||||
(int)(t.tv_usec / 1000));
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *timestamp_iso8601(time_t v)
|
||||
{
|
||||
struct tm *tm;
|
||||
static char buf[64];
|
||||
|
||||
if (v == 0)
|
||||
return NULL;
|
||||
|
||||
tm = gmtime(&v);
|
||||
|
||||
if (tm == NULL)
|
||||
return NULL;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_mon + 1,
|
||||
tm->tm_mday,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec,
|
||||
0);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -262,6 +350,17 @@ LogData *log_data_string(const char *key, const char *str)
|
||||
return d;
|
||||
}
|
||||
|
||||
LogData *log_data_char(const char *key, const char c)
|
||||
{
|
||||
LogData *d = safe_alloc(sizeof(LogData));
|
||||
d->type = LOG_FIELD_STRING;
|
||||
safe_strdup(d->key, key);
|
||||
d->value.string = safe_alloc(2);
|
||||
d->value.string[0] = c;
|
||||
d->value.string[1] = '\0';
|
||||
return d;
|
||||
}
|
||||
|
||||
LogData *log_data_integer(const char *key, int64_t integer)
|
||||
{
|
||||
LogData *d = safe_alloc(sizeof(LogData));
|
||||
@@ -271,6 +370,15 @@ LogData *log_data_integer(const char *key, int64_t integer)
|
||||
return d;
|
||||
}
|
||||
|
||||
LogData *log_data_timestamp(const char *key, time_t ts)
|
||||
{
|
||||
LogData *d = safe_alloc(sizeof(LogData));
|
||||
d->type = LOG_FIELD_STRING;
|
||||
safe_strdup(d->key, key);
|
||||
safe_strdup(d->value.string, timestamp_iso8601(ts));
|
||||
return d;
|
||||
}
|
||||
|
||||
LogData *log_data_client(const char *key, Client *client)
|
||||
{
|
||||
LogData *d = safe_alloc(sizeof(LogData));
|
||||
@@ -349,6 +457,70 @@ LogData *log_data_link_block(ConfigItem_link *link)
|
||||
return d;
|
||||
}
|
||||
|
||||
json_t *json_timestamp(time_t v)
|
||||
{
|
||||
char *ts = timestamp_iso8601(v);
|
||||
if (ts)
|
||||
return json_string(ts);
|
||||
return json_null();
|
||||
}
|
||||
|
||||
LogData *log_data_tkl(const char *key, TKL *tkl)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
LogData *d = safe_alloc(sizeof(LogData));
|
||||
json_t *j;
|
||||
|
||||
d->type = LOG_FIELD_OBJECT;
|
||||
safe_strdup(d->key, key);
|
||||
d->value.object = j = json_object();
|
||||
|
||||
json_object_set_new(j, "type", json_string(tkl_type_config_string(tkl))); // Eg 'kline'
|
||||
json_object_set_new(j, "type_string", json_string(tkl_type_string(tkl))); // Eg 'Soft K-Line'
|
||||
json_object_set_new(j, "set_by", json_string(tkl->set_by));
|
||||
json_object_set_new(j, "set_at", json_timestamp(tkl->set_at));
|
||||
json_object_set_new(j, "expire_at", json_timestamp(tkl->expire_at));
|
||||
*buf = '\0';
|
||||
short_date(tkl->set_at, buf);
|
||||
strlcat(buf, " GMT", sizeof(buf));
|
||||
json_object_set_new(j, "set_at_string", json_string(buf));
|
||||
if (tkl->expire_at <= 0)
|
||||
{
|
||||
json_object_set_new(j, "expire_at_string", json_string("Never"));
|
||||
} else {
|
||||
*buf = '\0';
|
||||
short_date(tkl->expire_at, buf);
|
||||
strlcat(buf, " GMT", sizeof(buf));
|
||||
json_object_set_new(j, "expire_at_string", json_string(buf));
|
||||
}
|
||||
json_object_set_new(j, "set_at_delta", json_integer(TStime() - tkl->set_at));
|
||||
if (TKLIsServerBan(tkl))
|
||||
{
|
||||
json_object_set_new(j, "name", json_string(tkl_uhost(tkl, buf, sizeof(buf), 0)));
|
||||
json_object_set_new(j, "reason", json_string(tkl->ptr.serverban->reason));
|
||||
} else
|
||||
if (TKLIsNameBan(tkl))
|
||||
{
|
||||
json_object_set_new(j, "name", json_string(tkl->ptr.nameban->name));
|
||||
json_object_set_new(j, "reason", json_string(tkl->ptr.nameban->reason));
|
||||
} else
|
||||
if (TKLIsBanException(tkl))
|
||||
{
|
||||
json_object_set_new(j, "name", json_string(tkl_uhost(tkl, buf, sizeof(buf), 0)));
|
||||
json_object_set_new(j, "reason", json_string(tkl->ptr.banexception->reason));
|
||||
json_object_set_new(j, "exception_types", json_string(tkl->ptr.banexception->bantypes));
|
||||
} else
|
||||
if (TKLIsSpamfilter(tkl))
|
||||
{
|
||||
json_object_set_new(j, "name", json_string(tkl->ptr.spamfilter->match->str));
|
||||
json_object_set_new(j, "match_type", json_string(unreal_match_method_valtostr(tkl->ptr.spamfilter->match->type)));
|
||||
json_object_set_new(j, "ban_action", json_string(banact_valtostring(tkl->ptr.spamfilter->action)));
|
||||
json_object_set_new(j, "spamfilter_targets", json_string(spamfilter_target_inttostring(tkl->ptr.spamfilter->target)));
|
||||
json_object_set_new(j, "reason", json_string(unreal_decodespace(tkl->ptr.spamfilter->tkl_reason)));
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void log_data_free(LogData *d)
|
||||
{
|
||||
@@ -362,9 +534,11 @@ char *loglevel_to_string(LogLevel loglevel)
|
||||
{
|
||||
switch(loglevel)
|
||||
{
|
||||
case ULOG_DEBUG:
|
||||
return "debug";
|
||||
case ULOG_INFO:
|
||||
return "info";
|
||||
case ULOG_WARN:
|
||||
case ULOG_WARNING:
|
||||
return "warn";
|
||||
case ULOG_ERROR:
|
||||
return "error";
|
||||
@@ -376,6 +550,28 @@ char *loglevel_to_string(LogLevel loglevel)
|
||||
}
|
||||
|
||||
#define validvarcharacter(x) (isalnum((x)) || ((x) == '_'))
|
||||
#define valideventidcharacter(x) (isupper((x)) || isdigit((x)) || ((x) == '_'))
|
||||
#define validsubsystemcharacter(x) (islower((x)) || isdigit((x)) || ((x) == '_'))
|
||||
|
||||
static int valid_event_id(const char *s)
|
||||
{
|
||||
if (!*s)
|
||||
return 0;
|
||||
for (; *s; s++)
|
||||
if (!valideventidcharacter(*s))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int valid_subsystem(const char *s)
|
||||
{
|
||||
if (!*s)
|
||||
return 0;
|
||||
for (; *s; s++)
|
||||
if (!validsubsystemcharacter(*s))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *json_get_value(json_t *t)
|
||||
{
|
||||
@@ -515,6 +711,7 @@ void do_unreal_log_loggers(LogLevel loglevel, char *subsystem, char *event_id, c
|
||||
struct stat fstats;
|
||||
int n;
|
||||
int write_error;
|
||||
long snomask;
|
||||
|
||||
/* Trap infinite recursions to avoid crash if log file is unavailable,
|
||||
* this will also avoid calling ircd_log from anything else called
|
||||
@@ -553,8 +750,11 @@ void do_unreal_log_loggers(LogLevel loglevel, char *subsystem, char *event_id, c
|
||||
/* Log to all ircops for now */
|
||||
// FIXME: obviously there should be snomask filtering here ;)
|
||||
// TODO: don't show loglevel for simple INFO messages?
|
||||
if (strncmp(msg, "->", 2) && strncmp(msg, "<-", 2))
|
||||
sendto_realops("[%s] %s", loglevel_to_string(loglevel), msg);
|
||||
snomask = log_to_snomask(loglevel, subsystem, event_id);
|
||||
if (snomask == SNO_ALL)
|
||||
sendto_realops("[%s] %s.%s %s", loglevel_to_string(loglevel), subsystem, event_id, msg);
|
||||
else if (snomask > 0)
|
||||
sendto_snomask(snomask, "[%s] %s.%s %s", loglevel_to_string(loglevel), subsystem, event_id, msg);
|
||||
|
||||
for (l = conf_log; l; l = l->next)
|
||||
{
|
||||
@@ -633,7 +833,7 @@ void do_unreal_log_loggers(LogLevel loglevel, char *subsystem, char *event_id, c
|
||||
|
||||
/* Now actually WRITE to the log... */
|
||||
write_error = 0;
|
||||
if (l->type == LOG_TYPE_JSON)
|
||||
if ((l->type == LOG_TYPE_JSON) && strcmp(subsystem, "traffic"))
|
||||
{
|
||||
n = write(l->logfd, json_serialized, strlen(json_serialized));
|
||||
if (n < strlen(text_buf))
|
||||
@@ -641,6 +841,7 @@ void do_unreal_log_loggers(LogLevel loglevel, char *subsystem, char *event_id, c
|
||||
else
|
||||
write(l->logfd, "\n", 1); // FIXME: no.. we should do it this way..... and why do we use direct I/O at all?
|
||||
} else
|
||||
if (l->type == LOG_TYPE_TEXT)
|
||||
{
|
||||
// FIXME: don't write in 2 stages, waste of slow system calls
|
||||
if (write(l->logfd, timebuf, strlen(timebuf)) < 0)
|
||||
@@ -673,15 +874,33 @@ void do_unreal_log_loggers(LogLevel loglevel, char *subsystem, char *event_id, c
|
||||
|
||||
/* Logging function, called by the unreal_log() macro. */
|
||||
void do_unreal_log(LogLevel loglevel, char *subsystem, char *event_id,
|
||||
Client *client,
|
||||
char *msg, ...)
|
||||
Client *client, char *msg, ...)
|
||||
{
|
||||
va_list vl;
|
||||
va_start(vl, msg);
|
||||
do_unreal_log_internal(loglevel, subsystem, event_id, client, 1, msg, vl);
|
||||
va_end(vl);
|
||||
}
|
||||
|
||||
/* Logging function, called by the unreal_log_raw() macro. */
|
||||
void do_unreal_log_raw(LogLevel loglevel, char *subsystem, char *event_id,
|
||||
Client *client, char *msg, ...)
|
||||
{
|
||||
va_list vl;
|
||||
va_start(vl, msg);
|
||||
do_unreal_log_internal(loglevel, subsystem, event_id, client, 0, msg, vl);
|
||||
va_end(vl);
|
||||
}
|
||||
|
||||
void do_unreal_log_internal(LogLevel loglevel, char *subsystem, char *event_id,
|
||||
Client *client, int expand_msg, char *msg, va_list vl)
|
||||
{
|
||||
LogData *d;
|
||||
char *json_serialized;
|
||||
json_t *j = NULL;
|
||||
json_t *j_details = NULL;
|
||||
char msgbuf[1024];
|
||||
char *loglevel_string = loglevel_to_string(loglevel);
|
||||
|
||||
/* TODO: Enforcement:
|
||||
* - loglevel must be valid
|
||||
@@ -690,12 +909,20 @@ void do_unreal_log(LogLevel loglevel, char *subsystem, char *event_id,
|
||||
* - msg may not contain percent signs (%) as that is an obvious indication something is wrong?
|
||||
* or maybe a temporary restriction while upgrading that can be removed later ;)
|
||||
*/
|
||||
if (!strcmp(loglevel_string, "???"))
|
||||
abort();
|
||||
if (!valid_subsystem(subsystem))
|
||||
abort();
|
||||
if (!valid_event_id(event_id))
|
||||
abort();
|
||||
if (expand_msg && strchr(msg, '%'))
|
||||
abort();
|
||||
|
||||
j = json_object();
|
||||
j_details = json_object();
|
||||
|
||||
json_object_set_new(j, "timestamp", json_string(timestamp_iso8601()));
|
||||
json_object_set_new(j, "level", json_string(loglevel_to_string(loglevel)));
|
||||
json_object_set_new(j, "timestamp", json_string(timestamp_iso8601_now()));
|
||||
json_object_set_new(j, "level", json_string(loglevel_string));
|
||||
json_object_set_new(j, "subsystem", json_string(subsystem));
|
||||
json_object_set_new(j, "event_id", json_string(event_id));
|
||||
|
||||
@@ -706,7 +933,6 @@ void do_unreal_log(LogLevel loglevel, char *subsystem, char *event_id,
|
||||
if (client)
|
||||
json_expand_client(j_details, "client", client, 0);
|
||||
/* Additional details (if any) */
|
||||
va_start(vl, msg);
|
||||
while ((d = va_arg(vl, LogData *)))
|
||||
{
|
||||
switch(d->type)
|
||||
@@ -715,7 +941,10 @@ void do_unreal_log(LogLevel loglevel, char *subsystem, char *event_id,
|
||||
json_object_set_new(j_details, d->key, json_integer(d->value.integer));
|
||||
break;
|
||||
case LOG_FIELD_STRING:
|
||||
json_object_set_new(j_details, d->key, json_string(d->value.string));
|
||||
if (d->value.string)
|
||||
json_object_set_new(j_details, d->key, json_string(d->value.string));
|
||||
else
|
||||
json_object_set_new(j_details, d->key, json_null());
|
||||
break;
|
||||
case LOG_FIELD_CLIENT:
|
||||
json_expand_client(j_details, d->key, d->value.client, 0);
|
||||
@@ -731,7 +960,12 @@ void do_unreal_log(LogLevel loglevel, char *subsystem, char *event_id,
|
||||
}
|
||||
log_data_free(d);
|
||||
}
|
||||
buildlogstring(msg, msgbuf, sizeof(msgbuf), j_details);
|
||||
|
||||
if (expand_msg)
|
||||
buildlogstring(msg, msgbuf, sizeof(msgbuf), j_details);
|
||||
else
|
||||
strlcpy(msgbuf, msg, sizeof(msgbuf));
|
||||
|
||||
json_object_set_new(j, "msg", json_string(msgbuf));
|
||||
|
||||
/* Now merge the details into root object 'j': */
|
||||
@@ -777,3 +1011,54 @@ void logtest(void)
|
||||
unreal_log(ULOG_INFO, "test", "TEST", &me, "More data, fun: $fun!", log_data_string("fun", "yes lots of fun"), log_data_integer("some_integer", 1337));
|
||||
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", &me, "Client $client used SAJOIN to join $target to y!", log_data_client("target", &me));
|
||||
}
|
||||
|
||||
void add_log_snomask(Configuration *i, char *subsystem, long snomask)
|
||||
{
|
||||
LogSnomask *l = safe_alloc(sizeof(LogSnomask));
|
||||
safe_strdup(l->subsystem, subsystem);
|
||||
l->snomask = snomask;
|
||||
AppendListItem(l, i->log_snomasks);
|
||||
}
|
||||
|
||||
void log_snomask_free(LogSnomask *l)
|
||||
{
|
||||
safe_free(l->subsystem);
|
||||
safe_free(l);
|
||||
}
|
||||
|
||||
void log_snomask_free_settings(Configuration *i)
|
||||
{
|
||||
LogSnomask *l, *l_next;
|
||||
for (l = i->log_snomasks; l; l = l_next)
|
||||
{
|
||||
l_next = l->next;
|
||||
log_snomask_free(l);
|
||||
}
|
||||
i->log_snomasks = NULL;
|
||||
}
|
||||
|
||||
void log_snomask_setdefaultsettings(Configuration *i)
|
||||
{
|
||||
add_log_snomask(i, "linking", SNO_ALL);
|
||||
add_log_snomask(i, "traffic", 0);
|
||||
add_log_snomask(i, "*", SNO_ALL);
|
||||
}
|
||||
|
||||
long log_to_snomask(LogLevel loglevel, char *subsystem, char *event_id)
|
||||
{
|
||||
LogSnomask *l;
|
||||
long snomask = 0;
|
||||
|
||||
for (l = iConf.log_snomasks; l; l = l->next)
|
||||
{
|
||||
if (match_simple(l->subsystem, subsystem))
|
||||
{
|
||||
if (l->snomask == SNO_ALL)
|
||||
return SNO_ALL; /* return early */
|
||||
if (l->snomask == 0)
|
||||
return 0; /* return early */
|
||||
snomask |= l->snomask;
|
||||
}
|
||||
}
|
||||
return snomask;
|
||||
}
|
||||
|
||||
+8
-13
@@ -114,8 +114,7 @@ void ircd_log(int flags, FORMAT_STRING(const char *format), ...)
|
||||
ircvsnprintf(buf, sizeof(buf), format, vl);
|
||||
va_end(vl);
|
||||
|
||||
// This is a stupid escape trick, we better use a different method / other function
|
||||
unreal_log(ULOG_ERROR, "unknown", "UNKNOWN", NULL, "$_data", log_data_string("_data", buf));
|
||||
unreal_log_raw(ULOG_ERROR, "unknown", "UNKNOWN", NULL, buf);
|
||||
}
|
||||
|
||||
/** Returns the date in rather long string */
|
||||
@@ -626,18 +625,14 @@ void exit_client_ex(Client *client, Client *origin, MessageTag *recv_mtags, char
|
||||
SetClosing(client);
|
||||
if (IsUser(client))
|
||||
{
|
||||
long connected_time = TStime() - client->local->firsttime;
|
||||
RunHook3(HOOKTYPE_LOCAL_QUIT, client, recv_mtags, comment);
|
||||
sendto_connectnotice(client, 1, comment);
|
||||
on_for = TStime() - client->local->firsttime;
|
||||
if (IsHidden(client))
|
||||
ircd_log(LOG_CLIENT, "Disconnect - (%lld:%lld:%lld) %s!%s@%s [%s] [vhost: %s] (%s)",
|
||||
on_for / 3600, (on_for % 3600) / 60, on_for % 60,
|
||||
client->name, client->user->username,
|
||||
client->user->realhost, GetIP(client), client->user->virthost, comment);
|
||||
else
|
||||
ircd_log(LOG_CLIENT, "Disconnect - (%lld:%lld:%lld) %s!%s@%s [%s] (%s)",
|
||||
on_for / 3600, (on_for % 3600) / 60, on_for % 60,
|
||||
client->name, client->user->username, client->user->realhost, GetIP(client), comment);
|
||||
unreal_log(ULOG_INFO, "connect", "LOCAL_CLIENT_DISCONNECT", client,
|
||||
"Client exiting: $client ($client.username@$client.hostname) [$client.ip] ($reason)",
|
||||
log_data_string("extended_client_info", get_connect_extinfo(client)),
|
||||
log_data_string("reason", comment),
|
||||
log_data_integer("connected_time", connected_time));
|
||||
|
||||
} else
|
||||
if (IsUnknown(client))
|
||||
{
|
||||
|
||||
@@ -22,17 +22,6 @@
|
||||
|
||||
#include "unrealircd.h"
|
||||
|
||||
/* You can change this '//#undef' into '#define' if you want to see quite
|
||||
* a flood for every user that connects (and on-load if cfg.fullstatus_on_load).
|
||||
* Obviously only recommended for testing, use with care!
|
||||
*/
|
||||
#undef DEBUGMODE
|
||||
|
||||
/** Change this 'undef' to 'define' to get performance information.
|
||||
* This really only meant for debugging purposes.
|
||||
*/
|
||||
#undef TIMING
|
||||
|
||||
ModuleHeader MOD_HEADER
|
||||
= {
|
||||
"antirandom",
|
||||
@@ -515,7 +504,6 @@ struct {
|
||||
long ban_time;
|
||||
int convert_to_lowercase;
|
||||
int show_failedconnects;
|
||||
int fullstatus_on_load;
|
||||
ConfigItem_mask *except_hosts;
|
||||
int except_webirc;
|
||||
} cfg;
|
||||
@@ -553,19 +541,14 @@ MOD_INIT()
|
||||
HookAdd(modinfo->handle, HOOKTYPE_CONFIGRUN, 0, antirandom_config_run);
|
||||
|
||||
/* Some default values: */
|
||||
cfg.fullstatus_on_load = 1;
|
||||
cfg.convert_to_lowercase = 1;
|
||||
cfg.except_webirc = 1;
|
||||
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
void check_all_users(void);
|
||||
|
||||
MOD_LOAD()
|
||||
{
|
||||
if (cfg.fullstatus_on_load)
|
||||
check_all_users();
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -644,9 +627,6 @@ int antirandom_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
|
||||
if (!strcmp(cep->ce_varname, "convert-to-lowercase"))
|
||||
{
|
||||
} else
|
||||
if (!strcmp(cep->ce_varname, "fullstatus-on-load"))
|
||||
{
|
||||
} else
|
||||
if (!strcmp(cep->ce_varname, "show-failedconnects"))
|
||||
{
|
||||
} else
|
||||
@@ -705,10 +685,6 @@ int antirandom_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
|
||||
if (!strcmp(cep->ce_varname, "show-failedconnects"))
|
||||
{
|
||||
cfg.show_failedconnects = config_checkval(cep->ce_vardata, CFG_YESNO);
|
||||
} else
|
||||
if (!strcmp(cep->ce_varname, "fullstatus-on-load"))
|
||||
{
|
||||
cfg.fullstatus_on_load = config_checkval(cep->ce_vardata, CFG_YESNO);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@@ -821,23 +797,14 @@ static int internal_getscore(char *str)
|
||||
if (digits >= 5)
|
||||
{
|
||||
score += 5 + (digits - 5);
|
||||
#ifdef DEBUGMODE
|
||||
sendto_ops_and_log("score@'%s': MATCH for digits check", str);
|
||||
#endif
|
||||
}
|
||||
if (vowels >= 4)
|
||||
{
|
||||
score += 4 + (vowels - 4);
|
||||
#ifdef DEBUGMODE
|
||||
sendto_ops_and_log("score@'%s': MATCH for vowels check", str);
|
||||
#endif
|
||||
}
|
||||
if (consonants >= 4)
|
||||
{
|
||||
score += 4 + (consonants - 4);
|
||||
#ifdef DEBUGMODE
|
||||
sendto_ops_and_log("score@'%s': MATCH for consonants check", str);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (t=triples; t; t=t->next)
|
||||
@@ -846,10 +813,6 @@ static int internal_getscore(char *str)
|
||||
if ((t->two[0] == s[0]) && (t->two[1] == s[1]) && s[2] && strchr(t->rest, s[2]))
|
||||
{
|
||||
score++; /* OK */
|
||||
#ifdef DEBUGMODE
|
||||
sendto_ops_and_log("score@'%s': MATCH for '%s[%s]' %c/%c/%c", str, t->two, t->rest,
|
||||
s[0], s[1], s[2]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -868,11 +831,6 @@ static int get_spam_score(Client *client)
|
||||
char *gecos = client->info;
|
||||
char nbuf[NICKLEN+1], ubuf[USERLEN+1], rbuf[REALLEN+1];
|
||||
int nscore, uscore, gscore, score;
|
||||
#ifdef TIMING
|
||||
struct timeval tv_alpha, tv_beta;
|
||||
|
||||
gettimeofday(&tv_alpha, NULL);
|
||||
#endif
|
||||
|
||||
if (cfg.convert_to_lowercase)
|
||||
{
|
||||
@@ -889,46 +847,9 @@ static int get_spam_score(Client *client)
|
||||
gscore = internal_getscore(gecos);
|
||||
score = nscore + uscore + gscore;
|
||||
|
||||
#ifdef TIMING
|
||||
gettimeofday(&tv_beta, NULL);
|
||||
ircd_log(LOG_ERROR, "AntiRandom Timing: %ld microseconds",
|
||||
((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec));
|
||||
#endif
|
||||
#ifdef DEBUGMODE
|
||||
sendto_ops_and_log("got score: %d/%d/%d = %d",
|
||||
nscore, uscore, gscore, score);
|
||||
#endif
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
void check_all_users(void)
|
||||
{
|
||||
Client *client;
|
||||
int matches=0, score;
|
||||
|
||||
list_for_each_entry(client, &lclient_list, lclient_node)
|
||||
{
|
||||
if (IsUser(client))
|
||||
{
|
||||
if (is_exempt(client))
|
||||
continue;
|
||||
|
||||
score = get_spam_score(client);
|
||||
if (score > cfg.threshold)
|
||||
{
|
||||
if (!matches)
|
||||
sendto_realops("[antirandom] Full status report follows:");
|
||||
sendto_realops("%d points: %s!%s@%s:%s",
|
||||
score, client->name, client->user->username, client->user->realhost, client->info);
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (matches)
|
||||
sendto_realops("[antirandom] %d match%s", matches, matches == 1 ? "" : "es");
|
||||
}
|
||||
|
||||
int antirandom_preconnect(Client *client)
|
||||
{
|
||||
int score;
|
||||
@@ -941,13 +862,17 @@ int antirandom_preconnect(Client *client)
|
||||
{
|
||||
if (cfg.ban_action == BAN_ACT_WARN)
|
||||
{
|
||||
sendto_ops_and_log("[antirandom] would have denied access to user with score %d: %s!%s@%s:%s",
|
||||
score, client->name, client->user->username, client->user->realhost, client->info);
|
||||
unreal_log(LOG_INFO, "antirandom", "ANTIRANDOM_REJECTED_USER", client,
|
||||
"[antirandom] would have denied access to user with score $score: $client:$client.info",
|
||||
log_data_integer("score", score));
|
||||
return HOOK_CONTINUE;
|
||||
}
|
||||
if (cfg.show_failedconnects)
|
||||
sendto_ops_and_log("[antirandom] denied access to user with score %d: %s!%s@%s:%s",
|
||||
score, client->name, client->user->username, client->user->realhost, client->info);
|
||||
{
|
||||
unreal_log(LOG_INFO, "antirandom", "ANTIRANDOM_REJECTED_USER", client,
|
||||
"[antirandom] denied access to user with score $score: $client:$client.info",
|
||||
log_data_integer("score", score));
|
||||
}
|
||||
place_host_ban(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time);
|
||||
return HOOK_DENY;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ void set_post_delayed(Channel *channel)
|
||||
channel->mode.extmode |= EXTMODE_POST_DELAYED;
|
||||
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +d", me.name, channel->chname);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +d", me.name, channel->name);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ void clear_post_delayed(Channel *channel)
|
||||
channel->mode.extmode &= ~EXTMODE_POST_DELAYED;
|
||||
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -d", me.name, channel->chname);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -d", me.name, channel->name);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
@@ -217,14 +217,14 @@ void clear_user_invisible_announce(Channel *channel, Client *client, MessageTag
|
||||
clear_user_invisible(channel, client);
|
||||
|
||||
ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN %s",
|
||||
client->name, client->user->username, GetHost(client), channel->chname);
|
||||
client->name, client->user->username, GetHost(client), channel->name);
|
||||
|
||||
ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s",
|
||||
client->name, client->user->username, GetHost(client), channel->chname,
|
||||
client->name, client->user->username, GetHost(client), channel->name,
|
||||
IsLoggedIn(client) ? client->user->svid : "*",
|
||||
client->info);
|
||||
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->chname);
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->name);
|
||||
for (i = channel->members; i; i = i->next)
|
||||
{
|
||||
Client *acptr = i->client;
|
||||
@@ -337,16 +337,16 @@ int moded_chanmode(Client *client, Channel *channel, MessageTag *recv_mtags, cha
|
||||
if (moded_user_invisible(i->client, channel))
|
||||
{
|
||||
MessageTag *mtags = NULL;
|
||||
new_message_special(i->client, recv_mtags, &mtags, ":%s JOIN %s", i->client->name, channel->chname);
|
||||
new_message_special(i->client, recv_mtags, &mtags, ":%s JOIN %s", i->client->name, channel->name);
|
||||
if (HasCapabilityFast(user, CAP_EXTENDED_JOIN))
|
||||
{
|
||||
sendto_one(user, mtags, ":%s!%s@%s JOIN %s %s :%s",
|
||||
i->client->name, i->client->user->username, GetHost(i->client),
|
||||
channel->chname,
|
||||
channel->name,
|
||||
IsLoggedIn(i->client) ? i->client->user->svid : "*",
|
||||
i->client->info);
|
||||
} else {
|
||||
sendto_one(user, mtags, ":%s!%s@%s JOIN :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->chname);
|
||||
sendto_one(user, mtags, ":%s!%s@%s JOIN :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->name);
|
||||
}
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
@@ -374,8 +374,8 @@ int moded_chanmode(Client *client, Channel *channel, MessageTag *recv_mtags, cha
|
||||
if (moded_user_invisible(i->client, channel))
|
||||
{
|
||||
MessageTag *mtags = NULL;
|
||||
new_message_special(i->client, recv_mtags, &mtags, ":%s PART %s", i->client->name, channel->chname);
|
||||
sendto_one(user, mtags, ":%s!%s@%s PART :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->chname);
|
||||
new_message_special(i->client, recv_mtags, &mtags, ":%s PART %s", i->client->name, channel->name);
|
||||
sendto_one(user, mtags, ":%s!%s@%s PART :%s", i->client->name, i->client->user->username, GetHost(i->client), channel->name);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -928,9 +928,9 @@ int floodprot_can_send_to_channel(Client *client, Channel *channel, Membership *
|
||||
{
|
||||
mtags = NULL;
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +b %s 0", me.id, channel->chname, mask);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +b %s 0", me.id, channel->name, mask);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s +b %s", me.name, channel->chname, mask);
|
||||
":%s MODE %s +b %s", me.name, channel->name, mask);
|
||||
free_message_tags(mtags);
|
||||
} /* else.. ban list is full */
|
||||
}
|
||||
@@ -1081,7 +1081,7 @@ void floodprottimer_add(Channel *channel, char mflag, time_t when)
|
||||
if (strlen(chp->timers_running)+1 >= sizeof(chp->timers_running))
|
||||
{
|
||||
sendto_realops_and_log("floodprottimer_add: too many timers running for %s (%s)!!!",
|
||||
channel->chname, chp->timers_running);
|
||||
channel->name, chp->timers_running);
|
||||
return;
|
||||
}
|
||||
strccat(chp->timers_running, mflag); /* bounds already checked ^^ */
|
||||
@@ -1140,7 +1140,7 @@ EVENT(modef_event)
|
||||
long mode = 0;
|
||||
Cmode_t extmode = 0;
|
||||
#ifdef NEWFLDDBG
|
||||
sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->channel->chname, e->m);
|
||||
sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->channel->name, e->m);
|
||||
#endif
|
||||
mode = get_mode_bitbychar(e->m);
|
||||
if (mode == 0)
|
||||
@@ -1152,10 +1152,10 @@ EVENT(modef_event)
|
||||
MessageTag *mtags = NULL;
|
||||
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s -%c 0", me.id, e->channel->chname, e->m);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s -%c 0", me.id, e->channel->name, e->m);
|
||||
sendto_channel(e->channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s -%c",
|
||||
me.name, e->channel->chname, e->m);
|
||||
me.name, e->channel->name, e->m);
|
||||
free_message_tags(mtags);
|
||||
|
||||
e->channel->mode.mode &= ~mode;
|
||||
@@ -1168,7 +1168,7 @@ EVENT(modef_event)
|
||||
} else {
|
||||
#ifdef NEWFLDDBG
|
||||
sendto_realops("modef_event: chan %s mode -%c about %d seconds",
|
||||
e->channel->chname, e->m, e->when - now);
|
||||
e->channel->name, e->m, e->when - now);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1258,7 +1258,7 @@ void do_floodprot_action(Channel *channel, int what)
|
||||
new_message(&me, NULL, &mtags);
|
||||
ircsnprintf(comment, sizeof(comment), "*** Channel %s detected (limit is %d per %d seconds), setting mode +%c",
|
||||
text, chp->limit[what], chp->per, m);
|
||||
ircsnprintf(target, sizeof(target), "%%%s", channel->chname);
|
||||
ircsnprintf(target, sizeof(target), "%%%s", channel->name);
|
||||
sendto_channel(channel, &me, NULL, PREFIX_HALFOP|PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
|
||||
0, SEND_ALL, mtags,
|
||||
":%s NOTICE %s :%s", me.name, target, comment);
|
||||
@@ -1267,8 +1267,8 @@ void do_floodprot_action(Channel *channel, int what)
|
||||
/* Then the MODE broadcast */
|
||||
mtags = NULL;
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +%c 0", me.id, channel->chname, m);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +%c", me.name, channel->chname, m);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s +%c 0", me.id, channel->name, m);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s +%c", me.name, channel->name, m);
|
||||
free_message_tags(mtags);
|
||||
|
||||
/* Actually set the mode internally */
|
||||
|
||||
@@ -623,9 +623,9 @@ int history_chanmode_change(Client *client, Channel *channel, MessageTag *mtags,
|
||||
/* If so, grab the settings, and communicate them */
|
||||
settings = (HistoryChanMode *)GETPARASTRUCT(channel, 'H');
|
||||
if (settings)
|
||||
history_set_limit(channel->chname, settings->max_lines, settings->max_time);
|
||||
history_set_limit(channel->name, settings->max_lines, settings->max_time);
|
||||
else
|
||||
history_destroy(channel->chname);
|
||||
history_destroy(channel->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -636,7 +636,7 @@ int history_channel_destroy(Channel *channel, int *should_destroy)
|
||||
if (*should_destroy == 0)
|
||||
return 0; /* channel will not be destroyed */
|
||||
|
||||
history_destroy(channel->chname);
|
||||
history_destroy(channel->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -672,10 +672,10 @@ int history_chanmsg(Client *client, Channel *channel, int sendflags, int prefix,
|
||||
snprintf(buf, sizeof(buf), ":%s %s %s :%s",
|
||||
source,
|
||||
sendtype_to_cmd(sendtype),
|
||||
channel->chname,
|
||||
channel->name,
|
||||
text);
|
||||
|
||||
history_add(channel->chname, mtags, buf);
|
||||
history_add(channel->name, mtags, buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -700,7 +700,7 @@ int history_join(Client *client, Channel *channel, MessageTag *mtags, char *parv
|
||||
filter.cmd = HFC_SIMPLE;
|
||||
filter.last_lines = cfg.playback_on_join.lines;
|
||||
filter.last_seconds = cfg.playback_on_join.time;
|
||||
r = history_request(channel->chname, &filter);
|
||||
r = history_request(channel->name, &filter);
|
||||
if (r)
|
||||
{
|
||||
history_send_result(client, r);
|
||||
@@ -727,7 +727,7 @@ CMD_OVERRIDE_FUNC(override_mode)
|
||||
(IsUser(client) && client->srvptr && client->srvptr->local))
|
||||
{
|
||||
/* Now check if the channel is currently +r */
|
||||
if ((parc >= 2) && !BadPtr(parv[1]) && ((channel = find_channel(parv[1], NULL))) &&
|
||||
if ((parc >= 2) && !BadPtr(parv[1]) && ((channel = find_channel(parv[1]))) &&
|
||||
has_channel_mode(channel, 'r'))
|
||||
{
|
||||
had_r = 1;
|
||||
@@ -744,7 +744,7 @@ CMD_OVERRIDE_FUNC(override_mode)
|
||||
* then...
|
||||
*/
|
||||
if (had_r &&
|
||||
((channel = find_channel(parv[1], NULL))) &&
|
||||
((channel = find_channel(parv[1]))) &&
|
||||
!has_channel_mode(channel, 'r') &&
|
||||
HistoryEnabled(channel))
|
||||
{
|
||||
@@ -782,9 +782,9 @@ CMD_OVERRIDE_FUNC(override_mode)
|
||||
|
||||
sendto_channel(channel, &me, &me, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s %s %s",
|
||||
me.name, channel->chname, modebuf, parabuf);
|
||||
me.name, channel->name, modebuf, parabuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s %lld",
|
||||
me.id, channel->chname, modebuf, parabuf,
|
||||
me.id, channel->name, modebuf, parabuf,
|
||||
(long long)channel->creationtime);
|
||||
|
||||
/* Activate this hook just like cmd_mode.c */
|
||||
|
||||
@@ -143,17 +143,17 @@ void issecure_unset(Channel *channel, Client *client, MessageTag *recv_mtags, in
|
||||
if (notice)
|
||||
{
|
||||
mtags = NULL;
|
||||
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting -Z", channel->chname);
|
||||
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting -Z", channel->name);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s NOTICE %s :User '%s' joined and is not connected through SSL/TLS, setting channel -Z (insecure)",
|
||||
me.id, channel->chname, client->name);
|
||||
me.id, channel->name, client->name);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
channel->mode.extmode &= ~EXTCMODE_ISSECURE;
|
||||
mtags = NULL;
|
||||
new_message_special(&me, recv_mtags, &mtags, "MODE %s -Z", channel->chname);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -Z", me.name, channel->chname);
|
||||
new_message_special(&me, recv_mtags, &mtags, "MODE %s -Z", channel->name);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s -Z", me.name, channel->name);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ void issecure_set(Channel *channel, Client *client, MessageTag *recv_mtags, int
|
||||
MessageTag *mtags;
|
||||
|
||||
mtags = NULL;
|
||||
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting +Z", channel->chname);
|
||||
new_message_special(&me, recv_mtags, &mtags, "NOTICE %s :setting +Z", channel->name);
|
||||
if (notice && client)
|
||||
{
|
||||
/* note that we have to skip 'client', since when this call is being made
|
||||
@@ -176,23 +176,23 @@ void issecure_set(Channel *channel, Client *client, MessageTag *recv_mtags, int
|
||||
*/
|
||||
sendto_channel(channel, &me, client, 0, 0, SEND_LOCAL, NULL,
|
||||
":%s NOTICE %s :Now all users in the channel are connected through SSL/TLS, setting channel +Z (secure)",
|
||||
me.name, channel->chname);
|
||||
me.name, channel->name);
|
||||
} else if (notice)
|
||||
{
|
||||
/* note the missing word 'now' in next line */
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, NULL,
|
||||
":%s NOTICE %s :All users in the channel are connected through SSL/TLS, setting channel +Z (secure)",
|
||||
me.name, channel->chname);
|
||||
me.name, channel->name);
|
||||
}
|
||||
free_message_tags(mtags);
|
||||
|
||||
channel->mode.extmode |= EXTCMODE_ISSECURE;
|
||||
|
||||
mtags = NULL;
|
||||
new_message_special(&me, recv_mtags, &mtags, "MODE %s +Z", channel->chname);
|
||||
new_message_special(&me, recv_mtags, &mtags, "MODE %s +Z", channel->name);
|
||||
sendto_channel(channel, &me, client, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s +Z",
|
||||
me.name, channel->chname);
|
||||
me.name, channel->name);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ int cmodeL_is_ok(Client *client, Channel *channel, char mode, char *para, int ty
|
||||
return EX_DENY;
|
||||
}
|
||||
|
||||
if (find_channel(para, NULL) == channel)
|
||||
if (find_channel(para) == channel)
|
||||
{
|
||||
if (MyUser(client))
|
||||
sendnumeric(client, ERR_CANNOTCHANGECHANMODE, 'L',
|
||||
@@ -335,8 +335,8 @@ int link_doforward(Client *client, Channel *channel, char *linked, linkType type
|
||||
|
||||
sendto_one(client, NULL,
|
||||
":%s %d %s %s %s :[Link] Cannot join channel %s (%s) -- transferring you to %s",
|
||||
me.name, ERR_LINKCHANNEL, client->name, channel->chname, linked,
|
||||
channel->chname, desc, linked);
|
||||
me.name, ERR_LINKCHANNEL, client->name, channel->name, linked,
|
||||
channel->name, desc, linked);
|
||||
parv[0] = client->name;
|
||||
parv[1] = linked;
|
||||
parv[2] = NULL;
|
||||
|
||||
@@ -75,7 +75,7 @@ int noinvite_pre_knock(Client *client, Channel *channel)
|
||||
if (MyUser(client) && IsNoInvite(channel))
|
||||
{
|
||||
sendnumeric(client, ERR_CANNOTKNOCK,
|
||||
channel->chname, "The channel does not allow invites (+V)");
|
||||
channel->name, "The channel does not allow invites (+V)");
|
||||
return HOOK_DENY;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int noinvite_pre_invite(Client *client, Client *target, Channel *channel, int *o
|
||||
{
|
||||
*override = 1;
|
||||
} else {
|
||||
sendnumeric(client, ERR_NOINVITE, channel->chname);
|
||||
sendnumeric(client, ERR_NOINVITE, channel->name);
|
||||
return HOOK_DENY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ int noknock_check (Client *client, Channel *channel)
|
||||
{
|
||||
if (MyUser(client) && IsNoKnock(channel))
|
||||
{
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "No knocks are allowed! (+K)");
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "No knocks are allowed! (+K)");
|
||||
return HOOK_DENY;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,11 +112,11 @@ static int secureonly_kick_insecure_users(Channel *channel)
|
||||
prefix, 0,
|
||||
SEND_LOCAL, mtags,
|
||||
":%s KICK %s %s :%s",
|
||||
me.name, channel->chname, client->name, comment);
|
||||
me.name, channel->name, client->name, comment);
|
||||
|
||||
sendto_prefix_one(client, &me, mtags, ":%s KICK %s %s :%s", me.name, channel->chname, client->name, comment);
|
||||
sendto_prefix_one(client, &me, mtags, ":%s KICK %s %s :%s", me.name, channel->name, client->name, comment);
|
||||
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s KICK %s %s :%s", me.id, channel->chname, client->id, comment);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s KICK %s %s :%s", me.id, channel->name, client->id, comment);
|
||||
|
||||
free_message_tags(mtags);
|
||||
|
||||
@@ -168,7 +168,7 @@ int secureonly_check_sajoin(Client *target, Channel *channel, Client *requester)
|
||||
if (IsSecureOnly(channel) && !IsSecure(target))
|
||||
{
|
||||
sendnotice(requester, "You cannot SAJOIN %s to %s because the channel is +z and the user is not connected via SSL/TLS",
|
||||
target->name, channel->chname);
|
||||
target->name, channel->name);
|
||||
return HOOK_DENY;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ int secureonly_specialcheck(Client *client, Channel *channel, char *parv[])
|
||||
{
|
||||
if ((channel->users == 0) && (iConf.modes_on_join.extmodes & EXTCMODE_SECUREONLY) && !IsSecure(client) && !IsOper(client))
|
||||
{
|
||||
sendnumeric(client, ERR_SECUREONLYCHAN, channel->chname);
|
||||
sendnumeric(client, ERR_SECUREONLYCHAN, channel->name);
|
||||
return HOOK_DENY;
|
||||
}
|
||||
return HOOK_CONTINUE;
|
||||
|
||||
@@ -27,9 +27,7 @@ ModuleHeader MOD_HEADER = {
|
||||
#define MAGIC_CHANNEL_START 0x11111111
|
||||
#define MAGIC_CHANNEL_END 0x22222222
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
#define BENCHMARK
|
||||
#endif
|
||||
// #undef BENCHMARK
|
||||
|
||||
#define WARN_WRITE_ERROR(fname) \
|
||||
do { \
|
||||
@@ -335,7 +333,7 @@ int write_channel_entry(UnrealDB *db, const char *tmpfname, Channel *channel)
|
||||
{
|
||||
W_SAFE(unrealdb_write_int32(db, MAGIC_CHANNEL_START));
|
||||
/* Channel name */
|
||||
W_SAFE(unrealdb_write_str(db, channel->chname));
|
||||
W_SAFE(unrealdb_write_str(db, channel->name));
|
||||
/* Channel creation time */
|
||||
W_SAFE(unrealdb_write_int64(db, channel->creationtime));
|
||||
/* Topic (topic, setby, seton) */
|
||||
@@ -506,7 +504,7 @@ int read_channeldb(void)
|
||||
R_SAFE(unrealdb_read_str(db, &modes2));
|
||||
R_SAFE(unrealdb_read_str(db, &mode_lock));
|
||||
/* If we got this far, we can create/initialize the channel with the above */
|
||||
channel = get_channel(&me, chname, CREATE);
|
||||
channel = make_channel(chname);
|
||||
channel->creationtime = creationtime;
|
||||
safe_strdup(channel->topic, topic);
|
||||
safe_strdup(channel->topic_nick, topic_nick);
|
||||
|
||||
@@ -173,7 +173,7 @@ void chathistory_targets(Client *client, HistoryFilter *filter, int limit)
|
||||
for (mp = client->user->channel; mp; mp = mp->next)
|
||||
{
|
||||
Channel *channel = mp->channel;
|
||||
r = history_request(channel->chname, filter);
|
||||
r = history_request(channel->name, filter);
|
||||
if (r)
|
||||
{
|
||||
add_chathistory_target(&targets, r);
|
||||
@@ -257,7 +257,7 @@ CMD_FUNC(cmd_chathistory)
|
||||
goto end;
|
||||
}
|
||||
|
||||
channel = find_channel(parv[2], NULL);
|
||||
channel = find_channel(parv[2]);
|
||||
if (!channel)
|
||||
{
|
||||
sendto_one(client, NULL, ":%s FAIL CHATHISTORY INVALID_TARGET %s %s :Messages could not be retrieved, not an existing channel",
|
||||
@@ -369,7 +369,7 @@ CMD_FUNC(cmd_chathistory)
|
||||
if (filter->limit > CHATHISTORY_LIMIT)
|
||||
filter->limit = CHATHISTORY_LIMIT;
|
||||
|
||||
if ((r = history_request(channel->chname, filter)))
|
||||
if ((r = history_request(channel->name, filter)))
|
||||
history_send_result(client, r);
|
||||
|
||||
end:
|
||||
|
||||
+20
-18
@@ -360,16 +360,18 @@ EVENT(connthrottle_evt)
|
||||
|
||||
if (ucounter->rejected_clients)
|
||||
{
|
||||
snprintf(buf, sizeof(buf),
|
||||
"[ConnThrottle] Stats for this server past 60 secs: Connections rejected: %d. Accepted: %d known user(s), %d SASL, %d WEBIRC and %d new user(s).",
|
||||
ucounter->rejected_clients,
|
||||
ucounter->allowed_score,
|
||||
ucounter->allowed_sasl,
|
||||
ucounter->allowed_webirc,
|
||||
ucounter->allowed_other);
|
||||
|
||||
sendto_realops("%s", buf);
|
||||
ircd_log(LOG_ERROR, "%s", buf);
|
||||
unreal_log(ULOG_INFO, "connthrottle", "CONNTHROTLE_REPORT", NULL,
|
||||
"ConnThrottle] Stats for this server past 60 secs: "
|
||||
"Connections rejected: $num_rejected. "
|
||||
"Accepted: $num_accepted_known_users known user(s), "
|
||||
"$num_accepted_sasl SASL, "
|
||||
"$num_accepted_webirc WEBIRC and "
|
||||
"$num_accepted_unknown_users new user(s).",
|
||||
log_data_integer("num_rejected", ucounter->rejected_clients),
|
||||
log_data_integer("num_accepted_known_users", ucounter->allowed_score),
|
||||
log_data_integer("num_accepted_sasl", ucounter->allowed_sasl),
|
||||
log_data_integer("num_accepted_webirc", ucounter->allowed_webirc),
|
||||
log_data_integer("num_accepted_unknown_users", ucounter->allowed_other));
|
||||
}
|
||||
|
||||
/* Reset stats for next message */
|
||||
@@ -436,8 +438,8 @@ int ct_pre_lconnect(Client *client)
|
||||
/* We send the LARGE banner if throttling was activated */
|
||||
if (!ucounter->throttling_previous_minute && !ucounter->throttling_banner_displayed)
|
||||
{
|
||||
ircd_log(LOG_ERROR, "[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE.");
|
||||
sendto_realops("[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE.");
|
||||
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_ACTIVATED", NULL,
|
||||
"[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE.");
|
||||
sendto_realops("[ConnThrottle] Users with IP addresses that have not been seen before will be rejected above the set connection rate. Known users can still get in.");
|
||||
sendto_realops("[ConnThrottle] For more information see https://www.unrealircd.org/docs/ConnThrottle");
|
||||
ucounter->throttling_banner_displayed = 1;
|
||||
@@ -602,8 +604,8 @@ CMD_FUNC(ct_throttle)
|
||||
return;
|
||||
}
|
||||
ucounter->disabled = 1;
|
||||
sendto_realops("[connthrottle] %s (%s@%s) DISABLED the connthrottle module.",
|
||||
client->name, client->user->username, client->user->realhost);
|
||||
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_MODULE_DISABLED", client,
|
||||
"[ConnThrottle] $client.nuh DISABLED the connthrottle module.");
|
||||
} else
|
||||
if (!strcasecmp(parv[1], "ON"))
|
||||
{
|
||||
@@ -612,15 +614,15 @@ CMD_FUNC(ct_throttle)
|
||||
sendnotice(client, "Already ON");
|
||||
return;
|
||||
}
|
||||
sendto_realops("[connthrottle] %s (%s@%s) ENABLED the connthrottle module.",
|
||||
client->name, client->user->username, client->user->realhost);
|
||||
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_MODULE_ENABLED", client,
|
||||
"[ConnThrottle] $client.nuh ENABLED the connthrottle module.");
|
||||
ucounter->disabled = 0;
|
||||
} else
|
||||
if (!strcasecmp(parv[1], "RESET"))
|
||||
{
|
||||
memset(ucounter, 0, sizeof(UCounter));
|
||||
sendto_realops("[connthrottle] %s (%s@%s) did a RESET on the stats/counters!!",
|
||||
client->name, client->user->username, client->user->realhost);
|
||||
unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_RESET", client,
|
||||
"[ConnThrottle] $client.nuh did a RESET on the statistics/counters.");
|
||||
} else
|
||||
{
|
||||
sendnotice(client, "Unknown option '%s'", parv[1]);
|
||||
|
||||
@@ -515,7 +515,7 @@ int dccdeny_can_send_to_channel(Client *client, Channel *channel, Membership *lp
|
||||
{
|
||||
char *err = NULL;
|
||||
char *filename = get_dcc_filename(*msg);
|
||||
if (filename && !can_dcc(client, channel->chname, NULL, filename, &err))
|
||||
if (filename && !can_dcc(client, channel->name, NULL, filename, &err))
|
||||
{
|
||||
if (!IsDead(client) && (sendtype != SEND_TYPE_NOTICE))
|
||||
{
|
||||
|
||||
@@ -65,10 +65,6 @@ CMD_FUNC(cmd_eos)
|
||||
return;
|
||||
client->serv->flags.synced = 1;
|
||||
/* pass it on ^_- */
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: got sync from %s (path:%s)", client->name, client->direction->name);
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: broadcasting it back to everyone except route from %s", client->direction->name);
|
||||
#endif
|
||||
sendto_server(client, 0, 0, NULL, ":%s EOS", client->id);
|
||||
|
||||
RunHook(HOOKTYPE_SERVER_SYNCED, client);
|
||||
|
||||
@@ -146,7 +146,7 @@ int extban_inchannel_is_banned(Client *client, Channel *channel, char *ban, int
|
||||
|
||||
for (lp = client->user->channel; lp; lp = lp->next)
|
||||
{
|
||||
if (match_esc(p, lp->channel->chname))
|
||||
if (match_esc(p, lp->channel->name))
|
||||
{
|
||||
/* Channel matched, check symbol if needed (+/%/@/etc) */
|
||||
if (symbol)
|
||||
|
||||
@@ -275,7 +275,7 @@ int extban_modeT_is_ok(Client *client, Channel *channel, char *para, int checkt,
|
||||
((n = counttextbans(channel)) >= MAX_EXTBANT_PER_CHAN))
|
||||
{
|
||||
/* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */
|
||||
sendnumeric(client, ERR_BANLISTFULL, channel->chname, para);
|
||||
sendnumeric(client, ERR_BANLISTFULL, channel->name, para);
|
||||
sendnotice(client, "Too many textbans for this channel");
|
||||
return 0;
|
||||
}
|
||||
@@ -500,7 +500,7 @@ int textban_check_ban(Client *client, Channel *channel, char *ban, char **msg, c
|
||||
gettimeofday(&tv_beta, NULL);
|
||||
ircd_log(LOG_ERROR, "TextBan Timing: %ld microseconds (%s / %s / %d)",
|
||||
((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec),
|
||||
client->name, channel->chname, strlen(*msg));
|
||||
client->name, channel->name, strlen(*msg));
|
||||
#endif
|
||||
|
||||
if (cleaned)
|
||||
|
||||
@@ -398,7 +398,7 @@ EVENT(timedban_timeout)
|
||||
* is too costly. So we stick with this. It should be
|
||||
* good enough. Alternative would be some channel->id value.
|
||||
*/
|
||||
if (((unsigned int)channel->chname[1] % TIMEDBAN_TIMER_ITERATION_SPLIT) != current_iteration)
|
||||
if (((unsigned int)channel->name[1] % TIMEDBAN_TIMER_ITERATION_SPLIT) != current_iteration)
|
||||
continue; /* not this time, maybe next */
|
||||
|
||||
*mbuf = *pbuf = '\0';
|
||||
@@ -433,8 +433,8 @@ EVENT(timedban_timeout)
|
||||
{
|
||||
MessageTag *mtags = NULL;
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->chname, mbuf, pbuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->chname, mbuf, pbuf);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->name, mbuf, pbuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->name, mbuf, pbuf);
|
||||
free_message_tags(mtags);
|
||||
*pbuf = 0;
|
||||
}
|
||||
@@ -484,8 +484,8 @@ void add_send_mode_param(Channel *channel, Client *from, char what, char mode, c
|
||||
MessageTag *mtags = NULL;
|
||||
|
||||
new_message(&me, NULL, &mtags);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->chname, mbuf, pbuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->chname, mbuf, pbuf);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, mtags, ":%s MODE %s %s %s", me.name, channel->name, mbuf, pbuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s 0", me.id, channel->name, mbuf, pbuf);
|
||||
free_message_tags(mtags);
|
||||
send = 0;
|
||||
*pbuf = 0;
|
||||
|
||||
@@ -82,7 +82,7 @@ CMD_FUNC(cmd_history)
|
||||
return;
|
||||
}
|
||||
|
||||
channel = find_channel(parv[1], NULL);
|
||||
channel = find_channel(parv[1]);
|
||||
if (!channel)
|
||||
{
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]);
|
||||
@@ -91,13 +91,13 @@ CMD_FUNC(cmd_history)
|
||||
|
||||
if (!IsMember(client, channel))
|
||||
{
|
||||
sendnumeric(client, ERR_NOTONCHANNEL, channel->chname);
|
||||
sendnumeric(client, ERR_NOTONCHANNEL, channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!has_channel_mode(channel, 'H'))
|
||||
{
|
||||
sendnotice(client, "Channel %s does not have channel mode +H set", channel->chname);
|
||||
sendnotice(client, "Channel %s does not have channel mode +H set", channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ CMD_FUNC(cmd_history)
|
||||
filter.cmd = HFC_SIMPLE;
|
||||
filter.last_lines = lines;
|
||||
|
||||
if ((r = history_request(channel->chname, &filter)))
|
||||
if ((r = history_request(channel->name, &filter)))
|
||||
{
|
||||
history_send_result(client, r);
|
||||
free_history_result(r);
|
||||
|
||||
@@ -481,7 +481,7 @@ int hbm_modechar_del(Channel *channel, int modechar)
|
||||
if (!cfg.persist)
|
||||
return 0;
|
||||
|
||||
if ((modechar == 'P') && ((h = hbm_find_object(channel->chname))))
|
||||
if ((modechar == 'P') && ((h = hbm_find_object(channel->name))))
|
||||
{
|
||||
/* Channel went from +P to -P and also has channel history: delete the history file */
|
||||
hbm_delete_db(h);
|
||||
@@ -1533,7 +1533,7 @@ static int hbm_write_db(HistoryLogObject *h)
|
||||
if (!cfg.db_secret)
|
||||
abort();
|
||||
|
||||
channel = find_channel(h->name, NULL);
|
||||
channel = find_channel(h->name);
|
||||
if (!channel || !has_channel_mode(channel, 'P'))
|
||||
return 1; /* Don't save this channel, pretend success */
|
||||
|
||||
|
||||
+22
-22
@@ -198,7 +198,7 @@ void send_invite_list(Client *client)
|
||||
for (inv = CLIENT_INVITES(client); inv; inv = inv->next)
|
||||
{
|
||||
sendnumeric(client, RPL_INVITELIST,
|
||||
inv->value.channel->chname);
|
||||
inv->value.channel->name);
|
||||
}
|
||||
sendnumeric(client, RPL_ENDOFINVITELIST);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ void invite_process(Client *client, Client *target, Channel *channel, MessageTag
|
||||
new_message(client, recv_mtags, &mtags);
|
||||
|
||||
/* broadcast to other servers */
|
||||
sendto_server(client, 0, 0, mtags, ":%s INVITE %s %s %d", client->id, target->id, channel->chname, override);
|
||||
sendto_server(client, 0, 0, mtags, ":%s INVITE %s %s %d", client->id, target->id, channel->name, override);
|
||||
|
||||
/* send chanops notifications */
|
||||
if (IsUser(client) && (is_chan_op(client, channel)
|
||||
@@ -240,20 +240,20 @@ void invite_process(Client *client, Client *target, Channel *channel, MessageTag
|
||||
sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
|
||||
0, SEND_LOCAL, mtags,
|
||||
":%s NOTICE @%s :OperOverride -- %s invited him/herself into the channel.",
|
||||
me.name, channel->chname, client->name);
|
||||
me.name, channel->name, client->name);
|
||||
}
|
||||
if (override == 0)
|
||||
{
|
||||
sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
|
||||
CAP_INVITE_NOTIFY | CAP_INVERT, SEND_LOCAL, mtags,
|
||||
":%s NOTICE @%s :%s invited %s into the channel.",
|
||||
me.name, channel->chname, client->name, target->name);
|
||||
me.name, channel->name, client->name, target->name);
|
||||
}
|
||||
/* always send IRCv3 invite-notify if possible */
|
||||
sendto_channel(channel, client, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
|
||||
CAP_INVITE_NOTIFY, SEND_LOCAL, mtags,
|
||||
":%s INVITE %s %s",
|
||||
client->name, target->name, channel->chname);
|
||||
client->name, target->name, channel->name);
|
||||
}
|
||||
|
||||
/* add to list and notify the person who got invited */
|
||||
@@ -270,7 +270,7 @@ void invite_process(Client *client, Client *target, Channel *channel, MessageTag
|
||||
if (!is_silenced(client, target))
|
||||
{
|
||||
sendto_prefix_one(target, client, mtags, ":%s INVITE %s :%s", client->name,
|
||||
target->name, channel->chname);
|
||||
target->name, channel->name);
|
||||
}
|
||||
}
|
||||
free_message_tags(mtags);
|
||||
@@ -295,7 +295,7 @@ CMD_FUNC(cmd_invite)
|
||||
{
|
||||
params_ok = 1;
|
||||
target = find_person(parv[1], NULL);
|
||||
channel = find_channel(parv[2], NULL);
|
||||
channel = find_channel(parv[2]);
|
||||
}
|
||||
|
||||
if (!MyConnect(client))
|
||||
@@ -386,7 +386,7 @@ CMD_FUNC(cmd_invite)
|
||||
{
|
||||
override = 1;
|
||||
} else {
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -396,17 +396,17 @@ CMD_FUNC(cmd_invite)
|
||||
{
|
||||
override = 1;
|
||||
} else {
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SPAMFILTER_VIRUSCHANDENY && SPAMFILTER_VIRUSCHAN &&
|
||||
!strcasecmp(channel->chname, SPAMFILTER_VIRUSCHAN) &&
|
||||
!strcasecmp(channel->name, SPAMFILTER_VIRUSCHAN) &&
|
||||
!is_chan_op(client, channel) && !ValidatePermissionsForPath("immune:server-ban:viruschan",client,NULL,NULL,NULL))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ CMD_FUNC(cmd_invite)
|
||||
|
||||
if (!override)
|
||||
{
|
||||
sendnumeric(client, RPL_INVITING, target->name, channel->chname);
|
||||
sendnumeric(client, RPL_INVITING, target->name, channel->name);
|
||||
if (target->user->away)
|
||||
{
|
||||
sendnumeric(client, RPL_AWAY, target->name, target->user->away);
|
||||
@@ -435,33 +435,33 @@ CMD_FUNC(cmd_invite)
|
||||
{
|
||||
sendto_snomask_global(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +b).",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
/* Logging implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Ban).",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
}
|
||||
else if (channel->mode.mode & MODE_INVITEONLY)
|
||||
{
|
||||
sendto_snomask_global(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +i).",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
/* Logging implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Invite Only)",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
}
|
||||
else if (channel->mode.limit)
|
||||
{
|
||||
sendto_snomask_global(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +l).",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
/* Logging implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Limit)",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
}
|
||||
|
||||
@@ -469,22 +469,22 @@ CMD_FUNC(cmd_invite)
|
||||
{
|
||||
sendto_snomask_global(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +k).",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
/* Logging implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding Key)",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
}
|
||||
else if (has_channel_mode(channel, 'z'))
|
||||
{
|
||||
sendto_snomask_global(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +z).",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
|
||||
/* Logging implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) invited him/herself into %s (Overriding SSL/TLS-Only)",
|
||||
client->name, client->user->username, client->user->realhost, channel->chname);
|
||||
client->name, client->user->username, client->user->realhost, channel->name);
|
||||
}
|
||||
#ifdef OPEROVERRIDE_VERIFY
|
||||
else if (channel->mode.mode & MODE_SECRET || channel->mode.mode & MODE_PRIVATE)
|
||||
|
||||
+21
-21
@@ -146,7 +146,7 @@ int _can_join(Client *client, Channel *channel, char *key, char *parv[])
|
||||
#ifndef NO_OPEROVERRIDE
|
||||
#ifdef OPEROVERRIDE_VERIFY
|
||||
if (ValidatePermissionsForPath("channel:override:privsecret",client,NULL,channel,NULL) && (channel->mode.mode & MODE_SECRET ||
|
||||
channel->mode.mode & MODE_PRIVATE) && !is_autojoin_chan(channel->chname))
|
||||
channel->mode.mode & MODE_PRIVATE) && !is_autojoin_chan(channel->name))
|
||||
return (ERR_OPERSPVERIFY);
|
||||
#endif
|
||||
#endif
|
||||
@@ -194,10 +194,10 @@ void _send_join_to_local_users(Client *client, Channel *channel, MessageTag *mta
|
||||
long CAP_AWAY_NOTIFY = ClientCapabilityBit("away-notify");
|
||||
|
||||
ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN :%s",
|
||||
client->name, client->user->username, GetHost(client), channel->chname);
|
||||
client->name, client->user->username, GetHost(client), channel->name);
|
||||
|
||||
ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s",
|
||||
client->name, client->user->username, GetHost(client), channel->chname,
|
||||
client->name, client->user->username, GetHost(client), channel->name,
|
||||
IsLoggedIn(client) ? client->user->svid : "*",
|
||||
client->info);
|
||||
|
||||
@@ -237,7 +237,7 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
|
||||
char *parv[] = { 0, 0 };
|
||||
|
||||
/* Same way as in SJOIN */
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->chname);
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s JOIN %s", client->name, channel->name);
|
||||
|
||||
new_message(&me, recv_mtags, &mtags_sjoin);
|
||||
|
||||
@@ -247,7 +247,7 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
|
||||
|
||||
sendto_server(client, 0, 0, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ",
|
||||
me.id, (long long)channel->creationtime,
|
||||
channel->chname, chfl_to_sjoin_symbol(flags), client->id);
|
||||
channel->name, chfl_to_sjoin_symbol(flags), client->id);
|
||||
|
||||
if (MyUser(client))
|
||||
{
|
||||
@@ -260,13 +260,13 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
|
||||
{
|
||||
channel->creationtime = TStime();
|
||||
sendto_server(client, 0, 0, NULL, ":%s MODE %s + %lld",
|
||||
me.id, channel->chname, (long long)channel->creationtime);
|
||||
me.id, channel->name, (long long)channel->creationtime);
|
||||
}
|
||||
|
||||
if (channel->topic)
|
||||
{
|
||||
sendnumeric(client, RPL_TOPIC, channel->chname, channel->topic);
|
||||
sendnumeric(client, RPL_TOPICWHOTIME, channel->chname, channel->topic_nick,
|
||||
sendnumeric(client, RPL_TOPIC, channel->name, channel->topic);
|
||||
sendnumeric(client, RPL_TOPICWHOTIME, channel->name, channel->topic_nick,
|
||||
channel->topic_time);
|
||||
}
|
||||
|
||||
@@ -295,15 +295,15 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int
|
||||
*modebuf = *parabuf = 0;
|
||||
channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel, 0);
|
||||
/* This should probably be in the SJOIN stuff */
|
||||
new_message_special(&me, recv_mtags, &mtags_mode, ":%s MODE %s %s %s", me.name, channel->chname, modebuf, parabuf);
|
||||
new_message_special(&me, recv_mtags, &mtags_mode, ":%s MODE %s %s %s", me.name, channel->name, modebuf, parabuf);
|
||||
sendto_server(NULL, 0, 0, mtags_mode, ":%s MODE %s %s %s %lld",
|
||||
me.id, channel->chname, modebuf, parabuf, (long long)channel->creationtime);
|
||||
sendto_one(client, mtags_mode, ":%s MODE %s %s %s", me.name, channel->chname, modebuf, parabuf);
|
||||
me.id, channel->name, modebuf, parabuf, (long long)channel->creationtime);
|
||||
sendto_one(client, mtags_mode, ":%s MODE %s %s %s", me.name, channel->name, modebuf, parabuf);
|
||||
free_message_tags(mtags_mode);
|
||||
}
|
||||
|
||||
parv[0] = client->name;
|
||||
parv[1] = channel->chname;
|
||||
parv[1] = channel->name;
|
||||
do_cmd(client, NULL, "NAMES", 2, parv);
|
||||
|
||||
RunHook4(HOOKTYPE_LOCAL_JOIN, client, channel, mtags, parv);
|
||||
@@ -383,7 +383,7 @@ void _do_join(Client *client, int parc, char *parv[])
|
||||
if (MyConnect(client) && !valid_channelname(name))
|
||||
{
|
||||
send_invalid_channelname(client, name);
|
||||
if (IsOper(client) && find_channel(name, NULL))
|
||||
if (IsOper(client) && find_channel(name))
|
||||
{
|
||||
/* Give IRCOps a bit more information */
|
||||
sendnotice(client, "Channel '%s' is unjoinable because it contains illegal characters. "
|
||||
@@ -441,8 +441,8 @@ void _do_join(Client *client, int parc, char *parv[])
|
||||
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s PART %s :%s",
|
||||
client->name, channel->chname, "Left all channels");
|
||||
sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", client->name, channel->chname);
|
||||
client->name, channel->name, "Left all channels");
|
||||
sendto_server(client, 0, 0, mtags, ":%s PART %s :Left all channels", client->name, channel->name);
|
||||
|
||||
if (MyConnect(client))
|
||||
RunHook4(HOOKTYPE_LOCAL_PART, client, channel, mtags, "Left all channels");
|
||||
@@ -513,7 +513,7 @@ void _do_join(Client *client, int parc, char *parv[])
|
||||
!strcasecmp(name, SPAMFILTER_VIRUSCHAN) &&
|
||||
!ValidatePermissionsForPath("immune:server-ban:viruschan",client,NULL,NULL,NULL) && !spamf_ugly_vchanoverride)
|
||||
{
|
||||
Channel *channel = find_channel(name, NULL);
|
||||
Channel *channel = find_channel(name);
|
||||
|
||||
if (!channel || !is_invited(client, channel))
|
||||
{
|
||||
@@ -524,7 +524,7 @@ void _do_join(Client *client, int parc, char *parv[])
|
||||
}
|
||||
}
|
||||
|
||||
channel = get_channel(client, name, CREATE);
|
||||
channel = make_channel(name);
|
||||
if (channel && (lp = find_membership_link(client->user->channel, channel)))
|
||||
continue;
|
||||
|
||||
@@ -713,20 +713,20 @@ void _userhost_changed(Client *client)
|
||||
/* Prepare buffers for PART, JOIN, MODE */
|
||||
ircsnprintf(partbuf, sizeof(partbuf), ":%s!%s@%s PART %s :%s",
|
||||
remember_nick, remember_user, remember_host,
|
||||
channel->chname,
|
||||
channel->name,
|
||||
"Changing host");
|
||||
|
||||
ircsnprintf(joinbuf, sizeof(joinbuf), ":%s!%s@%s JOIN %s",
|
||||
client->name, client->user->username, GetHost(client), channel->chname);
|
||||
client->name, client->user->username, GetHost(client), channel->name);
|
||||
|
||||
ircsnprintf(exjoinbuf, sizeof(exjoinbuf), ":%s!%s@%s JOIN %s %s :%s",
|
||||
client->name, client->user->username, GetHost(client), channel->chname,
|
||||
client->name, client->user->username, GetHost(client), channel->name,
|
||||
IsLoggedIn(client) ? client->user->svid : "*",
|
||||
client->info);
|
||||
|
||||
modes = get_chmodes_for_user(client, flags);
|
||||
if (!BadPtr(modes))
|
||||
ircsnprintf(modebuf, sizeof(modebuf), ":%s MODE %s %s", me.name, channel->chname, modes);
|
||||
ircsnprintf(modebuf, sizeof(modebuf), ":%s MODE %s %s", me.name, channel->name, modes);
|
||||
|
||||
for (lp = channel->members; lp; lp = lp->next)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ typedef struct JoinFlood JoinFlood;
|
||||
|
||||
struct JoinFlood {
|
||||
JoinFlood *prev, *next;
|
||||
char chname[CHANNELLEN+1];
|
||||
char name[CHANNELLEN+1];
|
||||
time_t firstjoin;
|
||||
unsigned short numjoins;
|
||||
};
|
||||
@@ -104,7 +104,7 @@ static int isjthrottled(Client *client, Channel *channel)
|
||||
|
||||
/* Grab user<->chan entry.. */
|
||||
for (e = moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next)
|
||||
if (!strcasecmp(e->chname, channel->chname))
|
||||
if (!strcasecmp(e->name, channel->name))
|
||||
break;
|
||||
|
||||
if (!e)
|
||||
@@ -129,7 +129,7 @@ static void jointhrottle_increase_usercounter(Client *client, Channel *channel)
|
||||
|
||||
/* Grab user<->chan entry.. */
|
||||
for (e = moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next)
|
||||
if (!strcasecmp(e->chname, channel->chname))
|
||||
if (!strcasecmp(e->name, channel->name))
|
||||
break;
|
||||
|
||||
if (!e)
|
||||
@@ -175,12 +175,12 @@ JoinFlood *jointhrottle_addentry(Client *client, Channel *channel)
|
||||
abort();
|
||||
|
||||
for (e=moddata_local_client(client, jointhrottle_md).ptr; e; e=e->next)
|
||||
if (!strcasecmp(e->chname, channel->chname))
|
||||
if (!strcasecmp(e->name, channel->name))
|
||||
abort(); /* already exists -- should never happen */
|
||||
#endif
|
||||
|
||||
e = safe_alloc(sizeof(JoinFlood));
|
||||
strlcpy(e->chname, channel->chname, sizeof(e->chname));
|
||||
strlcpy(e->name, channel->name, sizeof(e->name));
|
||||
|
||||
/* Insert our new entry as (new) head */
|
||||
if (moddata_local_client(client, jointhrottle_md).ptr)
|
||||
@@ -213,7 +213,7 @@ EVENT(jointhrottle_cleanup_structs)
|
||||
continue; /* still valid entry */
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "jointhrottle_cleanup_structs(): freeing %s/%s (%ld[%ld], %ld)",
|
||||
client->name, jf->chname, jf->firstjoin, (long)(TStime() - jf->firstjoin),
|
||||
client->name, jf->name, jf->firstjoin, (long)(TStime() - jf->firstjoin),
|
||||
iConf.floodsettings->period[FLD_JOIN]);
|
||||
#endif
|
||||
if (moddata_local_client(client, jointhrottle_md).ptr == jf)
|
||||
|
||||
+13
-13
@@ -84,7 +84,7 @@ void _kick_user(MessageTag *initial_mtags, Channel *channel, Client *client, Cli
|
||||
new_message(client, NULL, &initial_mtags);
|
||||
}
|
||||
|
||||
new_message_special(client, initial_mtags, &mtags, ":%s KICK %s %s", client->name, channel->chname, victim->name);
|
||||
new_message_special(client, initial_mtags, &mtags, ":%s KICK %s %s", client->name, channel->name, victim->name);
|
||||
/* The same message is actually sent at 5 places below (though max 4 at most) */
|
||||
|
||||
if (MyUser(client))
|
||||
@@ -99,22 +99,22 @@ void _kick_user(MessageTag *initial_mtags, Channel *channel, Client *client, Cli
|
||||
PREFIX_HALFOP|PREFIX_OP|PREFIX_OWNER|PREFIX_ADMIN, 0,
|
||||
SEND_LOCAL, mtags,
|
||||
":%s KICK %s %s :%s",
|
||||
client->name, channel->chname, victim->name, comment);
|
||||
client->name, channel->name, victim->name, comment);
|
||||
|
||||
if (MyUser(victim))
|
||||
{
|
||||
sendto_prefix_one(victim, client, mtags, ":%s KICK %s %s :%s",
|
||||
client->name, channel->chname, victim->name, comment);
|
||||
client->name, channel->name, victim->name, comment);
|
||||
}
|
||||
} else {
|
||||
/* NORMAL */
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s KICK %s %s :%s",
|
||||
client->name, channel->chname, victim->name, comment);
|
||||
client->name, channel->name, victim->name, comment);
|
||||
}
|
||||
|
||||
sendto_server(client, 0, 0, mtags, ":%s KICK %s %s :%s",
|
||||
client->id, channel->chname, victim->id, comment);
|
||||
client->id, channel->name, victim->id, comment);
|
||||
|
||||
free_message_tags(mtags);
|
||||
if (initial_mtags_generated)
|
||||
@@ -166,7 +166,7 @@ CMD_FUNC(cmd_kick)
|
||||
for (; (name = strtoken(&p, parv[1], ",")); parv[1] = NULL)
|
||||
{
|
||||
long client_flags = 0;
|
||||
channel = get_channel(client, name, !CREATE);
|
||||
channel = find_channel(name);
|
||||
if (!channel)
|
||||
{
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
|
||||
@@ -178,7 +178,7 @@ CMD_FUNC(cmd_kick)
|
||||
if (MyUser(client) && !IsULine(client) && !op_can_override("channel:override:kick:no-ops",client,channel,NULL)
|
||||
&& !(client_flags & CHFL_ISOP) && !(client_flags & CHFL_HALFOP))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -250,10 +250,10 @@ CMD_FUNC(cmd_kick)
|
||||
sendto_snomask(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, who->name, comment);
|
||||
channel->name, who->name, comment);
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, who->name, comment);
|
||||
channel->name, who->name, comment);
|
||||
goto attack; /* all other checks don't matter anymore (and could cause double msgs) */
|
||||
} else {
|
||||
/* Not an oper overriding */
|
||||
@@ -277,12 +277,12 @@ CMD_FUNC(cmd_kick)
|
||||
sendto_snomask(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, who->name, comment);
|
||||
channel->name, who->name, comment);
|
||||
|
||||
/* Logging Implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, who->name, comment);
|
||||
channel->name, who->name, comment);
|
||||
|
||||
goto attack;
|
||||
} /* is_chan_op */
|
||||
@@ -299,12 +299,12 @@ CMD_FUNC(cmd_kick)
|
||||
sendto_snomask(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, who->name, comment);
|
||||
channel->name, who->name, comment);
|
||||
|
||||
/* Logging Implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) KICK %s %s (%s)",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, who->name, comment);
|
||||
channel->name, who->name, comment);
|
||||
|
||||
goto attack;
|
||||
}
|
||||
|
||||
+7
-7
@@ -97,7 +97,7 @@ CMD_FUNC(cmd_knock)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(channel = find_channel(parv[1], NULL)))
|
||||
if (!(channel = find_channel(parv[1])))
|
||||
{
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, parv[1], "Channel does not exist!");
|
||||
return;
|
||||
@@ -106,19 +106,19 @@ CMD_FUNC(cmd_knock)
|
||||
/* IsMember bugfix by codemastr */
|
||||
if (IsMember(client, channel) == 1)
|
||||
{
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "You're already there!");
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "You're already there!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(channel->mode.mode & MODE_INVITEONLY))
|
||||
{
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "Channel is not invite only!");
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "Channel is not invite only!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_banned(client, channel, BANCHK_JOIN, NULL, NULL))
|
||||
{
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->chname, "You're banned!");
|
||||
sendnumeric(client, ERR_CANNOTKNOCK, channel->name, "You're banned!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -145,14 +145,14 @@ CMD_FUNC(cmd_knock)
|
||||
sendto_channel(channel, &me, NULL, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
|
||||
0, SEND_LOCAL, mtags,
|
||||
":%s NOTICE @%s :[Knock] by %s!%s@%s (%s)",
|
||||
me.name, channel->chname,
|
||||
me.name, channel->name,
|
||||
client->name, client->user->username, GetHost(client),
|
||||
reason);
|
||||
|
||||
sendto_server(client, 0, 0, mtags, ":%s KNOCK %s :%s", client->id, channel->chname, reason);
|
||||
sendto_server(client, 0, 0, mtags, ":%s KNOCK %s :%s", client->id, channel->name, reason);
|
||||
|
||||
if (MyUser(client))
|
||||
sendnotice(client, "Knocked on %s", channel->chname);
|
||||
sendnotice(client, "Knocked on %s", channel->name);
|
||||
|
||||
RunHook4(HOOKTYPE_KNOCK, client, channel, mtags, parv[2]);
|
||||
|
||||
|
||||
+9
-9
@@ -269,7 +269,7 @@ CMD_FUNC(cmd_list)
|
||||
}
|
||||
else /* Just a normal channel */
|
||||
{
|
||||
channel = find_channel(name, NULL);
|
||||
channel = find_channel(name);
|
||||
if (channel && (ShowChannel(client, channel) || ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL))) {
|
||||
#ifdef LIST_SHOW_MODES
|
||||
modebuf[0] = '[';
|
||||
@@ -343,9 +343,9 @@ int send_list(Client *client)
|
||||
ConfigItem_offchans *x;
|
||||
for (x = conf_offchans; x; x = x->next)
|
||||
{
|
||||
if (find_channel(x->chname, NULL))
|
||||
if (find_channel(x->name))
|
||||
continue; /* exists, >0 users.. will be sent later */
|
||||
sendnumeric(client, RPL_LIST, x->chname,
|
||||
sendnumeric(client, RPL_LIST, x->name,
|
||||
0,
|
||||
#ifdef LIST_SHOW_MODES
|
||||
"",
|
||||
@@ -366,11 +366,11 @@ int send_list(Client *client)
|
||||
continue;
|
||||
|
||||
/* set::hide-list { deny-channel } */
|
||||
if (!IsOper(client) && iConf.hide_list && find_channel_allowed(client, channel->chname))
|
||||
if (!IsOper(client) && iConf.hide_list && find_channel_allowed(client, channel->name))
|
||||
continue;
|
||||
|
||||
/* Similarly, hide unjoinable channels for non-ircops since it would be confusing */
|
||||
if (!IsOper(client) && !valid_channelname(channel->chname))
|
||||
if (!IsOper(client) && !valid_channelname(channel->name))
|
||||
continue;
|
||||
|
||||
/* Much more readable like this -- codemastr */
|
||||
@@ -394,11 +394,11 @@ int send_list(Client *client)
|
||||
continue;
|
||||
|
||||
/* Must not be on nolist (if it exists) */
|
||||
if (lopt->nolist && find_name_list_match(lopt->nolist, channel->chname))
|
||||
if (lopt->nolist && find_name_list_match(lopt->nolist, channel->name))
|
||||
continue;
|
||||
|
||||
/* Must be on yeslist (if it exists) */
|
||||
if (lopt->yeslist && !find_name_list_match(lopt->yeslist, channel->chname))
|
||||
if (lopt->yeslist && !find_name_list_match(lopt->yeslist, channel->name))
|
||||
continue;
|
||||
}
|
||||
#ifdef LIST_SHOW_MODES
|
||||
@@ -412,7 +412,7 @@ int send_list(Client *client)
|
||||
if (!ValidatePermissionsForPath("channel:see:list:secret",client,NULL,channel,NULL))
|
||||
sendnumeric(client, RPL_LIST,
|
||||
ShowChannel(client,
|
||||
channel) ? channel->chname :
|
||||
channel) ? channel->name :
|
||||
"*", channel->users,
|
||||
#ifdef LIST_SHOW_MODES
|
||||
ShowChannel(client, channel) ?
|
||||
@@ -422,7 +422,7 @@ int send_list(Client *client)
|
||||
channel) ? (channel->topic ?
|
||||
channel->topic : "") : "");
|
||||
else
|
||||
sendnumeric(client, RPL_LIST, channel->chname,
|
||||
sendnumeric(client, RPL_LIST, channel->name,
|
||||
channel->users,
|
||||
#ifdef LIST_SHOW_MODES
|
||||
modebuf,
|
||||
|
||||
+12
-12
@@ -138,7 +138,7 @@ CMD_FUNC(cmd_md)
|
||||
} else
|
||||
if (!strcmp(type, "channel"))
|
||||
{
|
||||
Channel *channel = find_channel(objname, NULL);
|
||||
Channel *channel = find_channel(objname);
|
||||
md = findmoddata_byname(varname, MODDATATYPE_CHANNEL);
|
||||
if (!md || !md->unserialize || !channel)
|
||||
return;
|
||||
@@ -166,7 +166,7 @@ CMD_FUNC(cmd_md)
|
||||
return;
|
||||
*p++ = '\0';
|
||||
|
||||
channel = find_channel(objname, NULL);
|
||||
channel = find_channel(objname);
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
@@ -213,7 +213,7 @@ CMD_FUNC(cmd_md)
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
channel = find_channel(p, NULL);
|
||||
channel = find_channel(p);
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
@@ -276,10 +276,10 @@ void _broadcast_md_channel_cmd(Client *except, Client *sender, Channel *channel,
|
||||
{
|
||||
if (value)
|
||||
sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s :%s",
|
||||
sender->id, "channel", channel->chname, varname, value);
|
||||
sender->id, "channel", channel->name, varname, value);
|
||||
else
|
||||
sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s",
|
||||
sender->id, "channel", channel->chname, varname);
|
||||
sender->id, "channel", channel->name, varname);
|
||||
}
|
||||
|
||||
void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *channel, Client *client, char *varname, char *value)
|
||||
@@ -287,12 +287,12 @@ void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *channel,
|
||||
if (value)
|
||||
{
|
||||
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s :%s",
|
||||
sender->id, "member", channel->chname, client->id, varname, value);
|
||||
sender->id, "member", channel->name, client->id, varname, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s",
|
||||
sender->id, "member", channel->chname, client->id, varname);
|
||||
sender->id, "member", channel->name, client->id, varname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,12 +301,12 @@ void _broadcast_md_membership_cmd(Client *except, Client *sender, Client *client
|
||||
if (value)
|
||||
{
|
||||
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s :%s",
|
||||
sender->id, "membership", client->id, channel->chname, varname, value);
|
||||
sender->id, "membership", client->id, channel->name, varname, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s",
|
||||
sender->id, "membership", client->id, channel->chname, varname);
|
||||
sender->id, "membership", client->id, channel->name, varname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ void _send_moddata_channel(Client *srv, Channel *channel)
|
||||
char *value = mdi->serialize(&moddata_channel(channel, mdi));
|
||||
if (value)
|
||||
sendto_one(srv, NULL, ":%s MD %s %s %s :%s",
|
||||
me.id, "channel", channel->chname, mdi->name, value);
|
||||
me.id, "channel", channel->name, mdi->name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,7 +421,7 @@ void _send_moddata_members(Client *srv)
|
||||
char *value = mdi->serialize(&moddata_member(m, mdi));
|
||||
if (value)
|
||||
sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s",
|
||||
me.id, "member", channel->chname, client->id, mdi->name, value);
|
||||
me.id, "member", channel->name, client->id, mdi->name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,7 +445,7 @@ void _send_moddata_members(Client *srv)
|
||||
char *value = mdi->serialize(&moddata_membership(m, mdi));
|
||||
if (value)
|
||||
sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s",
|
||||
me.id, "membership", client->id, m->channel->chname, mdi->name, value);
|
||||
me.id, "membership", client->id, m->channel->name, mdi->name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -104,7 +104,7 @@ CMD_FUNC(cmd_mdex)
|
||||
} else
|
||||
if (!strcmp(type, "channel"))
|
||||
{
|
||||
Channel *channel = find_channel(objname, NULL);
|
||||
Channel *channel = find_channel(objname);
|
||||
md = findmoddata_byname(varname, MODDATATYPE_CHANNEL);
|
||||
if (!md || !md->unserialize || !md->free || !channel)
|
||||
return 0;
|
||||
@@ -130,7 +130,7 @@ CMD_FUNC(cmd_mdex)
|
||||
return 0;
|
||||
*p++ = '\0';
|
||||
|
||||
channel = find_channel(objname, NULL);
|
||||
channel = find_channel(objname);
|
||||
if (!channel)
|
||||
return 0;
|
||||
|
||||
@@ -172,7 +172,7 @@ CMD_FUNC(cmd_mdex)
|
||||
if (!target)
|
||||
return 0;
|
||||
|
||||
channel = find_channel(p, NULL);
|
||||
channel = find_channel(p);
|
||||
if (!channel)
|
||||
return 0;
|
||||
|
||||
@@ -212,7 +212,7 @@ CMD_FUNC(cmd_mdex)
|
||||
} else
|
||||
if (!strcmp(type, "channel"))
|
||||
{
|
||||
Channel *channel = find_channel(objname, NULL);
|
||||
Channel *channel = find_channel(objname);
|
||||
char *str;
|
||||
|
||||
md = findmoddata_byname(varname, MODDATATYPE_CHANNEL);
|
||||
@@ -237,7 +237,7 @@ CMD_FUNC(cmd_mdex)
|
||||
return 0;
|
||||
*p++ = '\0';
|
||||
|
||||
channel = find_channel(objname, NULL);
|
||||
channel = find_channel(objname);
|
||||
if (!channel)
|
||||
return 0;
|
||||
|
||||
@@ -276,7 +276,7 @@ CMD_FUNC(cmd_mdex)
|
||||
if (!target)
|
||||
return 0;
|
||||
|
||||
channel = find_channel(p, NULL);
|
||||
channel = find_channel(p);
|
||||
if (!channel)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -244,14 +244,14 @@ int can_send_to_prefix(Client *client, Channel *channel, int prefix)
|
||||
*/
|
||||
if (!lp || !(lp->flags & (CHFL_VOICE|CHFL_HALFOP|CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN)))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(prefix & PREFIX_OP) && ((prefix & PREFIX_OWNER) || (prefix & PREFIX_ADMIN)) &&
|
||||
!(lp->flags & (CHFL_CHANOP|CHFL_CHANOWNER|CHFL_CHANADMIN)))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
|
||||
prefix = 0;
|
||||
|
||||
/* Message to channel */
|
||||
if (p2 && (channel = find_channel(p2, NULL)))
|
||||
if (p2 && (channel = find_channel(p2)))
|
||||
{
|
||||
prefix = prefix_string_to_values(targetstr, p2);
|
||||
if (prefix)
|
||||
@@ -345,15 +345,15 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
|
||||
* Eg: @&~#chan becomes @#chan
|
||||
*/
|
||||
pfixchan[0] = prefix_values_to_char(prefix);
|
||||
strlcpy(pfixchan+1, channel->chname, sizeof(pfixchan)-1);
|
||||
strlcpy(pfixchan+1, channel->name, sizeof(pfixchan)-1);
|
||||
targetstr = pfixchan;
|
||||
} else {
|
||||
/* Replace target so the privmsg always goes to the "official" channel name */
|
||||
strlcpy(pfixchan, channel->chname, sizeof(pfixchan));
|
||||
strlcpy(pfixchan, channel->name, sizeof(pfixchan));
|
||||
targetstr = pfixchan;
|
||||
}
|
||||
|
||||
if (IsVirus(client) && strcasecmp(channel->chname, SPAMFILTER_VIRUSCHAN))
|
||||
if (IsVirus(client) && strcasecmp(channel->name, SPAMFILTER_VIRUSCHAN))
|
||||
{
|
||||
sendnotice(client, "You are only allowed to talk in '%s'", SPAMFILTER_VIRUSCHAN);
|
||||
continue;
|
||||
@@ -372,7 +372,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
|
||||
if (IsDead(client))
|
||||
return;
|
||||
if (!IsDead(client) && (sendtype != SEND_TYPE_NOTICE) && errmsg)
|
||||
sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->chname, errmsg, p2);
|
||||
sendnumeric(client, ERR_CANNOTSENDTOCHAN, channel->name, errmsg, p2);
|
||||
continue; /* skip delivery to this target */
|
||||
}
|
||||
}
|
||||
@@ -389,7 +389,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[],
|
||||
{
|
||||
int spamtype = (sendtype == SEND_TYPE_NOTICE ? SPAMF_CHANNOTICE : SPAMF_CHANMSG);
|
||||
|
||||
if (match_spamfilter(client, text, spamtype, cmd, channel->chname, 0, NULL))
|
||||
if (match_spamfilter(client, text, spamtype, cmd, channel->name, 0, NULL))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+39
-39
@@ -105,7 +105,7 @@ CMD_FUNC(cmd_mode)
|
||||
{
|
||||
if (*parv[1] == '#')
|
||||
{
|
||||
channel = find_channel(parv[1], NULL);
|
||||
channel = find_channel(parv[1]);
|
||||
if (!channel)
|
||||
{
|
||||
cmd_umode(client, recv_mtags, parc, parv);
|
||||
@@ -134,8 +134,8 @@ CMD_FUNC(cmd_mode)
|
||||
|
||||
modebuf[1] = '\0';
|
||||
channel_modes(client, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), channel, 0);
|
||||
sendnumeric(client, RPL_CHANNELMODEIS, channel->chname, modebuf, parabuf);
|
||||
sendnumeric(client, RPL_CREATIONTIME, channel->chname, channel->creationtime);
|
||||
sendnumeric(client, RPL_CHANNELMODEIS, channel->name, modebuf, parabuf);
|
||||
sendnumeric(client, RPL_CREATIONTIME, channel->name, channel->creationtime);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -154,8 +154,8 @@ CMD_FUNC(cmd_mode)
|
||||
return;
|
||||
/* send ban list */
|
||||
for (ban = channel->banlist; ban; ban = ban->next)
|
||||
sendnumeric(client, RPL_BANLIST, channel->chname, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(client, RPL_ENDOFBANLIST, channel->chname);
|
||||
sendnumeric(client, RPL_BANLIST, channel->name, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(client, RPL_ENDOFBANLIST, channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ CMD_FUNC(cmd_mode)
|
||||
return;
|
||||
/* send exban list */
|
||||
for (ban = channel->exlist; ban; ban = ban->next)
|
||||
sendnumeric(client, RPL_EXLIST, channel->chname, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(client, RPL_ENDOFEXLIST, channel->chname);
|
||||
sendnumeric(client, RPL_EXLIST, channel->name, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(client, RPL_ENDOFEXLIST, channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,8 +175,8 @@ CMD_FUNC(cmd_mode)
|
||||
if (!IsMember(client, channel) && !ValidatePermissionsForPath("channel:see:mode:remoteinvexlist",client,NULL,channel,NULL))
|
||||
return;
|
||||
for (ban = channel->invexlist; ban; ban = ban->next)
|
||||
sendnumeric(client, RPL_INVEXLIST, channel->chname, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(client, RPL_ENDOFINVEXLIST, channel->chname);
|
||||
sendnumeric(client, RPL_INVEXLIST, channel->name, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(client, RPL_ENDOFINVEXLIST, channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,9 +190,9 @@ CMD_FUNC(cmd_mode)
|
||||
for (member = channel->members; member; member = member->next)
|
||||
{
|
||||
if (is_chanowner(member->client, channel))
|
||||
sendnumeric(client, RPL_QLIST, channel->chname, member->client->name);
|
||||
sendnumeric(client, RPL_QLIST, channel->name, member->client->name);
|
||||
}
|
||||
sendnumeric(client, RPL_ENDOFQLIST, channel->chname);
|
||||
sendnumeric(client, RPL_ENDOFQLIST, channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -206,9 +206,9 @@ CMD_FUNC(cmd_mode)
|
||||
for (member = channel->members; member; member = member->next)
|
||||
{
|
||||
if (is_chanadmin(member->client, channel))
|
||||
sendnumeric(client, RPL_ALIST, channel->chname, member->client->name);
|
||||
sendnumeric(client, RPL_ALIST, channel->name, member->client->name);
|
||||
}
|
||||
sendnumeric(client, RPL_ENDOFALIST, channel->chname);
|
||||
sendnumeric(client, RPL_ENDOFALIST, channel->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -239,11 +239,11 @@ CMD_FUNC(cmd_mode)
|
||||
{
|
||||
if (MyUser(client))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
return;
|
||||
}
|
||||
sendto_one(client, NULL, ":%s MODE %s -oh %s %s 0",
|
||||
me.name, channel->chname, client->name, client->name);
|
||||
me.name, channel->name, client->name, client->name);
|
||||
/* Tell the other server that the user is
|
||||
* de-opped. Fix op desyncs. */
|
||||
bounce_mode(channel, client, parc - 2, parv + 2);
|
||||
@@ -259,7 +259,7 @@ CMD_FUNC(cmd_mode)
|
||||
/* !!! */
|
||||
sendto_snomask(SNO_EYES,
|
||||
"*** TS bounce for %s - %lld(ours) %lld(theirs)",
|
||||
channel->chname, (long long)channel->creationtime,
|
||||
channel->name, (long long)channel->creationtime,
|
||||
(long long)sendts);
|
||||
bounce_mode(channel, client, parc - 2, parv + 2);
|
||||
}
|
||||
@@ -317,7 +317,7 @@ static void mode_cutoff2(Client *client, Channel *channel, int *parc_out, char *
|
||||
/* Calculate length of MODE if it would go through fully as-is */
|
||||
/* :nick!user@host MODE #channel +something param1 param2 etc... */
|
||||
len = strlen(client->name) + strlen(client->user->username) + strlen(GetHost(client)) +
|
||||
strlen(channel->chname) + 11;
|
||||
strlen(channel->name) + 11;
|
||||
|
||||
len += strlen(parv[2]);
|
||||
|
||||
@@ -376,9 +376,9 @@ static void bounce_mode(Channel *channel, Client *client, int parc, char *parv[]
|
||||
|
||||
if (channel->creationtime)
|
||||
sendto_one(client, NULL, ":%s MODE %s &%s %s %lld", me.id,
|
||||
channel->chname, modebuf, parabuf, (long long)channel->creationtime);
|
||||
channel->name, modebuf, parabuf, (long long)channel->creationtime);
|
||||
else
|
||||
sendto_one(client, NULL, ":%s MODE %s &%s %s", me.id, channel->chname,
|
||||
sendto_one(client, NULL, ":%s MODE %s &%s %s", me.id, channel->name,
|
||||
modebuf, parabuf);
|
||||
|
||||
/* the '&' denotes a bounce so servers won't bounce a bounce */
|
||||
@@ -424,9 +424,9 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
|
||||
{
|
||||
sendto_realops(
|
||||
"Warning! Possible desync: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)",
|
||||
channel->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
|
||||
channel->name, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
|
||||
ircd_log(LOG_ERROR, "Possible desync: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)",
|
||||
channel->chname, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
|
||||
channel->name, modebuf, parabuf, (long long)sendts, client->direction->name, client->name);
|
||||
}
|
||||
/* new chan or our timestamp is wrong */
|
||||
/* now works for double-bounce prevention */
|
||||
@@ -437,7 +437,7 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
|
||||
/* theirs is wrong but we let it pass anyway */
|
||||
sendts = channel->creationtime;
|
||||
sendto_one(client, NULL, ":%s MODE %s + %lld", me.name,
|
||||
channel->chname, (long long)channel->creationtime);
|
||||
channel->name, (long long)channel->creationtime);
|
||||
}
|
||||
}
|
||||
if (sendts == -1 && channel->creationtime)
|
||||
@@ -452,11 +452,11 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
|
||||
if (channel->creationtime)
|
||||
{
|
||||
sendto_server(client, 0, 0, NULL, ":%s MODE %s %s+ %lld",
|
||||
me.id, channel->chname, isbounce ? "&" : "",
|
||||
me.id, channel->name, isbounce ? "&" : "",
|
||||
(long long)channel->creationtime);
|
||||
} else {
|
||||
sendto_server(client, 0, 0, NULL, ":%s MODE %s %s+",
|
||||
me.id, channel->chname, isbounce ? "&" : "");
|
||||
me.id, channel->name, isbounce ? "&" : "");
|
||||
}
|
||||
free_message_tags(mtags);
|
||||
return; /* nothing to send */
|
||||
@@ -472,12 +472,12 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
|
||||
sendto_snomask(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) MODE %s %s %s",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, modebuf, parabuf);
|
||||
channel->name, modebuf, parabuf);
|
||||
|
||||
/* Logging Implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) MODE %s %s %s",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, modebuf, parabuf);
|
||||
channel->name, modebuf, parabuf);
|
||||
}
|
||||
|
||||
sendts = 0;
|
||||
@@ -495,7 +495,7 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
|
||||
{
|
||||
if (!sajoinmode)
|
||||
sendto_umode_global(UMODE_OPER, "%s used SAMODE %s (%s%s%s)",
|
||||
client->name, channel->chname, modebuf, *parabuf ? " " : "", parabuf);
|
||||
client->name, channel->name, modebuf, *parabuf ? " " : "", parabuf);
|
||||
|
||||
client = &me;
|
||||
sendts = 0;
|
||||
@@ -503,13 +503,13 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
|
||||
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s %s %s",
|
||||
client->name, channel->chname, modebuf, parabuf);
|
||||
client->name, channel->name, modebuf, parabuf);
|
||||
|
||||
if (IsServer(client) && sendts != -1)
|
||||
{
|
||||
sendto_server(client, 0, 0, mtags,
|
||||
":%s MODE %s %s%s %s %lld",
|
||||
client->id, channel->chname,
|
||||
client->id, channel->name,
|
||||
isbounce ? "&" : "", modebuf, parabuf,
|
||||
(long long)sendts);
|
||||
} else
|
||||
@@ -518,12 +518,12 @@ void _do_mode(Channel *channel, Client *client, MessageTag *recv_mtags, int parc
|
||||
/* SAMODE is a special case: always send a TS of 0 (omitting TS==desync) */
|
||||
sendto_server(client, 0, 0, mtags,
|
||||
":%s MODE %s %s %s 0",
|
||||
client->id, channel->chname, modebuf, parabuf);
|
||||
client->id, channel->name, modebuf, parabuf);
|
||||
} else
|
||||
{
|
||||
sendto_server(client, 0, 0, mtags,
|
||||
":%s MODE %s %s%s %s",
|
||||
client->id, channel->chname, isbounce ? "&" : "", modebuf, parabuf);
|
||||
client->id, channel->name, isbounce ? "&" : "", modebuf, parabuf);
|
||||
/* tell them it's not a timestamp, in case the last param
|
||||
** is a number. */
|
||||
}
|
||||
@@ -778,7 +778,7 @@ int do_mode_char(Channel *channel, long modetype, char modechar, char *param,
|
||||
case MODE_RGSTR:
|
||||
if (!IsServer(client) && !IsULine(client))
|
||||
{
|
||||
sendnumeric(client, ERR_ONLYSERVERSCANCHANGE, channel->chname);
|
||||
sendnumeric(client, ERR_ONLYSERVERSCANCHANGE, channel->name);
|
||||
break;
|
||||
}
|
||||
goto setmode;
|
||||
@@ -813,7 +813,7 @@ int do_mode_char(Channel *channel, long modetype, char modechar, char *param,
|
||||
{
|
||||
if (MyUser(client) && !op_can_override("channel:override:mode",client,channel,&modetype))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->name);
|
||||
break;
|
||||
}
|
||||
if (!is_half_op(client, channel)) /* htrig will take care of halfop override notices */
|
||||
@@ -828,7 +828,7 @@ int do_mode_char(Channel *channel, long modetype, char modechar, char *param,
|
||||
{
|
||||
if (MyUser(client) && !op_can_override("channel:override:mode",client,channel,&modetype))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOWNPRIVNEEDED, channel->name);
|
||||
break;
|
||||
}
|
||||
if (!is_half_op(client, channel)) /* htrig will take care of halfop override notices */
|
||||
@@ -847,7 +847,7 @@ process_listmode:
|
||||
break;
|
||||
if (!(membership = find_membership_link(target->user->channel, channel)))
|
||||
{
|
||||
sendnumeric(client, ERR_USERNOTINCHANNEL, target->name, channel->chname);
|
||||
sendnumeric(client, ERR_USERNOTINCHANNEL, target->name, channel->name);
|
||||
break;
|
||||
}
|
||||
member = find_member_link(channel->members, target);
|
||||
@@ -1458,7 +1458,7 @@ void _set_mode(Channel *channel, Client *client, int parc, char *parv[], u_int *
|
||||
{
|
||||
if (!sent_mlock_warning)
|
||||
{
|
||||
sendnumeric(client, ERR_MLOCKRESTRICTED, channel->chname, *curchr, channel->mode_lock);
|
||||
sendnumeric(client, ERR_MLOCKRESTRICTED, channel->name, *curchr, channel->mode_lock);
|
||||
sent_mlock_warning++;
|
||||
}
|
||||
continue;
|
||||
@@ -1566,13 +1566,13 @@ void _set_mode(Channel *channel, Client *client, int parc, char *parv[], u_int *
|
||||
{
|
||||
sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) MODE %s %s %s",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, modebuf, parabuf);
|
||||
channel->name, modebuf, parabuf);
|
||||
}
|
||||
|
||||
/* Logging Implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE,"OVERRIDE: %s (%s@%s) MODE %s %s %s",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, modebuf, parabuf);
|
||||
channel->name, modebuf, parabuf);
|
||||
|
||||
htrig = 0;
|
||||
opermode = 0; /* stop double override notices... but is this ok??? -- Syzop */
|
||||
@@ -1932,7 +1932,7 @@ CMD_FUNC(cmd_mlock)
|
||||
t = (time_t) atol(parv[1]);
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
channel = find_channel(parv[2], NULL);
|
||||
channel = find_channel(parv[2]);
|
||||
if (!channel)
|
||||
return;
|
||||
|
||||
|
||||
+2
-2
@@ -97,7 +97,7 @@ CMD_FUNC(cmd_names)
|
||||
}
|
||||
}
|
||||
|
||||
channel = find_channel(para, NULL);
|
||||
channel = find_channel(para);
|
||||
|
||||
if (!channel || (!ShowChannel(client, channel) && !ValidatePermissionsForPath("channel:see:names:secret",client,NULL,channel,NULL)))
|
||||
{
|
||||
@@ -117,7 +117,7 @@ CMD_FUNC(cmd_names)
|
||||
|
||||
idx = 1;
|
||||
buf[idx++] = ' ';
|
||||
for (s = channel->chname; *s; s++)
|
||||
for (s = channel->name; *s; s++)
|
||||
buf[idx++] = *s;
|
||||
buf[idx++] = ' ';
|
||||
buf[idx++] = ':';
|
||||
|
||||
+36
-43
@@ -413,12 +413,12 @@ CMD_FUNC(cmd_nick_local)
|
||||
if (!is_skochanop(client, mp->channel) && is_banned(client, mp->channel, BANCHK_NICK, NULL, NULL))
|
||||
{
|
||||
sendnumeric(client, ERR_BANNICKCHANGE,
|
||||
mp->channel->chname);
|
||||
mp->channel->name);
|
||||
return;
|
||||
}
|
||||
if (CHECK_TARGET_NICK_BANS && !is_skochanop(client, mp->channel) && is_banned_with_nick(client, mp->channel, BANCHK_NICK, nick, NULL, NULL))
|
||||
{
|
||||
sendnumeric(client, ERR_BANNICKCHANGE, mp->channel->chname);
|
||||
sendnumeric(client, ERR_BANNICKCHANGE, mp->channel->name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ CMD_FUNC(cmd_nick_local)
|
||||
if (i == HOOK_DENY)
|
||||
{
|
||||
sendnumeric(client, ERR_NONICKCHANGE,
|
||||
mp->channel->chname);
|
||||
mp->channel->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -734,7 +734,6 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
userbad[USERLEN * 2 + 1], *ubad = userbad, noident = 0;
|
||||
int i, xx;
|
||||
Hook *h;
|
||||
User *user = client->user;
|
||||
char *tkllayer[9] = {
|
||||
me.name, /*0 server.name */
|
||||
"+", /*1 +|- */
|
||||
@@ -773,18 +772,18 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
/* if host contained invalid ASCII _OR_ the DNS reply is an IP-like reply
|
||||
* (like: 1.2.3.4 or ::ffff:1.2.3.4), then reject it and use IP instead.
|
||||
*/
|
||||
if (*tmpstr || !*user->realhost || (isdigit(*client->local->sockhost) && (client->local->sockhost > tmpstr && isdigit(*(tmpstr - 1))) )
|
||||
if (*tmpstr || !*client->user->realhost || (isdigit(*client->local->sockhost) && (client->local->sockhost > tmpstr && isdigit(*(tmpstr - 1))) )
|
||||
|| (client->local->sockhost[0] == ':'))
|
||||
strlcpy(client->local->sockhost, client->ip, sizeof(client->local->sockhost));
|
||||
}
|
||||
if (client->local->sockhost[0])
|
||||
{
|
||||
strlcpy(user->realhost, client->local->sockhost, sizeof(client->local->sockhost)); /* SET HOSTNAME */
|
||||
strlcpy(client->user->realhost, client->local->sockhost, sizeof(client->local->sockhost)); /* SET HOSTNAME */
|
||||
} else {
|
||||
sendto_realops("[HOSTNAME BUG] client->local->sockhost is empty for user %s (%s, %s)",
|
||||
client->name, client->ip ? client->ip : "<null>", user->realhost);
|
||||
client->name, client->ip ? client->ip : "<null>", client->user->realhost);
|
||||
ircd_log(LOG_ERROR, "[HOSTNAME BUG] client->local->sockhost is empty for user %s (%s, %s)",
|
||||
client->name, client->ip ? client->ip : "<null>", user->realhost);
|
||||
client->name, client->ip ? client->ip : "<null>", client->user->realhost);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -801,21 +800,21 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
* Moved the noident stuff here. -OnyxDragon
|
||||
*/
|
||||
|
||||
/* because username may point to user->username */
|
||||
/* because username may point to client->user->username */
|
||||
strlcpy(temp, username, USERLEN + 1);
|
||||
|
||||
if (!IsUseIdent(client))
|
||||
strlcpy(user->username, temp, USERLEN + 1);
|
||||
strlcpy(client->user->username, temp, USERLEN + 1);
|
||||
else if (IsIdentSuccess(client))
|
||||
strlcpy(user->username, client->ident, USERLEN+1);
|
||||
strlcpy(client->user->username, client->ident, USERLEN+1);
|
||||
else
|
||||
{
|
||||
if (IDENT_CHECK == 0) {
|
||||
strlcpy(user->username, temp, USERLEN+1);
|
||||
strlcpy(client->user->username, temp, USERLEN+1);
|
||||
}
|
||||
else {
|
||||
*user->username = '~';
|
||||
strlcpy((user->username + 1), temp, sizeof(user->username)-1);
|
||||
*client->user->username = '~';
|
||||
strlcpy((client->user->username + 1), temp, sizeof(client->user->username)-1);
|
||||
noident = 1;
|
||||
}
|
||||
|
||||
@@ -836,7 +835,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
* problems so just ban them. (Using the nick could introduce
|
||||
* hostile chars) -- codemastr
|
||||
*/
|
||||
for (u2 = user->username + noident; *u2; u2++)
|
||||
for (u2 = client->user->username + noident; *u2; u2++)
|
||||
{
|
||||
if (isallowed(*u2))
|
||||
*u1++ = *u2;
|
||||
@@ -854,7 +853,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
}
|
||||
*u1 = '\0';
|
||||
*ubad = '\0';
|
||||
if (strlen(stripuser) != strlen(user->username + noident))
|
||||
if (strlen(stripuser) != strlen(client->user->username + noident))
|
||||
{
|
||||
if (stripuser[0] == '\0')
|
||||
{
|
||||
@@ -862,10 +861,10 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
return 0;
|
||||
}
|
||||
|
||||
strlcpy(olduser, user->username + noident, USERLEN+1);
|
||||
strlcpy(user->username + 1, stripuser, sizeof(user->username)-1);
|
||||
user->username[0] = '~';
|
||||
user->username[USERLEN] = '\0';
|
||||
strlcpy(olduser, client->user->username + noident, USERLEN+1);
|
||||
strlcpy(client->user->username + 1, stripuser, sizeof(client->user->username)-1);
|
||||
client->user->username[0] = '~';
|
||||
client->user->username[USERLEN] = '\0';
|
||||
}
|
||||
else
|
||||
u1 = NULL;
|
||||
@@ -929,15 +928,15 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(user->username, username, USERLEN+1);
|
||||
strlcpy(client->user->username, username, USERLEN+1);
|
||||
}
|
||||
SetUser(client);
|
||||
irccounts.clients++;
|
||||
if (client->srvptr && client->srvptr->serv)
|
||||
client->srvptr->serv->users++;
|
||||
|
||||
make_cloakedhost(client, user->realhost, user->cloakedhost, sizeof(user->cloakedhost));
|
||||
safe_strdup(user->virthost, user->cloakedhost);
|
||||
make_cloakedhost(client, client->user->realhost, client->user->cloakedhost, sizeof(client->user->cloakedhost));
|
||||
safe_strdup(client->user->virthost, client->user->cloakedhost);
|
||||
|
||||
if (MyConnect(client))
|
||||
{
|
||||
@@ -958,18 +957,12 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
RunHook(HOOKTYPE_SECURE_CONNECT, client);
|
||||
}
|
||||
|
||||
if (IsHidden(client))
|
||||
{
|
||||
ircd_log(LOG_CLIENT, "Connect - %s!%s@%s [%s] [vhost: %s] %s",
|
||||
nick, user->username, user->realhost, GetIP(client), user->virthost, get_connect_extinfo(client));
|
||||
} else
|
||||
{
|
||||
ircd_log(LOG_CLIENT, "Connect - %s!%s@%s [%s] %s",
|
||||
nick, user->username, user->realhost, GetIP(client), get_connect_extinfo(client));
|
||||
}
|
||||
unreal_log(ULOG_INFO, "connect", "LOCAL_CLIENT_CONNECT", client,
|
||||
"Client connecting: $client ($client.username@$client.hostname) [$client.ip] $extended_client_info",
|
||||
log_data_string("extended_client_info", get_connect_extinfo(client)));
|
||||
|
||||
RunHook2(HOOKTYPE_WELCOME, client, 0);
|
||||
sendnumeric(client, RPL_WELCOME, ircnetwork, nick, user->username, user->realhost);
|
||||
sendnumeric(client, RPL_WELCOME, ircnetwork, nick, client->user->username, client->user->realhost);
|
||||
|
||||
RunHook2(HOOKTYPE_WELCOME, client, 1);
|
||||
sendnumeric(client, RPL_YOURHOST, me.name, version);
|
||||
@@ -988,7 +981,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
|
||||
if (IsHidden(client))
|
||||
{
|
||||
sendnumeric(client, RPL_HOSTHIDDEN, user->virthost);
|
||||
sendnumeric(client, RPL_HOSTHIDDEN, client->user->virthost);
|
||||
RunHook2(HOOKTYPE_WELCOME, client, 396);
|
||||
}
|
||||
|
||||
@@ -1035,12 +1028,12 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
|
||||
/* Remote client */
|
||||
/* The following two cases probably cannot happen anymore? at all? */
|
||||
if (!(acptr = find_server_quick(user->server)))
|
||||
if (!(acptr = find_server_quick(client->user->server)))
|
||||
{
|
||||
sendto_ops("Bad USER [%s] :%s USER %s %s : No such server",
|
||||
client->name, nick, user->username, user->server);
|
||||
client->name, nick, client->user->username, client->user->server);
|
||||
sendto_one(client, NULL, ":%s KILL %s :No such server: %s",
|
||||
me.id, client->id, user->server);
|
||||
me.id, client->id, client->user->server);
|
||||
SetKilled(client);
|
||||
exit_client(client, NULL, "USER without prefix(2.8) or wrong prefix");
|
||||
return 0;
|
||||
@@ -1048,7 +1041,7 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
else if (acptr->direction != client->direction)
|
||||
{
|
||||
sendto_ops("Bad User [%s] :%s USER %s %s, != %s[%s]",
|
||||
client->name, nick, user->username, user->server,
|
||||
client->name, nick, client->user->username, client->user->server,
|
||||
acptr->name, acptr->direction->name);
|
||||
sendto_one(client, NULL, ":%s KILL %s :Wrong user-server-direction",
|
||||
me.id, client->id);
|
||||
@@ -1088,8 +1081,8 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
/* For remote clients we recalculate the cloakedhost here because
|
||||
* it may depend on the IP address (bug #5064).
|
||||
*/
|
||||
make_cloakedhost(client, user->realhost, user->cloakedhost, sizeof(user->cloakedhost));
|
||||
safe_strdup(user->virthost, user->cloakedhost);
|
||||
make_cloakedhost(client, client->user->realhost, client->user->cloakedhost, sizeof(client->user->cloakedhost));
|
||||
safe_strdup(client->user->virthost, client->user->cloakedhost);
|
||||
|
||||
/* Set the umodes */
|
||||
tkllayer[0] = nick;
|
||||
@@ -1112,12 +1105,12 @@ int _register_user(Client *client, char *nick, char *username, char *umode, char
|
||||
if (MyConnect(client))
|
||||
{
|
||||
broadcast_moddata_client(client);
|
||||
sendto_connectnotice(client, 0, NULL); /* moved down, for modules. */
|
||||
RunHook(HOOKTYPE_LOCAL_CONNECT, client);
|
||||
if (buf[0] != '\0' && buf[1] != '\0')
|
||||
sendto_one(client, NULL, ":%s MODE %s :%s", client->name,
|
||||
client->name, buf);
|
||||
if (user->snomask)
|
||||
sendnumeric(client, RPL_SNOMASK, get_snomask_string_raw(user->snomask));
|
||||
if (client->user->snomask)
|
||||
sendnumeric(client, RPL_SNOMASK, get_snomask_string_raw(client->user->snomask));
|
||||
|
||||
if (!IsSecure(client) && !IsLocalhost(client) && (iConf.plaintext_policy_user == POLICY_WARN))
|
||||
sendnotice_multiline(client, iConf.plaintext_policy_user_message);
|
||||
|
||||
+58
-58
@@ -82,7 +82,7 @@ void set_oper_host(Client *client, char *host)
|
||||
CMD_FUNC(cmd_oper)
|
||||
{
|
||||
ConfigItem_oper *operblock;
|
||||
char *name, *password;
|
||||
char *operblock_name, *password;
|
||||
long old_umodes = client->umodes & ALL_UMODES;
|
||||
|
||||
if (!MyUser(client))
|
||||
@@ -108,18 +108,18 @@ CMD_FUNC(cmd_oper)
|
||||
return;
|
||||
}
|
||||
|
||||
name = parv[1];
|
||||
operblock_name = parv[1];
|
||||
password = (parc > 2) ? parv[2] : "";
|
||||
|
||||
/* set::plaintext-policy::oper 'deny' */
|
||||
if (!IsSecure(client) && !IsLocalhost(client) && (iConf.plaintext_policy_oper == POLICY_DENY))
|
||||
{
|
||||
sendnotice_multiline(client, iConf.plaintext_policy_oper_message);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [not using SSL/TLS]",
|
||||
client->name, client->user->username, client->local->sockhost);
|
||||
ircd_log(LOG_OPER, "OPER NO-SSL/TLS (%s) by (%s!%s@%s)", name, client->name,
|
||||
client->user->username, client->local->sockhost);
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "Not using TLS"),
|
||||
log_data_string("fail_type", "NO_TLS"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
client->local->since += 7;
|
||||
return;
|
||||
}
|
||||
@@ -128,35 +128,39 @@ CMD_FUNC(cmd_oper)
|
||||
if (IsSecure(client) && (iConf.outdated_tls_policy_oper == POLICY_DENY) && outdated_tls_client(client))
|
||||
{
|
||||
sendnotice(client, "%s", outdated_tls_client_build_string(iConf.outdated_tls_policy_oper_message, client));
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [outdated SSL/TLS protocol or cipher]",
|
||||
client->name, client->user->username, client->local->sockhost);
|
||||
ircd_log(LOG_OPER, "OPER OUTDATED-SSL/TLS (%s) by (%s!%s@%s)", name, client->name,
|
||||
client->user->username, client->local->sockhost);
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "Outdated TLS protocol or cipher"),
|
||||
log_data_string("fail_type", "OUTDATED_TLS_PROTOCOL_OR_CIPHER"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
client->local->since += 7;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(operblock = find_oper(name)))
|
||||
if (!(operblock = find_oper(operblock_name)))
|
||||
{
|
||||
sendnumeric(client, ERR_NOOPERHOST);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [unknown oper]",
|
||||
client->name, client->user->username, client->local->sockhost);
|
||||
ircd_log(LOG_OPER, "OPER UNKNOWNOPER (%s) by (%s!%s@%s)", name, client->name,
|
||||
client->user->username, client->local->sockhost);
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "Unknown oper operblock_name"),
|
||||
log_data_string("fail_type", "UNKNOWN_OPER_NAME"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
client->local->since += 7;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Below here, the oper block exists, any errors here we take (even)
|
||||
* more seriously, they are logged as errors instead of warnings.
|
||||
*/
|
||||
|
||||
if (!unreal_mask_match(client, operblock->mask))
|
||||
{
|
||||
sendnumeric(client, ERR_NOOPERHOST);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [host doesnt match]",
|
||||
client->name, client->user->username, client->local->sockhost, name);
|
||||
ircd_log(LOG_OPER, "OPER NOHOSTMATCH (%s) by (%s!%s@%s)", name, client->name,
|
||||
client->user->username, client->local->sockhost);
|
||||
unreal_log(ULOG_ERROR, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "Host does not match"),
|
||||
log_data_string("fail_type", "NO_HOST_MATCH"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
client->local->since += 7;
|
||||
return;
|
||||
}
|
||||
@@ -167,11 +171,11 @@ CMD_FUNC(cmd_oper)
|
||||
if (FAILOPER_WARN)
|
||||
sendnotice(client,
|
||||
"*** Your attempt has been logged.");
|
||||
ircd_log(LOG_OPER, "OPER FAILEDAUTH (%s) by (%s!%s@%s)", name, client->name,
|
||||
client->user->username, client->local->sockhost);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [FAILEDAUTH]",
|
||||
client->name, client->user->username, client->local->sockhost, name);
|
||||
unreal_log(ULOG_ERROR, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "Authentication failed"),
|
||||
log_data_string("fail_type", "AUTHENTICATION_FAILED"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
client->local->since += 7;
|
||||
return;
|
||||
}
|
||||
@@ -185,12 +189,11 @@ CMD_FUNC(cmd_oper)
|
||||
if (operblock->require_modes & ~client->umodes)
|
||||
{
|
||||
sendnumericfmt(client, ERR_NOOPERHOST, ":You are missing user modes required to OPER");
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [lacking modes '%s' in oper::require-modes]",
|
||||
client->name, client->user->username, client->local->sockhost, get_usermode_string_raw(operblock->require_modes & ~client->umodes));
|
||||
ircd_log(LOG_OPER, "OPER MISSINGMODES (%s) by (%s!%s@%s), needs modes=%s",
|
||||
name, client->name, client->user->username, client->local->sockhost,
|
||||
get_usermode_string_raw(operblock->require_modes & ~client->umodes));
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "Not matching oper::require-modes"),
|
||||
log_data_string("fail_type", "REQUIRE_MODES_NOT_SATISFIED"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
client->local->since += 7;
|
||||
return;
|
||||
}
|
||||
@@ -198,12 +201,11 @@ CMD_FUNC(cmd_oper)
|
||||
if (!find_operclass(operblock->operclass))
|
||||
{
|
||||
sendnotice(client, "ERROR: There is a non-existant oper::operclass specified for your oper block");
|
||||
ircd_log(LOG_ERROR, "OPER MISSINGOPERCLASS (%s) by (%s!%s@%s), oper::operclass does not exist: %s",
|
||||
name, client->name, client->user->username, client->local->sockhost,
|
||||
operblock->operclass);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [oper::operclass does not exist: '%s']",
|
||||
client->name, client->user->username, client->local->sockhost, operblock->operclass);
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "Config error: invalid oper::operclass"),
|
||||
log_data_string("fail_type", "OPER_OPERCLASS_INVALID"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,11 +214,11 @@ CMD_FUNC(cmd_oper)
|
||||
sendnumeric(client, ERR_NOOPERHOST);
|
||||
sendnotice(client, "Your maximum number of concurrent oper logins has been reached (%d)",
|
||||
operblock->maxlogins);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [maxlogins reached]",
|
||||
client->name, client->user->username, client->local->sockhost, name);
|
||||
ircd_log(LOG_OPER, "OPER TOOMANYLOGINS (%s) by (%s!%s@%s)", name, client->name,
|
||||
client->user->username, client->local->sockhost);
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_FAILED", client,
|
||||
"Failed OPER attempt by $client.nuh [reason: $reason] [oper-block: $oper_block]",
|
||||
log_data_string("reason", "oper::maxlogins limit reached"),
|
||||
log_data_string("fail_type", "OPER_MAXLOGINS_LIMIT"),
|
||||
log_data_string("oper_block", parv[1]));
|
||||
client->local->since += 4;
|
||||
return;
|
||||
}
|
||||
@@ -258,13 +260,9 @@ CMD_FUNC(cmd_oper)
|
||||
safe_strdup(client->user->virthost, client->user->cloakedhost);
|
||||
}
|
||||
|
||||
sendto_snomask_global(SNO_OPER,
|
||||
"%s (%s@%s) [%s] is now an operator",
|
||||
client->name, client->user->username, client->local->sockhost,
|
||||
parv[1]);
|
||||
|
||||
ircd_log(LOG_OPER, "OPER (%s) by (%s!%s@%s)", name, client->name, client->user->username,
|
||||
client->local->sockhost);
|
||||
unreal_log(ULOG_INFO, "oper", "OPER_SUCCESS", client,
|
||||
"$client.nuh is now an IRC Operator [oper-block: $oper_block]",
|
||||
log_data_string("oper_block", parv[1]));
|
||||
|
||||
/* set oper snomasks */
|
||||
if (operblock->snomask)
|
||||
@@ -316,17 +314,19 @@ CMD_FUNC(cmd_oper)
|
||||
if (!IsSecure(client) && !IsLocalhost(client) && (iConf.plaintext_policy_oper == POLICY_WARN))
|
||||
{
|
||||
sendnotice_multiline(client, iConf.plaintext_policy_oper_message);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "OPER %s [%s] used an insecure (non-SSL/TLS) connection to /OPER.",
|
||||
client->name, name);
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_UNSAFE", client,
|
||||
"Insecure (non-TLS) connection used to OPER up by $client.nuh [oper-block: $oper_block]",
|
||||
log_data_string("oper_block", parv[1]),
|
||||
log_data_string("warn_type", "NO_TLS"));
|
||||
}
|
||||
|
||||
/* set::outdated-tls-policy::oper 'warn' */
|
||||
if (IsSecure(client) && (iConf.outdated_tls_policy_oper == POLICY_WARN) && outdated_tls_client(client))
|
||||
{
|
||||
sendnotice(client, "%s", outdated_tls_client_build_string(iConf.outdated_tls_policy_oper_message, client));
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "OPER %s [%s] used a connection with an outdated SSL/TLS protocol or cipher to /OPER.",
|
||||
client->name, name);
|
||||
unreal_log(ULOG_WARNING, "oper", "OPER_UNSAFE", client,
|
||||
"Outdated TLS protocol/cipher used to OPER up by $client.nuh [oper-block: $oper_block]",
|
||||
log_data_string("oper_block", parv[1]),
|
||||
log_data_string("warn_type", "OUTDATED_TLS_PROTOCOL_OR_CIPHER"));
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -106,7 +106,7 @@ CMD_FUNC(cmd_part)
|
||||
break;
|
||||
}
|
||||
|
||||
channel = get_channel(client, name, 0);
|
||||
channel = find_channel(name);
|
||||
if (!channel)
|
||||
{
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
|
||||
@@ -155,11 +155,11 @@ CMD_FUNC(cmd_part)
|
||||
}
|
||||
|
||||
/* Create a new message, this one is actually used by 8 calls (though at most 4 max) */
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s PART %s", client->name, channel->chname);
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s PART %s", client->name, channel->name);
|
||||
|
||||
/* Send to other servers... */
|
||||
sendto_server(client, 0, 0, mtags, ":%s PART %s :%s",
|
||||
client->id, channel->chname, comment ? comment : "");
|
||||
client->id, channel->name, comment ? comment : "");
|
||||
|
||||
if (invisible_user_in_channel(client, channel))
|
||||
{
|
||||
@@ -170,11 +170,11 @@ CMD_FUNC(cmd_part)
|
||||
PREFIX_HALFOP|PREFIX_OP|PREFIX_OWNER|PREFIX_ADMIN, 0,
|
||||
SEND_LOCAL, mtags,
|
||||
":%s PART %s",
|
||||
client->name, channel->chname);
|
||||
client->name, channel->name);
|
||||
if (MyUser(client))
|
||||
{
|
||||
sendto_one(client, mtags, ":%s!%s@%s PART %s",
|
||||
client->name, client->user->username, GetHost(client), channel->chname);
|
||||
client->name, client->user->username, GetHost(client), channel->name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -183,13 +183,13 @@ CMD_FUNC(cmd_part)
|
||||
PREFIX_HALFOP|PREFIX_OP|PREFIX_OWNER|PREFIX_ADMIN, 0,
|
||||
SEND_LOCAL, mtags,
|
||||
":%s PART %s %s",
|
||||
client->name, channel->chname, comment);
|
||||
client->name, channel->name, comment);
|
||||
if (MyUser(client))
|
||||
{
|
||||
sendto_one(client, mtags,
|
||||
":%s!%s@%s PART %s %s",
|
||||
client->name, client->user->username, GetHost(client),
|
||||
channel->chname, comment);
|
||||
channel->name, comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,11 +200,11 @@ CMD_FUNC(cmd_part)
|
||||
{
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s PART %s",
|
||||
client->name, channel->chname);
|
||||
client->name, channel->name);
|
||||
} else {
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s PART %s :%s",
|
||||
client->name, channel->chname, comment);
|
||||
client->name, channel->name, comment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ CMD_FUNC(cmd_quit)
|
||||
int ret;
|
||||
|
||||
parx[0] = NULL;
|
||||
parx[1] = channel->chname;
|
||||
parx[1] = channel->name;
|
||||
parx[2] = newcomment;
|
||||
parx[3] = NULL;
|
||||
|
||||
|
||||
+48
-27
@@ -81,9 +81,10 @@ ModuleHeader MOD_HEADER
|
||||
|
||||
#define WARN_WRITE_ERROR(fname) \
|
||||
do { \
|
||||
sendto_realops_and_log("[reputation] Error writing to temporary database file " \
|
||||
"'%s': %s (DATABASE NOT SAVED)", \
|
||||
fname, unrealdb_get_error_string()); \
|
||||
unreal_log(ULOG_ERROR, "reputation", "REPUTATION_FILE_WRITE_ERROR", NULL, \
|
||||
"[reputation] Error writing to temporary database file $filename: $system_error", \
|
||||
log_data_string("filename", fname), \
|
||||
log_data_string("system_error", unrealdb_get_error_string())); \
|
||||
} while(0)
|
||||
|
||||
#define W_SAFE(x) \
|
||||
@@ -465,8 +466,9 @@ void reputation_load_db_old(void)
|
||||
|
||||
#ifdef BENCHMARK
|
||||
gettimeofday(&tv_beta, NULL);
|
||||
ircd_log(LOG_ERROR, "Reputation benchmark: LOAD DB: %lld microseconds",
|
||||
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
|
||||
"Reputation benchmark: LOAD DB: $time_msec microseconds",
|
||||
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -529,8 +531,9 @@ int reputation_load_db_new(UnrealDB *db)
|
||||
unrealdb_close(db);
|
||||
#ifdef BENCHMARK
|
||||
gettimeofday(&tv_beta, NULL);
|
||||
ircd_log(LOG_ERROR, "Reputation benchmark: LOAD DB: %lld microseconds",
|
||||
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
|
||||
"Reputation benchmark: LOAD DB: $time_msec microseconds",
|
||||
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -656,8 +659,9 @@ write_fail:
|
||||
|
||||
#ifdef BENCHMARK
|
||||
gettimeofday(&tv_beta, NULL);
|
||||
ircd_log(LOG_ERROR, "Reputation benchmark: SAVE DB: %lld microseconds",
|
||||
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
|
||||
"Reputation benchmark: SAVE DB: $time_msec microseconds",
|
||||
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
@@ -677,7 +681,7 @@ int reputation_save_db(void)
|
||||
#endif
|
||||
|
||||
#ifdef TEST
|
||||
sendto_realops("REPUTATION IS RUNNING IN TEST MODE. SAVING DB'S...");
|
||||
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_TEST", NULL, "Reputation in running in test mode. Saving DB's....");
|
||||
#endif
|
||||
|
||||
/* Comment this out after one or more releases (means you cannot downgrade to <=5.0.9.1 anymore) */
|
||||
@@ -741,8 +745,9 @@ int reputation_save_db(void)
|
||||
|
||||
#ifdef BENCHMARK
|
||||
gettimeofday(&tv_beta, NULL);
|
||||
ircd_log(LOG_ERROR, "Reputation benchmark: SAVE DB: %lld microseconds",
|
||||
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
|
||||
"Reputation benchmark: SAVE DB: $time_msec microseconds",
|
||||
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -924,8 +929,11 @@ EVENT(delete_old_records)
|
||||
if (is_reputation_expired(e))
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "Deleting expired entry for '%s' (score %hd, last seen %lld seconds ago)",
|
||||
e->ip, e->score, (long long)(TStime() - e->last_seen));
|
||||
unreal_log(ULOG_INFO, "reputation", "REPUTATION_EXPIRY", NULL,
|
||||
"Deleting expired entry for $ip (score $score, last seen $time_delta seconds ago)",
|
||||
log_data_string("ip", e->ip),
|
||||
log_data_integer("score", e->score),
|
||||
log_data_integer("time_delta", TStime() - e->last_seen));
|
||||
#endif
|
||||
DelListItem(e, ReputationHashTable[i]);
|
||||
safe_free(e);
|
||||
@@ -935,8 +943,9 @@ EVENT(delete_old_records)
|
||||
|
||||
#ifdef BENCHMARK
|
||||
gettimeofday(&tv_beta, NULL);
|
||||
ircd_log(LOG_ERROR, "Reputation benchmark: EXPIRY IN MEM: %lld microseconds",
|
||||
(long long)(((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
unreal_log(ULOG_DEBUG, "reputation", "REPUTATION_BENCHMARK", NULL,
|
||||
"Reputation benchmark: EXPIRY IN MEM: $time_msec microseconds",
|
||||
log_data_integer("time_msec", ((tv_beta.tv_sec - tv_alpha.tv_sec) * 1000000) + (tv_beta.tv_usec - tv_alpha.tv_usec)));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -989,7 +998,7 @@ void reputation_channel_query(Client *client, Channel *channel)
|
||||
int cnt = 0, i, j;
|
||||
ReputationEntry *e;
|
||||
|
||||
sendtxtnumeric(client, "Users and reputation scores for %s:", channel->chname);
|
||||
sendtxtnumeric(client, "Users and reputation scores for %s:", channel->name);
|
||||
|
||||
/* Step 1: build a list of nicks and their reputation */
|
||||
nicks = safe_alloc((channel->users+1) * sizeof(char *));
|
||||
@@ -1005,8 +1014,11 @@ void reputation_channel_query(Client *client, Channel *channel)
|
||||
}
|
||||
if (++cnt > channel->users)
|
||||
{
|
||||
sendto_ops("[BUG] reputation_channel_query() expected %d users but %d (or more) were present in %s",
|
||||
channel->users, cnt, channel->chname);
|
||||
unreal_log(ULOG_WARNING, "bug", "REPUTATION_CHANNEL_QUERY_BUG", client,
|
||||
"[BUG] reputation_channel_query() expected $expected_users users, but $found_users (or more) users were present in $channel",
|
||||
log_data_integer("expected_users", channel->users),
|
||||
log_data_integer("found_users", cnt),
|
||||
log_data_string("channel", channel->name));
|
||||
#ifdef DEBUGMODE
|
||||
abort();
|
||||
#endif
|
||||
@@ -1121,7 +1133,7 @@ CMD_FUNC(reputation_user_cmd)
|
||||
} else
|
||||
if (parv[1][0] == '#')
|
||||
{
|
||||
Channel *channel = find_channel(parv[1], NULL);
|
||||
Channel *channel = find_channel(parv[1]);
|
||||
if (!channel)
|
||||
{
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]);
|
||||
@@ -1130,7 +1142,7 @@ CMD_FUNC(reputation_user_cmd)
|
||||
/* corner case: ircop without proper permissions and not in channel */
|
||||
if (!ValidatePermissionsForPath("channel:see:names:invisible",client,NULL,NULL,NULL) && !get_access(client,channel))
|
||||
{
|
||||
sendnumeric(client, ERR_NOTONCHANNEL, channel->chname);
|
||||
sendnumeric(client, ERR_NOTONCHANNEL, channel->name);
|
||||
return;
|
||||
}
|
||||
reputation_channel_query(client, channel);
|
||||
@@ -1239,8 +1251,11 @@ CMD_FUNC(reputation_server_cmd)
|
||||
*/
|
||||
sendto_one(client, NULL, ":%s REPUTATION %s *%d", me.id, parv[1], e->score);
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "[reputation] Score for '%s' from %s is %d, but we have %d, sending back %d",
|
||||
ip, client->name, score, e->score, e->score);
|
||||
unreal_log(ULOG_INFO, "reputation", "REPUTATION_DIFFERS", client,
|
||||
"Reputation score for for $ip from $client is $their_score, but we have $score, sending back $score",
|
||||
log_data_string("ip", e->ip),
|
||||
log_data_integer("their_score", score),
|
||||
log_data_integer("score", e->score));
|
||||
#endif
|
||||
score = e->score; /* Update for propagation in the non-client direction */
|
||||
}
|
||||
@@ -1249,8 +1264,11 @@ CMD_FUNC(reputation_server_cmd)
|
||||
if (e && (score > e->score))
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "[reputation] Score for '%s' from %s is %d, but we have %d, updating our score to %d",
|
||||
ip, client->name, score, e->score, score);
|
||||
unreal_log(ULOG_INFO, "reputation", "REPUTATION_DIFFERS", client,
|
||||
"Reputation score for for $ip from $client is $their_score, but we have $score, updating our score to $score",
|
||||
log_data_string("ip", e->ip),
|
||||
log_data_integer("their_score", score),
|
||||
log_data_integer("score", e->score));
|
||||
#endif
|
||||
e->score = score;
|
||||
}
|
||||
@@ -1259,8 +1277,11 @@ CMD_FUNC(reputation_server_cmd)
|
||||
if (!e && (score > 0))
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "[reputation] Score for '%s' from %s is %d, we had no entry, adding it",
|
||||
ip, client->name, score);
|
||||
unreal_log(ULOG_INFO, "reputation", "REPUTATION_NEW", client,
|
||||
"Reputation score for for $ip from $client is $their_score, we had no entry, adding it",
|
||||
log_data_string("ip", e->ip),
|
||||
log_data_integer("their_score", score),
|
||||
log_data_integer("score", e->score));
|
||||
#endif
|
||||
e = safe_alloc(sizeof(ReputationEntry)+strlen(ip));
|
||||
strcpy(e->ip, ip); /* safe, see alloc above */
|
||||
|
||||
+18
-26
@@ -52,6 +52,13 @@ MOD_UNLOAD()
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
static void log_sajoin(Client *client, Client *target, char *channels)
|
||||
{
|
||||
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: $client used SAJOIN to make $target join $channels",
|
||||
log_data_client("target", target),
|
||||
log_data_string("channels", channels));
|
||||
}
|
||||
|
||||
/* cmd_sajoin() - Lamego - Wed Jul 21 20:04:48 1999
|
||||
Copied off PTlink IRCd (C) PTlink coders team.
|
||||
Coded for Sadmin by Stskeeps
|
||||
@@ -89,20 +96,18 @@ CMD_FUNC(cmd_sajoin)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Broadcast so other servers can log it appropriately as an SAJOIN */
|
||||
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s", client->id, target->id, parv[2]);
|
||||
|
||||
/* If it's not for our client, then simply pass on the message... */
|
||||
if (!MyUser(target))
|
||||
{
|
||||
sendto_one(target, NULL, ":%s SAJOIN %s %s", client->id, target->id, parv[2]);
|
||||
|
||||
/* Logging function added by XeRXeS */
|
||||
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %s",
|
||||
client->name, target->name, parv[2]);
|
||||
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: %s used SAJOIN to make %s join %s",
|
||||
log_data_client("target", target),
|
||||
log_data_string("channel", parv[2]));
|
||||
log_sajoin(client, target, parv[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
/* 'target' is our client... */
|
||||
|
||||
/* Can't this just use do_join() or something with a parameter to bypass some checks?
|
||||
* This duplicate code is damn ugly. Ah well..
|
||||
*/
|
||||
@@ -178,7 +183,7 @@ CMD_FUNC(cmd_sajoin)
|
||||
continue;
|
||||
}
|
||||
|
||||
channel = get_channel(target, name, 0);
|
||||
channel = make_channel(name);
|
||||
|
||||
/* If this _specific_ channel is not permitted, skip it */
|
||||
if (!IsULine(client) && !ValidatePermissionsForPath("sacmd:sajoin",client,target,channel,NULL))
|
||||
@@ -225,8 +230,8 @@ CMD_FUNC(cmd_sajoin)
|
||||
new_message(target, NULL, &mtags);
|
||||
sendto_channel(channel, target, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s PART %s :%s",
|
||||
target->name, channel->chname, "Left all channels");
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s PART %s :Left all channels", target->name, channel->chname);
|
||||
target->name, channel->name, "Left all channels");
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s PART %s :Left all channels", target->name, channel->name);
|
||||
if (MyConnect(target))
|
||||
RunHook4(HOOKTYPE_LOCAL_PART, target, channel, mtags, "Left all channels");
|
||||
free_message_tags(mtags);
|
||||
@@ -236,7 +241,7 @@ CMD_FUNC(cmd_sajoin)
|
||||
continue;
|
||||
}
|
||||
flags = (ChannelExists(name)) ? CHFL_DEOPPED : LEVEL_ON_JOIN;
|
||||
channel = get_channel(target, name, CREATE);
|
||||
channel = make_channel(name);
|
||||
if (channel && (lp = find_membership_link(target->user->channel, channel)))
|
||||
continue;
|
||||
|
||||
@@ -281,23 +286,10 @@ CMD_FUNC(cmd_sajoin)
|
||||
if (did_anything)
|
||||
{
|
||||
if (!sjmode)
|
||||
{
|
||||
sendnotice(target, "*** You were forced to join %s", jbuf);
|
||||
sendto_umode_global(UMODE_OPER, "%s used SAJOIN to make %s join %s", client->name, target->name, jbuf);
|
||||
/* Logging function added by XeRXeS */
|
||||
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %s",
|
||||
client->name, target->name, jbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendnotice(target, "*** You were forced to join %s with '%c'", jbuf, sjmode);
|
||||
sendto_umode_global(UMODE_OPER, "%s used SAJOIN to make %s join %c%s", client->name, target->name, sjmode, jbuf);
|
||||
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %c%s",
|
||||
client->name, target->name, sjmode, jbuf);
|
||||
}
|
||||
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: $client used SAJOIN to make $target join $channel",
|
||||
log_data_client("target", target),
|
||||
log_data_string("channel", jbuf));
|
||||
log_sajoin(client, target, jbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ CMD_FUNC(cmd_samode)
|
||||
return;
|
||||
}
|
||||
|
||||
channel = find_channel(parv[1], NULL);
|
||||
channel = find_channel(parv[1]);
|
||||
if (!channel)
|
||||
{
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]);
|
||||
|
||||
+41
-34
@@ -52,6 +52,24 @@ MOD_UNLOAD()
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
static void log_sapart(Client *client, Client *target, char *channels, char *comment)
|
||||
{
|
||||
if (comment)
|
||||
{
|
||||
unreal_log(ULOG_INFO, "sacmds", "SAPART_COMMAND", client, "SAPART: $client used SAPART to make $target join $channels ($reason)",
|
||||
log_data_client("target", target),
|
||||
log_data_string("channels", channels),
|
||||
log_data_string("reason", comment));
|
||||
}
|
||||
else
|
||||
{
|
||||
unreal_log(ULOG_INFO, "sacmds", "SAPART_COMMAND", client, "SAPART: $client used SAPART to make $target join $channels",
|
||||
log_data_client("target", target),
|
||||
log_data_string("channels", channels));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* cmd_sapart() - Lamego - Wed Jul 21 20:04:48 1999
|
||||
Copied off PTlink IRCd (C) PTlink coders team.
|
||||
Coded for Sadmin by Stskeeps
|
||||
@@ -93,25 +111,20 @@ CMD_FUNC(cmd_sapart)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Relay it on, if it's not my target */
|
||||
/* Broadcast so other servers can log it appropriately as an SAPART */
|
||||
if (parv[3])
|
||||
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s :%s", client->id, target->id, parv[2], comment);
|
||||
else
|
||||
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s", client->id, target->id, parv[2]);
|
||||
|
||||
if (!MyUser(target))
|
||||
{
|
||||
if (comment)
|
||||
{
|
||||
sendto_one(target, NULL, ":%s SAPART %s %s :%s", client->id, target->id, parv[2], comment);
|
||||
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s (%s)",
|
||||
client->name, target->name, parv[2], comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_one(target, NULL, ":%s SAPART %s %s", client->id, target->id, parv[2]);
|
||||
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s",
|
||||
client->name, target->name, parv[2]);
|
||||
}
|
||||
log_sapart(client, target, parv[2], comment);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Now works like cmd_join */
|
||||
/* 'target' is our client... */
|
||||
|
||||
*jbuf = 0;
|
||||
for (i = 0, name = strtoken(&p, parv[2], ","); name; name = strtoken(&p, NULL, ","))
|
||||
{
|
||||
@@ -120,10 +133,10 @@ CMD_FUNC(cmd_sapart)
|
||||
sendnumeric(client, ERR_TOOMANYTARGETS, name, maxtargets, "SAPART");
|
||||
break;
|
||||
}
|
||||
if (!(channel = get_channel(target, name, 0)))
|
||||
|
||||
if (!(channel = find_channel(name)))
|
||||
{
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL,
|
||||
name);
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -156,25 +169,19 @@ CMD_FUNC(cmd_sapart)
|
||||
strlcat(commentx, comment, 512);
|
||||
}
|
||||
|
||||
log_sapart(client, target, parv[2], comment);
|
||||
|
||||
if (comment)
|
||||
sendnotice(target, "*** You were forced to part %s (%s)", parv[2], commentx);
|
||||
else
|
||||
sendnotice(target, "*** You were forced to part %s", parv[2]);
|
||||
|
||||
parv[0] = target->name; // nick
|
||||
parv[1] = parv[2]; // chan
|
||||
parv[2] = comment ? commentx : NULL; // comment
|
||||
if (comment)
|
||||
{
|
||||
sendnotice(target, "*** You were forced to part %s (%s)", parv[1], commentx);
|
||||
sendto_umode_global(UMODE_OPER, "%s used SAPART to make %s part %s (%s)",
|
||||
client->name, target->name, parv[1], comment);
|
||||
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s (%s)",
|
||||
client->name, target->name, parv[1], comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendnotice(target, "*** You were forced to part %s", parv[1]);
|
||||
sendto_umode_global(UMODE_OPER, "%s used SAPART to make %s part %s",
|
||||
client->name, target->name, parv[1]);
|
||||
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s",
|
||||
client->name, target->name, parv[1]);
|
||||
}
|
||||
|
||||
/* Now, do the actual parting: */
|
||||
do_cmd(target, NULL, "PART", comment ? 3 : 2, parv);
|
||||
/* target may be killed now due to the part reason @ spamfilter */
|
||||
|
||||
/* NOTE: target may be killed now due to the part reason @ spamfilter */
|
||||
}
|
||||
|
||||
+249
-245
@@ -51,7 +51,8 @@ void _send_server_message(Client *client);
|
||||
void _introduce_user(Client *to, Client *acptr);
|
||||
int _check_deny_version(Client *cptr, char *software, int protocol, char *flags);
|
||||
void _broadcast_sinfo(Client *acptr, Client *to, Client *except);
|
||||
int server_sync(Client *cptr, ConfigItem_link *conf);
|
||||
int server_sync(Client *cptr, ConfigItem_link *conf, int incoming);
|
||||
void tls_link_notification_verify(Client *acptr, ConfigItem_link *aconf);
|
||||
void server_generic_free(ModData *m);
|
||||
int server_post_connect(Client *client);
|
||||
|
||||
@@ -463,8 +464,8 @@ EVENT(server_handshake_timeout)
|
||||
((TStime() - client->local->firsttime) >= cfg.connect_timeout))
|
||||
{
|
||||
/* If this is a connect timeout to an outgoing server then notify ops & log it */
|
||||
sendto_ops_and_log("Connect timeout while trying to link to server '%s' (%s)",
|
||||
client->name, client->ip?client->ip:"<unknown ip>");
|
||||
unreal_log(ULOG_INFO, "link", "LINK_CONNECT_TIMEOUT", client,
|
||||
"Connect timeout while trying to link to server '$client' ($client.ip)");
|
||||
|
||||
exit_client(client, NULL, "Connection timeout");
|
||||
continue;
|
||||
@@ -474,8 +475,8 @@ EVENT(server_handshake_timeout)
|
||||
if ((TStime() - client->local->firsttime) >= cfg.handshake_timeout)
|
||||
{
|
||||
/* If this is a handshake timeout to an outgoing server then notify ops & log it */
|
||||
sendto_ops_and_log("Connection handshake timeout while trying to link to server '%s' (%s)",
|
||||
client->name, client->ip?client->ip:"<unknown ip>");
|
||||
unreal_log(ULOG_INFO, "link", "LINK_HANDSHAKE_TIMEOUT", client,
|
||||
"Connect handshake timeout while trying to link to server '$client' ($client.ip)");
|
||||
|
||||
exit_client(client, NULL, "Handshake Timeout");
|
||||
continue;
|
||||
@@ -880,6 +881,7 @@ CMD_FUNC(cmd_server)
|
||||
ConfigItem_link *aconf = NULL;
|
||||
ConfigItem_deny_link *deny;
|
||||
char *flags = NULL, *protocol = NULL, *inf = NULL, *num = NULL;
|
||||
int incoming;
|
||||
|
||||
if (IsUser(client))
|
||||
{
|
||||
@@ -943,11 +945,10 @@ CMD_FUNC(cmd_server)
|
||||
|
||||
if (strlen(client->id) != 3)
|
||||
{
|
||||
sendto_umode_global(UMODE_OPER, "Server %s is using old unsupported protocol from UnrealIRCd 3.2.x or earlier. "
|
||||
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol",
|
||||
servername);
|
||||
ircd_log(LOG_ERROR, "Server using old unsupported protocol from UnrealIRCd 3.2.x or earlier. "
|
||||
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol");
|
||||
unreal_log(ULOG_ERROR, "link", "LINK_OLD_PROTOCOL", client,
|
||||
"Server link $servername rejected. Server is using an old and unsupported protocol from UnrealIRCd 3.2.x or earlier. "
|
||||
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol",
|
||||
log_data_string("servername", servername));
|
||||
exit_client(client, NULL, "Server using old unsupported protocol from UnrealIRCd 3.2.x or earlier. "
|
||||
"See https://www.unrealircd.org/docs/FAQ#old-server-protocol");
|
||||
return;
|
||||
@@ -956,8 +957,10 @@ CMD_FUNC(cmd_server)
|
||||
hop = atol(parv[2]);
|
||||
if (hop != 1)
|
||||
{
|
||||
sendto_umode_global(UMODE_OPER, "Directly linked server %s provided a hopcount of %d, while 1 was expected",
|
||||
servername, hop);
|
||||
unreal_log(ULOG_ERROR, "link", "LINK_REJECTED_INVALID_HOPCOUNT", client,
|
||||
"Server link $servername rejected. Directly linked server provided a hopcount of $hopcount, while 1 was expected.",
|
||||
log_data_string("servername", servername),
|
||||
log_data_integer("hopcount", hop));
|
||||
exit_client(client, NULL, "Invalid SERVER message, hop count must be 1");
|
||||
return;
|
||||
}
|
||||
@@ -1002,8 +1005,9 @@ CMD_FUNC(cmd_server)
|
||||
if (deny->flag.type == CRULE_ALL && unreal_mask_match_string(servername, deny->mask)
|
||||
&& crule_eval(deny->rule))
|
||||
{
|
||||
sendto_ops_and_log("Refused connection from %s. Rejected by deny link { } block.",
|
||||
get_client_host(client));
|
||||
unreal_log(ULOG_ERROR, "link", "LINK_REJECTED_DENY_LINK_BLOCK", client,
|
||||
"Server link $servername rejected by deny link { } block.",
|
||||
log_data_string("servername", servername));
|
||||
exit_client(client, NULL, "Disallowed by connection rule");
|
||||
return;
|
||||
}
|
||||
@@ -1015,7 +1019,81 @@ CMD_FUNC(cmd_server)
|
||||
ircsnprintf(descbuf, sizeof descbuf, "Server: %s", servername);
|
||||
fd_desc(client->local->fd, descbuf);
|
||||
|
||||
server_sync(client, aconf);
|
||||
incoming = IsUnknown(client) ? 1 : 0;
|
||||
|
||||
if (client->local->passwd)
|
||||
safe_free(client->local->passwd);
|
||||
|
||||
/* Set up server structure */
|
||||
free_pending_net(client);
|
||||
SetServer(client);
|
||||
irccounts.me_servers++;
|
||||
irccounts.servers++;
|
||||
irccounts.unknown--;
|
||||
list_move(&client->client_node, &global_server_list);
|
||||
list_move(&client->lclient_node, &lclient_list);
|
||||
list_add(&client->special_node, &server_list);
|
||||
|
||||
if (find_uline(client->name))
|
||||
{
|
||||
if (client->serv && client->serv->features.software && !strncmp(client->serv->features.software, "UnrealIRCd-", 11))
|
||||
{
|
||||
unreal_log(ULOG_ERROR, "link", "BAD_ULINES", client,
|
||||
"Bad ulines! Server $client matches your ulines { } block, but this server "
|
||||
"is an UnrealIRCd server. UnrealIRCd servers should never be ulined as it "
|
||||
"causes security issues. Ulines should only be added for services! "
|
||||
"See https://www.unrealircd.org/docs/FAQ#bad-ulines.");
|
||||
exit_client(client, NULL, "Bad ulines. See https://www.unrealircd.org/docs/FAQ#bad-ulines");
|
||||
}
|
||||
SetULine(client);
|
||||
}
|
||||
|
||||
find_or_add(client->name);
|
||||
|
||||
if (IsSecure(client))
|
||||
{
|
||||
unreal_log(ULOG_INFO, "link", "SERVER_LINKED", client,
|
||||
"Server linked: $me -> $client [secure: $tls_cipher]",
|
||||
log_data_string("tls_cipher", tls_get_cipher(client->local->ssl)),
|
||||
log_data_client("me", &me));
|
||||
tls_link_notification_verify(client, aconf);
|
||||
}
|
||||
else
|
||||
{
|
||||
unreal_log(ULOG_INFO, "link", "SERVER_LINKED", client,
|
||||
"Server linked: $me -> $client",
|
||||
log_data_client("me", &me));
|
||||
/* Print out a warning if linking to a non-TLS server unless it's localhost.
|
||||
* Yeah.. there are still other cases when non-TLS links are fine (eg: local IP
|
||||
* of the same machine), we won't bother with detecting that. -- Syzop
|
||||
*/
|
||||
if (!IsLocalhost(client) && (iConf.plaintext_policy_server == POLICY_WARN))
|
||||
{
|
||||
sendto_realops("\002WARNING:\002 This link is unencrypted (not SSL/TLS). We highly recommend to use "
|
||||
"SSL/TLS for server linking. See https://www.unrealircd.org/docs/Linking_servers");
|
||||
}
|
||||
if (IsSecure(client) && (iConf.outdated_tls_policy_server == POLICY_WARN) && outdated_tls_client(client))
|
||||
{
|
||||
sendto_realops("\002WARNING:\002 This link is using an outdated SSL/TLS protocol or cipher (%s).",
|
||||
tls_get_cipher(client->local->ssl));
|
||||
}
|
||||
}
|
||||
|
||||
add_to_client_hash_table(client->name, client);
|
||||
/* doesnt duplicate client->serv if allocted this struct already */
|
||||
make_server(client);
|
||||
client->serv->up = me.name;
|
||||
client->srvptr = &me;
|
||||
if (!client->serv->conf)
|
||||
client->serv->conf = aconf; /* Only set serv->conf to aconf if not set already! Bug #0003913 */
|
||||
if (incoming)
|
||||
client->serv->conf->refcount++;
|
||||
client->serv->conf->class->clients++;
|
||||
client->local->class = client->serv->conf->class;
|
||||
|
||||
RunHook(HOOKTYPE_SERVER_CONNECT, client);
|
||||
|
||||
server_sync(client, aconf, incoming);
|
||||
}
|
||||
|
||||
/** Remote server command (SID).
|
||||
@@ -1165,7 +1243,6 @@ CMD_FUNC(cmd_sid)
|
||||
make_server(acptr);
|
||||
acptr->serv->up = find_or_add(acptr->srvptr->name);
|
||||
SetServer(acptr);
|
||||
ircd_log(LOG_SERVER, "SERVER %s (from %s)", acptr->name, acptr->srvptr->name);
|
||||
/* If this server is U-lined, or the parent is, then mark it as U-lined */
|
||||
if (IsULine(client) || find_uline(acptr->name))
|
||||
SetULine(acptr);
|
||||
@@ -1176,6 +1253,8 @@ CMD_FUNC(cmd_sid)
|
||||
add_to_id_hash_table(acptr->id, acptr);
|
||||
list_move(&acptr->client_node, &global_server_list);
|
||||
|
||||
unreal_log(ULOG_INFO, "link", "SERVER_LINKED", acptr, "Server linked: $client (via $client.server)");
|
||||
|
||||
RunHook(HOOKTYPE_SERVER_CONNECT, acptr);
|
||||
|
||||
sendto_server(client, 0, 0, NULL, ":%s SID %s %d %s :%s",
|
||||
@@ -1213,6 +1292,156 @@ void _introduce_user(Client *to, Client *acptr)
|
||||
}
|
||||
}
|
||||
|
||||
#define SafeStr(x) ((x && *(x)) ? (x) : "*")
|
||||
|
||||
/** Broadcast SINFO.
|
||||
* @param cptr The server to send the information about.
|
||||
* @param to The server to send the information TO (NULL for broadcast).
|
||||
* @param except The direction NOT to send to.
|
||||
* This function takes into account that the server may not
|
||||
* provide all of the detailed info. If any information is
|
||||
* absent we will send 0 for numbers and * for NULL strings.
|
||||
*/
|
||||
void _broadcast_sinfo(Client *acptr, Client *to, Client *except)
|
||||
{
|
||||
char chanmodes[128], buf[512];
|
||||
|
||||
if (acptr->serv->features.chanmodes[0])
|
||||
{
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s,%s,%s,%s",
|
||||
acptr->serv->features.chanmodes[0],
|
||||
acptr->serv->features.chanmodes[1],
|
||||
acptr->serv->features.chanmodes[2],
|
||||
acptr->serv->features.chanmodes[3]);
|
||||
} else {
|
||||
strlcpy(chanmodes, "*", sizeof(chanmodes));
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%lld %d %s %s %s :%s",
|
||||
(long long)acptr->serv->boottime,
|
||||
acptr->serv->features.protocol,
|
||||
SafeStr(acptr->serv->features.usermodes),
|
||||
chanmodes,
|
||||
SafeStr(acptr->serv->features.nickchars),
|
||||
SafeStr(acptr->serv->features.software));
|
||||
|
||||
if (to)
|
||||
{
|
||||
/* Targetted to one server */
|
||||
sendto_one(to, NULL, ":%s SINFO %s", acptr->id, buf);
|
||||
} else {
|
||||
/* Broadcast (except one side...) */
|
||||
sendto_server(except, 0, 0, NULL, ":%s SINFO %s", acptr->id, buf);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sync all information with server 'client'.
|
||||
* Eg: users, channels, everything.
|
||||
* @param client The newly linked in server
|
||||
* @param aconf The link block that belongs to this server
|
||||
* @note This function (via cmd_server) is called from both sides, so
|
||||
* from the incoming side and the outgoing side.
|
||||
*/
|
||||
int server_sync(Client *client, ConfigItem_link *aconf, int incoming)
|
||||
{
|
||||
Client *acptr;
|
||||
|
||||
if (incoming)
|
||||
{
|
||||
/* If this is an incomming connection, then we have just received
|
||||
* their stuff and now send our PASS, PROTOCTL and SERVER messages back.
|
||||
*/
|
||||
if (!IsEAuth(client)) /* if eauth'd then we already sent the passwd */
|
||||
sendto_one(client, NULL, "PASS :%s", (aconf->auth->type == AUTHTYPE_PLAINTEXT) ? aconf->auth->data : "*");
|
||||
|
||||
send_proto(client, aconf);
|
||||
send_server_message(client);
|
||||
}
|
||||
|
||||
/* Broadcast new server to the rest of the network */
|
||||
sendto_server(client, 0, 0, NULL, ":%s SID %s 2 %s :%s",
|
||||
client->srvptr->id, client->name, client->id, client->info);
|
||||
|
||||
/* Broadcast the just-linked-in featureset to other servers on our side */
|
||||
broadcast_sinfo(client, NULL, client);
|
||||
|
||||
/* Send moddata of &me (if any, likely minimal) */
|
||||
send_moddata_client(client, &me);
|
||||
|
||||
list_for_each_entry_reverse(acptr, &global_server_list, client_node)
|
||||
{
|
||||
/* acptr->direction == acptr for acptr == client */
|
||||
if (acptr->direction == client)
|
||||
continue;
|
||||
|
||||
if (IsServer(acptr))
|
||||
{
|
||||
sendto_one(client, NULL, ":%s SID %s %d %s :%s",
|
||||
acptr->srvptr->id,
|
||||
acptr->name, acptr->hopcount + 1,
|
||||
acptr->id, acptr->info);
|
||||
|
||||
/* Also signal to the just-linked server which
|
||||
* servers are fully linked.
|
||||
* Now you might ask yourself "Why don't we just
|
||||
* assume every server you get during link phase
|
||||
* is fully linked?", well.. there's a race condition
|
||||
* if 2 servers link (almost) at the same time,
|
||||
* then you would think the other one is fully linked
|
||||
* while in fact he was not.. -- Syzop.
|
||||
*/
|
||||
if (acptr->serv->flags.synced)
|
||||
sendto_one(client, NULL, ":%s EOS", acptr->id);
|
||||
/* Send SINFO of our servers to their side */
|
||||
broadcast_sinfo(acptr, client, NULL);
|
||||
send_moddata_client(client, acptr); /* send moddata of server 'acptr' (if any, likely minimal) */
|
||||
}
|
||||
}
|
||||
|
||||
/* Synching nick information */
|
||||
list_for_each_entry_reverse(acptr, &client_list, client_node)
|
||||
{
|
||||
/* acptr->direction == acptr for acptr == client */
|
||||
if (acptr->direction == client)
|
||||
continue;
|
||||
if (IsUser(acptr))
|
||||
introduce_user(client, acptr);
|
||||
}
|
||||
/*
|
||||
** Last, pass all channels plus statuses
|
||||
*/
|
||||
{
|
||||
Channel *channel;
|
||||
for (channel = channels; channel; channel = channel->nextch)
|
||||
{
|
||||
send_channel_modes_sjoin3(client, channel);
|
||||
if (channel->topic_time)
|
||||
sendto_one(client, NULL, "TOPIC %s %s %lld :%s",
|
||||
channel->name, channel->topic_nick,
|
||||
(long long)channel->topic_time, channel->topic);
|
||||
send_moddata_channel(client, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send ModData for all member(ship) structs */
|
||||
send_moddata_members(client);
|
||||
|
||||
/* pass on TKLs */
|
||||
tkl_sync(client);
|
||||
|
||||
RunHook(HOOKTYPE_SERVER_SYNC, client);
|
||||
|
||||
sendto_one(client, NULL, "NETINFO %i %lld %i %s 0 0 0 :%s",
|
||||
irccounts.global_max, (long long)TStime(), UnrealProtocol,
|
||||
CLOAK_KEYCRC,
|
||||
ircnetwork);
|
||||
|
||||
/* Send EOS (End Of Sync) to the just linked server... */
|
||||
sendto_one(client, NULL, ":%s EOS", me.id);
|
||||
RunHook(HOOKTYPE_POST_SERVER_CONNECT, client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tls_link_notification_verify(Client *acptr, ConfigItem_link *aconf)
|
||||
{
|
||||
char *spki_fp;
|
||||
@@ -1272,231 +1501,6 @@ void tls_link_notification_verify(Client *acptr, ConfigItem_link *aconf)
|
||||
}
|
||||
}
|
||||
|
||||
#define SafeStr(x) ((x && *(x)) ? (x) : "*")
|
||||
|
||||
/** Broadcast SINFO.
|
||||
* @param cptr The server to send the information about.
|
||||
* @param to The server to send the information TO (NULL for broadcast).
|
||||
* @param except The direction NOT to send to.
|
||||
* This function takes into account that the server may not
|
||||
* provide all of the detailed info. If any information is
|
||||
* absent we will send 0 for numbers and * for NULL strings.
|
||||
*/
|
||||
void _broadcast_sinfo(Client *acptr, Client *to, Client *except)
|
||||
{
|
||||
char chanmodes[128], buf[512];
|
||||
|
||||
if (acptr->serv->features.chanmodes[0])
|
||||
{
|
||||
snprintf(chanmodes, sizeof(chanmodes), "%s,%s,%s,%s",
|
||||
acptr->serv->features.chanmodes[0],
|
||||
acptr->serv->features.chanmodes[1],
|
||||
acptr->serv->features.chanmodes[2],
|
||||
acptr->serv->features.chanmodes[3]);
|
||||
} else {
|
||||
strlcpy(chanmodes, "*", sizeof(chanmodes));
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%lld %d %s %s %s :%s",
|
||||
(long long)acptr->serv->boottime,
|
||||
acptr->serv->features.protocol,
|
||||
SafeStr(acptr->serv->features.usermodes),
|
||||
chanmodes,
|
||||
SafeStr(acptr->serv->features.nickchars),
|
||||
SafeStr(acptr->serv->features.software));
|
||||
|
||||
if (to)
|
||||
{
|
||||
/* Targetted to one server */
|
||||
sendto_one(to, NULL, ":%s SINFO %s", acptr->id, buf);
|
||||
} else {
|
||||
/* Broadcast (except one side...) */
|
||||
sendto_server(except, 0, 0, NULL, ":%s SINFO %s", acptr->id, buf);
|
||||
}
|
||||
}
|
||||
|
||||
int server_sync(Client *cptr, ConfigItem_link *aconf)
|
||||
{
|
||||
char *inpath = get_client_name(cptr, TRUE);
|
||||
Client *acptr;
|
||||
int incoming = IsUnknown(cptr) ? 1 : 0;
|
||||
|
||||
ircd_log(LOG_SERVER, "SERVER %s", cptr->name);
|
||||
|
||||
if (cptr->local->passwd)
|
||||
{
|
||||
safe_free(cptr->local->passwd);
|
||||
cptr->local->passwd = NULL;
|
||||
}
|
||||
if (incoming)
|
||||
{
|
||||
/* If this is an incomming connection, then we have just received
|
||||
* their stuff and now send our stuff back.
|
||||
*/
|
||||
if (!IsEAuth(cptr)) /* if eauth'd then we already sent the passwd */
|
||||
sendto_one(cptr, NULL, "PASS :%s", (aconf->auth->type == AUTHTYPE_PLAINTEXT) ? aconf->auth->data : "*");
|
||||
|
||||
send_proto(cptr, aconf);
|
||||
send_server_message(cptr);
|
||||
}
|
||||
|
||||
/* Set up server structure */
|
||||
free_pending_net(cptr);
|
||||
SetServer(cptr);
|
||||
irccounts.me_servers++;
|
||||
irccounts.servers++;
|
||||
irccounts.unknown--;
|
||||
list_move(&cptr->client_node, &global_server_list);
|
||||
list_move(&cptr->lclient_node, &lclient_list);
|
||||
list_add(&cptr->special_node, &server_list);
|
||||
if (find_uline(cptr->name))
|
||||
{
|
||||
if (cptr->serv && cptr->serv->features.software && !strncmp(cptr->serv->features.software, "UnrealIRCd-", 11))
|
||||
{
|
||||
sendto_realops("\002WARNING:\002 Bad ulines! It seems your server is misconfigured: "
|
||||
"your ulines { } block is matching an UnrealIRCd server (%s). "
|
||||
"This is not correct and will cause security issues. "
|
||||
"ULines should only be added for services! "
|
||||
"See https://www.unrealircd.org/docs/FAQ#bad-ulines",
|
||||
cptr->name);
|
||||
}
|
||||
SetULine(cptr);
|
||||
}
|
||||
find_or_add(cptr->name);
|
||||
if (IsSecure(cptr))
|
||||
{
|
||||
sendto_umode_global(UMODE_OPER,
|
||||
"(\2link\2) Secure link %s -> %s established (%s)",
|
||||
me.name, inpath, tls_get_cipher(cptr->local->ssl));
|
||||
tls_link_notification_verify(cptr, aconf);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_umode_global(UMODE_OPER,
|
||||
"(\2link\2) Link %s -> %s established",
|
||||
me.name, inpath);
|
||||
/* Print out a warning if linking to a non-TLS server unless it's localhost.
|
||||
* Yeah.. there are still other cases when non-TLS links are fine (eg: local IP
|
||||
* of the same machine), we won't bother with detecting that. -- Syzop
|
||||
*/
|
||||
if (!IsLocalhost(cptr) && (iConf.plaintext_policy_server == POLICY_WARN))
|
||||
{
|
||||
sendto_realops("\002WARNING:\002 This link is unencrypted (not SSL/TLS). We highly recommend to use "
|
||||
"SSL/TLS for server linking. See https://www.unrealircd.org/docs/Linking_servers");
|
||||
}
|
||||
if (IsSecure(cptr) && (iConf.outdated_tls_policy_server == POLICY_WARN) && outdated_tls_client(cptr))
|
||||
{
|
||||
sendto_realops("\002WARNING:\002 This link is using an outdated SSL/TLS protocol or cipher (%s).",
|
||||
tls_get_cipher(cptr->local->ssl));
|
||||
}
|
||||
}
|
||||
add_to_client_hash_table(cptr->name, cptr);
|
||||
/* doesnt duplicate cptr->serv if allocted this struct already */
|
||||
make_server(cptr);
|
||||
cptr->serv->up = me.name;
|
||||
cptr->srvptr = &me;
|
||||
if (!cptr->serv->conf)
|
||||
cptr->serv->conf = aconf; /* Only set serv->conf to aconf if not set already! Bug #0003913 */
|
||||
if (incoming)
|
||||
cptr->serv->conf->refcount++;
|
||||
cptr->serv->conf->class->clients++;
|
||||
cptr->local->class = cptr->serv->conf->class;
|
||||
RunHook(HOOKTYPE_SERVER_CONNECT, cptr);
|
||||
|
||||
/* Broadcast new server to the rest of the network */
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SID %s 2 %s :%s",
|
||||
cptr->srvptr->id, cptr->name, cptr->id, cptr->info);
|
||||
|
||||
/* Broadcast the just-linked-in featureset to other servers on our side */
|
||||
broadcast_sinfo(cptr, NULL, cptr);
|
||||
|
||||
/* Send moddata of &me (if any, likely minimal) */
|
||||
send_moddata_client(cptr, &me);
|
||||
|
||||
list_for_each_entry_reverse(acptr, &global_server_list, client_node)
|
||||
{
|
||||
/* acptr->direction == acptr for acptr == cptr */
|
||||
if (acptr->direction == cptr)
|
||||
continue;
|
||||
|
||||
if (IsServer(acptr))
|
||||
{
|
||||
sendto_one(cptr, NULL, ":%s SID %s %d %s :%s",
|
||||
acptr->srvptr->id,
|
||||
acptr->name, acptr->hopcount + 1,
|
||||
acptr->id, acptr->info);
|
||||
|
||||
/* Also signal to the just-linked server which
|
||||
* servers are fully linked.
|
||||
* Now you might ask yourself "Why don't we just
|
||||
* assume every server you get during link phase
|
||||
* is fully linked?", well.. there's a race condition
|
||||
* if 2 servers link (almost) at the same time,
|
||||
* then you would think the other one is fully linked
|
||||
* while in fact he was not.. -- Syzop.
|
||||
*/
|
||||
if (acptr->serv->flags.synced)
|
||||
{
|
||||
sendto_one(cptr, NULL, ":%s EOS", acptr->id);
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] server_sync: sending to uplink '%s' with src %s...",
|
||||
cptr->name, acptr->name);
|
||||
#endif
|
||||
}
|
||||
/* Send SINFO of our servers to their side */
|
||||
broadcast_sinfo(acptr, cptr, NULL);
|
||||
send_moddata_client(cptr, acptr); /* send moddata of server 'acptr' (if any, likely minimal) */
|
||||
}
|
||||
}
|
||||
|
||||
/* Synching nick information */
|
||||
list_for_each_entry_reverse(acptr, &client_list, client_node)
|
||||
{
|
||||
/* acptr->direction == acptr for acptr == cptr */
|
||||
if (acptr->direction == cptr)
|
||||
continue;
|
||||
if (IsUser(acptr))
|
||||
introduce_user(cptr, acptr);
|
||||
}
|
||||
/*
|
||||
** Last, pass all channels plus statuses
|
||||
*/
|
||||
{
|
||||
Channel *channel;
|
||||
for (channel = channels; channel; channel = channel->nextch)
|
||||
{
|
||||
send_channel_modes_sjoin3(cptr, channel);
|
||||
if (channel->topic_time)
|
||||
sendto_one(cptr, NULL, "TOPIC %s %s %lld :%s",
|
||||
channel->chname, channel->topic_nick,
|
||||
(long long)channel->topic_time, channel->topic);
|
||||
send_moddata_channel(cptr, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send ModData for all member(ship) structs */
|
||||
send_moddata_members(cptr);
|
||||
|
||||
/* pass on TKLs */
|
||||
tkl_sync(cptr);
|
||||
|
||||
RunHook(HOOKTYPE_SERVER_SYNC, cptr);
|
||||
|
||||
sendto_one(cptr, NULL, "NETINFO %i %lld %i %s 0 0 0 :%s",
|
||||
irccounts.global_max, (long long)TStime(), UnrealProtocol,
|
||||
CLOAK_KEYCRC,
|
||||
ircnetwork);
|
||||
|
||||
/* Send EOS (End Of Sync) to the just linked server... */
|
||||
sendto_one(cptr, NULL, ":%s EOS", me.id);
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] server_sync: sending to justlinked '%s' with src ME...",
|
||||
cptr->name);
|
||||
#endif
|
||||
RunHook(HOOKTYPE_POST_SERVER_CONNECT, cptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** This will send "to" a full list of the modes for channel channel,
|
||||
*
|
||||
* Half of it recoded by Syzop: the whole buffering and size checking stuff
|
||||
@@ -1517,7 +1521,7 @@ void send_channel_modes_sjoin3(Client *to, Channel *channel)
|
||||
int prebuflen = 0; /* points to after the <sjointoken> <TS> <chan> <fixmodes> <fixparas <..>> : part */
|
||||
int sent = 0; /* we need this so we send at least 1 message about the channel (eg if +P and no members, no bans, #4459) */
|
||||
|
||||
if (*channel->chname != '#')
|
||||
if (*channel->name != '#')
|
||||
return;
|
||||
|
||||
nomode = 0;
|
||||
@@ -1546,19 +1550,19 @@ void send_channel_modes_sjoin3(Client *to, Channel *channel)
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
":%s SJOIN %lld %s :", me.id,
|
||||
(long long)channel->creationtime, channel->chname);
|
||||
(long long)channel->creationtime, channel->name);
|
||||
}
|
||||
if (nopara && !nomode)
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
":%s SJOIN %lld %s %s :", me.id,
|
||||
(long long)channel->creationtime, channel->chname, modebuf);
|
||||
(long long)channel->creationtime, channel->name, modebuf);
|
||||
}
|
||||
if (!nopara && !nomode)
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
":%s SJOIN %lld %s %s %s :", me.id,
|
||||
(long long)channel->creationtime, channel->chname, modebuf, parabuf);
|
||||
(long long)channel->creationtime, channel->name, modebuf, parabuf);
|
||||
}
|
||||
|
||||
prebuflen = strlen(buf);
|
||||
|
||||
+22
-21
@@ -82,9 +82,9 @@ void send_local_chan_mode(MessageTag *recv_mtags, Client *client, Channel *chann
|
||||
{
|
||||
MessageTag *mtags = NULL;
|
||||
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf);
|
||||
new_message_special(client, recv_mtags, &mtags, ":%s MODE %s %s %s", client->name, channel->name, modebuf, parabuf);
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s %s %s", client->name, channel->chname, modebuf, parabuf);
|
||||
":%s MODE %s %s %s", client->name, channel->name, modebuf, parabuf);
|
||||
if (MyConnect(client))
|
||||
RunHook7(HOOKTYPE_LOCAL_CHANMODE, client, channel, mtags, modebuf, parabuf, 0, -1);
|
||||
else
|
||||
@@ -178,10 +178,16 @@ CMD_FUNC(cmd_sjoin)
|
||||
if (parc < 5)
|
||||
nomode = 1;
|
||||
|
||||
channel = get_channel(client, parv[2], CREATE);
|
||||
|
||||
ts = (time_t)atol(parv[1]);
|
||||
|
||||
channel = find_channel(parv[2]);
|
||||
if (!channel)
|
||||
{
|
||||
channel = make_channel(parv[2]);
|
||||
channel->creationtime = ts;
|
||||
oldts = -1;
|
||||
}
|
||||
|
||||
if (channel->creationtime > ts)
|
||||
{
|
||||
removeours = 1;
|
||||
@@ -197,12 +203,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
merge = 1;
|
||||
}
|
||||
|
||||
if (channel->creationtime == 0)
|
||||
{
|
||||
oldts = -1;
|
||||
channel->creationtime = ts;
|
||||
}
|
||||
else
|
||||
if (channel->creationtime > 0)
|
||||
{
|
||||
oldts = channel->creationtime;
|
||||
}
|
||||
@@ -213,7 +214,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
if (ts != 0)
|
||||
sendto_ops
|
||||
("Warning! Possible desync: SJOIN for channel %s has a fishy timestamp (%lld) [%s/%s]",
|
||||
channel->chname, (long long)ts, client->name, client->direction->name);
|
||||
channel->name, (long long)ts, client->name, client->direction->name);
|
||||
}
|
||||
|
||||
parabuf[0] = '\0';
|
||||
@@ -366,7 +367,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
{
|
||||
/* this obviously should never happen */
|
||||
sendto_ops("Malformed SJOIN piece from %s for channel %s: %s",
|
||||
client->name, channel->chname, tp);
|
||||
client->name, channel->name, tp);
|
||||
continue;
|
||||
}
|
||||
*end++ = '\0';
|
||||
@@ -376,7 +377,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
{
|
||||
/* missing setby parameter */
|
||||
sendto_ops("Malformed SJOIN piece from %s for channel %s: %s",
|
||||
client->name, channel->chname, tp);
|
||||
client->name, channel->name, tp);
|
||||
continue;
|
||||
}
|
||||
*p++ = '\0';
|
||||
@@ -485,11 +486,11 @@ getnick:
|
||||
|
||||
sendto_one(client, NULL,
|
||||
":%s KICK %s %s :Fake direction",
|
||||
me.id, channel->chname, acptr->name);
|
||||
me.id, channel->name, acptr->name);
|
||||
sendto_realops
|
||||
("Fake direction from user %s in SJOIN from %s(%s) at %s",
|
||||
nick, client->srvptr->name,
|
||||
client->name, channel->chname);
|
||||
client->name, channel->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -506,7 +507,7 @@ getnick:
|
||||
|
||||
add_user_to_channel(channel, acptr, modeflags);
|
||||
RunHook4(HOOKTYPE_REMOTE_JOIN, acptr, channel, recv_mtags, NULL);
|
||||
new_message_special(acptr, recv_mtags, &mtags, ":%s JOIN %s", acptr->name, channel->chname);
|
||||
new_message_special(acptr, recv_mtags, &mtags, ":%s JOIN %s", acptr->name, channel->name);
|
||||
send_join_to_local_users(acptr, channel, mtags);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
@@ -527,7 +528,7 @@ getnick:
|
||||
{
|
||||
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'",
|
||||
uid_buf, prefix, acptr->id);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -543,7 +544,7 @@ getnick:
|
||||
{
|
||||
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'",
|
||||
uid_sjsby_buf, prefix, acptr->id);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -602,7 +603,7 @@ getnick:
|
||||
{
|
||||
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'",
|
||||
uid_buf, prefix, nick);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -623,7 +624,7 @@ getnick:
|
||||
if (strlen(uid_sjsby_buf) + strlen(scratch_buf) > BUFSIZE - 5)
|
||||
{
|
||||
ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s'", uid_sjsby_buf, scratch_buf);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname);
|
||||
sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -886,7 +887,7 @@ getnick:
|
||||
new_message(client, NULL, &mtags);
|
||||
sendto_channel(channel, &me, NULL, 0, 0, SEND_LOCAL, NULL,
|
||||
":%s NOTICE %s :*** TS for %s changed from %lld to %lld",
|
||||
me.name, channel->chname, channel->chname,
|
||||
me.name, channel->name, channel->name,
|
||||
(long long)oldts, (long long)channel->creationtime);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
+1
-1
@@ -776,7 +776,7 @@ int stats_officialchannels(Client *client, char *para)
|
||||
|
||||
for (x = conf_offchans; x; x = x->next)
|
||||
{
|
||||
sendtxtnumeric(client, "%s %s", x->chname, x->topic ? x->topic : "");
|
||||
sendtxtnumeric(client, "%s %s", x->name, x->topic ? x->topic : "");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ void channel_svsmode(Client *client, int parc, char *parv[])
|
||||
if ((parc < 3) || BadPtr(parv[2]))
|
||||
return;
|
||||
|
||||
if (!(channel = find_channel(parv[1], NULL)))
|
||||
if (!(channel = find_channel(parv[1])))
|
||||
return;
|
||||
|
||||
for(m = parv[2]; *m; m++)
|
||||
@@ -231,7 +231,7 @@ void channel_svsmode(Client *client, int parc, char *parv[])
|
||||
if (what != MODE_DEL)
|
||||
{
|
||||
sendto_realops("Warning! Received SVS(2)MODE with +%c for %s from %s, which is invalid!!",
|
||||
*m, channel->chname, client->name);
|
||||
*m, channel->name, client->name);
|
||||
continue;
|
||||
}
|
||||
channel_flags = char_to_channelflag(*m);
|
||||
@@ -268,7 +268,7 @@ void channel_svsmode(Client *client, int parc, char *parv[])
|
||||
break;
|
||||
default:
|
||||
sendto_realops("Warning! Invalid mode `%c' used with 'SVSMODE %s %s %s' (from %s %s)",
|
||||
*m, channel->chname, parv[2], parv[3] ? parv[3] : "",
|
||||
*m, channel->name, parv[2], parv[3] ? parv[3] : "",
|
||||
client->direction->name, client->name);
|
||||
break;
|
||||
}
|
||||
@@ -283,8 +283,8 @@ void channel_svsmode(Client *client, int parc, char *parv[])
|
||||
|
||||
sendto_channel(channel, client, client, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s %s %s",
|
||||
client->name, channel->chname, modebuf, parabuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", client->id, channel->chname, modebuf, parabuf);
|
||||
client->name, channel->name, modebuf, parabuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", client->id, channel->name, modebuf, parabuf);
|
||||
|
||||
/* Activate this hook just like cmd_mode.c */
|
||||
RunHook7(HOOKTYPE_REMOTE_CHANMODE, client, channel, mtags, modebuf, parabuf, 0, 0);
|
||||
@@ -598,8 +598,8 @@ void add_send_mode_param(Channel *channel, Client *from, char what, char mode, c
|
||||
new_message(from, NULL, &mtags);
|
||||
sendto_channel(channel, from, from, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s MODE %s %s %s",
|
||||
from->name, channel->chname, modebuf, parabuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", from->id, channel->chname, modebuf, parabuf);
|
||||
from->name, channel->name, modebuf, parabuf);
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", from->id, channel->name, modebuf, parabuf);
|
||||
free_message_tags(mtags);
|
||||
send = 0;
|
||||
*parabuf = 0;
|
||||
|
||||
+86
-162
@@ -55,6 +55,7 @@ char _tkl_typetochar(int type);
|
||||
int _tkl_chartotype(char c);
|
||||
int tkl_banexception_chartotype(char c);
|
||||
char *_tkl_type_string(TKL *tk);
|
||||
char *_tkl_type_config_string(TKL *tk);
|
||||
char *tkl_banexception_configname_to_chars(char *name);
|
||||
TKL *_tkl_add_serverban(int type, char *usermask, char *hostmask, char *reason, char *set_by,
|
||||
time_t expire_at, time_t set_at, int soft, int flags);
|
||||
@@ -71,6 +72,7 @@ void _sendnotice_tkl_add(TKL *tkl);
|
||||
void _free_tkl(TKL *tkl);
|
||||
void _tkl_del_line(TKL *tkl);
|
||||
static void _tkl_check_local_remove_shun(TKL *tmp);
|
||||
char *_tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options);
|
||||
void tkl_expire_entry(TKL * tmp);
|
||||
EVENT(tkl_check_expire);
|
||||
int _find_tkline_match(Client *client, int skip_soft);
|
||||
@@ -161,6 +163,7 @@ MOD_TEST()
|
||||
EfunctionAdd(modinfo->handle, EFUNC_TKL_TYPETOCHAR, TO_INTFUNC(_tkl_typetochar));
|
||||
EfunctionAdd(modinfo->handle, EFUNC_TKL_CHARTOTYPE, TO_INTFUNC(_tkl_chartotype));
|
||||
EfunctionAddPChar(modinfo->handle, EFUNC_TKL_TYPE_STRING, _tkl_type_string);
|
||||
EfunctionAddPChar(modinfo->handle, EFUNC_TKL_TYPE_CONFIG_STRING, _tkl_type_config_string);
|
||||
EfunctionAddPVoid(modinfo->handle, EFUNC_TKL_ADD_SERVERBAN, TO_PVOIDFUNC(_tkl_add_serverban));
|
||||
EfunctionAddPVoid(modinfo->handle, EFUNC_TKL_ADD_BANEXCEPTION, TO_PVOIDFUNC(_tkl_add_banexception));
|
||||
EfunctionAddPVoid(modinfo->handle, EFUNC_TKL_ADD_NAMEBAN, TO_PVOIDFUNC(_tkl_add_nameban));
|
||||
@@ -191,6 +194,7 @@ MOD_TEST()
|
||||
EfunctionAddVoid(modinfo->handle, EFUNC_SENDNOTICE_TKL_ADD, _sendnotice_tkl_add);
|
||||
EfunctionAddVoid(modinfo->handle, EFUNC_SENDNOTICE_TKL_DEL, _sendnotice_tkl_del);
|
||||
EfunctionAdd(modinfo->handle, EFUNC_FIND_TKL_EXCEPTION, _find_tkl_exception);
|
||||
EfunctionAddPChar(modinfo->handle, EFUNC_TKL_UHOST, _tkl_uhost);
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2123,8 +2127,9 @@ int _tkl_hash(unsigned int c)
|
||||
else if ((c >= 'A') && (c <= 'Z'))
|
||||
return c-'A';
|
||||
else {
|
||||
sendto_realops("[BUG] tkl_hash() called with out of range parameter (c = '%c') !!!", c);
|
||||
ircd_log(LOG_ERROR, "[BUG] tkl_hash() called with out of range parameter (c = '%c') !!!", c);
|
||||
unreal_log(ULOG_ERROR, "bug", "TKL_HASH_INVALID", NULL,
|
||||
"tkl_hash() called with out of range parameter (c = '$tkl_char') !!!",
|
||||
log_data_char("tkl_char", c));
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
@@ -2141,8 +2146,9 @@ char _tkl_typetochar(int type)
|
||||
for (i=0; tkl_types[i].config_name; i++)
|
||||
if ((tkl_types[i].type == type) && tkl_types[i].tkltype)
|
||||
return tkl_types[i].letter;
|
||||
sendto_realops("[BUG]: tkl_typetochar(): unknown type 0x%x !!!", type);
|
||||
ircd_log(LOG_ERROR, "[BUG] tkl_typetochar(): unknown type 0x%x !!!", type);
|
||||
unreal_log(ULOG_ERROR, "bug", "TKL_TYPETOCHAR_INVALID", NULL,
|
||||
"tkl_typetochar(): unknown type $tkl_type!!!",
|
||||
log_data_integer("tkl_type", type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2201,13 +2207,13 @@ char *tkl_banexception_configname_to_chars(char *name)
|
||||
char *_tkl_type_string(TKL *tkl)
|
||||
{
|
||||
static char txt[256];
|
||||
int i;
|
||||
|
||||
*txt = '\0';
|
||||
|
||||
if (TKLIsServerBan(tkl) && (tkl->ptr.serverban->subtype == TKL_SUBTYPE_SOFT))
|
||||
strlcpy(txt, "Soft ", sizeof(txt));
|
||||
|
||||
int i;
|
||||
for (i=0; tkl_types[i].config_name; i++)
|
||||
{
|
||||
if ((tkl_types[i].type == tkl->type) && tkl_types[i].tkltype)
|
||||
@@ -2221,6 +2227,18 @@ char *_tkl_type_string(TKL *tkl)
|
||||
return txt;
|
||||
}
|
||||
|
||||
/** Short config string, lowercase alnum with possibly hyphens (eg: 'kline') */
|
||||
char *_tkl_type_config_string(TKL *tkl)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; tkl_types[i].config_name; i++)
|
||||
if ((tkl_types[i].type == tkl->type) && tkl_types[i].tkltype)
|
||||
return tkl_types[i].config_name;
|
||||
|
||||
return "???";
|
||||
}
|
||||
|
||||
int tkl_banexception_matches_type(TKL *except, int bantype)
|
||||
{
|
||||
char *p;
|
||||
@@ -2746,7 +2764,7 @@ void _tkl_check_local_remove_shun(TKL *tmp)
|
||||
* that can be used in oper notices like expiring kline, added kline, etc.
|
||||
*/
|
||||
#define NO_SOFT_PREFIX 1
|
||||
char *tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options)
|
||||
char *_tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options)
|
||||
{
|
||||
if (TKLIsServerBan(tkl))
|
||||
{
|
||||
@@ -2784,56 +2802,29 @@ char *tkl_uhost(TKL *tkl, char *buf, size_t buflen, int options)
|
||||
*/
|
||||
void tkl_expire_entry(TKL *tkl)
|
||||
{
|
||||
char *whattype = tkl_type_string(tkl);
|
||||
|
||||
if (!tkl)
|
||||
return;
|
||||
|
||||
if (tkl->type & TKL_SPAMF)
|
||||
{
|
||||
/* Impossible */
|
||||
} else
|
||||
if (TKLIsServerBan(tkl))
|
||||
{
|
||||
char uhostbuf[BUFSIZE];
|
||||
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
|
||||
sendto_snomask(SNO_TKL,
|
||||
"*** Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
|
||||
whattype, uhost, tkl->set_by, tkl->ptr.serverban->reason,
|
||||
(long long)(TStime() - tkl->set_at));
|
||||
ircd_log
|
||||
(LOG_TKL, "Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
|
||||
whattype, uhost, tkl->set_by, tkl->ptr.serverban->reason,
|
||||
(long long)(TStime() - tkl->set_at));
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_EXPIRE", NULL,
|
||||
"Expiring $tkl.type_string '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] set $tkl.set_at_delta seconds ago",
|
||||
log_data_tkl("tkl", tkl));
|
||||
}
|
||||
else if (TKLIsNameBan(tkl))
|
||||
{
|
||||
if (!tkl->ptr.nameban->hold)
|
||||
{
|
||||
sendto_snomask(SNO_TKL,
|
||||
"*** Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
|
||||
whattype, tkl->ptr.nameban->name, tkl->set_by, tkl->ptr.nameban->reason,
|
||||
(long long)(TStime() - tkl->set_at));
|
||||
ircd_log
|
||||
(LOG_TKL, "Expiring %s (%s) made by %s (Reason: %s) set %lld seconds ago",
|
||||
whattype, tkl->ptr.nameban->name, tkl->set_by, tkl->ptr.nameban->reason,
|
||||
(long long)(TStime() - tkl->set_at));
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_EXPIRE", NULL,
|
||||
"Expiring $tkl.type_string '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] set $tkl.set_at_delta seconds ago",
|
||||
log_data_tkl("tkl", tkl));
|
||||
}
|
||||
}
|
||||
else if (TKLIsBanException(tkl))
|
||||
{
|
||||
char uhostbuf[BUFSIZE];
|
||||
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
|
||||
sendto_snomask(SNO_TKL,
|
||||
"*** Expiring %s (%s) for types '%s' made by %s (Reason: %s) set %lld seconds ago",
|
||||
whattype, uhost, tkl->ptr.banexception->bantypes, tkl->set_by, tkl->ptr.banexception->reason,
|
||||
(long long)(TStime() - tkl->set_at));
|
||||
ircd_log
|
||||
(LOG_TKL, "Expiring %s (%s) for types '%s' made by %s (Reason: %s) set %lld seconds ago",
|
||||
whattype, uhost, tkl->ptr.banexception->bantypes, tkl->set_by, tkl->ptr.banexception->reason,
|
||||
(long long)(TStime() - tkl->set_at));
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_EXPIRE", NULL,
|
||||
"Expiring $tkl.type_string '$tkl' [type: $tkl.exception_types] [reason: $tkl.reason] [by: $tkl.set_by] set $tkl.set_at_delta seconds ago",
|
||||
log_data_tkl("tkl", tkl));
|
||||
}
|
||||
|
||||
// FIXME: so.. this isn't logged? or what?
|
||||
if (tkl->type & TKL_SHUN)
|
||||
tkl_check_local_remove_shun(tkl);
|
||||
|
||||
@@ -3161,14 +3152,12 @@ int spamfilter_check_users(TKL *tkl)
|
||||
continue; /* No match */
|
||||
|
||||
/* matched! */
|
||||
ircsnprintf(buf, sizeof(buf), "[Spamfilter] %s!%s@%s matches filter '%s': [%s: '%s'] [%s]",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
tkl->ptr.spamfilter->match->str,
|
||||
"user", spamfilter_user,
|
||||
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
|
||||
unreal_log(ULOG_INFO, "tkl", "SPAMFILTER_MATCH", client,
|
||||
"[Spamfilter] $client.nuh matches filter '$tkl': [cmd: $command: '$str'] [reason: $tkl.reason] [action: $tkl.ban_action]",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_string("command", "USER"),
|
||||
log_data_string("str", spamfilter_user));
|
||||
|
||||
sendto_snomask_global(SNO_SPAMF, "%s", buf);
|
||||
ircd_log(LOG_SPAMFILTER, "%s", buf);
|
||||
RunHook6(HOOKTYPE_LOCAL_SPAMFILTER, client, spamfilter_user, spamfilter_user, SPAMF_USER, NULL, tkl);
|
||||
matches++;
|
||||
}
|
||||
@@ -3177,36 +3166,6 @@ int spamfilter_check_users(TKL *tkl)
|
||||
return matches;
|
||||
}
|
||||
|
||||
/** Similarly to previous, but match against all global users.
|
||||
* FUNCTION IS UNUSED !!
|
||||
*/
|
||||
int spamfilter_check_all_users(Client *from, TKL *tkl)
|
||||
{
|
||||
char spamfilter_user[NICKLEN + USERLEN + HOSTLEN + REALLEN + 64]; /* n!u@h:r */
|
||||
int matches = 0;
|
||||
Client *acptr;
|
||||
|
||||
list_for_each_entry(acptr, &client_list, client_node)
|
||||
{
|
||||
if (IsUser(acptr))
|
||||
{
|
||||
spamfilter_build_user_string(spamfilter_user, acptr->name, acptr);
|
||||
if (!unreal_match(tkl->ptr.spamfilter->match, spamfilter_user))
|
||||
continue; /* No match */
|
||||
|
||||
/* matched! */
|
||||
sendnotice(from, "[Spamfilter] %s!%s@%s matches filter '%s': [%s: '%s'] [%s]",
|
||||
acptr->name, acptr->user->username, acptr->user->realhost,
|
||||
tkl->ptr.spamfilter->match->str,
|
||||
"user", spamfilter_user,
|
||||
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
/** Check if the nick or channel name is banned (Q-Line).
|
||||
* @param client The possibly affected user.
|
||||
* @param name The nick or channel to check.
|
||||
@@ -3827,66 +3786,32 @@ void _sendnotice_tkl_add(TKL *tkl)
|
||||
|
||||
if (TKLIsServerBan(tkl))
|
||||
{
|
||||
char uhostbuf[BUFSIZE];
|
||||
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
|
||||
if (tkl->expire_at != 0)
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf), "%s added for %s on %s GMT (from %s to expire at %s GMT: %s)",
|
||||
tkl_type_str, uhost,
|
||||
set_at, tkl->set_by, expire_at, tkl->ptr.serverban->reason);
|
||||
} else {
|
||||
ircsnprintf(buf, sizeof(buf), "Permanent %s added for %s on %s GMT (from %s: %s)",
|
||||
tkl_type_str, uhost,
|
||||
set_at, tkl->set_by, tkl->ptr.serverban->reason);
|
||||
}
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
|
||||
"$tkl.type_string added: '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] [expires: $tkl.expire_at_string]",
|
||||
log_data_tkl("tkl", tkl));
|
||||
} else
|
||||
if (TKLIsNameBan(tkl))
|
||||
{
|
||||
if (tkl->expire_at > 0)
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf), "%s added for %s on %s GMT (from %s to expire at %s GMT: %s)",
|
||||
tkl_type_str, tkl->ptr.nameban->name, set_at, tkl->set_by, expire_at, tkl->ptr.nameban->reason);
|
||||
} else {
|
||||
ircsnprintf(buf, sizeof(buf), "Permanent %s added for %s on %s GMT (from %s: %s)",
|
||||
tkl_type_str, tkl->ptr.nameban->name, set_at, tkl->set_by, tkl->ptr.nameban->reason);
|
||||
}
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
|
||||
"$tkl.type_string added: '$tkl' [reason: $tkl.reason] [by: $tkl.set_by] [expires: $tkl.expire_at_string]",
|
||||
log_data_tkl("tkl", tkl));
|
||||
} else
|
||||
if (TKLIsSpamfilter(tkl))
|
||||
{
|
||||
/* Spamfilter */
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
"Spamfilter added: '%s' [type: %s] [target: %s] [action: %s] [reason: %s] on %s GMT (from %s)",
|
||||
tkl->ptr.spamfilter->match->str,
|
||||
unreal_match_method_valtostr(tkl->ptr.spamfilter->match->type),
|
||||
spamfilter_target_inttostring(tkl->ptr.spamfilter->target),
|
||||
banact_valtostring(tkl->ptr.spamfilter->action),
|
||||
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason),
|
||||
set_at,
|
||||
tkl->set_by);
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
|
||||
"Spamfilter added: '$tkl' [type: $tkl.match_type] [targets: $tkl.spamfilter_targets] "
|
||||
"[action: $tkl.ban_action] [reason: $tkl.reason] [by: $tkl.set_by]",
|
||||
log_data_tkl("tkl", tkl));
|
||||
} else
|
||||
if (TKLIsBanException(tkl))
|
||||
{
|
||||
char uhostbuf[BUFSIZE];
|
||||
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
|
||||
if (tkl->expire_at != 0)
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf), "%s added for %s for types '%s' on %s GMT (from %s to expire at %s GMT: %s)",
|
||||
tkl_type_str, uhost,
|
||||
tkl->ptr.banexception->bantypes,
|
||||
set_at, tkl->set_by, expire_at, tkl->ptr.banexception->reason);
|
||||
} else {
|
||||
ircsnprintf(buf, sizeof(buf), "Permanent %s added for %s for types '%s' on %s GMT (from %s: %s)",
|
||||
tkl_type_str, uhost,
|
||||
tkl->ptr.banexception->bantypes,
|
||||
set_at, tkl->set_by, tkl->ptr.banexception->reason);
|
||||
}
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_ADD", NULL,
|
||||
"$tkl.type_string added: '$tkl' [types: $tkl.exception_types] [by: $tkl.set_by] [expires: $tkl.expire_at_string]",
|
||||
log_data_tkl("tkl", tkl));
|
||||
} else
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf), "[BUG] %s added but type unhandled in sendnotice_tkl_add()!!!", tkl_type_str);
|
||||
}
|
||||
|
||||
sendto_snomask(SNO_TKL, "*** %s", buf);
|
||||
ircd_log(LOG_TKL, "%s", buf);
|
||||
}
|
||||
|
||||
/** Send a notice to opers about the TKL that is being deleted */
|
||||
@@ -3907,40 +3832,36 @@ void _sendnotice_tkl_del(char *removed_by, TKL *tkl)
|
||||
|
||||
if (TKLIsServerBan(tkl))
|
||||
{
|
||||
char uhostbuf[BUFSIZE];
|
||||
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
"%s removed %s %s (set at %s - reason: %s)",
|
||||
removed_by, tkl_type_str, uhost,
|
||||
set_at, tkl->ptr.serverban->reason);
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
|
||||
"$tkl.type_string removed: '$tkl' [reason: $tkl.reason] [by: $removed_by] [set at: $tkl.set_at_string]",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_string("removed_by", removed_by));
|
||||
} else
|
||||
if (TKLIsNameBan(tkl))
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
"%s removed %s %s (set at %s - reason: %s)",
|
||||
removed_by, tkl_type_str, tkl->ptr.nameban->name, set_at, tkl->ptr.nameban->reason);
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
|
||||
"$tkl.type_string removed: '$tkl' [reason: $tkl.reason] [by: $removed_by] [set at: $tkl.set_at_string]",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_string("removed_by", removed_by));
|
||||
} else
|
||||
if (TKLIsSpamfilter(tkl))
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
"%s removed Spamfilter '%s' (set at %s)",
|
||||
removed_by, tkl->ptr.spamfilter->match->str, set_at);
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
|
||||
"Spamfilter removed: '$tkl' [type: $tkl.match_type] [targets: $tkl.spamfilter_targets] "
|
||||
"[action: $tkl.ban_action] [reason: $tkl.reason] [by: $removed_by] [set at: $tkl.set_at_string]",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_string("removed_by", removed_by));
|
||||
} else
|
||||
if (TKLIsBanException(tkl))
|
||||
{
|
||||
char uhostbuf[BUFSIZE];
|
||||
char *uhost = tkl_uhost(tkl, uhostbuf, sizeof(uhostbuf), 0);
|
||||
ircsnprintf(buf, sizeof(buf),
|
||||
"%s removed exception on %s (set at %s - reason: %s)",
|
||||
removed_by, uhost,
|
||||
set_at, tkl->ptr.banexception->reason);
|
||||
unreal_log(ULOG_INFO, "tkl", "TKL_DEL", NULL,
|
||||
"$tkl.type_string removed: '$tkl' [types: $tkl.exception_types] [by: $removed_by] [set at: $tkl.set_at_string]",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_string("removed_by", removed_by));
|
||||
} else
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf), "[BUG] %s added but type unhandled in sendnotice_tkl_del()!!!!!", tkl_type_str);
|
||||
}
|
||||
|
||||
sendto_snomask(SNO_TKL, "*** %s", buf);
|
||||
ircd_log(LOG_TKL, "%s", buf);
|
||||
}
|
||||
|
||||
/** Add a TKL using the TKL layer. See cmd_tkl for parv[] and protocol documentation. */
|
||||
@@ -4656,11 +4577,11 @@ int _join_viruschan(Client *client, TKL *tkl, int type)
|
||||
sendnotice(client, "You are now restricted to talking in %s: %s",
|
||||
SPAMFILTER_VIRUSCHAN, unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
|
||||
|
||||
channel = find_channel(SPAMFILTER_VIRUSCHAN, NULL);
|
||||
channel = find_channel(SPAMFILTER_VIRUSCHAN);
|
||||
if (channel)
|
||||
{
|
||||
MessageTag *mtags = NULL;
|
||||
ircsnprintf(chbuf, sizeof(chbuf), "@%s", channel->chname);
|
||||
ircsnprintf(chbuf, sizeof(chbuf), "@%s", channel->name);
|
||||
ircsnprintf(buf, sizeof(buf), "[Spamfilter] %s matched filter '%s' [%s] [%s]",
|
||||
client->name, tkl->ptr.spamfilter->match->str, cmdname_by_spamftarget(type),
|
||||
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
|
||||
@@ -4751,22 +4672,26 @@ int _match_spamfilter(Client *client, char *str_in, int target, char *cmd, char
|
||||
|
||||
if ((SPAMFILTER_DETECTSLOW_FATAL > 0) && (ms_past > SPAMFILTER_DETECTSLOW_FATAL))
|
||||
{
|
||||
sendto_realops("[Spamfilter] WARNING: Too slow spamfilter detected (took %ld msec to execute) "
|
||||
"-- spamfilter will be \002REMOVED!\002: %s", ms_past, tkl->ptr.spamfilter->match->str);
|
||||
unreal_log(ULOG_ERROR, "tkl", "SPAMFILTER_SLOW_FATAL", NULL,
|
||||
"[Spamfilter] WARNING: Too slow spamfilter detected (took $msec_time msec to execute) "
|
||||
"-- spamfilter will be \002REMOVED!\002: $tkl",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_integer("msec_time", ms_past));
|
||||
tkl_del_line(tkl);
|
||||
return 0; /* Act as if it didn't match, even if it did.. it's gone now anyway.. */
|
||||
} else
|
||||
if ((SPAMFILTER_DETECTSLOW_WARN > 0) && (ms_past > SPAMFILTER_DETECTSLOW_WARN))
|
||||
{
|
||||
sendto_realops("[Spamfilter] WARNING: SLOW Spamfilter detected (took %ld msec to execute): %s",
|
||||
ms_past, tkl->ptr.spamfilter->match->str);
|
||||
unreal_log(ULOG_WARNING, "tkl", "SPAMFILTER_SLOW_WARN", NULL,
|
||||
"[Spamfilter] WARNING: Slow spamfilter detected (took $msec_time msec to execute): $tkl",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_integer("msec_time", ms_past));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* We have a match! */
|
||||
char buf[1024];
|
||||
char destinationbuf[48];
|
||||
|
||||
if (destination) {
|
||||
@@ -4779,14 +4704,13 @@ int _match_spamfilter(Client *client, char *str_in, int target, char *cmd, char
|
||||
if (!winner_tkl && destination && target_is_spamexcept(destination))
|
||||
return 0; /* No problem! */
|
||||
|
||||
ircsnprintf(buf, sizeof(buf), "[Spamfilter] %s!%s@%s matches filter '%s': [%s%s: '%s'] [%s]",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
tkl->ptr.spamfilter->match->str,
|
||||
cmd, destinationbuf, str,
|
||||
unreal_decodespace(tkl->ptr.spamfilter->tkl_reason));
|
||||
unreal_log(ULOG_INFO, "tkl", "SPAMFILTER_MATCH", client,
|
||||
"[Spamfilter] $client.nuh matches filter '$tkl': [cmd: $command$destination: '$str'] [reason: $tkl.reason] [action: $tkl.ban_action]",
|
||||
log_data_tkl("tkl", tkl),
|
||||
log_data_string("command", cmd),
|
||||
log_data_string("destination", destinationbuf),
|
||||
log_data_string("str", str));
|
||||
|
||||
sendto_snomask_global(SNO_SPAMF, "%s", buf);
|
||||
ircd_log(LOG_SPAMFILTER, "%s", buf);
|
||||
RunHook6(HOOKTYPE_LOCAL_SPAMFILTER, client, str, str_in, target, destination, tkl);
|
||||
|
||||
/* If we should stop after the first match, we end here... */
|
||||
|
||||
+1
-3
@@ -38,8 +38,7 @@ ModuleHeader MOD_HEADER = {
|
||||
*/
|
||||
#define TKLDB_SAVE_EVERY_DELTA +15
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
#define BENCHMARK
|
||||
// #undef BENCHMARK
|
||||
/* Benchmark results (2GHz Xeon Skylake, compiled with -O2, Linux):
|
||||
* 100,000 zlines:
|
||||
* - load db: 510 ms
|
||||
@@ -48,7 +47,6 @@ ModuleHeader MOD_HEADER = {
|
||||
* which executes every 5 minutes.
|
||||
* Of course, exact figures will depend on the machine.
|
||||
*/
|
||||
#endif
|
||||
|
||||
#define FreeTKLRead() \
|
||||
do { \
|
||||
|
||||
@@ -81,8 +81,7 @@ void ssl_info_callback(const SSL *ssl, int where, int ret)
|
||||
e->n++;
|
||||
if (e->n >= HANDSHAKE_LIMIT_COUNT)
|
||||
{
|
||||
ircd_log(LOG_ERROR, "TLS Handshake flood detected from %s -- killed", get_client_name(client, TRUE));
|
||||
sendto_realops("TLS Handshake flood detected from %s -- killed", get_client_name(client, TRUE));
|
||||
unreal_log(LOG_INFO, "flood", "TLS_HANDSHAKE_FLOOD", client, "TLS Handshake flood detected from $client -- killed");
|
||||
dead_socket(client, "TLS Handshake flood detected");
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -57,12 +57,12 @@ void topicoverride(Client *client, Channel *channel, char *topic)
|
||||
sendto_snomask(SNO_EYES,
|
||||
"*** OperOverride -- %s (%s@%s) TOPIC %s \'%s\'",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, topic);
|
||||
channel->name, topic);
|
||||
|
||||
/* Logging implementation added by XeRXeS */
|
||||
ircd_log(LOG_OVERRIDE, "OVERRIDE: %s (%s@%s) TOPIC %s \'%s\'",
|
||||
client->name, client->user->username, client->user->realhost,
|
||||
channel->chname, topic);
|
||||
channel->name, topic);
|
||||
}
|
||||
|
||||
/** Query or change the channel topic.
|
||||
@@ -97,7 +97,7 @@ CMD_FUNC(cmd_topic)
|
||||
|
||||
name = parv[1];
|
||||
|
||||
channel = find_channel(parv[1], NULL);
|
||||
channel = find_channel(parv[1]);
|
||||
if (!channel)
|
||||
{
|
||||
sendnumeric(client, ERR_NOSUCHCHANNEL, name);
|
||||
@@ -149,12 +149,12 @@ CMD_FUNC(cmd_topic)
|
||||
}
|
||||
|
||||
if (!channel->topic)
|
||||
sendnumeric(client, RPL_NOTOPIC, channel->chname);
|
||||
sendnumeric(client, RPL_NOTOPIC, channel->name);
|
||||
else
|
||||
{
|
||||
sendnumeric(client, RPL_TOPIC,
|
||||
channel->chname, channel->topic);
|
||||
sendnumeric(client, RPL_TOPICWHOTIME, channel->chname,
|
||||
channel->name, channel->topic);
|
||||
sendnumeric(client, RPL_TOPICWHOTIME, channel->name,
|
||||
channel->topic_nick, channel->topic_time);
|
||||
}
|
||||
return;
|
||||
@@ -175,11 +175,11 @@ CMD_FUNC(cmd_topic)
|
||||
new_message(client, recv_mtags, &mtags);
|
||||
RunHook4(HOOKTYPE_TOPIC, client, channel, mtags, topic);
|
||||
sendto_server(client, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
client->id, channel->chname, channel->topic_nick,
|
||||
client->id, channel->name, channel->topic_nick,
|
||||
(long long)channel->topic_time, channel->topic);
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s TOPIC %s :%s",
|
||||
client->name, channel->chname, channel->topic);
|
||||
client->name, channel->name, channel->topic);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
return;
|
||||
@@ -196,7 +196,7 @@ CMD_FUNC(cmd_topic)
|
||||
{
|
||||
if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, channel, NULL))
|
||||
{
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->chname);
|
||||
sendnumeric(client, ERR_CHANOPRIVSNEEDED, channel->name);
|
||||
return;
|
||||
}
|
||||
topicoverride(client, channel, topic);
|
||||
@@ -211,7 +211,7 @@ CMD_FUNC(cmd_topic)
|
||||
|
||||
if (MyUser(client) && !ValidatePermissionsForPath("channel:override:topic", client, NULL, channel, NULL))
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf), "You cannot change the topic on %s while being banned", channel->chname);
|
||||
ircsnprintf(buf, sizeof(buf), "You cannot change the topic on %s while being banned", channel->name);
|
||||
sendnumeric(client, ERR_CANNOTDOCOMMAND, "TOPIC", buf);
|
||||
return;
|
||||
}
|
||||
@@ -230,7 +230,7 @@ CMD_FUNC(cmd_topic)
|
||||
topicoverride(client, channel, topic);
|
||||
} else {
|
||||
/* With +m and -t, only voice and higher may change the topic */
|
||||
ircsnprintf(buf, sizeof(buf), "Voice (+v) or higher is required in order to change the topic on %s (channel is +m)", channel->chname);
|
||||
ircsnprintf(buf, sizeof(buf), "Voice (+v) or higher is required in order to change the topic on %s (channel is +m)", channel->name);
|
||||
sendnumeric(client, ERR_CANNOTDOCOMMAND, "TOPIC", buf);
|
||||
return;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ CMD_FUNC(cmd_topic)
|
||||
Hook *tmphook;
|
||||
int n;
|
||||
|
||||
if (match_spamfilter(client, topic, SPAMF_TOPIC, "TOPIC", channel->chname, 0, NULL))
|
||||
if (match_spamfilter(client, topic, SPAMF_TOPIC, "TOPIC", channel->name, 0, NULL))
|
||||
return;
|
||||
|
||||
for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_TOPIC]; tmphook; tmphook = tmphook->next) {
|
||||
@@ -272,10 +272,10 @@ CMD_FUNC(cmd_topic)
|
||||
new_message(client, recv_mtags, &mtags);
|
||||
RunHook4(HOOKTYPE_TOPIC, client, channel, mtags, topic);
|
||||
sendto_server(client, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
client->id, channel->chname, channel->topic_nick,
|
||||
client->id, channel->name, channel->topic_nick,
|
||||
(long long)channel->topic_time, channel->topic);
|
||||
sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
":%s TOPIC %s :%s",
|
||||
client->name, channel->chname, channel->topic);
|
||||
client->name, channel->name, channel->topic);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ int nokick_can_kick(Client *client, Client *target, Channel *channel, char *comm
|
||||
|
||||
sendnotice(target,
|
||||
"*** umode q: %s tried to kick you from channel %s (%s)",
|
||||
client->name, channel->chname, comment);
|
||||
client->name, channel->name, comment);
|
||||
|
||||
return EX_ALWAYS_DENY;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ CMD_FUNC(cmd_who)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((target_channel = find_channel(mask, NULL)) != NULL)
|
||||
if ((target_channel = find_channel(mask)) != NULL)
|
||||
{
|
||||
do_channel_who(client, target_channel, mask);
|
||||
sendnumeric(client, RPL_ENDOFWHO, mask);
|
||||
@@ -163,7 +163,7 @@ CMD_FUNC(cmd_who)
|
||||
}
|
||||
|
||||
if (wfl.channel && wfl.want_channel == WHO_WANT &&
|
||||
(target_channel = find_channel(wfl.channel, NULL)) != NULL)
|
||||
(target_channel = find_channel(wfl.channel)) != NULL)
|
||||
{
|
||||
do_channel_who(client, target_channel, mask);
|
||||
sendnumeric(client, RPL_ENDOFWHO, mask);
|
||||
@@ -418,7 +418,7 @@ static int can_see(Client *requester, Client *target, Channel *channel)
|
||||
/* if they only want people on a certain channel. */
|
||||
if (wfl.want_channel != WHO_DONTCARE)
|
||||
{
|
||||
Channel *chan = find_channel(wfl.channel, NULL);
|
||||
Channel *chan = find_channel(wfl.channel);
|
||||
if (!chan && wfl.want_channel == WHO_WANT)
|
||||
return WHO_CANTSEE;
|
||||
if ((wfl.want_channel == WHO_WANT) && !IsMember(target, chan))
|
||||
@@ -602,7 +602,7 @@ static void do_channel_who(Client *client, Channel *channel, char *mask)
|
||||
continue;
|
||||
|
||||
make_who_status(client, acptr, channel, cm, status, cansee);
|
||||
send_who_reply(client, acptr, channel->chname, status, "");
|
||||
send_who_reply(client, acptr, channel->name, status, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ static char *first_visible_channel(Client *client, Client *acptr, int *flg)
|
||||
*flg |= FVC_HIDDEN;
|
||||
|
||||
if (showchannel)
|
||||
return channel->chname;
|
||||
return channel->name;
|
||||
}
|
||||
|
||||
/* no channels that they can see */
|
||||
|
||||
+3
-3
@@ -196,7 +196,7 @@ CMD_FUNC(cmd_whois)
|
||||
if (showchannel)
|
||||
{
|
||||
long access;
|
||||
if (len + strlen(channel->chname) > (size_t)BUFSIZE - 4 - mlen)
|
||||
if (len + strlen(channel->name) > (size_t)BUFSIZE - 4 - mlen)
|
||||
{
|
||||
sendto_one(client, NULL,
|
||||
":%s %d %s %s :%s",
|
||||
@@ -258,8 +258,8 @@ CMD_FUNC(cmd_whois)
|
||||
}
|
||||
if (len)
|
||||
*(buf + len) = '\0';
|
||||
strcpy(buf + len, channel->chname);
|
||||
len += strlen(channel->chname);
|
||||
strcpy(buf + len, channel->name);
|
||||
len += strlen(channel->name);
|
||||
strcat(buf + len, " ");
|
||||
len++;
|
||||
}
|
||||
|
||||
+3
-3
@@ -342,7 +342,7 @@ CMD_FUNC(cmd_whox)
|
||||
Channel *channel = NULL;
|
||||
|
||||
/* List all users on a given channel */
|
||||
if ((channel = find_channel(orig_mask, NULL)) != NULL)
|
||||
if ((channel = find_channel(orig_mask)) != NULL)
|
||||
{
|
||||
if (IsMember(client, channel) || operspy)
|
||||
do_who_on_channel(client, channel, 1, operspy, &fmt);
|
||||
@@ -761,7 +761,7 @@ static void do_who(Client *client, Client *acptr, Channel *channel, struct who_f
|
||||
else
|
||||
host = GetHost(acptr);
|
||||
sendnumeric(client, RPL_WHOREPLY,
|
||||
channel ? channel->chname : "*",
|
||||
channel ? channel->name : "*",
|
||||
acptr->user->username, host,
|
||||
hide ? "*" : acptr->user->server,
|
||||
acptr->name, status, hide ? 0 : acptr->hopcount, acptr->info);
|
||||
@@ -773,7 +773,7 @@ static void do_who(Client *client, Client *acptr, Channel *channel, struct who_f
|
||||
if (HasField(fmt, FIELD_QUERYTYPE))
|
||||
append_format(str, sizeof str, &pos, " %s", fmt->querytype);
|
||||
if (HasField(fmt, FIELD_CHANNEL))
|
||||
append_format(str, sizeof str, &pos, " %s", channel ? channel->chname : "*");
|
||||
append_format(str, sizeof str, &pos, " %s", channel ? channel->name : "*");
|
||||
if (HasField(fmt, FIELD_USER))
|
||||
append_format(str, sizeof str, &pos, " %s", acptr->user->username);
|
||||
if (HasField(fmt, FIELD_IP))
|
||||
|
||||
+4
-2
@@ -203,7 +203,9 @@ void parse(Client *cptr, char *buffer, int length)
|
||||
strlcpy(backupbuf, buffer, sizeof(backupbuf));
|
||||
|
||||
#if defined(DEBUGMODE) && defined(RAWCMDLOGGING)
|
||||
ircd_log(LOG_ERROR, "<- %s: %s", cptr->name, backupbuf);
|
||||
unreal_log(ULOG_INFO, "traffic", "TRAFFIC_IN", cptr,
|
||||
"<- $client: $data",
|
||||
log_data_string("data", backupbuf));
|
||||
#endif
|
||||
|
||||
/* This poisons unused para elements that code should never access */
|
||||
@@ -723,7 +725,7 @@ static int do_numeric(int numeric, Client *client, MessageTag *recv_mtags, int p
|
||||
sendto_prefix_one(acptr, client, recv_mtags, ":%s %d %s",
|
||||
client->name, numeric, buffer);
|
||||
}
|
||||
else if ((channel = find_channel(nick, NULL)))
|
||||
else if ((channel = find_channel(nick)))
|
||||
{
|
||||
sendto_channel(channel, client, client->direction,
|
||||
0, 0, SEND_ALL, recv_mtags,
|
||||
|
||||
+4
-2
@@ -344,7 +344,9 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick)
|
||||
if (p) *p = '\0';
|
||||
p = strchr(copy, '\r');
|
||||
if (p) *p = '\0';
|
||||
ircd_log(LOG_ERROR, "-> %s: %s", to->name, copy);
|
||||
unreal_log(ULOG_INFO, "traffic", "TRAFFIC_OUT", to,
|
||||
"-> $client: $data",
|
||||
log_data_string("data", copy));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -410,7 +412,7 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick)
|
||||
* sendnumeric(client, ERR_NEEDMOREPARAMS, "SAYHELLO");
|
||||
* return;
|
||||
* }
|
||||
* channel = find_channel(parv[1], NULL);
|
||||
* channel = find_channel(parv[1]);
|
||||
* if (!channel)
|
||||
* {
|
||||
* sendnumeric(client, ERR_NOSUCHCHANNEL, parv[1]);
|
||||
|
||||
+30
-87
@@ -425,10 +425,10 @@ CMD_FUNC(cmd_error)
|
||||
return;
|
||||
}
|
||||
|
||||
sendto_umode_global(UMODE_OPER, "ERROR from server %s: %s",
|
||||
get_client_name(client, FALSE), para);
|
||||
ircd_log(LOG_ERROR, "ERROR from server %s: %s",
|
||||
get_client_name(client, FALSE), para);
|
||||
unreal_log(ULOG_ERROR, "link", "LINK_ERROR_MESSAGE", client,
|
||||
"Error from $client: $error_message",
|
||||
log_data_string("error_message", para),
|
||||
client->serv->conf ? log_data_link_block(client->serv->conf) : NULL);
|
||||
}
|
||||
|
||||
/** Save the tunefile (such as: highest seen connection count) */
|
||||
@@ -439,11 +439,11 @@ EVENT(save_tunefile)
|
||||
tunefile = fopen(conf_files->tune_file, "w");
|
||||
if (!tunefile)
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(_AMIGA)
|
||||
sendto_ops("Unable to write tunefile.. %s", strerror(errno));
|
||||
#else
|
||||
sendto_ops("Unable to write tunefile..");
|
||||
#endif
|
||||
char *errstr = strerror(errno);
|
||||
unreal_log(ULOG_WARNING, "config", "WRITE_TUNE_FILE_FAILED", NULL,
|
||||
"Unable to write tunefile '$filename': $system_error",
|
||||
log_data_string("filename", conf_files->tune_file),
|
||||
log_data_string("system_error", errstr));
|
||||
return;
|
||||
}
|
||||
fprintf(tunefile, "0\n");
|
||||
@@ -461,13 +461,15 @@ void load_tunefile(void)
|
||||
if (!tunefile)
|
||||
return;
|
||||
fprintf(stderr, "Loading tunefile..\n");
|
||||
if (!fgets(buf, sizeof(buf), tunefile))
|
||||
fprintf(stderr, "Warning: error while reading the timestamp offset from the tunefile%s%s\n",
|
||||
errno? ": ": "", errno? strerror(errno): "");
|
||||
|
||||
if (!fgets(buf, sizeof(buf), tunefile))
|
||||
fprintf(stderr, "Warning: error while reading the peak user count from the tunefile%s%s\n",
|
||||
errno? ": ": "", errno? strerror(errno): "");
|
||||
/* We ignore the first line, hence the weird looking double fgets here... */
|
||||
if (!fgets(buf, sizeof(buf), tunefile) || !fgets(buf, sizeof(buf), tunefile))
|
||||
{
|
||||
char *errstr = strerror(errno);
|
||||
unreal_log(ULOG_WARNING, "config", "READ_TUNE_FILE_FAILED", NULL,
|
||||
"Unable to read tunefile '$filename': $system_error",
|
||||
log_data_string("filename", conf_files->tune_file),
|
||||
log_data_string("system_error", errstr));
|
||||
}
|
||||
irccounts.me_max = atol(buf);
|
||||
fclose(tunefile);
|
||||
}
|
||||
@@ -568,12 +570,9 @@ CMD_FUNC(cmd_rehash)
|
||||
sendnotice(client, "A rehash is already in progress");
|
||||
return;
|
||||
}
|
||||
sendto_umode_global(UMODE_OPER, "%s is remotely rehashing server %s config file", client->name, me.name);
|
||||
unreal_log(ULOG_INFO, "config", "CONFIG_RELOAD", client, "Rehashing server configuration file [by: $client.nuh]");
|
||||
remote_rehash_client = client;
|
||||
reread_motdsandrules();
|
||||
// TODO: clean this next line up, wtf man.
|
||||
rehash(client, (parc > 1) ? ((*parv[1] == 'q') ? 2 : 0) : 0);
|
||||
return;
|
||||
/* fallthrough... so we deal with this the same way as local rehashes */
|
||||
}
|
||||
parv[1] = parv[2];
|
||||
} else {
|
||||
@@ -589,16 +588,6 @@ CMD_FUNC(cmd_rehash)
|
||||
parv[1] = parv[2];
|
||||
parv[2] = NULL;
|
||||
parc--;
|
||||
/* Only netadmins may use /REHASH -global, which is because:
|
||||
* a) it makes sense
|
||||
* b) remote servers don't support remote rehashes by non-netadmins
|
||||
*/
|
||||
if (!ValidatePermissionsForPath("server:rehash",client,NULL,NULL,NULL))
|
||||
{
|
||||
sendnumeric(client, ERR_NOPRIVILEGES);
|
||||
sendnotice(client, "'/REHASH -global' requires you to have server::rehash permissions");
|
||||
return;
|
||||
}
|
||||
if (parv[1] && *parv[1] != '-')
|
||||
{
|
||||
sendnotice(client, "You cannot specify a server name after /REHASH -global, for obvious reasons");
|
||||
@@ -620,13 +609,6 @@ CMD_FUNC(cmd_rehash)
|
||||
|
||||
if (!BadPtr(parv[1]) && strcasecmp(parv[1], "-all"))
|
||||
{
|
||||
|
||||
if (!ValidatePermissionsForPath("server:rehash",client,NULL,NULL,NULL))
|
||||
{
|
||||
sendnumeric(client, ERR_NOPRIVILEGES);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*parv[1] == '-')
|
||||
{
|
||||
if (!strncasecmp("-gar", parv[1], 4))
|
||||
@@ -642,47 +624,10 @@ CMD_FUNC(cmd_rehash)
|
||||
}
|
||||
if (match_simple("-ssl*", parv[1]) || match_simple("-tls*", parv[1]))
|
||||
{
|
||||
if (IsUser(client))
|
||||
{
|
||||
sendto_realops_and_log("%s (%s@%s) requested a reload of all SSL related data (/rehash -tls)",
|
||||
client->name, client->user->username, client->user->realhost);
|
||||
} else {
|
||||
sendto_realops_and_log("%s requested a reload of all SSL related data (/rehash -tls)",
|
||||
client->name);
|
||||
}
|
||||
unreal_log(ULOG_INFO, "config", "CONFIG_RELOAD_TLS", client, "Reloading all TLS related data. [by: $client.nuh]");
|
||||
reinit_tls();
|
||||
return;
|
||||
}
|
||||
if (match_simple("-o*motd", parv[1]))
|
||||
{
|
||||
if (MyUser(client))
|
||||
sendto_ops("Rehashing OPERMOTD on request of %s", client->name);
|
||||
else
|
||||
sendto_umode_global(UMODE_OPER, "Remotely rehashing OPERMOTD on request of %s", client->name);
|
||||
read_motd(conf_files->opermotd_file, &opermotd);
|
||||
RunHook2(HOOKTYPE_REHASHFLAG, client, parv[1]);
|
||||
return;
|
||||
}
|
||||
if (match_simple("-b*motd", parv[1]))
|
||||
{
|
||||
if (MyUser(client))
|
||||
sendto_ops("Rehashing BOTMOTD on request of %s", client->name);
|
||||
else
|
||||
sendto_umode_global(UMODE_OPER, "Remotely rehashing BOTMOTD on request of %s", client->name);
|
||||
read_motd(conf_files->botmotd_file, &botmotd);
|
||||
RunHook2(HOOKTYPE_REHASHFLAG, client, parv[1]);
|
||||
return;
|
||||
}
|
||||
if (!strncasecmp("-motd", parv[1], 5) || !strncasecmp("-rules", parv[1], 6))
|
||||
{
|
||||
if (MyUser(client))
|
||||
sendto_ops("Rehashing all MOTDs and RULES on request of %s", client->name);
|
||||
else
|
||||
sendto_umode_global(UMODE_OPER, "Remotely rehasing all MOTDs and RULES on request of %s", client->name);
|
||||
rehash_motdrules();
|
||||
RunHook2(HOOKTYPE_REHASHFLAG, client, parv[1]);
|
||||
return;
|
||||
}
|
||||
RunHook2(HOOKTYPE_REHASHFLAG, client, parv[1]);
|
||||
return;
|
||||
}
|
||||
@@ -691,17 +636,15 @@ CMD_FUNC(cmd_rehash)
|
||||
{
|
||||
if (loop.ircd_rehashing)
|
||||
{
|
||||
sendnotice(client, "A rehash is already in progress");
|
||||
sendnotice(client, "ERROR: A rehash is already in progress");
|
||||
return;
|
||||
}
|
||||
sendto_ops("%s is rehashing server config file", client->name);
|
||||
unreal_log(ULOG_INFO, "config", "CONFIG_RELOAD", client, "Rehashing server configuration file [by: $client.nuh]");
|
||||
}
|
||||
|
||||
/* Normal rehash, rehash motds&rules too, just like the on in the tld block will :p */
|
||||
sendnumeric(client, RPL_REHASHING, configfile);
|
||||
// TODO: fix next line - occurence #2
|
||||
x = rehash(client, (parc > 1) ? ((*parv[1] == 'q') ? 2 : 0) : 0);
|
||||
reread_motdsandrules();
|
||||
x = rehash(client, 0);
|
||||
}
|
||||
|
||||
/** RESTART command - restart the server (discouraged command)
|
||||
@@ -745,7 +688,6 @@ CMD_FUNC(cmd_restart)
|
||||
reason = parv[2];
|
||||
}
|
||||
}
|
||||
sendto_ops("Server is Restarting by request of %s", client->name);
|
||||
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
{
|
||||
@@ -1050,7 +992,8 @@ CMD_FUNC(cmd_die)
|
||||
}
|
||||
|
||||
/* Let the +s know what is going on */
|
||||
sendto_ops("Server Terminating by request of %s", client->name);
|
||||
unreal_log(ULOG_INFO, "main", "UNREALIRCD_STOP", client,
|
||||
"Terminating server by request of $client.nuh");
|
||||
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
{
|
||||
@@ -1245,10 +1188,10 @@ void charsys_check_for_changes(void)
|
||||
|
||||
if (strcmp(langsinuse, previous_langsinuse))
|
||||
{
|
||||
ircd_log(LOG_ERROR, "Permitted nick characters changed at runtime: %s -> %s",
|
||||
previous_langsinuse, langsinuse);
|
||||
sendto_realops("Permitted nick characters changed at runtime: %s -> %s",
|
||||
previous_langsinuse, langsinuse);
|
||||
unreal_log(ULOG_INFO, "charsys", "NICKCHARS_CHANGED", NULL,
|
||||
"Permitted nick characters changed at runtime: $old_nickchars -> $new_nickchars",
|
||||
log_data_string("old_nickchars", previous_langsinuse),
|
||||
log_data_string("new_nickchars", langsinuse));
|
||||
/* Broadcast change to all (locally connected) servers */
|
||||
sendto_server(NULL, 0, 0, NULL, "PROTOCTL NICKCHARS=%s", langsinuse);
|
||||
}
|
||||
|
||||
+5
-5
@@ -745,7 +745,7 @@ void set_sock_opts(int fd, Client *client, int ipv6)
|
||||
opt = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0)
|
||||
{
|
||||
unreal_log(ULOG_WARN, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
unreal_log(ULOG_WARNING, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
"Could not setsockopt(SO_REUSEADDR): $socket_error",
|
||||
log_data_socket_error(-1));
|
||||
}
|
||||
@@ -755,7 +755,7 @@ void set_sock_opts(int fd, Client *client, int ipv6)
|
||||
opt = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_USELOOPBACK, (void *)&opt, sizeof(opt)) < 0)
|
||||
{
|
||||
unreal_log(ULOG_WARN, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
unreal_log(ULOG_WARNING, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
"Could not setsockopt(SO_USELOOPBACK): $socket_error",
|
||||
log_data_socket_error(-1));
|
||||
}
|
||||
@@ -772,7 +772,7 @@ void set_sock_opts(int fd, Client *client, int ipv6)
|
||||
{
|
||||
if (client)
|
||||
{
|
||||
unreal_log(ULOG_WARN, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
unreal_log(ULOG_WARNING, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
"Could not get socket options (F_GETFL): $socket_error",
|
||||
log_data_socket_error(-1));
|
||||
}
|
||||
@@ -781,7 +781,7 @@ void set_sock_opts(int fd, Client *client, int ipv6)
|
||||
{
|
||||
if (client)
|
||||
{
|
||||
unreal_log(ULOG_WARN, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
unreal_log(ULOG_WARNING, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
"Could not get socket options (F_SETFL): $socket_error",
|
||||
log_data_socket_error(-1));
|
||||
}
|
||||
@@ -792,7 +792,7 @@ void set_sock_opts(int fd, Client *client, int ipv6)
|
||||
{
|
||||
if (client)
|
||||
{
|
||||
unreal_log(ULOG_WARN, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
unreal_log(ULOG_WARNING, "socket", "SOCKET_ERROR_SETSOCKOPTS", client,
|
||||
"Could not ioctlsocket FIONBIO: $socket_error",
|
||||
log_data_socket_error(-1));
|
||||
}
|
||||
|
||||
+8
-9
@@ -947,7 +947,11 @@ char *get_connect_extinfo(Client *client)
|
||||
|
||||
/* And some built-in: */
|
||||
|
||||
/* "class": this should be first */
|
||||
/* "vhost": this should be first */
|
||||
if (IsHidden(client))
|
||||
add_nvplist(&list, -1000000, "vhost", client->user->virthost);
|
||||
|
||||
/* "class": second */
|
||||
if (MyUser(client) && client->local->class)
|
||||
add_nvplist(&list, -100000, "class", client->local->class->name);
|
||||
|
||||
@@ -994,14 +998,9 @@ void flood_limit_exceeded_log(Client *client, char *floodname)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Flood blocked (%s) from %s!%s@%s [%s]",
|
||||
floodname,
|
||||
client->name,
|
||||
client->user->username,
|
||||
client->user->realhost,
|
||||
GetIP(client));
|
||||
ircd_log(LOG_FLOOD, "%s", buf);
|
||||
sendto_snomask_global(SNO_FLOOD, "%s", buf);
|
||||
unreal_log(ULOG_INFO, "flood", "FLOOD_BLOCKED", client,
|
||||
"Flood blocked ($flood_type) from $client.nuh [$client.ip]",
|
||||
log_data_string("flood_type", floodname));
|
||||
}
|
||||
|
||||
/** Is the flood limit exceeded for an option? eg for away-flood.
|
||||
|
||||
Reference in New Issue
Block a user