mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 23:47:14 +00:00
november cleanup & improvements
This commit is contained in:
parent
8229117911
commit
d3fdf50bdd
1
VERSIONS
1
VERSIONS
@ -1,5 +1,6 @@
|
|||||||
3.5(.dev) --
|
3.5(.dev) --
|
||||||
|
|
||||||
|
* Changed: Branchless more compact base64 conversion for RANDSRC in send_spy().
|
||||||
* Changed: New botnet connection announced on spy sstatus instead of spy botnet.
|
* Changed: New botnet connection announced on spy sstatus instead of spy botnet.
|
||||||
* Changed: Adjusted output of INFO command.
|
* Changed: Adjusted output of INFO command.
|
||||||
* Changed: Rewrote how SERVERGROUP works. Config files might need changes.
|
* Changed: Rewrote how SERVERGROUP works. Config files might need changes.
|
||||||
|
|||||||
12
config/fdset.c
Normal file
12
config/fdset.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv, char **envp)
|
||||||
|
{
|
||||||
|
fd_set readfds;
|
||||||
|
int sz;
|
||||||
|
|
||||||
|
sz = sizeof(readfds);
|
||||||
|
printf("%i\n",sz);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@ -1469,6 +1469,7 @@ void do_crash(COMMAND_ARGS)
|
|||||||
void debug(char *format, ...)
|
void debug(char *format, ...)
|
||||||
{
|
{
|
||||||
va_list msg;
|
va_list msg;
|
||||||
|
int sz;
|
||||||
|
|
||||||
if (!dodebug)
|
if (!dodebug)
|
||||||
return;
|
return;
|
||||||
@ -1491,10 +1492,10 @@ void debug(char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va_start(msg,format);
|
va_start(msg,format);
|
||||||
vsnprintf(debugbuf,sizeof(debugbuf),format,msg);
|
sz = vsnprintf(debugbuf,sizeof(debugbuf),format,msg);
|
||||||
va_end(msg);
|
va_end(msg);
|
||||||
|
|
||||||
if ((write(debug_fd,debugbuf,strlen(debugbuf))) < 0)
|
if ((write(debug_fd,debugbuf,sz)) < 0)
|
||||||
dodebug = FALSE;
|
dodebug = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
src/dns.c
15
src/dns.c
@ -640,17 +640,14 @@ void process_rawdns(void)
|
|||||||
char packet[512];
|
char packet[512];
|
||||||
int sz,n;
|
int sz,n;
|
||||||
|
|
||||||
if (FD_ISSET(dnssock,&read_fds))
|
sz = sizeof(sai);
|
||||||
{
|
n = recvfrom(dnssock,packet,512,0,(struct sockaddr*)&sai,&sz);
|
||||||
sz = sizeof(sai);
|
if (n < sizeof(dnsQuery))
|
||||||
n = recvfrom(dnssock,packet,512,0,(struct sockaddr*)&sai,&sz);
|
return;
|
||||||
if (n < sizeof(dnsQuery))
|
|
||||||
return;
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(process_rawdns) packet from: %s (%i bytes)\n",inet_ntoa(sai.sin_addr),n);
|
debug("(process_rawdns) packet from: %s (%i bytes)\n",inet_ntoa(sai.sin_addr),n);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
parse_query(n,(dnsQuery*)packet);
|
parse_query(n,(dnsQuery*)packet);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *poll_rawdns(char *hostname)
|
char *poll_rawdns(char *hostname)
|
||||||
|
|||||||
@ -72,6 +72,8 @@ BEG const char NULLSTR[] MDEF("<NULL>");
|
|||||||
BEG const char DEFAULTSTR[] MDEF("default");
|
BEG const char DEFAULTSTR[] MDEF("default");
|
||||||
BEG const char UNKNOWNATUNKNOWN[] MDEF("unknown@unknown");
|
BEG const char UNKNOWNATUNKNOWN[] MDEF("unknown@unknown");
|
||||||
#define UNKNOWN (&UNKNOWNATUNKNOWN[8])
|
#define UNKNOWN (&UNKNOWNATUNKNOWN[8])
|
||||||
|
BEG const char FMT_PLAIN[] MDEF("%s");
|
||||||
|
BEG const char FMT_PLAINLINE[] MDEF("%s\n");
|
||||||
|
|
||||||
BEG const char ERR_CHAN[] MDEF("I'm not on %s");
|
BEG const char ERR_CHAN[] MDEF("I'm not on %s");
|
||||||
BEG const char ERR_FILEOPEN[] MDEF("Couldn't open the file %s");
|
BEG const char ERR_FILEOPEN[] MDEF("Couldn't open the file %s");
|
||||||
@ -97,7 +99,6 @@ BEG const char STR_MECHRESET[] MDEF("MECHRESET=");
|
|||||||
BEG const char FMT_6XSTRTAB[] MDEF("%s\t%s\t%s\t%s\t%s\t%s");
|
BEG const char FMT_6XSTRTAB[] MDEF("%s\t%s\t%s\t%s\t%s\t%s");
|
||||||
#define FMT_4XSTRTAB &FMT_6XSTRTAB[6]
|
#define FMT_4XSTRTAB &FMT_6XSTRTAB[6]
|
||||||
#define FMT_3XSTRTAB &FMT_6XSTRTAB[9]
|
#define FMT_3XSTRTAB &FMT_6XSTRTAB[9]
|
||||||
#define FMT_PLAIN &FMT_6XSTRTAB[15]
|
|
||||||
|
|
||||||
BEG Mech *botlist MDEF(NULL);
|
BEG Mech *botlist MDEF(NULL);
|
||||||
|
|
||||||
|
|||||||
349
src/h.h
349
src/h.h
@ -73,14 +73,6 @@
|
|||||||
#define __att2(x,y,z) /* nothing */
|
#define __att2(x,y,z) /* nothing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* __x86_64__ automatically compiles for regparm optimization */
|
|
||||||
#if !defined(__profiling__) && defined(__i386__) && !defined(__i686__)
|
|
||||||
# define __regparm(x) regparm(x)
|
|
||||||
#else
|
|
||||||
# define __regparm(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define CORE_SEG ".text.a"
|
#define CORE_SEG ".text.a"
|
||||||
#define CFG1_SEG ".text.b"
|
#define CFG1_SEG ".text.b"
|
||||||
#define CMD1_SEG ".text.c"
|
#define CMD1_SEG ".text.c"
|
||||||
@ -151,9 +143,9 @@ void do_calc(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
/* channel.c */
|
/* channel.c */
|
||||||
|
|
||||||
void check_idlekick(void);
|
void check_idlekick(void);
|
||||||
Chan *find_channel(const char *, int) __attr(CORE_SEG, __regparm(2));
|
Chan *find_channel(const char *, int) __page(CORE_SEG);
|
||||||
Chan *find_channel_ac(const char *) __attr(CORE_SEG, __regparm(1));
|
Chan *find_channel_ac(const char *) __page(CORE_SEG);
|
||||||
Chan *find_channel_ny(const char *) __attr(CORE_SEG, __regparm(1));
|
Chan *find_channel_ny(const char *) __page(CORE_SEG);
|
||||||
void remove_chan(Chan *) __page(CMD1_SEG);
|
void remove_chan(Chan *) __page(CMD1_SEG);
|
||||||
void join_channel(char *, char *) __page(CFG1_SEG);
|
void join_channel(char *, char *) __page(CFG1_SEG);
|
||||||
void reverse_topic(Chan *, char *, char *) __page(CORE_SEG);
|
void reverse_topic(Chan *, char *, char *) __page(CORE_SEG);
|
||||||
@ -294,15 +286,15 @@ void do_dns(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
/* dynamode.c */
|
/* dynamode.c */
|
||||||
/* function.c */
|
/* function.c */
|
||||||
|
|
||||||
LS void *Calloc(int) __attr(CORE_SEG, __regparm(1));
|
LS void *Calloc(int) __page(CORE_SEG);
|
||||||
LS void Free(char **) __attr(CORE_SEG, __regparm(1));
|
LS void Free(char **) __page(CORE_SEG);
|
||||||
LS Strp *make_strp(Strp **, const char *) __attr(CORE_SEG, __regparm(2));
|
LS Strp *make_strp(Strp **, const char *) __page(CORE_SEG);
|
||||||
LS Strp *append_strp(Strp **, const char *) __attr(CORE_SEG, __regparm(2));
|
LS Strp *append_strp(Strp **, const char *) __page(CORE_SEG);
|
||||||
LS Strp *prepend_strp(Strp **, const char *) __attr(CORE_SEG, __regparm(2));
|
LS Strp *prepend_strp(Strp **, const char *) __page(CORE_SEG);
|
||||||
LS void purge_linklist(void **) __attr(CORE_SEG, __regparm(1));
|
LS void purge_linklist(void **) __page(CORE_SEG);
|
||||||
LS void dupe_strp(Strp *, Strp **) __attr(CORE_SEG, __regparm(2));
|
LS void dupe_strp(Strp *, Strp **) __page(CORE_SEG);
|
||||||
LS const int StrlenX(const char *, ...) __attr(CORE_SEG, __regparm(1));
|
LS const int StrlenX(const char *, ...) __page(CORE_SEG);
|
||||||
LS const int Strlen2(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS const int Strlen2(const char *, const char *) __page(CORE_SEG);
|
||||||
LS char *getuh(char *) __page(CORE_SEG);
|
LS char *getuh(char *) __page(CORE_SEG);
|
||||||
LS char *get_token(char **, const char *) __page(CORE_SEG);
|
LS char *get_token(char **, const char *) __page(CORE_SEG);
|
||||||
LS char *logtime(time_t) __page(CORE_SEG);
|
LS char *logtime(time_t) __page(CORE_SEG);
|
||||||
@ -320,15 +312,15 @@ LS void deop_ban(Chan *, ChanUser *, char *) __page(CORE_SEG);
|
|||||||
LS void deop_siteban(Chan *, ChanUser *) __page(CORE_SEG);
|
LS void deop_siteban(Chan *, ChanUser *) __page(CORE_SEG);
|
||||||
LS void screwban_format(char *) __page(CORE_SEG);
|
LS void screwban_format(char *) __page(CORE_SEG);
|
||||||
LS void deop_screwban(Chan *, ChanUser *) __page(CORE_SEG);
|
LS void deop_screwban(Chan *, ChanUser *) __page(CORE_SEG);
|
||||||
LS int is_nick(const char *) __attr(CORE_SEG, __regparm(1));
|
LS int is_nick(const char *) __page(CORE_SEG);
|
||||||
LS int asc2int(const char *) __attr(CORE_SEG, __regparm(1));
|
LS int asc2int(const char *) __page(CORE_SEG);
|
||||||
LS int get_number(const char *) __attr(CORE_SEG, __regparm(1));
|
LS int get_number(const char *) __page(CORE_SEG);
|
||||||
LS void fix_config_line(char *) __page(CFG1_SEG);
|
LS void fix_config_line(char *) __page(CFG1_SEG);
|
||||||
LS int matches(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS int matches(const char *, const char *) __page(CORE_SEG);
|
||||||
LS int num_matches(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS int num_matches(const char *, const char *) __page(CORE_SEG);
|
||||||
LS void table_buffer(const char *, ...) __page(CMD1_SEG);
|
LS void table_buffer(const char *, ...) __page(CMD1_SEG);
|
||||||
LS void table_send(const char *, const int) __page(CMD1_SEG);
|
LS void table_send(const char *, const int) __page(CMD1_SEG);
|
||||||
LS int is_safepath(const char *, int) __attr(CORE_SEG, __regparm(2));
|
LS int is_safepath(const char *, int) __page(CORE_SEG);
|
||||||
|
|
||||||
/* greet.c */
|
/* greet.c */
|
||||||
|
|
||||||
@ -365,7 +357,7 @@ LS int SockListener(int) __page(CORE_SEG);
|
|||||||
LS int SockConnect(char *, int, int) __page(CORE_SEG);
|
LS int SockConnect(char *, int, int) __page(CORE_SEG);
|
||||||
LS int SockAccept(int) __page(CORE_SEG);
|
LS int SockAccept(int) __page(CORE_SEG);
|
||||||
int to_file(const int sock, const char *format, ...) __page(CORE_SEG);
|
int to_file(const int sock, const char *format, ...) __page(CORE_SEG);
|
||||||
void to_server(char *format, ...) __page(CORE_SEG);
|
void to_server(const char *format, ...) __page(CORE_SEG);
|
||||||
void to_user_q(const char *, const char *, ...) __page(CMD1_SEG);
|
void to_user_q(const char *, const char *, ...) __page(CMD1_SEG);
|
||||||
void to_user(const char *, const char *, ...) __page(CORE_SEG);
|
void to_user(const char *, const char *, ...) __page(CORE_SEG);
|
||||||
char *sockread(int, char *, char *) __page(CORE_SEG);
|
char *sockread(int, char *, char *) __page(CORE_SEG);
|
||||||
@ -393,18 +385,18 @@ void do_rkicksay(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
|
|
||||||
/* lib/string.c */
|
/* lib/string.c */
|
||||||
|
|
||||||
LS char *chop(char **) __attr(CORE_SEG, __regparm(1));
|
LS char *chop(char **) __page(CORE_SEG);
|
||||||
LS void unchop(char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS void unchop(char *, const char *) __page(CORE_SEG);
|
||||||
LS int stringcasecmp(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS int stringcasecmp(const char *, const char *) __page(CORE_SEG);
|
||||||
LS int stringcmp(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS int stringcmp(const char *, const char *) __page(CORE_SEG);
|
||||||
LS int nickcmp(const char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS int nickcmp(const char *, const char *) __page(CORE_SEG);
|
||||||
LS char *nickcpy(char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS char *nickcpy(char *, const char *) __page(CORE_SEG);
|
||||||
LS void stringcpy_n(char *, const char *, int) __attr(CORE_SEG, __regparm(3));
|
LS void stringcpy_n(char *, const char *, int) __page(CORE_SEG);
|
||||||
LS char *stringcpy(char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS char *stringcpy(char *, const char *) __page(CORE_SEG);
|
||||||
LS char *stringchr(const char *, int) __attr(CORE_SEG, __regparm(2));
|
LS char *stringchr(const char *, int) __page(CORE_SEG);
|
||||||
LS char *stringdup(const char *) __attr(CORE_SEG, __regparm(1));
|
LS char *stringdup(const char *) __page(CORE_SEG);
|
||||||
LS char *stringcat(char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS char *stringcat(char *, const char *) __page(CORE_SEG);
|
||||||
LS char *tolowercat(char *, const char *) __attr(CORE_SEG, __regparm(2));
|
LS char *tolowercat(char *, const char *) __page(CORE_SEG);
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
|
|
||||||
@ -499,104 +491,105 @@ void do_notify(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
|
|
||||||
/* ons.c */
|
/* ons.c */
|
||||||
|
|
||||||
LS uint32_t makecrc(const char *) __page(CORE_SEG);
|
uint32_t makecrc(const char *) __page(CORE_SEG);
|
||||||
LS void send_suppress(const char *, const char *) __page(CORE_SEG);
|
void send_suppress(const char *, const char *) __page(CORE_SEG);
|
||||||
LS void on_kick(char *from, char *rest) __page(CORE_SEG);
|
void on_kick(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void on_join(Chan *chan, char *from) __page(CORE_SEG);
|
void on_join(Chan *chan, char *from) __page(CORE_SEG);
|
||||||
LS void on_nick(char *from, char *newnick) __page(CORE_SEG);
|
void on_nick(char *from, char *newnick) __page(CORE_SEG);
|
||||||
LS void on_msg(char *from, char *to, char *rest) __page(CORE_SEG);
|
int mkhash(const char *) __page(CORE_SEG);
|
||||||
LS void on_mode(char *from, char *channel, char *rest) __page(CORE_SEG);
|
void on_msg(char *from, char *to, char *rest) __page(CORE_SEG);
|
||||||
LS void common_public(Chan *chan, char *from, char *spyformat, char *rest) __page(CORE_SEG);
|
void on_mode(char *from, char *channel, char *rest) __page(CORE_SEG);
|
||||||
LS void on_action(char *from, char *to, char *rest) __page(CORE_SEG);
|
void common_public(Chan *chan, char *from, char *spyformat, char *rest) __page(CORE_SEG);
|
||||||
LS int access_needed(char *name) __page(CORE_SEG);
|
void on_action(char *from, char *to, char *rest) __page(CORE_SEG);
|
||||||
LS void do_chaccess(COMMAND_ARGS) __page(CMD1_SEG);
|
int access_needed(char *name) __page(CORE_SEG);
|
||||||
LS void do_last(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_chaccess(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
void do_last(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
|
|
||||||
LS void parse_error(char *from, char *rest) __page(CORE_SEG);
|
void parse_error(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_invite(char *from, char *rest) __page(CMD1_SEG);
|
void parse_invite(char *from, char *rest) __page(CMD1_SEG);
|
||||||
LS void parse_join(char *from, char *rest) __page(CORE_SEG);
|
void parse_join(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_mode(char *from, char *rest) __page(CORE_SEG);
|
void parse_mode(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_notice(char *from, char *rest) __page(CORE_SEG);
|
void parse_notice(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_part(char *from, char *rest) __page(CORE_SEG);
|
void parse_part(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_ping(char *from, char *rest) __page(CORE_SEG);
|
void parse_ping(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_pong(char *from, char *rest) __page(CORE_SEG);
|
void parse_pong(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_privmsg(char *from, char *rest) __page(CORE_SEG);
|
void parse_privmsg(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_quit(char *from, char *rest) __page(CORE_SEG);
|
void parse_quit(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_topic(char *from, char *rest) __page(CORE_SEG);
|
void parse_topic(char *from, char *rest) __page(CORE_SEG);
|
||||||
LS void parse_wallops(char *from, char *rest) __page(CORE_SEG);
|
void parse_wallops(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_213(char *from, char *rest);
|
void parse_213(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_219(char *from, char *rest);
|
void parse_219(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_251(char *from, char *rest);
|
void parse_251(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_252(char *from, char *rest);
|
void parse_252(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_253(char *from, char *rest);
|
void parse_253(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_254(char *from, char *rest);
|
void parse_254(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_255(char *from, char *rest);
|
void parse_255(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_301(char *from, char *rest);
|
void parse_301(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_303(char *from, char *rest);
|
void parse_303(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_311(char *from, char *rest);
|
void parse_311(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_312(char *from, char *rest);
|
void parse_312(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_313(char *from, char *rest);
|
void parse_313(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_315(char *from, char *rest);
|
void parse_315(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_317(char *from, char *rest);
|
void parse_317(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_318(char *from, char *rest);
|
void parse_318(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_319(char *from, char *rest);
|
void parse_319(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_324(char *from, char *rest);
|
void parse_324(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_352(char *from, char *rest);
|
void parse_352(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_367(char *from, char *rest);
|
void parse_367(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_376(char *from, char *rest);
|
void parse_376(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_401(char *from, char *rest);
|
void parse_401(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_433(char *from, char *rest);
|
void parse_433(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_451(char *from, char *rest);
|
void parse_451(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_471(char *from, char *rest);
|
void parse_471(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_473(char *from, char *rest);
|
void parse_473(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_346(char *from, char *rest);
|
void parse_346(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_348(char *from, char *rest);
|
void parse_348(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_368(char *from, char *rest);
|
void parse_368(char *from, char *rest) __page(CORE_SEG);
|
||||||
void parse_005(char *from, char *rest);
|
void parse_005(char *from, char *rest) __page(CORE_SEG);
|
||||||
static __INLINE__ uint32_t stringhash(char *) __page(CORE_SEG);
|
static __INLINE__ uint32_t stringhash(char *) __page(CORE_SEG);
|
||||||
void parse_server_input(char *) __page(CORE_SEG);
|
void parse_server_input(char *) __page(CORE_SEG);
|
||||||
|
|
||||||
/* partyline.c */
|
/* partyline.c */
|
||||||
|
|
||||||
LS int check_telnet(int, char *) __page(CMD1_SEG);
|
int check_telnet(int, char *) __page(CMD1_SEG);
|
||||||
LS void check_telnet_pass(Client *, char *) __page(CMD1_SEG);
|
void check_telnet_pass(Client *, char *) __page(CMD1_SEG);
|
||||||
LS int partyline_only_command(const char *) __page(CMD1_SEG);
|
int partyline_only_command(const char *) __page(CMD1_SEG);
|
||||||
LS void partyline_broadcast(const Client *, const char *, const char *) __page(CMD1_SEG);
|
void partyline_broadcast(const Client *, const char *, const char *) __page(CMD1_SEG);
|
||||||
LS void partyline_banner(Client *) __page(CMD1_SEG);
|
void partyline_banner(Client *) __page(CMD1_SEG);
|
||||||
LS void dcc_chat(char *) __page(CMD1_SEG);
|
void dcc_chat(char *) __page(CMD1_SEG);
|
||||||
LS void whom_printbot(char *, BotInfo *, char *) __page(CMD1_SEG);
|
void whom_printbot(char *, BotInfo *, char *) __page(CMD1_SEG);
|
||||||
LS void do_whom(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_whom(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_chat(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_chat(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_bye(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_bye(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_boot(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_boot(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* perl.c */
|
/* perl.c */
|
||||||
|
|
||||||
LS void do_perl(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_perl(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_perlscript(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_perlscript(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* prot.c */
|
/* prot.c */
|
||||||
|
|
||||||
LS void send_kick(Chan *chan, const char *nick, const char *format, ...);
|
void send_kick(Chan *chan, const char *nick, const char *format, ...);
|
||||||
LS void push_kicks(Chan *chan);
|
void push_kicks(Chan *chan);
|
||||||
LS void unmode_chanuser(Chan *chan, ChanUser *cu);
|
void unmode_chanuser(Chan *chan, ChanUser *cu);
|
||||||
LS void send_mode(Chan *chan, int pri, int type, char plusminus, char modeflag, void *data);
|
void send_mode(Chan *chan, int pri, int type, char plusminus, char modeflag, void *data);
|
||||||
LS int mode_effect(Chan *chan, qMode *mode);
|
int mode_effect(Chan *chan, qMode *mode);
|
||||||
LS void push_modes(Chan *chan, int lowpri);
|
void push_modes(Chan *chan, int lowpri);
|
||||||
LS void update_modes(Chan *chan);
|
void update_modes(Chan *chan);
|
||||||
LS int check_mass(Chan *chan, ChanUser *doer, int type);
|
int check_mass(Chan *chan, ChanUser *doer, int type);
|
||||||
LS void mass_action(Chan *chan, ChanUser *doer);
|
void mass_action(Chan *chan, ChanUser *doer);
|
||||||
LS void prot_action(Chan *chan, char *from, ChanUser *doer, char *target, ChanUser *victim);
|
void prot_action(Chan *chan, char *from, ChanUser *doer, char *target, ChanUser *victim);
|
||||||
LS void process_chanbans(void);
|
void process_chanbans(void);
|
||||||
LS void chanban_action(char *, char *, Shit *);
|
void chanban_action(char *, char *, Shit *);
|
||||||
LS void check_dynamode(Chan *) __page(CORE_SEG);
|
void check_dynamode(Chan *) __page(CORE_SEG);
|
||||||
LS void do_opdeopme(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_opdeopme(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_opvoice(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_opvoice(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_kickban(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_kickban(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_unban(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_unban(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_banlist(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_banlist(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* python.c */
|
/* python.c */
|
||||||
|
|
||||||
@ -664,7 +657,7 @@ void send_global(const char *src, const char *format, ...) __page(CORE_SEG);
|
|||||||
void spy_typecount(Mech *bot) __page(CORE_SEG);
|
void spy_typecount(Mech *bot) __page(CORE_SEG);
|
||||||
int spy_source(char *from, int *t_src, const char **src) __page(CORE_SEG);
|
int spy_source(char *from, int *t_src, const char **src) __page(CORE_SEG);
|
||||||
char *urlhost(const char *) __page(CORE_SEG);
|
char *urlhost(const char *) __page(CORE_SEG);
|
||||||
LS void urlcapture(const char *) __page(CORE_SEG);
|
void urlcapture(const char *) __page(CORE_SEG);
|
||||||
int begin_redirect(char *, char *) __page(CORE_SEG);
|
int begin_redirect(char *, char *) __page(CORE_SEG);
|
||||||
void send_redirect(char *) __page(CORE_SEG);
|
void send_redirect(char *) __page(CORE_SEG);
|
||||||
void end_redirect(void) __page(CORE_SEG);
|
void end_redirect(void) __page(CORE_SEG);
|
||||||
@ -673,7 +666,7 @@ void stats_plusminususer(Chan *chan, int plusminus) __page(CORE_SEG);
|
|||||||
void do_spy(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_spy(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_rspy(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_rspy(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_info(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_info(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_urlhist(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_urlhist(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
/* tcl.c */
|
/* tcl.c */
|
||||||
#ifdef TCL
|
#ifdef TCL
|
||||||
@ -682,11 +675,11 @@ LS void do_urlhist(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
LS char *tcl_var_read(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
LS char *tcl_var_read(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
||||||
LS char *tcl_var_write(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
LS char *tcl_var_write(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
||||||
*/
|
*/
|
||||||
LS int tcl_timer_jump(Hook *hook);
|
int tcl_timer_jump(Hook *hook);
|
||||||
LS int tcl_parse_jump(char *from, char *rest, Hook *hook);
|
int tcl_parse_jump(char *from, char *rest, Hook *hook);
|
||||||
LS void tcl_dcc_complete(Client *client, int cps);
|
void tcl_dcc_complete(Client *client, int cps);
|
||||||
#if defined(DEBUG_C) || defined(MEGA_C)
|
#if defined(DEBUG_C) || defined(MEGA_C)
|
||||||
LS int tcl_hook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
int tcl_hook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
LS int tcl_unhook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_unhook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
@ -698,36 +691,36 @@ LS int tcl_dcc_sendfile(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[
|
|||||||
LS int tcl_dns_jump(char *host, char *resolved, Hook *hook);
|
LS int tcl_dns_jump(char *host, char *resolved, Hook *hook);
|
||||||
LS int tcl_dns(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_dns(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
*/
|
*/
|
||||||
LS void init_tcl(void);
|
void init_tcl(void);
|
||||||
LS void do_tcl(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_tcl(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
#endif /* TCL */
|
#endif /* TCL */
|
||||||
|
|
||||||
/* toybox.c */
|
/* toybox.c */
|
||||||
|
|
||||||
LS int read_charset_callback(char *) __page(CMD1_SEG);
|
int read_charset_callback(char *) __page(CMD1_SEG);
|
||||||
LS int read_bigcharset(char *) __page(CMD1_SEG);
|
int read_bigcharset(char *) __page(CMD1_SEG);
|
||||||
LS int read_ascii(char *) __page(CMD1_SEG);
|
int read_ascii(char *) __page(CMD1_SEG);
|
||||||
LS void trivia_week_toppers(void) __page(CMD1_SEG);
|
void trivia_week_toppers(void) __page(CMD1_SEG);
|
||||||
LS void hint_one(void) __page(CMD1_SEG);
|
void hint_one(void) __page(CMD1_SEG);
|
||||||
LS void hint_two(void) __page(CMD1_SEG);
|
void hint_two(void) __page(CMD1_SEG);
|
||||||
LS void hint_three(void) __page(CMD1_SEG);
|
void hint_three(void) __page(CMD1_SEG);
|
||||||
LS void trivia_cleanup(void) __page(CMD1_SEG);
|
void trivia_cleanup(void) __page(CMD1_SEG);
|
||||||
LS void trivia_check(Chan *, char *) __page(CMD1_SEG);
|
void trivia_check(Chan *, char *) __page(CMD1_SEG);
|
||||||
LS void trivia_no_answer(void) __page(CMD1_SEG);
|
void trivia_no_answer(void) __page(CMD1_SEG);
|
||||||
LS char *random_question(char *) __page(CMD1_SEG);
|
char *random_question(char *) __page(CMD1_SEG);
|
||||||
LS void trivia_question(void) __page(CMD1_SEG);
|
void trivia_question(void) __page(CMD1_SEG);
|
||||||
LS void trivia_tick(void) __page(CMD1_SEG);
|
void trivia_tick(void) __page(CMD1_SEG);
|
||||||
LS void write_triviascore(void) __page(CMD1_SEG);
|
void write_triviascore(void) __page(CMD1_SEG);
|
||||||
LS int trivia_score_callback(char *) __page(CMD1_SEG);
|
int trivia_score_callback(char *) __page(CMD1_SEG);
|
||||||
LS void read_triviascore(void) __page(CMD1_SEG);
|
void read_triviascore(void) __page(CMD1_SEG);
|
||||||
LS void do_bigsay(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_bigsay(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_random_msg(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_randmsg(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_randtopic(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_randtopic(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_8ball(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_8ball(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_ascii(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_ascii(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_rand(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_rand(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
LS void do_trivia(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_trivia(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
|
|
||||||
/* uptime.c */
|
/* uptime.c */
|
||||||
@ -740,36 +733,36 @@ void do_upsend(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
|
|
||||||
/* user.c */
|
/* user.c */
|
||||||
|
|
||||||
LS void cfg_user(char *) __page(CFG1_SEG);
|
void cfg_user(char *) __page(CFG1_SEG);
|
||||||
void cfg_modcount(char *);
|
void cfg_modcount(char *) __page(CFG1_SEG);
|
||||||
LS void cfg_pass(char *) __page(CFG1_SEG);
|
void cfg_pass(char *) __page(CFG1_SEG);
|
||||||
LS void cfg_mask(char *) __page(CFG1_SEG);
|
void cfg_mask(char *) __page(CFG1_SEG);
|
||||||
LS void cfg_chan(char *) __page(CFG1_SEG);
|
void cfg_chan(char *) __page(CFG1_SEG);
|
||||||
LS void cfg_opt(char *) __page(CFG1_SEG);
|
void cfg_opt(char *) __page(CFG1_SEG);
|
||||||
LS void cfg_shit(char *) __page(CFG1_SEG);
|
void cfg_shit(char *) __page(CFG1_SEG);
|
||||||
void cfg_kicksay(char *);
|
void cfg_kicksay(char *) __page(CFG1_SEG);
|
||||||
LS void cfg_greet(char *) __page(CFG1_SEG);
|
void cfg_greet(char *) __page(CFG1_SEG);
|
||||||
LS void cfg_note(char *) __page(CFG1_SEG);
|
void cfg_note(char *) __page(CFG1_SEG);
|
||||||
void user_sync(void);
|
void user_sync(void) __page(CFG1_SEG);
|
||||||
int read_userlist_callback(char *);
|
int read_userlist_callback(char *) __page(CFG1_SEG);
|
||||||
int read_userlist(char *);
|
int read_userlist(char *) __page(CFG1_SEG);
|
||||||
int write_userlist(char *);
|
int write_userlist(char *) __page(CMD1_SEG);
|
||||||
void rehash_chanusers(void);
|
void rehash_chanusers(void) __page(CORE_SEG);
|
||||||
LS void addtouser(Strp **, const char *, int) __attr(CORE_SEG, __regparm(3));
|
void addtouser(Strp **, const char *, int) __page(CORE_SEG);
|
||||||
LS int remfromuser(Strp **, const char *) __attr(CORE_SEG, __regparm(2));
|
int remfromuser(Strp **, const char *) __page(CORE_SEG);
|
||||||
void mirror_user(User *) __page(CORE_SEG);
|
void mirror_user(User *) __page(CORE_SEG);
|
||||||
void mirror_userlist(void) __page(CORE_SEG);
|
void mirror_userlist(void) __page(CORE_SEG);
|
||||||
void reset_userlink(User *, User *);
|
void reset_userlink(User *, User *) __page(CORE_SEG);
|
||||||
void remove_user(User *);
|
void remove_user(User *) __page(CFG1_SEG);
|
||||||
User *add_user(char *, char *, int);
|
User *add_user(char *, char *, int) __page(CFG1_SEG);
|
||||||
User *find_handle(const char *);
|
User *find_handle(const char *) __page(CORE_SEG);
|
||||||
int userhaschannel(const User *, const char *);
|
int userhaschannel(const User *, const char *) __page(CORE_SEG);
|
||||||
User *get_user(const char *, const char *) __page(CORE_SEG);
|
User *get_user(const char *, const char *) __page(CORE_SEG);
|
||||||
int get_useraccess(const char *, const char *) __page(CORE_SEG);
|
int get_useraccess(const char *, const char *) __page(CORE_SEG);
|
||||||
int get_maxaccess(const char *) __page(CORE_SEG);
|
int get_maxaccess(const char *) __page(CORE_SEG);
|
||||||
int is_bot(const char *) __page(CORE_SEG);
|
int is_bot(const char *) __page(CORE_SEG);
|
||||||
int get_protaction(Chan *, char *) __page(CORE_SEG);
|
int get_protaction(Chan *, char *) __page(CORE_SEG);
|
||||||
int usercanmodify(const char *, const User *);
|
int usercanmodify(const char *, const User *) __page(CMD1_SEG);
|
||||||
void change_pass(User *, char *) __page(CMD1_SEG);
|
void change_pass(User *, char *) __page(CMD1_SEG);
|
||||||
void do_access(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_access(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
void do_userlist(COMMAND_ARGS) __page(CMD1_SEG);
|
void do_userlist(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
@ -787,7 +780,7 @@ int find_setting(const char *) __page(CORE_SEG);
|
|||||||
void copy_vars(UniVar *, UniVar *) __page(CFG1_SEG);
|
void copy_vars(UniVar *, UniVar *) __page(CFG1_SEG);
|
||||||
void set_binarydefault(UniVar *) __page(CFG1_SEG);
|
void set_binarydefault(UniVar *) __page(CFG1_SEG);
|
||||||
void delete_vars(UniVar *, int) __page(CMD1_SEG);
|
void delete_vars(UniVar *, int) __page(CMD1_SEG);
|
||||||
void var_resolve_host(const struct Setting *);
|
void var_resolve_host(const struct Setting *) __page(CMD1_SEG);
|
||||||
void nobo_strcpy(const char *) __page(CMD1_SEG);
|
void nobo_strcpy(const char *) __page(CMD1_SEG);
|
||||||
void ec_access(char *, const char *) __page(CMD1_SEG);
|
void ec_access(char *, const char *) __page(CMD1_SEG);
|
||||||
void ec_capabilities(char *, const char *) __page(CMD1_SEG);
|
void ec_capabilities(char *, const char *) __page(CMD1_SEG);
|
||||||
|
|||||||
@ -229,6 +229,8 @@ void usage_command(char *to, const char *arg)
|
|||||||
char *pt;
|
char *pt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (to == CoreUser.name) /* dont send usage notices to config file */
|
||||||
|
return;
|
||||||
for(i=0;ulist[i].command;i++)
|
for(i=0;ulist[i].command;i++)
|
||||||
{
|
{
|
||||||
if (!stringcasecmp(arg,ulist[i].command))
|
if (!stringcasecmp(arg,ulist[i].command))
|
||||||
|
|||||||
7
src/io.c
7
src/io.c
@ -254,18 +254,19 @@ int to_file(const int sock, const char *format, ...)
|
|||||||
* Format a message and send it to the current bots server
|
* Format a message and send it to the current bots server
|
||||||
* to_server needs a newline (\n) it wont manufacture it itself.
|
* to_server needs a newline (\n) it wont manufacture it itself.
|
||||||
*/
|
*/
|
||||||
void to_server(char *format, ...)
|
void to_server(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list msg;
|
va_list msg;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
char *line,*rest;
|
char *line,*rest;
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
int sz;
|
||||||
|
|
||||||
if (current->sock == -1)
|
if (current->sock == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
va_start(msg,format);
|
va_start(msg,format);
|
||||||
vsprintf(globaldata,format,msg);
|
sz = vsprintf(globaldata,format,msg);
|
||||||
va_end(msg);
|
va_end(msg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -274,7 +275,7 @@ void to_server(char *format, ...)
|
|||||||
*/
|
*/
|
||||||
current->sendq_time += 2;
|
current->sendq_time += 2;
|
||||||
|
|
||||||
if (write(current->sock,globaldata,strlen(globaldata)) < 0)
|
if (write(current->sock,globaldata,sz) < 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("[StS] {%i} errno = %i\n",current->sock,errno);
|
debug("[StS] {%i} errno = %i\n",current->sock,errno);
|
||||||
|
|||||||
@ -858,7 +858,10 @@ restart_die:
|
|||||||
#endif /* CHANBAN */
|
#endif /* CHANBAN */
|
||||||
|
|
||||||
#ifdef RAWDNS
|
#ifdef RAWDNS
|
||||||
if (dnssock != -1)
|
/*
|
||||||
|
* Only a single socket to check.
|
||||||
|
*/
|
||||||
|
if (dnssock != -1 && FD_ISSET(dnssock,&read_fds))
|
||||||
process_rawdns();
|
process_rawdns();
|
||||||
#endif /* RAWDNS */
|
#endif /* RAWDNS */
|
||||||
|
|
||||||
|
|||||||
88
src/net.c
88
src/net.c
@ -159,21 +159,30 @@ NetCfg *find_netcfg(int guid)
|
|||||||
|
|
||||||
BotInfo *make_botinfo(int guid, int hops, char *nuh, char *server, char *version)
|
BotInfo *make_botinfo(int guid, int hops, char *nuh, char *server, char *version)
|
||||||
{
|
{
|
||||||
BotInfo *new;
|
BotInfo *newbinfo;
|
||||||
|
int sn,vn;
|
||||||
|
|
||||||
set_mallocdoer(make_botinfo);
|
set_mallocdoer(make_botinfo);
|
||||||
new = (BotInfo*)Calloc(sizeof(BotInfo) + StrlenX(nuh,server,version,NULL));
|
newbinfo = (BotInfo*)Calloc(sizeof(BotInfo) + StrlenX(nuh,server,version,NULL));
|
||||||
|
|
||||||
new->guid = guid;
|
newbinfo->guid = guid;
|
||||||
new->hops = hops;
|
newbinfo->hops = hops;
|
||||||
|
|
||||||
new->server = stringcat(new->nuh,nuh) + 1;
|
/*
|
||||||
new->version = stringcat(new->server,server) + 1;
|
sprintf(newbinfo->nuh,"%s%c%n%s%c%n%s",nuh,0,&sn,server,0,&vn,version);
|
||||||
stringcpy(new->version,version);
|
newbinfo->server = newbinfo->nuh + sn;
|
||||||
|
newbinfo->version = newbinfo->nuh + vn;
|
||||||
|
*/
|
||||||
|
newbinfo->server = stringcat(newbinfo->nuh,nuh) + 1;
|
||||||
|
newbinfo->version = stringcat(newbinfo->server,server) + 1;
|
||||||
|
stringcpy(newbinfo->version,version);
|
||||||
|
|
||||||
return(new);
|
return(newbinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* broadcast data to all except the source
|
||||||
|
*/
|
||||||
void botnet_relay(BotNet *source, char *format, ...)
|
void botnet_relay(BotNet *source, char *format, ...)
|
||||||
{
|
{
|
||||||
BotNet *bn;
|
BotNet *bn;
|
||||||
@ -188,9 +197,8 @@ void botnet_relay(BotNet *source, char *format, ...)
|
|||||||
if (!sz)
|
if (!sz)
|
||||||
{
|
{
|
||||||
va_start(msg,format);
|
va_start(msg,format);
|
||||||
vsprintf(globaldata,format,msg);
|
sz = vsprintf(globaldata,format,msg);
|
||||||
va_end(msg);
|
va_end(msg);
|
||||||
sz = strlen(globaldata);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write(bn->sock,globaldata,sz) < 0)
|
if (write(bn->sock,globaldata,sz) < 0)
|
||||||
@ -201,6 +209,24 @@ void botnet_relay(BotNet *source, char *format, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void botnet_binfo_relay(BotNet *source, BotInfo *binfo)
|
||||||
|
{
|
||||||
|
botnet_relay(source,
|
||||||
|
"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
||||||
|
(binfo->nuh) ? binfo->nuh : UNKNOWNATUNKNOWN,
|
||||||
|
(binfo->server) ? binfo->server : UNKNOWN,
|
||||||
|
(binfo->version) ? binfo->version : "-");
|
||||||
|
}
|
||||||
|
|
||||||
|
void botnet_binfo_tofile(int sock, BotInfo *binfo)
|
||||||
|
{
|
||||||
|
to_file(sock,
|
||||||
|
"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
||||||
|
(binfo->nuh) ? binfo->nuh : UNKNOWNATUNKNOWN,
|
||||||
|
(binfo->server) ? binfo->server : UNKNOWN,
|
||||||
|
(binfo->version) ? binfo->version : "-");
|
||||||
|
}
|
||||||
|
|
||||||
void botnet_refreshbotinfo(void)
|
void botnet_refreshbotinfo(void)
|
||||||
{
|
{
|
||||||
Server *sv;
|
Server *sv;
|
||||||
@ -215,22 +241,6 @@ void botnet_refreshbotinfo(void)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void botnet_binfo_relay(BotNet *source, BotInfo *binfo)
|
|
||||||
{
|
|
||||||
botnet_relay(source,"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
|
||||||
(binfo->nuh) ? binfo->nuh : UNKNOWNATUNKNOWN,
|
|
||||||
(binfo->server) ? binfo->server : UNKNOWN,
|
|
||||||
(binfo->version) ? binfo->version : "-");
|
|
||||||
}
|
|
||||||
|
|
||||||
void botnet_binfo_tofile(int sock, BotInfo *binfo)
|
|
||||||
{
|
|
||||||
to_file(sock,"BL%i %i %s %s %s\n",binfo->guid,(binfo->hops + 1),
|
|
||||||
(binfo->nuh) ? binfo->nuh : UNKNOWNATUNKNOWN,
|
|
||||||
(binfo->server) ? binfo->server : UNKNOWN,
|
|
||||||
(binfo->version) ? binfo->version : "-");
|
|
||||||
}
|
|
||||||
|
|
||||||
void botnet_dumplinklist(BotNet *bn)
|
void botnet_dumplinklist(BotNet *bn)
|
||||||
{
|
{
|
||||||
BotInfo *binfo;
|
BotInfo *binfo;
|
||||||
@ -255,7 +265,7 @@ void botnet_dumplinklist(BotNet *bn)
|
|||||||
}
|
}
|
||||||
for(bn2=botnetlist;bn2;bn2=bn2->next)
|
for(bn2=botnetlist;bn2;bn2=bn2->next)
|
||||||
{
|
{
|
||||||
if ((bn2 == bn) || (bn2->status != BN_LINKED) || !(bn2->list_complete))
|
if ((bn2 == bn) || (bn2->status != BN_LINKED) || (bn2->opt.links_complete == 0))
|
||||||
continue;
|
continue;
|
||||||
for(binfo=bn2->botinfo;binfo;binfo=binfo->next)
|
for(binfo=bn2->botinfo;binfo;binfo=binfo->next)
|
||||||
botnet_binfo_tofile(bn->sock,binfo);
|
botnet_binfo_tofile(bn->sock,binfo);
|
||||||
@ -707,7 +717,7 @@ void basicBanner(BotNet *bn, char *rest)
|
|||||||
|
|
||||||
void basicLink(BotNet *bn, char *version)
|
void basicLink(BotNet *bn, char *version)
|
||||||
{
|
{
|
||||||
BotInfo *binfo,*delete,**pp;
|
BotInfo *binfo,**pp;
|
||||||
NetCfg *cfg;
|
NetCfg *cfg;
|
||||||
char *nuh,*server;
|
char *nuh,*server;
|
||||||
int guid,hops;
|
int guid,hops;
|
||||||
@ -754,7 +764,7 @@ void basicLink(BotNet *bn, char *version)
|
|||||||
continue;
|
continue;
|
||||||
cfg->linked = TRUE;
|
cfg->linked = TRUE;
|
||||||
}
|
}
|
||||||
bn->list_complete = TRUE;
|
bn->opt.links_complete = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,23 +790,25 @@ void basicLink(BotNet *bn, char *version)
|
|||||||
binfo = make_botinfo(guid,hops,nuh,server,version);
|
binfo = make_botinfo(guid,hops,nuh,server,version);
|
||||||
|
|
||||||
if (bn->botinfo == NULL)
|
if (bn->botinfo == NULL)
|
||||||
send_global(SPYSTR_STATUS,"connecting to %s [guid %i]",nickcpy(NULL,nuh),bn->guid);
|
send_global(SPYSTR_STATUS,"Connected to %s [guid %i]",nickcpy(NULL,nuh),bn->guid);
|
||||||
|
|
||||||
pp = &bn->botinfo;
|
pp = &bn->botinfo;
|
||||||
while(*pp)
|
while(*pp)
|
||||||
{
|
{
|
||||||
delete = *pp;
|
BotInfo *trash;
|
||||||
if (guid == delete->guid)
|
if (guid == (*pp)->guid)
|
||||||
{
|
{
|
||||||
*pp = delete->next;
|
trash = *pp;
|
||||||
Free((char**)&delete);
|
*pp = trash->next;
|
||||||
|
Free((char**)&trash);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pp = &delete->next;
|
pp = &(*pp)->next;
|
||||||
}
|
}
|
||||||
binfo->next = *pp;
|
binfo->next = *pp;
|
||||||
*pp = binfo;
|
*pp = binfo;
|
||||||
|
|
||||||
if (bn->list_complete)
|
if (bn->opt.links_complete)
|
||||||
{
|
{
|
||||||
if ((cfg = find_netcfg(guid)))
|
if ((cfg = find_netcfg(guid)))
|
||||||
cfg->linked = TRUE;
|
cfg->linked = TRUE;
|
||||||
@ -1617,7 +1629,7 @@ clean:
|
|||||||
debug("(process_botnet) botnet quit: guid %i child of %i on socket %i\n",
|
debug("(process_botnet) botnet quit: guid %i child of %i on socket %i\n",
|
||||||
binfo->guid,bn->guid,bn->sock);
|
binfo->guid,bn->guid,bn->sock);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (bn->list_complete)
|
if (bn->opt.links_complete)
|
||||||
{
|
{
|
||||||
send_global(SPYSTR_BOTNET,"quit: guid %i (child of %i)",
|
send_global(SPYSTR_BOTNET,"quit: guid %i (child of %i)",
|
||||||
binfo->guid,bn->guid);
|
binfo->guid,bn->guid);
|
||||||
@ -1626,7 +1638,7 @@ clean:
|
|||||||
}
|
}
|
||||||
Free((char**)&binfo);
|
Free((char**)&binfo);
|
||||||
}
|
}
|
||||||
if (bn->list_complete)
|
if (bn->opt.links_complete)
|
||||||
{
|
{
|
||||||
botnet_relay(bn,"BQ%i\n",bn->guid);
|
botnet_relay(bn,"BQ%i\n",bn->guid);
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/onhash.h
12
src/onhash.h
@ -1,3 +1,13 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* This file is included in ons.c right before on_msg
|
||||||
|
* It is also used in gencmd.c where its used with different
|
||||||
|
* random hashdata in order to find a hashmap with no
|
||||||
|
* collisions. Unfortunatly there is no way of handling
|
||||||
|
* hasmaps with collisions currently so if it gets stuck
|
||||||
|
* trying hashdata forever you are out of luck.
|
||||||
|
*
|
||||||
|
*/
|
||||||
int mkhash(const char *cmd)
|
int mkhash(const char *cmd)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
@ -14,8 +24,8 @@ int mkhash(const char *cmd)
|
|||||||
h = (a - b) & HASHDATAMASK;
|
h = (a - b) & HASHDATAMASK;
|
||||||
ki += a + hashdata[h];
|
ki += a + hashdata[h];
|
||||||
#ifdef HEATMAP
|
#ifdef HEATMAP
|
||||||
|
/* used when refining the algorithm */
|
||||||
heatmap[ki & HASHDATAMASK] += 1;
|
heatmap[ki & HASHDATAMASK] += 1;
|
||||||
//heatmap[(ki + h) & HASHDATAMASK] += 1;
|
|
||||||
#endif
|
#endif
|
||||||
kk ^= hashdata[ki & HASHDATAMASK] ^ (hashdata[(h + ki) & HASHDATAMASK] << 8);
|
kk ^= hashdata[ki & HASHDATAMASK] ^ (hashdata[(h + ki) & HASHDATAMASK] << 8);
|
||||||
s++;
|
s++;
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#define INTPROC(x) .v.numptr=&x
|
#define INTPROC(x) .v.numptr=&x
|
||||||
#define STRPROC(x) .v.strptr=&x
|
#define STRPROC(x) .v.strptr=&x
|
||||||
|
|
||||||
LS const Setting VarName[SIZE_VARS] =
|
const Setting VarName[SIZE_VARS] =
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* all channel settings in the beginning
|
* all channel settings in the beginning
|
||||||
|
|||||||
@ -147,6 +147,7 @@ typedef struct Alias
|
|||||||
{
|
{
|
||||||
struct Alias *next;
|
struct Alias *next;
|
||||||
|
|
||||||
|
int hash;
|
||||||
char *format;
|
char *format;
|
||||||
char alias[1];
|
char alias[1];
|
||||||
|
|
||||||
@ -233,7 +234,7 @@ typedef struct Setting
|
|||||||
char **strptr;
|
char **strptr;
|
||||||
|
|
||||||
} v;
|
} v;
|
||||||
char *name;
|
char name[16];
|
||||||
int max;
|
int max;
|
||||||
void (*onchangefunc)(const struct Setting *);
|
void (*onchangefunc)(const struct Setting *);
|
||||||
|
|
||||||
@ -706,8 +707,8 @@ typedef struct BotNet
|
|||||||
{
|
{
|
||||||
uint32_t pta:1, /* plain text auth */
|
uint32_t pta:1, /* plain text auth */
|
||||||
sha:1, /* SHA */
|
sha:1, /* SHA */
|
||||||
md5:1; /* MD5 */
|
md5:1, /* MD5 */
|
||||||
|
links_complete; /* All links shared to this bot */
|
||||||
} opt;
|
} opt;
|
||||||
|
|
||||||
Mech *controller;
|
Mech *controller;
|
||||||
@ -719,7 +720,6 @@ typedef struct BotNet
|
|||||||
time_t when;
|
time_t when;
|
||||||
|
|
||||||
struct BotInfo *botinfo;
|
struct BotInfo *botinfo;
|
||||||
int list_complete;
|
|
||||||
|
|
||||||
char sockdata[MSGLEN];
|
char sockdata[MSGLEN];
|
||||||
|
|
||||||
|
|||||||
@ -25,14 +25,6 @@
|
|||||||
* These are more or less globally used..
|
* These are more or less globally used..
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
#define FMT_PLAIN "%s"
|
|
||||||
#define FMT_6XSTRTAB "%s\t%s\t%s\t%s\t%s\t%s"
|
|
||||||
#define FMT_4XSTRTAB "%s\t%s\t%s\t%s"
|
|
||||||
#define FMT_3XSTRTAB "%s\t%s\t%s"
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define FMT_PLAINLINE "%s\n"
|
|
||||||
#define MATCH_ALL "*"
|
#define MATCH_ALL "*"
|
||||||
|
|
||||||
#define TEXT_NOTINSERVLIST "(not in serverlist)"
|
#define TEXT_NOTINSERVLIST "(not in serverlist)"
|
||||||
|
|||||||
@ -812,7 +812,7 @@ reuse_font:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_random_msg(COMMAND_ARGS)
|
void do_randmsg(COMMAND_ARGS)
|
||||||
{
|
{
|
||||||
const char *filename;
|
const char *filename;
|
||||||
const char *message;
|
const char *message;
|
||||||
|
|||||||
17
src/vars.c
17
src/vars.c
@ -53,10 +53,12 @@ int find_setting(const char *name)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;VarName[i].name;i++)
|
for(i=0;i<SIZE_VARS;i++)
|
||||||
{
|
{
|
||||||
if (!stringcasecmp(name,VarName[i].name))
|
/* 223 = binary 11011111 -> convert lower case to upper */
|
||||||
return(i);
|
if ((*name & 223) == *VarName[i].name)
|
||||||
|
if (stringcasecmp(name,VarName[i].name) == 0)
|
||||||
|
return(i);
|
||||||
}
|
}
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@ -86,8 +88,10 @@ void set_binarydefault(UniVar *dst)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;VarName[i].name;i++)
|
for(i=0;i<SIZE_VARS;i++)
|
||||||
|
{
|
||||||
dst[i].str_var = VarName[i].v.str;
|
dst[i].str_var = VarName[i].v.str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_vars(UniVar *vars, int which)
|
void delete_vars(UniVar *vars, int which)
|
||||||
@ -403,6 +407,7 @@ void do_set(COMMAND_ARGS)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* empty args, its "set" or "set #channel"
|
* empty args, its "set" or "set #channel"
|
||||||
|
* list setting and values
|
||||||
*/
|
*/
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
@ -484,6 +489,10 @@ second_pass:
|
|||||||
if ((which = find_setting(name)) == -1)
|
if ((which = find_setting(name)) == -1)
|
||||||
{
|
{
|
||||||
set_usage:
|
set_usage:
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (from == CoreUser.name)
|
||||||
|
debug("init: set error: %s\n",nullstr(name));
|
||||||
|
#endif
|
||||||
usage(from); /* usage for CurrentCmd->name */
|
usage(from); /* usage for CurrentCmd->name */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user