mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-07 01:03:12 +02:00
Remove 'cptr' from all commands, hooks, etc. It only confuses people and
'sptr' is sufficient and in most cases the only one you should care about. Should you need it, you can access sptr->direction in cases where you need the old information (usually only for some sendto_* functions and some protoctl checks), so 'cptr' was redundant too. [!] This change likely introduces some bugs. This was many hours of work. I only cut some corners in 4 functions, which will be fixed at a later stage..... yes, more major changes to come. On the plus side, I likely fixed some bugs in the process. Situations where cptr vs sptr usage was incorrect. Eg using cptr->name (near server) when sptr->name should be used (the actual source server), etc....
This commit is contained in:
+16
-17
@@ -233,7 +233,7 @@ extern int verify_hostname(char *name);
|
||||
extern void report_error(char *, Client *);
|
||||
extern int setup_ping();
|
||||
|
||||
extern void set_channel_mlock(Client *, Client *, Channel *, const char *, int);
|
||||
extern void set_channel_mlock(Client *, Channel *, const char *, int);
|
||||
|
||||
extern void restart(char *);
|
||||
extern void server_reboot(char *);
|
||||
@@ -297,8 +297,7 @@ extern char *make_nick_user_host(char *, char *, char *);
|
||||
extern char *make_nick_user_host_r(char *namebuf, char *nick, char *name, char *host);
|
||||
extern char *make_user_host(char *, char *);
|
||||
extern int parse(Client *cptr, char *buffer, int length);
|
||||
extern int do_numeric(int, Client *, Client *, MessageTag *, int, char **);
|
||||
extern int hunt_server(Client *, Client *, MessageTag *, char *, int, int, char **);
|
||||
extern int hunt_server(Client *, MessageTag *, char *, int, int, char **);
|
||||
extern int cmd_server_estab(Client *);
|
||||
extern void umode_init(void);
|
||||
#define UMODE_GLOBAL 1
|
||||
@@ -308,8 +307,8 @@ extern int umode_allow_unset(Client *sptr, int what);
|
||||
extern int umode_allow_opers(Client *sptr, int what);
|
||||
extern int umode_allow_none(Client *sptr, int what);
|
||||
extern int umode_delete(char ch, long val);
|
||||
extern void send_umode(Client *, Client *, long, long, char *);
|
||||
extern void send_umode_out(Client *, Client *, long);
|
||||
extern void build_umode_string(Client *sptr, long old, long sendmask, char *umode_buf);
|
||||
extern void send_umode_out(Client *sptr, int show_to_user, long old);
|
||||
|
||||
extern void free_client(Client *);
|
||||
extern void free_link(Link *);
|
||||
@@ -466,7 +465,7 @@ extern void report_dynconf(Client *sptr);
|
||||
extern void count_memory(Client *cptr, char *nick);
|
||||
extern void list_scache(Client *sptr);
|
||||
extern char *oflagstr(long oflag);
|
||||
extern int rehash(Client *cptr, Client *sptr, int sig);
|
||||
extern int rehash(Client *sptr, int sig);
|
||||
extern int match_simple(const char *mask, const char *name);
|
||||
extern int match_esc(const char *mask, const char *name);
|
||||
extern int add_listener(ConfigItem_listen *conf);
|
||||
@@ -655,7 +654,7 @@ extern void efunctions_switchover(void);
|
||||
extern char *encode_ip(char *);
|
||||
extern char *decode_ip(char *);
|
||||
extern void sendto_fconnectnotice(Client *sptr, int disconnect, char *comment);
|
||||
extern void sendto_one_nickcmd(Client *cptr, Client *sptr, char *umodes);
|
||||
extern void sendto_one_nickcmd(Client *server, Client *client, char *umodes)
|
||||
extern int on_dccallow_list(Client *to, Client *from);
|
||||
extern int add_dccallow(Client *sptr, Client *optr);
|
||||
extern int del_dccallow(Client *sptr, Client *optr);
|
||||
@@ -665,20 +664,20 @@ extern void del_async_connects(void);
|
||||
extern void isupport_init(void);
|
||||
extern void clicap_init(void);
|
||||
extern void efunctions_init(void);
|
||||
extern int do_cmd(Client *cptr, Client *sptr, MessageTag *mtags, char *cmd, int parc, char *parv[]);
|
||||
extern int do_cmd(Client *sptr, MessageTag *mtags, char *cmd, int parc, char *parv[]);
|
||||
extern MODVAR char *me_hash;
|
||||
extern MODVAR int dontspread;
|
||||
extern MODVAR int labeled_response_inhibit;
|
||||
|
||||
/* Efuncs */
|
||||
extern MODVAR int (*do_join)(Client *, Client *, int, char **);
|
||||
extern MODVAR void (*join_channel)(Channel *chptr, Client *cptr, Client *sptr, MessageTag *mtags, int flags);
|
||||
extern MODVAR int (*can_join)(Client *cptr, Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
extern MODVAR void (*do_mode)(Channel *chptr, Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode);
|
||||
extern MODVAR int (*do_join)(Client *, int, char **);
|
||||
extern MODVAR void (*join_channel)(Channel *chptr, Client *sptr, MessageTag *mtags, int flags);
|
||||
extern MODVAR int (*can_join)(Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
extern MODVAR void (*do_mode)(Channel *chptr, Client *sptr, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode);
|
||||
extern MODVAR void (*set_mode)(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcount,
|
||||
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
|
||||
extern MODVAR int (*cmd_umode)(Client *, Client *, MessageTag *, int, char **);
|
||||
extern MODVAR int (*register_user)(Client *cptr, Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip);
|
||||
extern MODVAR int (*cmd_umode)(Client *, MessageTag *, int, char **);
|
||||
extern MODVAR int (*register_user)(Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip);
|
||||
extern MODVAR int (*tkl_hash)(unsigned int c);
|
||||
extern MODVAR char (*tkl_typetochar)(int type);
|
||||
extern MODVAR int (*tkl_chartotype)(char c);
|
||||
@@ -709,7 +708,7 @@ extern MODVAR TKL *(*find_qline)(Client *cptr, char *nick, int *ishold);
|
||||
extern MODVAR TKL *(*find_tkline_match_zap)(Client *cptr);
|
||||
extern MODVAR void (*tkl_stats)(Client *cptr, int type, char *para);
|
||||
extern MODVAR void (*tkl_synch)(Client *sptr);
|
||||
extern MODVAR int (*cmd_tkl)(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[]);
|
||||
extern MODVAR int (*cmd_tkl)(Client *sptr, MessageTag *recv_mtags, int parc, char *parv[]);
|
||||
extern MODVAR int (*place_host_ban)(Client *sptr, BanAction action, char *reason, long duration);
|
||||
extern MODVAR int (*run_spamfilter)(Client *sptr, char *str_in, int type, char *target, int flags, TKL **rettk);
|
||||
extern MODVAR int (*join_viruschan)(Client *sptr, TKL *tk, int type);
|
||||
@@ -717,7 +716,7 @@ extern MODVAR unsigned char *(*StripColors)(unsigned char *text);
|
||||
extern MODVAR const char *(*StripControlCodes)(unsigned char *text);
|
||||
extern MODVAR void (*spamfilter_build_user_string)(char *buf, char *nick, Client *acptr);
|
||||
extern MODVAR void (*send_protoctl_servers)(Client *sptr, int response);
|
||||
extern MODVAR int (*verify_link)(Client *cptr, Client *sptr, char *servername, ConfigItem_link **link_out);
|
||||
extern MODVAR int (*verify_link)(Client *sptr, char *servername, ConfigItem_link **link_out);
|
||||
extern MODVAR void (*send_server_message)(Client *sptr);
|
||||
extern MODVAR void (*broadcast_md_client)(ModDataInfo *mdi, Client *acptr, ModData *md);
|
||||
extern MODVAR void (*broadcast_md_channel)(ModDataInfo *mdi, Channel *chptr, ModData *md);
|
||||
@@ -860,7 +859,7 @@ extern CMD_FUNC(cmd_module);
|
||||
extern CMD_FUNC(cmd_rehash);
|
||||
extern CMD_FUNC(cmd_die);
|
||||
extern CMD_FUNC(cmd_restart);
|
||||
extern int cmd_alias(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], char *cmd); /* special! */
|
||||
extern int cmd_alias(Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], char *cmd); /* special! */
|
||||
extern int ban_flooder(Client *cptr);
|
||||
extern char *pcre2_version(void);
|
||||
extern int has_common_channels(Client *c1, Client *c2);
|
||||
|
||||
+19
-19
@@ -803,7 +803,7 @@ extern int CommandExists(char *name);
|
||||
extern CommandOverride *CommandOverrideAdd(Module *module, char *cmd, OverrideCmdFunc func);
|
||||
extern CommandOverride *CommandOverrideAddEx(Module *module, char *name, int priority, OverrideCmdFunc func);
|
||||
extern void CommandOverrideDel(CommandOverride *ovr);
|
||||
extern int CallCommandOverride(CommandOverride *ovr, Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
extern int CallCommandOverride(CommandOverride *ovr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
|
||||
extern void moddata_free_client(Client *acptr);
|
||||
extern void moddata_free_local_client(Client *acptr);
|
||||
@@ -954,30 +954,30 @@ int hooktype_unkuser_quit(Client *sptr, MessageTag *mtags, char *comment);
|
||||
int hooktype_pre_local_connect(Client *sptr);
|
||||
int hooktype_server_quit(Client *sptr, MessageTag *mtags);
|
||||
int hooktype_local_nickchange(Client *sptr, char *newnick);
|
||||
int hooktype_remote_nickchange(Client *cptr, Client *sptr, char *newnick);
|
||||
int hooktype_remote_nickchange(Client *sptr, char *newnick);
|
||||
int hooktype_can_join(Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
int hooktype_pre_local_join(Client *sptr, Channel *chptr, char *parv[]);
|
||||
int hooktype_local_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int hooktype_remote_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int hooktype_local_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int hooktype_remote_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
char *hooktype_pre_local_part(Client *sptr, Channel *chptr, char *comment);
|
||||
int hooktype_local_part(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int hooktype_remote_part(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int hooktype_local_part(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int hooktype_remote_part(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
char *hooktype_pre_local_kick(Client *sptr, Client *victim, Channel *chptr, char *comment);
|
||||
int hooktype_can_kick(Client *sptr, Client *victim, Channel *chptr, char *comment, long sptr_flags, long victim_flags, char **error);
|
||||
int hooktype_local_kick(Client *cptr, Client *sptr, Client *victim, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int hooktype_remote_kick(Client *cptr, Client *sptr, Client *victim, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int hooktype_local_kick(Client *sptr, Client *victim, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int hooktype_remote_kick(Client *sptr, Client *victim, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
char *hooktype_pre_usermsg(Client *sptr, Client *to, char *text, int notice);
|
||||
int hooktype_usermsg(Client *sptr, Client *to, MessageTag *mtags, char *text, int notice);
|
||||
int hooktype_can_send(Client *sptr, Channel *chptr, Membership *member, char **text, char **errmsg, int notice);
|
||||
char *hooktype_pre_chanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, char *text, int notice);
|
||||
int hooktype_chanmsg(Client *sptr, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice);
|
||||
char *hooktype_pre_local_topic(Client *cptr, Client *sptr, Channel *chptr, char *topic);
|
||||
int hooktype_local_topic(Client *cptr, Client *sptr, Channel *chptr, char *topic);
|
||||
int hooktype_topic(Client *cptr, Client *sptr, Channel *chptr, char *topic);
|
||||
int hooktype_pre_local_chanmode(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
int hooktype_pre_remote_chanmode(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
int hooktype_local_chanmode(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
int hooktype_remote_chanmode(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
char *hooktype_pre_local_topic(Client *sptr, Channel *chptr, char *topic);
|
||||
int hooktype_local_topic(Client *sptr, Channel *chptr, char *topic);
|
||||
int hooktype_topic(Client *sptr, Channel *chptr, char *topic);
|
||||
int hooktype_pre_local_chanmode(Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
int hooktype_pre_remote_chanmode(Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
int hooktype_local_chanmode(Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
int hooktype_remote_chanmode(Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
int hooktype_modechar_del(Channel *chptr, int modechar);
|
||||
int hooktype_modechar_add(Channel *chptr, int modechar);
|
||||
int hooktype_away(Client *sptr, MessageTag *mtags, char *reason);
|
||||
@@ -989,7 +989,7 @@ int hooktype_whois(Client *sptr, Client *target);
|
||||
int hooktype_who_status(Client *sptr, Client *target, Channel *chptr, Member *member, char *status, int cansee);
|
||||
int hooktype_pre_kill(Client *sptr, Client *victim, char *killpath);
|
||||
int hooktype_local_kill(Client *sptr, Client *victim, char *comment);
|
||||
int hooktype_rehashflag(Client *cptr, Client *sptr, char *str);
|
||||
int hooktype_rehashflag(Client *sptr, char *str);
|
||||
int hooktype_configposttest(int *errors);
|
||||
int hooktype_rehash(void);
|
||||
int hooktype_stats(Client *sptr, char *str);
|
||||
@@ -1003,11 +1003,11 @@ int hooktype_channel_destroy(Channel *chptr, int *should_destroy);
|
||||
int hooktype_tkl_except(Client *cptr, int ban_type);
|
||||
int hooktype_umode_change(Client *sptr, long setflags, long newflags);
|
||||
int hooktype_rehash_complete(void);
|
||||
int hooktype_tkl_add(Client *cptr, Client *sptr, TKL *tkl);
|
||||
int hooktype_tkl_del(Client *cptr, Client *sptr, TKL *tkl);
|
||||
int hooktype_tkl_add(Client *sptr, TKL *tkl);
|
||||
int hooktype_tkl_del(Client *sptr, TKL *tkl);
|
||||
int hooktype_log(int flags, char *timebuf, char *buf);
|
||||
int hooktype_local_spamfilter(Client *acptr, char *str, char *str_in, int type, char *target, TKL *tkl);
|
||||
int hooktype_silenced(Client *cptr, Client *sptr, Client *to, int notice);
|
||||
int hooktype_silenced(Client *sptr, Client *to, int notice);
|
||||
int hooktype_rawpacket_in(Client *sptr, char *readbuf, int *length);
|
||||
int hooktype_local_nickpass(Client *sptr, Client *nickserv);
|
||||
int hooktype_packet(Client *from, Client *to, Client *intended_to, char **msg, int *length);
|
||||
|
||||
+5
-37
@@ -829,45 +829,13 @@ struct SWhois {
|
||||
* @param recv_mtags Received message tags for this command.
|
||||
* @param parc Parameter count *plus* 1.
|
||||
* @param parv Parameter values.
|
||||
* @note The use of sptr and cptr often confuse people. The short answer is that in most cases you
|
||||
* will use 'sptr' (source client pointer) since that is the actual client that you should be
|
||||
* dealing with. The 'cptr' is the connected client from which the command was received.
|
||||
* This is best illustrated with an example. Consider the following toplogy:
|
||||
*
|
||||
* serverA--serverB--serverC
|
||||
* | |
|
||||
* clientA clientC
|
||||
*
|
||||
*
|
||||
* Say, *clientA* sends a message to a channel, the IRC protocol message is
|
||||
* `PRIVMSG #test :hi`. When *serverA* receives this message and calls the cmd_message()
|
||||
* command handler, *sptr* will point to clientA, and *cptr* will point to clientA as well.
|
||||
*
|
||||
* Now, *serverA* will send the channel message to serverB to deliver it to other clients.
|
||||
* The IRC protocol message is `:clientA PRIVMSG #test :hi`. When *serverB* receives this
|
||||
* message and calls the cmd_message() command handler, *sptr* will point to *clientA*,
|
||||
* but this time *cptr* will point to *serverA* (!!). That is because cptr points to the
|
||||
* local client on which this message was received, which is *serverA* in this case.
|
||||
*
|
||||
* Let's continue this example: *serverB* will send the channel message to *serverC*,
|
||||
* sending `:clientA PRIVMSG #test :hi`. On *serverC*, when it receives this
|
||||
* message it will call cmd_message() with *sptr* pointing to *clientA*, and
|
||||
* *cptr* pointing to *serverB*. It will point *cptr* to *serverB* because *serverB* is
|
||||
* the directly connected client from which this message was received.
|
||||
*
|
||||
* As you can see, **cptr says nothing about which server the client (*sptr*) is on**,
|
||||
* the only thing it specifies is the *direction* from which the message was received.
|
||||
*
|
||||
* In almost all cases you will use *sptr*. It's just that sometimes you need the direction
|
||||
* as well, such as for sending functions.
|
||||
*
|
||||
* @note Slightly confusing, but parc will be 2 if 1 parameter was provided.
|
||||
* It is two because parv will still have 2 elements, parv[1] will be your first parameter,
|
||||
* and parv[2] will be NULL.
|
||||
* Note that reading parv[parc] and beyond is OUT OF BOUNDS and will cause a crash.
|
||||
* E.g. parv[3] in the above example is out of bounds.
|
||||
*/
|
||||
#define CMD_FUNC(x) int (x) (Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[])
|
||||
#define CMD_FUNC(x) int (x) (Client *sptr, MessageTag *recv_mtags, int parc, char *parv[])
|
||||
/* @} */
|
||||
|
||||
/** Command override function - used by all command override handlers.
|
||||
@@ -884,13 +852,13 @@ struct SWhois {
|
||||
* Note that reading parv[parc] and beyond is OUT OF BOUNDS and will cause a crash.
|
||||
* E.g. parv[3] in the above example.
|
||||
*/
|
||||
#define CMD_OVERRIDE_FUNC(x) int (x)(CommandOverride *ovr, Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[])
|
||||
#define CMD_OVERRIDE_FUNC(x) int (x)(CommandOverride *ovr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[])
|
||||
|
||||
|
||||
|
||||
typedef int (*CmdFunc)(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
typedef int (*AliasCmdFunc)(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[], char *cmd);
|
||||
typedef int (*OverrideCmdFunc)(CommandOverride *ovr, Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
typedef int (*CmdFunc)(Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
typedef int (*AliasCmdFunc)(Client *sptr, MessageTag *mtags, int parc, char *parv[], char *cmd);
|
||||
typedef int (*OverrideCmdFunc)(CommandOverride *ovr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
|
||||
|
||||
/* tkl:
|
||||
|
||||
+2
-1
@@ -41,7 +41,8 @@ void strrangetok(char *in, char *out, char tok, short first, short last) {
|
||||
|
||||
/* cmd_alias is a special type of command, it has an extra argument 'cmd'. */
|
||||
static int recursive_alias = 0;
|
||||
int cmd_alias(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[], char *cmd)
|
||||
|
||||
int cmd_alias(Client *sptr, MessageTag *mtags, int parc, char *parv[], char *cmd)
|
||||
{
|
||||
ConfigItem_alias *alias;
|
||||
Client *acptr;
|
||||
|
||||
@@ -34,14 +34,14 @@ static Efunction *Efunctions[MAXEFUNCTIONS]; /* Efunction objects (used for reha
|
||||
static EfunctionsList efunction_table[MAXEFUNCTIONS];
|
||||
|
||||
/* Efuncs */
|
||||
int (*do_join)(Client *cptr, Client *sptr, int parc, char *parv[]);
|
||||
void (*join_channel)(Channel *chptr, Client *cptr, Client *sptr, MessageTag *mtags, int flags);
|
||||
int (*can_join)(Client *cptr, Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
void (*do_mode)(Channel *chptr, Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode);
|
||||
int (*do_join)(Client *sptr, int parc, char *parv[]);
|
||||
void (*join_channel)(Channel *chptr, Client *sptr, MessageTag *mtags, int flags);
|
||||
int (*can_join)(Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
void (*do_mode)(Channel *chptr, Client *sptr, MessageTag *mtags, int parc, char *parv[], time_t sendts, int samode);
|
||||
void (*set_mode)(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcount,
|
||||
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
|
||||
int (*cmd_umode)(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
int (*register_user)(Client *cptr, Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip);
|
||||
int (*cmd_umode)(Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
int (*register_user)(Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip);
|
||||
int (*tkl_hash)(unsigned int c);
|
||||
char (*tkl_typetochar)(int type);
|
||||
int (*tkl_chartotype)(char c);
|
||||
@@ -65,7 +65,7 @@ TKL *(*find_qline)(Client *cptr, char *nick, int *ishold);
|
||||
TKL *(*find_tkline_match_zap)(Client *cptr);
|
||||
void (*tkl_stats)(Client *cptr, int type, char *para);
|
||||
void (*tkl_synch)(Client *sptr);
|
||||
int (*cmd_tkl)(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
int (*cmd_tkl)(Client *sptr, MessageTag *mtags, int parc, char *parv[]);
|
||||
int (*place_host_ban)(Client *sptr, BanAction action, char *reason, long duration);
|
||||
int (*run_spamfilter)(Client *sptr, char *str_in, int type, char *target, int flags, TKL **rettk);
|
||||
int (*join_viruschan)(Client *sptr, TKL *tk, int type);
|
||||
@@ -73,7 +73,7 @@ unsigned char *(*StripColors)(unsigned char *text);
|
||||
const char *(*StripControlCodes)(unsigned char *text);
|
||||
void (*spamfilter_build_user_string)(char *buf, char *nick, Client *acptr);
|
||||
void (*send_protoctl_servers)(Client *sptr, int response);
|
||||
int (*verify_link)(Client *cptr, Client *sptr, char *servername, ConfigItem_link **link_out);
|
||||
int (*verify_link)(Client *sptr, char *servername, ConfigItem_link **link_out);
|
||||
void (*introduce_user)(Client *to, Client *acptr);
|
||||
void (*send_server_message)(Client *sptr);
|
||||
void (*broadcast_md_client)(ModDataInfo *mdi, Client *acptr, ModData *md);
|
||||
|
||||
+3
-3
@@ -234,7 +234,7 @@ void UmodeDel(Umode *umode)
|
||||
oldumode = cptr->umodes;
|
||||
cptr->umodes &= ~umode->mode;
|
||||
if (MyUser(cptr))
|
||||
send_umode_out(cptr, cptr, oldumode);
|
||||
send_umode_out(cptr, 1, oldumode);
|
||||
}
|
||||
umode->flag = '\0';
|
||||
AllUmodes &= ~(umode->mode);
|
||||
@@ -398,7 +398,7 @@ void unload_all_unused_umodes(void)
|
||||
oldumode = cptr->umodes;
|
||||
cptr->umodes &= ~(removed_umode);
|
||||
if (MyUser(cptr))
|
||||
send_umode_out(cptr, cptr, oldumode);
|
||||
send_umode_out(cptr, 1, oldumode);
|
||||
}
|
||||
for (i = 0; i < UMODETABLESZ; i++)
|
||||
{
|
||||
@@ -477,7 +477,7 @@ void remove_oper_privileges(Client *sptr, int broadcast_mode_change)
|
||||
remove_oper_modes(sptr);
|
||||
remove_oper_snomasks(sptr);
|
||||
if (broadcast_mode_change && (sptr->umodes != oldumodes))
|
||||
send_umode_out(sptr, sptr, oldumodes);
|
||||
send_umode_out(sptr, 1, oldumodes);
|
||||
if (MyUser(sptr)) /* only do if it's our client, remote servers will send a SWHOIS cmd */
|
||||
swhois_delete(sptr, "oper", "*", &me, NULL);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1157,14 +1157,14 @@ void send_user_joins(Client *cptr, Client *user)
|
||||
* output -
|
||||
* side effects - channel mlock is changed / MLOCK is propagated
|
||||
*/
|
||||
void set_channel_mlock(Client *cptr, Client *sptr, Channel *chptr, const char *newmlock, int propagate)
|
||||
void set_channel_mlock(Client *sptr, Channel *chptr, const char *newmlock, int propagate)
|
||||
{
|
||||
safe_strdup(chptr->mode_lock, newmlock);
|
||||
|
||||
if (propagate)
|
||||
{
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s MLOCK %lld %s :%s",
|
||||
cptr->name, (long long)chptr->creationtime, chptr->chname,
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s MLOCK %lld %s :%s",
|
||||
sptr->name, (long long)chptr->creationtime, chptr->chname,
|
||||
BadPtr(chptr->mode_lock) ? "" : chptr->mode_lock);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-7
@@ -283,7 +283,7 @@ int remote_include(ConfigEntry *ce);
|
||||
void unload_notloaded_includes(void);
|
||||
void load_includes(void);
|
||||
void unload_loaded_includes(void);
|
||||
int rehash_internal(Client *cptr, Client *sptr, int sig);
|
||||
int rehash_internal(Client *sptr, int sig);
|
||||
int is_blacklisted_module(char *name);
|
||||
|
||||
/** Return the printable string of a 'cep' location, such as set::something::xyz */
|
||||
@@ -9954,11 +9954,11 @@ static void conf_download_complete(const char *url, const char *file, const char
|
||||
if (inc->flag.type & INCLUDE_DLQUEUED)
|
||||
return;
|
||||
}
|
||||
rehash_internal(loop.rehash_save_cptr, loop.rehash_save_sptr, loop.rehash_save_sig);
|
||||
rehash_internal(loop.rehash_save_sptr, loop.rehash_save_sig);
|
||||
}
|
||||
#endif
|
||||
|
||||
int rehash(Client *cptr, Client *sptr, int sig)
|
||||
int rehash(Client *sptr, int sig)
|
||||
{
|
||||
#ifdef USE_LIBCURL
|
||||
ConfigItem_include *inc;
|
||||
@@ -9971,7 +9971,6 @@ int rehash(Client *cptr, Client *sptr, int sig)
|
||||
}
|
||||
|
||||
loop.ircd_rehashing = 1;
|
||||
loop.rehash_save_cptr = cptr;
|
||||
loop.rehash_save_sptr = sptr;
|
||||
loop.rehash_save_sig = sig;
|
||||
for (inc = conf_include; inc; inc = inc->next)
|
||||
@@ -9993,15 +9992,15 @@ int rehash(Client *cptr, Client *sptr, int sig)
|
||||
download_file_async(inc->url, modtime, conf_download_complete, (void *)inc);
|
||||
}
|
||||
if (!found_remote)
|
||||
return rehash_internal(cptr, sptr, sig);
|
||||
return rehash_internal(sptr, sig);
|
||||
return 0;
|
||||
#else
|
||||
loop.ircd_rehashing = 1;
|
||||
return rehash_internal(cptr, sptr, sig);
|
||||
return rehash_internal(sptr, sig);
|
||||
#endif
|
||||
}
|
||||
|
||||
int rehash_internal(Client *cptr, Client *sptr, int sig)
|
||||
int rehash_internal(Client *sptr, int sig)
|
||||
{
|
||||
if (sig == 1)
|
||||
sendto_ops("Got signal SIGHUP, reloading %s file", configfile);
|
||||
|
||||
+1
-1
@@ -1422,7 +1422,7 @@ void SocketLoop(void *dummy)
|
||||
*/
|
||||
if (dorehash)
|
||||
{
|
||||
(void)rehash(&me, &me, 1);
|
||||
(void)rehash(&me, 1);
|
||||
dorehash = 0;
|
||||
}
|
||||
if (dorestart)
|
||||
|
||||
+5
-5
@@ -794,10 +794,10 @@ CMD_FUNC(cmd_module)
|
||||
if (MyUser(sptr) && !IsOper(sptr) && all)
|
||||
sptr->local->since += 7; /* Lag them up. Big list. */
|
||||
|
||||
if ((parc > 2) && (hunt_server(cptr, sptr, recv_mtags, ":%s MODULE %s :%s", 2, parc, parv) != HUNTED_ISME))
|
||||
if ((parc > 2) && (hunt_server(sptr, recv_mtags, ":%s MODULE %s :%s", 2, parc, parv) != HUNTED_ISME))
|
||||
return 0;
|
||||
|
||||
if ((parc == 2) && (parv[1][0] != '-') && (hunt_server(cptr, sptr, recv_mtags, ":%s MODULE :%s", 1, parc, parv) != HUNTED_ISME))
|
||||
if ((parc == 2) && (parv[1][0] != '-') && (hunt_server(sptr, recv_mtags, ":%s MODULE :%s", 1, parc, parv) != HUNTED_ISME))
|
||||
return 0;
|
||||
|
||||
if (all)
|
||||
@@ -1162,11 +1162,11 @@ void CommandOverrideDel(CommandOverride *cmd)
|
||||
safe_free(cmd);
|
||||
}
|
||||
|
||||
int CallCommandOverride(CommandOverride *ovr, Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[])
|
||||
int CallCommandOverride(CommandOverride *ovr, Client *sptr, MessageTag *mtags, int parc, char *parv[])
|
||||
{
|
||||
if (ovr->next)
|
||||
return ovr->next->func(ovr->next, cptr, sptr, mtags, parc, parv);
|
||||
return ovr->command->func(cptr, sptr, mtags, parc, parv);
|
||||
return ovr->next->func(ovr->next, sptr, mtags, parc, parv);
|
||||
return ovr->command->func(sptr, mtags, parc, parv);
|
||||
}
|
||||
|
||||
EVENT(e_unload_module_delayed)
|
||||
|
||||
+8
-9
@@ -37,7 +37,7 @@ ModuleHeader MOD_HEADER
|
||||
|
||||
MOD_INIT()
|
||||
{
|
||||
CommandAdd(modinfo->handle, MSG_ADMIN, cmd_admin, MAXPARA, CMD_UNREGISTERED|CMD_USER|CMD_SHUN|CMD_VIRUS);
|
||||
CommandAdd(modinfo->handle, MSG_ADMIN, cmd_admin, MAXPARA, CMD_USER|CMD_SHUN|CMD_VIRUS);
|
||||
MARK_AS_OFFICIAL_MODULE(modinfo);
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
@@ -52,19 +52,18 @@ MOD_UNLOAD()
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
** cmd_admin
|
||||
** parv[1] = servername
|
||||
*/
|
||||
/** ADMIN [servername].
|
||||
* Shows administrative information about this server to users.
|
||||
*/
|
||||
CMD_FUNC(cmd_admin)
|
||||
{
|
||||
ConfigItem_admin *admin;
|
||||
/* Users may want to get the address in case k-lined, etc. -- Barubary
|
||||
|
||||
* Only allow remote ADMINs if registered -- Barubary */
|
||||
if (IsUser(sptr) || IsServer(cptr))
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
if (IsUser(sptr))
|
||||
{
|
||||
if (hunt_server(sptr, recv_mtags, ":%s ADMIN :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!conf_admin_tail)
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ CMD_OVERRIDE_FUNC(override_msg)
|
||||
if (!MyUser(sptr) || (parc < 3) || BadPtr(parv[2]))
|
||||
{
|
||||
/* Short circuit for: remote clients or insufficient parameters */
|
||||
return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv);
|
||||
return CallCommandOverride(ovr, sptr, recv_mtags, parc, parv);
|
||||
}
|
||||
|
||||
score = lookalikespam_score(StripControlCodes(parv[2]));
|
||||
@@ -202,7 +202,7 @@ CMD_OVERRIDE_FUNC(override_msg)
|
||||
}
|
||||
}
|
||||
|
||||
return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv);
|
||||
return CallCommandOverride(ovr, sptr, recv_mtags, parc, parv);
|
||||
}
|
||||
|
||||
/*** rest is module and config stuff ****/
|
||||
|
||||
@@ -515,7 +515,7 @@ int authprompt_sasl_result(Client *sptr, int success)
|
||||
/* Authentication was a success */
|
||||
if (*sptr->name && sptr->user && *sptr->user->username && IsNotSpoof(sptr))
|
||||
{
|
||||
register_user(sptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
|
||||
register_user(sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
|
||||
/* NOTE: register_user() may return FLUSH_BUFFER here, but since the caller
|
||||
* won't continue processing (won't touch 'sptr') it's safe.
|
||||
* That is, as long as we 'return 1'.
|
||||
|
||||
+5
-18
@@ -53,21 +53,8 @@ MOD_UNLOAD()
|
||||
{
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
/***********************************************************************
|
||||
* cmd_away() - Added 14 Dec 1988 by jto.
|
||||
* Not currently really working, I don't like this
|
||||
* call at all...
|
||||
*
|
||||
* ...trying to make it work. I don't like it either,
|
||||
* but perhaps it's worth the load it causes to net.
|
||||
* This requires flooding of the whole net like NICK,
|
||||
* USER, MODE, etc messages... --msa
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
** cmd_away
|
||||
** parv[1] = away message
|
||||
*/
|
||||
/** Mark client as AWAY or mark them as back (in case of empty reason) */
|
||||
CMD_FUNC(cmd_away)
|
||||
{
|
||||
char *new_reason = parv[1];
|
||||
@@ -85,8 +72,8 @@ CMD_FUNC(cmd_away)
|
||||
safe_free(sptr->user->away);
|
||||
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
sendto_server(cptr, 0, 0, mtags, ":%s AWAY", sptr->name);
|
||||
hash_check_watch(cptr, RPL_NOTAWAY);
|
||||
sendto_server(sptr, 0, 0, mtags, ":%s AWAY", sptr->name);
|
||||
hash_check_watch(sptr, RPL_NOTAWAY);
|
||||
sendto_local_common_channels(sptr, sptr, ClientCapabilityBit("away-notify"), mtags,
|
||||
":%s AWAY", sptr->name);
|
||||
RunHook3(HOOKTYPE_AWAY, sptr, mtags, NULL);
|
||||
@@ -137,7 +124,7 @@ CMD_FUNC(cmd_away)
|
||||
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
|
||||
sendto_server(cptr, 0, 0, mtags, ":%s AWAY :%s", sptr->name, new_reason);
|
||||
sendto_server(sptr, 0, 0, mtags, ":%s AWAY :%s", sptr->name, new_reason);
|
||||
|
||||
if (sptr->user->away)
|
||||
{
|
||||
@@ -150,7 +137,7 @@ CMD_FUNC(cmd_away)
|
||||
if (MyConnect(sptr))
|
||||
sendnumeric(sptr, RPL_NOWAWAY);
|
||||
|
||||
hash_check_watch(cptr, already_as_away ? RPL_REAWAY : RPL_GONEAWAY);
|
||||
hash_check_watch(sptr, already_as_away ? RPL_REAWAY : RPL_GONEAWAY);
|
||||
|
||||
sendto_local_common_channels(sptr, sptr,
|
||||
ClientCapabilityBit("away-notify"), mtags,
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ CMD_FUNC(cmd_batch)
|
||||
Client *acptr;
|
||||
char buf[512];
|
||||
|
||||
if (!IsServer(cptr) || (parc < 3))
|
||||
if (MyUser(sptr) || (parc < 3))
|
||||
return 0;
|
||||
|
||||
acptr = find_client(parv[1], NULL);
|
||||
|
||||
@@ -60,7 +60,7 @@ CMD_FUNC(cmd_botmotd)
|
||||
MOTDLine *motdline;
|
||||
ConfigItem_tld *tld;
|
||||
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s BOTMOTD :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s BOTMOTD :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
|
||||
if (!IsUser(sptr))
|
||||
|
||||
+3
-3
@@ -240,7 +240,7 @@ static int cap_end(Client *sptr, const char *arg)
|
||||
ClearCapabilityFast(sptr, CAP_IN_PROGRESS);
|
||||
|
||||
if (*sptr->name && sptr->user && *sptr->user->username && IsNotSpoof(sptr))
|
||||
return register_user(sptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
|
||||
return register_user(sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -351,7 +351,7 @@ static int cap_req(Client *sptr, const char *arg)
|
||||
|
||||
struct clicap_cmd {
|
||||
const char *cmd;
|
||||
int (*func)(struct Client *source_p, const char *arg);
|
||||
int (*func)(Client *source_p, const char *arg);
|
||||
};
|
||||
|
||||
static struct clicap_cmd clicap_cmdtable[] = {
|
||||
@@ -392,7 +392,7 @@ CMD_FUNC(cmd_cap)
|
||||
* This will speed up connections considerably.
|
||||
*/
|
||||
if (sptr->local->receiveM > 15)
|
||||
cptr->local->since++;
|
||||
sptr->local->since++;
|
||||
|
||||
if (DISABLE_CAP)
|
||||
{
|
||||
|
||||
@@ -26,9 +26,9 @@ static Cmode_t EXTMODE_POST_DELAYED;
|
||||
int visible_in_channel( Client *cptr, Channel *chptr);
|
||||
int moded_check_part( Client *cptr, Channel *chptr);
|
||||
int moded_join(Client *cptr, Channel *chptr);
|
||||
int moded_part(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int moded_part(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int deny_all(Client *cptr, Channel *chptr, char mode, char *para, int checkt, int what);
|
||||
int moded_chanmode(Client *cptr, Client *sptr, Channel *chptr,
|
||||
int moded_chanmode(Client *sptr, Channel *chptr,
|
||||
MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
char *moded_prechanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, char *text, int notice);
|
||||
char *moded_serialize(ModData *m);
|
||||
@@ -272,16 +272,15 @@ int moded_join(Client *cptr, Channel *chptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int moded_part(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *comment)
|
||||
int moded_part(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment)
|
||||
{
|
||||
if (channel_is_delayed(chptr) || channel_is_post_delayed(chptr))
|
||||
clear_user_invisible(chptr,cptr);
|
||||
clear_user_invisible(chptr, sptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int moded_chanmode(Client *cptr, Client *sptr, Channel *chptr,
|
||||
MessageTag *recv_mtags, char *modebuf, char *parabuf, time_t sendts, int samode)
|
||||
int moded_chanmode(Client *sptr, Channel *chptr, MessageTag *recv_mtags, char *modebuf, char *parabuf, time_t sendts, int samode)
|
||||
{
|
||||
long CAP_EXTENDED_JOIN = ClientCapabilityBit("extended-join");
|
||||
|
||||
|
||||
@@ -115,14 +115,14 @@ char *cmodef_conv_param(char *param_in, Client *cptr);
|
||||
void cmodef_free_param(void *r);
|
||||
void *cmodef_dup_struct(void *r_in);
|
||||
int cmodef_sjoin_check(Channel *chptr, void *ourx, void *theirx);
|
||||
int floodprot_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int floodprot_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
EVENT(modef_event);
|
||||
int cmodef_channel_destroy(Channel *chptr, int *should_destroy);
|
||||
char *floodprot_pre_chanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, char *text, int notice);
|
||||
int floodprot_post_chanmsg(Client *sptr, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice);
|
||||
int floodprot_knock(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int floodprot_local_nickchange(Client *sptr, char *oldnick);
|
||||
int floodprot_remote_nickchange(Client *cptr, Client *sptr, char *oldnick);
|
||||
int floodprot_remote_nickchange(Client *sptr, char *oldnick);
|
||||
int floodprot_chanmode_del(Channel *chptr, int m);
|
||||
void memberflood_free(ModData *md);
|
||||
int floodprot_stats(Client *sptr, char *flag);
|
||||
@@ -849,7 +849,7 @@ int cmodef_sjoin_check(Channel *chptr, void *ourx, void *theirx)
|
||||
return EXSJ_MERGE;
|
||||
}
|
||||
|
||||
int floodprot_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
int floodprot_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
{
|
||||
/* I'll explain this only once:
|
||||
* 1. if channel is +f
|
||||
@@ -997,7 +997,7 @@ int floodprot_local_nickchange(Client *sptr, char *oldnick)
|
||||
return gotnickchange(sptr);
|
||||
}
|
||||
|
||||
int floodprot_remote_nickchange(Client *cptr, Client *sptr, char *oldnick)
|
||||
int floodprot_remote_nickchange(Client *sptr, char *oldnick)
|
||||
{
|
||||
if (IsULine(sptr))
|
||||
return 0;
|
||||
|
||||
@@ -63,7 +63,7 @@ void *history_chanmode_dup_struct(void *r_in);
|
||||
int history_chanmode_sjoin_check(Channel *chptr, void *ourx, void *theirx);
|
||||
int history_channel_destroy(Channel *chptr, int *should_destroy);
|
||||
int history_chanmsg(Client *sptr, Channel *chptr, int sendflags, int prefix, char *target, MessageTag *mtags, char *text, int notice);
|
||||
int history_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int history_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
EVENT(history_clean);
|
||||
|
||||
MOD_TEST()
|
||||
@@ -506,7 +506,7 @@ int history_chanmsg(Client *sptr, Channel *chptr, int sendflags, int prefix, cha
|
||||
return 0;
|
||||
}
|
||||
|
||||
int history_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
int history_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
{
|
||||
if (!HistoryEnabled(chptr))
|
||||
return 0;
|
||||
|
||||
@@ -43,11 +43,11 @@ Cmode_t EXTCMODE_ISSECURE;
|
||||
|
||||
int IsSecureJoin(Channel *chptr);
|
||||
int modeZ_is_ok(Client *sptr, Channel *chptr, char mode, char *para, int checkt, int what);
|
||||
int issecure_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int issecure_part(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int issecure_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int issecure_part(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int issecure_quit(Client *acptr, MessageTag *mtags, char *comment);
|
||||
int issecure_kick(Client *cptr, Client *sptr, Client *acptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int issecure_chanmode(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags,
|
||||
int issecure_kick(Client *sptr, Client *acptr, Channel *chptr, MessageTag *mtags, char *comment);
|
||||
int issecure_chanmode(Client *sptr, Channel *chptr, MessageTag *mtags,
|
||||
char *modebuf, char *parabuf, time_t sendts, int samode);
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ void issecure_set(Channel *chptr, Client *sptr, MessageTag *recv_mtags, int noti
|
||||
* so while they can be written shorter, they would only take longer to execute!
|
||||
*/
|
||||
|
||||
int issecure_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
int issecure_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
{
|
||||
/* Check only if chan already +zZ and the user joining is insecure (no need to count) */
|
||||
if (IsSecureJoin(chptr) && IsSecureChanIndicated(chptr) && !IsSecureConnect(sptr) && !IsULine(sptr))
|
||||
@@ -212,7 +212,7 @@ int issecure_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int issecure_part(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *comment)
|
||||
int issecure_part(Client *sptr, Channel *chptr, MessageTag *mtags, char *comment)
|
||||
{
|
||||
/* Only care if chan is +z-Z and the user leaving is insecure, then count */
|
||||
if (IsSecureJoin(chptr) && !IsSecureChanIndicated(chptr) && !IsSecureConnect(sptr) &&
|
||||
@@ -237,7 +237,7 @@ Channel *chptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int issecure_kick(Client *cptr, Client *sptr, Client *victim, Channel *chptr, MessageTag *mtags, char *comment)
|
||||
int issecure_kick(Client *sptr, Client *victim, Channel *chptr, MessageTag *mtags, char *comment)
|
||||
{
|
||||
/* Identical to part&quit, except we care about 'victim' and not 'sptr' */
|
||||
if (IsSecureJoin(chptr) && !IsSecureChanIndicated(chptr) &&
|
||||
@@ -246,7 +246,7 @@ int issecure_kick(Client *cptr, Client *sptr, Client *victim, Channel *chptr, Me
|
||||
return 0;
|
||||
}
|
||||
|
||||
int issecure_chanmode(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags,
|
||||
int issecure_chanmode(Client *sptr, Channel *chptr, MessageTag *mtags,
|
||||
char *modebuf, char *parabuf, time_t sendts, int samode)
|
||||
{
|
||||
if (!strchr(modebuf, 'z'))
|
||||
|
||||
@@ -354,7 +354,7 @@ int link_doforward(Client *sptr, Channel *chptr, char *linked, linkType type)
|
||||
parv[0] = sptr->name;
|
||||
parv[1] = linked;
|
||||
parv[2] = NULL;
|
||||
do_join(sptr, sptr, 2, parv);
|
||||
do_join(sptr, 2, parv);
|
||||
return HOOK_DENY; // Original channel join = ignored
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ int link_pre_localjoin_cb(Client *sptr, Channel *chptr, char *parv[])
|
||||
return HOOK_CONTINUE;
|
||||
|
||||
// can_join() actually returns 0 if we *can* join a channel, so we don't need to bother checking any further conditions
|
||||
if (!(canjoin = can_join(sptr, sptr, chptr, NULL, parv)))
|
||||
if (!(canjoin = can_join(sptr, chptr, NULL, parv)))
|
||||
return HOOK_CONTINUE;
|
||||
|
||||
// Oper only channel
|
||||
|
||||
@@ -51,7 +51,7 @@ static int permanent_is_ok(Client *cptr, Channel *chptr, char mode, char *para,
|
||||
return EX_ALLOW;
|
||||
}
|
||||
|
||||
int permanent_chanmode(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode)
|
||||
int permanent_chanmode(Client *sptr, Channel *chptr, MessageTag *mtags, char *modebuf, char *parabuf, time_t sendts, int samode)
|
||||
{
|
||||
/* Destroy the channel if it was set '(SA)MODE #chan -P' with nobody in it (#4442) */
|
||||
if (!(chptr->mode.extmode & EXTMODE_PERMANENT) && (chptr->users <= 0))
|
||||
|
||||
@@ -482,9 +482,10 @@ static void set_channel_mode(Channel *chptr, char *modes, char *parameters)
|
||||
myparv[myparc] = NULL;
|
||||
|
||||
SetULine(&me); // hack for crash.. set ulined so no access checks.
|
||||
do_mode(chptr, &me, &me, NULL, myparc, myparv, 0, 0);
|
||||
do_mode(chptr, &me, NULL, myparc, myparv, 0, 0);
|
||||
SetULine(&me); // and clear it again..
|
||||
|
||||
for (i = 0; i < myparc; i++)
|
||||
safe_free(myparv[i]);
|
||||
}
|
||||
// FIXME: move above function to m_mode and make efunc, available for all modules anyway
|
||||
|
||||
@@ -144,7 +144,7 @@ CMD_FUNC(cmd_chghost)
|
||||
|
||||
acptr->umodes |= UMODE_HIDE;
|
||||
acptr->umodes |= UMODE_SETHOST;
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s CHGHOST %s %s", sptr->name, acptr->name, parv[2]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s CHGHOST %s %s", sptr->name, acptr->name, parv[2]);
|
||||
safe_strdup(acptr->user->virthost, parv[2]);
|
||||
|
||||
userhost_changed(acptr);
|
||||
|
||||
@@ -142,7 +142,7 @@ CMD_FUNC(cmd_chgident)
|
||||
GetHost(acptr), parv[2]);
|
||||
}
|
||||
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s CHGIDENT %s %s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s CHGIDENT %s %s",
|
||||
sptr->name, acptr->name, parv[2]);
|
||||
ircsnprintf(acptr->user->username, sizeof(acptr->user->username), "%s", parv[2]);
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ CMD_FUNC(cmd_chgname)
|
||||
}
|
||||
}
|
||||
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s CHGNAME %s :%s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s CHGNAME %s :%s",
|
||||
sptr->name, acptr->name, parv[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ CMD_FUNC(cmd_connect)
|
||||
ConfigItem_deny_link *deny;
|
||||
Client *acptr;
|
||||
|
||||
|
||||
if (!IsServer(sptr) && MyConnect(sptr) && !ValidatePermissionsForPath("route:global",sptr,NULL,NULL,NULL) && parc > 3)
|
||||
{ /* Only allow LocOps to make */
|
||||
/* local CONNECTS --SRB */
|
||||
@@ -77,7 +76,7 @@ CMD_FUNC(cmd_connect)
|
||||
sendnumeric(sptr, ERR_NOPRIVILEGES);
|
||||
return 0;
|
||||
}
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s CONNECT %s %s :%s", 3, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
|
||||
if (parc < 2 || *parv[1] == '\0')
|
||||
@@ -128,7 +127,7 @@ CMD_FUNC(cmd_connect)
|
||||
}
|
||||
|
||||
/* Notify all operators about remote connect requests */
|
||||
if (!MyUser(cptr))
|
||||
if (!MyUser(sptr))
|
||||
{
|
||||
sendto_server(&me, 0, 0, NULL,
|
||||
":%s GLOBOPS :Remote CONNECT %s %s from %s",
|
||||
|
||||
+2
-2
@@ -69,10 +69,10 @@ CMD_FUNC(cmd_cycle)
|
||||
|
||||
parv[2] = "cycling";
|
||||
strlcpy(channels, parv[1], sizeof(channels));
|
||||
n = do_cmd(cptr, sptr, recv_mtags, "PART", 3, parv);
|
||||
n = do_cmd(sptr, recv_mtags, "PART", 3, parv);
|
||||
if (n == FLUSH_BUFFER)
|
||||
return n;
|
||||
parv[1] = channels;
|
||||
parv[2] = NULL;
|
||||
return do_cmd(cptr, sptr, recv_mtags, "JOIN", 2, parv);
|
||||
return do_cmd(sptr, recv_mtags, "JOIN", 2, parv);
|
||||
}
|
||||
|
||||
+4
-4
@@ -66,11 +66,11 @@ CMD_FUNC(cmd_eos)
|
||||
sptr->serv->flags.synced = 1;
|
||||
/* pass it on ^_- */
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: got sync from %s (path:%s)", sptr->name, cptr->name);
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: broadcasting it back to everyone except route from %s", cptr->name);
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: got sync from %s (path:%s)", sptr->name, sptr->direction->name);
|
||||
ircd_log(LOG_ERROR, "[EOSDBG] cmd_eos: broadcasting it back to everyone except route from %s", sptr->direction->name);
|
||||
#endif
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s EOS", sptr->name);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s EOS", sptr->name);
|
||||
|
||||
RunHook(HOOKTYPE_SERVER_SYNCHED, cptr);
|
||||
RunHook(HOOKTYPE_SERVER_SYNCHED, sptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ CMD_FUNC(cmd_globops)
|
||||
{
|
||||
/* Backward-compatible (3.2.x) */
|
||||
sendto_umode(UMODE_OPER, "from %s: %s", sptr->name, message);
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SENDUMODE o :from %s: %s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SENDUMODE o :from %s: %s",
|
||||
me.name, sptr->name, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ CMD_OVERRIDE_FUNC(override_map)
|
||||
parv[1] = "*";
|
||||
|
||||
if (IsOper(sptr))
|
||||
return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv);
|
||||
return CallCommandOverride(ovr, sptr, recv_mtags, parc, parv);
|
||||
|
||||
if (Settings.disable_map)
|
||||
{
|
||||
@@ -366,7 +366,7 @@ CMD_OVERRIDE_FUNC(override_links)
|
||||
int flat = (FLAT_MAP && !IsOper(sptr)) ? 1 : 0;
|
||||
|
||||
if (IsOper(sptr))
|
||||
return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv);
|
||||
return CallCommandOverride(ovr, sptr, recv_mtags, parc, parv);
|
||||
|
||||
if (Settings.disable_links)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ CMD_OVERRIDE_FUNC(override_links)
|
||||
list_for_each_entry(acptr, &global_server_list, client_node)
|
||||
{
|
||||
/* Some checks */
|
||||
if (HIDE_ULINES && IsULine(acptr) && !ValidatePermissionsForPath("server:info:map:ulines",cptr,NULL,NULL,NULL))
|
||||
if (HIDE_ULINES && IsULine(acptr) && !ValidatePermissionsForPath("server:info:map:ulines",sptr,NULL,NULL,NULL))
|
||||
continue;
|
||||
if (FindHiddenServer(acptr->name))
|
||||
continue;
|
||||
|
||||
+26
-26
@@ -24,9 +24,9 @@
|
||||
|
||||
/* Forward declarations */
|
||||
CMD_FUNC(cmd_join);
|
||||
void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *mtags, int flags);
|
||||
int _do_join(Client *cptr, Client *sptr, int parc, char *parv[]);
|
||||
int _can_join(Client *cptr, Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
void _join_channel(Channel *chptr, Client *sptr, MessageTag *mtags, int flags);
|
||||
int _do_join(Client *sptr, int parc, char *parv[]);
|
||||
int _can_join(Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
void _userhost_save_current(Client *sptr);
|
||||
void _userhost_changed(Client *sptr);
|
||||
void _send_join_to_local_users(Client *sptr, Channel *chptr, MessageTag *mtags);
|
||||
@@ -87,12 +87,12 @@ MOD_UNLOAD()
|
||||
* (eg: bans at the end), so don't change it unless you have a good reason
|
||||
* to do so -- Syzop.
|
||||
*/
|
||||
int _can_join(Client *cptr, Client *sptr, Channel *chptr, char *key, char *parv[])
|
||||
int _can_join(Client *sptr, Channel *chptr, char *key, char *parv[])
|
||||
{
|
||||
Link *lp;
|
||||
Ban *banned;
|
||||
Hook *h;
|
||||
int i=0,j=0;
|
||||
Link *lp;
|
||||
Ban *banned;
|
||||
Hook *h;
|
||||
int i=0, j=0;
|
||||
|
||||
for (h = Hooks[HOOKTYPE_CAN_JOIN]; h; h = h->next)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ CMD_FUNC(cmd_join)
|
||||
bouncedtimes = 0;
|
||||
if (IsServer(sptr))
|
||||
return 0;
|
||||
r = do_join(cptr, sptr, parc, parv);
|
||||
r = do_join(sptr, parc, parv);
|
||||
bouncedtimes = 0;
|
||||
|
||||
return r;
|
||||
@@ -233,7 +233,7 @@ void _send_join_to_local_users(Client *sptr, Channel *chptr, MessageTag *mtags)
|
||||
/* Routine that actually makes a user join the channel
|
||||
* this does no actual checking (banned, etc.) it just adds the user
|
||||
*/
|
||||
void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags, int flags)
|
||||
void _join_channel(Channel *chptr, Client *sptr, MessageTag *recv_mtags, int flags)
|
||||
{
|
||||
MessageTag *mtags = NULL; /** Message tags to send to local users (sender is :user) */
|
||||
MessageTag *mtags_sjoin = NULL; /* Message tags to send to remote servers for SJOIN (sender is :me.name) */
|
||||
@@ -249,15 +249,15 @@ void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_
|
||||
send_join_to_local_users(sptr, chptr, mtags);
|
||||
|
||||
/* old non-SJOINv3 servers */
|
||||
sendto_server(cptr, 0, PROTO_SJ3, mtags, ":%s JOIN :%s", sptr->name, chptr->chname);
|
||||
sendto_server(sptr, 0, PROTO_SJ3, mtags, ":%s JOIN :%s", sptr->name, chptr->chname);
|
||||
|
||||
/* I _know_ that the "@%s " look a bit wierd
|
||||
with the space and all .. but its to get around
|
||||
a SJOIN bug --stskeeps */
|
||||
sendto_server(cptr, PROTO_SID | PROTO_SJ3, 0, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ",
|
||||
sendto_server(sptr, PROTO_SID | PROTO_SJ3, 0, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ",
|
||||
me.id, (long long)chptr->creationtime,
|
||||
chptr->chname, chfl_to_sjoin_symbol(flags), ID(sptr));
|
||||
sendto_server(cptr, PROTO_SJ3, PROTO_SID, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ",
|
||||
sendto_server(sptr, PROTO_SJ3, PROTO_SID, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ",
|
||||
me.name, (long long)chptr->creationtime,
|
||||
chptr->chname, chfl_to_sjoin_symbol(flags), sptr->name);
|
||||
|
||||
@@ -271,7 +271,7 @@ void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_
|
||||
if (chptr->creationtime == 0)
|
||||
{
|
||||
chptr->creationtime = TStime();
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s MODE %s + %lld",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s MODE %s + %lld",
|
||||
me.name, chptr->chname, (long long)chptr->creationtime);
|
||||
}
|
||||
del_invite(sptr, chptr);
|
||||
@@ -285,14 +285,14 @@ void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_
|
||||
if ((flags & CHFL_CHANOWNER) || (flags & CHFL_CHANADMIN))
|
||||
{
|
||||
/* +ao / +qo for when PREFIX_AQ is off */
|
||||
sendto_server(cptr, 0, PROTO_SJ3, NULL, ":%s MODE %s +o%c %s %s %lld",
|
||||
sendto_server(sptr, 0, PROTO_SJ3, NULL, ":%s MODE %s +o%c %s %s %lld",
|
||||
me.name,
|
||||
chptr->chname, chfl_to_chanmode(flags), sptr->name, sptr->name,
|
||||
(long long)chptr->creationtime);
|
||||
} else {
|
||||
#endif
|
||||
/* +v/+h/+o (and +a/+q if PREFIX_AQ is on) */
|
||||
sendto_server(cptr, 0, PROTO_SJ3, NULL, ":%s MODE %s +%c %s %lld",
|
||||
sendto_server(sptr, 0, PROTO_SJ3, NULL, ":%s MODE %s +%c %s %lld",
|
||||
me.name,
|
||||
chptr->chname, chfl_to_chanmode(flags), sptr->name,
|
||||
(long long)chptr->creationtime);
|
||||
@@ -342,11 +342,11 @@ void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_
|
||||
|
||||
parv[0] = sptr->name;
|
||||
parv[1] = chptr->chname;
|
||||
(void)do_cmd(cptr, sptr, NULL, "NAMES", 2, parv);
|
||||
(void)do_cmd(sptr, NULL, "NAMES", 2, parv);
|
||||
|
||||
RunHook5(HOOKTYPE_LOCAL_JOIN, cptr, sptr, chptr, mtags, parv);
|
||||
RunHook4(HOOKTYPE_LOCAL_JOIN, sptr, chptr, mtags, parv);
|
||||
} else {
|
||||
RunHook5(HOOKTYPE_REMOTE_JOIN, cptr, sptr, chptr, mtags, parv);
|
||||
RunHook4(HOOKTYPE_REMOTE_JOIN, sptr, chptr, mtags, parv);
|
||||
}
|
||||
|
||||
free_message_tags(mtags);
|
||||
@@ -360,7 +360,7 @@ void _join_channel(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_
|
||||
* increased every time we enter this loop and decreased anytime we leave the
|
||||
* loop. So be carefull not to use a simple 'return' after bouncedtimes++. -- Syzop
|
||||
*/
|
||||
int _do_join(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
int _do_join(Client *sptr, int parc, char *parv[])
|
||||
{
|
||||
char jbuf[BUFSIZE];
|
||||
Membership *lp;
|
||||
@@ -467,10 +467,10 @@ int _do_join(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
sendto_channel(chptr, sptr, NULL, 0, 0, SEND_LOCAL, NULL,
|
||||
":%s PART %s :%s",
|
||||
sptr->name, chptr->chname, "Left all channels");
|
||||
sendto_server(cptr, 0, 0, mtags, ":%s PART %s :Left all channels", sptr->name, chptr->chname);
|
||||
sendto_server(sptr, 0, 0, mtags, ":%s PART %s :Left all channels", sptr->name, chptr->chname);
|
||||
|
||||
if (MyConnect(sptr))
|
||||
RunHook5(HOOKTYPE_LOCAL_PART, cptr, sptr, chptr, mtags, "Left all channels");
|
||||
RunHook4(HOOKTYPE_LOCAL_PART, sptr, chptr, mtags, "Left all channels");
|
||||
|
||||
remove_user_from_channel(sptr, chptr);
|
||||
free_message_tags(mtags);
|
||||
@@ -506,7 +506,7 @@ int _do_join(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
if (!ValidatePermissionsForPath("immune:server-ban:deny-channel",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
ConfigItem_deny_channel *d;
|
||||
if ((d = Find_channel_allowed(cptr, name)))
|
||||
if ((d = Find_channel_allowed(sptr, name)))
|
||||
{
|
||||
if (d->warn)
|
||||
{
|
||||
@@ -520,7 +520,7 @@ int _do_join(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
sendnotice(sptr, "*** Redirecting you to %s", d->redirect);
|
||||
parv[0] = sptr->name;
|
||||
parv[1] = d->redirect;
|
||||
do_join(cptr, sptr, 2, parv);
|
||||
do_join(sptr, 2, parv);
|
||||
}
|
||||
if (d->class)
|
||||
sendnotice(sptr, "*** Can not join %s: Your class is not allowed", name);
|
||||
@@ -586,7 +586,7 @@ int _do_join(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
}
|
||||
/* If they are allowed, don't check can_join */
|
||||
if (i != HOOK_ALLOW &&
|
||||
(i = can_join(cptr, sptr, chptr, key, parv)))
|
||||
(i = can_join(sptr, chptr, key, parv)))
|
||||
{
|
||||
if (i != -1)
|
||||
{
|
||||
@@ -607,7 +607,7 @@ int _do_join(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
* and so on, each with their own unique msgid and such.
|
||||
*/
|
||||
new_message(sptr, NULL, &mtags);
|
||||
join_channel(chptr, cptr, sptr, mtags, flags);
|
||||
join_channel(chptr, sptr, mtags, flags);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
RET(0)
|
||||
|
||||
@@ -59,7 +59,7 @@ int jointhrottle_config_test(ConfigFile *, ConfigEntry *, int, int *);
|
||||
int jointhrottle_config_run(ConfigFile *, ConfigEntry *, int);
|
||||
void jointhrottle_md_free(ModData *m);
|
||||
int jointhrottle_can_join(Client *sptr, Channel *chptr, char *key, char *parv[]);
|
||||
int jointhrottle_local_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
int jointhrottle_local_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[]);
|
||||
static int isjthrottled(Client *cptr, Channel *chptr);
|
||||
static void jointhrottle_increase_usercounter(Client *cptr, Channel *chptr);
|
||||
EVENT(jointhrottle_cleanup_structs);
|
||||
@@ -214,9 +214,9 @@ int jointhrottle_can_join(Client *sptr, Channel *chptr, char *key, char *parv[])
|
||||
}
|
||||
|
||||
|
||||
int jointhrottle_local_join(Client *cptr, Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
int jointhrottle_local_join(Client *sptr, Channel *chptr, MessageTag *mtags, char *parv[])
|
||||
{
|
||||
jointhrottle_increase_usercounter(cptr, chptr);
|
||||
jointhrottle_increase_usercounter(sptr, chptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -101,7 +101,7 @@ CMD_FUNC(cmd_kick)
|
||||
/* Store "sptr" access flags */
|
||||
if (IsUser(sptr))
|
||||
sptr_flags = get_access(sptr, chptr);
|
||||
if (!IsServer(cptr) && !IsULine(sptr) && !op_can_override("channel:override:kick:no-ops",sptr,chptr,NULL)
|
||||
if (MyUser(sptr) && !IsULine(sptr) && !op_can_override("channel:override:kick:no-ops",sptr,chptr,NULL)
|
||||
&& !(sptr_flags & CHFL_ISOP) && !(sptr_flags & CHFL_HALFOP))
|
||||
{
|
||||
sendnumeric(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
|
||||
@@ -287,9 +287,9 @@ CMD_FUNC(cmd_kick)
|
||||
/* The same message is actually sent at 5 places below (though max 4 at most) */
|
||||
|
||||
if (MyUser(sptr))
|
||||
RunHook6(HOOKTYPE_LOCAL_KICK, cptr, sptr, who, chptr, mtags, comment);
|
||||
RunHook5(HOOKTYPE_LOCAL_KICK, sptr, who, chptr, mtags, comment);
|
||||
else
|
||||
RunHook6(HOOKTYPE_REMOTE_KICK, cptr, sptr, who, chptr, mtags, comment);
|
||||
RunHook5(HOOKTYPE_REMOTE_KICK, sptr, who, chptr, mtags, comment);
|
||||
|
||||
if (lp)
|
||||
{
|
||||
@@ -314,9 +314,9 @@ CMD_FUNC(cmd_kick)
|
||||
sptr->name, chptr->chname, who->name, comment);
|
||||
}
|
||||
}
|
||||
sendto_server(cptr, PROTO_SID, 0, mtags, ":%s KICK %s %s :%s",
|
||||
sendto_server(sptr, PROTO_SID, 0, mtags, ":%s KICK %s %s :%s",
|
||||
ID(sptr), chptr->chname, ID(who), comment);
|
||||
sendto_server(cptr, 0, PROTO_SID, mtags, ":%s KICK %s %s :%s",
|
||||
sendto_server(sptr, 0, PROTO_SID, mtags, ":%s KICK %s %s :%s",
|
||||
sptr->name, chptr->chname, who->name, comment);
|
||||
free_message_tags(mtags);
|
||||
if (lp)
|
||||
@@ -327,7 +327,7 @@ CMD_FUNC(cmd_kick)
|
||||
else if (MyUser(sptr))
|
||||
sendnumeric(sptr, ERR_USERNOTINCHANNEL, user, name);
|
||||
} /* loop on parv[2] */
|
||||
if (MyUser(cptr))
|
||||
if (MyUser(sptr))
|
||||
break;
|
||||
} /* loop on parv[1] */
|
||||
|
||||
|
||||
+15
-11
@@ -66,7 +66,7 @@ CMD_FUNC(cmd_kill)
|
||||
{
|
||||
Client *acptr;
|
||||
char inpath[HOSTLEN * 2 + USERLEN + 5];
|
||||
char *oinpath = get_client_name(cptr, FALSE);
|
||||
char *oinpath = get_client_name(sptr->direction, FALSE);
|
||||
char *user, *path, *killer, *nick, *p, *s;
|
||||
int kcount = 0;
|
||||
Hook *h;
|
||||
@@ -79,15 +79,19 @@ CMD_FUNC(cmd_kill)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// FIXME: clean all this killpath shit, nobody cares anymore these days.
|
||||
// FYI, I just replaced 'cptr' with 'sptr->direction' for now, but
|
||||
// we should clean up this mess later, see the FIXME.
|
||||
|
||||
user = parv[1];
|
||||
path = parv[2]; /* Either defined or NULL (parc >= 2!!) */
|
||||
|
||||
strlcpy(inpath, oinpath, sizeof inpath);
|
||||
|
||||
if (IsServer(cptr) && (s = strchr(inpath, '.')) != NULL)
|
||||
if (IsServer(sptr->direction) && (s = strchr(inpath, '.')) != NULL)
|
||||
*s = '\0'; /* Truncate at first "." -- hmm... why ? */
|
||||
|
||||
if (!IsServer(cptr) && !ValidatePermissionsForPath("kill:global",sptr,NULL,NULL,NULL) && !ValidatePermissionsForPath("kill:local",sptr,NULL,NULL,NULL))
|
||||
if (!IsServer(sptr->direction) && !ValidatePermissionsForPath("kill:global",sptr,NULL,NULL,NULL) && !ValidatePermissionsForPath("kill:local",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
sendnumeric(sptr, ERR_NOPRIVILEGES);
|
||||
return 0;
|
||||
@@ -134,8 +138,8 @@ CMD_FUNC(cmd_kill)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((!MyConnect(acptr) && MyUser(cptr) && !ValidatePermissionsForPath("kill:global",sptr,acptr,NULL,NULL))
|
||||
|| (MyConnect(acptr) && MyUser(cptr)
|
||||
if ((!MyConnect(acptr) && MyUser(sptr) && !ValidatePermissionsForPath("kill:global",sptr,acptr,NULL,NULL))
|
||||
|| (MyConnect(acptr) && MyUser(sptr)
|
||||
&& !ValidatePermissionsForPath("kill:local",sptr,acptr,NULL,NULL)))
|
||||
{
|
||||
sendnumeric(sptr, ERR_NOPRIVILEGES);
|
||||
@@ -169,7 +173,7 @@ CMD_FUNC(cmd_kill)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!IsServer(cptr))
|
||||
if (!IsServer(sptr->direction))
|
||||
{
|
||||
/*
|
||||
** The kill originates from this server, initialize path.
|
||||
@@ -179,10 +183,10 @@ CMD_FUNC(cmd_kill)
|
||||
** ...!operhost!oper
|
||||
** ...!operhost!oper (comment)
|
||||
*/
|
||||
strlcpy(inpath, GetHost(cptr), sizeof inpath);
|
||||
strlcpy(inpath, GetHost(sptr->direction), sizeof inpath);
|
||||
if (kcount == 1)
|
||||
{
|
||||
ircsnprintf(buf, sizeof(buf), "%s (%s)", cptr->name, path);
|
||||
ircsnprintf(buf, sizeof(buf), "%s (%s)", sptr->direction->name, path);
|
||||
path = buf;
|
||||
}
|
||||
}
|
||||
@@ -227,9 +231,9 @@ CMD_FUNC(cmd_kill)
|
||||
/* Kill from one server to another (we may be src, victim or something in-between) */
|
||||
|
||||
/* Broadcast it to other SID and non-SID servers (may be a NOOP, obviously) */
|
||||
sendto_server(cptr, PROTO_SID, 0, mtags, ":%s KILL %s :%s!%s",
|
||||
sendto_server(sptr, PROTO_SID, 0, mtags, ":%s KILL %s :%s!%s",
|
||||
sptr->name, ID(acptr), inpath, path);
|
||||
sendto_server(cptr, 0, PROTO_SID, mtags, ":%s KILL %s :%s!%s",
|
||||
sendto_server(sptr, 0, PROTO_SID, mtags, ":%s KILL %s :%s!%s",
|
||||
sptr->name, acptr->name, inpath, path);
|
||||
|
||||
/* Don't send a QUIT for this */
|
||||
@@ -253,7 +257,7 @@ CMD_FUNC(cmd_kill)
|
||||
if (MyUser(sptr))
|
||||
RunHook3(HOOKTYPE_LOCAL_KILL, sptr, acptr, parv[2]);
|
||||
|
||||
n = exit_client(cptr, acptr, sptr, mtags, buf2);
|
||||
n = exit_client(sptr->direction, acptr, sptr, mtags, buf2);
|
||||
|
||||
free_message_tags(mtags);
|
||||
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ CMD_FUNC(cmd_lag)
|
||||
sendnumeric(sptr, ERR_NEEDMOREPARAMS, "LAG");
|
||||
return 0;
|
||||
}
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s LAG :%s", 1, parc, parv) == HUNTED_NOSUCH)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s LAG :%s", 1, parc, parv) == HUNTED_NOSUCH)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
+4
-1
@@ -57,10 +57,13 @@ CMD_FUNC(cmd_links)
|
||||
Client *acptr;
|
||||
int flat = (FLAT_MAP && !IsOper(sptr)) ? 1 : 0;
|
||||
|
||||
if (!MyUser(sptr))
|
||||
return 0;
|
||||
|
||||
list_for_each_entry(acptr, &global_server_list, client_node)
|
||||
{
|
||||
/* Some checks */
|
||||
if (HIDE_ULINES && IsULine(acptr) && !ValidatePermissionsForPath("server:info:map:ulines",cptr,NULL,NULL,NULL))
|
||||
if (HIDE_ULINES && IsULine(acptr) && !ValidatePermissionsForPath("server:info:map:ulines",sptr,NULL,NULL,NULL))
|
||||
continue;
|
||||
if (flat)
|
||||
sendnumeric(sptr, RPL_LINKS, acptr->name, me.name,
|
||||
|
||||
+6
-6
@@ -143,8 +143,8 @@ CMD_FUNC(cmd_list)
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Some starting san checks -- No interserver lists allowed. */
|
||||
if (cptr != sptr || !sptr->user)
|
||||
/* Remote /LIST is not supported */
|
||||
if (!MyUser(sptr))
|
||||
return 0;
|
||||
|
||||
/* If a /LIST is in progress then a new one will cancel it */
|
||||
@@ -161,8 +161,8 @@ CMD_FUNC(cmd_list)
|
||||
ALLOCATE_CHANNELLISTOPTIONS(sptr);
|
||||
CHANNELLISTOPTIONS(sptr)->showall = 1;
|
||||
|
||||
if (DBufLength(&cptr->local->sendQ) < 2048)
|
||||
send_list(cptr);
|
||||
if (DBufLength(&sptr->local->sendQ) < 2048)
|
||||
send_list(sptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -298,8 +298,8 @@ CMD_FUNC(cmd_list)
|
||||
CHANNELLISTOPTIONS(sptr)->nolist = nolist;
|
||||
CHANNELLISTOPTIONS(sptr)->yeslist = yeslist;
|
||||
|
||||
if (DBufLength(&cptr->local->sendQ) < 2048)
|
||||
send_list(cptr);
|
||||
if (DBufLength(&sptr->local->sendQ) < 2048)
|
||||
send_list(sptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ CMD_FUNC(cmd_lusers)
|
||||
{
|
||||
char flatmap;
|
||||
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s LUSERS :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s LUSERS :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
|
||||
flatmap = (FLAT_MAP && !ValidatePermissionsForPath("server:info:lusers",sptr,NULL,NULL,NULL)) ? 1 : 0;
|
||||
|
||||
+5
-5
@@ -114,7 +114,7 @@ CMD_FUNC(cmd_md)
|
||||
memset(&moddata_client(acptr, md), 0, sizeof(ModData));
|
||||
}
|
||||
/* Pass on to other servers */
|
||||
broadcast_md_client_cmd(cptr, sptr, acptr, varname, value);
|
||||
broadcast_md_client_cmd(sptr->direction, sptr, acptr, varname, value);
|
||||
} else
|
||||
if (!strcmp(type, "channel"))
|
||||
{
|
||||
@@ -131,7 +131,7 @@ CMD_FUNC(cmd_md)
|
||||
memset(&moddata_channel(chptr, md), 0, sizeof(ModData));
|
||||
}
|
||||
/* Pass on to other servers */
|
||||
broadcast_md_channel_cmd(cptr, sptr, chptr, varname, value);
|
||||
broadcast_md_channel_cmd(sptr->direction, sptr, chptr, varname, value);
|
||||
} else
|
||||
if (!strcmp(type, "member"))
|
||||
{
|
||||
@@ -171,7 +171,7 @@ CMD_FUNC(cmd_md)
|
||||
memset(&moddata_member(m, md), 0, sizeof(ModData));
|
||||
}
|
||||
/* Pass on to other servers */
|
||||
broadcast_md_member_cmd(cptr, sptr, chptr, acptr, varname, value);
|
||||
broadcast_md_member_cmd(sptr->direction, sptr, chptr, acptr, varname, value);
|
||||
} else
|
||||
if (!strcmp(type, "membership"))
|
||||
{
|
||||
@@ -211,7 +211,7 @@ CMD_FUNC(cmd_md)
|
||||
memset(&moddata_membership(m, md), 0, sizeof(ModData));
|
||||
}
|
||||
/* Pass on to other servers */
|
||||
broadcast_md_membership_cmd(cptr, sptr, acptr, chptr, varname, value);
|
||||
broadcast_md_membership_cmd(sptr->direction, sptr, acptr, chptr, varname, value);
|
||||
} else
|
||||
if (!strcmp(type, "globalvar"))
|
||||
{
|
||||
@@ -228,7 +228,7 @@ CMD_FUNC(cmd_md)
|
||||
memset(&moddata_global_variable(md), 0, sizeof(ModData));
|
||||
}
|
||||
/* Pass on to other servers */
|
||||
broadcast_md_globalvar_cmd(cptr, sptr, varname, value);
|
||||
broadcast_md_globalvar_cmd(sptr->direction, sptr, varname, value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+23
-24
@@ -27,8 +27,8 @@ int ban_version(Client *sptr, char *text);
|
||||
|
||||
CMD_FUNC(cmd_private);
|
||||
CMD_FUNC(cmd_notice);
|
||||
int cmd_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], int notice);
|
||||
int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int notice);
|
||||
int cmd_message(Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], int notice);
|
||||
int _can_send(Client *sptr, Channel *chptr, char **msgtext, char **errmsg, int notice);
|
||||
|
||||
/* Place includes here */
|
||||
#define MSG_PRIVATE "PRIVMSG" /* PRIV */
|
||||
@@ -79,8 +79,7 @@ static int check_dcc_soft(Client *from, Client *to, char *text);
|
||||
#define CANPRIVMSG_CONTINUE 100
|
||||
#define CANPRIVMSG_SEND 101
|
||||
/** Check if PRIVMSG's are permitted from a person to another person.
|
||||
* cptr: ..
|
||||
* sptr: ..
|
||||
* sptr: source client
|
||||
* acptr: target client
|
||||
* notice: 1 if notice, 0 if privmsg
|
||||
* text: Pointer to a pointer to a text [in, out]
|
||||
@@ -91,7 +90,7 @@ static int check_dcc_soft(Client *from, Client *to, char *text);
|
||||
* CANPRIVMSG_SEND: send the message (use text/newcmd!)
|
||||
* Other: return with this value (can be anything like 0, -1, FLUSH_BUFFER, etc)
|
||||
*/
|
||||
static int can_privmsg(Client *cptr, Client *sptr, Client *acptr, int notice, char **text, char **cmd)
|
||||
static int can_privmsg(Client *sptr, Client *acptr, int notice, char **text, char **cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -143,7 +142,7 @@ int ret;
|
||||
return CANPRIVMSG_SEND;
|
||||
} else {
|
||||
/* Silenced */
|
||||
RunHook4(HOOKTYPE_SILENCED, cptr, sptr, acptr, notice);
|
||||
RunHook3(HOOKTYPE_SILENCED, sptr, acptr, notice);
|
||||
}
|
||||
return CANPRIVMSG_CONTINUE;
|
||||
}
|
||||
@@ -159,7 +158,7 @@ int ret;
|
||||
** rev argv 6/91
|
||||
**
|
||||
*/
|
||||
int cmd_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], int notice)
|
||||
int cmd_message(Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], int notice)
|
||||
{
|
||||
Client *acptr;
|
||||
Channel *chptr;
|
||||
@@ -365,7 +364,7 @@ int cmd_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, ch
|
||||
continue;
|
||||
}
|
||||
|
||||
sendto_channel(chptr, sptr, cptr,
|
||||
sendto_channel(chptr, sptr, sptr,
|
||||
prefix, 0, sendflags, mtags,
|
||||
notice ? ":%s NOTICE %s :%s" : ":%s PRIVMSG %s :%s",
|
||||
sptr->name, nick, text);
|
||||
@@ -398,7 +397,7 @@ int cmd_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, ch
|
||||
continue;
|
||||
}
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
sendto_match_butone(IsServer(cptr) ? cptr : NULL,
|
||||
sendto_match_butone(IsServer(sptr->direction) ? sptr->direction : NULL,
|
||||
sptr, nick + 1,
|
||||
(*nick == '#') ? MATCH_HOST :
|
||||
MATCH_SERVER,
|
||||
@@ -414,7 +413,7 @@ int cmd_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, ch
|
||||
{
|
||||
text = parv[2];
|
||||
newcmd = cmd;
|
||||
ret = can_privmsg(cptr, sptr, acptr, notice, &text, &newcmd);
|
||||
ret = can_privmsg(sptr, acptr, notice, &text, &newcmd);
|
||||
if (ret == CANPRIVMSG_SEND)
|
||||
{
|
||||
MessageTag *mtags = NULL;
|
||||
@@ -461,7 +460,7 @@ int cmd_message(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, ch
|
||||
*/
|
||||
CMD_FUNC(cmd_private)
|
||||
{
|
||||
return cmd_message(cptr, sptr, recv_mtags, parc, parv, 0);
|
||||
return cmd_message(sptr, recv_mtags, parc, parv, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -471,7 +470,7 @@ CMD_FUNC(cmd_private)
|
||||
*/
|
||||
CMD_FUNC(cmd_notice)
|
||||
{
|
||||
return cmd_message(cptr, sptr, recv_mtags, parc, parv, 1);
|
||||
return cmd_message(sptr, recv_mtags, parc, parv, 1);
|
||||
}
|
||||
|
||||
/** Make a viewable dcc filename.
|
||||
@@ -857,7 +856,7 @@ int ban_version(Client *sptr, char *text)
|
||||
}
|
||||
|
||||
/** Can user send a message to this channel?
|
||||
* @param cptr The client
|
||||
* @param sptr The client
|
||||
* @param chptr The channel
|
||||
* @param msgtext The message to send (MAY be changed, even if user is allowed to send)
|
||||
* @param errmsg The error message (will be filled in)
|
||||
@@ -865,18 +864,18 @@ int ban_version(Client *sptr, char *text)
|
||||
* @returns Returns 1 if the user is allowed to send, otherwise 0.
|
||||
* (note that this behavior was reversed in UnrealIRCd versions <5.x.
|
||||
*/
|
||||
int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int notice)
|
||||
int _can_send(Client *sptr, Channel *chptr, char **msgtext, char **errmsg, int notice)
|
||||
{
|
||||
Membership *lp;
|
||||
int member, i = 0;
|
||||
Hook *h;
|
||||
|
||||
if (!MyUser(cptr))
|
||||
if (!MyUser(sptr))
|
||||
return 1;
|
||||
|
||||
*errmsg = NULL;
|
||||
|
||||
member = IsMember(cptr, chptr);
|
||||
member = IsMember(sptr, chptr);
|
||||
|
||||
if (chptr->mode.mode & MODE_NOPRIVMSGS && !member)
|
||||
{
|
||||
@@ -885,7 +884,7 @@ int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int n
|
||||
*/
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_CHANMSG_EXTERNAL);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_CHANMSG_EXTERNAL);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
@@ -896,9 +895,9 @@ int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int n
|
||||
}
|
||||
}
|
||||
|
||||
lp = find_membership_link(cptr->user->channel, chptr);
|
||||
lp = find_membership_link(sptr->user->channel, chptr);
|
||||
if (chptr->mode.mode & MODE_MODERATED &&
|
||||
!op_can_override("channel:override:message:moderated",cptr,chptr,NULL) &&
|
||||
!op_can_override("channel:override:message:moderated",sptr,chptr,NULL) &&
|
||||
(!lp /* FIXME: UGLY */
|
||||
|| !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER | CHFL_HALFOP | CHFL_CHANADMIN))))
|
||||
{
|
||||
@@ -907,7 +906,7 @@ int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int n
|
||||
*/
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_CHANMSG_MODERATED);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_CHANMSG_MODERATED);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
@@ -921,7 +920,7 @@ int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int n
|
||||
/* Modules can plug in as well */
|
||||
for (h = Hooks[HOOKTYPE_CAN_SEND]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(cptr, chptr, lp, msgtext, errmsg, notice);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, lp, msgtext, errmsg, notice);
|
||||
if (i != HOOK_CONTINUE)
|
||||
{
|
||||
#ifdef DEBUGMODE
|
||||
@@ -944,13 +943,13 @@ int _can_send(Client *cptr, Channel *chptr, char **msgtext, char **errmsg, int n
|
||||
/* Now we are going to check bans */
|
||||
|
||||
/* ..but first: exempt ircops */
|
||||
if (op_can_override("channel:override:message:ban",cptr,chptr,NULL))
|
||||
if (op_can_override("channel:override:message:ban",sptr,chptr,NULL))
|
||||
return 1;
|
||||
|
||||
if ((!lp
|
||||
|| !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER |
|
||||
CHFL_HALFOP | CHFL_CHANADMIN))) && MyUser(cptr)
|
||||
&& is_banned(cptr, chptr, BANCHK_MSG, msgtext, errmsg))
|
||||
CHFL_HALFOP | CHFL_CHANADMIN))) && MyUser(sptr)
|
||||
&& is_banned(sptr, chptr, BANCHK_MSG, msgtext, errmsg))
|
||||
{
|
||||
/* Modules can set 'errmsg', otherwise we default to this: */
|
||||
if (!*errmsg)
|
||||
|
||||
+79
-89
@@ -25,7 +25,7 @@
|
||||
/* Forward declarations */
|
||||
CMD_FUNC(cmd_mode);
|
||||
CMD_FUNC(cmd_mlock);
|
||||
void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode);
|
||||
void _do_mode(Channel *chptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode);
|
||||
void _set_mode(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcount,
|
||||
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], int bounce);
|
||||
CMD_FUNC(_cmd_umode);
|
||||
@@ -108,11 +108,11 @@ CMD_FUNC(cmd_mode)
|
||||
chptr = find_channel(parv[1], NULL);
|
||||
if (!chptr)
|
||||
{
|
||||
return cmd_umode(cptr, sptr, recv_mtags, parc, parv);
|
||||
return cmd_umode(sptr, recv_mtags, parc, parv);
|
||||
}
|
||||
}
|
||||
else
|
||||
return cmd_umode(cptr, sptr, recv_mtags, parc, parv);
|
||||
return cmd_umode(sptr, recv_mtags, parc, parv);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -129,90 +129,81 @@ CMD_FUNC(cmd_mode)
|
||||
|
||||
modebuf[1] = '\0';
|
||||
channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr);
|
||||
sendnumeric(sptr, RPL_CHANNELMODEIS,
|
||||
chptr->chname, modebuf, parabuf);
|
||||
sendnumeric(sptr, RPL_CREATIONTIME,
|
||||
chptr->chname, chptr->creationtime);
|
||||
sendnumeric(sptr, RPL_CHANNELMODEIS, chptr->chname, modebuf, parabuf);
|
||||
sendnumeric(sptr, RPL_CREATIONTIME, chptr->chname, chptr->creationtime);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IsUser(sptr) && strstr(parv[2], "b") && BadPtr(parv[3]))
|
||||
if (MyUser(sptr))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",sptr,NULL,chptr,NULL))
|
||||
/* Deal with information requests from local users, such as:
|
||||
* MODE #chan b Show the ban list
|
||||
* MODE #chan e Show the ban exemption list
|
||||
* MODE #chan I Show the invite exception list
|
||||
* MODE #chan q Show list of channel owners
|
||||
* MODE #chan a Show list of channel admins
|
||||
*/
|
||||
if (strstr(parv[2], "b") && BadPtr(parv[3]))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",sptr,NULL,chptr,NULL))
|
||||
return 0;
|
||||
/* send ban list */
|
||||
for (ban = chptr->banlist; ban; ban = ban->next)
|
||||
sendnumeric(sptr, RPL_BANLIST, chptr->chname, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(sptr, RPL_ENDOFBANLIST, chptr->chname);
|
||||
return 0;
|
||||
/* send ban list */
|
||||
for (ban = chptr->banlist; ban; ban = ban->next)
|
||||
sendnumeric(sptr, RPL_BANLIST, chptr->chname, ban->banstr,
|
||||
ban->who, ban->when);
|
||||
sendnumeric(cptr, RPL_ENDOFBANLIST,
|
||||
chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsUser(sptr) && strstr(parv[2], "e") && BadPtr(parv[3]))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",sptr,NULL,chptr,NULL))
|
||||
if (strstr(parv[2], "e") && BadPtr(parv[3]))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remotebanlist",sptr,NULL,chptr,NULL))
|
||||
return 0;
|
||||
/* send exban list */
|
||||
for (ban = chptr->exlist; ban; ban = ban->next)
|
||||
sendnumeric(sptr, RPL_EXLIST, chptr->chname, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(sptr, RPL_ENDOFEXLIST, chptr->chname);
|
||||
return 0;
|
||||
/* send exban list */
|
||||
for (ban = chptr->exlist; ban; ban = ban->next)
|
||||
sendnumeric(sptr, RPL_EXLIST, chptr->chname, ban->banstr,
|
||||
ban->who, ban->when);
|
||||
sendnumeric(cptr, RPL_ENDOFEXLIST,
|
||||
chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsUser(sptr) && strstr(parv[2], "I") && BadPtr(parv[3]))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteinvexlist",sptr,NULL,chptr,NULL))
|
||||
if (strstr(parv[2], "I") && BadPtr(parv[3]))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteinvexlist",sptr,NULL,chptr,NULL))
|
||||
return 0;
|
||||
for (ban = chptr->invexlist; ban; ban = ban->next)
|
||||
sendnumeric(sptr, RPL_INVEXLIST, chptr->chname, ban->banstr, ban->who, ban->when);
|
||||
sendnumeric(sptr, RPL_ENDOFINVEXLIST, chptr->chname);
|
||||
return 0;
|
||||
for (ban = chptr->invexlist; ban; ban = ban->next)
|
||||
sendnumeric(sptr, RPL_INVEXLIST, chptr->chname, ban->banstr,
|
||||
ban->who, ban->when);
|
||||
sendnumeric(sptr, RPL_ENDOFINVEXLIST, chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsUser(sptr) && strstr(parv[2], "q") && BadPtr(parv[3]))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",sptr,NULL,chptr,NULL))
|
||||
return 0;
|
||||
if (strstr(parv[2], "q") && BadPtr(parv[3]))
|
||||
{
|
||||
Member *member;
|
||||
/* send chanowner list */
|
||||
/* [Whole story about bad loops removed, sorry ;)]
|
||||
* Now rewritten so it works (was: bad logic) -- Syzop
|
||||
*/
|
||||
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",sptr,NULL,chptr,NULL))
|
||||
return 0;
|
||||
|
||||
for (member = chptr->members; member; member = member->next)
|
||||
{
|
||||
if (is_chanowner(member->cptr, chptr))
|
||||
sendnumeric(sptr, RPL_QLIST, chptr->chname,
|
||||
member->cptr->name);
|
||||
sendnumeric(sptr, RPL_QLIST, chptr->chname, member->cptr->name);
|
||||
}
|
||||
sendnumeric(cptr, RPL_ENDOFQLIST,
|
||||
chptr->chname);
|
||||
sendnumeric(sptr, RPL_ENDOFQLIST, chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsUser(sptr) && strstr(parv[2], "a") && BadPtr(parv[3]))
|
||||
{
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",sptr,NULL,chptr,NULL))
|
||||
return 0;
|
||||
if (strstr(parv[2], "a") && BadPtr(parv[3]))
|
||||
{
|
||||
Member *member;
|
||||
/* send chanowner list */
|
||||
/* [Whole story about bad loops removed, sorry ;)]
|
||||
* Now rewritten so it works (was: bad logic) -- Syzop
|
||||
*/
|
||||
|
||||
if (!IsMember(sptr, chptr) && !ValidatePermissionsForPath("channel:see:mode:remoteownerlist",sptr,NULL,chptr,NULL))
|
||||
return 0;
|
||||
|
||||
for (member = chptr->members; member; member = member->next)
|
||||
{
|
||||
if (is_chanadmin(member->cptr, chptr))
|
||||
sendnumeric(sptr, RPL_ALIST, chptr->chname,
|
||||
member->cptr->name);
|
||||
sendnumeric(sptr, RPL_ALIST, chptr->chname, member->cptr->name);
|
||||
}
|
||||
sendnumeric(cptr, RPL_ENDOFALIST,
|
||||
chptr->chname);
|
||||
sendnumeric(sptr, RPL_ENDOFALIST, chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -236,20 +227,21 @@ CMD_FUNC(cmd_mode)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* User does not have permission to use the MODE command */
|
||||
if (IsUser(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr) &&
|
||||
!is_half_op(sptr, chptr) &&
|
||||
(cptr == sptr || !ValidatePermissionsForPath("channel:override:mode",sptr,NULL,chptr,NULL)))
|
||||
!ValidatePermissionsForPath("channel:override:mode",sptr,NULL,chptr,NULL))
|
||||
{
|
||||
if (cptr == sptr)
|
||||
if (MyUser(sptr))
|
||||
{
|
||||
sendnumeric(sptr, ERR_CHANOPRIVSNEEDED, chptr->chname);
|
||||
return 0;
|
||||
}
|
||||
sendto_one(cptr, NULL, ":%s MODE %s -oh %s %s 0",
|
||||
sendto_one(sptr, NULL, ":%s MODE %s -oh %s %s 0",
|
||||
me.name, chptr->chname, sptr->name, sptr->name);
|
||||
/* Tell the other server that the user is
|
||||
* de-opped. Fix op desyncs. */
|
||||
bounce_mode(chptr, cptr, parc - 2, parv + 2);
|
||||
bounce_mode(chptr, sptr, parc - 2, parv + 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -264,7 +256,7 @@ CMD_FUNC(cmd_mode)
|
||||
"*** TS bounce for %s - %lld(ours) %lld(theirs)",
|
||||
chptr->chname, (long long)chptr->creationtime,
|
||||
(long long)sendts);
|
||||
bounce_mode(chptr, cptr, parc - 2, parv + 2);
|
||||
bounce_mode(chptr, sptr, parc - 2, parv + 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -285,7 +277,7 @@ aftercheck:
|
||||
/* Filter out the unprivileged FIRST. *
|
||||
* Now, we can actually do the mode. */
|
||||
|
||||
(void)do_mode(chptr, cptr, sptr, recv_mtags, parc - 2, parv + 2, sendts, 0);
|
||||
(void)do_mode(chptr, sptr, recv_mtags, parc - 2, parv + 2, sendts, 0);
|
||||
/* After this don't touch 'chptr' anymore, as permanent module may have destroyed the channel */
|
||||
opermode = 0; /* Important since sometimes forgotten. -- Syzop */
|
||||
return 0;
|
||||
@@ -392,7 +384,7 @@ static void bounce_mode(Channel *chptr, Client *cptr, int parc, char *parv[])
|
||||
* User or server is authorized to do the mode. This takes care of
|
||||
* setting the mode and relaying it to other users and servers.
|
||||
*/
|
||||
void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode)
|
||||
void _do_mode(Channel *chptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], time_t sendts, int samode)
|
||||
{
|
||||
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3];
|
||||
int pcount;
|
||||
@@ -412,9 +404,9 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags
|
||||
samode_in_progress = 0;
|
||||
|
||||
if (MyConnect(sptr))
|
||||
RunHook8(HOOKTYPE_PRE_LOCAL_CHANMODE, cptr, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
RunHook7(HOOKTYPE_PRE_LOCAL_CHANMODE, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
else
|
||||
RunHook8(HOOKTYPE_PRE_REMOTE_CHANMODE, cptr, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
RunHook7(HOOKTYPE_PRE_REMOTE_CHANMODE, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
|
||||
if (IsServer(sptr))
|
||||
{
|
||||
@@ -428,9 +420,9 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags
|
||||
{
|
||||
sendto_realops(
|
||||
"Warning! Possible desynch: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)",
|
||||
chptr->chname, modebuf, parabuf, (long long)sendts, cptr->name, sptr->name);
|
||||
chptr->chname, modebuf, parabuf, (long long)sendts, sptr->direction->name, sptr->name);
|
||||
ircd_log(LOG_ERROR, "Possible desynch: MODE for channel %s ('%s %s') has fishy timestamp (%lld) (from %s/%s)",
|
||||
chptr->chname, modebuf, parabuf, (long long)sendts, cptr->name, sptr->name);
|
||||
chptr->chname, modebuf, parabuf, (long long)sendts, sptr->direction->name, sptr->name);
|
||||
}
|
||||
/* new chan or our timestamp is wrong */
|
||||
/* now works for double-bounce prevention */
|
||||
@@ -440,7 +432,7 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags
|
||||
{
|
||||
/* theirs is wrong but we let it pass anyway */
|
||||
sendts = chptr->creationtime;
|
||||
sendto_one(cptr, NULL, ":%s MODE %s + %lld", me.name,
|
||||
sendto_one(sptr, NULL, ":%s MODE %s + %lld", me.name,
|
||||
chptr->chname, (long long)chptr->creationtime);
|
||||
}
|
||||
}
|
||||
@@ -455,11 +447,11 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags
|
||||
/* relay bounce time changes */
|
||||
if (chptr->creationtime)
|
||||
{
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s MODE %s %s+ %lld",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s MODE %s %s+ %lld",
|
||||
me.name, chptr->chname, isbounce ? "&" : "",
|
||||
(long long)chptr->creationtime);
|
||||
} else {
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s MODE %s %s+",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s MODE %s %s+",
|
||||
me.name, chptr->chname, isbounce ? "&" : "");
|
||||
}
|
||||
free_message_tags(mtags);
|
||||
@@ -511,7 +503,7 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags
|
||||
|
||||
if (IsServer(sptr) && sendts != -1)
|
||||
{
|
||||
sendto_server(cptr, 0, 0, mtags,
|
||||
sendto_server(sptr, 0, 0, mtags,
|
||||
":%s MODE %s %s%s %s %lld",
|
||||
sptr->name, chptr->chname,
|
||||
isbounce ? "&" : "", modebuf, parabuf,
|
||||
@@ -520,12 +512,12 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags
|
||||
if (samode && IsMe(sptr))
|
||||
{
|
||||
/* SAMODE is a special case: always send a TS of 0 (omitting TS==desynch) */
|
||||
sendto_server(cptr, 0, 0, mtags,
|
||||
sendto_server(sptr, 0, 0, mtags,
|
||||
":%s MODE %s %s %s 0",
|
||||
sptr->name, chptr->chname, modebuf, parabuf);
|
||||
} else
|
||||
{
|
||||
sendto_server(cptr, 0, 0, mtags,
|
||||
sendto_server(sptr, 0, 0, mtags,
|
||||
":%s MODE %s %s%s %s",
|
||||
sptr->name, chptr->chname, isbounce ? "&" : "", modebuf, parabuf);
|
||||
/* tell them it's not a timestamp, in case the last param
|
||||
@@ -533,9 +525,9 @@ void _do_mode(Channel *chptr, Client *cptr, Client *sptr, MessageTag *recv_mtags
|
||||
}
|
||||
|
||||
if (MyConnect(sptr))
|
||||
RunHook8(HOOKTYPE_LOCAL_CHANMODE, cptr, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
RunHook7(HOOKTYPE_LOCAL_CHANMODE, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
else
|
||||
RunHook8(HOOKTYPE_REMOTE_CHANMODE, cptr, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
RunHook7(HOOKTYPE_REMOTE_CHANMODE, sptr, chptr, mtags, modebuf, parabuf, sendts, samode);
|
||||
|
||||
/* After this, don't touch 'chptr' anymore! As permanent module may have destroyed the channel. */
|
||||
|
||||
@@ -921,8 +913,7 @@ process_listmode:
|
||||
{
|
||||
char errbuf[NICKLEN+30];
|
||||
ircsnprintf(errbuf, sizeof(errbuf), "%s is a channel owner", member->cptr->name);
|
||||
sendnumeric(cptr, ERR_CANNOTCHANGECHANMODE,
|
||||
modechar, errbuf);
|
||||
sendnumeric(cptr, ERR_CANNOTCHANGECHANMODE, modechar, errbuf);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -948,8 +939,7 @@ process_listmode:
|
||||
{
|
||||
char errbuf[NICKLEN+30];
|
||||
ircsnprintf(errbuf, sizeof(errbuf), "%s is a channel admin", member->cptr->name);
|
||||
sendnumeric(cptr, ERR_CANNOTCHANGECHANMODE,
|
||||
modechar, errbuf);
|
||||
sendnumeric(cptr, ERR_CANNOTCHANGECHANMODE, modechar, errbuf);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -1672,7 +1662,7 @@ CMD_FUNC(_cmd_umode)
|
||||
{
|
||||
sendto_realops("QUARANTINE: Oper %s on server %s killed, due to quarantine", sptr->name, sptr->srvptr->name);
|
||||
sendto_server(NULL, 0, 0, NULL, ":%s KILL %s :%s (Quarantined: no oper privileges allowed)", me.name, sptr->name, me.name);
|
||||
return exit_client(cptr, sptr, &me, NULL, "Quarantined: no oper privileges allowed");
|
||||
return exit_client(sptr->direction, sptr, &me, NULL, "Quarantined: no oper privileges allowed");
|
||||
}
|
||||
/* A local user trying to set himself +o/+O is denied here.
|
||||
* A while later (outside this loop) it is handled as well (and +C, +N, etc too)
|
||||
@@ -1808,7 +1798,7 @@ CMD_FUNC(_cmd_umode)
|
||||
((oldumodes & UMODE_SETHOST) && !IsSetHost(sptr) && IsHidden(sptr)))
|
||||
{
|
||||
if (!dontspread)
|
||||
sendto_server(cptr, PROTO_VHP, 0, NULL, ":%s SETHOST :%s",
|
||||
sendto_server(sptr, PROTO_VHP, 0, NULL, ":%s SETHOST :%s",
|
||||
sptr->name, sptr->user->virthost);
|
||||
|
||||
/* Set the vhost */
|
||||
@@ -1885,7 +1875,7 @@ CMD_FUNC(_cmd_umode)
|
||||
if (oldumodes != sptr->umodes)
|
||||
RunHook3(HOOKTYPE_UMODE_CHANGE, sptr, oldumodes, sptr->umodes);
|
||||
if (dontspread == 0)
|
||||
send_umode_out(cptr, sptr, oldumodes);
|
||||
send_umode_out(sptr, 1, oldumodes);
|
||||
|
||||
if (MyConnect(sptr) && setsnomask != sptr->user->snomask)
|
||||
sendnumeric(sptr, RPL_SNOMASK, get_sno_str(sptr));
|
||||
@@ -1913,7 +1903,7 @@ CMD_FUNC(cmd_mlock)
|
||||
return 0;
|
||||
|
||||
if (IsServer(sptr))
|
||||
set_channel_mlock(cptr, sptr, chptr, parv[3], TRUE);
|
||||
set_channel_mlock(sptr, chptr, parv[3], TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ CMD_FUNC(cmd_motd)
|
||||
if (IsServer(sptr))
|
||||
return 0;
|
||||
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
{
|
||||
if (MyUser(sptr))
|
||||
sptr->local->since += 15;
|
||||
|
||||
+17
-13
@@ -77,9 +77,13 @@ CMD_FUNC(cmd_netinfo)
|
||||
if (parc < 9)
|
||||
return 0;
|
||||
|
||||
if (IsNetInfo(cptr))
|
||||
/* Only allow from directly connected servers */
|
||||
if (!MyConnect(sptr))
|
||||
return 0;
|
||||
|
||||
if (IsNetInfo(sptr))
|
||||
{
|
||||
sendto_realops("Already got NETINFO from Link %s", cptr->name);
|
||||
sendto_realops("Already got NETINFO from Link %s", sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -93,7 +97,7 @@ CMD_FUNC(cmd_netinfo)
|
||||
{
|
||||
irccounts.global_max = lmax;
|
||||
sendto_realops("Max Global Count is now %li (set by link %s)",
|
||||
lmax, cptr->name);
|
||||
lmax, sptr->name);
|
||||
}
|
||||
|
||||
xx = TStime();
|
||||
@@ -106,38 +110,38 @@ CMD_FUNC(cmd_netinfo)
|
||||
}
|
||||
sendto_realops
|
||||
("Possible negative TS split at link %s (%lld - %lld = %lld)%s",
|
||||
cptr->name, (long long)(xx), (long long)(endsync), (long long)(xx - endsync), emsg);
|
||||
sptr->name, (long long)(xx), (long long)(endsync), (long long)(xx - endsync), emsg);
|
||||
sendto_server(&me, 0, 0, NULL,
|
||||
":%s SMO o :\2(sync)\2 Possible negative TS split at link %s (%lld - %lld = %lld)%s",
|
||||
me.name, cptr->name, (long long)(xx), (long long)(endsync), (long long)(xx - endsync), emsg);
|
||||
me.name, sptr->name, (long long)(xx), (long long)(endsync), (long long)(xx - endsync), emsg);
|
||||
}
|
||||
sendto_realops
|
||||
("Link %s -> %s is now synced [secs: %lld recv: %ld.%hu sent: %ld.%hu]",
|
||||
cptr->name, me.name, (long long)(TStime() - endsync), sptr->local->receiveK,
|
||||
sptr->name, me.name, (long long)(TStime() - endsync), sptr->local->receiveK,
|
||||
sptr->local->receiveB, sptr->local->sendK, sptr->local->sendB);
|
||||
|
||||
sendto_server(&me, 0, 0, NULL,
|
||||
":%s SMO o :\2(sync)\2 Link %s -> %s is now synced [secs: %lld recv: %ld.%hu sent: %ld.%hu]",
|
||||
me.name, cptr->name, me.name, (long long)(TStime() - endsync), sptr->local->receiveK,
|
||||
me.name, sptr->name, me.name, (long long)(TStime() - endsync), sptr->local->receiveK,
|
||||
sptr->local->receiveB, sptr->local->sendK, sptr->local->sendB);
|
||||
|
||||
if (!(strcmp(ircnetwork, parv[8]) == 0))
|
||||
{
|
||||
sendto_realops("Network name mismatch from link %s (%s != %s)",
|
||||
cptr->name, parv[8], ircnetwork);
|
||||
sptr->name, parv[8], ircnetwork);
|
||||
sendto_server(&me, 0, 0, NULL,
|
||||
":%s SMO o :\2(sync)\2 Network name mismatch from link %s (%s != %s)",
|
||||
me.name, cptr->name, parv[8], ircnetwork);
|
||||
me.name, sptr->name, parv[8], ircnetwork);
|
||||
}
|
||||
|
||||
if ((protocol != UnrealProtocol) && (protocol != 0))
|
||||
{
|
||||
sendto_realops
|
||||
("Link %s is running Protocol u%li while we are running %d!",
|
||||
cptr->name, protocol, UnrealProtocol);
|
||||
sptr->name, protocol, UnrealProtocol);
|
||||
sendto_server(&me, 0, 0, NULL,
|
||||
":%s SMO o :\2(sync)\2 Link %s is running u%li while %s is running %d!",
|
||||
me.name, cptr->name, protocol, me.name, UnrealProtocol);
|
||||
me.name, sptr->name, protocol, me.name, UnrealProtocol);
|
||||
|
||||
}
|
||||
strlcpy(buf, CLOAK_KEYCRC, sizeof(buf));
|
||||
@@ -145,8 +149,8 @@ CMD_FUNC(cmd_netinfo)
|
||||
{
|
||||
sendto_realops
|
||||
("Link %s has a DIFFERENT CLOAK KEY - %s != %s. \002YOU SHOULD CORRECT THIS ASAP\002.",
|
||||
cptr->name, parv[4], buf);
|
||||
sptr->name, parv[4], buf);
|
||||
}
|
||||
SetNetInfo(cptr);
|
||||
SetNetInfo(sptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+106
-211
@@ -36,8 +36,8 @@ ModuleHeader MOD_HEADER
|
||||
/* Forward declarations */
|
||||
CMD_FUNC(cmd_nick);
|
||||
CMD_FUNC(cmd_uid);
|
||||
int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip);
|
||||
int AllowClient(Client *cptr, struct hostent *hp, char *sockhost, char *username);
|
||||
int _register_user(Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip);
|
||||
int AllowClient(Client *cptr, struct hostent *hp, char *sockhost, char *username);
|
||||
int check_client(Client *cptr, char *username);
|
||||
|
||||
MOD_TEST()
|
||||
@@ -95,7 +95,7 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien
|
||||
(type == NICKCOL_EQUAL) ? "None (equal)" : ((type == NICKCOL_NEW_WON) ? "New won" : "Existing won"),
|
||||
new ? "nick-change" : "new user connecting");
|
||||
|
||||
new_server = cptr->name; // not correct, should be sptr
|
||||
new_server = cptr->name;
|
||||
existing_server = (existing == existing->direction) ? me.name : existing->direction->name;
|
||||
if (type == NICKCOL_EXISTING_WON)
|
||||
snprintf(comment, sizeof(comment), "Nick collision: %s <- %s", new_server, existing_server);
|
||||
@@ -104,6 +104,9 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien
|
||||
else
|
||||
snprintf(comment, sizeof(comment), "Nick collision: %s <-> %s", existing_server, new_server);
|
||||
|
||||
/* We only care about the direction from this point, not about the originally sending server */
|
||||
cptr = cptr->direction;
|
||||
|
||||
if ((type == NICKCOL_EQUAL) || (type == NICKCOL_EXISTING_WON))
|
||||
{
|
||||
/* Kill 'new':
|
||||
@@ -264,9 +267,9 @@ CMD_FUNC(cmd_uid)
|
||||
int ishold;
|
||||
Client *acptr, *serv = NULL;
|
||||
Client *acptrs;
|
||||
char nick[NICKLEN + 2];
|
||||
char nick[NICKLEN + 2]; // FIXME: why +2 and not +1?
|
||||
long lastnick = 0l;
|
||||
int differ = 1;
|
||||
int differ = 1;
|
||||
|
||||
if (parc < 13)
|
||||
{
|
||||
@@ -274,100 +277,56 @@ CMD_FUNC(cmd_uid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!IsServer(cptr))
|
||||
strlcpy(nick, parv[1], iConf.nick_length + 1);
|
||||
else
|
||||
strlcpy(nick, parv[1], NICKLEN + 1);
|
||||
|
||||
/* For a local clients, do proper nickname checking via do_nick_name()
|
||||
* and reject the nick if it returns false.
|
||||
* For remote clients, do a quick check by using do_remote_nick_name(),
|
||||
* if this returned false then reject and kill it. -- Syzop
|
||||
/* It's not just the directly attached client which must be a
|
||||
* server. The source itself needs to be a server.
|
||||
*/
|
||||
if (IsServer(cptr) && !do_remote_nick_name(nick))
|
||||
if (!IsServer(sptr))
|
||||
{
|
||||
sendnumeric(sptr, ERR_NOTFORUSERS, "UID");
|
||||
return 0;
|
||||
}
|
||||
|
||||
strlcpy(nick, parv[1], NICKLEN + 1);
|
||||
|
||||
/* Do some *MINIMAL* nick name checking for remote nicknames.
|
||||
* This will only catch things that severely break things. -- Syzop
|
||||
*/
|
||||
if (!do_remote_nick_name(nick))
|
||||
{
|
||||
sendnumeric(sptr, ERR_ERRONEUSNICKNAME, parv[1], "Illegal characters");
|
||||
|
||||
if (IsServer(cptr))
|
||||
{
|
||||
ircstats.is_kill++;
|
||||
sendto_umode(UMODE_OPER, "Bad Nick: %s From: %s %s",
|
||||
parv[1], sptr->name, get_client_name(cptr, FALSE));
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (%s <- %s[%s])",
|
||||
me.name, parv[1], me.name, parv[1],
|
||||
nick, cptr->name);
|
||||
if (sptr != cptr)
|
||||
{
|
||||
/* bad nick change */
|
||||
MessageTag *mtags = NULL;
|
||||
int n;
|
||||
|
||||
new_message(sptr, NULL, &mtags);
|
||||
|
||||
sendto_server(cptr, 0, 0, mtags,
|
||||
":%s KILL %s :%s (%s <- %s!%s@%s)",
|
||||
me.name, sptr->name, me.name,
|
||||
get_client_name(cptr, FALSE),
|
||||
sptr->name,
|
||||
sptr->user ? sptr->ident : "",
|
||||
sptr->user ? sptr->user->server :
|
||||
cptr->name);
|
||||
SetKilled(sptr);
|
||||
n = exit_client(cptr, sptr, &me, mtags, "BadNick");
|
||||
|
||||
free_message_tags(mtags);
|
||||
|
||||
return n;
|
||||
}
|
||||
}
|
||||
ircstats.is_kill++;
|
||||
sendto_umode(UMODE_OPER, "Bad Nick: %s From: %s %s",
|
||||
parv[1], sptr->name, get_client_name(sptr, FALSE));
|
||||
/* Send kill to uplink only, hasn't been broadcasted to the rest, anyway */
|
||||
sendto_one(sptr, NULL, ":%s KILL %s :%s (%s <- %s[%s])",
|
||||
me.name, parv[1], me.name, parv[1],
|
||||
nick, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Kill quarantined opers early... */
|
||||
if (IsServer(cptr) && IsQuarantined(sptr->direction) &&
|
||||
(parc >= 11) && strchr(parv[8], 'o'))
|
||||
if (IsQuarantined(sptr->direction) && strchr(parv[8], 'o'))
|
||||
{
|
||||
ircstats.is_kill++;
|
||||
/* Send kill to uplink only, hasn't been broadcasted to the rest, anyway */
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (Quarantined: no oper privileges allowed)",
|
||||
sendto_one(sptr, NULL, ":%s KILL %s :%s (Quarantined: no oper privileges allowed)",
|
||||
me.name, parv[1], me.name);
|
||||
sendto_realops("QUARANTINE: Oper %s on server %s killed, due to quarantine",
|
||||
parv[1], sptr->name);
|
||||
/* (nothing to exit_client or to free, since user was never added) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Protocol 4 doesn't send the server as prefix, so it is possible
|
||||
** the server doesn't exist (a lagged net.burst), in which case
|
||||
** we simply need to ignore the NICK. Also when we got that server
|
||||
** name (again) but from another direction. --Run
|
||||
*/
|
||||
/*
|
||||
** We should really only deal with this for msgs from servers.
|
||||
** -- Aeto
|
||||
*/
|
||||
if (IsServer(cptr) &&
|
||||
(parc > 7
|
||||
&& (!(serv = find_server(sptr->name, NULL))
|
||||
|| serv->direction != cptr->direction)))
|
||||
{
|
||||
sendto_realops("Cannot find SID for %s (%s)", sptr->name,
|
||||
backupbuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Check for a Q-lined nickname. If we find it, and it's our
|
||||
** client, just reject it. -Lefler
|
||||
** Allow opers to use Q-lined nicknames. -Russell
|
||||
*/
|
||||
/* This one is never allowed, even from remotes */
|
||||
if (!strcasecmp("ircd", nick) || !strcasecmp("irc", nick))
|
||||
{
|
||||
sendnumeric(sptr, ERR_ERRONEUSNICKNAME, nick,
|
||||
"Reserved for internal IRCd purposes");
|
||||
sendnumeric(sptr, ERR_ERRONEUSNICKNAME, nick, "Reserved for internal IRCd purposes");
|
||||
sendto_one(sptr, NULL, ":%s KILL %s :%s (%s <- %s[%s])",
|
||||
me.name, parv[1], me.name, parv[1],
|
||||
nick, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!IsULine(sptr) && (tklban = find_qline(sptr, nick, &ishold)))
|
||||
{
|
||||
if (IsServer(sptr) && !ishold) /* server introducing new client */
|
||||
@@ -380,49 +339,28 @@ CMD_FUNC(cmd_uid)
|
||||
&& !IsServer(sptr) ? sptr->name : "<unregistered>"),
|
||||
acptrs ? acptrs->name : "unknown server");
|
||||
}
|
||||
|
||||
if (IsServer(cptr) && IsUser(sptr) && !ishold) /* remote user changing nick */
|
||||
{
|
||||
sendto_snomask(SNO_QLINE, "Q-Lined nick %s from %s on %s", nick,
|
||||
sptr->name, sptr->srvptr ? sptr->srvptr->name : "<unknown>");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** acptr already has result from previous find_server()
|
||||
*/
|
||||
/* Now check if 'nick' already exists - first, collisions with server names/ids (extremely rare) */
|
||||
if ((acptr = find_server(nick, NULL)) != NULL)
|
||||
{
|
||||
/*
|
||||
** We have a nickname trying to use the same name as
|
||||
** a server. Send out a nick collision KILL to remove
|
||||
** the nickname. As long as only a KILL is sent out,
|
||||
** there is no danger of the server being disconnected.
|
||||
** Ultimate way to jupiter a nick ? >;-). -avalon
|
||||
*/
|
||||
sendto_umode(UMODE_OPER, "Nick collision on %s(%s <- %s)",
|
||||
sptr->name, acptr->direction->name,
|
||||
get_client_name(cptr, FALSE));
|
||||
get_client_name(sptr, FALSE));
|
||||
ircstats.is_kill++;
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (%s <- %s)",
|
||||
sendto_one(sptr, NULL, ":%s KILL %s :%s (%s <- %s)",
|
||||
me.name, sptr->name, me.name, acptr->direction->name,
|
||||
/* NOTE: Cannot use get_client_name
|
||||
** twice here, it returns static
|
||||
** string pointer--the other info
|
||||
** would be lost
|
||||
*/
|
||||
get_client_name(cptr, FALSE));
|
||||
get_client_name(sptr, FALSE));
|
||||
SetKilled(sptr);
|
||||
return exit_client(cptr, sptr, &me, NULL, "Nick/Server collision");
|
||||
return exit_client(sptr->direction, sptr, &me, NULL, "Nick/Server collision");
|
||||
}
|
||||
|
||||
/* Now check if 'nick' already exists - collision with a user (or still in handshake, unknown) */
|
||||
if ((acptr = find_client(nick, NULL)) != NULL)
|
||||
{
|
||||
/*
|
||||
** A new NICK being introduced by a neighbouring
|
||||
** server (e.g. message type "NICK new" received)
|
||||
/* If there's a collision with a user that is still in handshake, on our side,
|
||||
* then we can just kill our client and continue.
|
||||
*/
|
||||
|
||||
if (MyConnect(acptr) && IsUnknown(acptr))
|
||||
{
|
||||
SetKilled(acptr);
|
||||
@@ -430,33 +368,11 @@ CMD_FUNC(cmd_uid)
|
||||
goto nickkill2done;
|
||||
}
|
||||
|
||||
if (acptr->user == NULL)
|
||||
{
|
||||
/* This is a Bad Thing */
|
||||
sendto_umode(UMODE_OPER, "Lost user field for %s in change from %s",
|
||||
acptr->name, get_client_name(cptr, FALSE));
|
||||
ircstats.is_kill++;
|
||||
sendto_one(acptr, NULL, ":%s KILL %s :%s (Lost user field!)",
|
||||
me.name, acptr->name, me.name);
|
||||
SetKilled(acptr);
|
||||
/* Here's the previous versions' desynch. If the old one is
|
||||
messed up, trash the old one and accept the new one.
|
||||
Remember - at this point there is a new nick coming in!
|
||||
Handle appropriately. -- Barubary */
|
||||
exit_client(NULL, acptr, &me, NULL, "Lost user field");
|
||||
goto nickkill2done;
|
||||
}
|
||||
|
||||
if (parc > 3)
|
||||
{
|
||||
lastnick = atol(parv[3]);
|
||||
if (parc > 5)
|
||||
differ = (mycmp(acptr->user->username, parv[4])
|
||||
|| mycmp(acptr->user->realhost, parv[5]));
|
||||
}
|
||||
lastnick = atol(parv[3]);
|
||||
differ = (mycmp(acptr->user->username, parv[4]) || mycmp(acptr->user->realhost, parv[5]));
|
||||
sendto_umode(UMODE_OPER, "Nick collision on %s (%s %lld <- %s %lld)",
|
||||
acptr->name, acptr->direction->name, (long long)acptr->lastnick,
|
||||
cptr->name, (long long)lastnick);
|
||||
sptr->direction->name, (long long)lastnick);
|
||||
/*
|
||||
** I'm putting the KILL handling here just to make it easier
|
||||
** to read, it's hard to follow it the way it used to be.
|
||||
@@ -470,69 +386,48 @@ CMD_FUNC(cmd_uid)
|
||||
** would kill their user. Not anymore.
|
||||
** -- binary
|
||||
*/
|
||||
if (!(parc > 3) || (acptr->lastnick == lastnick))
|
||||
if (acptr->lastnick == lastnick)
|
||||
{
|
||||
nick_collision(cptr, parv[1], ((parc > 6) ? parv[6] : NULL), NULL, acptr, NICKCOL_EQUAL);
|
||||
nick_collision(sptr, parv[1], ((parc > 6) ? parv[6] : NULL), NULL, acptr, NICKCOL_EQUAL);
|
||||
return 0; /* We killed both users, now stop the process. */
|
||||
}
|
||||
|
||||
if ((differ && (acptr->lastnick > lastnick)) ||
|
||||
(!differ && (acptr->lastnick < lastnick)) || acptr->direction == cptr) /* we missed a QUIT somewhere ? */
|
||||
(!differ && (acptr->lastnick < lastnick)) || acptr->direction == sptr->direction) /* we missed a QUIT somewhere ? */
|
||||
{
|
||||
nick_collision(cptr, parv[1], ((parc > 6) ? parv[6] : NULL), NULL, acptr, NICKCOL_NEW_WON);
|
||||
nick_collision(sptr, parv[1], ((parc > 6) ? parv[6] : NULL), NULL, acptr, NICKCOL_NEW_WON);
|
||||
/* We got rid of the "wrong" user. Introduce the correct one. */
|
||||
/* ^^ hmm.. why was this absent in nenolod's code, resulting in a 'return 0'? seems wrong. */
|
||||
goto nickkill2done;
|
||||
}
|
||||
|
||||
if ((differ && (acptr->lastnick < lastnick)) ||
|
||||
(!differ && (acptr->lastnick > lastnick)))
|
||||
if ((differ && (acptr->lastnick < lastnick)) || (!differ && (acptr->lastnick > lastnick)))
|
||||
{
|
||||
nick_collision(cptr, parv[1], ((parc > 6) ? parv[6] : NULL), NULL, acptr, NICKCOL_EXISTING_WON);
|
||||
nick_collision(sptr, parv[1], ((parc > 6) ? parv[6] : NULL), NULL, acptr, NICKCOL_EXISTING_WON);
|
||||
return 0; /* Ignore the NICK */
|
||||
}
|
||||
return 0; /* just in case */
|
||||
}
|
||||
|
||||
nickkill2done:
|
||||
if (IsServer(sptr))
|
||||
{
|
||||
/* A server introducing a new client, change source */
|
||||
/* Proceed with introducing the new client, change source (replace sptr) */
|
||||
|
||||
if (serv == NULL)
|
||||
serv = sptr;
|
||||
sptr = make_client(cptr, serv);
|
||||
strlcpy(sptr->id, parv[6], IDLEN);
|
||||
add_client_to_list(sptr);
|
||||
add_to_id_hash_table(sptr->id, sptr);
|
||||
if (parc > 2)
|
||||
sptr->hopcount = atol(parv[2]);
|
||||
if (parc > 3)
|
||||
sptr->lastnick = atol(parv[3]);
|
||||
else /* Little bit better, as long as not all upgraded */
|
||||
sptr->lastnick = TStime();
|
||||
if (sptr->lastnick < 0)
|
||||
{
|
||||
sendto_realops
|
||||
("Negative timestamp recieved from %s, resetting to TStime (%s)",
|
||||
cptr->name, backupbuf);
|
||||
sptr->lastnick = TStime();
|
||||
}
|
||||
}
|
||||
serv = sptr;
|
||||
sptr = make_client(serv->direction, serv);
|
||||
strlcpy(sptr->id, parv[6], IDLEN);
|
||||
add_client_to_list(sptr);
|
||||
add_to_id_hash_table(sptr->id, sptr);
|
||||
sptr->lastnick = atol(parv[3]);
|
||||
strlcpy(sptr->name, nick, NICKLEN+1);
|
||||
add_to_client_hash_table(nick, sptr);
|
||||
|
||||
(void)strlcpy(sptr->name, nick, NICKLEN+1);
|
||||
(void)add_to_client_hash_table(nick, sptr);
|
||||
|
||||
if (IsServer(cptr) && parc > 7)
|
||||
{
|
||||
/* XXX: we need to split this out into register_remote_user() or something. */
|
||||
parv[3] = nick;
|
||||
parv[6] = sptr->name;
|
||||
if (do_cmd(cptr, sptr, recv_mtags, "USER", parc - 3, &parv[3]) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
if (IsNetInfo(cptr) && !IsULine(sptr))
|
||||
sendto_fconnectnotice(sptr, 0, NULL);
|
||||
}
|
||||
/* FIXME: we need to split this out into register_remote_user() or something. */
|
||||
parv[3] = nick;
|
||||
parv[6] = sptr->name;
|
||||
if (do_cmd(sptr, recv_mtags, "USER", parc - 3, &parv[3]) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
if (!IsULine(serv) && IsSynched(serv))
|
||||
sendto_fconnectnotice(sptr, 0, NULL);
|
||||
|
||||
RunHook(HOOKTYPE_REMOTE_CONNECT, sptr);
|
||||
|
||||
@@ -577,6 +472,7 @@ CMD_FUNC(cmd_nick)
|
||||
Hook *h;
|
||||
int i = 0;
|
||||
char *nickid = (IsUser(sptr) && *sptr->id) ? sptr->id : NULL;
|
||||
Client *cptr = sptr->direction; /* Pending a complete overhaul... (TODO) */
|
||||
/*
|
||||
* If the user didn't specify a nickname, complain
|
||||
*/
|
||||
@@ -637,7 +533,7 @@ CMD_FUNC(cmd_nick)
|
||||
|
||||
new_message(sptr, NULL, &mtags);
|
||||
|
||||
sendto_server(cptr, 0, 0, mtags,
|
||||
sendto_server(sptr, 0, 0, mtags,
|
||||
":%s KILL %s :%s (%s <- %s!%s@%s)",
|
||||
me.name, sptr->name, me.name,
|
||||
get_client_name(cptr, FALSE),
|
||||
@@ -911,14 +807,14 @@ CMD_FUNC(cmd_nick)
|
||||
*/
|
||||
if (!(parc > 3) || (acptr->lastnick == lastnick))
|
||||
{
|
||||
nick_collision(cptr, parv[1], nickid, NULL, acptr, NICKCOL_EQUAL);
|
||||
nick_collision(sptr, parv[1], nickid, NULL, acptr, NICKCOL_EQUAL);
|
||||
return 0; /* We killed both users, now stop the process. */
|
||||
}
|
||||
|
||||
if ((differ && (acptr->lastnick > lastnick)) ||
|
||||
(!differ && (acptr->lastnick < lastnick)) || acptr->direction == cptr) /* we missed a QUIT somewhere ? */
|
||||
{
|
||||
nick_collision(cptr, parv[1], nickid, NULL, acptr, NICKCOL_NEW_WON);
|
||||
nick_collision(sptr, parv[1], nickid, NULL, acptr, NICKCOL_NEW_WON);
|
||||
/* OK, we got rid of the "wrong" user, now we're going to add the
|
||||
* user the other server introduced.
|
||||
*/
|
||||
@@ -928,7 +824,7 @@ CMD_FUNC(cmd_nick)
|
||||
if ((differ && (acptr->lastnick < lastnick)) ||
|
||||
(!differ && (acptr->lastnick > lastnick)))
|
||||
{
|
||||
nick_collision(cptr, parv[1], nickid, NULL, acptr, NICKCOL_EXISTING_WON);
|
||||
nick_collision(sptr, parv[1], nickid, NULL, acptr, NICKCOL_EXISTING_WON);
|
||||
return 0; /* Ignore the NICK. */
|
||||
}
|
||||
return 0;
|
||||
@@ -948,19 +844,19 @@ CMD_FUNC(cmd_nick)
|
||||
sptr->direction->name, (long long)lastnick);
|
||||
if (!(parc > 2) || lastnick == acptr->lastnick)
|
||||
{
|
||||
nick_collision(cptr, parv[1], nickid, sptr, acptr, NICKCOL_EQUAL);
|
||||
nick_collision(sptr, parv[1], nickid, sptr, acptr, NICKCOL_EQUAL);
|
||||
return 0; /* Now that I killed them both, ignore the NICK */
|
||||
}
|
||||
if ((differ && (acptr->lastnick > lastnick)) ||
|
||||
(!differ && (acptr->lastnick < lastnick)))
|
||||
{
|
||||
nick_collision(cptr, parv[1], nickid, sptr, acptr, NICKCOL_NEW_WON);
|
||||
nick_collision(sptr, parv[1], nickid, sptr, acptr, NICKCOL_NEW_WON);
|
||||
goto nickkilldone; /* their user won, introduce new nick */
|
||||
}
|
||||
if ((differ && (acptr->lastnick < lastnick)) ||
|
||||
(!differ && (acptr->lastnick > lastnick)))
|
||||
{
|
||||
nick_collision(cptr, parv[1], nickid, sptr, acptr, NICKCOL_EXISTING_WON);
|
||||
nick_collision(sptr, parv[1], nickid, sptr, acptr, NICKCOL_EXISTING_WON);
|
||||
return 0; /* their user lost, ignore the NICK */
|
||||
}
|
||||
|
||||
@@ -1048,7 +944,7 @@ CMD_FUNC(cmd_nick)
|
||||
sendto_snomask(SNO_FNICKCHANGE, "*** %s (%s@%s) has changed their nickname to %s",
|
||||
sptr->name, sptr->user->username, sptr->user->realhost, nick);
|
||||
|
||||
RunHook3(HOOKTYPE_REMOTE_NICKCHANGE, cptr, sptr, nick);
|
||||
RunHook2(HOOKTYPE_REMOTE_NICKCHANGE, sptr, nick);
|
||||
}
|
||||
/*
|
||||
* Client just changing their nick. If he/she is
|
||||
@@ -1068,9 +964,9 @@ CMD_FUNC(cmd_nick)
|
||||
}
|
||||
add_history(sptr, 1);
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
sendto_server(cptr, PROTO_SID, 0, mtags, ":%s NICK %s %lld",
|
||||
sendto_server(sptr, PROTO_SID, 0, mtags, ":%s NICK %s %lld",
|
||||
ID(sptr), nick, (long long)sptr->lastnick);
|
||||
sendto_server(cptr, 0, PROTO_SID, mtags, ":%s NICK %s %lld",
|
||||
sendto_server(sptr, 0, PROTO_SID, mtags, ":%s NICK %s %lld",
|
||||
sptr->name, nick, (long long)sptr->lastnick);
|
||||
sendto_local_common_channels(sptr, NULL, 0, mtags, ":%s NICK :%s", sptr->name, nick);
|
||||
free_message_tags(mtags);
|
||||
@@ -1107,7 +1003,7 @@ CMD_FUNC(cmd_nick)
|
||||
me.name, nick);
|
||||
|
||||
sptr->lastnick = TStime();
|
||||
if (register_user(cptr, sptr, nick, sptr->user->username, NULL, NULL, NULL) == FLUSH_BUFFER)
|
||||
if (register_user(sptr, nick, sptr->user->username, NULL, NULL, NULL) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
strlcpy(nick, sptr->name, sizeof(nick)); /* don't ask, but I need this. do not remove! -- Syzop */
|
||||
update_watch = 0;
|
||||
@@ -1136,9 +1032,9 @@ CMD_FUNC(cmd_nick)
|
||||
if (IsServer(cptr) && parc > 7)
|
||||
{
|
||||
parv[3] = nick;
|
||||
if (do_cmd(cptr, sptr, recv_mtags, "USER", parc - 3, &parv[3]) == FLUSH_BUFFER)
|
||||
if (do_cmd(sptr, recv_mtags, "USER", parc - 3, &parv[3]) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
if (IsNetInfo(cptr) && !IsULine(sptr))
|
||||
if (IsNetInfo(cptr) && !IsULine(sptr)) // FIXME: use IsSynced here too to match cmd_uid
|
||||
sendto_fconnectnotice(sptr, 0, NULL);
|
||||
}
|
||||
else if (IsUser(sptr) && update_watch)
|
||||
@@ -1180,7 +1076,7 @@ CMD_FUNC(cmd_nick)
|
||||
|
||||
extern int short_motd(Client *sptr);
|
||||
|
||||
int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip)
|
||||
int _register_user(Client *sptr, char *nick, char *username, char *umode, char *virthost, char *ip)
|
||||
{
|
||||
ConfigItem_ban *bconf;
|
||||
char *tmpstr;
|
||||
@@ -1203,7 +1099,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
};
|
||||
TKL *savetkl = NULL;
|
||||
ConfigItem_tld *tlds;
|
||||
cptr->local->last = TStime();
|
||||
|
||||
nick = sptr->name; /* <- The data is always the same, but the pointer is sometimes not,
|
||||
* I need this for one of my modules, so do not remove! ;) -- Syzop */
|
||||
|
||||
@@ -1219,7 +1115,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
* so have a generic exit_client() here to be safe.
|
||||
*/
|
||||
if (i != FLUSH_BUFFER)
|
||||
return exit_client(cptr, sptr, &me, NULL, "Rejected");
|
||||
return exit_client(sptr->direction, sptr, &me, NULL, "Rejected");
|
||||
return FLUSH_BUFFER;
|
||||
}
|
||||
|
||||
@@ -1316,7 +1212,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
{
|
||||
if (stripuser[0] == '\0')
|
||||
{
|
||||
return exit_client(cptr, cptr, cptr, NULL, "Hostile username. Please use only 0-9 a-z A-Z _ - and . in your username.");
|
||||
return exit_client(sptr, sptr, sptr, NULL, "Hostile username. Please use only 0-9 a-z A-Z _ - and . in your username.");
|
||||
}
|
||||
|
||||
strlcpy(olduser, user->username + noident, USERLEN+1);
|
||||
@@ -1431,7 +1327,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
char *parv[2];
|
||||
parv[0] = sptr->name;
|
||||
parv[1] = NULL;
|
||||
if (do_cmd(sptr, sptr, NULL, "LUSERS", 1, parv) == FLUSH_BUFFER)
|
||||
if (do_cmd(sptr, NULL, "LUSERS", 1, parv) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
}
|
||||
|
||||
@@ -1454,16 +1350,15 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
if (u1)
|
||||
sendnumeric(sptr, ERR_HOSTILENAME, olduser, userbad, stripuser);
|
||||
}
|
||||
else if (IsServer(cptr))
|
||||
else if (IsServer(sptr))
|
||||
{
|
||||
Client *acptr;
|
||||
|
||||
if (!(acptr = find_server_quick(user->server)))
|
||||
{
|
||||
sendto_ops
|
||||
("Bad USER [%s] :%s USER %s %s : No such server",
|
||||
cptr->name, nick, user->username, user->server);
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (No such server: %s)",
|
||||
sendto_ops("Bad USER [%s] :%s USER %s %s : No such server",
|
||||
sptr->name, nick, user->username, user->server);
|
||||
sendto_one(sptr, NULL, ":%s KILL %s :%s (No such server: %s)",
|
||||
me.name, sptr->name, me.name, user->server);
|
||||
SetKilled(sptr);
|
||||
return exit_client(sptr, sptr, &me, NULL,
|
||||
@@ -1472,19 +1367,19 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
else if (acptr->direction != sptr->direction)
|
||||
{
|
||||
sendto_ops("Bad User [%s] :%s USER %s %s, != %s[%s]",
|
||||
cptr->name, nick, user->username, user->server,
|
||||
sptr->name, nick, user->username, user->server,
|
||||
acptr->name, acptr->direction->name);
|
||||
sendto_one(cptr, NULL, ":%s KILL %s :%s (%s != %s[%s])",
|
||||
sendto_one(sptr, NULL, ":%s KILL %s :%s (%s != %s[%s])",
|
||||
me.name, sptr->name, me.name, user->server,
|
||||
acptr->direction->name, acptr->direction->local->sockhost);
|
||||
SetKilled(sptr);
|
||||
return exit_client(sptr, sptr, &me, NULL,
|
||||
"USER server wrong direction");
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
sptr->flags |= acptr->flags;
|
||||
/* *FINALL* this gets in ircd... -- Barubary */
|
||||
/* We change this a bit .. */
|
||||
}
|
||||
|
||||
if (IsULine(sptr->srvptr))
|
||||
SetULine(sptr);
|
||||
}
|
||||
@@ -1521,7 +1416,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
tkllayer[2] = umode;
|
||||
tkllayer[3] = NULL;
|
||||
dontspread = 1;
|
||||
do_cmd(cptr, sptr, NULL, "MODE", 3, tkllayer);
|
||||
do_cmd(sptr, NULL, "MODE", 3, tkllayer);
|
||||
dontspread = 0;
|
||||
|
||||
/* Set the vhost */
|
||||
@@ -1530,10 +1425,10 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
}
|
||||
|
||||
hash_check_watch(sptr, RPL_LOGON); /* Uglier hack */
|
||||
send_umode(NULL, sptr, 0, SEND_UMODES|UMODE_SERVNOTICE, buf);
|
||||
build_umode_string(sptr, 0, SEND_UMODES|UMODE_SERVNOTICE, buf);
|
||||
|
||||
/* NICKv2 Servers ! */
|
||||
sendto_serv_butone_nickcmd(cptr, sptr, (*buf == '\0' ? "+" : buf));
|
||||
sendto_serv_butone_nickcmd(sptr->direction, sptr, (*buf == '\0' ? "+" : buf));
|
||||
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
@@ -1563,8 +1458,8 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
NickServ, SERVICES_NAME, sptr->local->passwd);
|
||||
}
|
||||
if (buf[0] != '\0' && buf[1] != '\0')
|
||||
sendto_one(cptr, NULL, ":%s MODE %s :%s", cptr->name,
|
||||
cptr->name, buf);
|
||||
sendto_one(sptr, NULL, ":%s MODE %s :%s", sptr->name,
|
||||
sptr->name, buf);
|
||||
if (user->snomask)
|
||||
sendnumeric(sptr, RPL_SNOMASK, get_snostr(user->snomask));
|
||||
|
||||
@@ -1602,7 +1497,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
tlds->channel,
|
||||
NULL
|
||||
};
|
||||
if (do_cmd(sptr, sptr, NULL, "JOIN", 3, chans) == FLUSH_BUFFER)
|
||||
if (do_cmd(sptr, NULL, "JOIN", 3, chans) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
}
|
||||
else if (!BadPtr(AUTO_JOIN_CHANS) && strcmp(AUTO_JOIN_CHANS, "0"))
|
||||
@@ -1612,7 +1507,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
|
||||
AUTO_JOIN_CHANS,
|
||||
NULL
|
||||
};
|
||||
if (do_cmd(sptr, sptr, NULL, "JOIN", 3, chans) == FLUSH_BUFFER)
|
||||
if (do_cmd(sptr, NULL, "JOIN", 3, chans) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
}
|
||||
/* NOTE: If you add something here.. be sure to check the 'if (savetkl)' note above */
|
||||
|
||||
+4
-4
@@ -161,7 +161,7 @@ CMD_FUNC(cmd_oper)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!Auth_Check(cptr, operblock->auth, password))
|
||||
if (!Auth_Check(sptr, operblock->auth, password))
|
||||
{
|
||||
sendnumeric(sptr, ERR_PASSWDMISMATCH);
|
||||
if (FAILOPER_WARN)
|
||||
@@ -279,7 +279,7 @@ CMD_FUNC(cmd_oper)
|
||||
sptr->umodes |= UMODE_SERVNOTICE;
|
||||
}
|
||||
|
||||
send_umode_out(cptr, sptr, old_umodes);
|
||||
send_umode_out(sptr, 1, old_umodes);
|
||||
sendnumeric(sptr, RPL_SNOMASK, get_sno_str(sptr));
|
||||
|
||||
list_add(&sptr->special_node, &oper_list);
|
||||
@@ -295,7 +295,7 @@ CMD_FUNC(cmd_oper)
|
||||
irccounts.operators++;
|
||||
|
||||
if (SHOWOPERMOTD == 1)
|
||||
(void)do_cmd(cptr, sptr, NULL, "OPERMOTD", parc, parv);
|
||||
(void)do_cmd(sptr, NULL, "OPERMOTD", parc, parv);
|
||||
|
||||
if (!BadPtr(OPER_AUTO_JOIN_CHANS) && strcmp(OPER_AUTO_JOIN_CHANS, "0"))
|
||||
{
|
||||
@@ -304,7 +304,7 @@ CMD_FUNC(cmd_oper)
|
||||
OPER_AUTO_JOIN_CHANS,
|
||||
NULL
|
||||
};
|
||||
if (do_cmd(cptr, sptr, NULL, "JOIN", 3, chans) == FLUSH_BUFFER)
|
||||
if (do_cmd(sptr, NULL, "JOIN", 3, chans) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -159,9 +159,9 @@ CMD_FUNC(cmd_part)
|
||||
new_message_special(sptr, recv_mtags, &mtags, ":%s PART %s", sptr->name, chptr->chname);
|
||||
|
||||
/* Send to other servers... */
|
||||
sendto_server(cptr, PROTO_SID, 0, mtags, ":%s PART %s :%s",
|
||||
sendto_server(sptr, PROTO_SID, 0, mtags, ":%s PART %s :%s",
|
||||
ID(sptr), chptr->chname, comment ? comment : "");
|
||||
sendto_server(cptr, 0, PROTO_SID, mtags, ":%s PART %s :%s",
|
||||
sendto_server(sptr, 0, PROTO_SID, mtags, ":%s PART %s :%s",
|
||||
sptr->name, chptr->chname, comment ? comment : "");
|
||||
|
||||
if (invisible_user_in_channel(sptr, chptr))
|
||||
@@ -212,9 +212,9 @@ CMD_FUNC(cmd_part)
|
||||
}
|
||||
|
||||
if (MyUser(sptr))
|
||||
RunHook5(HOOKTYPE_LOCAL_PART, cptr, sptr, chptr, mtags, comment);
|
||||
RunHook4(HOOKTYPE_LOCAL_PART, sptr, chptr, mtags, comment);
|
||||
else
|
||||
RunHook5(HOOKTYPE_REMOTE_PART, cptr, sptr, chptr, mtags, comment);
|
||||
RunHook4(HOOKTYPE_REMOTE_PART, sptr, chptr, mtags, comment);
|
||||
|
||||
free_message_tags(mtags);
|
||||
|
||||
|
||||
+6
-5
@@ -115,19 +115,20 @@ CMD_FUNC(cmd_pass)
|
||||
{
|
||||
char *password = parc > 1 ? parv[1] : NULL;
|
||||
|
||||
if (BadPtr(password))
|
||||
if (!MyConnect(sptr) || (!IsUnknown(sptr) && !IsHandshake(sptr)))
|
||||
{
|
||||
sendnumeric(cptr, ERR_NEEDMOREPARAMS, "PASS");
|
||||
sendnumeric(sptr, ERR_ALREADYREGISTRED);
|
||||
return 0;
|
||||
}
|
||||
if (!MyConnect(sptr) || (!IsUnknown(cptr) && !IsHandshake(cptr)))
|
||||
|
||||
if (BadPtr(password))
|
||||
{
|
||||
sendnumeric(cptr, ERR_ALREADYREGISTRED);
|
||||
sendnumeric(sptr, ERR_NEEDMOREPARAMS, "PASS");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Store the password */
|
||||
safe_strldup(cptr->local->passwd, password, PASSWDLEN+1);
|
||||
safe_strldup(sptr->local->passwd, password, PASSWDLEN+1);
|
||||
|
||||
/* note: the original non-truncated password is supplied as 2nd parameter. */
|
||||
RunHookReturnInt2(HOOKTYPE_LOCAL_PASS, sptr, password, !=0);
|
||||
|
||||
+17
-23
@@ -68,23 +68,17 @@ CMD_FUNC(cmd_ping)
|
||||
Client *acptr;
|
||||
char *origin, *destination;
|
||||
|
||||
if (parc < 2 || *parv[1] == '\0')
|
||||
if (parc < 2 || BadPtr(parv[1]))
|
||||
{
|
||||
sendnumeric(sptr, ERR_NOORIGIN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
origin = parv[1];
|
||||
destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */
|
||||
|
||||
if (!MyUser(sptr))
|
||||
{
|
||||
/* I've no idea who invented this or what it is supposed to do.. */
|
||||
acptr = find_client(origin, NULL);
|
||||
if (!acptr)
|
||||
acptr = find_server_quick(origin);
|
||||
if (acptr && acptr != sptr)
|
||||
origin = cptr->name;
|
||||
}
|
||||
origin = sptr->name;
|
||||
|
||||
if (!BadPtr(destination) && mycmp(destination, me.name) != 0 && mycmp(destination, me.id) != 0)
|
||||
{
|
||||
@@ -112,9 +106,9 @@ CMD_FUNC(cmd_nospoof)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
if (IsNotSpoof(cptr))
|
||||
if (IsNotSpoof(sptr))
|
||||
return 0;
|
||||
if (IsRegistered(cptr))
|
||||
if (IsRegistered(sptr))
|
||||
return 0;
|
||||
if (!*sptr->name)
|
||||
return 0;
|
||||
@@ -136,13 +130,12 @@ CMD_FUNC(cmd_nospoof)
|
||||
me.name, sptr->name);
|
||||
|
||||
if (is_handshake_finished(sptr))
|
||||
return register_user(cptr, sptr, sptr->name,
|
||||
sptr->user->username, NULL, NULL, NULL);
|
||||
return register_user(sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
|
||||
return 0;
|
||||
temp:
|
||||
/* Homer compatibility */
|
||||
sendto_one(cptr, NULL, ":%X!nospoof@%s PRIVMSG %s :\1VERSION\1",
|
||||
cptr->local->nospoof, me.name, cptr->name);
|
||||
sendto_one(sptr, NULL, ":%X!nospoof@%s PRIVMSG %s :\1VERSION\1",
|
||||
sptr->local->nospoof, me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -156,8 +149,8 @@ CMD_FUNC(cmd_pong)
|
||||
Client *acptr;
|
||||
char *origin, *destination;
|
||||
|
||||
if (!IsRegistered(cptr))
|
||||
return cmd_nospoof(cptr, sptr, recv_mtags, parc, parv);
|
||||
if (!IsRegistered(sptr))
|
||||
return cmd_nospoof(sptr, recv_mtags, parc, parv);
|
||||
|
||||
if (parc < 2 || *parv[1] == '\0')
|
||||
{
|
||||
@@ -168,26 +161,27 @@ CMD_FUNC(cmd_pong)
|
||||
origin = parv[1];
|
||||
destination = parv[2];
|
||||
ClearPingSent(sptr);
|
||||
ClearPingSent(cptr);
|
||||
ClearPingWarning(cptr);
|
||||
ClearPingWarning(sptr);
|
||||
|
||||
/* Remote pongs for clients? uhh... */
|
||||
if (MyUser(sptr) || !IsRegistered(sptr))
|
||||
destination = NULL;
|
||||
return 0;
|
||||
|
||||
/* PONG from a server - either for us, or needs relaying.. */
|
||||
if (!BadPtr(destination) && mycmp(destination, me.name) != 0)
|
||||
{
|
||||
if ((acptr = find_client(destination, NULL)) ||
|
||||
(acptr = find_server_quick(destination)))
|
||||
{
|
||||
if (!IsServer(cptr) && !IsServer(acptr))
|
||||
if (IsUser(sptr) && !IsServer(acptr))
|
||||
{
|
||||
sendnumeric(sptr, ERR_NOSUCHSERVER, destination);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
sendto_one(acptr, NULL, ":%s PONG %s %s",
|
||||
sptr->name, origin, destination);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+66
-66
@@ -70,7 +70,7 @@ CMD_FUNC(cmd_protoctl)
|
||||
if (!MyConnect(sptr))
|
||||
return 0; /* Remote PROTOCTL's are not supported */
|
||||
|
||||
SetProtoctlReceived(cptr);
|
||||
SetProtoctlReceived(sptr);
|
||||
|
||||
for (i = 1; i < parc; i++)
|
||||
{
|
||||
@@ -88,72 +88,72 @@ CMD_FUNC(cmd_protoctl)
|
||||
|
||||
if (!strcmp(name, "NAMESX"))
|
||||
{
|
||||
SetCapability(cptr, "multi-prefix");
|
||||
SetCapability(sptr, "multi-prefix");
|
||||
}
|
||||
else if (!strcmp(name, "UHNAMES") && UHNAMES_ENABLED)
|
||||
{
|
||||
SetCapability(cptr, "userhost-in-names");
|
||||
SetCapability(sptr, "userhost-in-names");
|
||||
}
|
||||
else if (!strcmp(name, "NOQUIT"))
|
||||
{
|
||||
SetNoQuit(cptr);
|
||||
SetNoQuit(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "SJOIN"))
|
||||
{
|
||||
SetSJOIN(cptr);
|
||||
SetSJOIN(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "SJOIN2"))
|
||||
{
|
||||
SetSJOIN2(cptr);
|
||||
SetSJOIN2(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "NICKv2"))
|
||||
{
|
||||
SetNICKv2(cptr);
|
||||
SetNICKv2(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "UMODE2"))
|
||||
{
|
||||
SetUMODE2(cptr);
|
||||
SetUMODE2(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "VL"))
|
||||
{
|
||||
SetVL(cptr);
|
||||
SetVL(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "VHP"))
|
||||
{
|
||||
SetVHP(cptr);
|
||||
SetVHP(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "CLK"))
|
||||
{
|
||||
SetCLK(cptr);
|
||||
SetCLK(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "SJ3"))
|
||||
{
|
||||
SetSJ3(cptr);
|
||||
SetSJ3(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "SJSBY") && iConf.ban_setter_sync)
|
||||
{
|
||||
SetSJSBY(cptr);
|
||||
SetSJSBY(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "TKLEXT"))
|
||||
{
|
||||
SetTKLEXT(cptr);
|
||||
SetTKLEXT(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "TKLEXT2"))
|
||||
{
|
||||
SetTKLEXT2(cptr);
|
||||
SetTKLEXT(cptr); /* TKLEXT is implied as well. always. */
|
||||
SetTKLEXT2(sptr);
|
||||
SetTKLEXT(sptr); /* TKLEXT is implied as well. always. */
|
||||
}
|
||||
else if (!strcmp(name, "NICKIP"))
|
||||
{
|
||||
cptr->local->proto |= PROTO_NICKIP;
|
||||
sptr->local->proto |= PROTO_NICKIP;
|
||||
}
|
||||
else if (!strcmp(name, "MTAGS"))
|
||||
{
|
||||
SetMTAGS(cptr);
|
||||
SetMTAGS(sptr);
|
||||
}
|
||||
else if (!strcmp(name, "NICKCHARS") && value)
|
||||
{
|
||||
if (!IsServer(cptr) && !IsEAuth(cptr) && !IsHandshake(cptr))
|
||||
if (!IsServer(sptr) && !IsEAuth(sptr) && !IsHandshake(sptr))
|
||||
continue;
|
||||
/* Ok, server is either authenticated, or is an outgoing connect... */
|
||||
/* Some combinations are fatal because they would lead to mass-kills:
|
||||
@@ -165,50 +165,50 @@ CMD_FUNC(cmd_protoctl)
|
||||
snprintf(buf, sizeof(buf), "Server %s has utf8 in set::allowed-nickchars but %s does not. Link rejected.",
|
||||
me.name, *sptr->name ? sptr->name : "other side");
|
||||
sendto_realops("\002ERROR\001 %s", buf);
|
||||
return exit_client(cptr, sptr, &me, NULL, buf);
|
||||
return exit_client(sptr, sptr, &me, NULL, buf);
|
||||
}
|
||||
/* We compare the character sets to see if we should warn opers about any mismatch... */
|
||||
if (strcmp(value, charsys_get_current_languages()))
|
||||
{
|
||||
sendto_realops("\002WARNING!!!!\002 Link %s does not have the same set::allowed-nickchars settings (or is "
|
||||
"a different UnrealIRCd version), this MAY cause display issues. Our charset: '%s', theirs: '%s'",
|
||||
get_client_name(cptr, FALSE), charsys_get_current_languages(), value);
|
||||
/* return exit_client(cptr, cptr, &me, NULL, "Nick charset mismatch"); */
|
||||
get_client_name(sptr, FALSE), charsys_get_current_languages(), value);
|
||||
/* return exit_client(sptr, sptr, &me, NULL, "Nick charset mismatch"); */
|
||||
}
|
||||
if (cptr->serv)
|
||||
safe_strdup(cptr->serv->features.nickchars, value);
|
||||
if (sptr->serv)
|
||||
safe_strdup(sptr->serv->features.nickchars, value);
|
||||
|
||||
/* If this is a runtime change (so post-handshake): */
|
||||
if (IsServer(sptr))
|
||||
broadcast_sinfo(sptr, NULL, cptr);
|
||||
broadcast_sinfo(sptr, NULL, sptr);
|
||||
}
|
||||
else if (!strcmp(name, "SID") && value)
|
||||
{
|
||||
Client *acptr;
|
||||
Client *asptr;
|
||||
char *sid = value;
|
||||
|
||||
if (!IsServer(cptr) && !IsEAuth(cptr) && !IsHandshake(cptr))
|
||||
return exit_client(cptr, cptr, &me, NULL, "Got PROTOCTL SID before EAUTH, that's the wrong order!");
|
||||
if (!IsServer(sptr) && !IsEAuth(sptr) && !IsHandshake(sptr))
|
||||
return exit_client(sptr, sptr, &me, NULL, "Got PROTOCTL SID before EAUTH, that's the wrong order!");
|
||||
|
||||
if (*sptr->id && (strlen(sptr->id)==3))
|
||||
return exit_client(cptr, cptr, &me, NULL, "Got PROTOCTL SID twice");
|
||||
return exit_client(sptr, sptr, &me, NULL, "Got PROTOCTL SID twice");
|
||||
|
||||
if (IsServer(cptr))
|
||||
return exit_client(cptr, cptr, &me, NULL, "Got PROTOCTL SID after SERVER, that's the wrong order!");
|
||||
if (IsServer(sptr))
|
||||
return exit_client(sptr, sptr, &me, NULL, "Got PROTOCTL SID after SERVER, that's the wrong order!");
|
||||
|
||||
if ((acptr = hash_find_id(sid, NULL)) != NULL)
|
||||
if ((asptr = hash_find_id(sid, NULL)) != NULL)
|
||||
{
|
||||
sendto_one(sptr, NULL, "ERROR :SID %s already exists from %s", acptr->id, acptr->name);
|
||||
sendto_one(sptr, NULL, "ERROR :SID %s already exists from %s", asptr->id, asptr->name);
|
||||
sendto_snomask(SNO_SNOTICE, "Link %s rejected - SID %s already exists from %s",
|
||||
get_client_name(cptr, FALSE), acptr->id, acptr->name);
|
||||
return exit_client(cptr, cptr, &me, NULL, "SID collision");
|
||||
get_client_name(sptr, FALSE), asptr->id, asptr->name);
|
||||
return exit_client(sptr, sptr, &me, NULL, "SID collision");
|
||||
}
|
||||
|
||||
if (*sptr->id)
|
||||
del_from_id_hash_table(sptr->id, sptr); /* delete old UID entry (created on connect) */
|
||||
strlcpy(cptr->id, sid, IDLEN);
|
||||
add_to_id_hash_table(cptr->id, cptr); /* add SID */
|
||||
cptr->local->proto |= PROTO_SID;
|
||||
strlcpy(sptr->id, sid, IDLEN);
|
||||
add_to_id_hash_table(sptr->id, sptr); /* add SID */
|
||||
sptr->local->proto |= PROTO_SID;
|
||||
}
|
||||
else if (!strcmp(name, "EAUTH") && value && NEW_LINKING_PROTOCOL)
|
||||
{
|
||||
@@ -236,9 +236,9 @@ CMD_FUNC(cmd_protoctl)
|
||||
sendto_snomask
|
||||
(SNO_JUNK,
|
||||
"WARNING: Bogus server name (%s) from %s in EAUTH (maybe just a fishy client)",
|
||||
servername ? servername : "", get_client_name(cptr, TRUE));
|
||||
servername ? servername : "", get_client_name(sptr, TRUE));
|
||||
|
||||
return exit_client(cptr, sptr, &me, NULL, "Bogus server name");
|
||||
return exit_client(sptr, sptr, &me, NULL, "Bogus server name");
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ CMD_FUNC(cmd_protoctl)
|
||||
}
|
||||
}
|
||||
|
||||
ret = verify_link(cptr, sptr, servername, &aconf);
|
||||
ret = verify_link(sptr, servername, &aconf);
|
||||
if (ret < 0)
|
||||
return ret; /* FLUSH_BUFFER */
|
||||
|
||||
@@ -261,29 +261,29 @@ CMD_FUNC(cmd_protoctl)
|
||||
if (ret < 0)
|
||||
return ret; /* FLUSH_BUFFER */
|
||||
|
||||
SetEAuth(cptr);
|
||||
make_server(cptr); /* allocate and set cptr->serv */
|
||||
/* Set cptr->name but don't add to hash list. The real work on
|
||||
SetEAuth(sptr);
|
||||
make_server(sptr); /* allocate and set sptr->serv */
|
||||
/* Set sptr->name but don't add to hash list. The real work on
|
||||
* that is done in cmd_server. We just set it here for display
|
||||
* purposes of error messages (such as reject due to clock).
|
||||
*/
|
||||
strlcpy(cptr->name, servername, sizeof(cptr->name));
|
||||
strlcpy(sptr->name, servername, sizeof(sptr->name));
|
||||
if (protocol)
|
||||
cptr->serv->features.protocol = atoi(protocol);
|
||||
sptr->serv->features.protocol = atoi(protocol);
|
||||
if (software)
|
||||
safe_strdup(cptr->serv->features.software, software);
|
||||
if (!IsHandshake(cptr) && aconf) /* Send PASS early... */
|
||||
safe_strdup(sptr->serv->features.software, software);
|
||||
if (!IsHandshake(sptr) && aconf) /* Send PASS early... */
|
||||
sendto_one(sptr, NULL, "PASS :%s", (aconf->auth->type == AUTHTYPE_PLAINTEXT) ? aconf->auth->data : "*");
|
||||
}
|
||||
else if (!strcmp(name, "SERVERS") && value && NEW_LINKING_PROTOCOL)
|
||||
{
|
||||
Client *acptr, *srv;
|
||||
Client *asptr, *srv;
|
||||
char *sid = NULL;
|
||||
|
||||
if (!IsEAuth(cptr))
|
||||
if (!IsEAuth(sptr))
|
||||
continue;
|
||||
|
||||
if (cptr->serv->features.protocol < 2351)
|
||||
if (sptr->serv->features.protocol < 2351)
|
||||
continue; /* old SERVERS= version */
|
||||
|
||||
/* Other side lets us know which servers are behind it.
|
||||
@@ -293,24 +293,24 @@ CMD_FUNC(cmd_protoctl)
|
||||
|
||||
add_pending_net(sptr, value);
|
||||
|
||||
acptr = find_non_pending_net_duplicates(sptr);
|
||||
if (acptr)
|
||||
asptr = find_non_pending_net_duplicates(sptr);
|
||||
if (asptr)
|
||||
{
|
||||
sendto_one(sptr, NULL, "ERROR :Server with SID %s (%s) already exists",
|
||||
acptr->id, acptr->name);
|
||||
asptr->id, asptr->name);
|
||||
sendto_realops("Link %s cancelled, server with SID %s (%s) already exists",
|
||||
get_client_name(acptr, TRUE), acptr->id, acptr->name);
|
||||
get_client_name(asptr, TRUE), asptr->id, asptr->name);
|
||||
return exit_client(sptr, sptr, sptr, NULL, "Server Exists (or non-unique me::sid)");
|
||||
}
|
||||
|
||||
acptr = find_pending_net_duplicates(sptr, &srv, &sid);
|
||||
if (acptr)
|
||||
asptr = find_pending_net_duplicates(sptr, &srv, &sid);
|
||||
if (asptr)
|
||||
{
|
||||
sendto_one(sptr, NULL, "ERROR :Server with SID %s is being introduced by another server as well. "
|
||||
"Just wait a moment for it to synchronize...", sid);
|
||||
sendto_realops("Link %s cancelled, server would introduce server with SID %s, which "
|
||||
"server %s is also about to introduce. Just wait a moment for it to synchronize...",
|
||||
get_client_name(acptr, TRUE), sid, get_client_name(srv, TRUE));
|
||||
get_client_name(asptr, TRUE), sid, get_client_name(srv, TRUE));
|
||||
return exit_client(sptr, sptr, sptr, NULL, "Server Exists (just wait a moment)");
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ CMD_FUNC(cmd_protoctl)
|
||||
"Correct time is very important in IRC. Please "
|
||||
"verify the clock on both %s (them) and %s (us), "
|
||||
"fix it and then try linking again",
|
||||
get_client_name(cptr, TRUE),
|
||||
get_client_name(sptr, TRUE),
|
||||
(long long)(TStime() - t),
|
||||
sptr->name, me.name);
|
||||
} else
|
||||
@@ -356,7 +356,7 @@ CMD_FUNC(cmd_protoctl)
|
||||
"Correct time is very important in IRC. Please "
|
||||
"verify the clock on both %s (them) and %s (us), "
|
||||
"fix it and then try linking again",
|
||||
get_client_name(cptr, TRUE),
|
||||
get_client_name(sptr, TRUE),
|
||||
(long long)(t - TStime()),
|
||||
sptr->name, me.name);
|
||||
}
|
||||
@@ -370,21 +370,21 @@ CMD_FUNC(cmd_protoctl)
|
||||
}
|
||||
else if (!strcmp(name, "MLOCK"))
|
||||
{
|
||||
cptr->local->proto |= PROTO_MLOCK;
|
||||
sptr->local->proto |= PROTO_MLOCK;
|
||||
}
|
||||
else if (!strcmp(name, "CHANMODES") && value && sptr->serv)
|
||||
{
|
||||
parse_chanmodes_protoctl(sptr, value);
|
||||
/* If this is a runtime change (so post-handshake): */
|
||||
if (IsServer(sptr))
|
||||
broadcast_sinfo(sptr, NULL, cptr);
|
||||
broadcast_sinfo(sptr, NULL, sptr);
|
||||
}
|
||||
else if (!strcmp(name, "USERMODES") && value && sptr->serv)
|
||||
{
|
||||
safe_strdup(sptr->serv->features.usermodes, value);
|
||||
/* If this is a runtime change (so post-handshake): */
|
||||
if (IsServer(sptr))
|
||||
broadcast_sinfo(sptr, NULL, cptr);
|
||||
broadcast_sinfo(sptr, NULL, sptr);
|
||||
}
|
||||
else if (!strcmp(name, "BOOTED") && value && sptr->serv)
|
||||
{
|
||||
@@ -392,7 +392,7 @@ CMD_FUNC(cmd_protoctl)
|
||||
}
|
||||
else if (!strcmp(name, "EXTSWHOIS"))
|
||||
{
|
||||
cptr->local->proto |= PROTO_EXTSWHOIS;
|
||||
sptr->local->proto |= PROTO_EXTSWHOIS;
|
||||
}
|
||||
/* You can add protocol extensions here.
|
||||
* Use 'name' and 'value' (the latter may be NULL).
|
||||
@@ -402,14 +402,14 @@ CMD_FUNC(cmd_protoctl)
|
||||
*/
|
||||
}
|
||||
|
||||
if (first_protoctl && IsHandshake(cptr) && sptr->serv && !IsServerSent(sptr)) /* first & outgoing connection to server */
|
||||
if (first_protoctl && IsHandshake(sptr) && sptr->serv && !IsServerSent(sptr)) /* first & outgoing connection to server */
|
||||
{
|
||||
/* SERVER message moved from completed_connection() to here due to EAUTH/SERVERS PROTOCTL stuff,
|
||||
* which needed to be delayed until after both sides have received SERVERS=xx (..or not.. in case
|
||||
* of older servers).
|
||||
* Actually, this is often not reached, as the PANGPANG stuff in do_numeric() is reached first.
|
||||
*/
|
||||
send_server_message(cptr);
|
||||
send_server_message(sptr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+6
-6
@@ -65,16 +65,16 @@ CMD_FUNC(cmd_quit)
|
||||
if (parv[1] && (strlen(comment) > iConf.quit_length))
|
||||
comment[iConf.quit_length] = '\0';
|
||||
|
||||
if (!IsServer(cptr) && IsUser(sptr))
|
||||
if (MyUser(sptr))
|
||||
{
|
||||
int n;
|
||||
Hook *tmphook;
|
||||
|
||||
if (STATIC_QUIT)
|
||||
return exit_client(cptr, sptr, sptr, recv_mtags, STATIC_QUIT);
|
||||
return exit_client(sptr->direction, sptr, sptr, recv_mtags, STATIC_QUIT);
|
||||
|
||||
if (IsVirus(sptr))
|
||||
return exit_client(cptr, sptr, sptr, recv_mtags, "Client exited");
|
||||
return exit_client(sptr->direction, sptr, sptr, recv_mtags, "Client exited");
|
||||
|
||||
n = run_spamfilter(sptr, comment, SPAMF_QUIT, NULL, 0, NULL);
|
||||
if (n == FLUSH_BUFFER)
|
||||
@@ -121,7 +121,7 @@ CMD_FUNC(cmd_quit)
|
||||
parx[2] = newcomment;
|
||||
parx[3] = NULL;
|
||||
|
||||
ret = do_cmd(cptr, sptr, recv_mtags, "PART", newcomment ? 3 : 2, parx);
|
||||
ret = do_cmd(sptr, recv_mtags, "PART", newcomment ? 3 : 2, parx);
|
||||
/* This would be unusual, but possible (somewhere in the future perhaps): */
|
||||
if (ret == FLUSH_BUFFER)
|
||||
return ret;
|
||||
@@ -144,13 +144,13 @@ CMD_FUNC(cmd_quit)
|
||||
else
|
||||
strlcpy(commentbuf, comment, sizeof(commentbuf));
|
||||
|
||||
return exit_client(cptr, sptr, sptr, recv_mtags, commentbuf);
|
||||
return exit_client(sptr->direction, sptr, sptr, recv_mtags, commentbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remote quits and non-person quits always use their original comment.
|
||||
* Also pass recv_mtags so to keep the msgid and such.
|
||||
*/
|
||||
return exit_client(cptr, sptr, sptr, recv_mtags, comment);
|
||||
return exit_client(sptr->direction, sptr, sptr, recv_mtags, comment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,15 +788,15 @@ CMD_FUNC(reputation_server_cmd)
|
||||
e = find_reputation_entry(ip);
|
||||
if (allow_reply && e && (e->score > score) && (e->score - score > UPDATE_SCORE_MARGIN))
|
||||
{
|
||||
/* We have a higher score, inform the cptr direction about it.
|
||||
/* We have a higher score, inform the sptr direction about it.
|
||||
* This will prefix the score with a * so servers will never reply to it.
|
||||
*/
|
||||
sendto_one(cptr, NULL, ":%s REPUTATION %s *%d", me.name, parv[1], e->score);
|
||||
sendto_one(sptr, NULL, ":%s REPUTATION %s *%d", me.name, 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, sptr->name, score, e->score, e->score);
|
||||
#endif
|
||||
score = e->score; /* Update for propagation in the non-cptr direction */
|
||||
score = e->score; /* Update for propagation in the non-sptr direction */
|
||||
}
|
||||
|
||||
/* Update our score if sender has a higher score */
|
||||
@@ -823,8 +823,8 @@ CMD_FUNC(reputation_server_cmd)
|
||||
add_reputation_entry(e);
|
||||
}
|
||||
|
||||
/* Propagate to the non-cptr direction (score may be updated) */
|
||||
sendto_server(cptr, 0, 0, NULL,
|
||||
/* Propagate to the non-sptr direction (score may be updated) */
|
||||
sendto_server(sptr, 0, 0, NULL,
|
||||
":%s REPUTATION %s %s%d",
|
||||
sptr->name,
|
||||
parv[1],
|
||||
@@ -837,10 +837,10 @@ CMD_FUNC(reputation_server_cmd)
|
||||
CMD_FUNC(reputation_cmd)
|
||||
{
|
||||
if (MyUser(sptr))
|
||||
return reputation_user_cmd(cptr, sptr, recv_mtags, parc, parv);
|
||||
return reputation_user_cmd(sptr, recv_mtags, parc, parv);
|
||||
|
||||
if (IsServer(sptr))
|
||||
return reputation_server_cmd(cptr, sptr, recv_mtags, parc, parv);
|
||||
return reputation_server_cmd(sptr, recv_mtags, parc, parv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ CMD_FUNC(cmd_smod)
|
||||
if (abort)
|
||||
{
|
||||
sendto_umode_global(UMODE_OPER, "ABORTING LINK: %s <=> %s", me.name, sptr->name);
|
||||
return exit_client(cptr, sptr, &me, NULL, "ABORTING LINK");
|
||||
return exit_client(sptr->direction, sptr, &me, NULL, "ABORTING LINK");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -351,7 +351,7 @@ CMD_OVERRIDE_FUNC(rcmd_override)
|
||||
RestrictedCommand *rcmd;
|
||||
|
||||
if (!MyUser(sptr) || !sptr->local || IsOper(sptr) || IsULine(sptr))
|
||||
return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv);
|
||||
return CallCommandOverride(ovr, sptr, recv_mtags, parc, parv);
|
||||
|
||||
rcmd = find_restrictions_bycmd(ovr->command->cmd);
|
||||
if (rcmd)
|
||||
@@ -369,5 +369,5 @@ CMD_OVERRIDE_FUNC(rcmd_override)
|
||||
}
|
||||
|
||||
// No restrictions apply, process command as normal =]
|
||||
return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv);
|
||||
return CallCommandOverride(ovr, sptr, recv_mtags, parc, parv);
|
||||
}
|
||||
|
||||
+5
-5
@@ -40,7 +40,7 @@ typedef struct {
|
||||
static int dump_str(Client *sptr, char **buf);
|
||||
static TKLType *find_TKLType_by_flag(char flag);
|
||||
void rmtkl_check_options(char *param, int *skipperm, int *silent);
|
||||
int rmtkl_tryremove(Client *sptr, Client *cptr, TKLType *tkltype, TKL *tkl, char *uhmask, char *commentmask, int skipperm, int silent);
|
||||
int rmtkl_tryremove(Client *sptr, TKLType *tkltype, TKL *tkl, char *uhmask, char *commentmask, int skipperm, int silent);
|
||||
CMD_FUNC(rmtkl);
|
||||
|
||||
TKLType tkl_types[] = {
|
||||
@@ -134,7 +134,7 @@ void rmtkl_check_options(char *param, int *skipperm, int *silent) {
|
||||
*silent = 1;
|
||||
}
|
||||
|
||||
int rmtkl_tryremove(Client *sptr, Client *cptr, TKLType *tkltype, TKL *tkl, char *uhmask, char *commentmask, int skipperm, int silent)
|
||||
int rmtkl_tryremove(Client *sptr, TKLType *tkltype, TKL *tkl, char *uhmask, char *commentmask, int skipperm, int silent)
|
||||
{
|
||||
if (tkl->type != tkltype->type)
|
||||
return 0;
|
||||
@@ -172,7 +172,7 @@ int rmtkl_tryremove(Client *sptr, Client *cptr, TKLType *tkltype, TKL *tkl, char
|
||||
if (!silent)
|
||||
sendnotice_tkl_del(sptr->name, tkl);
|
||||
|
||||
RunHook5(HOOKTYPE_TKL_DEL, cptr, sptr, tkl, NULL, NULL);
|
||||
RunHook4(HOOKTYPE_TKL_DEL, sptr, tkl, NULL, NULL);
|
||||
|
||||
if (tkl->type & TKL_SHUN)
|
||||
tkl_check_local_remove_shun(tkl);
|
||||
@@ -272,7 +272,7 @@ CMD_FUNC(rmtkl) {
|
||||
for (tkl = tklines_ip_hash[tklindex][tklindex2]; tkl; tkl = next)
|
||||
{
|
||||
next = tkl->next;
|
||||
count += rmtkl_tryremove(sptr, cptr, tkltype, tkl, uhmask, commentmask, skipperm, silent);
|
||||
count += rmtkl_tryremove(sptr, tkltype, tkl, uhmask, commentmask, skipperm, silent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,7 +282,7 @@ CMD_FUNC(rmtkl) {
|
||||
for (tkl = tklines[tklindex]; tkl; tkl = next)
|
||||
{
|
||||
next = tkl->next;
|
||||
count += rmtkl_tryremove(sptr, cptr, tkltype, tkl, uhmask, commentmask, skipperm, silent);
|
||||
count += rmtkl_tryremove(sptr, tkltype, tkl, uhmask, commentmask, skipperm, silent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ CMD_FUNC(cmd_rules)
|
||||
|
||||
temp = NULL;
|
||||
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s RULES :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s RULES :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
|
||||
ptr = Find_tld(sptr);
|
||||
|
||||
@@ -220,9 +220,9 @@ CMD_FUNC(cmd_sajoin)
|
||||
sendto_channel(chptr, acptr, NULL, 0, 0, SEND_LOCAL, NULL,
|
||||
":%s PART %s :%s",
|
||||
acptr->name, chptr->chname, "Left all channels");
|
||||
sendto_server(cptr, 0, 0, mtags, ":%s PART %s :Left all channels", acptr->name, chptr->chname);
|
||||
sendto_server(sptr, 0, 0, mtags, ":%s PART %s :Left all channels", acptr->name, chptr->chname);
|
||||
if (MyConnect(acptr))
|
||||
RunHook5(HOOKTYPE_LOCAL_PART, acptr, acptr, chptr, mtags, "Left all channels");
|
||||
RunHook4(HOOKTYPE_LOCAL_PART, acptr, chptr, mtags, "Left all channels");
|
||||
free_message_tags(mtags);
|
||||
remove_user_from_channel(acptr, chptr);
|
||||
}
|
||||
@@ -251,7 +251,7 @@ CMD_FUNC(cmd_sajoin)
|
||||
* Each with their own unique msgid.
|
||||
*/
|
||||
new_message(acptr, NULL, &mtags);
|
||||
join_channel(chptr, acptr, acptr, mtags, flags);
|
||||
join_channel(chptr, acptr, mtags, flags);
|
||||
if (sjmode)
|
||||
{
|
||||
opermode = 0;
|
||||
@@ -261,7 +261,7 @@ CMD_FUNC(cmd_sajoin)
|
||||
mode_args[0][1] = '\0';
|
||||
mode_args[1] = acptr->name;
|
||||
mode_args[2] = 0;
|
||||
(void)do_mode(chptr, &me, acptr, NULL, 3, mode_args, 0, 1);
|
||||
(void)do_mode(chptr, acptr, NULL, 3, mode_args, 0, 1);
|
||||
sajoinmode = 0;
|
||||
safe_free(mode_args[0]);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ CMD_FUNC(cmd_samode)
|
||||
}
|
||||
|
||||
opermode = 0;
|
||||
(void)do_mode(chptr, cptr, sptr, NULL, parc - 2, parv + 2, 0, 1);
|
||||
(void)do_mode(chptr, sptr, NULL, parc - 2, parv + 2, 0, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ CMD_FUNC(cmd_sapart)
|
||||
ircd_log(LOG_SACMDS,"SAPART: %s used SAPART to make %s part %s",
|
||||
sptr->name, acptr->name, parv[1]);
|
||||
}
|
||||
(void)do_cmd(acptr, acptr, NULL, "PART", comment ? 3 : 2, parv);
|
||||
(void)do_cmd(acptr, NULL, "PART", comment ? 3 : 2, parv);
|
||||
/* acptr may be killed now due to the part reason @ spamfilter */
|
||||
}
|
||||
else
|
||||
|
||||
+2
-2
@@ -160,7 +160,7 @@ CMD_FUNC(cmd_svslogin)
|
||||
}
|
||||
|
||||
/* not for us; propagate. */
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSLOGIN %s %s %s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSLOGIN %s %s %s",
|
||||
sptr->name, parv[1], parv[2], parv[3]);
|
||||
|
||||
return 0;
|
||||
@@ -229,7 +229,7 @@ CMD_FUNC(cmd_sasl)
|
||||
}
|
||||
|
||||
/* not for us; propagate. */
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SASL %s %s %c %s %s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SASL %s %s %c %s %s",
|
||||
sptr->name, parv[1], parv[2], *parv[3], parv[4], parc > 5 ? parv[5] : "");
|
||||
|
||||
return 0;
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ CMD_FUNC(cmd_sdesc)
|
||||
|
||||
ircsnprintf(sptr->srvptr->info, sizeof(sptr->srvptr->info), "%s", parv[1]);
|
||||
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SDESC :%s", sptr->name, parv[1]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SDESC :%s", sptr->name, parv[1]);
|
||||
|
||||
if (MyConnect(sptr))
|
||||
sendnotice(sptr,
|
||||
|
||||
@@ -79,7 +79,7 @@ CMD_FUNC(cmd_sendsno)
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
|
||||
/* Forward to others... */
|
||||
sendto_server(cptr, 0, 0, mtags, ":%s SENDSNO %s :%s", sptr->name, parv[1], parv[2]);
|
||||
sendto_server(sptr, 0, 0, mtags, ":%s SENDSNO %s :%s", sptr->name, parv[1], parv[2]);
|
||||
|
||||
for (p = sno; *p; p++)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ CMD_FUNC(cmd_sendumode)
|
||||
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
|
||||
sendto_server(IsServer(cptr) ? cptr : NULL, 0, 0, mtags,
|
||||
sendto_server(sptr, 0, 0, mtags,
|
||||
":%s SENDUMODE %s :%s", sptr->name, parv[1], message);
|
||||
|
||||
for (p = parv[1]; *p; p++)
|
||||
|
||||
+80
-90
@@ -28,7 +28,7 @@ void send_channel_modes_sjoin(Client *cptr, Channel *chptr);
|
||||
void send_channel_modes_sjoin3(Client *cptr, Channel *chptr);
|
||||
CMD_FUNC(cmd_server);
|
||||
CMD_FUNC(cmd_server_remote);
|
||||
int _verify_link(Client *cptr, Client *sptr, char *servername, ConfigItem_link **link_out);
|
||||
int _verify_link(Client *sptr, char *servername, ConfigItem_link **link_out);
|
||||
void _send_protoctl_servers(Client *sptr, int response);
|
||||
void _send_server_message(Client *sptr);
|
||||
void _introduce_user(Client *to, Client *acptr);
|
||||
@@ -228,29 +228,29 @@ void _send_server_message(Client *sptr)
|
||||
* @returns This function returns 0 on succesful auth, other values should be returned by
|
||||
* the calling function, as it will always be FLUSH_BUFFER due to exit_client().
|
||||
*/
|
||||
int _verify_link(Client *cptr, Client *sptr, char *servername, ConfigItem_link **link_out)
|
||||
int _verify_link(Client *sptr, char *servername, ConfigItem_link **link_out)
|
||||
{
|
||||
char xerrmsg[256];
|
||||
ConfigItem_link *link;
|
||||
char *inpath = get_client_name(cptr, TRUE);
|
||||
char *inpath = get_client_name(sptr, TRUE);
|
||||
Client *acptr = NULL, *ocptr = NULL;
|
||||
ConfigItem_ban *bconf;
|
||||
|
||||
/* We set the sockhost here so you can have incoming masks based on hostnames.
|
||||
* Perhaps a bit late to do it here, but does anyone care?
|
||||
*/
|
||||
if (cptr->local->hostp && cptr->local->hostp->h_name)
|
||||
set_sockhost(cptr, cptr->local->hostp->h_name);
|
||||
if (sptr->local->hostp && sptr->local->hostp->h_name)
|
||||
set_sockhost(sptr, sptr->local->hostp->h_name);
|
||||
|
||||
if (link_out)
|
||||
*link_out = NULL;
|
||||
|
||||
strcpy(xerrmsg, "No matching link configuration");
|
||||
|
||||
if (!cptr->local->passwd)
|
||||
if (!sptr->local->passwd)
|
||||
{
|
||||
sendto_one(cptr, NULL, "ERROR :Missing password");
|
||||
return exit_client(cptr, sptr, &me, NULL, "Missing password");
|
||||
sendto_one(sptr, NULL, "ERROR :Missing password");
|
||||
return exit_client(sptr, sptr, &me, NULL, "Missing password");
|
||||
}
|
||||
|
||||
/* First check if the server is in the list */
|
||||
@@ -259,26 +259,26 @@ int _verify_link(Client *cptr, Client *sptr, char *servername, ConfigItem_link *
|
||||
goto errlink;
|
||||
}
|
||||
|
||||
if (cptr->serv && cptr->serv->conf)
|
||||
if (sptr->serv && sptr->serv->conf)
|
||||
{
|
||||
/* This is an outgoing connect so we already know what link block we are
|
||||
* dealing with. It's the one in: cptr->serv->conf
|
||||
* dealing with. It's the one in: sptr->serv->conf
|
||||
*/
|
||||
|
||||
/* Actually we still need to double check the servername to avoid confusion. */
|
||||
if (strcasecmp(servername, cptr->serv->conf->servername))
|
||||
if (strcasecmp(servername, sptr->serv->conf->servername))
|
||||
{
|
||||
ircsnprintf(xerrmsg, sizeof(xerrmsg), "Outgoing connect from link block '%s' but server "
|
||||
"introduced himself as '%s'. Server name mismatch.",
|
||||
cptr->serv->conf->servername,
|
||||
sptr->serv->conf->servername,
|
||||
servername);
|
||||
|
||||
sendto_one(cptr, NULL, "ERROR :%s", xerrmsg);
|
||||
sendto_one(sptr, NULL, "ERROR :%s", xerrmsg);
|
||||
sendto_ops_and_log("Outgoing link aborted to %s(%s@%s) (%s) %s",
|
||||
cptr->serv->conf->servername, cptr->ident, cptr->local->sockhost, xerrmsg, inpath);
|
||||
return exit_client(cptr, sptr, &me, NULL, xerrmsg);
|
||||
sptr->serv->conf->servername, sptr->ident, sptr->local->sockhost, xerrmsg, inpath);
|
||||
return exit_client(sptr, sptr, &me, NULL, xerrmsg);
|
||||
}
|
||||
link = cptr->serv->conf;
|
||||
link = sptr->serv->conf;
|
||||
goto skip_host_check;
|
||||
} else {
|
||||
/* Hunt the linkblock down ;) */
|
||||
@@ -299,26 +299,26 @@ int _verify_link(Client *cptr, Client *sptr, char *servername, ConfigItem_link *
|
||||
goto errlink;
|
||||
}
|
||||
|
||||
link = Find_link(servername, cptr);
|
||||
link = Find_link(servername, sptr);
|
||||
|
||||
if (!link)
|
||||
{
|
||||
ircsnprintf(xerrmsg, sizeof(xerrmsg), "Server is in link block but link::incoming::mask didn't match");
|
||||
errlink:
|
||||
/* Send the "simple" error msg to the server */
|
||||
sendto_one(cptr, NULL,
|
||||
sendto_one(sptr, NULL,
|
||||
"ERROR :Link denied (No link block found named '%s' or link::incoming::mask did not match your IP %s) %s",
|
||||
servername, GetIP(cptr), inpath);
|
||||
servername, GetIP(sptr), inpath);
|
||||
/* And send the "verbose" error msg only to locally connected ircops */
|
||||
sendto_ops_and_log("Link denied for %s(%s@%s) (%s) %s",
|
||||
servername, cptr->ident, cptr->local->sockhost, xerrmsg, inpath);
|
||||
return exit_client(cptr, sptr, &me, NULL,
|
||||
servername, sptr->ident, sptr->local->sockhost, xerrmsg, inpath);
|
||||
return exit_client(sptr, sptr, &me, NULL,
|
||||
"Link denied (No link block found with your server name or link::incoming::mask did not match)");
|
||||
}
|
||||
|
||||
skip_host_check:
|
||||
/* Now for checking passwords */
|
||||
if (!Auth_Check(cptr, link->auth, cptr->local->passwd))
|
||||
if (!Auth_Check(sptr, link->auth, sptr->local->passwd))
|
||||
{
|
||||
/* Let's help admins a bit with a good error message in case
|
||||
* they mix different authentication systems (plaintext password
|
||||
@@ -327,8 +327,8 @@ skip_host_check:
|
||||
* 1. Check if our side expects a plaintext password but we did not receive one
|
||||
* 2. Check if our side expects a non-plaintext password but we did receive one
|
||||
*/
|
||||
if (((link->auth->type == AUTHTYPE_PLAINTEXT) && cptr->local->passwd && !strcmp(cptr->local->passwd, "*")) ||
|
||||
((link->auth->type != AUTHTYPE_PLAINTEXT) && cptr->local->passwd && strcmp(cptr->local->passwd, "*")))
|
||||
if (((link->auth->type == AUTHTYPE_PLAINTEXT) && sptr->local->passwd && !strcmp(sptr->local->passwd, "*")) ||
|
||||
((link->auth->type != AUTHTYPE_PLAINTEXT) && sptr->local->passwd && strcmp(sptr->local->passwd, "*")))
|
||||
{
|
||||
sendto_ops_and_log("Link denied for '%s' (Authentication failed due to different password types on both sides of the link) %s",
|
||||
servername, inpath);
|
||||
@@ -353,10 +353,10 @@ skip_host_check:
|
||||
sendto_ops_and_log("Link denied for '%s' (Authentication failed [Bad password?]) %s",
|
||||
servername, inpath);
|
||||
}
|
||||
sendto_one(cptr, NULL,
|
||||
sendto_one(sptr, NULL,
|
||||
"ERROR :Link '%s' denied (Authentication failed) %s",
|
||||
servername, inpath);
|
||||
return exit_client(cptr, sptr, &me, NULL,
|
||||
return exit_client(sptr, sptr, &me, NULL,
|
||||
"Link denied (Authentication failed)");
|
||||
}
|
||||
|
||||
@@ -365,25 +365,25 @@ skip_host_check:
|
||||
{
|
||||
char *errstr = NULL;
|
||||
|
||||
if (!IsTLS(cptr))
|
||||
if (!IsTLS(sptr))
|
||||
{
|
||||
sendto_one(cptr, NULL,
|
||||
sendto_one(sptr, NULL,
|
||||
"ERROR :Link '%s' denied (Not using SSL/TLS) %s",
|
||||
servername, inpath);
|
||||
sendto_ops_and_log("Link denied for '%s' (Not using SSL/TLS and verify-certificate is on) %s",
|
||||
servername, inpath);
|
||||
return exit_client(cptr, sptr, &me, NULL,
|
||||
return exit_client(sptr, sptr, &me, NULL,
|
||||
"Link denied (Not using SSL/TLS)");
|
||||
}
|
||||
if (!verify_certificate(cptr->local->ssl, link->servername, &errstr))
|
||||
if (!verify_certificate(sptr->local->ssl, link->servername, &errstr))
|
||||
{
|
||||
sendto_one(cptr, NULL,
|
||||
sendto_one(sptr, NULL,
|
||||
"ERROR :Link '%s' denied (Certificate verification failed) %s",
|
||||
servername, inpath);
|
||||
sendto_ops_and_log("Link denied for '%s' (Certificate verification failed) %s",
|
||||
servername, inpath);
|
||||
sendto_ops_and_log("Reason for certificate verification failure: %s", errstr);
|
||||
return exit_client(cptr, sptr, &me, NULL,
|
||||
return exit_client(sptr, sptr, &me, NULL,
|
||||
"Link denied (Certificate verification failed)");
|
||||
}
|
||||
}
|
||||
@@ -405,10 +405,8 @@ skip_host_check:
|
||||
}
|
||||
|
||||
acptr = acptr->direction;
|
||||
ocptr =
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? acptr : cptr;
|
||||
acptr =
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? cptr : acptr;
|
||||
ocptr = (sptr->local->firsttime > acptr->local->firsttime) ? acptr : sptr;
|
||||
acptr = (sptr->local->firsttime > acptr->local->firsttime) ? sptr : acptr;
|
||||
sendto_one(acptr, NULL,
|
||||
"ERROR :Server %s already exists from %s",
|
||||
servername,
|
||||
@@ -424,27 +422,27 @@ skip_host_check:
|
||||
{
|
||||
sendto_ops_and_log
|
||||
("Cancelling link %s, banned server",
|
||||
get_client_name(cptr, TRUE));
|
||||
sendto_one(cptr, NULL, "ERROR :Banned server (%s)", bconf->reason ? bconf->reason : "no reason");
|
||||
return exit_client(cptr, cptr, &me, NULL, "Banned server");
|
||||
get_client_name(sptr, TRUE));
|
||||
sendto_one(sptr, NULL, "ERROR :Banned server (%s)", bconf->reason ? bconf->reason : "no reason");
|
||||
return exit_client(sptr, sptr, &me, NULL, "Banned server");
|
||||
}
|
||||
if (link->class->clients + 1 > link->class->maxclients)
|
||||
{
|
||||
sendto_ops_and_log("Cancelling link %s, full class",
|
||||
get_client_name(cptr, TRUE));
|
||||
return exit_client(cptr, cptr, &me, NULL, "Full class");
|
||||
get_client_name(sptr, TRUE));
|
||||
return exit_client(sptr, sptr, &me, NULL, "Full class");
|
||||
}
|
||||
if (!IsLocalhost(cptr) && (iConf.plaintext_policy_server == POLICY_DENY) && !IsSecure(cptr))
|
||||
if (!IsLocalhost(sptr) && (iConf.plaintext_policy_server == POLICY_DENY) && !IsSecure(sptr))
|
||||
{
|
||||
sendto_one(cptr, NULL, "ERROR :Servers need to use SSL/TLS (set::plaintext-policy::server is 'deny')");
|
||||
sendto_ops_and_log("Rejected insecure server %s. See https://www.unrealircd.org/docs/FAQ#ERROR:_Servers_need_to_use_SSL.2FTLS", cptr->name);
|
||||
return exit_client(cptr, sptr, &me, NULL, "Servers need to use SSL/TLS (set::plaintext-policy::server is 'deny')");
|
||||
sendto_one(sptr, NULL, "ERROR :Servers need to use SSL/TLS (set::plaintext-policy::server is 'deny')");
|
||||
sendto_ops_and_log("Rejected insecure server %s. See https://www.unrealircd.org/docs/FAQ#ERROR:_Servers_need_to_use_SSL.2FTLS", sptr->name);
|
||||
return exit_client(sptr, sptr, &me, NULL, "Servers need to use SSL/TLS (set::plaintext-policy::server is 'deny')");
|
||||
}
|
||||
if (IsSecure(cptr) && (iConf.outdated_tls_policy_server == POLICY_DENY) && outdated_tls_client(cptr))
|
||||
if (IsSecure(sptr) && (iConf.outdated_tls_policy_server == POLICY_DENY) && outdated_tls_client(sptr))
|
||||
{
|
||||
sendto_one(cptr, NULL, "ERROR :Server is using an outdated SSL/TLS protocol or cipher (set::outdated-tls-policy::server is 'deny')");
|
||||
sendto_ops_and_log("Rejected server %s using outdated %s. See https://www.unrealircd.org/docs/FAQ#server-outdated-tls", tls_get_cipher(cptr->local->ssl), cptr->name);
|
||||
return exit_client(cptr, sptr, &me, NULL, "Server using outdates SSL/TLS protocol or cipher (set::outdated-tls-policy::server is 'deny')");
|
||||
sendto_one(sptr, NULL, "ERROR :Server is using an outdated SSL/TLS protocol or cipher (set::outdated-tls-policy::server is 'deny')");
|
||||
sendto_ops_and_log("Rejected server %s using outdated %s. See https://www.unrealircd.org/docs/FAQ#server-outdated-tls", tls_get_cipher(sptr->local->ssl), sptr->name);
|
||||
return exit_client(sptr, sptr, &me, NULL, "Server using outdates SSL/TLS protocol or cipher (set::outdated-tls-policy::server is 'deny')");
|
||||
}
|
||||
if (link_out)
|
||||
*link_out = link;
|
||||
@@ -473,7 +471,6 @@ skip_host_check:
|
||||
CMD_FUNC(cmd_server)
|
||||
{
|
||||
char *servername = NULL; /* Pointer for servername */
|
||||
/* char *password = NULL; */
|
||||
char *ch = NULL; /* */
|
||||
char descbuf[BUFSIZE];
|
||||
int hop = 0;
|
||||
@@ -482,14 +479,10 @@ CMD_FUNC(cmd_server)
|
||||
ConfigItem_deny_link *deny;
|
||||
char *flags = NULL, *protocol = NULL, *inf = NULL, *num = NULL;
|
||||
|
||||
|
||||
/* Ignore it */
|
||||
if (IsUser(sptr))
|
||||
{
|
||||
sendnumeric(cptr, ERR_ALREADYREGISTRED);
|
||||
sendnotice(cptr,
|
||||
"*** Sorry, but your IRC program doesn't appear to support changing servers.");
|
||||
sptr->local->since += 7;
|
||||
sendnumeric(sptr, ERR_ALREADYREGISTRED);
|
||||
sendnotice(sptr, "*** Sorry, but your IRC program doesn't appear to support changing servers.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -499,14 +492,11 @@ CMD_FUNC(cmd_server)
|
||||
if (parc < 4 || (!*parv[3]))
|
||||
{
|
||||
sendto_one(sptr, NULL, "ERROR :Not enough SERVER parameters");
|
||||
return exit_client(cptr, sptr, &me, NULL, "Not enough parameters");
|
||||
return exit_client(sptr->direction, sptr, &me, NULL, "Not enough parameters");
|
||||
}
|
||||
|
||||
if (IsUnknown(cptr) && (cptr->local->listener->options & LISTENER_CLIENTSONLY))
|
||||
{
|
||||
return exit_client(cptr, sptr, &me, NULL,
|
||||
"This port is for clients only");
|
||||
}
|
||||
if (MyConnect(sptr) && IsUnknown(sptr) && (sptr->local->listener->options & LISTENER_CLIENTSONLY))
|
||||
return exit_client(sptr, sptr, &me, NULL, "This port is for clients only");
|
||||
|
||||
/* Now, let us take a look at the parameters we got
|
||||
* Passes here:
|
||||
@@ -527,34 +517,34 @@ CMD_FUNC(cmd_server)
|
||||
sendto_snomask
|
||||
(SNO_JUNK,
|
||||
"WARNING: Bogus server name (%s) from %s (maybe just a fishy client)",
|
||||
servername, get_client_name(cptr, TRUE));
|
||||
servername, get_client_name(sptr, TRUE));
|
||||
|
||||
return exit_client(cptr, sptr, &me, NULL, "Bogus server name");
|
||||
return exit_client(sptr->direction, sptr, &me, NULL, "Bogus server name");
|
||||
}
|
||||
|
||||
if ((IsUnknown(cptr) || IsHandshake(cptr)) && !cptr->local->passwd)
|
||||
if ((IsUnknown(sptr) || IsHandshake(sptr)) && !sptr->local->passwd)
|
||||
{
|
||||
sendto_one(sptr, NULL, "ERROR :Missing password");
|
||||
return exit_client(cptr, sptr, &me, NULL, "Missing password");
|
||||
return exit_client(sptr, sptr, &me, NULL, "Missing password");
|
||||
}
|
||||
|
||||
/*
|
||||
* Now, we can take a look at it all
|
||||
*/
|
||||
if (IsUnknown(cptr) || IsHandshake(cptr))
|
||||
if (IsUnknown(sptr) || IsHandshake(sptr))
|
||||
{
|
||||
int ret;
|
||||
ret = verify_link(cptr, sptr, servername, &aconf);
|
||||
ret = verify_link(sptr, servername, &aconf);
|
||||
if (ret < 0)
|
||||
return ret; /* FLUSH_BUFFER / failure */
|
||||
|
||||
/* OK, let us check in the data now now */
|
||||
hop = atol(parv[2]);
|
||||
strlcpy(info, parv[parc - 1], sizeof(info));
|
||||
strlcpy(cptr->name, servername, sizeof(cptr->name));
|
||||
cptr->hopcount = hop;
|
||||
strlcpy(sptr->name, servername, sizeof(sptr->name));
|
||||
sptr->hopcount = hop;
|
||||
/* Add ban server stuff */
|
||||
if (SupportVL(cptr))
|
||||
if (SupportVL(sptr))
|
||||
{
|
||||
char tmp[REALLEN + 61];
|
||||
inf = protocol = flags = num = NULL;
|
||||
@@ -575,16 +565,16 @@ CMD_FUNC(cmd_server)
|
||||
{
|
||||
int ret;
|
||||
|
||||
strlcpy(cptr->info, inf[0] ? inf : "server", sizeof(cptr->info)); /* set real description */
|
||||
strlcpy(sptr->info, inf[0] ? inf : "server", sizeof(sptr->info)); /* set real description */
|
||||
|
||||
ret = _check_deny_version(cptr, NULL, atoi(protocol), flags);
|
||||
ret = _check_deny_version(sptr, NULL, atoi(protocol), flags);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
strlcpy(cptr->info, info[0] ? info : "server", sizeof(cptr->info));
|
||||
strlcpy(sptr->info, info[0] ? info : "server", sizeof(sptr->info));
|
||||
}
|
||||
} else {
|
||||
strlcpy(cptr->info, info[0] ? info : "server", sizeof(cptr->info));
|
||||
strlcpy(sptr->info, info[0] ? info : "server", sizeof(sptr->info));
|
||||
}
|
||||
|
||||
for (deny = conf_deny_link; deny; deny = deny->next)
|
||||
@@ -592,24 +582,23 @@ CMD_FUNC(cmd_server)
|
||||
if (deny->flag.type == CRULE_ALL && match_simple(deny->mask, servername)
|
||||
&& crule_eval(deny->rule)) {
|
||||
sendto_ops_and_log("Refused connection from %s. Rejected by deny link { } block.",
|
||||
get_client_host(cptr));
|
||||
return exit_client(cptr, cptr, cptr, NULL,
|
||||
"Disallowed by connection rule");
|
||||
get_client_host(sptr));
|
||||
return exit_client(sptr, sptr, sptr, NULL, "Disallowed by connection rule");
|
||||
}
|
||||
}
|
||||
if (aconf->options & CONNECT_QUARANTINE)
|
||||
SetQuarantined(cptr);
|
||||
SetQuarantined(sptr);
|
||||
|
||||
ircsnprintf(descbuf, sizeof descbuf, "Server: %s", servername);
|
||||
fd_desc(cptr->local->fd, descbuf);
|
||||
fd_desc(sptr->local->fd, descbuf);
|
||||
|
||||
/* Start synch now */
|
||||
if (cmd_server_synch(cptr, aconf) == FLUSH_BUFFER)
|
||||
if (cmd_server_synch(sptr, aconf) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
}
|
||||
else
|
||||
{
|
||||
return cmd_server_remote(cptr, sptr, recv_mtags, parc, parv);
|
||||
return cmd_server_remote(sptr, recv_mtags, parc, parv);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -622,6 +611,7 @@ CMD_FUNC(cmd_server_remote)
|
||||
int hop;
|
||||
char info[REALLEN + 61];
|
||||
char *servername = parv[1];
|
||||
Client *cptr = sptr->direction; /* lazy, since this function may be removed soon */
|
||||
|
||||
if (parc < 4 || (!*parv[3]))
|
||||
{
|
||||
@@ -629,6 +619,7 @@ CMD_FUNC(cmd_server_remote)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check if server already exists... */
|
||||
if ((acptr = find_server(servername, NULL)))
|
||||
{
|
||||
/* Found. Bad. Quit. */
|
||||
@@ -641,11 +632,10 @@ CMD_FUNC(cmd_server_remote)
|
||||
return exit_client(sptr, sptr, sptr, NULL, "Server Exists");
|
||||
}
|
||||
|
||||
// FIXME: verify this code:
|
||||
acptr = acptr->direction;
|
||||
ocptr =
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? acptr : cptr;
|
||||
acptr =
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? cptr : acptr;
|
||||
ocptr = (cptr->local->firsttime > acptr->local->firsttime) ? acptr : cptr;
|
||||
acptr = (cptr->local->firsttime > acptr->local->firsttime) ? cptr : acptr;
|
||||
sendto_one(acptr, NULL,
|
||||
"ERROR :Server %s already exists from %s",
|
||||
servername,
|
||||
@@ -740,13 +730,13 @@ CMD_FUNC(cmd_server_remote)
|
||||
|
||||
if (*acptr->id)
|
||||
{
|
||||
sendto_server(cptr, PROTO_SID, 0, NULL, ":%s SID %s %d %s :%s",
|
||||
sendto_server(sptr, PROTO_SID, 0, NULL, ":%s SID %s %d %s :%s",
|
||||
acptr->srvptr->id, acptr->name, hop + 1, acptr->id, acptr->info);
|
||||
sendto_server(cptr, 0, PROTO_SID, NULL, ":%s SERVER %s %d :%s",
|
||||
sendto_server(sptr, 0, PROTO_SID, NULL, ":%s SERVER %s %d :%s",
|
||||
acptr->srvptr->name,
|
||||
acptr->name, hop + 1, acptr->info);
|
||||
} else {
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SERVER %s %d :%s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SERVER %s %d :%s",
|
||||
acptr->srvptr->name,
|
||||
acptr->name, hop + 1, acptr->info);
|
||||
}
|
||||
@@ -757,7 +747,7 @@ CMD_FUNC(cmd_server_remote)
|
||||
|
||||
void _introduce_user(Client *to, Client *acptr)
|
||||
{
|
||||
send_umode(NULL, acptr, 0, SEND_UMODES, buf);
|
||||
build_umode_string(acptr, 0, SEND_UMODES, buf);
|
||||
|
||||
sendto_one_nickcmd(to, acptr, buf);
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ CMD_FUNC(cmd_sethost)
|
||||
/* get it in */
|
||||
safe_strdup(sptr->user->virthost, vhost);
|
||||
/* spread it out */
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SETHOST %s", sptr->name, parv[1]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SETHOST %s", sptr->name, parv[1]);
|
||||
|
||||
userhost_changed(sptr);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ CMD_FUNC(cmd_setident)
|
||||
|
||||
strlcpy(sptr->user->username, vident, sizeof(sptr->user->username));
|
||||
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SETIDENT %s", sptr->name, parv[1]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SETIDENT %s", sptr->name, parv[1]);
|
||||
|
||||
userhost_changed(sptr);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ CMD_FUNC(cmd_setname)
|
||||
strcpy(sptr->info, parv[1]);
|
||||
}
|
||||
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SETNAME :%s", sptr->name, parv[1]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SETNAME :%s", sptr->name, parv[1]);
|
||||
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
|
||||
+7
-7
@@ -41,11 +41,11 @@ MOD_UNLOAD()
|
||||
* https://www.unrealircd.org/docs/Server_protocol:SINFO_command
|
||||
* ^ contains important remarks regarding when to send it and when not.
|
||||
*/
|
||||
int sinfo_server(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
int sinfo_server(Client *sptr, int parc, char *parv[])
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
if (cptr == sptr)
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
/* It is a protocol violation to send an SINFO for yourself,
|
||||
* eg if you are server 001, then you cannot send :001 SINFO ....
|
||||
@@ -57,7 +57,7 @@ int sinfo_server(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
* failure to do so will lead to potential desyncs or other major
|
||||
* issues.
|
||||
*/
|
||||
return exit_client(cptr, sptr, &me, NULL, "Protocol error: you cannot send SINFO about yourself");
|
||||
return exit_client(sptr, sptr, &me, NULL, "Protocol error: you cannot send SINFO about yourself");
|
||||
}
|
||||
|
||||
/* :SID SINFO up_since protocol umodes chanmodes nickchars :software name
|
||||
@@ -105,13 +105,13 @@ int sinfo_server(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
|
||||
/* Broadcast to 'the other side' of the net */
|
||||
concat_params(buf, sizeof(buf), parc, parv);
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SINFO %s", sptr->name, buf);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SINFO %s", sptr->name, buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define SafeDisplayStr(x) ((x && *(x)) ? (x) : "-")
|
||||
int sinfo_user(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
int sinfo_user(Client *sptr, int parc, char *parv[])
|
||||
{
|
||||
Client *acptr;
|
||||
|
||||
@@ -160,8 +160,8 @@ int sinfo_user(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
CMD_FUNC(cmd_sinfo)
|
||||
{
|
||||
if (IsServer(sptr))
|
||||
return sinfo_server(cptr, sptr, parc, parv);
|
||||
return sinfo_server(sptr, parc, parv);
|
||||
else if (MyUser(sptr))
|
||||
return sinfo_user(cptr, sptr, parc, parv);
|
||||
return sinfo_user(sptr, parc, parv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+32
-32
@@ -116,7 +116,7 @@ aParv *mp2parv(char *xmbuf, char *parmbuf)
|
||||
else {\
|
||||
MessageTag *mtags = NULL; \
|
||||
/* for old servers without sjoin: */ \
|
||||
sendto_server(cptr, 0, PROTO_SJOIN, NULL, ":%s MODE %s %s %s %lld", sptr->name, chptr->chname,\
|
||||
sendto_server(sptr, 0, PROTO_SJOIN, NULL, ":%s MODE %s %s %s %lld", sptr->name, chptr->chname,\
|
||||
modebuf, parabuf, (long long)chptr->creationtime); \
|
||||
new_message_special(sptr, recv_mtags, &mtags, ":%s MODE %s %s %s", sptr->name, chptr->chname, modebuf, parabuf); \
|
||||
sendto_channel(chptr, sptr, NULL, 0, 0, SEND_LOCAL, mtags, \
|
||||
@@ -158,7 +158,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
long modeflags;
|
||||
char queue_s=0, queue_c=0; /* oh this is soooooo ugly :p */
|
||||
|
||||
if (IsUser(sptr) || parc < 4 || !IsServer(sptr))
|
||||
if (!IsServer(sptr) || parc < 4)
|
||||
return 0;
|
||||
|
||||
if (!IsChannelName(parv[2]))
|
||||
@@ -166,16 +166,16 @@ CMD_FUNC(cmd_sjoin)
|
||||
|
||||
merge = nopara = nomode = removeours = removetheirs = 0;
|
||||
|
||||
if (SupportSJOIN(cptr) && !SupportSJ3(cptr) && !strncmp(parv[4], "<none>", 6))
|
||||
if (SupportSJOIN(sptr->direction) && !SupportSJ3(sptr->direction) && !strncmp(parv[4], "<none>", 6))
|
||||
nopara = 1;
|
||||
|
||||
if (SupportSJOIN2(cptr) && !SupportSJ3(cptr) && !strncmp(parv[4], "<->", 6))
|
||||
if (SupportSJOIN2(sptr->direction) && !SupportSJ3(sptr->direction) && !strncmp(parv[4], "<->", 6))
|
||||
nopara = 1;
|
||||
|
||||
if (SupportSJ3(cptr) && (parc < 6))
|
||||
if (SupportSJ3(sptr->direction) && (parc < 6))
|
||||
nopara = 1;
|
||||
|
||||
if (SupportSJ3(cptr))
|
||||
if (SupportSJ3(sptr->direction))
|
||||
{
|
||||
if (parc < 5)
|
||||
nomode = 1;
|
||||
@@ -186,7 +186,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
nomode = 1;
|
||||
}
|
||||
|
||||
chptr = get_channel(cptr, parv[2], CREATE);
|
||||
chptr = get_channel(sptr, parv[2], CREATE);
|
||||
|
||||
ts = (time_t)atol(parv[1]);
|
||||
|
||||
@@ -215,12 +215,13 @@ CMD_FUNC(cmd_sjoin)
|
||||
oldts = chptr->creationtime;
|
||||
}
|
||||
|
||||
// FIXME: make it so services cannot screw this up so easily --- if possible...
|
||||
if (ts < 750000)
|
||||
{
|
||||
if (ts != 0)
|
||||
sendto_ops
|
||||
("Warning! Possible desynch: SJOIN for channel %s has a fishy timestamp (%lld) [%s/%s]",
|
||||
chptr->chname, (long long)ts, sptr->name, cptr->name);
|
||||
chptr->chname, (long long)ts, sptr->name, sptr->direction->name);
|
||||
}
|
||||
|
||||
parabuf[0] = '\0';
|
||||
@@ -228,7 +229,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
modebuf[1] = '\0';
|
||||
|
||||
/* Grab current modes -> modebuf & parabuf */
|
||||
channel_modes(cptr, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr);
|
||||
channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), sizeof(parabuf), chptr);
|
||||
|
||||
/* Do we need to remove all our modes, bans/exempt/inves lists and -vhoaq our users? */
|
||||
if (removeours)
|
||||
@@ -243,11 +244,10 @@ CMD_FUNC(cmd_sjoin)
|
||||
{
|
||||
MessageTag *mtags = NULL;
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount,
|
||||
pvar, 0);
|
||||
set_mode(chptr, sptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
|
||||
/* for old servers without SJOIN: */
|
||||
sendto_server(cptr, 0, PROTO_SJOIN, mtags,
|
||||
sendto_server(sptr, 0, PROTO_SJOIN, mtags,
|
||||
":%s MODE %s %s %s %lld",
|
||||
sptr->name, chptr->chname, modebuf, parabuf,
|
||||
(long long)chptr->creationtime);
|
||||
@@ -335,7 +335,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
modebuf[b] = '\0';
|
||||
|
||||
/* for old servers without sjoin: */
|
||||
sendto_server(cptr, 0, PROTO_SJOIN, mtags,
|
||||
sendto_server(sptr, 0, PROTO_SJOIN, mtags,
|
||||
":%s MODE %s %s %s %lld",
|
||||
sptr->name, chptr->chname,
|
||||
modebuf, parabuf, (long long)chptr->creationtime);
|
||||
@@ -349,7 +349,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
}
|
||||
|
||||
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
|
||||
set_channel_mlock(cptr, sptr, chptr, NULL, FALSE);
|
||||
set_channel_mlock(sptr, chptr, NULL, FALSE);
|
||||
}
|
||||
/* Mode setting done :), now for our beloved clients */
|
||||
parabuf[0] = 0;
|
||||
@@ -379,7 +379,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
|
||||
for (s = strtoken(&saved, cbuf, " "); s; s = strtoken(&saved, NULL, " "))
|
||||
{
|
||||
char *setby = cptr->name; /**< Set by (nick, nick!user@host, or server name) */
|
||||
char *setby = sptr->name; /**< Set by (nick, nick!user@host, or server name) */
|
||||
time_t setat = TStime(); /**< Set at timestamp */
|
||||
int sjsby_info = 0; /**< Set to 1 if we receive SJSBY info to alter the above 2 vars */
|
||||
|
||||
@@ -390,7 +390,7 @@ CMD_FUNC(cmd_sjoin)
|
||||
/* UnrealIRCd 4.2.2 and later support "SJSBY" which allows communicating
|
||||
* setat/setby information for bans, ban exempts and invite exceptions.
|
||||
*/
|
||||
if (SupportSJSBY(cptr) && (*tp == '<'))
|
||||
if (SupportSJSBY(sptr->direction) && (*tp == '<'))
|
||||
{
|
||||
/* Special prefix to communicate timestamp and setter:
|
||||
* "<" + timestamp + "," + nick[!user@host] + ">" + normal SJOIN stuff
|
||||
@@ -542,14 +542,14 @@ getnick:
|
||||
MessageTag *mtags = NULL;
|
||||
|
||||
add_user_to_channel(chptr, acptr, modeflags);
|
||||
RunHook5(HOOKTYPE_REMOTE_JOIN, cptr, acptr, chptr, recv_mtags, NULL);
|
||||
RunHook4(HOOKTYPE_REMOTE_JOIN, acptr, chptr, recv_mtags, NULL);
|
||||
new_message_special(acptr, recv_mtags, &mtags, ":%s JOIN %s", acptr->name, chptr->chname);
|
||||
send_join_to_local_users(acptr, chptr, mtags);
|
||||
free_message_tags(mtags);
|
||||
}
|
||||
|
||||
/* old servers without SJOIN: */
|
||||
sendto_server(cptr, 0, PROTO_SJOIN, NULL, ":%s JOIN %s", acptr->name, chptr->chname);
|
||||
sendto_server(sptr, 0, PROTO_SJOIN, NULL, ":%s JOIN %s", acptr->name, chptr->chname);
|
||||
|
||||
CheckStatus('q', CHFL_CHANOWNER);
|
||||
CheckStatus('a', CHFL_CHANADMIN);
|
||||
@@ -560,7 +560,7 @@ getnick:
|
||||
if (strlen(nick_buf) + strlen(prefix) + strlen(acptr->name) > BUFSIZE - 10)
|
||||
{
|
||||
/* Send what we have and start a new buffer */
|
||||
sendto_server(cptr, PROTO_SJOIN | PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf);
|
||||
sendto_server(sptr, PROTO_SJOIN | PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf);
|
||||
snprintf(nick_buf, sizeof(nick_buf), ":%s SJOIN %lld %s :", sptr->name, (long long)ts, sj3_parabuf);
|
||||
/* Double-check the new buffer is sufficient to concat the data */
|
||||
if (strlen(nick_buf) + strlen(prefix) + strlen(acptr->name) > BUFSIZE - 5)
|
||||
@@ -576,7 +576,7 @@ getnick:
|
||||
if (strlen(uid_buf) + strlen(prefix) + IDLEN > BUFSIZE - 10)
|
||||
{
|
||||
/* Send what we have and start a new buffer */
|
||||
sendto_server(cptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_buf);
|
||||
sendto_server(sptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_buf);
|
||||
snprintf(uid_buf, sizeof(uid_buf), ":%s SJOIN %lld %s :", ID(sptr), (long long)ts, sj3_parabuf);
|
||||
/* Double-check the new buffer is sufficient to concat the data */
|
||||
if (strlen(uid_buf) + strlen(prefix) + strlen(ID(acptr)) > BUFSIZE - 5)
|
||||
@@ -592,7 +592,7 @@ getnick:
|
||||
if (strlen(uid_sjsby_buf) + strlen(prefix) + IDLEN > BUFSIZE - 10)
|
||||
{
|
||||
/* Send what we have and start a new buffer */
|
||||
sendto_server(cptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_sjsby_buf);
|
||||
sendto_server(sptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_sjsby_buf);
|
||||
snprintf(uid_sjsby_buf, sizeof(uid_sjsby_buf), ":%s SJOIN %lld %s :", ID(sptr), (long long)ts, sj3_parabuf);
|
||||
/* Double-check the new buffer is sufficient to concat the data */
|
||||
if (strlen(uid_sjsby_buf) + strlen(prefix) + strlen(ID(acptr)) > BUFSIZE - 5)
|
||||
@@ -651,7 +651,7 @@ getnick:
|
||||
if (strlen(nick_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 10)
|
||||
{
|
||||
/* Send what we have and start a new buffer */
|
||||
sendto_server(cptr, PROTO_SJOIN | PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf);
|
||||
sendto_server(sptr, PROTO_SJOIN | PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf);
|
||||
snprintf(nick_buf, sizeof(nick_buf), ":%s SJOIN %lld %s :", sptr->name, (long long)ts, sj3_parabuf);
|
||||
/* Double-check the new buffer is sufficient to concat the data */
|
||||
if (strlen(nick_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 5)
|
||||
@@ -667,7 +667,7 @@ getnick:
|
||||
if (strlen(uid_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 10)
|
||||
{
|
||||
/* Send what we have and start a new buffer */
|
||||
sendto_server(cptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_buf);
|
||||
sendto_server(sptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_buf);
|
||||
snprintf(uid_buf, sizeof(uid_buf), ":%s SJOIN %lld %s :", ID(sptr), (long long)ts, sj3_parabuf);
|
||||
/* Double-check the new buffer is sufficient to concat the data */
|
||||
if (strlen(uid_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 5)
|
||||
@@ -689,7 +689,7 @@ getnick:
|
||||
if (strlen(uid_sjsby_buf) + strlen(scratch_buf) > BUFSIZE - 10)
|
||||
{
|
||||
/* Send what we have and start a new buffer */
|
||||
sendto_server(cptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf);
|
||||
sendto_server(sptr, PROTO_SJOIN | PROTO_SJ3 | PROTO_SID | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf);
|
||||
snprintf(uid_sjsby_buf, sizeof(uid_sjsby_buf), ":%s SJOIN %lld %s :", ID(sptr), (long long)ts, sj3_parabuf);
|
||||
/* Double-check the new buffer is sufficient to concat the data */
|
||||
if (strlen(uid_sjsby_buf) + strlen(scratch_buf) > BUFSIZE - 5)
|
||||
@@ -706,9 +706,9 @@ getnick:
|
||||
|
||||
/* Send out any possible remainder.. */
|
||||
Debug((DEBUG_DEBUG, "Sending '%li %s :%s' to sj3", ts, parabuf, parv[parc - 1]));
|
||||
sendto_server(cptr, PROTO_SJOIN | PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf);
|
||||
sendto_server(cptr, PROTO_SID | PROTO_SJOIN | PROTO_SJ3, PROTO_SJSBY, recv_mtags, "%s", uid_buf);
|
||||
sendto_server(cptr, PROTO_SID | PROTO_SJOIN | PROTO_SJ3 | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf);
|
||||
sendto_server(sptr, PROTO_SJOIN | PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf);
|
||||
sendto_server(sptr, PROTO_SID | PROTO_SJOIN | PROTO_SJ3, PROTO_SJSBY, recv_mtags, "%s", uid_buf);
|
||||
sendto_server(sptr, PROTO_SID | PROTO_SJOIN | PROTO_SJ3 | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf);
|
||||
|
||||
if (modebuf[1])
|
||||
{
|
||||
@@ -717,7 +717,7 @@ getnick:
|
||||
modebuf[b] = '\0';
|
||||
|
||||
/* for old servers without sjoin: */
|
||||
sendto_server(cptr, 0, PROTO_SJOIN, mtags,
|
||||
sendto_server(sptr, 0, PROTO_SJOIN, mtags,
|
||||
":%s MODE %s %s %s %lld",
|
||||
sptr->name, chptr->chname, modebuf, parabuf,
|
||||
(long long)chptr->creationtime);
|
||||
@@ -746,10 +746,10 @@ getnick:
|
||||
strlcpy(paraback, parabuf, sizeof paraback);
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
set_mode(chptr, sptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
|
||||
/* for old servers without SJOIN: */
|
||||
sendto_server(cptr, 0, PROTO_SJOIN, NULL,
|
||||
sendto_server(sptr, 0, PROTO_SJOIN, NULL,
|
||||
":%s MODE %s %s %s %lld",
|
||||
sptr->name, chptr->chname, modebuf, paraback,
|
||||
(long long)chptr->creationtime);
|
||||
@@ -782,7 +782,7 @@ getnick:
|
||||
}
|
||||
}
|
||||
ap = mp2parv(modebuf, parabuf);
|
||||
set_mode(chptr, cptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
set_mode(chptr, sptr, ap->parc, ap->parv, &pcount, pvar, 0);
|
||||
|
||||
/* Good, now we got modes, now for the differencing and outputting of modes
|
||||
* We first see if any para modes are set.
|
||||
@@ -964,7 +964,7 @@ getnick:
|
||||
MessageTag *mtags = NULL;
|
||||
|
||||
/* for old servers without SJOIN: */
|
||||
sendto_server(cptr, 0, PROTO_SJOIN, NULL,
|
||||
sendto_server(sptr, 0, PROTO_SJOIN, NULL,
|
||||
":%s MODE %s %s %s %lld",
|
||||
sptr->name, chptr->chname, modebuf, parabuf,
|
||||
(long long)chptr->creationtime);
|
||||
|
||||
@@ -83,5 +83,5 @@ CMD_FUNC(cmd_sqline)
|
||||
ircsnprintf(mo, sizeof(mo), "%lld", (long long)TStime());
|
||||
tkllayer[7] = mo;
|
||||
tkllayer[8] = comment ? comment : "no reason";
|
||||
return cmd_tkl(&me, &me, NULL, 9, tkllayer);
|
||||
return cmd_tkl(&me, NULL, 9, tkllayer);
|
||||
}
|
||||
|
||||
+16
-20
@@ -61,7 +61,9 @@ CMD_FUNC(cmd_squit)
|
||||
{
|
||||
char *server;
|
||||
Client *acptr;
|
||||
char *comment = (parc > 2 && parv[parc - 1]) ? parv[parc - 1] : cptr->name;
|
||||
char *comment = (parc > 2 && parv[parc - 1]) ? parv[parc - 1] : sptr->name;
|
||||
|
||||
// FIXME: this function is way too confusing, and full of old shit?
|
||||
|
||||
if (!ValidatePermissionsForPath("route:local",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
@@ -69,25 +71,19 @@ CMD_FUNC(cmd_squit)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parc > 1)
|
||||
if ((parc < 2) || BadPtr(parv[1]))
|
||||
{
|
||||
server = parv[1];
|
||||
|
||||
acptr = find_server_quick(server);
|
||||
if (acptr && IsMe(acptr))
|
||||
{
|
||||
acptr = cptr;
|
||||
server = cptr->local->sockhost;
|
||||
}
|
||||
sendnumeric(sptr, ERR_NEEDMOREPARAMS, "SQUIT");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
||||
server = parv[1];
|
||||
|
||||
acptr = find_server_quick(server);
|
||||
if (acptr && IsMe(acptr))
|
||||
{
|
||||
/*
|
||||
** This is actually protocol error. But, well, closing
|
||||
** the link is very proper answer to that...
|
||||
*/
|
||||
server = cptr->local->sockhost;
|
||||
acptr = cptr;
|
||||
acptr = sptr->direction;
|
||||
server = sptr->direction->local->sockhost;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -95,7 +91,7 @@ CMD_FUNC(cmd_squit)
|
||||
**
|
||||
** The old (irc2.2PL1 and earlier) code just cleans away the
|
||||
** server client from the links (because it is never true
|
||||
** "cptr == acptr".
|
||||
** "sptr->direction == acptr".
|
||||
**
|
||||
** This logic here works the same way until "SQUIT host" hits
|
||||
** the server having the target "host" as local link. Then it
|
||||
@@ -132,7 +128,7 @@ CMD_FUNC(cmd_squit)
|
||||
/*
|
||||
** Notify all opers, if my local link is remotely squitted
|
||||
*/
|
||||
if (MyConnect(acptr) && !MyUser(cptr))
|
||||
if (MyConnect(acptr) && !MyUser(sptr))
|
||||
{
|
||||
sendto_umode_global(UMODE_OPER, "Received SQUIT %s from %s (%s)",
|
||||
acptr->name, get_client_name(sptr, FALSE), comment);
|
||||
@@ -164,5 +160,5 @@ CMD_FUNC(cmd_squit)
|
||||
SetSQuit(acptr);
|
||||
}
|
||||
|
||||
return exit_client(cptr, acptr, sptr, recv_mtags, comment);
|
||||
return exit_client(sptr->direction, acptr, sptr, recv_mtags, comment);
|
||||
}
|
||||
|
||||
+4
-4
@@ -47,7 +47,7 @@ ModuleHeader MOD_HEADER
|
||||
/* Forward declarations */
|
||||
static void unload_motd_file(MOTDFile *list);
|
||||
CMD_FUNC(cmd_staff);
|
||||
static int cb_rehashflag(Client *cptr, Client *sptr, char *flag);
|
||||
static int cb_rehashflag(Client *sptr, char *flag);
|
||||
static int cb_test(ConfigFile *, ConfigEntry *, int, int *);
|
||||
static int cb_conf(ConfigFile *, ConfigEntry *, int);
|
||||
static int cb_rehash();
|
||||
@@ -335,7 +335,7 @@ static int cb_stats(Client *sptr, char *flag)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cb_rehashflag(Client *cptr, Client *sptr, char *flag)
|
||||
static int cb_rehashflag(Client *sptr, char *flag)
|
||||
{
|
||||
int myflag = 0;
|
||||
|
||||
@@ -344,7 +344,7 @@ static int cb_rehashflag(Client *cptr, Client *sptr, char *flag)
|
||||
{
|
||||
if (myflag)
|
||||
sendto_ops("%sRehashing network staff file on the request of %s",
|
||||
cptr != sptr ? "Remotely " : "", sptr->name);
|
||||
MyUser(sptr) ? "Remotely " : "", sptr->name);
|
||||
|
||||
#ifdef USE_LIBCURL
|
||||
if (Download.is_url)
|
||||
@@ -366,7 +366,7 @@ CMD_FUNC(cmd_staff)
|
||||
if (!IsUser(sptr))
|
||||
return -1;
|
||||
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s STAFF", 1, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s STAFF", 1, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
|
||||
if (!staff.lines)
|
||||
|
||||
+2
-2
@@ -306,12 +306,12 @@ CMD_FUNC(cmd_stats)
|
||||
|
||||
if (parc == 3 && parv[2][0] != '+' && parv[2][0] != '-')
|
||||
{
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s STATS %s :%s", 2, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
}
|
||||
else if (parc == 4 && parv[2][0] != '+' && parv[2][0] != '-')
|
||||
{
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s STATS %s %s %s", 2, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s STATS %s %s %s", 2, parc, parv) != HUNTED_ISME)
|
||||
return 0;
|
||||
}
|
||||
if (parc < 2 || !*parv[1])
|
||||
|
||||
@@ -72,7 +72,7 @@ CMD_FUNC(cmd_svsfline)
|
||||
|
||||
if (IsULine(sptr))
|
||||
{
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSFLINE + %s :%s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSFLINE + %s :%s",
|
||||
sptr->name, parv[2], parv[3]);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ CMD_FUNC(cmd_svsfline)
|
||||
|
||||
DCCdeny_del(deny);
|
||||
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSFLINE %s", sptr->name, parv[2]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSFLINE %s", sptr->name, parv[2]);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ CMD_FUNC(cmd_svsfline)
|
||||
|
||||
dcc_wipe_services();
|
||||
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSFLINE *", sptr->name);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSFLINE *", sptr->name);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ CMD_FUNC(cmd_svsjoin)
|
||||
if (parc == 3)
|
||||
{
|
||||
parv[2] = NULL;
|
||||
(void)do_cmd(acptr, acptr, NULL, "JOIN", 2, parv);
|
||||
(void)do_cmd(acptr, NULL, "JOIN", 2, parv);
|
||||
/* NOTE: 'acptr' may be killed if we ever implement spamfilter join channel target */
|
||||
} else {
|
||||
parv[2] = parv[3];
|
||||
parv[3] = NULL;
|
||||
(void)do_cmd(acptr, acptr, NULL, "JOIN", 3, parv);
|
||||
(void)do_cmd(acptr, NULL, "JOIN", 3, parv);
|
||||
/* NOTE: 'acptr' may be killed if we ever implement spamfilter join channel target */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ CMD_FUNC(cmd_svskill)
|
||||
|
||||
/* for new_message() we use acptr here, makes sense for the exit_client, right? */
|
||||
new_message(acptr, recv_mtags, &mtags);
|
||||
sendto_server(cptr, 0, 0, mtags, ":%s SVSKILL %s :%s", sptr->name, parv[1], comment);
|
||||
sendto_server(sptr, 0, 0, mtags, ":%s SVSKILL %s :%s", sptr->name, parv[1], comment);
|
||||
SetKilled(acptr);
|
||||
n = exit_client(cptr, acptr, sptr, mtags, comment);
|
||||
n = exit_client(sptr->direction, acptr, sptr, mtags, comment);
|
||||
free_message_tags(mtags);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ CMD_FUNC(cmd_svslusers)
|
||||
{
|
||||
if (!IsULine(sptr) || parc < 4)
|
||||
return -1;
|
||||
if (hunt_server(cptr, sptr, NULL, ":%s SVSLUSERS %s %s :%s", 1, parc, parv) == HUNTED_ISME)
|
||||
if (hunt_server(sptr, NULL, ":%s SVSLUSERS %s %s :%s", 1, parc, parv) == HUNTED_ISME)
|
||||
{
|
||||
int temp;
|
||||
temp = atoi(parv[2]);
|
||||
|
||||
+11
-11
@@ -195,7 +195,7 @@ void clear_bans(Client *sptr, Channel *chptr, char chmode)
|
||||
*
|
||||
* OLD syntax had a 'ts' parameter. No services are known to use this.
|
||||
*/
|
||||
int channel_svsmode(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
int channel_svsmode(Client *sptr, int parc, char *parv[])
|
||||
{
|
||||
Channel *chptr;
|
||||
Client *acptr;
|
||||
@@ -269,7 +269,7 @@ int channel_svsmode(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
default:
|
||||
sendto_realops("Warning! Invalid mode `%c' used with 'SVSMODE %s %s %s' (from %s %s)",
|
||||
*m, chptr->chname, parv[2], parv[3] ? parv[3] : "",
|
||||
cptr->name, sptr->name);
|
||||
sptr->direction->name, sptr->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ int channel_svsmode(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
sendto_server(NULL, 0, 0, mtags, ":%s MODE %s %s %s", sptr->name, chptr->chname, modebuf, parabuf);
|
||||
|
||||
/* Activate this hook just like cmd_mode.c */
|
||||
RunHook8(HOOKTYPE_REMOTE_CHANMODE, cptr, sptr, chptr, mtags, modebuf, parabuf, 0, 0);
|
||||
RunHook7(HOOKTYPE_REMOTE_CHANMODE, sptr, chptr, mtags, modebuf, parabuf, 0, 0);
|
||||
|
||||
free_message_tags(mtags);
|
||||
|
||||
@@ -305,7 +305,7 @@ int channel_svsmode(Client *cptr, Client *sptr, int parc, char *parv[])
|
||||
*
|
||||
* show_change can be 0 (for svsmode) or 1 (for svs2mode).
|
||||
*/
|
||||
int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], int show_change)
|
||||
int do_svsmode(Client *sptr, MessageTag *recv_mtags, int parc, char *parv[], int show_change)
|
||||
{
|
||||
int i;
|
||||
char *m;
|
||||
@@ -322,7 +322,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
|
||||
return 0;
|
||||
|
||||
if (parv[1][0] == '#')
|
||||
return channel_svsmode(cptr, sptr, parc, parv);
|
||||
return channel_svsmode(sptr, parc, parv);
|
||||
|
||||
if (!(acptr = find_person(parv[1], NULL)))
|
||||
return 0;
|
||||
@@ -497,11 +497,11 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
|
||||
} /*switch*/
|
||||
|
||||
if (parc > 3)
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s %s %s %s %s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s %s %s %s %s",
|
||||
sptr->name, show_change ? "SVS2MODE" : "SVSMODE",
|
||||
parv[1], parv[2], parv[3]);
|
||||
else
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s %s %s %s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s %s %s %s",
|
||||
sptr->name, show_change ? "SVS2MODE" : "SVSMODE",
|
||||
parv[1], parv[2]);
|
||||
|
||||
@@ -514,8 +514,8 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
|
||||
if (show_change)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
send_umode(NULL, acptr, setflags, ALL_UMODES, buf);
|
||||
if (MyUser(acptr) && buf[0] && buf[1])
|
||||
build_umode_string(acptr, setflags, ALL_UMODES, buf);
|
||||
if (MyUser(acptr) && *buf)
|
||||
sendto_one(acptr, NULL, ":%s MODE %s :%s", sptr->name, acptr->name, buf);
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
|
||||
*/
|
||||
CMD_FUNC(cmd_svsmode)
|
||||
{
|
||||
return do_svsmode(cptr, sptr, recv_mtags, parc, parv, 0);
|
||||
return do_svsmode(sptr, recv_mtags, parc, parv, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -544,7 +544,7 @@ CMD_FUNC(cmd_svsmode)
|
||||
*/
|
||||
CMD_FUNC(cmd_svs2mode)
|
||||
{
|
||||
return do_svsmode(cptr, sptr, recv_mtags, parc, parv, 1);
|
||||
return do_svsmode(sptr, recv_mtags, parc, parv, 1);
|
||||
}
|
||||
|
||||
void add_send_mode_param(Channel *chptr, Client *from, char what, char mode, char *param)
|
||||
|
||||
@@ -96,9 +96,9 @@ CMD_FUNC(cmd_svsmotd)
|
||||
return 0;
|
||||
}
|
||||
if (parv[2])
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSMOTD %s :%s", sptr->name, parv[1], parv[2]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSMOTD %s :%s", sptr->name, parv[1], parv[2]);
|
||||
else
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSMOTD %s", sptr->name, parv[1]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSMOTD %s", sptr->name, parv[1]);
|
||||
|
||||
if (conf == NULL)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ CMD_FUNC(cmd_svsnick)
|
||||
if (!IsULine(sptr) || parc < 4 || (strlen(parv[2]) > NICKLEN))
|
||||
return -1; /* This looks like an error anyway -Studded */
|
||||
|
||||
if (hunt_server(cptr, sptr, NULL, ":%s SVSNICK %s %s :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
if (hunt_server(sptr, NULL, ":%s SVSNICK %s %s :%s", 1, parc, parv) != HUNTED_ISME)
|
||||
return 0; /* Forwarded, done */
|
||||
|
||||
if (do_nick_name(parv[2]) == 0)
|
||||
|
||||
@@ -113,7 +113,7 @@ CMD_FUNC(cmd_svsnline)
|
||||
}
|
||||
|
||||
if (IsULine(sptr))
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSNLINE + %s :%s",
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSNLINE + %s :%s",
|
||||
sptr->name, parv[2], parv[3]);
|
||||
break;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ CMD_FUNC(cmd_svsnline)
|
||||
safe_free(bconf);
|
||||
|
||||
}
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSNLINE - %s", sptr->name, parv[2]);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSNLINE - %s", sptr->name, parv[2]);
|
||||
break;
|
||||
}
|
||||
case '*':
|
||||
@@ -149,7 +149,7 @@ CMD_FUNC(cmd_svsnline)
|
||||
if (!IsULine(sptr))
|
||||
return 0;
|
||||
wipe_svsnlines();
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SVSNLINE *", sptr->name);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SVSNLINE *", sptr->name);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ MOD_UNLOAD()
|
||||
return MOD_SUCCESS;
|
||||
}
|
||||
|
||||
int do_svsnolag(Client *cptr, Client *sptr, int parc, char *parv[], int show_change)
|
||||
int do_svsnolag(Client *sptr, int parc, char *parv[], int show_change)
|
||||
{
|
||||
Client *acptr;
|
||||
char *cmd = show_change ? MSG_SVS2NOLAG : MSG_SVSNOLAG;
|
||||
@@ -98,10 +98,10 @@ int do_svsnolag(Client *cptr, Client *sptr, int parc, char *parv[], int show_cha
|
||||
|
||||
CMD_FUNC(cmd_svsnolag)
|
||||
{
|
||||
return do_svsnolag(cptr, sptr, parc, parv, 0);
|
||||
return do_svsnolag(sptr, parc, parv, 0);
|
||||
}
|
||||
|
||||
CMD_FUNC(cmd_svs2nolag)
|
||||
{
|
||||
return do_svsnolag(cptr, sptr, parc, parv, 1);
|
||||
return do_svsnolag(sptr, parc, parv, 1);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ CMD_FUNC(cmd_svsnoop)
|
||||
if (!(IsULine(sptr) && parc > 2))
|
||||
return 0;
|
||||
|
||||
if (hunt_server(cptr, sptr, NULL, ":%s SVSNOOP %s :%s", 1, parc, parv) == HUNTED_ISME)
|
||||
if (hunt_server(sptr, NULL, ":%s SVSNOOP %s :%s", 1, parc, parv) == HUNTED_ISME)
|
||||
{
|
||||
if (parv[2][0] == '+')
|
||||
{
|
||||
|
||||
@@ -75,7 +75,7 @@ CMD_FUNC(cmd_svspart)
|
||||
parv[1] = parv[2];
|
||||
parv[2] = comment;
|
||||
parv[3] = NULL;
|
||||
(void)do_cmd(acptr, acptr, NULL, "PART", comment ? 3 : 2, parv);
|
||||
(void)do_cmd(acptr, NULL, "PART", comment ? 3 : 2, parv);
|
||||
/* NOTE: acptr may be killed now by spamfilter due to the part reason */
|
||||
}
|
||||
else
|
||||
|
||||
@@ -61,7 +61,7 @@ MOD_UNLOAD()
|
||||
* parv[2] - snomasks to change
|
||||
* show_change determines whether to show the change to the user
|
||||
*/
|
||||
int do_svssno(Client *cptr, Client *sptr, int parc, char *parv[], int show_change)
|
||||
int do_svssno(Client *sptr, int parc, char *parv[], int show_change)
|
||||
{
|
||||
char *p;
|
||||
Client *acptr;
|
||||
@@ -79,7 +79,7 @@ int do_svssno(Client *cptr, Client *sptr, int parc, char *parv[], int show_chan
|
||||
if (!(acptr = find_person(parv[1], NULL)))
|
||||
return 0;
|
||||
|
||||
if (hunt_server(cptr, sptr, NULL,
|
||||
if (hunt_server(sptr, NULL,
|
||||
show_change ? ":%s SVS2SNO %s %s" : ":%s SVSSNO %s %s",
|
||||
1, parc, parv) != HUNTED_ISME)
|
||||
{
|
||||
@@ -126,10 +126,10 @@ int do_svssno(Client *cptr, Client *sptr, int parc, char *parv[], int show_chan
|
||||
|
||||
CMD_FUNC(cmd_svssno)
|
||||
{
|
||||
return do_svssno(cptr, sptr, parc, parv, 0);
|
||||
return do_svssno(sptr, parc, parv, 0);
|
||||
}
|
||||
|
||||
CMD_FUNC(cmd_svs2sno)
|
||||
{
|
||||
return do_svssno(cptr, sptr, parc, parv, 1);
|
||||
return do_svssno(sptr, parc, parv, 1);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ MOD_UNLOAD()
|
||||
CMD_FUNC(cmd_svswatch)
|
||||
{
|
||||
Client *acptr;
|
||||
|
||||
if (!IsULine(sptr))
|
||||
return 0;
|
||||
|
||||
@@ -72,7 +73,7 @@ CMD_FUNC(cmd_svswatch)
|
||||
parv[0] = acptr->name;
|
||||
parv[1] = parv[2];
|
||||
parv[2] = NULL;
|
||||
(void)do_cmd(acptr, acptr, NULL, "WATCH", 2, parv);
|
||||
(void)do_cmd(acptr, NULL, "WATCH", 2, parv);
|
||||
}
|
||||
else
|
||||
sendto_one(acptr, NULL, ":%s SVSWATCH %s :%s", sptr->name, parv[1], parv[2]);
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ MOD_UNLOAD()
|
||||
*/
|
||||
CMD_FUNC(cmd_time)
|
||||
{
|
||||
if (hunt_server(cptr, sptr, recv_mtags, ":%s TIME :%s", 1, parc, parv) == HUNTED_ISME)
|
||||
if (hunt_server(sptr, recv_mtags, ":%s TIME :%s", 1, parc, parv) == HUNTED_ISME)
|
||||
sendnumeric(sptr, RPL_TIME, me.name, long_date(0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
+33
-33
@@ -47,7 +47,7 @@ CMD_FUNC(cmd_kline);
|
||||
CMD_FUNC(cmd_zline);
|
||||
CMD_FUNC(cmd_spamfilter);
|
||||
CMD_FUNC(cmd_eline);
|
||||
int cmd_tkl_line(Client *cptr, Client *sptr, int parc, char *parv[], char* type);
|
||||
int cmd_tkl_line(Client *sptr, int parc, char *parv[], char* type);
|
||||
int _tkl_hash(unsigned int c);
|
||||
char _tkl_typetochar(int type);
|
||||
int _tkl_chartotype(char c);
|
||||
@@ -873,10 +873,10 @@ CMD_FUNC(cmd_gline)
|
||||
parv[0] = NULL;
|
||||
parv[1] = "gline";
|
||||
parv[2] = NULL;
|
||||
return do_cmd(sptr, sptr, recv_mtags, "STATS", 2, parv);
|
||||
return do_cmd(sptr, recv_mtags, "STATS", 2, parv);
|
||||
}
|
||||
|
||||
return cmd_tkl_line(cptr, sptr, parc, parv, "G");
|
||||
return cmd_tkl_line(sptr, parc, parv, "G");
|
||||
}
|
||||
|
||||
/** GZLINE - Global zline.
|
||||
@@ -898,10 +898,10 @@ CMD_FUNC(cmd_gzline)
|
||||
parv[0] = NULL;
|
||||
parv[1] = "gline"; /* (there's no /STATS gzline, it's included in /STATS gline output) */
|
||||
parv[2] = NULL;
|
||||
return do_cmd(sptr, sptr, recv_mtags, "STATS", 2, parv);
|
||||
return do_cmd(sptr, recv_mtags, "STATS", 2, parv);
|
||||
}
|
||||
|
||||
return cmd_tkl_line(cptr, sptr, parc, parv, "Z");
|
||||
return cmd_tkl_line(sptr, parc, parv, "Z");
|
||||
|
||||
}
|
||||
|
||||
@@ -924,10 +924,10 @@ CMD_FUNC(cmd_shun)
|
||||
parv[0] = NULL;
|
||||
parv[1] = "shun";
|
||||
parv[2] = NULL;
|
||||
return do_cmd(sptr, sptr, recv_mtags, "STATS", 2, parv);
|
||||
return do_cmd(sptr, recv_mtags, "STATS", 2, parv);
|
||||
}
|
||||
|
||||
return cmd_tkl_line(cptr, sptr, parc, parv, "s");
|
||||
return cmd_tkl_line(sptr, parc, parv, "s");
|
||||
|
||||
}
|
||||
|
||||
@@ -1023,7 +1023,7 @@ CMD_FUNC(cmd_kline)
|
||||
parv[0] = NULL;
|
||||
parv[1] = "kline";
|
||||
parv[2] = NULL;
|
||||
return do_cmd(sptr, sptr, recv_mtags, "STATS", 2, parv);
|
||||
return do_cmd(sptr, recv_mtags, "STATS", 2, parv);
|
||||
}
|
||||
|
||||
if (!ValidatePermissionsForPath("server-ban:kline:remove",sptr,NULL,NULL,NULL) && *parv[1] == '-')
|
||||
@@ -1032,7 +1032,7 @@ CMD_FUNC(cmd_kline)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cmd_tkl_line(cptr, sptr, parc, parv, "k");
|
||||
return cmd_tkl_line(sptr, parc, parv, "k");
|
||||
}
|
||||
|
||||
/** Generate stats for '/GLINE -stats' and such */
|
||||
@@ -1091,7 +1091,7 @@ CMD_FUNC(cmd_zline)
|
||||
parv[0] = NULL;
|
||||
parv[1] = "kline"; /* (there's no /STATS zline, it's included in /STATS kline output) */
|
||||
parv[2] = NULL;
|
||||
return do_cmd(sptr, sptr, recv_mtags, "STATS", 2, parv);
|
||||
return do_cmd(sptr, recv_mtags, "STATS", 2, parv);
|
||||
}
|
||||
|
||||
if ((parc > 1) && !BadPtr(parv[1]) && !strcasecmp(parv[1], "-stats"))
|
||||
@@ -1101,7 +1101,7 @@ CMD_FUNC(cmd_zline)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cmd_tkl_line(cptr, sptr, parc, parv, "z");
|
||||
return cmd_tkl_line(sptr, parc, parv, "z");
|
||||
|
||||
}
|
||||
|
||||
@@ -1153,7 +1153,7 @@ int ban_too_broad(char *usermask, char *hostmask)
|
||||
* This allows us doing some syntax checking and other helpful
|
||||
* things that are the same for many types of *LINES.
|
||||
*/
|
||||
int cmd_tkl_line(Client *cptr, Client *sptr, int parc, char *parv[], char *type)
|
||||
int cmd_tkl_line(Client *sptr, int parc, char *parv[], char *type)
|
||||
{
|
||||
time_t secs;
|
||||
int whattodo = 0; /* 0 = add 1 = del */
|
||||
@@ -1339,12 +1339,12 @@ int cmd_tkl_line(Client *cptr, Client *sptr, int parc, char *parv[], char *type)
|
||||
}
|
||||
|
||||
/* call the tkl layer .. */
|
||||
cmd_tkl(&me, &me, NULL, 9, tkllayer);
|
||||
cmd_tkl(&me, NULL, 9, tkllayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* call the tkl layer .. */
|
||||
cmd_tkl(&me, &me, NULL, 6, tkllayer);
|
||||
cmd_tkl(&me, NULL, 6, tkllayer);
|
||||
|
||||
}
|
||||
return 0;
|
||||
@@ -1550,13 +1550,13 @@ CMD_FUNC(cmd_eline)
|
||||
tkllayer[8] = bantypes;
|
||||
tkllayer[9] = reason;
|
||||
/* call the tkl layer .. */
|
||||
cmd_tkl(&me, &me, NULL, 10, tkllayer);
|
||||
cmd_tkl(&me, NULL, 10, tkllayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove ELINE */
|
||||
/* call the tkl layer .. */
|
||||
cmd_tkl(&me, &me, NULL, 10, tkllayer);
|
||||
cmd_tkl(&me, NULL, 10, tkllayer);
|
||||
|
||||
}
|
||||
return 0;
|
||||
@@ -1574,7 +1574,7 @@ int spamfilter_usage(Client *sptr)
|
||||
}
|
||||
|
||||
/** Helper function for cmd_spamfilter, explaining usage has changed. */
|
||||
int spamfilter_new_usage(Client *cptr, Client *sptr, char *parv[])
|
||||
int spamfilter_new_usage(Client *sptr, char *parv[])
|
||||
{
|
||||
sendnotice(sptr, "Unknown match-type '%s'. Must be one of: -regex (new fast PCRE regexes), "
|
||||
"-posix (old unreal 3.2.x posix regexes) or "
|
||||
@@ -1584,7 +1584,7 @@ int spamfilter_new_usage(Client *cptr, Client *sptr, char *parv[])
|
||||
if (*parv[2] != '-')
|
||||
sendnotice(sptr, "Using the old 3.2.x /SPAMFILTER syntax? Note the new -regex/-posix/-simple field!!");
|
||||
|
||||
return spamfilter_usage(cptr);
|
||||
return spamfilter_usage(sptr);
|
||||
}
|
||||
|
||||
/** Delete a spamfilter by ID (the ID can be obtained via '/SPAMFILTER del' */
|
||||
@@ -1644,7 +1644,7 @@ int spamfilter_del_by_id(Client *sptr, char *id)
|
||||
ircsnprintf(mo2, sizeof(mo2), "%lld", (long long)TStime());
|
||||
tkllayer[7] = mo2; /* deletion time */
|
||||
|
||||
cmd_tkl(&me, &me, NULL, 12, tkllayer);
|
||||
cmd_tkl(&me, NULL, 12, tkllayer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1697,7 +1697,7 @@ CMD_FUNC(cmd_spamfilter)
|
||||
parv[0] = NULL;
|
||||
parv[1] = "spamfilter";
|
||||
parv[2] = NULL;
|
||||
return do_cmd(sptr, sptr, recv_mtags, "STATS", 2, parv);
|
||||
return do_cmd(sptr, recv_mtags, "STATS", 2, parv);
|
||||
}
|
||||
|
||||
if ((parc <= 3) && !strcmp(parv[1], "del"))
|
||||
@@ -1711,13 +1711,13 @@ CMD_FUNC(cmd_spamfilter)
|
||||
parv[2] = me.name;
|
||||
parv[3] = "del";
|
||||
parv[4] = NULL;
|
||||
return do_cmd(sptr, sptr, recv_mtags, "STATS", 4, parv);
|
||||
return do_cmd(sptr, recv_mtags, "STATS", 4, parv);
|
||||
}
|
||||
return spamfilter_del_by_id(sptr, parv[2]);
|
||||
}
|
||||
|
||||
if ((parc == 7) && (*parv[2] != '-'))
|
||||
return spamfilter_new_usage(cptr,sptr,parv);
|
||||
return spamfilter_new_usage(sptr,parv);
|
||||
|
||||
if ((parc < 8) || BadPtr(parv[7]))
|
||||
return spamfilter_usage(sptr);
|
||||
@@ -1750,7 +1750,7 @@ CMD_FUNC(cmd_spamfilter)
|
||||
match_type = unreal_match_method_strtoval(parv[2]+1);
|
||||
if (!match_type)
|
||||
{
|
||||
return spamfilter_new_usage(cptr,sptr,parv);
|
||||
return spamfilter_new_usage(sptr,parv);
|
||||
}
|
||||
|
||||
targets = spamfilter_gettargets(parv[3], sptr);
|
||||
@@ -1824,7 +1824,7 @@ CMD_FUNC(cmd_spamfilter)
|
||||
tkllayer[7] = mo2;
|
||||
}
|
||||
|
||||
cmd_tkl(&me, &me, NULL, 12, tkllayer);
|
||||
cmd_tkl(&me, NULL, 12, tkllayer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3833,14 +3833,14 @@ CMD_FUNC(cmd_tkl_add)
|
||||
safe_strdup(tkl->set_by, parv[5]);
|
||||
|
||||
if (type & TKL_GLOBAL)
|
||||
tkl_broadcast_entry(1, sptr, cptr, tkl);
|
||||
tkl_broadcast_entry(1, sptr, sptr, tkl);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Below this line we will only use 'tkl'. No parc/parv reading anymore. */
|
||||
|
||||
RunHook3(HOOKTYPE_TKL_ADD, cptr, sptr, tkl);
|
||||
RunHook2(HOOKTYPE_TKL_ADD, sptr, tkl);
|
||||
|
||||
sendnotice_tkl_add(tkl);
|
||||
|
||||
@@ -3852,7 +3852,7 @@ CMD_FUNC(cmd_tkl_add)
|
||||
loop.do_bancheck = 1;
|
||||
|
||||
if (type & TKL_GLOBAL)
|
||||
tkl_broadcast_entry(1, sptr, cptr, tkl);
|
||||
tkl_broadcast_entry(1, sptr, sptr, tkl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3967,10 +3967,10 @@ CMD_FUNC(cmd_tkl_del)
|
||||
if (type & TKL_SHUN)
|
||||
tkl_check_local_remove_shun(tkl);
|
||||
|
||||
RunHook3(HOOKTYPE_TKL_DEL, cptr, sptr, tkl);
|
||||
RunHook2(HOOKTYPE_TKL_DEL, sptr, tkl);
|
||||
|
||||
if (type & TKL_GLOBAL)
|
||||
tkl_broadcast_entry(0, sptr, cptr, tkl);
|
||||
tkl_broadcast_entry(0, sptr, sptr, tkl);
|
||||
|
||||
|
||||
if (TKLIsBanException(tkl))
|
||||
@@ -4029,9 +4029,9 @@ CMD_FUNC(_cmd_tkl)
|
||||
switch (*parv[1])
|
||||
{
|
||||
case '+':
|
||||
return cmd_tkl_add(cptr, sptr, recv_mtags, parc, parv);
|
||||
return cmd_tkl_add(sptr, recv_mtags, parc, parv);
|
||||
case '-':
|
||||
return cmd_tkl_del(cptr, sptr, recv_mtags, parc, parv);
|
||||
return cmd_tkl_del(sptr, recv_mtags, parc, parv);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -4138,7 +4138,7 @@ int _place_host_ban(Client *sptr, BanAction action, char *reason, long duration)
|
||||
tkllayer[6] = mo;
|
||||
tkllayer[7] = mo2;
|
||||
tkllayer[8] = reason;
|
||||
cmd_tkl(&me, &me, NULL, 9, tkllayer);
|
||||
cmd_tkl(&me, NULL, 9, tkllayer);
|
||||
if ((action == BAN_ACT_SHUN) || (action == BAN_ACT_SOFT_SHUN))
|
||||
{
|
||||
find_shun(sptr);
|
||||
@@ -4231,7 +4231,7 @@ int _join_viruschan(Client *sptr, TKL *tkl, int type)
|
||||
|
||||
/* RECURSIVE CAUTION in case we ever add blacklisted chans */
|
||||
spamf_ugly_vchanoverride = 1;
|
||||
ret = do_cmd(sptr, sptr, NULL, "JOIN", 2, xparv);
|
||||
ret = do_cmd(sptr, NULL, "JOIN", 2, xparv);
|
||||
spamf_ugly_vchanoverride = 0;
|
||||
|
||||
if (ret == FLUSH_BUFFER)
|
||||
|
||||
+6
-6
@@ -173,11 +173,11 @@ CMD_FUNC(cmd_topic)
|
||||
chptr->topic_time = ttime;
|
||||
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
RunHook5(HOOKTYPE_TOPIC, cptr, sptr, chptr, mtags, topic);
|
||||
sendto_server(cptr, PROTO_SID, 0, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
RunHook4(HOOKTYPE_TOPIC, sptr, chptr, mtags, topic);
|
||||
sendto_server(sptr, PROTO_SID, 0, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
ID(sptr), chptr->chname, chptr->topic_nick,
|
||||
(long long)chptr->topic_time, chptr->topic);
|
||||
sendto_server(cptr, 0, PROTO_SID, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
sendto_server(sptr, 0, PROTO_SID, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
sptr->name, chptr->chname, chptr->topic_nick,
|
||||
(long long)chptr->topic_time, chptr->topic);
|
||||
sendto_channel(chptr, sptr, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
@@ -267,14 +267,14 @@ CMD_FUNC(cmd_topic)
|
||||
safe_strldup(chptr->topic, topic, iConf.topic_length+1);
|
||||
safe_strldup(chptr->topic_nick, tnick, NICKLEN+USERLEN+HOSTLEN+5);
|
||||
|
||||
if (ttime && IsServer(cptr))
|
||||
if (ttime && !MyUser(sptr))
|
||||
chptr->topic_time = ttime;
|
||||
else
|
||||
chptr->topic_time = TStime();
|
||||
|
||||
new_message(sptr, recv_mtags, &mtags);
|
||||
RunHook5(HOOKTYPE_TOPIC, cptr, sptr, chptr, mtags, topic);
|
||||
sendto_server(cptr, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
RunHook4(HOOKTYPE_TOPIC, sptr, chptr, mtags, topic);
|
||||
sendto_server(sptr, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s",
|
||||
sptr->name, chptr->chname, chptr->topic_nick,
|
||||
(long long)chptr->topic_time, chptr->topic);
|
||||
sendto_channel(chptr, sptr, NULL, 0, 0, SEND_LOCAL, mtags,
|
||||
|
||||
+2
-2
@@ -71,7 +71,7 @@ CMD_FUNC(cmd_trace)
|
||||
// set some kind of flag? or?
|
||||
|
||||
if (parc > 2)
|
||||
if (hunt_server(cptr, sptr, NULL, ":%s TRACE %s :%s", 2, parc, parv))
|
||||
if (hunt_server(sptr, NULL, ":%s TRACE %s :%s", 2, parc, parv))
|
||||
return 0;
|
||||
|
||||
if (parc > 1)
|
||||
@@ -96,7 +96,7 @@ CMD_FUNC(cmd_trace)
|
||||
}
|
||||
}
|
||||
|
||||
switch (hunt_server(cptr, sptr, NULL, ":%s TRACE :%s", 1, parc, parv))
|
||||
switch (hunt_server(sptr, NULL, ":%s TRACE :%s", 1, parc, parv))
|
||||
{
|
||||
case HUNTED_PASS: /* note: gets here only if parv[1] exists */
|
||||
{
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ CMD_FUNC(cmd_tsctl)
|
||||
{
|
||||
sendnotice(sptr, "*** Server=%s TStime=%lld",
|
||||
me.name, (long long)TStime());
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s TSCTL alltime", sptr->name);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s TSCTL alltime", sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ MOD_UNLOAD()
|
||||
/*
|
||||
cmd_umode2 added by Stskeeps
|
||||
parv[1] - modes to change
|
||||
Small wrapper to bandwidth save
|
||||
Small wrapper to save bandwidth
|
||||
*/
|
||||
|
||||
CMD_FUNC(cmd_umode2)
|
||||
@@ -70,5 +70,5 @@ CMD_FUNC(cmd_umode2)
|
||||
|
||||
if (!parv[1])
|
||||
return 0;
|
||||
return cmd_umode(cptr, sptr, recv_mtags, (parc > 3) ? 4 : 3, xparv);
|
||||
return cmd_umode(sptr, recv_mtags, (parc > 3) ? 4 : 3, xparv);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ CMD_FUNC(cmd_unsqline)
|
||||
if (parc < 2)
|
||||
return 0;
|
||||
|
||||
cmd_tkl(&me, &me, NULL, 6, tkllayer);
|
||||
cmd_tkl(&me, NULL, 6, tkllayer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+7
-7
@@ -72,17 +72,19 @@ CMD_FUNC(cmd_user)
|
||||
char *virthost = NULL;
|
||||
char *ip = NULL;
|
||||
char *sstamp = NULL;
|
||||
Client *cptr = sptr->direction; /* Lazyness, since this function should be rewritten anyway */
|
||||
|
||||
if (IsServer(cptr) && !IsUnknown(sptr))
|
||||
// Eh, this is for old remote USER shit (which we currently still use indirectly via do_cmd).
|
||||
// TODO: cleanup. Also, hope this is right:
|
||||
if (!MyConnect(sptr) && !IsUnknown(sptr))
|
||||
return 0;
|
||||
|
||||
if (MyConnect(sptr) && (sptr->local->listener->options & LISTENER_SERVERSONLY))
|
||||
{
|
||||
return exit_client(cptr, sptr, sptr, NULL, "This port is for servers only");
|
||||
}
|
||||
return exit_client(sptr->direction, sptr, sptr, NULL, "This port is for servers only");
|
||||
|
||||
if (parc > 2 && (username = strchr(parv[1], '@')))
|
||||
*username = '\0';
|
||||
|
||||
if (parc < 5 || *parv[1] == '\0' || *parv[2] == '\0' ||
|
||||
*parv[3] == '\0' || *parv[4] == '\0')
|
||||
{
|
||||
@@ -179,9 +181,7 @@ CMD_FUNC(cmd_user)
|
||||
me.name, sptr->name);
|
||||
if (strlen(username) > USERLEN)
|
||||
username[USERLEN] = '\0'; /* cut-off */
|
||||
return(
|
||||
register_user(cptr, sptr, sptr->name, username, umodex,
|
||||
virthost,ip));
|
||||
return register_user(sptr, sptr->name, username, umodex, virthost, ip);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -62,7 +62,7 @@ CMD_FUNC(cmd_userhost)
|
||||
{
|
||||
char *p; /* scratch end pointer */
|
||||
char *cn; /* current name */
|
||||
struct Client *acptr;
|
||||
Client *acptr;
|
||||
char response[5][NICKLEN * 2 + CHANNELLEN + USERLEN + HOSTLEN + 30];
|
||||
int i; /* loop counter */
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ CMD_FUNC(cmd_userip)
|
||||
char *p; /* scratch end pointer */
|
||||
char *cn; /* current name */
|
||||
char *ip, ipbuf[HOSTLEN+1];
|
||||
struct Client *acptr;
|
||||
Client *acptr;
|
||||
char response[5][NICKLEN * 2 + CHANNELLEN + USERLEN + HOSTLEN + 30];
|
||||
int i; /* loop counter */
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ int bot_umode_change(Client *sptr, long oldmode, long newmode)
|
||||
char *parv[2];
|
||||
parv[0] = sptr->name;
|
||||
parv[1] = NULL;
|
||||
(void)do_cmd(sptr, sptr, NULL, "BOTMOTD", 1, parv);
|
||||
(void)do_cmd(sptr, NULL, "BOTMOTD", 1, parv);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
+3
-3
@@ -99,7 +99,7 @@ CMD_FUNC(cmd_vhost)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!Auth_Check(cptr, vhost->auth, password))
|
||||
if (!Auth_Check(sptr, vhost->auth, password))
|
||||
{
|
||||
sendto_snomask(SNO_VHOST,
|
||||
"[\2vhost\2] Failed login for vhost %s by %s!%s@%s - incorrect password",
|
||||
@@ -143,12 +143,12 @@ CMD_FUNC(cmd_vhost)
|
||||
{
|
||||
strcpy(olduser, sptr->user->username);
|
||||
strlcpy(sptr->user->username, vhost->virtuser, USERLEN);
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SETIDENT %s", sptr->name,
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SETIDENT %s", sptr->name,
|
||||
sptr->user->username);
|
||||
}
|
||||
sptr->umodes |= UMODE_HIDE;
|
||||
sptr->umodes |= UMODE_SETHOST;
|
||||
sendto_server(cptr, 0, 0, NULL, ":%s SETHOST %s", sptr->name, sptr->user->virthost);
|
||||
sendto_server(sptr, 0, 0, NULL, ":%s SETHOST %s", sptr->name, sptr->user->virthost);
|
||||
sendto_one(sptr, NULL, ":%s MODE %s :+tx", sptr->name, sptr->name);
|
||||
if (vhost->swhois)
|
||||
{
|
||||
|
||||
@@ -73,8 +73,8 @@ CMD_FUNC(cmd_wallops)
|
||||
return 0;
|
||||
}
|
||||
|
||||
sendto_ops_butone(IsServer(cptr) ? cptr : NULL, sptr,
|
||||
":%s WALLOPS :%s", sptr->name, message);
|
||||
// FIXME: verify: not sure about direction @ sptr, here or in send.c
|
||||
sendto_ops_butone(sptr, sptr, ":%s WALLOPS :%s", sptr->name, message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user