Compare commits
72 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b5be25bfe3 | ||
![]() |
3506ff6ab2 | ||
![]() |
bb8fe65617 | ||
![]() |
1b453e0b43 | ||
![]() |
e4f2d0290b | ||
![]() |
86a5f1cf87 | ||
![]() |
faabd770dc | ||
![]() |
03e23618dd | ||
![]() |
cf6ca565d5 | ||
![]() |
0964664b40 | ||
![]() |
1c57f1dc4c | ||
![]() |
10d43de4fe | ||
![]() |
28c05587e8 | ||
![]() |
81e7b4e89a | ||
![]() |
a92a2c8899 | ||
![]() |
f3c48e57a4 | ||
![]() |
1f27e85ff7 | ||
![]() |
eca1082055 | ||
![]() |
3dad21da64 | ||
![]() |
aee8367458 | ||
![]() |
caadfa687b | ||
![]() |
da947b07bb | ||
![]() |
59519174e4 | ||
![]() |
89ee13b176 | ||
![]() |
f766077f75 | ||
![]() |
5d00a68329 | ||
![]() |
6c1352dd13 | ||
![]() |
c3013b8f6f | ||
![]() |
23480ab942 | ||
![]() |
5bc7a36428 | ||
![]() |
b004bc6bc1 | ||
![]() |
1b9505e4bc | ||
![]() |
b2bb9964e8 | ||
![]() |
4ead736fe4 | ||
![]() |
db0e8ef1d0 | ||
![]() |
ed620abd85 | ||
![]() |
f455d9c630 | ||
![]() |
f1a9c9d272 | ||
![]() |
1f03282ca5 | ||
![]() |
31c7a36719 | ||
![]() |
369eb7a670 | ||
![]() |
f6f200f04b | ||
![]() |
e6c401d2a4 | ||
![]() |
2f9b412f0c | ||
![]() |
7046116a0a | ||
![]() |
4027f672b4 | ||
![]() |
3a37cd5937 | ||
![]() |
90c92d0aaa | ||
![]() |
4a5443ab65 | ||
![]() |
0a07e573a5 | ||
![]() |
c200db520d | ||
![]() |
565cd912c5 | ||
![]() |
ae6a9fd397 | ||
![]() |
02b506c2c6 | ||
![]() |
1ddbde7650 | ||
![]() |
5d25106d71 | ||
![]() |
c9987e204f | ||
![]() |
ca4d2f25e1 | ||
![]() |
68189e47c5 | ||
![]() |
67f0701d4a | ||
![]() |
223fb9bba1 | ||
![]() |
1613c0689f | ||
![]() |
14a432d0db | ||
![]() |
4193dd659d | ||
![]() |
f5184a4a97 | ||
![]() |
ee39eae599 | ||
![]() |
fbe758b1cd | ||
![]() |
c24f05083a | ||
![]() |
f17c8571ce | ||
![]() |
7035df98a9 | ||
![]() |
8203d88c2e | ||
![]() |
095371bd16 |
52 changed files with 2656 additions and 1306 deletions
|
@ -172,9 +172,9 @@ send_part (const char *who, const char *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
send_cmd (":%s %s %lu %s + :%c%s", sender, MSG_SJOIN, ts, chan, flag, who);
|
send_cmd (":%s %s %lu %s + :%s", sender, MSG_SJOIN, ts, chan, who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -173,7 +173,7 @@
|
||||||
/* Umode chars */
|
/* Umode chars */
|
||||||
#define UMODE_CH_LOCOP 'O'
|
#define UMODE_CH_LOCOP 'O'
|
||||||
#define UMODE_CH_OPER 'o'
|
#define UMODE_CH_OPER 'o'
|
||||||
#define UMODE_CH_ADMIN 'a'
|
#define UMODE_CH_ADMIN 'A'
|
||||||
|
|
||||||
/* Umodes */
|
/* Umodes */
|
||||||
#define UMODE_OPER 0x00001 /* umode +o - Oper */
|
#define UMODE_OPER 0x00001 /* umode +o - Oper */
|
||||||
|
|
52
ChangeLog
52
ChangeLog
|
@ -1,5 +1,57 @@
|
||||||
NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rants)
|
NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rants)
|
||||||
=====================================================================================
|
=====================================================================================
|
||||||
|
* NeoStats * Mark (M) * Version 2.5.21
|
||||||
|
- va_copy handling courtesy of Reed. (M)
|
||||||
|
- Fix client top 10 counts. (M)
|
||||||
|
|
||||||
|
* NeoStats * Mark (M) * Version 2.5.20
|
||||||
|
- Fix memory leak in exclude load (M)
|
||||||
|
- Fix memory leak in statserv (M)
|
||||||
|
- Fix crash on IRCu in do_server (M)
|
||||||
|
- Fix bug with Unreal IP addresses - bug 188 (M)
|
||||||
|
|
||||||
|
* NeoStats * Fish (F) * Version 2.5.19
|
||||||
|
- Fix up a problem with exclude lists (F)
|
||||||
|
- Fix up a problem with NICKIP issues on Unreal 3.2.0 (BugID 180) (F)
|
||||||
|
- Fix up server admin flag for Bahamut reported by Ashen (F)
|
||||||
|
- Display full path to config file when a error occurs (F)
|
||||||
|
|
||||||
|
* NeoStats * Fish (F) * Version 2.5.18
|
||||||
|
- Fix a crash in message parsing functions (F)
|
||||||
|
|
||||||
|
* NeoStats * Mark (M) * Version 2.5.17
|
||||||
|
- Fix Unreal smodes (M)
|
||||||
|
- Fix Unreal ban type field in sqlserv (M)
|
||||||
|
- Fix some warnings in ircd.c (M)
|
||||||
|
- HostServ: validate vhosts when adding - bug 151 (M)
|
||||||
|
- ConnectServ: fix colour message case - bug 150 (M)
|
||||||
|
- StatServ: fix NULL client versions load/save (M)
|
||||||
|
- Fix ConnectServ ServWatch problem (F)
|
||||||
|
- Add recursion to squit to automatically remove leaves (M)
|
||||||
|
- Add NOQUIT protocol support to core (M)
|
||||||
|
- StatServ: fix alerts not disabled - bug 157 (M)
|
||||||
|
- Add BanDump command to NeoStats bot to help debug Bans (F)
|
||||||
|
- Fix a obscure bug with recv.log that IRCu triggered with Bans (partly with BUGID 160) (F)
|
||||||
|
- Fix a bug with SecureServ not seeing Channel Messages - bug 164 (F)
|
||||||
|
- IRCu: Fix for numeric collisions - Bug 159 (M)
|
||||||
|
- Option to Disable Channel Statistics in Statserv due to Performance problems. Read statserv.h for more Info - Bug 162 (F)
|
||||||
|
- Backport 3.0 fix for broken pipe loop (M)
|
||||||
|
- Fix Unreal 3.2.1 md5 cloak keys (F)
|
||||||
|
- Unreal 3.2.1 NICKIP support. This should have significant speedups for some modules on newer versions of Unreal (F)
|
||||||
|
|
||||||
|
* NeoStats * Mark (M) * Version 2.5.16
|
||||||
|
- Fix problem with Unreal SVSMODE services TS processing (M)
|
||||||
|
- IRCu: enable sethost for ASUKA (M)
|
||||||
|
- Add extra checks to ircstr[n]case routines for stability when passed NULL (M)
|
||||||
|
- Unreal: fix sjoin bug (M)
|
||||||
|
- Fix NULL pointer in dns_lookup (M)
|
||||||
|
- IRCu: Fix +D problem reported on ASUKA bug 138 (M)
|
||||||
|
- send_sjoin bug fix where user has no modes (M)
|
||||||
|
- IRCu: Fix statserv map (M)
|
||||||
|
- IRCu: Umode +g no longer sets auth level (M)
|
||||||
|
- Fix mem leak in NICKIP code (M)
|
||||||
|
- DNS lookup's will now queue up when active list is full, and automatically dequeue (F)
|
||||||
|
|
||||||
* NeoStats * Fish (F) & Mark (M) * Version 2.5.15
|
* NeoStats * Fish (F) & Mark (M) * Version 2.5.15
|
||||||
- Remove sprotocol_cmd since it is very ircd specfic (M)
|
- Remove sprotocol_cmd since it is very ircd specfic (M)
|
||||||
- Initialize me.now at bootup so we do not get random timestamps (M)
|
- Initialize me.now at bootup so we do not get random timestamps (M)
|
||||||
|
|
42
Ircu.c
42
Ircu.c
|
@ -114,7 +114,7 @@ ChanModes chan_modes[] = {
|
||||||
{CMODE_NONOTICE, 'N', 0, 0, 0},
|
{CMODE_NONOTICE, 'N', 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ASUKA
|
#ifdef ASUKA
|
||||||
{CMODE_DELJOINS, 'D', 0, 1, 0},
|
{CMODE_DELJOINS, 'D', 0, 0, 0},
|
||||||
{CMODE_NOQUITPARTS, 'u', 0, 0, 0},
|
{CMODE_NOQUITPARTS, 'u', 0, 0, 0},
|
||||||
{CMODE_WASDELJOIN, 'd', 0, 0, 0},
|
{CMODE_WASDELJOIN, 'd', 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
|
@ -127,13 +127,13 @@ ChanModes chan_modes[] = {
|
||||||
{CMODE_NOAMSG, 'T', 0, 0, 0},
|
{CMODE_NOAMSG, 'T', 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
/*{CMODE_LISTED, 'b', 0, 1, 0},*/
|
/*{CMODE_LISTED, 'b', 0, 1, 0},*/
|
||||||
{CMODE_REGONLY, 'r', 0, 0, 0},
|
{CMODE_RGSTRONLY, 'r', 0, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
UserModes user_umodes[] = {
|
UserModes user_umodes[] = {
|
||||||
{UMODE_DEBUG, 'g', NS_ULEVEL_ROOT},
|
|
||||||
{UMODE_OPER, 'o', NS_ULEVEL_ADMIN},
|
{UMODE_OPER, 'o', NS_ULEVEL_ADMIN},
|
||||||
{UMODE_LOCOP, 'O', NS_ULEVEL_OPER},
|
{UMODE_LOCOP, 'O', NS_ULEVEL_OPER},
|
||||||
|
{UMODE_DEBUG, 'g', 0},
|
||||||
{UMODE_INVISIBLE, 'i', 0},
|
{UMODE_INVISIBLE, 'i', 0},
|
||||||
{UMODE_WALLOP, 'w', 0},
|
{UMODE_WALLOP, 'w', 0},
|
||||||
{UMODE_SERVNOTICE, 's', 0},
|
{UMODE_SERVNOTICE, 's', 0},
|
||||||
|
@ -142,10 +142,10 @@ UserModes user_umodes[] = {
|
||||||
{UMODE_ACCOUNT, 'r', 0},
|
{UMODE_ACCOUNT, 'r', 0},
|
||||||
{UMODE_HIDE, 'x', 0},
|
{UMODE_HIDE, 'x', 0},
|
||||||
#ifdef NEFARIOUS
|
#ifdef NEFARIOUS
|
||||||
{UMODE_SETHOST, 'h', 0},
|
|
||||||
{UMODE_BOT, 'B', 0},
|
{UMODE_BOT, 'B', 0},
|
||||||
#endif
|
#endif
|
||||||
#if ( defined NEFARIOUS ) || (defined ASUKA )
|
#if ( defined NEFARIOUS ) || (defined ASUKA )
|
||||||
|
{UMODE_SETHOST, 'h', 0},
|
||||||
{UMODE_ACCOUNTONLY, 'R', 0},
|
{UMODE_ACCOUNTONLY, 'R', 0},
|
||||||
{UMODE_XTRAOP, 'X', 0},
|
{UMODE_XTRAOP, 'X', 0},
|
||||||
{UMODE_NOCHAN, 'n', 0},
|
{UMODE_NOCHAN, 'n', 0},
|
||||||
|
@ -159,7 +159,8 @@ const int ircd_cmodecount = ((sizeof (chan_modes) / sizeof (chan_modes[0])));
|
||||||
|
|
||||||
/* Temporary buffers for numeric conversion */
|
/* Temporary buffers for numeric conversion */
|
||||||
char neostatsbase64[3] = "\0";
|
char neostatsbase64[3] = "\0";
|
||||||
int neonickcount = 0;
|
/* Flags for numeric usage; limits to 64 clients */
|
||||||
|
char neonicknumerics[64];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Numeric nicks are new as of version ircu2.10.00beta1.
|
* Numeric nicks are new as of version ircu2.10.00beta1.
|
||||||
|
@ -308,6 +309,8 @@ send_server (const char *sender, const char *name, const int numeric, const char
|
||||||
void
|
void
|
||||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||||
{
|
{
|
||||||
|
/* Reset our numeric buffer */
|
||||||
|
memset(neonicknumerics, 0 , sizeof(neonicknumerics));
|
||||||
inttobase64(neostatsbase64, numeric, 2);
|
inttobase64(neostatsbase64, numeric, 2);
|
||||||
send_cmd ("%s %s", MSG_PASS, pass);
|
send_cmd ("%s %s", MSG_PASS, pass);
|
||||||
send_cmd ("%s %s 1 %lu %lu J10 %s]]] +s :%s", MSG_SERVER, name, tsboot, tslink, neostatsbase64, infoline);
|
send_cmd ("%s %s 1 %lu %lu J10 %s]]] +s :%s", MSG_SERVER, name, tsboot, tslink, neostatsbase64, infoline);
|
||||||
|
@ -323,6 +326,11 @@ send_squit (const char *server, const char *quitmsg)
|
||||||
void
|
void
|
||||||
send_quit (const char *who, const char *quitmsg)
|
send_quit (const char *who, const char *quitmsg)
|
||||||
{
|
{
|
||||||
|
char* num;
|
||||||
|
|
||||||
|
/* Clear numeric */
|
||||||
|
num = nicktobase64 (who);
|
||||||
|
neonicknumerics[convert2n[num[4]]] = 0;
|
||||||
send_cmd ("%s %s :%s", nicktobase64 (who), TOK_QUIT, quitmsg);
|
send_cmd ("%s %s :%s", nicktobase64 (who), TOK_QUIT, quitmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +341,7 @@ send_part (const char *who, const char *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -354,12 +362,21 @@ send_cmode (const char *sender, const char *who, const char *chan, const char *m
|
||||||
void
|
void
|
||||||
send_nick (const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname)
|
send_nick (const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
char nicknumbuf[6];
|
char nicknumbuf[6];
|
||||||
|
|
||||||
send_cmd ("%s %s %s 1 %lu %s %s %s AAAAAA %sAA%c :%s", neostatsbase64, TOK_NICK, nick, ts, ident, host, newmode, neostatsbase64, (neonickcount+'A'), realname);
|
for(i = 0; i < 64; i++)
|
||||||
snprintf(nicknumbuf, 6, "%sAA%c", neostatsbase64, (neonickcount+'A'));
|
{
|
||||||
|
/* Reserve numeric */
|
||||||
|
if(neonicknumerics[i]==0)
|
||||||
|
{
|
||||||
|
neonicknumerics[i] = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snprintf(nicknumbuf, 6, "%sAA%c", neostatsbase64, convert2y[i]);
|
||||||
|
send_cmd ("%s %s %s 1 %lu %s %s %s AAAAAA %s :%s", neostatsbase64, TOK_NICK, nick, ts, ident, host, newmode, nicknumbuf, realname);
|
||||||
setnickbase64 (nick, nicknumbuf);
|
setnickbase64 (nick, nicknumbuf);
|
||||||
neonickcount ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -395,7 +412,7 @@ send_kill (const char *from, const char *target, const char *reason)
|
||||||
void
|
void
|
||||||
send_nickchange (const char *oldnick, const char *newnick, const unsigned long ts)
|
send_nickchange (const char *oldnick, const char *newnick, const unsigned long ts)
|
||||||
{
|
{
|
||||||
send_cmd ("%s %s %s %s %lu", nicktobase64 (oldnick), TOK_NICK, newnick, newnick, ts);
|
send_cmd ("%s %s %s %lu", nicktobase64 (oldnick), TOK_NICK, newnick, ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -441,7 +458,8 @@ send_end_of_burst(void)
|
||||||
void
|
void
|
||||||
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const int length, const char *reason, const unsigned long ts)
|
send_akill (const char *sender, const char *host, const char *ident, const char *setby, const int length, const char *reason, const unsigned long ts)
|
||||||
{
|
{
|
||||||
send_cmd ("%s %s * +%s@%s %lu %lu :%s", neostatsbase64, TOK_GLINE, ident, host, (ts + length), ts, reason);
|
send_cmd ("%s %s * +%s@%s %lu :%s", neostatsbase64, TOK_GLINE, ident, host, length, reason);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -523,7 +541,7 @@ static void
|
||||||
m_server (char *origin, char **argv, int argc, int srv)
|
m_server (char *origin, char **argv, int argc, int srv)
|
||||||
{
|
{
|
||||||
if(srv == 2) {
|
if(srv == 2) {
|
||||||
do_server (argv[0], origin, argv[1], NULL, argv[argc-1], 0);
|
do_server (argv[0], NULL, argv[1], NULL, argv[argc-1], 0);
|
||||||
} else {
|
} else {
|
||||||
do_server (argv[0], base64toserver (origin), argv[1], NULL, argv[argc-1], srv);
|
do_server (argv[0], base64toserver (origin), argv[1], NULL, argv[argc-1], srv);
|
||||||
}
|
}
|
||||||
|
|
7
Ircu.h
7
Ircu.h
|
@ -43,6 +43,7 @@
|
||||||
/* The following defines might not be correct for IRCu but are used to
|
/* The following defines might not be correct for IRCu but are used to
|
||||||
* ensure NeoStats compiles correctly until we get updated files */
|
* ensure NeoStats compiles correctly until we get updated files */
|
||||||
|
|
||||||
|
#define GOTNOQUITSUPPORT
|
||||||
/* we support tokens */
|
/* we support tokens */
|
||||||
#define GOTTOKENSUPPORT
|
#define GOTTOKENSUPPORT
|
||||||
/* we don't have sjoin */
|
/* we don't have sjoin */
|
||||||
|
@ -268,10 +269,10 @@
|
||||||
#define UMODE_ACCOUNT 0x1000 /* */
|
#define UMODE_ACCOUNT 0x1000 /* */
|
||||||
#define UMODE_HIDE 0x2000 /* */
|
#define UMODE_HIDE 0x2000 /* */
|
||||||
#ifdef NEFARIOUS
|
#ifdef NEFARIOUS
|
||||||
#define UMODE_SETHOST 0x4000 /* */
|
#define UMODE_BOT 0x4000 /* */
|
||||||
#define UMODE_BOT 0x8000 /* */
|
|
||||||
#endif
|
#endif
|
||||||
#if ( defined NEFARIOUS ) || (defined ASUKA )
|
#if ( defined NEFARIOUS ) || (defined ASUKA )
|
||||||
|
#define UMODE_SETHOST 0x8000 /* */
|
||||||
#define UMODE_ACCOUNTONLY 0x10000 /* */
|
#define UMODE_ACCOUNTONLY 0x10000 /* */
|
||||||
#define UMODE_XTRAOP 0x20000 /* */
|
#define UMODE_XTRAOP 0x20000 /* */
|
||||||
#define UMODE_NOCHAN 0x40000 /* */
|
#define UMODE_NOCHAN 0x40000 /* */
|
||||||
|
@ -295,7 +296,7 @@
|
||||||
#define CMODE_DELJOINS 0x1000
|
#define CMODE_DELJOINS 0x1000
|
||||||
#endif
|
#endif
|
||||||
#define CMODE_LISTED 0x10000
|
#define CMODE_LISTED 0x10000
|
||||||
#define CMODE_REGONLY 0x20000
|
#define CMODE_RGSTRONLY 0x20000
|
||||||
#if ( defined NEFARIOUS ) || (defined ASUKA )
|
#if ( defined NEFARIOUS ) || (defined ASUKA )
|
||||||
#define CMODE_NOCOLOUR 0x40000
|
#define CMODE_NOCOLOUR 0x40000
|
||||||
#define CMODE_NOCTCP 0x80000
|
#define CMODE_NOCTCP 0x80000
|
||||||
|
|
|
@ -85,7 +85,7 @@ clean:
|
||||||
(cd pcre; $(MAKE) $@)
|
(cd pcre; $(MAKE) $@)
|
||||||
(cd curl; $(MAKE) $@)
|
(cd curl; $(MAKE) $@)
|
||||||
(cd sqlsrv; $(MAKE) $@)
|
(cd sqlsrv; $(MAKE) $@)
|
||||||
$(RM) *.o neostats *.cache Makefile config.h Makefile.inc dl/Makefile.inc *.log *.a *.d *.exe version.h
|
$(RM) *.o neostats Makefile config.h Makefile.inc dl/Makefile.inc *.log *.a *.d *.exe version.h
|
||||||
|
|
||||||
distclean:
|
distclean:
|
||||||
(cd dl; $(MAKE) $@)
|
(cd dl; $(MAKE) $@)
|
||||||
|
|
|
@ -208,9 +208,9 @@ send_part (const char *who, const char *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
send_cmd (":%s %s %lu %s + :%c%s", sender, MSG_SJOIN, ts, chan, flag, who);
|
send_cmd (":%s %s %lu %s + :%s", sender, MSG_SJOIN, ts, chan, who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
17
RELNOTES
17
RELNOTES
|
@ -1,4 +1,4 @@
|
||||||
* NeoStats * M & Fish * Version 2.5.15
|
* NeoStats * M & Fish * Version 2.5.21
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Important Changes you should know: (READ THIS!)
|
Important Changes you should know: (READ THIS!)
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@ -7,13 +7,14 @@ RedHat 9.0 / Fedora / Slakware 9.0 Users:
|
||||||
Kernels that affects NeoStats. If you are running RedHat 9.0 or Fedora
|
Kernels that affects NeoStats. If you are running RedHat 9.0 or Fedora
|
||||||
or Slakware 9.0 please read
|
or Slakware 9.0 please read
|
||||||
http://www.neostats.net/boards/viewtopic.php?t=391
|
http://www.neostats.net/boards/viewtopic.php?t=391
|
||||||
|
|
||||||
Experimental IRCu support:
|
Experimental IRCu support:
|
||||||
NeoStats 2.5.15 includes experimental support for IRCu. It may not work
|
NeoStats 2.5.21 includes experimental support for IRCu. It may not work
|
||||||
correctly on your network especially if you run a modified version of
|
correctly on your network especially if you run a modified version of
|
||||||
IRCu. Currently we only aim to support the main IRCu branch but do have
|
IRCu. Currently we only aim to support the main IRCu branch but do have
|
||||||
some support for Nefarious and Asuka modifications. You will need to
|
some support for Nefarious and Asuka modifications. You will need to
|
||||||
read and edit Ircu.h to support these modifications. If you wish to
|
read and edit Ircu.h to support these modifications. If you wish to
|
||||||
have support for a different branch of IRCu (e.g. boxen) you should
|
have support for a different branch of IRCu (e.g. boxen) you should
|
||||||
request this on the forums.
|
request this on the forums.
|
||||||
|
|
||||||
|
|
|
@ -262,10 +262,10 @@ send_part (const char *who, const char *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
#ifdef ULTIMATE3
|
#ifdef ULTIMATE3
|
||||||
send_cmd (":%s %s %lu %s + :%c%s", sender, MSG_SJOIN, ts, chan, flag, who);
|
send_cmd (":%s %s %lu %s + :%s", sender, MSG_SJOIN, ts, chan, who);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
319
Unreal.c
319
Unreal.c
|
@ -22,7 +22,12 @@
|
||||||
** NeoStats CVS Identification
|
** NeoStats CVS Identification
|
||||||
** $Id$
|
** $Id$
|
||||||
*/
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "Unreal.h"
|
#include "Unreal.h"
|
||||||
#include "ircd.h"
|
#include "ircd.h"
|
||||||
|
@ -61,6 +66,9 @@ static void m_smo (char *origin, char **argv, int argc, int srv);
|
||||||
static void m_swhois (char *origin, char **argv, int argc, int srv);
|
static void m_swhois (char *origin, char **argv, int argc, int srv);
|
||||||
static void m_tkl (char *origin, char **argv, int argc, int srv);
|
static void m_tkl (char *origin, char **argv, int argc, int srv);
|
||||||
|
|
||||||
|
static int decode_ip(char *buf);
|
||||||
|
|
||||||
|
|
||||||
#define NICKV2
|
#define NICKV2
|
||||||
|
|
||||||
#ifdef UNREAL32
|
#ifdef UNREAL32
|
||||||
|
@ -114,8 +122,8 @@ ChanModes chan_modes[] = {
|
||||||
{CMODE_VOICE, 'v', 1, 0, '+'},
|
{CMODE_VOICE, 'v', 1, 0, '+'},
|
||||||
{CMODE_HALFOP, 'h', 1, 0, '%'},
|
{CMODE_HALFOP, 'h', 1, 0, '%'},
|
||||||
{CMODE_CHANOP, 'o', 1, 0, '@'},
|
{CMODE_CHANOP, 'o', 1, 0, '@'},
|
||||||
{CMODE_CHANPROT, 'a', 1, 0, '~'},
|
{CMODE_CHANPROT, 'a', 1, 0, '*'},
|
||||||
{CMODE_CHANOWNER, 'q', 1, 0, '*'},
|
{CMODE_CHANOWNER, 'q', 1, 0, '~'},
|
||||||
{CMODE_LIMIT, 'l', 0, 1},
|
{CMODE_LIMIT, 'l', 0, 1},
|
||||||
{CMODE_PRIVATE, 'p', 0, 0},
|
{CMODE_PRIVATE, 'p', 0, 0},
|
||||||
{CMODE_SECRET, 's', 0, 0},
|
{CMODE_SECRET, 's', 0, 0},
|
||||||
|
@ -201,7 +209,7 @@ void
|
||||||
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
send_server_connect (const char *name, const int numeric, const char *infoline, const char *pass, unsigned long tsboot, unsigned long tslink)
|
||||||
{
|
{
|
||||||
/* PROTOCTL NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 NS SJB64 */
|
/* PROTOCTL NOQUIT TOKEN NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 NS SJB64 */
|
||||||
send_cmd ("%s TOKEN NICKv2 VHP SJOIN SJOIN2 SJ3 UMODE2", (ircd_srv.token ? TOK_PROTOCTL : MSG_PROTOCTL));
|
send_cmd ("%s TOKEN NICKv2 VHP SJOIN SJOIN2 SJ3 UMODE2 NICKIP", (ircd_srv.token ? TOK_PROTOCTL : MSG_PROTOCTL));
|
||||||
send_cmd ("%s %s", (ircd_srv.token ? TOK_PASS : MSG_PASS), pass);
|
send_cmd ("%s %s", (ircd_srv.token ? TOK_PASS : MSG_PASS), pass);
|
||||||
send_cmd ("%s %s %d :%s", (ircd_srv.token ? TOK_SERVER : MSG_SERVER), name, numeric, infoline);
|
send_cmd ("%s %s %d :%s", (ircd_srv.token ? TOK_SERVER : MSG_SERVER), name, numeric, infoline);
|
||||||
}
|
}
|
||||||
|
@ -231,9 +239,9 @@ send_join (const char *sender, const char *who, const char *chan, const unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
send_cmd (":%s %s %lu %s + :%c%s", sender, (ircd_srv.token ? TOK_SJOIN : MSG_SJOIN), ts, chan, flag, who);
|
send_cmd (":%s %s %lu %s + :%s", sender, (ircd_srv.token ? TOK_SJOIN : MSG_SJOIN), ts, chan, who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -585,14 +593,24 @@ m_away (char *origin, char **argv, int argc, int srv)
|
||||||
* argv[7] = umodes
|
* argv[7] = umodes
|
||||||
* argv[8] = virthost, * if none
|
* argv[8] = virthost, * if none
|
||||||
* argv[9] = info
|
* argv[9] = info
|
||||||
|
* if NICKIP
|
||||||
|
* argv[9] = nickip
|
||||||
|
* argv[10] = info
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
m_nick (char *origin, char **argv, int argc, int srv)
|
m_nick (char *origin, char **argv, int argc, int srv)
|
||||||
{
|
{
|
||||||
|
char tmpbuf[25];
|
||||||
if(!srv) {
|
if(!srv) {
|
||||||
#ifdef NICKV2
|
#ifdef NICKV2
|
||||||
do_nick (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
|
if (ircd_srv.nickip) {
|
||||||
NULL, argv[6], argv[7], argv[8], argv[9], NULL);
|
snprintf(tmpbuf, 25, "%d", ntohl (decode_ip(argv[9])));
|
||||||
|
do_nick (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
|
||||||
|
tmpbuf /* NICKIP */, argv[6], argv[7], argv[8], argv[10], NULL);
|
||||||
|
} else {
|
||||||
|
do_nick (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
|
||||||
|
NULL, argv[6], argv[7], argv[8], argv[9], NULL);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
do_nick (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
|
do_nick (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],
|
||||||
NULL, argv[6], NULL, NULL, argv[9], NULL);
|
NULL, argv[6], NULL, NULL, argv[9], NULL);
|
||||||
|
@ -709,7 +727,7 @@ m_eos (char *origin, char **argv, int argc, int srv)
|
||||||
static void
|
static void
|
||||||
m_sjoin (char *origin, char **argv, int argc, int srv)
|
m_sjoin (char *origin, char **argv, int argc, int srv)
|
||||||
{
|
{
|
||||||
do_sjoin (argv[0], argv[1], ((argc <= 2) ? argv[1] : argv[2]), origin, argv, argc);
|
do_sjoin (argv[0], argv[1], ((argc >= 4) ? argv[2] : ""), origin, argv, argc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* m_pass
|
/* m_pass
|
||||||
|
@ -775,3 +793,286 @@ static void m_tkl (char *origin, char **argv, int argc, int srv)
|
||||||
{
|
{
|
||||||
do_tkl(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
|
do_tkl(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char Base64[] =
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
static const char Pad64 = '=';
|
||||||
|
|
||||||
|
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
|
||||||
|
The following encoding technique is taken from RFC 1521 by Borenstein
|
||||||
|
and Freed. It is reproduced here in a slightly edited form for
|
||||||
|
convenience.
|
||||||
|
|
||||||
|
A 65-character subset of US-ASCII is used, enabling 6 bits to be
|
||||||
|
represented per printable character. (The extra 65th character, "=",
|
||||||
|
is used to signify a special processing function.)
|
||||||
|
|
||||||
|
The encoding process represents 24-bit groups of input bits as output
|
||||||
|
strings of 4 encoded characters. Proceeding from left to right, a
|
||||||
|
24-bit input group is formed by concatenating 3 8-bit input groups.
|
||||||
|
These 24 bits are then treated as 4 concatenated 6-bit groups, each
|
||||||
|
of which is translated into a single digit in the base64 alphabet.
|
||||||
|
|
||||||
|
Each 6-bit group is used as an index into an array of 64 printable
|
||||||
|
characters. The character referenced by the index is placed in the
|
||||||
|
output string.
|
||||||
|
|
||||||
|
Table 1: The Base64 Alphabet
|
||||||
|
|
||||||
|
Value Encoding Value Encoding Value Encoding Value Encoding
|
||||||
|
0 A 17 R 34 i 51 z
|
||||||
|
1 B 18 S 35 j 52 0
|
||||||
|
2 C 19 T 36 k 53 1
|
||||||
|
3 D 20 U 37 l 54 2
|
||||||
|
4 E 21 V 38 m 55 3
|
||||||
|
5 F 22 W 39 n 56 4
|
||||||
|
6 G 23 X 40 o 57 5
|
||||||
|
7 H 24 Y 41 p 58 6
|
||||||
|
8 I 25 Z 42 q 59 7
|
||||||
|
9 J 26 a 43 r 60 8
|
||||||
|
10 K 27 b 44 s 61 9
|
||||||
|
11 L 28 c 45 t 62 +
|
||||||
|
12 M 29 d 46 u 63 /
|
||||||
|
13 N 30 e 47 v
|
||||||
|
14 O 31 f 48 w (pad) =
|
||||||
|
15 P 32 g 49 x
|
||||||
|
16 Q 33 h 50 y
|
||||||
|
|
||||||
|
Special processing is performed if fewer than 24 bits are available
|
||||||
|
at the end of the data being encoded. A full encoding quantum is
|
||||||
|
always completed at the end of a quantity. When fewer than 24 input
|
||||||
|
bits are available in an input group, zero bits are added (on the
|
||||||
|
right) to form an integral number of 6-bit groups. Padding at the
|
||||||
|
end of the data is performed using the '=' character.
|
||||||
|
|
||||||
|
Since all base64 input is an integral number of octets, only the
|
||||||
|
-------------------------------------------------
|
||||||
|
following cases can arise:
|
||||||
|
|
||||||
|
(1) the final quantum of encoding input is an integral
|
||||||
|
multiple of 24 bits; here, the final unit of encoded
|
||||||
|
output will be an integral multiple of 4 characters
|
||||||
|
with no "=" padding,
|
||||||
|
(2) the final quantum of encoding input is exactly 8 bits;
|
||||||
|
here, the final unit of encoded output will be two
|
||||||
|
characters followed by two "=" padding characters, or
|
||||||
|
(3) the final quantum of encoding input is exactly 16 bits;
|
||||||
|
here, the final unit of encoded output will be three
|
||||||
|
characters followed by one "=" padding character.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int b64_encode(unsigned char const *src, size_t srclength, char *target, size_t targsize)
|
||||||
|
{
|
||||||
|
size_t datalength = 0;
|
||||||
|
u_char input[3];
|
||||||
|
u_char output[4];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
while (2 < srclength) {
|
||||||
|
input[0] = *src++;
|
||||||
|
input[1] = *src++;
|
||||||
|
input[2] = *src++;
|
||||||
|
srclength -= 3;
|
||||||
|
|
||||||
|
output[0] = input[0] >> 2;
|
||||||
|
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||||
|
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||||
|
output[3] = input[2] & 0x3f;
|
||||||
|
|
||||||
|
if (datalength + 4 > targsize)
|
||||||
|
return (-1);
|
||||||
|
target[datalength++] = Base64[output[0]];
|
||||||
|
target[datalength++] = Base64[output[1]];
|
||||||
|
target[datalength++] = Base64[output[2]];
|
||||||
|
target[datalength++] = Base64[output[3]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now we worry about padding. */
|
||||||
|
if (0 != srclength) {
|
||||||
|
/* Get what's left. */
|
||||||
|
input[0] = input[1] = input[2] = '\0';
|
||||||
|
for (i = 0; i < srclength; i++)
|
||||||
|
input[i] = *src++;
|
||||||
|
|
||||||
|
output[0] = input[0] >> 2;
|
||||||
|
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||||
|
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||||
|
|
||||||
|
if (datalength + 4 > targsize)
|
||||||
|
return (-1);
|
||||||
|
target[datalength++] = Base64[output[0]];
|
||||||
|
target[datalength++] = Base64[output[1]];
|
||||||
|
if (srclength == 1)
|
||||||
|
target[datalength++] = Pad64;
|
||||||
|
else
|
||||||
|
target[datalength++] = Base64[output[2]];
|
||||||
|
target[datalength++] = Pad64;
|
||||||
|
}
|
||||||
|
if (datalength >= targsize)
|
||||||
|
return (-1);
|
||||||
|
target[datalength] = '\0'; /* Returned value doesn't count \0. */
|
||||||
|
return (datalength);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* skips all whitespace anywhere.
|
||||||
|
converts characters, four at a time, starting at (or after)
|
||||||
|
src from base - 64 numbers into three 8 bit bytes in the target area.
|
||||||
|
it returns the number of data bytes stored at the target, or -1 on error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int b64_decode(char const *src, unsigned char *target, size_t targsize)
|
||||||
|
{
|
||||||
|
int tarindex, state, ch;
|
||||||
|
char *pos;
|
||||||
|
|
||||||
|
state = 0;
|
||||||
|
tarindex = 0;
|
||||||
|
|
||||||
|
while ((ch = *src++) != '\0') {
|
||||||
|
if (isspace(ch)) /* Skip whitespace anywhere. */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (ch == Pad64)
|
||||||
|
break;
|
||||||
|
|
||||||
|
pos = strchr(Base64, ch);
|
||||||
|
if (pos == 0) /* A non-base64 character. */
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case 0:
|
||||||
|
if (target) {
|
||||||
|
if ((size_t)tarindex >= targsize)
|
||||||
|
return (-1);
|
||||||
|
target[tarindex] = (pos - Base64) << 2;
|
||||||
|
}
|
||||||
|
state = 1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (target) {
|
||||||
|
if ((size_t)tarindex + 1 >= targsize)
|
||||||
|
return (-1);
|
||||||
|
target[tarindex] |= (pos - Base64) >> 4;
|
||||||
|
target[tarindex+1] = ((pos - Base64) & 0x0f)
|
||||||
|
<< 4 ;
|
||||||
|
}
|
||||||
|
tarindex++;
|
||||||
|
state = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (target) {
|
||||||
|
if ((size_t)tarindex + 1 >= targsize)
|
||||||
|
return (-1);
|
||||||
|
target[tarindex] |= (pos - Base64) >> 2;
|
||||||
|
target[tarindex+1] = ((pos - Base64) & 0x03)
|
||||||
|
<< 6;
|
||||||
|
}
|
||||||
|
tarindex++;
|
||||||
|
state = 3;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (target) {
|
||||||
|
if ((size_t)tarindex >= targsize)
|
||||||
|
return (-1);
|
||||||
|
target[tarindex] |= (pos - Base64);
|
||||||
|
}
|
||||||
|
tarindex++;
|
||||||
|
state = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We are done decoding Base-64 chars. Let's see if we ended
|
||||||
|
* on a byte boundary, and/or with erroneous trailing characters.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (ch == Pad64) { /* We got a pad char. */
|
||||||
|
ch = *src++; /* Skip it, get next. */
|
||||||
|
switch (state) {
|
||||||
|
case 0: /* Invalid = in first position */
|
||||||
|
case 1: /* Invalid = in second position */
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
case 2: /* Valid, means one byte of info */
|
||||||
|
/* Skip any number of spaces. */
|
||||||
|
for ((void)NULL; ch != '\0'; ch = *src++)
|
||||||
|
if (!isspace(ch))
|
||||||
|
break;
|
||||||
|
/* Make sure there is another trailing = sign. */
|
||||||
|
if (ch != Pad64)
|
||||||
|
return (-1);
|
||||||
|
ch = *src++; /* Skip the = */
|
||||||
|
/* Fall through to "single trailing =" case. */
|
||||||
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
|
case 3: /* Valid, means two bytes of info */
|
||||||
|
/*
|
||||||
|
* We know this char is an =. Is there anything but
|
||||||
|
* whitespace after it?
|
||||||
|
*/
|
||||||
|
for ((void)NULL; ch != '\0'; ch = *src++)
|
||||||
|
if (!isspace(ch))
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now make sure for cases 2 and 3 that the "extra"
|
||||||
|
* bits that slopped past the last full byte were
|
||||||
|
* zeros. If we don't check them, they become a
|
||||||
|
* subliminal channel.
|
||||||
|
*/
|
||||||
|
if (target && target[tarindex] != 0)
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* We ended by seeing the end of the string. Make sure we
|
||||||
|
* have no partial bytes lying around.
|
||||||
|
*/
|
||||||
|
if (state != 0)
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (tarindex);
|
||||||
|
}
|
||||||
|
char *encode_ip(u_char *ip)
|
||||||
|
{
|
||||||
|
static char buf[25];
|
||||||
|
u_char *cp;
|
||||||
|
struct in_addr ia; /* For IPv4 */
|
||||||
|
|
||||||
|
if (!ip)
|
||||||
|
return "*";
|
||||||
|
|
||||||
|
if (strchr(ip, ':'))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ia.s_addr = inet_addr(ip);
|
||||||
|
cp = (u_char *)ia.s_addr;
|
||||||
|
b64_encode((char *)&cp, sizeof(struct in_addr), buf, 25);
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
int decode_ip(char *buf)
|
||||||
|
{
|
||||||
|
int len = strlen(buf);
|
||||||
|
char targ[25];
|
||||||
|
struct in_addr ia;
|
||||||
|
|
||||||
|
b64_decode(buf, targ, 25);
|
||||||
|
ia = *( struct in_addr *)targ;
|
||||||
|
if (len == 24) /* IPv6 */
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (len == 8) /* IPv4 */
|
||||||
|
return ia.s_addr;
|
||||||
|
else /* Error?? */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
5
Unreal.h
5
Unreal.h
|
@ -63,9 +63,12 @@
|
||||||
#define GOTSVSKILL
|
#define GOTSVSKILL
|
||||||
/* we have automatic host cloaking support via Umode */
|
/* we have automatic host cloaking support via Umode */
|
||||||
#define GOTUMODECLOAKING
|
#define GOTUMODECLOAKING
|
||||||
|
#ifdef UNREAL32
|
||||||
/* we dont have a nickip field in the nick message */
|
/* we dont have a nickip field in the nick message */
|
||||||
|
#define GOTNICKIP
|
||||||
|
#else
|
||||||
#undef GOTNICKIP
|
#undef GOTNICKIP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
4
Viagra.c
4
Viagra.c
|
@ -165,9 +165,9 @@ send_part (const char *who, const char *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
send_cmd (":%s %s %lu %s + :%c%s", sender, MSG_SJOIN, ts, chan, flag, who);
|
send_cmd (":%s %s %lu %s + :%s", sender, MSG_SJOIN, ts, chan, who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -605,7 +605,7 @@ typedef enum {
|
||||||
} parsedomain_flags;
|
} parsedomain_flags;
|
||||||
|
|
||||||
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu,
|
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu,
|
||||||
vbuf * vb, parsedomain_flags flags,
|
vbuf * vb, adns_queryflags flags,
|
||||||
const byte * dgram, int dglen,
|
const byte * dgram, int dglen,
|
||||||
int *cbyte_io, int max);
|
int *cbyte_io, int max);
|
||||||
/* vb must already have been initialised; it will be reset if necessary.
|
/* vb must already have been initialised; it will be reset if necessary.
|
||||||
|
|
5
bans.c
5
bans.c
|
@ -60,7 +60,8 @@ void AddBan(const char* type, const char* user, const char* host, const char* ma
|
||||||
Ban* ban;
|
Ban* ban;
|
||||||
|
|
||||||
ban = new_ban (mask);
|
ban = new_ban (mask);
|
||||||
ban->type = type[0];
|
ban->type[0] = type[0];
|
||||||
|
ban->type[1] = 0;
|
||||||
strlcpy(ban->user, user, MAXUSER);
|
strlcpy(ban->user, user, MAXUSER);
|
||||||
strlcpy(ban->host, host, MAXHOST);
|
strlcpy(ban->host, host, MAXHOST);
|
||||||
strlcpy(ban->mask, mask, MAXHOST);
|
strlcpy(ban->mask, mask, MAXHOST);
|
||||||
|
@ -155,7 +156,7 @@ COLDEF neo_banscols[] = {
|
||||||
"bans",
|
"bans",
|
||||||
"type",
|
"type",
|
||||||
RTA_STR,
|
RTA_STR,
|
||||||
1,
|
8,
|
||||||
offsetof(struct Ban, type),
|
offsetof(struct Ban, type),
|
||||||
RTA_READONLY,
|
RTA_READONLY,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -535,7 +535,7 @@ bot_cmd_help (ModUser* bot_ptr, User * u, char **av, int ac)
|
||||||
prefmsg(u->nick, bot_ptr->nick, " ");
|
prefmsg(u->nick, bot_ptr->nick, " ");
|
||||||
prefmsg(u->nick, bot_ptr->nick, "To use a command, type");
|
prefmsg(u->nick, bot_ptr->nick, "To use a command, type");
|
||||||
prefmsg(u->nick, bot_ptr->nick, " \2/msg %s command\2", bot_ptr->nick);
|
prefmsg(u->nick, bot_ptr->nick, " \2/msg %s command\2", bot_ptr->nick);
|
||||||
prefmsg(u->nick, bot_ptr->nick, "For for more information on a command, type");
|
prefmsg(u->nick, bot_ptr->nick, "For more information on a command, type");
|
||||||
prefmsg(u->nick, bot_ptr->nick, " \2/msg %s HELP command\2.", bot_ptr->nick);
|
prefmsg(u->nick, bot_ptr->nick, " \2/msg %s HELP command\2.", bot_ptr->nick);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,3 +191,9 @@
|
||||||
|
|
||||||
/* if we are compiling with SQL support */
|
/* if we are compiling with SQL support */
|
||||||
#undef SQLSRV
|
#undef SQLSRV
|
||||||
|
|
||||||
|
/* Define if we have va_copy. */
|
||||||
|
#undef HAVE_VA_COPY
|
||||||
|
|
||||||
|
/* Define if we have __va_copy. */
|
||||||
|
#undef HAVE___VA_COPY
|
||||||
|
|
19
configure.in
19
configure.in
|
@ -4,7 +4,7 @@ AC_CONFIG_HEADER(config.h)
|
||||||
PACKAGE=NeoStats
|
PACKAGE=NeoStats
|
||||||
MAJOR=2
|
MAJOR=2
|
||||||
MINOR=5
|
MINOR=5
|
||||||
REV=15
|
REV=21
|
||||||
AC_DEFINE_UNQUOTED(MAJOR, $MAJOR)
|
AC_DEFINE_UNQUOTED(MAJOR, $MAJOR)
|
||||||
AC_DEFINE_UNQUOTED(MINOR, $MINOR)
|
AC_DEFINE_UNQUOTED(MINOR, $MINOR)
|
||||||
AC_DEFINE_UNQUOTED(REV, $REV)
|
AC_DEFINE_UNQUOTED(REV, $REV)
|
||||||
|
@ -153,6 +153,23 @@ dnl Default values for miscellaneous macros
|
||||||
|
|
||||||
AC_DEFINE(POSIX_MALLOC_THRESHOLD,10)
|
AC_DEFINE(POSIX_MALLOC_THRESHOLD,10)
|
||||||
|
|
||||||
|
dnl How to copy one va_list to another?
|
||||||
|
AC_CACHE_CHECK([for va_copy], ns_va_copy, [AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
|
||||||
|
[ns_va_copy="yes"],
|
||||||
|
[ns_va_copy="no"]
|
||||||
|
)])
|
||||||
|
if test "$ns_va_copy" = "yes" ; then
|
||||||
|
AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy]) fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for __va_copy], ns___va_copy, [AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
|
||||||
|
[ns___va_copy="yes"],
|
||||||
|
[ns___va_copy="no"]
|
||||||
|
)])
|
||||||
|
if test "$ns___va_copy" = "yes" ; then
|
||||||
|
AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy]) fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dnl check if we are running with Debug....
|
dnl check if we are running with Debug....
|
||||||
|
|
5
dl.c
5
dl.c
|
@ -856,6 +856,11 @@ bot_message (char *origin, char **av, int ac)
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (ac < 2) {
|
||||||
|
nlog(LOG_WARNING, LOG_CORE, "Invalid String passed to Bot_message");
|
||||||
|
return NS_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check command length */
|
/* Check command length */
|
||||||
if (strnlen (av[1], MAX_CMD_LINE_LENGTH) >= MAX_CMD_LINE_LENGTH) {
|
if (strnlen (av[1], MAX_CMD_LINE_LENGTH) >= MAX_CMD_LINE_LENGTH) {
|
||||||
prefmsg (origin, s_Services, "command line too long!");
|
prefmsg (origin, s_Services, "command line too long!");
|
||||||
|
|
|
@ -57,9 +57,9 @@ static char msg_mode_serv[]="\2MODE\2 %s is %s a %s (%c%c) on %s";
|
||||||
static char msg_bot[]="\2BOT\2 %s is %s a Bot (%c%c)";
|
static char msg_bot[]="\2BOT\2 %s is %s a Bot (%c%c)";
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
static char msg_nickchange[]="\2\0037Nick Change\2 user: \2%s\2 (%s@%s) Changed their nick to \2%s\2\003";
|
static char msg_nickchange[]="\2\0037NICK CHANGE\2 user: \2%s\2 (%s@%s) Changed their nick to \2%s\2\003";
|
||||||
static char msg_signon[]="\2\0034SIGNED ON\2 user: \2%s\2 (%s@%s - %s) at: \2%s\2\003";
|
static char msg_signon[]="\2\0034SIGNED ON\2 user: \2%s\2 (%s@%s - %s) at: \2%s\2\003";
|
||||||
static char msg_signoff[]="\2\0033Signed Off\2 user: %s (%s@%s - %s) at: %s - %s\003";
|
static char msg_signoff[]="\2\0033SIGNED OFF\2 user: %s (%s@%s - %s) at: %s - %s\003";
|
||||||
static char msg_localkill[]="\2LOCAL KILL\2 user: \2%s\2 (%s@%s) was Killed by: \2%s\2 - Reason sighted: \2%s\2";
|
static char msg_localkill[]="\2LOCAL KILL\2 user: \2%s\2 (%s@%s) was Killed by: \2%s\2 - Reason sighted: \2%s\2";
|
||||||
static char msg_globalkill[]="\2\00312GLOBAL KILL\2 user: \2%s\2 (%s@%s) was Killed by \2%s\2 - Reason sighted: \2%s\2\003";
|
static char msg_globalkill[]="\2\00312GLOBAL KILL\2 user: \2%s\2 (%s@%s) was Killed by \2%s\2 - Reason sighted: \2%s\2\003";
|
||||||
static char msg_serverkill[]="\2SERVER KILL\2 user: \2%s\2 (%s@%s) was Killed by the Server \2%s\2 - Reason sighted: \2%s\2";
|
static char msg_serverkill[]="\2SERVER KILL\2 user: \2%s\2 (%s@%s) was Killed by the Server \2%s\2 - Reason sighted: \2%s\2";
|
||||||
|
@ -593,7 +593,7 @@ static void LoadConfig(void)
|
||||||
cs_cfg.serv_watch = 1;
|
cs_cfg.serv_watch = 1;
|
||||||
}
|
}
|
||||||
if(GetConf((void *) &cs_cfg.use_exc, CFGBOOL, "Exclusions")<= 0) {
|
if(GetConf((void *) &cs_cfg.use_exc, CFGBOOL, "Exclusions")<= 0) {
|
||||||
cs_cfg.serv_watch = 0;
|
cs_cfg.use_exc = 0;
|
||||||
}
|
}
|
||||||
if(GetConf((void *) &temp, CFGSTR, "Nick") < 0) {
|
if(GetConf((void *) &temp, CFGSTR, "Nick") < 0) {
|
||||||
#if !defined(HYBRID7)
|
#if !defined(HYBRID7)
|
||||||
|
|
|
@ -2,6 +2,9 @@ HostServ Module for NeoStats 2.x ChangeLog
|
||||||
Shmad <shmad@neostats.net>
|
Shmad <shmad@neostats.net>
|
||||||
^Enigma^ <enigma@neostats.net>
|
^Enigma^ <enigma@neostats.net>
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
* July 07, 2004 * Fish
|
||||||
|
- use "match" rather than fnmatch
|
||||||
|
|
||||||
* Version 3.4 * Mark (M) * Feb 17, 2004
|
* Version 3.4 * Mark (M) * Feb 17, 2004
|
||||||
- SET interface for nick/user/host/realname added (M)
|
- SET interface for nick/user/host/realname added (M)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fnmatch.h>
|
|
||||||
#include "neostats.h"
|
#include "neostats.h"
|
||||||
#include "hostserv.h"
|
#include "hostserv.h"
|
||||||
|
|
||||||
|
@ -225,7 +224,7 @@ static int hs_sign_on(char **av, int ac)
|
||||||
if (hn) {
|
if (hn) {
|
||||||
map = lnode_get(hn);
|
map = lnode_get(hn);
|
||||||
nlog(LOG_DEBUG1, LOG_MOD, "Checking %s against %s for HostName Match", map->host, u->hostname);
|
nlog(LOG_DEBUG1, LOG_MOD, "Checking %s against %s for HostName Match", map->host, u->hostname);
|
||||||
if (fnmatch(map->host, u->hostname, 0) == 0) {
|
if (match(map->host, u->hostname)) {
|
||||||
ssvshost_cmd(u->nick, map->vhost);
|
ssvshost_cmd(u->nick, map->vhost);
|
||||||
prefmsg(u->nick, s_HostServ,
|
prefmsg(u->nick, s_HostServ,
|
||||||
"Automatically setting your Virtual Host to %s",
|
"Automatically setting your Virtual Host to %s",
|
||||||
|
@ -571,7 +570,7 @@ static int hs_chpass(User * u, char **av, int ac)
|
||||||
hn = list_find(vhosts, nick, findnick);
|
hn = list_find(vhosts, nick, findnick);
|
||||||
if (hn) {
|
if (hn) {
|
||||||
map = lnode_get(hn);
|
map = lnode_get(hn);
|
||||||
if ((fnmatch(map->host, u->hostname, 0) == 0)
|
if ((match(map->host, u->hostname))
|
||||||
|| (UserLevel(u) >= 100)) {
|
|| (UserLevel(u) >= 100)) {
|
||||||
if (!ircstrcasecmp(map->passwd, oldpass)) {
|
if (!ircstrcasecmp(map->passwd, oldpass)) {
|
||||||
strlcpy(map->passwd, newpass, MAXPASSWORD);
|
strlcpy(map->passwd, newpass, MAXPASSWORD);
|
||||||
|
@ -627,7 +626,7 @@ static int hs_add(User * u, char **av, int ac)
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
hash_scan_begin(&hs, bannedvhosts);
|
hash_scan_begin(&hs, bannedvhosts);
|
||||||
while ((hn = hash_scan_next(&hs)) != NULL) {
|
while ((hn = hash_scan_next(&hs)) != NULL) {
|
||||||
if (fnmatch(hnode_get(hn), h, 0) == 0) {
|
if (match(hnode_get(hn), h)) {
|
||||||
prefmsg(u->nick, s_HostServ,
|
prefmsg(u->nick, s_HostServ,
|
||||||
"The Hostname %s has been matched against the banned hostname %s",
|
"The Hostname %s has been matched against the banned hostname %s",
|
||||||
h, (char *) hnode_get(hn));
|
h, (char *) hnode_get(hn));
|
||||||
|
@ -638,6 +637,11 @@ static int hs_add(User * u, char **av, int ac)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(validate_host (h) == NS_FAILURE) {
|
||||||
|
prefmsg(u->nick, s_HostServ,
|
||||||
|
"%s is an invalid host", h);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!list_find(vhosts, cmd, findnick)) {
|
if (!list_find(vhosts, cmd, findnick)) {
|
||||||
hsdat(cmd, m, h, p, u->nick);
|
hsdat(cmd, m, h, p, u->nick);
|
||||||
|
@ -654,7 +658,7 @@ static int hs_add(User * u, char **av, int ac)
|
||||||
if ((nu = finduser(cmd)) != NULL) {
|
if ((nu = finduser(cmd)) != NULL) {
|
||||||
if (findbot(cmd))
|
if (findbot(cmd))
|
||||||
return 1;
|
return 1;
|
||||||
if (fnmatch(m, nu->hostname, 0) == 0) {
|
if (match(m, nu->hostname)) {
|
||||||
ssvshost_cmd(nu->nick, h);
|
ssvshost_cmd(nu->nick, h);
|
||||||
prefmsg(u->nick, s_HostServ,
|
prefmsg(u->nick, s_HostServ,
|
||||||
"%s is online now, setting vhost to %s",
|
"%s is online now, setting vhost to %s",
|
||||||
|
|
|
@ -78,7 +78,8 @@ static bot_setting ls_settings[]=
|
||||||
{"NICK", &s_LoveServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick },
|
{"NICK", &s_LoveServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick },
|
||||||
{"USER", &ls_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user },
|
{"USER", &ls_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user },
|
||||||
{"HOST", &ls_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host },
|
{"HOST", &ls_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host },
|
||||||
{"REALNAME", &ls_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname },
|
{"REALNAME", &ls_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName", NULL, ns_help_set_realname },
|
||||||
|
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int Online(char **av, int ac)
|
static int Online(char **av, int ac)
|
||||||
|
|
|
@ -74,7 +74,8 @@ static bot_setting ms_settings[]=
|
||||||
{"NICK", &s_MoraleServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick },
|
{"NICK", &s_MoraleServ, SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "Nick", NULL, ns_help_set_nick },
|
||||||
{"USER", &ms_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user },
|
{"USER", &ms_cfg.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user },
|
||||||
{"HOST", &ms_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host },
|
{"HOST", &ms_cfg.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host },
|
||||||
{"REALNAME", &ms_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname },
|
{"REALNAME", &ms_cfg.realname, SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName", NULL, ns_help_set_realname },
|
||||||
|
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int Online(char **av, int ac)
|
static int Online(char **av, int ac)
|
||||||
|
|
Binary file not shown.
|
@ -36,11 +36,13 @@ void LoadOldStats();
|
||||||
void SaveStats()
|
void SaveStats()
|
||||||
{
|
{
|
||||||
SStats *s;
|
SStats *s;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
CStats *c;
|
CStats *c;
|
||||||
hnode_t *sn;
|
|
||||||
lnode_t *cn;
|
lnode_t *cn;
|
||||||
hscan_t ss;
|
|
||||||
int count, limit;
|
int count, limit;
|
||||||
|
#endif
|
||||||
|
hnode_t *sn;
|
||||||
|
hscan_t ss;
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
|
|
||||||
if (StatServ.newdb == 1) {
|
if (StatServ.newdb == 1) {
|
||||||
|
@ -83,6 +85,7 @@ void SaveStats()
|
||||||
hash_destroy(Shead);
|
hash_destroy(Shead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
/* ok, Now Channel Stats */
|
/* ok, Now Channel Stats */
|
||||||
count = 0;
|
count = 0;
|
||||||
/* we want to only do 25% each progressive save */
|
/* we want to only do 25% each progressive save */
|
||||||
|
@ -117,7 +120,7 @@ void SaveStats()
|
||||||
if (StatServ.shutdown == 1) {
|
if (StatServ.shutdown == 1) {
|
||||||
list_destroy_nodes(Chead);
|
list_destroy_nodes(Chead);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* and finally, the network data */
|
/* and finally, the network data */
|
||||||
|
|
||||||
SetData((void *)stats_network.maxopers, CFGINT, "NetStats", "Global", "MaxOpers");
|
SetData((void *)stats_network.maxopers, CFGINT, "NetStats", "Global", "MaxOpers");
|
||||||
|
@ -127,8 +130,10 @@ void SaveStats()
|
||||||
SetData((void *)stats_network.t_maxusers, CFGINT, "NetStats", "Global", "MaxUsersTime");
|
SetData((void *)stats_network.t_maxusers, CFGINT, "NetStats", "Global", "MaxUsersTime");
|
||||||
SetData((void *)stats_network.t_maxservers, CFGINT, "NetStats", "Global", "MaxServersTime");
|
SetData((void *)stats_network.t_maxservers, CFGINT, "NetStats", "Global", "MaxServersTime");
|
||||||
SetData((void *)stats_network.totusers, CFGINT, "NetStats", "Global", "TotalUsers");
|
SetData((void *)stats_network.totusers, CFGINT, "NetStats", "Global", "TotalUsers");
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
SetData((void *)stats_network.maxchans, CFGINT, "NetStats", "Global", "MaxChans");
|
SetData((void *)stats_network.maxchans, CFGINT, "NetStats", "Global", "MaxChans");
|
||||||
SetData((void *)stats_network.t_chans, CFGINT, "NetStats", "Global", "MaxChansTime");
|
SetData((void *)stats_network.t_chans, CFGINT, "NetStats", "Global", "MaxChansTime");
|
||||||
|
#endif
|
||||||
if (StatServ.shutdown == 1) {
|
if (StatServ.shutdown == 1) {
|
||||||
chanalert(s_Services, "Done");
|
chanalert(s_Services, "Done");
|
||||||
}
|
}
|
||||||
|
@ -142,7 +147,9 @@ void LoadStats() {
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
Chead = list_create(SS_CHAN_SIZE);
|
Chead = list_create(SS_CHAN_SIZE);
|
||||||
|
#endif
|
||||||
Shead = hash_create(S_TABLE_SIZE, 0, 0);
|
Shead = hash_create(S_TABLE_SIZE, 0, 0);
|
||||||
|
|
||||||
if (GetData ((void *) &stats_network.maxopers, CFGINT, "NetStats", "Global", "MaxOpers") <= 0) {
|
if (GetData ((void *) &stats_network.maxopers, CFGINT, "NetStats", "Global", "MaxOpers") <= 0) {
|
||||||
|
@ -158,9 +165,10 @@ void LoadStats() {
|
||||||
GetData((void *)&stats_network.t_maxusers, CFGINT, "NetStats", "Global", "MaxUsersTime");
|
GetData((void *)&stats_network.t_maxusers, CFGINT, "NetStats", "Global", "MaxUsersTime");
|
||||||
GetData((void *)&stats_network.t_maxservers, CFGINT, "NetStats", "Global", "MaxServersTime");
|
GetData((void *)&stats_network.t_maxservers, CFGINT, "NetStats", "Global", "MaxServersTime");
|
||||||
GetData((void *)&stats_network.totusers, CFGINT, "NetStats", "Global", "TotalUsers");
|
GetData((void *)&stats_network.totusers, CFGINT, "NetStats", "Global", "TotalUsers");
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
GetData((void *)&stats_network.maxchans, CFGINT, "NetStats", "Global", "MaxChans");
|
GetData((void *)&stats_network.maxchans, CFGINT, "NetStats", "Global", "MaxChans");
|
||||||
GetData((void *)&stats_network.t_chans, CFGINT, "NetStats", "Global", "MaxChansTime");
|
GetData((void *)&stats_network.t_chans, CFGINT, "NetStats", "Global", "MaxChansTime");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ok, now load the server stats */
|
/* ok, now load the server stats */
|
||||||
if (GetTableData("ServerStats", &row) > 0) {
|
if (GetTableData("ServerStats", &row) > 0) {
|
||||||
|
@ -195,52 +203,11 @@ void LoadStats() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(row);
|
free(row);
|
||||||
/* we now load channel data dynamically. */
|
|
||||||
/* ok, and now the channel stats. */
|
|
||||||
#if 0
|
|
||||||
if (GetTableData("ChanStats", &row) > 0) {
|
|
||||||
for (count = 0; row[count] != NULL; count++) {
|
|
||||||
load_chan(row[count]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c = malloc(sizeof(CStats));
|
|
||||||
strlcpy(c->name, row[count], CHANLEN);
|
|
||||||
GetData((void *)&c->topics, CFGINT, "ChanStats", c->name, "Topics");
|
|
||||||
GetData((void *)&c->totmem, CFGINT, "ChanStats", c->name, "TotalMems");
|
|
||||||
GetData((void *)&c->kicks, CFGINT, "ChanStats", c->name, "Kicks");
|
|
||||||
GetData((void *)&c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen");
|
|
||||||
GetData((void *)&c->maxmems, CFGINT, "ChanStats", c->name, "MaxMems");
|
|
||||||
GetData((void *)&c->t_maxmems, CFGINT, "ChanStats", c->name, "MaxMemsTime");
|
|
||||||
GetData((void *)&c->maxkicks, CFGINT, "ChanStats", c->name, "MaxKicks");
|
|
||||||
GetData((void *)&c->t_maxkicks, CFGINT, "ChanStats", c->name, "MaxKicksTime");
|
|
||||||
GetData((void *)&c->maxjoins, CFGINT, "ChanStats", c->name, "MaxJoins");
|
|
||||||
GetData((void *)&c->t_maxjoins, CFGINT, "ChanStats", c->name, "MaxJoinsTime");
|
|
||||||
c->topicstoday = 0;
|
|
||||||
c->joinstoday = 0;
|
|
||||||
c->members = 0;
|
|
||||||
cn = lnode_create(c);
|
|
||||||
if (list_isfull(Chead)) {
|
|
||||||
nlog(LOG_CRITICAL, LOG_MOD,
|
|
||||||
"Eeek, StatServ Channel Hash is Full!");
|
|
||||||
} else {
|
|
||||||
nlog(LOG_DEBUG2, LOG_MOD,
|
|
||||||
"Loading %s Channel Data", c->name);
|
|
||||||
if ((me.now - c->lastseen) < 604800) {
|
|
||||||
list_append(Chead, cn);
|
|
||||||
} else {
|
|
||||||
nlog(LOG_DEBUG1, LOG_MOD,
|
|
||||||
"Deleting Old Channel %s", c->name);
|
|
||||||
lnode_destroy(cn);
|
|
||||||
free(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(row);
|
|
||||||
#endif
|
|
||||||
StatServ.newdb = 0;
|
StatServ.newdb = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
|
|
||||||
/* @brief load the info for a specific channel from the database
|
/* @brief load the info for a specific channel from the database
|
||||||
* or return null a blank if it does not exist.
|
* or return null a blank if it does not exist.
|
||||||
*
|
*
|
||||||
|
@ -410,7 +377,7 @@ void DelOldChan()
|
||||||
free(row);
|
free(row);
|
||||||
nlog(LOG_INFO, LOG_MOD, "Took %d seconds to clean %d channel stats", (int)(time(NULL) - start), count);
|
nlog(LOG_INFO, LOG_MOD, "Took %d seconds to clean %d channel stats", (int)(time(NULL) - start), count);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* @brief This loads the old database format for statistics. This is depreciated and only
|
/* @brief This loads the old database format for statistics. This is depreciated and only
|
||||||
* retained for backwards compatibility with old DB formats. will go away one day.
|
* retained for backwards compatibility with old DB formats. will go away one day.
|
||||||
|
@ -419,18 +386,20 @@ void LoadOldStats()
|
||||||
{
|
{
|
||||||
FILE *fp = fopen("data/nstats.db", "r");
|
FILE *fp = fopen("data/nstats.db", "r");
|
||||||
SStats *s;
|
SStats *s;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
CStats *c;
|
CStats *c;
|
||||||
|
char *topics, *totmem, *kicks, *maxmems, *t_maxmems, *maxkicks,
|
||||||
|
*t_maxkicks, *maxjoins, *t_maxjoins;
|
||||||
|
int count;
|
||||||
|
#endif
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *name, *numsplits, *maxusers, *t_maxusers,
|
char *name, *numsplits, *maxusers, *t_maxusers,
|
||||||
*maxopers, *t_maxopers, *lastseen, *starttime,
|
*maxopers, *t_maxopers, *lastseen, *starttime,
|
||||||
*operkills, *serverkills, *totusers;
|
*operkills, *serverkills, *totusers;
|
||||||
char *topics, *totmem, *kicks, *maxmems, *t_maxmems, *maxkicks,
|
|
||||||
*t_maxkicks, *maxjoins, *t_maxjoins;
|
|
||||||
|
|
||||||
|
|
||||||
hnode_t *sn;
|
hnode_t *sn;
|
||||||
int count;
|
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
|
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
@ -455,12 +424,16 @@ void LoadOldStats()
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
nlog(LOG_NOTICE, LOG_MOD,
|
nlog(LOG_NOTICE, LOG_MOD,
|
||||||
"Detected Old version (3.0) of Network Database, Upgrading");
|
"Detected Old version (3.0) of Network Database, Upgrading");
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
stats_network.maxchans = 0;
|
stats_network.maxchans = 0;
|
||||||
stats_network.t_chans = me.now;
|
stats_network.t_chans = me.now;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
stats_network.maxchans = atol(tmp);
|
stats_network.maxchans = atol(tmp);
|
||||||
tmp = strtok(NULL, "");
|
tmp = strtok(NULL, "");
|
||||||
stats_network.t_chans = atol(tmp);
|
stats_network.t_chans = atol(tmp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StatServ.newdb = 0;
|
StatServ.newdb = 0;
|
||||||
|
@ -518,7 +491,7 @@ void LoadOldStats()
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
unlink("data/stats.db");
|
unlink("data/stats.db");
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
if ((fp = fopen("data/cstats.db", "r")) == NULL)
|
if ((fp = fopen("data/cstats.db", "r")) == NULL)
|
||||||
return;
|
return;
|
||||||
memset(buf, '\0', BUFSIZE);
|
memset(buf, '\0', BUFSIZE);
|
||||||
|
@ -560,24 +533,6 @@ void LoadOldStats()
|
||||||
save_chan(c);
|
save_chan(c);
|
||||||
}
|
}
|
||||||
free(c);
|
free(c);
|
||||||
#if 0
|
|
||||||
cn = lnode_create(c);
|
|
||||||
if (list_isfull(Chead)) {
|
|
||||||
nlog(LOG_CRITICAL, LOG_MOD,
|
|
||||||
"Eeek, StatServ Channel Hash is Full!");
|
|
||||||
} else {
|
|
||||||
nlog(LOG_DEBUG2, LOG_MOD,
|
|
||||||
"Loading %s Channel Data", c->name);
|
|
||||||
if ((me.now - c->lastseen) < 604800) {
|
|
||||||
list_append(Chead, cn);
|
|
||||||
} else {
|
|
||||||
nlog(LOG_DEBUG1, LOG_MOD,
|
|
||||||
"Deleting Old Channel %s", c->name);
|
|
||||||
lnode_destroy(cn);
|
|
||||||
free(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
free(name);
|
free(name);
|
||||||
free(topics);
|
free(topics);
|
||||||
|
@ -592,8 +547,6 @@ void LoadOldStats()
|
||||||
free(t_maxjoins);
|
free(t_maxjoins);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
unlink("data/cstats.db");
|
unlink("data/cstats.db");
|
||||||
|
#endif
|
||||||
SaveStats();
|
SaveStats();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,17 +32,21 @@
|
||||||
int bufsize;
|
int bufsize;
|
||||||
|
|
||||||
void get_map();
|
void get_map();
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
void get_top10chan();
|
void get_top10chan();
|
||||||
|
#endif
|
||||||
char *strnrepl(char *, int size, const char *old, const char *new);
|
char *strnrepl(char *, int size, const char *old, const char *new);
|
||||||
void put_copyright();
|
void put_copyright();
|
||||||
void get_srvlist();
|
void get_srvlist();
|
||||||
void get_srvlistdet();
|
void get_srvlistdet();
|
||||||
void get_netstats();
|
void get_netstats();
|
||||||
void get_dailystats();
|
void get_dailystats();
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
void get_chantops();
|
void get_chantops();
|
||||||
void get_chantop10();
|
void get_chantop10();
|
||||||
void get_chantop10eva();
|
void get_chantop10eva();
|
||||||
void get_unwelcomechan();
|
void get_unwelcomechan();
|
||||||
|
#endif
|
||||||
void get_clientstats();
|
void get_clientstats();
|
||||||
void get_title();
|
void get_title();
|
||||||
void get_tldmap();
|
void get_tldmap();
|
||||||
|
@ -85,7 +89,6 @@ void ss_html()
|
||||||
}
|
}
|
||||||
buf = malloc(STARTBUFSIZE * 2);
|
buf = malloc(STARTBUFSIZE * 2);
|
||||||
bufold = buf;
|
bufold = buf;
|
||||||
buf1 = malloc(STARTBUFSIZE * 2);
|
|
||||||
while (fgets(buf, STARTBUFSIZE, tpl)) {
|
while (fgets(buf, STARTBUFSIZE, tpl)) {
|
||||||
|
|
||||||
buf1 = strstr(buf, "!MAP!");
|
buf1 = strstr(buf, "!MAP!");
|
||||||
|
@ -133,6 +136,7 @@ void ss_html()
|
||||||
get_dailystats();
|
get_dailystats();
|
||||||
buf = buf1 + strlen("!DAILYSTATS!");
|
buf = buf1 + strlen("!DAILYSTATS!");
|
||||||
}
|
}
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
buf1 = strstr(buf, "!DAILYTOPCHAN!");
|
buf1 = strstr(buf, "!DAILYTOPCHAN!");
|
||||||
if (buf1) {
|
if (buf1) {
|
||||||
startstr = strlen(buf) - strlen(buf1);
|
startstr = strlen(buf) - strlen(buf1);
|
||||||
|
@ -161,6 +165,7 @@ void ss_html()
|
||||||
get_chantops();
|
get_chantops();
|
||||||
buf = buf1 + strlen("!TOP10TOPICS!");
|
buf = buf1 + strlen("!TOP10TOPICS!");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
buf1 = strstr(buf, "!TLDMAP!");
|
buf1 = strstr(buf, "!TLDMAP!");
|
||||||
if (buf1) {
|
if (buf1) {
|
||||||
startstr = strlen(buf) - strlen(buf1);
|
startstr = strlen(buf) - strlen(buf1);
|
||||||
|
@ -193,7 +198,6 @@ void ss_html()
|
||||||
|
|
||||||
fputs(buf, opf);
|
fputs(buf, opf);
|
||||||
}
|
}
|
||||||
free(buf1);
|
|
||||||
free(bufold);
|
free(bufold);
|
||||||
if (!gothtml) {
|
if (!gothtml) {
|
||||||
put_copyright();
|
put_copyright();
|
||||||
|
@ -319,11 +323,13 @@ void get_netstats()
|
||||||
fprintf(opf,
|
fprintf(opf,
|
||||||
"<tr><td colspan=2>Total Users Ever Connected</td><td colspan=2>%ld</td></tr>",
|
"<tr><td colspan=2>Total Users Ever Connected</td><td colspan=2>%ld</td></tr>",
|
||||||
stats_network.totusers);
|
stats_network.totusers);
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
fprintf(opf, "<tr><td>Current Channels: </td>\n");
|
fprintf(opf, "<tr><td>Current Channels: </td>\n");
|
||||||
fprintf(opf, "<td> %i </td>\n", (int)stats_network.chans);
|
fprintf(opf, "<td> %i </td>\n", (int)stats_network.chans);
|
||||||
fprintf(opf, "<td>Maximum Channels: </td>\n");
|
fprintf(opf, "<td>Maximum Channels: </td>\n");
|
||||||
fprintf(opf, "<td> %ld [%s] </td></tr>\n", stats_network.maxchans,
|
fprintf(opf, "<td> %ld [%s] </td></tr>\n", stats_network.maxchans,
|
||||||
sftime(stats_network.t_chans));
|
sftime(stats_network.t_chans));
|
||||||
|
#endif
|
||||||
fprintf(opf, "<tr><td>Current Opers: </td>\n");
|
fprintf(opf, "<tr><td>Current Opers: </td>\n");
|
||||||
fprintf(opf, "<td> %i </td>\n", (int)stats_network.opers);
|
fprintf(opf, "<td> %i </td>\n", (int)stats_network.opers);
|
||||||
fprintf(opf, "<td>Maximum Opers: </td>\n");
|
fprintf(opf, "<td>Maximum Opers: </td>\n");
|
||||||
|
@ -353,10 +359,12 @@ void get_dailystats()
|
||||||
"<tr><td colspan=\"2\">Total Users Connected:</td>\n");
|
"<tr><td colspan=\"2\">Total Users Connected:</td>\n");
|
||||||
fprintf(opf, "<td colspan=\"2\"> %-2d</td></tr>\n",
|
fprintf(opf, "<td colspan=\"2\"> %-2d</td></tr>\n",
|
||||||
daily.tot_users);
|
daily.tot_users);
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
fprintf(opf,
|
fprintf(opf,
|
||||||
"<tr><td colspan=\"2\">Max Channels:</td>\n");
|
"<tr><td colspan=\"2\">Max Channels:</td>\n");
|
||||||
fprintf(opf, "<td colspan=\"2\"> %-2ld</td></tr>\n",
|
fprintf(opf, "<td colspan=\"2\"> %-2ld</td></tr>\n",
|
||||||
(long)daily.chans);
|
(long)daily.chans);
|
||||||
|
#endif
|
||||||
fprintf(opf, "<tr><td colspan=\"2\">Max Daily Opers: </td>\n");
|
fprintf(opf, "<tr><td colspan=\"2\">Max Daily Opers: </td>\n");
|
||||||
fprintf(opf, "<td colspan=\"2\"> %-2d %s </td></tr>\n",
|
fprintf(opf, "<td colspan=\"2\"> %-2d %s </td></tr>\n",
|
||||||
daily.opers, sftime(daily.t_opers));
|
daily.opers, sftime(daily.t_opers));
|
||||||
|
@ -368,6 +376,8 @@ void get_dailystats()
|
||||||
fprintf(opf, "</tr></table>\n");
|
fprintf(opf, "</tr></table>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
|
|
||||||
void get_chantop10()
|
void get_chantop10()
|
||||||
{
|
{
|
||||||
CStats *cs;
|
CStats *cs;
|
||||||
|
@ -443,6 +453,7 @@ void get_chantop10eva()
|
||||||
}
|
}
|
||||||
fprintf(opf, "</table>");
|
fprintf(opf, "</table>");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
void get_clientstats()
|
void get_clientstats()
|
||||||
{
|
{
|
||||||
CVersions *cv;
|
CVersions *cv;
|
||||||
|
@ -494,7 +505,7 @@ void get_tldmap()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
void get_unwelcomechan()
|
void get_unwelcomechan()
|
||||||
{
|
{
|
||||||
CStats *cs;
|
CStats *cs;
|
||||||
|
@ -571,7 +582,7 @@ void get_chantops()
|
||||||
}
|
}
|
||||||
fprintf(opf, "</table>");
|
fprintf(opf, "</table>");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void get_map(char *uplink, int level)
|
void get_map(char *uplink, int level)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,4 +40,5 @@
|
||||||
#define Decreasemems(x) x->members--; x->lastseen = time(NULL);
|
#define Decreasemems(x) x->members--; x->lastseen = time(NULL);
|
||||||
#define IncreaseChans() stats_network.chans++;
|
#define IncreaseChans() stats_network.chans++;
|
||||||
#define DecreaseChans() stats_network.chans--;
|
#define DecreaseChans() stats_network.chans--;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,7 +50,7 @@ announce_record(const char *msg, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if(StatServ.recordalert < 0) {
|
if(StatServ.recordalert <= 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ announce_lag(const char *msg, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if(StatServ.lagalert < 0) {
|
if(StatServ.lagalert <= 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,12 +146,14 @@ int load_client_versions(void)
|
||||||
|
|
||||||
input = fopen("data/ssversions.dat", "rb");
|
input = fopen("data/ssversions.dat", "rb");
|
||||||
if(input) {
|
if(input) {
|
||||||
|
clientv = malloc(sizeof(CVersions));
|
||||||
|
fread(clientv, sizeof(CVersions), 1, input);
|
||||||
while(!feof(input)) {
|
while(!feof(input)) {
|
||||||
clientv = malloc(sizeof(CVersions));
|
|
||||||
fread(clientv, sizeof(CVersions), 1, input);
|
|
||||||
node = lnode_create(clientv);
|
node = lnode_create(clientv);
|
||||||
list_append(Vhead, node);
|
list_append(Vhead, node);
|
||||||
nlog(LOG_DEBUG2, LOG_MOD, "Loaded version %s", clientv->name);
|
nlog(LOG_DEBUG2, LOG_MOD, "Loaded version %s", clientv->name);
|
||||||
|
clientv = malloc(sizeof(CVersions));
|
||||||
|
fread(clientv, sizeof(CVersions), 1, input);
|
||||||
}
|
}
|
||||||
fclose(input);
|
fclose(input);
|
||||||
}
|
}
|
||||||
|
@ -183,6 +185,8 @@ int s_client_version(char **av, int ac)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
|
|
||||||
int s_chan_new(char **av, int ac)
|
int s_chan_new(char **av, int ac)
|
||||||
{
|
{
|
||||||
long count;
|
long count;
|
||||||
|
@ -360,6 +364,8 @@ CStats *AddChanStats(char *name)
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* chanstats */
|
||||||
int s_new_server(char **av, int ac)
|
int s_new_server(char **av, int ac)
|
||||||
{
|
{
|
||||||
Server *s;
|
Server *s;
|
||||||
|
@ -714,7 +720,7 @@ extern SStats *new_stats(const char *name)
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
nlog(LOG_CRITICAL, LOG_MOD, "Out of memory.");
|
nlog(LOG_CRITICAL, LOG_MOD, "Out of memory.");
|
||||||
FATAL_ERROR("Out of memory.")
|
FATAL_ERROR((char *)"Out of memory.")
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(s->name, name, MAXHOST);
|
memcpy(s->name, name, MAXHOST);
|
||||||
|
@ -780,8 +786,10 @@ SStats *findstats(char *name)
|
||||||
void Is_Midnight()
|
void Is_Midnight()
|
||||||
{
|
{
|
||||||
struct tm *ltm = localtime(&me.now);
|
struct tm *ltm = localtime(&me.now);
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
lnode_t *cn;
|
lnode_t *cn;
|
||||||
CStats *c;
|
CStats *c;
|
||||||
|
#endif
|
||||||
|
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
if (ltm->tm_hour == 0) {
|
if (ltm->tm_hour == 0) {
|
||||||
|
@ -797,9 +805,12 @@ void Is_Midnight()
|
||||||
daily.t_users = me.now;
|
daily.t_users = me.now;
|
||||||
daily.opers = stats_network.opers;
|
daily.opers = stats_network.opers;
|
||||||
daily.t_opers = me.now;
|
daily.t_opers = me.now;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
daily.chans = stats_network.chans;
|
daily.chans = stats_network.chans;
|
||||||
daily.t_chans = me.now;
|
daily.t_chans = me.now;
|
||||||
|
#endif
|
||||||
ResetTLD();
|
ResetTLD();
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
cn = list_first(Chead);
|
cn = list_first(Chead);
|
||||||
while (cn) {
|
while (cn) {
|
||||||
c = lnode_get(cn);
|
c = lnode_get(cn);
|
||||||
|
@ -810,7 +821,7 @@ void Is_Midnight()
|
||||||
c->t_maxmemtoday = me.now;
|
c->t_maxmemtoday = me.now;
|
||||||
cn = list_next(Chead, cn);
|
cn = list_next(Chead, cn);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
#include "sqlstats.h"
|
#include "sqlstats.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
static int ss_chans(User * u, char **av, int ac);
|
static int ss_chans(User * u, char **av, int ac);
|
||||||
|
#endif
|
||||||
static int ss_daily(User * u, char **av, int ac);
|
static int ss_daily(User * u, char **av, int ac);
|
||||||
static int ss_stats(User * u, char **av, int ac);
|
static int ss_stats(User * u, char **av, int ac);
|
||||||
static int ss_tld_map(User * u, char **av, int ac);
|
static int ss_tld_map(User * u, char **av, int ac);
|
||||||
|
@ -68,12 +70,14 @@ EventFnList __module_events[] = {
|
||||||
{EVENT_SIGNOFF, s_del_user},
|
{EVENT_SIGNOFF, s_del_user},
|
||||||
{EVENT_AWAY, s_user_away},
|
{EVENT_AWAY, s_user_away},
|
||||||
{EVENT_KILL, s_user_kill},
|
{EVENT_KILL, s_user_kill},
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
{EVENT_NEWCHAN, s_chan_new},
|
{EVENT_NEWCHAN, s_chan_new},
|
||||||
{EVENT_DELCHAN, s_chan_del},
|
{EVENT_DELCHAN, s_chan_del},
|
||||||
{EVENT_JOINCHAN, s_chan_join},
|
{EVENT_JOINCHAN, s_chan_join},
|
||||||
{EVENT_PARTCHAN, s_chan_part},
|
{EVENT_PARTCHAN, s_chan_part},
|
||||||
{EVENT_KICK, s_chan_kick},
|
{EVENT_KICK, s_chan_kick},
|
||||||
{EVENT_TOPICCHANGE, s_topic_change},
|
{EVENT_TOPICCHANGE, s_topic_change},
|
||||||
|
#endif
|
||||||
{EVENT_CLIENTVERSION, s_client_version},
|
{EVENT_CLIENTVERSION, s_client_version},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -132,7 +136,7 @@ static void ss_Config(void)
|
||||||
StatServ.htmlpath[0] = 0;
|
StatServ.htmlpath[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
/* assume that html is enabled if we don't have a setting for it */
|
/* assume that html is enabled if we don't have a setting for it */
|
||||||
if (GetConf((void *) &StatServ.html, CFGINT, "HTML_Enabled") < 0) {
|
if (GetConf((void *) &StatServ.html, CFGBOOL, "HTML_Enabled") < 0) {
|
||||||
StatServ.html = 1;
|
StatServ.html = 1;
|
||||||
}
|
}
|
||||||
strlcpy(StatServ.htmlpath, tmp, MAXPATH);
|
strlcpy(StatServ.htmlpath, tmp, MAXPATH);
|
||||||
|
@ -149,12 +153,14 @@ int __ModInit(int modnum, int apiver)
|
||||||
#ifdef SQLSRV
|
#ifdef SQLSRV
|
||||||
lnode_t *lnode;
|
lnode_t *lnode;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
int count, i;
|
int count, i;
|
||||||
Chans *c;
|
Chans *c;
|
||||||
char **av;
|
|
||||||
int ac = 0;
|
|
||||||
char *chan;
|
char *chan;
|
||||||
lnode_t *chanmem;
|
lnode_t *chanmem;
|
||||||
|
#endif
|
||||||
|
char **av;
|
||||||
|
int ac = 0;
|
||||||
|
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
|
|
||||||
|
@ -198,6 +204,7 @@ int __ModInit(int modnum, int apiver)
|
||||||
ac = 0;
|
ac = 0;
|
||||||
nlog(LOG_DEBUG2, LOG_CORE, "Add user %s to StatServ List", u->nick);
|
nlog(LOG_DEBUG2, LOG_CORE, "Add user %s to StatServ List", u->nick);
|
||||||
}
|
}
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
hash_scan_begin(&scan, ch);
|
hash_scan_begin(&scan, ch);
|
||||||
while ((node = hash_scan_next(&scan)) != NULL) {
|
while ((node = hash_scan_next(&scan)) != NULL) {
|
||||||
c = hnode_get(node);
|
c = hnode_get(node);
|
||||||
|
@ -224,7 +231,7 @@ int __ModInit(int modnum, int apiver)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef SQLSRV
|
#ifdef SQLSRV
|
||||||
/* ok, now export the server and chan data into the sql emulation layers */
|
/* ok, now export the server and chan data into the sql emulation layers */
|
||||||
|
|
||||||
|
@ -238,9 +245,10 @@ int __ModInit(int modnum, int apiver)
|
||||||
list_append(fakenetwork, lnode);
|
list_append(fakenetwork, lnode);
|
||||||
|
|
||||||
/* find the address of each list/hash, and export to rta */
|
/* find the address of each list/hash, and export to rta */
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
statserv_chans.address = Chead;
|
statserv_chans.address = Chead;
|
||||||
rta_add_table(&statserv_chans);
|
rta_add_table(&statserv_chans);
|
||||||
|
#endif
|
||||||
statserv_tld.address = Thead;
|
statserv_tld.address = Thead;
|
||||||
rta_add_table(&statserv_tld);
|
rta_add_table(&statserv_tld);
|
||||||
statserv_servers.address = Shead;
|
statserv_servers.address = Shead;
|
||||||
|
@ -281,7 +289,9 @@ bot_cmd ss_commands[]=
|
||||||
{"VERSION", ss_version, 0, 0, ss_help_version, ss_help_version_oneline},
|
{"VERSION", ss_version, 0, 0, ss_help_version, ss_help_version_oneline},
|
||||||
{"SERVER", ss_server, 0, 0, ss_help_server, ss_help_server_oneline},
|
{"SERVER", ss_server, 0, 0, ss_help_server, ss_help_server_oneline},
|
||||||
{"MAP", ss_map, 0, 0, ss_help_map, ss_help_map_oneline},
|
{"MAP", ss_map, 0, 0, ss_help_map, ss_help_map_oneline},
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
{"CHAN", ss_chans, 0, 0, ss_help_chan, ss_help_chan_oneline},
|
{"CHAN", ss_chans, 0, 0, ss_help_chan, ss_help_chan_oneline},
|
||||||
|
#endif
|
||||||
{"NETSTATS", ss_netstats, 0, 0, ss_help_netstats, ss_help_netstats_oneline},
|
{"NETSTATS", ss_netstats, 0, 0, ss_help_netstats, ss_help_netstats_oneline},
|
||||||
{"DAILY", ss_daily, 0, 0, ss_help_daily, ss_help_daily_oneline},
|
{"DAILY", ss_daily, 0, 0, ss_help_daily, ss_help_daily_oneline},
|
||||||
{"TLDMAP", ss_tld_map, 0, 0, ss_help_tldmap, ss_help_tldmap_oneline},
|
{"TLDMAP", ss_tld_map, 0, 0, ss_help_tldmap, ss_help_tldmap_oneline},
|
||||||
|
@ -312,6 +322,7 @@ bot_setting ss_settings[]=
|
||||||
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
|
{NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
int topchan(const void *key1, const void *key2)
|
int topchan(const void *key1, const void *key2)
|
||||||
{
|
{
|
||||||
const CStats *chan1 = key1;
|
const CStats *chan1 = key1;
|
||||||
|
@ -346,7 +357,7 @@ int topversions(const void *key1, const void *key2)
|
||||||
const CVersions *ver2 = key2;
|
const CVersions *ver2 = key2;
|
||||||
return (ver2->count - ver1->count);
|
return (ver2->count - ver1->count);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static int ss_clientversions(User * u, char **av, int ac)
|
static int ss_clientversions(User * u, char **av, int ac)
|
||||||
{
|
{
|
||||||
CVersions *cv;
|
CVersions *cv;
|
||||||
|
@ -371,7 +382,7 @@ static int ss_clientversions(User * u, char **av, int ac)
|
||||||
prefmsg(u->nick, s_StatServ, "Top%d Client Versions:", num);
|
prefmsg(u->nick, s_StatServ, "Top%d Client Versions:", num);
|
||||||
prefmsg(u->nick, s_StatServ, "======================");
|
prefmsg(u->nick, s_StatServ, "======================");
|
||||||
for (i = 0; i <= num; i++) {
|
for (i = 0; i <= num; i++) {
|
||||||
prefmsg(u->nick, s_StatServ, "%d) %d -> %s", i, cv->count, cv->name);
|
prefmsg(u->nick, s_StatServ, "%d) %d -> %s", i + 1, cv->count, cv->name);
|
||||||
cn = list_next(Vhead, cn);
|
cn = list_next(Vhead, cn);
|
||||||
if (cn) {
|
if (cn) {
|
||||||
cv = lnode_get(cn);
|
cv = lnode_get(cn);
|
||||||
|
@ -383,6 +394,7 @@ static int ss_clientversions(User * u, char **av, int ac)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
static int ss_chans(User * u, char **av, int ac)
|
static int ss_chans(User * u, char **av, int ac)
|
||||||
{
|
{
|
||||||
CStats *cs;
|
CStats *cs;
|
||||||
|
@ -553,7 +565,7 @@ static int ss_chans(User * u, char **av, int ac)
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif /* chans */
|
||||||
static int ss_tld_map(User * u, char **av, int ac)
|
static int ss_tld_map(User * u, char **av, int ac)
|
||||||
{
|
{
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
|
@ -590,9 +602,11 @@ static int ss_netstats(User * u, char **av, int ac)
|
||||||
stats_network.maxusers, sftime(stats_network.t_maxusers));
|
stats_network.maxusers, sftime(stats_network.t_maxusers));
|
||||||
prefmsg(u->nick, s_StatServ, "Total Users Connected: %ld",
|
prefmsg(u->nick, s_StatServ, "Total Users Connected: %ld",
|
||||||
stats_network.totusers);
|
stats_network.totusers);
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
prefmsg(u->nick, s_StatServ, "Current Channels %ld", stats_network.chans);
|
prefmsg(u->nick, s_StatServ, "Current Channels %ld", stats_network.chans);
|
||||||
prefmsg(u->nick, s_StatServ, "Maximum Channels %ld [%s]",
|
prefmsg(u->nick, s_StatServ, "Maximum Channels %ld [%s]",
|
||||||
stats_network.maxchans, sftime(stats_network.t_chans));
|
stats_network.maxchans, sftime(stats_network.t_chans));
|
||||||
|
#endif
|
||||||
prefmsg(u->nick, s_StatServ, "Current Opers: %ld",
|
prefmsg(u->nick, s_StatServ, "Current Opers: %ld",
|
||||||
stats_network.opers);
|
stats_network.opers);
|
||||||
prefmsg(u->nick, s_StatServ, "Maximum Opers: %ld [%s]",
|
prefmsg(u->nick, s_StatServ, "Maximum Opers: %ld [%s]",
|
||||||
|
@ -614,8 +628,10 @@ static int ss_daily(User * u, char **av, int ac)
|
||||||
daily.servers, sftime(daily.t_servers));
|
daily.servers, sftime(daily.t_servers));
|
||||||
prefmsg(u->nick, s_StatServ, "Maximum Users: %-2d %s", daily.users,
|
prefmsg(u->nick, s_StatServ, "Maximum Users: %-2d %s", daily.users,
|
||||||
sftime(daily.t_users));
|
sftime(daily.t_users));
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
prefmsg(u->nick, s_StatServ, "Maximum Chans: %-2d %s", daily.chans,
|
prefmsg(u->nick, s_StatServ, "Maximum Chans: %-2d %s", daily.chans,
|
||||||
sftime(daily.t_chans));
|
sftime(daily.t_chans));
|
||||||
|
#endif
|
||||||
prefmsg(u->nick, s_StatServ, "Maximum Opers: %-2d %s", daily.opers,
|
prefmsg(u->nick, s_StatServ, "Maximum Opers: %-2d %s", daily.opers,
|
||||||
sftime(daily.t_opers));
|
sftime(daily.t_opers));
|
||||||
prefmsg(u->nick, s_StatServ, "Total Users Connected: %-2d",
|
prefmsg(u->nick, s_StatServ, "Total Users Connected: %-2d",
|
||||||
|
|
|
@ -29,9 +29,19 @@
|
||||||
#include "neostats.h"
|
#include "neostats.h"
|
||||||
#include "m_stats.h"
|
#include "m_stats.h"
|
||||||
|
|
||||||
|
/* define this to enable channel tracking in statserv
|
||||||
|
* If NeoStats lags out with statserv enabled, channel tracking is most likely the cause
|
||||||
|
* so undefine this to improve performance
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STATSERV_DOCHANS 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
/* this is the max number of statserv channels our database can hold... */
|
/* this is the max number of statserv channels our database can hold... */
|
||||||
#define SS_CHAN_SIZE -1
|
#define SS_CHAN_SIZE -1
|
||||||
|
#endif
|
||||||
/* this is the how often to save a portion of the DB. Don't alter this unless you need to */
|
/* this is the how often to save a portion of the DB. Don't alter this unless you need to */
|
||||||
/* DO NOT set PROGCHANTIME less than ((DBSAVETIME + (DBSAVETIME/2)) * 4) otherwise you will not have the enitre database progressively saved! */
|
/* DO NOT set PROGCHANTIME less than ((DBSAVETIME + (DBSAVETIME/2)) * 4) otherwise you will not have the enitre database progressively saved! */
|
||||||
|
|
||||||
|
@ -46,16 +56,22 @@ extern ModuleInfo __module_info;
|
||||||
typedef struct tld_ TLD;
|
typedef struct tld_ TLD;
|
||||||
typedef struct region_ Region;
|
typedef struct region_ Region;
|
||||||
typedef struct server_stats SStats;
|
typedef struct server_stats SStats;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
typedef struct chan_stats CStats;
|
typedef struct chan_stats CStats;
|
||||||
|
#endif
|
||||||
typedef struct irc_client_version CVersions;
|
typedef struct irc_client_version CVersions;
|
||||||
hash_t *Shead;
|
hash_t *Shead;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
list_t *Chead;
|
list_t *Chead;
|
||||||
|
#endif
|
||||||
list_t *Thead;
|
list_t *Thead;
|
||||||
list_t *Vhead;
|
list_t *Vhead;
|
||||||
|
|
||||||
struct stats_network_ {
|
struct stats_network_ {
|
||||||
long opers;
|
long opers;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
long chans;
|
long chans;
|
||||||
|
#endif
|
||||||
long maxopers;
|
long maxopers;
|
||||||
long users;
|
long users;
|
||||||
long totusers;
|
long totusers;
|
||||||
|
@ -66,8 +82,10 @@ struct stats_network_ {
|
||||||
time_t t_maxopers;
|
time_t t_maxopers;
|
||||||
time_t t_maxusers;
|
time_t t_maxusers;
|
||||||
time_t t_maxservers;
|
time_t t_maxservers;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
long maxchans;
|
long maxchans;
|
||||||
time_t t_chans;
|
time_t t_chans;
|
||||||
|
#endif
|
||||||
} stats_network;
|
} stats_network;
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,6 +137,7 @@ struct irc_client_version {
|
||||||
int count;
|
int count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
struct chan_stats {
|
struct chan_stats {
|
||||||
char name[CHANLEN];
|
char name[CHANLEN];
|
||||||
long members;
|
long members;
|
||||||
|
@ -139,7 +158,7 @@ struct chan_stats {
|
||||||
time_t t_maxjoins;
|
time_t t_maxjoins;
|
||||||
time_t lastsave;
|
time_t lastsave;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
struct daily_ {
|
struct daily_ {
|
||||||
int servers;
|
int servers;
|
||||||
time_t t_servers;
|
time_t t_servers;
|
||||||
|
@ -148,8 +167,10 @@ struct daily_ {
|
||||||
int opers;
|
int opers;
|
||||||
time_t t_opers;
|
time_t t_opers;
|
||||||
int tot_users;
|
int tot_users;
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
int chans;
|
int chans;
|
||||||
time_t t_chans;
|
time_t t_chans;
|
||||||
|
#endif
|
||||||
} daily;
|
} daily;
|
||||||
|
|
||||||
struct tld_ {
|
struct tld_ {
|
||||||
|
@ -169,10 +190,12 @@ struct region_ {
|
||||||
|
|
||||||
/* statserv.c */
|
/* statserv.c */
|
||||||
void statserv(char *);
|
void statserv(char *);
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
int topchan(const void *key1, const void *key2);
|
int topchan(const void *key1, const void *key2);
|
||||||
int topjoin(const void *key1, const void *key2);
|
int topjoin(const void *key1, const void *key2);
|
||||||
int topkick(const void *key1, const void *key2);
|
int topkick(const void *key1, const void *key2);
|
||||||
int toptopics(const void *key1, const void *key2);
|
int toptopics(const void *key1, const void *key2);
|
||||||
|
#endif
|
||||||
int topversions(const void *key1, const void *key2);
|
int topversions(const void *key1, const void *key2);
|
||||||
/* stats.c */
|
/* stats.c */
|
||||||
int s_client_version(char **av, int ac);
|
int s_client_version(char **av, int ac);
|
||||||
|
@ -192,6 +215,7 @@ int s_new_user(char **av, int ac);
|
||||||
int s_del_user(char **av, int ac);
|
int s_del_user(char **av, int ac);
|
||||||
int s_user_modes(char **av, int ac);
|
int s_user_modes(char **av, int ac);
|
||||||
int s_user_kill(char **av, int ac);
|
int s_user_kill(char **av, int ac);
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
int s_chan_new(char **av, int ac);
|
int s_chan_new(char **av, int ac);
|
||||||
int s_chan_del(char **av, int ac);
|
int s_chan_del(char **av, int ac);
|
||||||
int s_chan_join(char **av, int ac);
|
int s_chan_join(char **av, int ac);
|
||||||
|
@ -203,11 +227,12 @@ CStats *AddChanStats(char *);
|
||||||
void DelOldChan();
|
void DelOldChan();
|
||||||
int s_topic_change(char **av, int ac);
|
int s_topic_change(char **av, int ac);
|
||||||
int s_chan_kick(char **av, int ac);
|
int s_chan_kick(char **av, int ac);
|
||||||
|
#endif /* chanstats */
|
||||||
/* database.c */
|
/* database.c */
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
void save_chan(CStats *c);
|
void save_chan(CStats *c);
|
||||||
CStats *load_chan(char *name);
|
CStats *load_chan(char *name);
|
||||||
|
#endif
|
||||||
/* ss_help.c */
|
/* ss_help.c */
|
||||||
extern const char *ss_help_about[];
|
extern const char *ss_help_about[];
|
||||||
extern const char *ss_help_server[];
|
extern const char *ss_help_server[];
|
||||||
|
@ -224,7 +249,9 @@ extern const char *ss_help_version[];
|
||||||
extern const char *ss_help_stats[];
|
extern const char *ss_help_stats[];
|
||||||
extern const char *ss_help_htmlstats[];
|
extern const char *ss_help_htmlstats[];
|
||||||
extern const char *ss_help_forcehtml[];
|
extern const char *ss_help_forcehtml[];
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
extern const char *ss_help_chan[];
|
extern const char *ss_help_chan[];
|
||||||
|
#endif
|
||||||
extern const char *ss_help_set_htmlpath[];
|
extern const char *ss_help_set_htmlpath[];
|
||||||
extern const char *ss_help_set_html[];
|
extern const char *ss_help_set_html[];
|
||||||
extern const char *ss_help_set_exclusions[];
|
extern const char *ss_help_set_exclusions[];
|
||||||
|
@ -239,7 +266,9 @@ extern const char ss_help_about_oneline[];
|
||||||
extern const char ss_help_version_oneline[];
|
extern const char ss_help_version_oneline[];
|
||||||
extern const char ss_help_server_oneline[];
|
extern const char ss_help_server_oneline[];
|
||||||
extern const char ss_help_map_oneline[];
|
extern const char ss_help_map_oneline[];
|
||||||
|
#ifdef STATSERV_DOCHANS
|
||||||
extern const char ss_help_chan_oneline[];
|
extern const char ss_help_chan_oneline[];
|
||||||
|
#endif
|
||||||
extern const char ss_help_netstats_oneline[];
|
extern const char ss_help_netstats_oneline[];
|
||||||
extern const char ss_help_daily_oneline[];
|
extern const char ss_help_daily_oneline[];
|
||||||
extern const char ss_help_tld_oneline[];
|
extern const char ss_help_tld_oneline[];
|
||||||
|
|
133
dns.c
133
dns.c
|
@ -44,12 +44,23 @@ adns_state ads;
|
||||||
struct dnslookup_struct {
|
struct dnslookup_struct {
|
||||||
adns_query q; /**< the ADNS query */
|
adns_query q; /**< the ADNS query */
|
||||||
adns_answer *a; /**< the ADNS result if we have completed */
|
adns_answer *a; /**< the ADNS result if we have completed */
|
||||||
|
adns_rrtype type; /**< the type we are looking for, only populated if we add to a queue */
|
||||||
char data[255]; /**< the User data based to the callback */
|
char data[255]; /**< the User data based to the callback */
|
||||||
|
char lookupdata[255]; /**< the look up data, only populated if we add to a queue */
|
||||||
void (*callback) (char *data, adns_answer * a);
|
void (*callback) (char *data, adns_answer * a);
|
||||||
/**< a function pointer to call when we have a result */
|
/**< a function pointer to call when we have a result */
|
||||||
char mod_name[MAX_MOD_NAME];
|
char mod_name[MAX_MOD_NAME];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DNSStats {
|
||||||
|
int totalq;
|
||||||
|
int maxqueued;
|
||||||
|
int totalqueued;
|
||||||
|
int success;
|
||||||
|
int failure;
|
||||||
|
} DNSStats;
|
||||||
|
|
||||||
|
|
||||||
/** @brief DNS structures
|
/** @brief DNS structures
|
||||||
*/
|
*/
|
||||||
typedef struct dnslookup_struct DnsLookup;
|
typedef struct dnslookup_struct DnsLookup;
|
||||||
|
@ -59,6 +70,13 @@ typedef struct dnslookup_struct DnsLookup;
|
||||||
*/
|
*/
|
||||||
list_t *dnslist;
|
list_t *dnslist;
|
||||||
|
|
||||||
|
/** @brief list of DNS queries that are queued up
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
list_t *dnsqueue;
|
||||||
|
|
||||||
|
|
||||||
|
void dns_check_queue();
|
||||||
|
|
||||||
/** @brief starts a DNS lookup
|
/** @brief starts a DNS lookup
|
||||||
*
|
*
|
||||||
|
@ -82,13 +100,12 @@ dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answ
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
|
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
if (list_isfull (dnslist)) {
|
|
||||||
nlog (LOG_ERROR, LOG_CORE, "DNS: Lookup list is full");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
dnsdata = malloc (sizeof (DnsLookup));
|
dnsdata = malloc (sizeof (DnsLookup));
|
||||||
|
DNSStats.totalq++;
|
||||||
if (!dnsdata) {
|
if (!dnsdata) {
|
||||||
nlog (LOG_CRITICAL, LOG_CORE, "DNS: Out of Memory");
|
nlog (LOG_CRITICAL, LOG_CORE, "DNS: Out of Memory");
|
||||||
|
DNSStats.failure++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* set the module name */
|
/* set the module name */
|
||||||
|
@ -96,9 +113,26 @@ dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answ
|
||||||
if (segv_inmodule[0]) {
|
if (segv_inmodule[0]) {
|
||||||
/* why MAXHOST? because thats the size of mod_name!?!? */
|
/* why MAXHOST? because thats the size of mod_name!?!? */
|
||||||
strlcpy(dnsdata->mod_name, segv_inmodule, MAX_MOD_NAME);
|
strlcpy(dnsdata->mod_name, segv_inmodule, MAX_MOD_NAME);
|
||||||
|
} else {
|
||||||
|
strlcpy(dnsdata->mod_name, "NeoStats", MAX_MOD_NAME);
|
||||||
}
|
}
|
||||||
strlcpy (dnsdata->data, data, 254);
|
strlcpy (dnsdata->data, data, 254);
|
||||||
dnsdata->callback = callback;
|
dnsdata->callback = callback;
|
||||||
|
dnsdata->type = type;
|
||||||
|
|
||||||
|
if (list_isfull (dnslist)) {
|
||||||
|
nlog (LOG_DEBUG1, LOG_CORE, "DNS: Lookup list is full, adding to queue");
|
||||||
|
strlcpy(dnsdata->lookupdata, str, 254);
|
||||||
|
dnsnode = lnode_create (dnsdata);
|
||||||
|
list_append (dnsqueue, dnsnode);
|
||||||
|
DNSStats.totalqueued++;
|
||||||
|
if (list_count(dnsqueue) > DNSStats.maxqueued) {
|
||||||
|
DNSStats.maxqueued = list_count(dnsqueue);
|
||||||
|
}
|
||||||
|
return NS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (type == adns_r_ptr) {
|
if (type == adns_r_ptr) {
|
||||||
sa.sin_family = AF_INET;
|
sa.sin_family = AF_INET;
|
||||||
sa.sin_addr.s_addr = inet_addr (str);
|
sa.sin_addr.s_addr = inet_addr (str);
|
||||||
|
@ -109,6 +143,7 @@ dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answ
|
||||||
if (status) {
|
if (status) {
|
||||||
nlog (LOG_WARNING, LOG_CORE, "DNS: adns_submit error: %s", strerror (status));
|
nlog (LOG_WARNING, LOG_CORE, "DNS: adns_submit error: %s", strerror (status));
|
||||||
free (dnsdata);
|
free (dnsdata);
|
||||||
|
DNSStats.failure++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +172,10 @@ init_dns ()
|
||||||
dnslist = list_create (DNS_QUEUE_SIZE);
|
dnslist = list_create (DNS_QUEUE_SIZE);
|
||||||
if (!dnslist)
|
if (!dnslist)
|
||||||
return NS_FAILURE;
|
return NS_FAILURE;
|
||||||
|
/* dnsqueue is unlimited. */
|
||||||
|
dnsqueue = list_create(-1);
|
||||||
|
if (!dnsqueue)
|
||||||
|
return NS_FAILURE;
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
adnsstart = adns_init (&ads, adns_if_noerrprint | adns_if_noautosys, 0);
|
adnsstart = adns_init (&ads, adns_if_noerrprint | adns_if_noautosys, 0);
|
||||||
#else
|
#else
|
||||||
|
@ -169,6 +208,12 @@ fini_adns() {
|
||||||
free (dnsdata);
|
free (dnsdata);
|
||||||
}
|
}
|
||||||
list_destroy_nodes(dnslist);
|
list_destroy_nodes(dnslist);
|
||||||
|
dnsnode = list_first(dnsqueue);
|
||||||
|
while (dnsnode) {
|
||||||
|
dnsdata = lnode_get(dnsnode);
|
||||||
|
free(dnsdata);
|
||||||
|
}
|
||||||
|
list_destroy_nodes(dnsqueue);
|
||||||
free(ads);
|
free(ads);
|
||||||
}
|
}
|
||||||
/** @brief Canx any DNS queries for modules we might be unloading
|
/** @brief Canx any DNS queries for modules we might be unloading
|
||||||
|
@ -196,6 +241,18 @@ canx_dns(const char *modname) {
|
||||||
dnsnode = lnode2;
|
dnsnode = lnode2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dnsnode = list_first(dnsqueue);
|
||||||
|
while (dnsnode) {
|
||||||
|
dnsdata = lnode_get(dnsnode);
|
||||||
|
if (!ircstrcasecmp(dnsdata->mod_name, modname)) {
|
||||||
|
free(dnsdata);
|
||||||
|
lnode2 = list_next(dnsqueue, dnsnode);
|
||||||
|
list_delete(dnsqueue, dnsnode);
|
||||||
|
lnode_destroy(dnsnode);
|
||||||
|
dnsnode = lnode2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dns_check_queue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,8 +275,10 @@ do_dns ()
|
||||||
|
|
||||||
SET_SEGV_LOCATION();
|
SET_SEGV_LOCATION();
|
||||||
/* if the list is empty, no use doing anything */
|
/* if the list is empty, no use doing anything */
|
||||||
if (list_isempty (dnslist))
|
if (list_isempty (dnslist)) {
|
||||||
|
dns_check_queue();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dnsnode = list_first (dnslist);
|
dnsnode = list_first (dnslist);
|
||||||
while (dnsnode) {
|
while (dnsnode) {
|
||||||
|
@ -236,7 +295,8 @@ do_dns ()
|
||||||
if (status) {
|
if (status) {
|
||||||
nlog (LOG_CRITICAL, LOG_CORE, "DNS: Baaaad error on adns_check: %s. Please report to NeoStats Group", strerror (status));
|
nlog (LOG_CRITICAL, LOG_CORE, "DNS: Baaaad error on adns_check: %s. Please report to NeoStats Group", strerror (status));
|
||||||
chanalert (s_Services, "Bad Error on DNS lookup. Please check logfile");
|
chanalert (s_Services, "Bad Error on DNS lookup. Please check logfile");
|
||||||
|
DNSStats.failure++;
|
||||||
|
|
||||||
/* set this so nlog works good */
|
/* set this so nlog works good */
|
||||||
SET_SEGV_INMODULE(dnsdata->mod_name);
|
SET_SEGV_INMODULE(dnsdata->mod_name);
|
||||||
/* call the callback function with answer set to NULL */
|
/* call the callback function with answer set to NULL */
|
||||||
|
@ -251,6 +311,7 @@ do_dns ()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nlog (LOG_DEBUG1, LOG_CORE, "DNS: Calling callback function with data %s for module %s", dnsdata->data, dnsdata->mod_name);
|
nlog (LOG_DEBUG1, LOG_CORE, "DNS: Calling callback function with data %s for module %s", dnsdata->data, dnsdata->mod_name);
|
||||||
|
DNSStats.success++;
|
||||||
SET_SEGV_INMODULE(dnsdata->mod_name);
|
SET_SEGV_INMODULE(dnsdata->mod_name);
|
||||||
/* call the callback function */
|
/* call the callback function */
|
||||||
dnsdata->callback (dnsdata->data, dnsdata->a);
|
dnsdata->callback (dnsdata->data, dnsdata->a);
|
||||||
|
@ -262,5 +323,63 @@ do_dns ()
|
||||||
free (dnsdata);
|
free (dnsdata);
|
||||||
lnode_destroy (dnsnode1);
|
lnode_destroy (dnsnode1);
|
||||||
}
|
}
|
||||||
|
dns_check_queue();
|
||||||
|
}
|
||||||
|
/** @breif Checks the DNS queue and if we can
|
||||||
|
* add new queries to the active DNS queries and remove from Queue
|
||||||
|
*/
|
||||||
|
void dns_check_queue() {
|
||||||
|
lnode_t *dnsnode, *dnsnode2;
|
||||||
|
DnsLookup *dnsdata;
|
||||||
|
struct sockaddr_in sa;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
/* first, if the DNSLIST is full, just exit straight away */
|
||||||
|
if (list_isfull(dnslist)) {
|
||||||
|
nlog(LOG_DEBUG2, LOG_CORE, "DNS list is still full. Can't work on queue");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* if the dnsqueue isn't empty, then lets process some more till we are full again */
|
||||||
|
if (!list_isempty(dnsqueue)) {
|
||||||
|
dnsnode = list_first(dnsqueue);
|
||||||
|
while ((dnsnode) && (!list_isfull(dnslist))) {
|
||||||
|
dnsdata = lnode_get(dnsnode);
|
||||||
|
nlog(LOG_DEBUG2, LOG_CORE, "Moving DNS query %s from queue to active", dnsdata->data);
|
||||||
|
if (dnsdata->type == adns_r_ptr) {
|
||||||
|
sa.sin_family = AF_INET;
|
||||||
|
sa.sin_addr.s_addr = inet_addr (dnsdata->lookupdata);
|
||||||
|
status = adns_submit_reverse (ads, (const struct sockaddr *) &sa, dnsdata->type, adns_qf_owner | adns_qf_cname_loose, NULL, &dnsdata->q);
|
||||||
|
} else {
|
||||||
|
status = adns_submit (ads, dnsdata->lookupdata, dnsdata->type, adns_qf_owner | adns_qf_cname_loose, NULL, &dnsdata->q);
|
||||||
|
}
|
||||||
|
if (status) {
|
||||||
|
/* delete from queue and delete node */
|
||||||
|
nlog (LOG_WARNING, LOG_CORE, "DNS: adns_submit error: %s", strerror (status));
|
||||||
|
free (dnsdata);
|
||||||
|
dnsnode2 = dnsnode;
|
||||||
|
dnsnode = list_next(dnsqueue, dnsnode);
|
||||||
|
list_delete(dnsqueue, dnsnode2);
|
||||||
|
lnode_destroy(dnsnode2);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* move from queue to active list */
|
||||||
|
dnsnode2 = dnsnode;
|
||||||
|
dnsnode = list_next(dnsqueue, dnsnode);
|
||||||
|
list_delete(dnsqueue, dnsnode2);
|
||||||
|
list_append(dnslist, dnsnode2);
|
||||||
|
nlog (LOG_DEBUG1, LOG_CORE, "DNS: Added dns query %s to list", dnsdata->data);
|
||||||
|
/* while loop */
|
||||||
|
}
|
||||||
|
/* isempty */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void do_dns_stats_Z(User *u) {
|
||||||
|
numeric (RPL_MEMSTATS, u->nick, "Active DNS queries: %d", (int) list_count(dnslist));
|
||||||
|
numeric (RPL_MEMSTATS, u->nick, "Queued DNS Queries: %d", (int) list_count(dnsqueue));
|
||||||
|
numeric (RPL_MEMSTATS, u->nick, "Max Queued Queries: %d", DNSStats.maxqueued);
|
||||||
|
numeric (RPL_MEMSTATS, u->nick, "Total DNS Questions: %d", DNSStats.totalq);
|
||||||
|
numeric (RPL_MEMSTATS, u->nick, "SuccessFull Lookups: %d", DNSStats.success);
|
||||||
|
numeric (RPL_MEMSTATS, u->nick, "Un-Successfull Lookups: %d", DNSStats.failure);
|
||||||
}
|
}
|
||||||
|
|
1
dns.h
1
dns.h
|
@ -28,4 +28,5 @@ int init_dns (void);
|
||||||
void do_dns (void);
|
void do_dns (void);
|
||||||
void fini_adns();
|
void fini_adns();
|
||||||
void canx_dns(const char *modname);
|
void canx_dns(const char *modname);
|
||||||
|
void do_dns_stats_Z(User *);
|
||||||
#endif /* _DNS_H_ */
|
#endif /* _DNS_H_ */
|
||||||
|
|
|
@ -383,7 +383,7 @@ config_read (char *fname, config_option * options)
|
||||||
char *dc_env; /* pointer to DC_INCLUDEPATH */
|
char *dc_env; /* pointer to DC_INCLUDEPATH */
|
||||||
|
|
||||||
if (access (fname, R_OK)) {
|
if (access (fname, R_OK)) {
|
||||||
fprintf (stderr, "Error opening configuration file '%s'\n", fname);
|
fprintf (stderr, "Error opening configuration file '%s/%s'\n", NEO_PREFIX, fname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,12 +63,14 @@ int init_exclude_list() {
|
||||||
bzero(e, sizeof(excludes));
|
bzero(e, sizeof(excludes));
|
||||||
if (GetData((void *)&tmp, CFGSTR, "Exclusions", row[i], "Pattern") > 0) {
|
if (GetData((void *)&tmp, CFGSTR, "Exclusions", row[i], "Pattern") > 0) {
|
||||||
strlcpy(e->pattern, tmp, MAXHOST);
|
strlcpy(e->pattern, tmp, MAXHOST);
|
||||||
|
free (tmp);
|
||||||
} else {
|
} else {
|
||||||
nlog(LOG_WARNING, LOG_CORE, "Exclusions: Can't add entry %s, Pattern invalid", row[i]);
|
nlog(LOG_WARNING, LOG_CORE, "Exclusions: Can't add entry %s, Pattern invalid", row[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (GetData((void *)&tmp, CFGSTR, "Exclusions", row[i], "AddedBy") > 0) {
|
if (GetData((void *)&tmp, CFGSTR, "Exclusions", row[i], "AddedBy") > 0) {
|
||||||
strlcpy(e->addedby, tmp, MAXNICK);
|
strlcpy(e->addedby, tmp, MAXNICK);
|
||||||
|
free (tmp);
|
||||||
}
|
}
|
||||||
e->addedon = atoi(row[i]);
|
e->addedon = atoi(row[i]);
|
||||||
GetData((void *)&e->type, CFGINT, "Exclusions", row[i], "Type");
|
GetData((void *)&e->type, CFGINT, "Exclusions", row[i], "Type");
|
||||||
|
@ -234,7 +236,7 @@ void ns_do_exclude_user(User *u) {
|
||||||
/* first thing we check is the server flag. if the server
|
/* first thing we check is the server flag. if the server
|
||||||
* is excluded, then the user is excluded as well
|
* is excluded, then the user is excluded as well
|
||||||
*/
|
*/
|
||||||
if (u->server->flags && NS_FLAGS_EXCLUDED) {
|
if (u->server->flags & NS_FLAGS_EXCLUDED) {
|
||||||
u->flags |= NS_FLAGS_EXCLUDED;
|
u->flags |= NS_FLAGS_EXCLUDED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +268,6 @@ void ns_do_exclude_user(User *u) {
|
||||||
void ns_do_exclude_server(Server *s) {
|
void ns_do_exclude_server(Server *s) {
|
||||||
lnode_t *en;
|
lnode_t *en;
|
||||||
excludes *e;
|
excludes *e;
|
||||||
|
|
||||||
en = list_first(exclude_list);
|
en = list_first(exclude_list);
|
||||||
while (en != NULL) {
|
while (en != NULL) {
|
||||||
e = lnode_get(en);
|
e = lnode_get(en);
|
||||||
|
@ -280,6 +281,7 @@ void ns_do_exclude_server(Server *s) {
|
||||||
}
|
}
|
||||||
/* if we are here, there is no match */
|
/* if we are here, there is no match */
|
||||||
s->flags &= ~NS_FLAGS_EXCLUDED;
|
s->flags &= ~NS_FLAGS_EXCLUDED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ send_join (const char *sender, const char *who, const char *chan, const unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
38
ircd.c
38
ircd.c
|
@ -35,6 +35,7 @@
|
||||||
#include "services.h"
|
#include "services.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "bans.h"
|
#include "bans.h"
|
||||||
|
#include "dns.h"
|
||||||
|
|
||||||
ircd_server ircd_srv;
|
ircd_server ircd_srv;
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ static char UmodeStringBuf[64];
|
||||||
#ifdef GOTUSERSMODES
|
#ifdef GOTUSERSMODES
|
||||||
static char SmodeStringBuf[64];
|
static char SmodeStringBuf[64];
|
||||||
#endif
|
#endif
|
||||||
static long services_bot_umode= 0;
|
long services_bot_umode= 0;
|
||||||
|
|
||||||
/* Fully split buffer */
|
/* Fully split buffer */
|
||||||
static char privmsgbuffer[BUFSIZE];
|
static char privmsgbuffer[BUFSIZE];
|
||||||
|
@ -600,6 +601,8 @@ m_private (char* origin, char **av, int ac, int cmdptr)
|
||||||
}
|
}
|
||||||
if(av[0][0] == '#') {
|
if(av[0][0] == '#') {
|
||||||
bot_chan_message (origin, argv, argc);
|
bot_chan_message (origin, argv, argc);
|
||||||
|
/* we need this to fool the check below */
|
||||||
|
ret = NS_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
ret = bot_message (origin, argv, argc);
|
ret = bot_message (origin, argv, argc);
|
||||||
}
|
}
|
||||||
|
@ -996,6 +999,10 @@ do_stats (const char* nick, const char *what)
|
||||||
if (cmd_list[i].usage > 0)
|
if (cmd_list[i].usage > 0)
|
||||||
numeric (RPL_STATSCOMMANDS, u->nick, "Command %s Usage %d", cmd_list[i].name, cmd_list[i].usage);
|
numeric (RPL_STATSCOMMANDS, u->nick, "Command %s Usage %d", cmd_list[i].name, cmd_list[i].usage);
|
||||||
}
|
}
|
||||||
|
} else if (!ircstrcasecmp(what, "Z")) {
|
||||||
|
if (UserLevel(u) >= NS_ULEVEL_ADMIN) {
|
||||||
|
do_dns_stats_Z(u);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
numeric (RPL_ENDOFSTATS, u->nick, "%s :End of /STATS report", what);
|
numeric (RPL_ENDOFSTATS, u->nick, "%s :End of /STATS report", what);
|
||||||
chanalert (s_Services, "%s Requested Stats %s", u->nick, what);
|
chanalert (s_Services, "%s Requested Stats %s", u->nick, what);
|
||||||
|
@ -1022,6 +1029,16 @@ do_protocol (char *origin, char **argv, int argc)
|
||||||
if (!ircstrcasecmp ("UNKLN", argv[i])) {
|
if (!ircstrcasecmp ("UNKLN", argv[i])) {
|
||||||
ircd_srv.unkline = 1;
|
ircd_srv.unkline = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef GOTNOQUITSUPPORT
|
||||||
|
if (!ircstrcasecmp ("NOQUIT", argv[i])) {
|
||||||
|
ircd_srv.noquit = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef UNREAL32
|
||||||
|
if (!ircstrcasecmp ("NICKIP", argv[i])) {
|
||||||
|
ircd_srv.nickip = 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1462,7 +1479,12 @@ ssjoin_cmd (const char *who, const char *chan, unsigned long chflag)
|
||||||
flag = ' ';
|
flag = ' ';
|
||||||
mode= '\0';
|
mode= '\0';
|
||||||
}
|
}
|
||||||
send_sjoin (me.name, who, chan, flag, (unsigned long)ts);
|
if (mode == 0) {
|
||||||
|
ircsnprintf (ircd_buf, BUFSIZE, "%s", who);
|
||||||
|
} else {
|
||||||
|
ircsnprintf (ircd_buf, BUFSIZE, "%c%s", flag, who);
|
||||||
|
}
|
||||||
|
send_sjoin (me.name, ircd_buf, chan, (unsigned long)ts);
|
||||||
join_chan (who, chan);
|
join_chan (who, chan);
|
||||||
ircsnprintf (ircd_buf, BUFSIZE, "%s +%c %s", chan, mode, who);
|
ircsnprintf (ircd_buf, BUFSIZE, "%s +%c %s", chan, mode, who);
|
||||||
ac = split_buf (ircd_buf, &av, 0);
|
ac = split_buf (ircd_buf, &av, 0);
|
||||||
|
@ -1642,7 +1664,7 @@ do_netinfo(const char* maxglobalcnt, const char* tsendsync, const char* prot, co
|
||||||
ircd_srv.maxglobalcnt = atoi (maxglobalcnt);
|
ircd_srv.maxglobalcnt = atoi (maxglobalcnt);
|
||||||
ircd_srv.tsendsync = atoi (tsendsync);
|
ircd_srv.tsendsync = atoi (tsendsync);
|
||||||
ircd_srv.uprot = atoi (prot);
|
ircd_srv.uprot = atoi (prot);
|
||||||
strlcpy (ircd_srv.cloak, cloak, 10);
|
strlcpy (ircd_srv.cloak, cloak, CLOAKKEYLEN);
|
||||||
strlcpy (me.netname, netname, MAXPASS);
|
strlcpy (me.netname, netname, MAXPASS);
|
||||||
send_netinfo (me.name, ircd_srv.uprot, ircd_srv.cloak, me.netname, me.now);
|
send_netinfo (me.name, ircd_srv.uprot, ircd_srv.cloak, me.netname, me.now);
|
||||||
init_services_bot ();
|
init_services_bot ();
|
||||||
|
@ -1657,7 +1679,7 @@ void
|
||||||
do_snetinfo(const char* maxglobalcnt, const char* tsendsync, const char* prot, const char* cloak, const char* netname)
|
do_snetinfo(const char* maxglobalcnt, const char* tsendsync, const char* prot, const char* cloak, const char* netname)
|
||||||
{
|
{
|
||||||
ircd_srv.uprot = atoi (prot);
|
ircd_srv.uprot = atoi (prot);
|
||||||
strlcpy (ircd_srv.cloak, cloak, 10);
|
strlcpy (ircd_srv.cloak, cloak, CLOAKKEYLEN);
|
||||||
strlcpy (me.netname, netname, MAXPASS);
|
strlcpy (me.netname, netname, MAXPASS);
|
||||||
send_snetinfo (me.name, ircd_srv.uprot, ircd_srv.cloak, me.netname, me.now);
|
send_snetinfo (me.name, ircd_srv.uprot, ircd_srv.cloak, me.netname, me.now);
|
||||||
init_services_bot ();
|
init_services_bot ();
|
||||||
|
@ -1796,7 +1818,7 @@ do_svsmode_user (const char* nick, const char* modes, const char* ts)
|
||||||
char modebuf[MODESIZE];
|
char modebuf[MODESIZE];
|
||||||
|
|
||||||
if (ts && isdigit(*ts)) {
|
if (ts && isdigit(*ts)) {
|
||||||
char* pModes;
|
const char* pModes;
|
||||||
char* pNewModes;
|
char* pNewModes;
|
||||||
|
|
||||||
SetUserServicesTS (nick, ts);
|
SetUserServicesTS (nick, ts);
|
||||||
|
@ -1807,7 +1829,7 @@ do_svsmode_user (const char* nick, const char* modes, const char* ts)
|
||||||
}
|
}
|
||||||
/* We need to strip the d from the mode string */
|
/* We need to strip the d from the mode string */
|
||||||
pNewModes = modebuf;
|
pNewModes = modebuf;
|
||||||
pModes = modebuf;
|
pModes = modes;
|
||||||
while(*pModes) {
|
while(*pModes) {
|
||||||
if(*pModes != 'd') {
|
if(*pModes != 'd') {
|
||||||
*pNewModes = *pModes;
|
*pNewModes = *pModes;
|
||||||
|
@ -1856,8 +1878,8 @@ do_topic (const char* chan, const char *owner, const char* ts, const char *topic
|
||||||
void
|
void
|
||||||
do_server (const char *name, const char *uplink, const char* hops, const char *numeric, const char *infoline, int srv)
|
do_server (const char *name, const char *uplink, const char* hops, const char *numeric, const char *infoline, int srv)
|
||||||
{
|
{
|
||||||
if(!srv) {
|
if(srv == 0) {
|
||||||
if (*uplink == 0) {
|
if (uplink == NULL || *uplink == 0) {
|
||||||
me.s = AddServer (name, me.name, hops, numeric, infoline);
|
me.s = AddServer (name, me.name, hops, numeric, infoline);
|
||||||
} else {
|
} else {
|
||||||
me.s = AddServer (name, uplink, hops, numeric, infoline);
|
me.s = AddServer (name, uplink, hops, numeric, infoline);
|
||||||
|
|
7
ircd.h
7
ircd.h
|
@ -55,10 +55,13 @@ typedef struct ircd_server {
|
||||||
int modex;
|
int modex;
|
||||||
int nicklen;
|
int nicklen;
|
||||||
int gc;
|
int gc;
|
||||||
char cloak[25];
|
int nickip;
|
||||||
|
/* unreal cloak keys are md5, so we need at least 34+1 */
|
||||||
|
char cloak[CLOAKKEYLEN];
|
||||||
int maxglobalcnt;
|
int maxglobalcnt;
|
||||||
int tsendsync;
|
int tsendsync;
|
||||||
unsigned int token:1;
|
unsigned int token:1;
|
||||||
|
unsigned int noquit;
|
||||||
} ircd_server;
|
} ircd_server;
|
||||||
|
|
||||||
extern UserModes user_umodes[];
|
extern UserModes user_umodes[];
|
||||||
|
@ -155,7 +158,7 @@ void send_wallops (const char *who, const char *buf);
|
||||||
void send_numeric (const char *from, const int numeric, const char *target, const char *buf);
|
void send_numeric (const char *from, const int numeric, const char *target, const char *buf);
|
||||||
void send_umode (const char *who, const char *target, const char *mode);
|
void send_umode (const char *who, const char *target, const char *mode);
|
||||||
void send_join (const char *sender, const char *who, const char *chan, const unsigned long ts);
|
void send_join (const char *sender, const char *who, const char *chan, const unsigned long ts);
|
||||||
void send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts);
|
void send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts);
|
||||||
void send_part (const char *who, const char *chan);
|
void send_part (const char *who, const char *chan);
|
||||||
void send_nickchange (const char *oldnick, const char *newnick, const unsigned long ts);
|
void send_nickchange (const char *oldnick, const char *newnick, const unsigned long ts);
|
||||||
void send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts);
|
void send_cmode (const char *sender, const char *who, const char *chan, const char *mode, const char *args, unsigned long ts);
|
||||||
|
|
22
ircstring.c
22
ircstring.c
|
@ -39,7 +39,7 @@
|
||||||
#define __attribute__(x) /* NOTHING */
|
#define __attribute__(x) /* NOTHING */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include "ircstring.h"
|
#include "stats.h"
|
||||||
|
|
||||||
/* buffer for itoa conversion
|
/* buffer for itoa conversion
|
||||||
* int ranges from
|
* int ranges from
|
||||||
|
@ -63,16 +63,15 @@ static char nullstring[]="(null)";
|
||||||
*/
|
*/
|
||||||
int ircvsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
int ircvsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
#if 0
|
va_list saveargs;
|
||||||
return vsnprintf(buf, size, fmt, args);
|
|
||||||
#else
|
|
||||||
va_list saveargs=args;
|
|
||||||
size_t len=0;
|
size_t len=0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char *str;
|
char *str;
|
||||||
char c;
|
char c;
|
||||||
const char *format=fmt;
|
const char *format=fmt;
|
||||||
|
|
||||||
|
/* save args in case we need to call vsnprintf */
|
||||||
|
va_copy( saveargs, args );
|
||||||
while((c = *format++)!=0 && (len<size) ) {
|
while((c = *format++)!=0 && (len<size) ) {
|
||||||
/* Is it a format string character? */
|
/* Is it a format string character? */
|
||||||
if(c == '%') {
|
if(c == '%') {
|
||||||
|
@ -138,7 +137,6 @@ int ircvsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
||||||
}
|
}
|
||||||
/* return count chars written */
|
/* return count chars written */
|
||||||
return len;
|
return len;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @brief optimised vsprintf replacement
|
/* @brief optimised vsprintf replacement
|
||||||
|
@ -239,6 +237,10 @@ static const unsigned char irctolowertable[256] = {
|
||||||
int
|
int
|
||||||
ircstrcasecmp(const char *s1, const char *s2)
|
ircstrcasecmp(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
|
/* How should we handle nulls... hmmm */
|
||||||
|
if(s1 == 0 || s2 == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
while (IRCTOLOWER(*s1) == IRCTOLOWER(*s2)) {
|
while (IRCTOLOWER(*s1) == IRCTOLOWER(*s2)) {
|
||||||
if(*s1 == 0)
|
if(*s1 == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -256,9 +258,12 @@ ircstrcasecmp(const char *s1, const char *s2)
|
||||||
int
|
int
|
||||||
ircstrncasecmp(const char *s1, const char *s2, size_t size)
|
ircstrncasecmp(const char *s1, const char *s2, size_t size)
|
||||||
{
|
{
|
||||||
|
/* How should we handle nulls... hmmm */
|
||||||
|
if(s1 == 0 || s2 == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (size && (IRCTOLOWER(*s1) == IRCTOLOWER(*s2)))
|
while (size && (IRCTOLOWER(*s1) == IRCTOLOWER(*s2)))
|
||||||
{
|
{
|
||||||
if(*s1 == 0)
|
if(*s1 == 0)
|
||||||
|
@ -267,7 +272,8 @@ ircstrncasecmp(const char *s1, const char *s2, size_t size)
|
||||||
s2++;
|
s2++;
|
||||||
size--;
|
size--;
|
||||||
}
|
}
|
||||||
if(size)
|
if(size) {
|
||||||
return IRCTOLOWER(*s1) - IRCTOLOWER(*s2);
|
return IRCTOLOWER(*s1) - IRCTOLOWER(*s2);
|
||||||
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,9 +197,9 @@ send_part (const char *who, const char *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
send_cmd (":%s %s %lu %s + :%c%s", sender, MSG_SJOIN, ts, chan, flag, who);
|
send_cmd (":%s %s %lu %s + :%s", sender, MSG_SJOIN, ts, chan, who);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
2
mystic.c
2
mystic.c
|
@ -191,7 +191,7 @@ send_join (const char *sender, const char *who, const char *chan, const unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ send_join (const char *sender, const char *who, const char *chan, const unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send_sjoin (const char *sender, const char *who, const char *chan, const char flag, const unsigned long ts)
|
send_sjoin (const char *sender, const char *who, const char *chan, const unsigned long ts)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ NeoStats IRC Statistical Server
|
||||||
|
|
||||||
|
|
||||||
Developers:
|
Developers:
|
||||||
Adam Rutter (Shmad) <shmad@neostats.net>
|
Mark (M) <m@neostats.net>
|
||||||
Justin Hammond (Fish) <fish@neostats.net>
|
Justin Hammond (Fish) <fish@neostats.net>
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,4 +12,3 @@ With your help this project grows stronger!
|
||||||
|
|
||||||
|
|
||||||
http://www.NeoStats.Net
|
http://www.NeoStats.Net
|
||||||
The NeoStats Group
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ const char ns_help_modlist_oneline[]="List loaded modules";
|
||||||
const char ns_help_userdump_oneline[]="Debug user table";
|
const char ns_help_userdump_oneline[]="Debug user table";
|
||||||
const char ns_help_chandump_oneline[]="Debug channel table";
|
const char ns_help_chandump_oneline[]="Debug channel table";
|
||||||
const char ns_help_serverdump_oneline[]="Debug server table";
|
const char ns_help_serverdump_oneline[]="Debug server table";
|
||||||
|
const char ns_help_bandump_oneline[]="Debug Ban table";
|
||||||
|
|
||||||
const char *ns_help_level[] = {
|
const char *ns_help_level[] = {
|
||||||
"Syntax: \2LEVEL [nick]\2",
|
"Syntax: \2LEVEL [nick]\2",
|
||||||
|
@ -195,6 +196,14 @@ const char *ns_help_serverdump[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *ns_help_bandump[] = {
|
||||||
|
"Syntax: \2BANDUMP\2",
|
||||||
|
"",
|
||||||
|
"When in debug mode, Neostats will echo its ban table to",
|
||||||
|
"the services channel. Only useful for debugging Neostats",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
const char *ns_help_chandump[] = {
|
const char *ns_help_chandump[] = {
|
||||||
"Syntax: \2CHANDUMP\2",
|
"Syntax: \2CHANDUMP\2",
|
||||||
"Syntax: \2CHANDUMP <channel>\2",
|
"Syntax: \2CHANDUMP <channel>\2",
|
||||||
|
|
|
@ -36,6 +36,7 @@ extern const char *ns_help_debug[];
|
||||||
extern const char *ns_help_userdump[];
|
extern const char *ns_help_userdump[];
|
||||||
extern const char *ns_help_chandump[];
|
extern const char *ns_help_chandump[];
|
||||||
extern const char *ns_help_serverdump[];
|
extern const char *ns_help_serverdump[];
|
||||||
|
extern const char *ns_help_bandump[];
|
||||||
extern const char *ns_help_version[];
|
extern const char *ns_help_version[];
|
||||||
extern const char *ns_help_load[];
|
extern const char *ns_help_load[];
|
||||||
extern const char *ns_help_unload[];
|
extern const char *ns_help_unload[];
|
||||||
|
@ -71,5 +72,6 @@ extern const char ns_help_modlist_oneline[];
|
||||||
extern const char ns_help_userdump_oneline[];
|
extern const char ns_help_userdump_oneline[];
|
||||||
extern const char ns_help_chandump_oneline[];
|
extern const char ns_help_chandump_oneline[];
|
||||||
extern const char ns_help_serverdump_oneline[];
|
extern const char ns_help_serverdump_oneline[];
|
||||||
|
extern const char ns_help_bandump_oneline[];
|
||||||
|
|
||||||
#endif /* _NS_HELP_H_ */
|
#endif /* _NS_HELP_H_ */
|
||||||
|
|
26
server.c
26
server.c
|
@ -31,6 +31,8 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "ircd.h"
|
#include "ircd.h"
|
||||||
#include "exclude.h"
|
#include "exclude.h"
|
||||||
|
#include "server.h"
|
||||||
|
#include "users.h"
|
||||||
#ifdef SQLSRV
|
#ifdef SQLSRV
|
||||||
#include "sqlsrv/rta.h"
|
#include "sqlsrv/rta.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,7 +68,7 @@ AddServer (const char *name, const char *uplink, const char* hops, const char *n
|
||||||
char **av;
|
char **av;
|
||||||
int ac = 0;
|
int ac = 0;
|
||||||
|
|
||||||
nlog (LOG_DEBUG1, LOG_CORE, "New Server: %s", name);
|
nlog (LOG_DEBUG1, LOG_CORE, "New Server: %s Uplink; %s", name, uplink);
|
||||||
s = new_server (name);
|
s = new_server (name);
|
||||||
if(hops) {
|
if(hops) {
|
||||||
s->hops = atoi (hops);
|
s->hops = atoi (hops);
|
||||||
|
@ -100,6 +102,23 @@ AddServer (const char *name, const char *uplink, const char* hops, const char *n
|
||||||
return(s);
|
return(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void del_server_leaves(Server* hub)
|
||||||
|
{
|
||||||
|
Server *s;
|
||||||
|
hscan_t ss;
|
||||||
|
hnode_t *sn;
|
||||||
|
|
||||||
|
nlog (LOG_DEBUG1, LOG_CORE, "del_server_leaves: %s", hub->name);
|
||||||
|
hash_scan_begin (&ss, sh);
|
||||||
|
while ((sn = hash_scan_next (&ss)) != NULL) {
|
||||||
|
s = hnode_get (sn);
|
||||||
|
if(ircstrcasecmp(hub->name, s->uplink) == 0) {
|
||||||
|
nlog (LOG_DEBUG1, LOG_CORE, "del_server_leaves: del child %s", s->name);
|
||||||
|
DelServer(s->name, hub->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DelServer (const char *name, const char* reason)
|
DelServer (const char *name, const char* reason)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +136,10 @@ DelServer (const char *name, const char* reason)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s = hnode_get (sn);
|
s = hnode_get (sn);
|
||||||
|
del_server_leaves(s);
|
||||||
|
if(ircd_srv.noquit) {
|
||||||
|
QuitServerUsers (s);
|
||||||
|
}
|
||||||
/* run the event for delete server */
|
/* run the event for delete server */
|
||||||
AddStringToList (&av, s->name, &ac);
|
AddStringToList (&av, s->name, &ac);
|
||||||
if(reason) {
|
if(reason) {
|
||||||
|
|
25
services.c
25
services.c
|
@ -36,6 +36,7 @@
|
||||||
#include "ircd.h"
|
#include "ircd.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "exclude.h"
|
#include "exclude.h"
|
||||||
|
#include "bans.h"
|
||||||
|
|
||||||
static int ns_set_debug (User * u, char **av, int ac);
|
static int ns_set_debug (User * u, char **av, int ac);
|
||||||
static int ns_shutdown (User * u, char **av, int ac);
|
static int ns_shutdown (User * u, char **av, int ac);
|
||||||
|
@ -48,6 +49,7 @@ static int ns_raw (User * u, char **av, int ac);
|
||||||
#endif
|
#endif
|
||||||
static int ns_userdump (User * u, char **av, int ac);
|
static int ns_userdump (User * u, char **av, int ac);
|
||||||
static int ns_serverdump (User * u, char **av, int ac);
|
static int ns_serverdump (User * u, char **av, int ac);
|
||||||
|
static int ns_bandump(User * u, char **av, int ac);
|
||||||
static int ns_chandump (User * u, char **av, int ac);
|
static int ns_chandump (User * u, char **av, int ac);
|
||||||
static int ns_status (User * u, char **av, int ac);
|
static int ns_status (User * u, char **av, int ac);
|
||||||
static int ns_version (User * u, char **av, int ac);
|
static int ns_version (User * u, char **av, int ac);
|
||||||
|
@ -82,6 +84,7 @@ static bot_cmd ns_commands[]=
|
||||||
{"USERDUMP", ns_userdump, 0, NS_ULEVEL_ROOT, ns_help_userdump, ns_help_userdump_oneline},
|
{"USERDUMP", ns_userdump, 0, NS_ULEVEL_ROOT, ns_help_userdump, ns_help_userdump_oneline},
|
||||||
{"CHANDUMP", ns_chandump, 0, NS_ULEVEL_ROOT, ns_help_chandump, ns_help_chandump_oneline},
|
{"CHANDUMP", ns_chandump, 0, NS_ULEVEL_ROOT, ns_help_chandump, ns_help_chandump_oneline},
|
||||||
{"SERVERDUMP", ns_serverdump, 0, NS_ULEVEL_ROOT, ns_help_serverdump, ns_help_serverdump_oneline},
|
{"SERVERDUMP", ns_serverdump, 0, NS_ULEVEL_ROOT, ns_help_serverdump, ns_help_serverdump_oneline},
|
||||||
|
{"BANDUMP", ns_bandump, 0, NS_ULEVEL_ROOT, ns_help_bandump, ns_help_bandump_oneline},
|
||||||
{NULL, NULL, 0, 0, NULL, NULL}
|
{NULL, NULL, 0, 0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -343,6 +346,28 @@ ns_serverdump (User * u, char **av, int ac)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @brief BANDUMP command handler
|
||||||
|
*
|
||||||
|
* Dump ban list
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @param list of arguments
|
||||||
|
* @param number of arguments
|
||||||
|
* @returns none
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
ns_bandump (User * u, char **av, int ac)
|
||||||
|
{
|
||||||
|
SET_SEGV_LOCATION();
|
||||||
|
if (!me.debug_mode) {
|
||||||
|
prefmsg (u->nick, s_Services, "\2Error:\2 Debug Mode Disabled");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
chanalert (s_Services, "\2DEBUG\2 \2%s\2 Requested a BanDump!", u->nick);
|
||||||
|
BanDump();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/** @brief CHANDUMP command handler
|
/** @brief CHANDUMP command handler
|
||||||
*
|
*
|
||||||
* Dump channel list
|
* Dump channel list
|
||||||
|
|
4
sock.c
4
sock.c
|
@ -419,7 +419,7 @@ recvlog (char *line)
|
||||||
if ((logfile = fopen (RECV_LOG, "a")) == NULL)
|
if ((logfile = fopen (RECV_LOG, "a")) == NULL)
|
||||||
return;
|
return;
|
||||||
if (logfile)
|
if (logfile)
|
||||||
fprintf (logfile, line);
|
fprintf (logfile, "%s", line);
|
||||||
fclose (logfile);
|
fclose (logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,6 +537,8 @@ sts (const char *buf, const int buflen)
|
||||||
sent = write (servsock, buf, buflen);
|
sent = write (servsock, buf, buflen);
|
||||||
if (sent == -1) {
|
if (sent == -1) {
|
||||||
nlog (LOG_CRITICAL, LOG_CORE, "Write error: %s", strerror(errno));
|
nlog (LOG_CRITICAL, LOG_CORE, "Write error: %s", strerror(errno));
|
||||||
|
close (servsock);
|
||||||
|
servsock = -1;
|
||||||
do_exit (NS_EXIT_ERROR, NULL);
|
do_exit (NS_EXIT_ERROR, NULL);
|
||||||
}
|
}
|
||||||
me.SendM++;
|
me.SendM++;
|
||||||
|
|
14
stats.h
14
stats.h
|
@ -65,6 +65,15 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* va_copy handling*/
|
||||||
|
#ifndef HAVE_VA_COPY
|
||||||
|
#if HAVE___VA_COPY
|
||||||
|
#define va_copy(dest, src) __va_copy(dest, src)
|
||||||
|
#else /* HAVE___VA_COPY */
|
||||||
|
#define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(dest))
|
||||||
|
#endif /* HAVE___VA_COPY */
|
||||||
|
#endif /* HAVE_VA_COPY */
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include "adns.h"
|
#include "adns.h"
|
||||||
|
@ -189,6 +198,9 @@
|
||||||
#define MAXCMDSIZE 15
|
#define MAXCMDSIZE 15
|
||||||
#define MAXINFO 128
|
#define MAXINFO 128
|
||||||
#define B64SIZE 16
|
#define B64SIZE 16
|
||||||
|
#ifndef CLOAKKEYLEN
|
||||||
|
#define CLOAKKEYLEN 40
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* MAXCHANLIST
|
/* MAXCHANLIST
|
||||||
|
@ -416,7 +428,7 @@ struct me {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct Ban {
|
typedef struct Ban {
|
||||||
char type;
|
char type[8];
|
||||||
char user[MAXUSER];
|
char user[MAXUSER];
|
||||||
char host[MAXHOST];
|
char host[MAXHOST];
|
||||||
char mask[MAXHOST];
|
char mask[MAXHOST];
|
||||||
|
|
35
users.c
35
users.c
|
@ -70,7 +70,7 @@ new_user (const char *nick)
|
||||||
}
|
}
|
||||||
return (u);
|
return (u);
|
||||||
}
|
}
|
||||||
#ifndef GOTNICKIP
|
#ifndef GOTNICKIP1
|
||||||
static void
|
static void
|
||||||
lookupnickip(char *data, adns_answer *a) {
|
lookupnickip(char *data, adns_answer *a) {
|
||||||
User *u;
|
User *u;
|
||||||
|
@ -82,6 +82,7 @@ lookupnickip(char *data, adns_answer *a) {
|
||||||
u->ipaddr.s_addr = a->rrs.addr->addr.inet.sin_addr.s_addr;
|
u->ipaddr.s_addr = a->rrs.addr->addr.inet.sin_addr.s_addr;
|
||||||
AddStringToList (&av, u->nick, &ac);
|
AddStringToList (&av, u->nick, &ac);
|
||||||
ModuleEvent (EVENT_GOTNICKIP, av, ac);
|
ModuleEvent (EVENT_GOTNICKIP, av, ac);
|
||||||
|
free (av);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,7 +95,7 @@ AddUser (const char *nick, const char *user, const char *host, const char *realn
|
||||||
int ac = 0;
|
int ac = 0;
|
||||||
User *u;
|
User *u;
|
||||||
int i;
|
int i;
|
||||||
#ifndef GOTNICKIP
|
#ifndef GOTNICKIP1
|
||||||
struct in_addr *ipad;
|
struct in_addr *ipad;
|
||||||
int res;
|
int res;
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,11 +106,10 @@ AddUser (const char *nick, const char *user, const char *host, const char *realn
|
||||||
nlog (LOG_WARNING, LOG_CORE, "AddUser: trying to add a user that already exists %s", nick);
|
nlog (LOG_WARNING, LOG_CORE, "AddUser: trying to add a user that already exists %s", nick);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (ip) {
|
||||||
if(ip) {
|
|
||||||
ipaddress = strtoul (ip, NULL, 10);
|
ipaddress = strtoul (ip, NULL, 10);
|
||||||
} else {
|
}
|
||||||
#ifndef GOTNICKIP
|
if(ipaddress == 0) {
|
||||||
if (me.want_nickip == 1) {
|
if (me.want_nickip == 1) {
|
||||||
/* first, if the u->host is a ip address, just convert it */
|
/* first, if the u->host is a ip address, just convert it */
|
||||||
ipad = malloc(sizeof(struct in_addr));
|
ipad = malloc(sizeof(struct in_addr));
|
||||||
|
@ -123,10 +123,7 @@ AddUser (const char *nick, const char *user, const char *host, const char *realn
|
||||||
dns_lookup((char *)host, adns_r_addr, lookupnickip, (void *)nick);
|
dns_lookup((char *)host, adns_r_addr, lookupnickip, (void *)nick);
|
||||||
ipaddress = 0;
|
ipaddress = 0;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
ipaddress = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if(TS) {
|
if(TS) {
|
||||||
time = strtoul (TS, NULL, 10);
|
time = strtoul (TS, NULL, 10);
|
||||||
|
@ -884,3 +881,21 @@ FreeUsers ()
|
||||||
hash_destroy(uh);
|
hash_destroy(uh);
|
||||||
hash_destroy(ch);
|
hash_destroy(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuitServerUsers (Server* s)
|
||||||
|
{
|
||||||
|
User *u;
|
||||||
|
hnode_t *un;
|
||||||
|
hscan_t hs;
|
||||||
|
|
||||||
|
SET_SEGV_LOCATION();
|
||||||
|
hash_scan_begin(&hs, uh);
|
||||||
|
while ((un = hash_scan_next(&hs)) != NULL) {
|
||||||
|
u = hnode_get (un);
|
||||||
|
if(u->server == s)
|
||||||
|
{
|
||||||
|
nlog (LOG_DEBUG1, LOG_CORE, "QuitServerUsers: deleting %s for %s", u->nick, s->name);
|
||||||
|
DelUser(u->nick, 0, s->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
1
users.h
1
users.h
|
@ -42,5 +42,6 @@ void FreeUsers();
|
||||||
#ifdef BASE64NICKNAME
|
#ifdef BASE64NICKNAME
|
||||||
User *finduserbase64 (const char *num);
|
User *finduserbase64 (const char *num);
|
||||||
#endif
|
#endif
|
||||||
|
void QuitServerUsers (Server* s);
|
||||||
|
|
||||||
#endif /* _USERS_H_ */
|
#endif /* _USERS_H_ */
|
||||||
|
|
Reference in a new issue