mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-29 16:14:43 +00:00
reorganizing
This commit is contained in:
parent
a5187a7a8f
commit
c5b03f35e1
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ trivia/*.index
|
|||||||
energymech
|
energymech
|
||||||
src/energymech
|
src/energymech
|
||||||
src/*.o
|
src/*.o
|
||||||
|
src/lib/*.o
|
||||||
src/gencmd
|
src/gencmd
|
||||||
src/aliastest
|
src/aliastest
|
||||||
src/safepathtest
|
src/safepathtest
|
||||||
|
|||||||
15
Makefile
15
Makefile
@ -55,15 +55,12 @@ TESTFILES = config/cc.c config/endian.c config/inet_addr.c config/inet_aton.c co
|
|||||||
|
|
||||||
TRIVFILES = trivia/mkindex.c
|
TRIVFILES = trivia/mkindex.c
|
||||||
|
|
||||||
SRCFILES = src/alias.c src/auth.c src/bounce.c src/chanban.c src/channel.c \
|
SRCFILES = src/alias.c src/auth.c src/bounce.c src/chanban.c src/channel.c src/core.c src/ctcp.c src/debug.c src/dns.c \
|
||||||
src/core.c src/ctcp.c src/debug.c src/dns.c src/dynamode.c \
|
src/function.c src/gencmd.c src/greet.c src/help.c src/hostinfo.c src/irc.c src/kicksay.c src/main.c src/mega.c \
|
||||||
src/function.c src/gencmd.c src/greet.c src/help.c src/hostinfo.c src/irc.c \
|
src/net.c src/net_chan.c src/note.c src/notify.c src/ons.c src/parse.c src/partyline.c src/perl.c src/prot.c \
|
||||||
src/kicksay.c src/main.c src/mega.c src/net.c src/net_chan.c \
|
src/python.c src/redirect.c src/reset.c src/seen.c src/shit.c src/socket.c src/spy.c src/stats.c src/tcl.c \
|
||||||
src/note.c src/notify.c src/ons.c src/parse.c src/perl.c \
|
src/toybox.c src/trivia.c src/uptime.c src/urlcap.c src/user.c src/vars.c src/web.c \
|
||||||
src/prot.c src/python.c src/redirect.c src/reset.c src/seen.c \
|
src/lib/md5.c src/lib/md5.h src/lib/string.c
|
||||||
src/shit.c src/socket.c src/spy.c src/stats.c src/tcl.c \
|
|
||||||
src/telnet.c src/toybox.c src/trivia.c src/uptime.c src/urlcap.c src/user.c \
|
|
||||||
src/vars.c src/web.c src/md5/md5.c src/md5/md5.h
|
|
||||||
|
|
||||||
HDRFILES = src/defines.h src/global.h src/h.h src/settings.h src/structs.h src/text.h src/usage.h
|
HDRFILES = src/defines.h src/global.h src/h.h src/settings.h src/structs.h src/text.h src/usage.h
|
||||||
|
|
||||||
|
|||||||
6
README
6
README
@ -102,6 +102,10 @@ The main distribution site for the EnergyMech is:
|
|||||||
|
|
||||||
https://github.com/MadCamel/energymech
|
https://github.com/MadCamel/energymech
|
||||||
|
|
||||||
|
Extra files for users of EnergyMech can be found at:
|
||||||
|
|
||||||
|
https://github.com/joonicks/energymech-extra
|
||||||
|
|
||||||
Files, documentation and tips can be found at:
|
Files, documentation and tips can be found at:
|
||||||
|
|
||||||
http://www.energymech.net
|
http://www.energymech.net
|
||||||
@ -113,4 +117,4 @@ IT COMES TO CONFIGURING AND USING IT.
|
|||||||
|
|
||||||
---*---
|
---*---
|
||||||
|
|
||||||
proton, March 13th, 2018.
|
proton, April 3rd, 2018.
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
../src/md5/md5.h
|
../src/lib/md5.h
|
||||||
@ -1 +1 @@
|
|||||||
../src/md5/md5.c
|
../src/lib/md5.c
|
||||||
@ -1 +1 @@
|
|||||||
../src/sha/sha1.h
|
../src/lib/sha1.h
|
||||||
@ -1 +1 @@
|
|||||||
../src/sha/sha1.c
|
../src/lib/sha1.c
|
||||||
19
configure
vendored
19
configure
vendored
@ -103,6 +103,7 @@ do
|
|||||||
hostinfo ) ft_hostinfo=$yesno ;;
|
hostinfo ) ft_hostinfo=$yesno ;;
|
||||||
idwrap ) ft_idwrap=$yesno ;;
|
idwrap ) ft_idwrap=$yesno ;;
|
||||||
ircd_ext ) ft_ircd_ext=$yesno ;;
|
ircd_ext ) ft_ircd_ext=$yesno ;;
|
||||||
|
libmusl ) try_libmusl=$yesno ;;
|
||||||
md5 ) ft_md5=$yesno ;;
|
md5 ) ft_md5=$yesno ;;
|
||||||
newbie ) ft_newbie=$yesno ;;
|
newbie ) ft_newbie=$yesno ;;
|
||||||
note ) ft_note=$yesno ;;
|
note ) ft_note=$yesno ;;
|
||||||
@ -205,6 +206,8 @@ do
|
|||||||
idwrap_no ) ft_idwrap=no ;;
|
idwrap_no ) ft_idwrap=no ;;
|
||||||
ircd_ext_yes | ircd_ext_ ) ft_ircd_ext=yes ;;
|
ircd_ext_yes | ircd_ext_ ) ft_ircd_ext=yes ;;
|
||||||
ircd_ext_no ) ft_ircd_ext=no ;;
|
ircd_ext_no ) ft_ircd_ext=no ;;
|
||||||
|
libmusl_yes | libmusl_ ) try_libmusl=/usr/local/musl/bin/musl-gcc ;;
|
||||||
|
libmusl_no ) try_libmusl=no ;;
|
||||||
md5_yes | md5_ ) ft_md5=yes ;;
|
md5_yes | md5_ ) ft_md5=yes ;;
|
||||||
md5_no ) ft_md5=no ;;
|
md5_no ) ft_md5=no ;;
|
||||||
newbie_yes | newbie_ ) ft_newbie=yes ;;
|
newbie_yes | newbie_ ) ft_newbie=yes ;;
|
||||||
@ -225,7 +228,7 @@ do
|
|||||||
seen_no ) ft_seen=no ;;
|
seen_no ) ft_seen=no ;;
|
||||||
session_yes | session_ ) ft_session=yes ;;
|
session_yes | session_ ) ft_session=yes ;;
|
||||||
session_no ) ft_session=no ;;
|
session_no ) ft_session=no ;;
|
||||||
sha_yes | sha_ ) ft_seen=yes ;;
|
sha_yes | sha_ ) ft_sha=yes ;;
|
||||||
sha_no ) ft_sha=no ;;
|
sha_no ) ft_sha=no ;;
|
||||||
stats_yes | stats_ ) ft_stats=yes ;;
|
stats_yes | stats_ ) ft_stats=yes ;;
|
||||||
stats_no ) ft_stats=no ;;
|
stats_no ) ft_stats=no ;;
|
||||||
@ -256,7 +259,7 @@ do
|
|||||||
alias ) ft_alias=no ;;
|
alias ) ft_alias=no ;;
|
||||||
botnet ) ft_botnet=no ;;
|
botnet ) ft_botnet=no ;;
|
||||||
bounce ) ft_bounce=no ;;
|
bounce ) ft_bounce=no ;;
|
||||||
chanban ) ft_chanban=yes ;;
|
chanban ) ft_chanban=no ;;
|
||||||
ctcp ) ft_ctcp=no ;;
|
ctcp ) ft_ctcp=no ;;
|
||||||
dccfile ) ft_dccfile=no ;;
|
dccfile ) ft_dccfile=no ;;
|
||||||
debug ) ft_debug=no ;;
|
debug ) ft_debug=no ;;
|
||||||
@ -266,6 +269,7 @@ do
|
|||||||
hostinfo ) ft_hostinfo=no ;;
|
hostinfo ) ft_hostinfo=no ;;
|
||||||
idwrap ) ft_idwrap=no ;;
|
idwrap ) ft_idwrap=no ;;
|
||||||
ircd_ext ) ft_ircd_ext=no ;;
|
ircd_ext ) ft_ircd_ext=no ;;
|
||||||
|
libmusl ) try_libmusl=no ;;
|
||||||
md5 ) ft_md5=no ;;
|
md5 ) ft_md5=no ;;
|
||||||
newbie ) ft_newbie=no ;;
|
newbie ) ft_newbie=no ;;
|
||||||
note ) ft_note=no ;;
|
note ) ft_note=no ;;
|
||||||
@ -277,7 +281,7 @@ do
|
|||||||
redirect ) ft_redirect=no ;;
|
redirect ) ft_redirect=no ;;
|
||||||
seen ) ft_seen=no ;;
|
seen ) ft_seen=no ;;
|
||||||
session ) ft_session=no ;;
|
session ) ft_session=no ;;
|
||||||
sha ) ft_sha=yes ;;
|
sha ) ft_sha=no ;;
|
||||||
stats ) ft_stats=no ;;
|
stats ) ft_stats=no ;;
|
||||||
suppress ) ft_suppress=no ;;
|
suppress ) ft_suppress=no ;;
|
||||||
tcl ) ft_tcl=no ;;
|
tcl ) ft_tcl=no ;;
|
||||||
@ -292,7 +296,6 @@ do
|
|||||||
;;
|
;;
|
||||||
--compile) compile=yes ;;
|
--compile) compile=yes ;;
|
||||||
--install) install=yes ;;
|
--install) install=yes ;;
|
||||||
--with-libmusl) try_libmusl=/usr/local/musl/bin/musl-gcc ;;
|
|
||||||
--silence=options) silentopt=yes ;;
|
--silence=options) silentopt=yes ;;
|
||||||
--md5=internal) ft_md5=internal ;;
|
--md5=internal) ft_md5=internal ;;
|
||||||
--sha=internal) ft_sha=internal ;;
|
--sha=internal) ft_sha=internal ;;
|
||||||
@ -1039,14 +1042,18 @@ fi
|
|||||||
objcomment=
|
objcomment=
|
||||||
[ "$OBJCOPY" = "not found" ] && objcomment='#'
|
[ "$OBJCOPY" = "not found" ] && objcomment='#'
|
||||||
|
|
||||||
|
MD5_C=
|
||||||
MD5_O=
|
MD5_O=
|
||||||
if [ "$ft_md5" = internal ]; then
|
if [ "$ft_md5" = internal ]; then
|
||||||
MD5_O=md5/md5.o
|
MD5_C=lib/md5.c
|
||||||
|
MD5_O=lib/md5.o
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SHA_C=
|
||||||
SHA_O=
|
SHA_O=
|
||||||
if [ "$ft_sha" = internal ]; then
|
if [ "$ft_sha" = internal ]; then
|
||||||
SHA_O=sha/sha.o
|
SHA_C=lib/sha1.c
|
||||||
|
SHA_O=lib/sha.o
|
||||||
fi
|
fi
|
||||||
|
|
||||||
out=echo
|
out=echo
|
||||||
|
|||||||
@ -42,23 +42,20 @@ MV = mv -f
|
|||||||
RM = rm -f
|
RM = rm -f
|
||||||
CHMOD = chmod
|
CHMOD = chmod
|
||||||
|
|
||||||
INCS = config.h defines.h global.h h.h mcmd.h structs.h text.h usercombo.h
|
BASEINCLUDES = config.h defines.h structs.h global.h h.h
|
||||||
|
INCS = $(BASEINCLUDES) mcmd.h text.h usercombo.h
|
||||||
|
|
||||||
TESTFILES = aliastest safepathtest
|
TESTFILES = aliastest safepathtest
|
||||||
|
|
||||||
OFILES = alias.o auth.o bounce.o chanban.o channel.o core.o \
|
OFILES = alias.o auth.o bounce.o chanban.o channel.o core.o ctcp.o debug.o dns.o function.o greet.o \
|
||||||
ctcp.o debug.o dns.o dynamode.o function.o greet.o help.o hostinfo.o irc.o \
|
help.o hostinfo.o irc.o kicksay.o main.o net.o net_chan.o note.o notify.o ons.o parse.o partyline.o \
|
||||||
kicksay.o main.o net.o net_chan.o note.o notify.o ons.o parse.o \
|
perl.o prot.o python.o redirect.o reset.o seen.o shit.o socket.o spy.o stats.o tcl.o toybox.o \
|
||||||
perl.o prot.o python.o redirect.o reset.o seen.o shit.o socket.o \
|
trivia.o uptime.o urlcap.o user.o vars.o web.o lib/string.o @MD5_O@ @SHA_O@
|
||||||
spy.o stats.o tcl.o telnet.o toybox.o trivia.o uptime.o urlcap.o \
|
|
||||||
user.o vars.o web.o @MD5_O@ @SHA_O@
|
|
||||||
|
|
||||||
SRCFILES = alias.c auth.c bounce.c chanban.c channel.c core.c \
|
SRCFILES = alias.c auth.c bounce.c chanban.c channel.c core.c ctcp.c debug.c dns.c function.c greet.c \
|
||||||
ctcp.c debug.c dns.c dynamode.c function.c greet.c help.c hostinfo.c irc.c \
|
help.c hostinfo.c irc.c kicksay.c main.c net.c net_chan.c note.c notify.c ons.c parse.c partyline.c \
|
||||||
kicksay.c main.c net.c net_chan.c note.c notify.c ons.c parse.c \
|
perl.c prot.c python.c redirect.c reset.c seen.c shit.c socket.c spy.c stats.c tcl.c toybox.c \
|
||||||
perl.c prot.c python.c redirect.c reset.c seen.c shit.c socket.c \
|
trivia.c uptime.c urlcap.c user.c vars.c web.c lib/string.c @MD5_C@ @SHA_C@
|
||||||
spy.c stats.c tcl.c telnet.c toybox.c trivia.c uptime.c urlcap.c \
|
|
||||||
user.c vars.c web.c
|
|
||||||
|
|
||||||
.PHONY: all clean mega-install mega mega-static test commands
|
.PHONY: all clean mega-install mega mega-static test commands
|
||||||
|
|
||||||
@ -137,6 +134,15 @@ commands:
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
lib/md5.o: lib/md5.c $(INCS)
|
||||||
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -Ilib $(CPROF)
|
||||||
|
|
||||||
|
lib/sha1.o: lib/sha1.c $(INCS)
|
||||||
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -Ilib $(CPROF)
|
||||||
|
|
||||||
|
lib/string.o: lib/string.c $(BASEINCLUDES)
|
||||||
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -I. $(CPROF)
|
||||||
|
|
||||||
alias.o: alias.c $(INCS)
|
alias.o: alias.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
@ -164,9 +170,6 @@ debug.o: debug.c $(INCS) settings.h
|
|||||||
dns.o: dns.c $(INCS)
|
dns.o: dns.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
dynamode.o: dynamode.c $(INCS)
|
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
|
||||||
|
|
||||||
function.o: function.c $(INCS)
|
function.o: function.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
@ -206,8 +209,11 @@ ons.o: ons.c $(INCS)
|
|||||||
parse.o: parse.c $(INCS)
|
parse.o: parse.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
|
partyline.o: partyline.c $(INCS)
|
||||||
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
perl.o: perl.c $(INCS)
|
perl.o: perl.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) $(I_PERL) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(I_PERL)
|
||||||
|
|
||||||
prot.o: prot.c $(INCS)
|
prot.o: prot.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
@ -239,9 +245,6 @@ stats.o: stats.c $(INCS)
|
|||||||
tcl.o: tcl.c $(INCS)
|
tcl.o: tcl.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(TCLINCLUDE)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF) $(TCLINCLUDE)
|
||||||
|
|
||||||
telnet.o: telnet.c $(INCS)
|
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
|
||||||
|
|
||||||
toybox.o: toybox.c $(INCS)
|
toybox.o: toybox.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
@ -263,9 +266,3 @@ vars.o: vars.c $(INCS) settings.h
|
|||||||
web.o: web.c $(INCS)
|
web.o: web.c $(INCS)
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< $(CPROF)
|
||||||
|
|
||||||
md5/md5.o: md5/md5.c $(INCS)
|
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -Imd5 $(CPROF)
|
|
||||||
|
|
||||||
sha/sha1.o: sha/sha1.c $(INCS)
|
|
||||||
$(CROSS_COMPILE)$(CC) $(CFLAGS) -c $< -o $@ -Isha1 $(CPROF)
|
|
||||||
|
|
||||||
|
|||||||
12
src/alias.c
12
src/alias.c
@ -231,7 +231,7 @@ void do_alias(COMMAND_ARGS)
|
|||||||
to_user(from,TEXT_NOALIASES);
|
to_user(from,TEXT_NOALIASES);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dcc_only_command(from))
|
if (partyline_only_command(from))
|
||||||
return;
|
return;
|
||||||
to_user(from,"\037Alias\037 \037Format\037");
|
to_user(from,"\037Alias\037 \037Format\037");
|
||||||
for(alias=aliaslist;alias;alias=alias->next)
|
for(alias=aliaslist;alias;alias=alias->next)
|
||||||
@ -250,11 +250,11 @@ void do_alias(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
for(alias=aliaslist;alias;alias=alias->next)
|
for(alias=aliaslist;alias;alias=alias->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(alias->alias,cmd))
|
if (!stringcasecmp(alias->alias,cmd))
|
||||||
{
|
{
|
||||||
Free(&alias->format);
|
Free(&alias->format);
|
||||||
set_mallocdoer(do_alias);
|
set_mallocdoer(do_alias);
|
||||||
alias->format = Strdup(rest);
|
alias->format = stringdup(rest);
|
||||||
to_user(from,"Replaced alias: %s --> %s",cmd,rest);
|
to_user(from,"Replaced alias: %s --> %s",cmd,rest);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(do_alias) Replaced alias: %s --> %s\n",cmd,rest);
|
debug("(do_alias) Replaced alias: %s --> %s\n",cmd,rest);
|
||||||
@ -264,9 +264,9 @@ void do_alias(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
set_mallocdoer(do_alias);
|
set_mallocdoer(do_alias);
|
||||||
alias = (Alias*)Calloc(sizeof(Alias)+strlen(cmd));
|
alias = (Alias*)Calloc(sizeof(Alias)+strlen(cmd));
|
||||||
Strcpy(alias->alias,cmd);
|
stringcpy(alias->alias,cmd);
|
||||||
set_mallocdoer(do_alias);
|
set_mallocdoer(do_alias);
|
||||||
alias->format = Strdup(rest);
|
alias->format = stringdup(rest);
|
||||||
alias->next = aliaslist;
|
alias->next = aliaslist;
|
||||||
aliaslist = alias;
|
aliaslist = alias;
|
||||||
to_user(from,"Added alias: %s --> %s",cmd,rest);
|
to_user(from,"Added alias: %s --> %s",cmd,rest);
|
||||||
@ -295,7 +295,7 @@ void do_unalias(COMMAND_ARGS)
|
|||||||
|
|
||||||
for(ap=&aliaslist;*ap;ap=&(*ap)->next)
|
for(ap=&aliaslist;*ap;ap=&(*ap)->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(rest,(*ap)->alias))
|
if (!stringcasecmp(rest,(*ap)->alias))
|
||||||
{
|
{
|
||||||
alias = *ap;
|
alias = *ap;
|
||||||
*ap = alias->next;
|
*ap = alias->next;
|
||||||
|
|||||||
32
src/auth.c
32
src/auth.c
@ -112,7 +112,7 @@ char *makepass(char *plain)
|
|||||||
|
|
||||||
int passmatch(char *plain, char *encoded)
|
int passmatch(char *plain, char *encoded)
|
||||||
{
|
{
|
||||||
return(!Strcmp(cipher(plain),encoded));
|
return(!stringcmp(cipher(plain),encoded));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* not SHACRYPT */
|
#endif /* not SHACRYPT */
|
||||||
@ -141,7 +141,7 @@ int passmatch(char *plain, char *encoded)
|
|||||||
if (matches("$6$????$*",encoded))
|
if (matches("$6$????$*",encoded))
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
enc = CRYPT_FUNC(plain,encoded);
|
enc = CRYPT_FUNC(plain,encoded);
|
||||||
return(!Strcmp(enc,encoded));
|
return(!stringcmp(enc,encoded));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SHACRYPT */
|
#endif /* SHACRYPT */
|
||||||
@ -170,7 +170,7 @@ int passmatch(char *plain, char *encoded)
|
|||||||
if (matches("$1$????$*",encoded))
|
if (matches("$1$????$*",encoded))
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
enc = CRYPT_FUNC(plain,encoded);
|
enc = CRYPT_FUNC(plain,encoded);
|
||||||
return(!Strcmp(enc,encoded));
|
return(!stringcmp(enc,encoded));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MD5CRYPT */
|
#endif /* MD5CRYPT */
|
||||||
@ -185,7 +185,7 @@ void delete_auth(char *userhost)
|
|||||||
pp = ¤t->authlist;
|
pp = ¤t->authlist;
|
||||||
while(*pp)
|
while(*pp)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(userhost,(*pp)->nuh))
|
if (!stringcasecmp(userhost,(*pp)->nuh))
|
||||||
{
|
{
|
||||||
auth = *pp;
|
auth = *pp;
|
||||||
*pp = auth->next;
|
*pp = auth->next;
|
||||||
@ -238,10 +238,10 @@ void change_authnick(char *nuh, char *newnuh)
|
|||||||
if ((n1 - nuh) >= (n2 - newnuh))
|
if ((n1 - nuh) >= (n2 - newnuh))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(change_authnick) auth->nuh = `%s'; was `%s' (Strcpy) (L1 = %i, L2 = %i)\n",
|
debug("(change_authnick) auth->nuh = `%s'; was `%s' (stringcpy) (L1 = %i, L2 = %i)\n",
|
||||||
newnuh,nuh,(int)(n1 - nuh),(int)(n2 - newnuh));
|
newnuh,nuh,(int)(n1 - nuh),(int)(n2 - newnuh));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
Strcpy(auth->nuh,newnuh);
|
stringcpy(auth->nuh,newnuh);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -260,7 +260,7 @@ void change_authnick(char *nuh, char *newnuh)
|
|||||||
auth->active = now;
|
auth->active = now;
|
||||||
auth->next = current->authlist;
|
auth->next = current->authlist;
|
||||||
current->authlist = auth;
|
current->authlist = auth;
|
||||||
Strcpy(auth->nuh,newnuh);
|
stringcpy(auth->nuh,newnuh);
|
||||||
Free((char**)&oldauth);
|
Free((char**)&oldauth);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -270,8 +270,8 @@ void change_authnick(char *nuh, char *newnuh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LS User *au_user;
|
LS User *au_user;
|
||||||
LS char *au_userhost;
|
LS const char *au_userhost;
|
||||||
LS char *au_channel;
|
LS const char *au_channel;
|
||||||
LS int au_access;
|
LS int au_access;
|
||||||
|
|
||||||
void aucheck(User *user)
|
void aucheck(User *user)
|
||||||
@ -282,7 +282,7 @@ void aucheck(User *user)
|
|||||||
{
|
{
|
||||||
for(ump=user->chan;ump;ump=ump->next)
|
for(ump=user->chan;ump;ump=ump->next)
|
||||||
{
|
{
|
||||||
if (*ump->p == '*' || !Strcasecmp(au_channel,ump->p))
|
if (*ump->p == '*' || !stringcasecmp(au_channel,ump->p))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ump)
|
if (!ump)
|
||||||
@ -303,7 +303,7 @@ void aucheck(User *user)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
User *get_authuser(char *userhost, char *channel)
|
User *get_authuser(const char *userhost, const char *channel)
|
||||||
{
|
{
|
||||||
User *user;
|
User *user;
|
||||||
Auth *auth;
|
Auth *auth;
|
||||||
@ -320,7 +320,7 @@ User *get_authuser(char *userhost, char *channel)
|
|||||||
{
|
{
|
||||||
if (au_access < auth->user->x.x.access)
|
if (au_access < auth->user->x.x.access)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(userhost,auth->nuh))
|
if (!stringcasecmp(userhost,auth->nuh))
|
||||||
{
|
{
|
||||||
aucheck(auth->user);
|
aucheck(auth->user);
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ User *get_authuser(char *userhost, char *channel)
|
|||||||
return(au_user);
|
return(au_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_authaccess(char *userhost, char *channel)
|
int get_authaccess(const char *userhost, const char *channel)
|
||||||
{
|
{
|
||||||
User *user;
|
User *user;
|
||||||
Strp *ump;
|
Strp *ump;
|
||||||
@ -355,7 +355,7 @@ int get_authaccess(char *userhost, char *channel)
|
|||||||
return(user->x.x.access);
|
return(user->x.x.access);
|
||||||
for(ump=user->chan;ump;ump=ump->next)
|
for(ump=user->chan;ump;ump=ump->next)
|
||||||
{
|
{
|
||||||
if (*ump->p == '*' || !Strcasecmp(ump->p,channel))
|
if (*ump->p == '*' || !stringcasecmp(ump->p,channel))
|
||||||
return(user->x.x.access);
|
return(user->x.x.access);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
@ -375,7 +375,7 @@ int make_auth(const char *userhost, const User *user)
|
|||||||
|
|
||||||
for(auth=current->authlist;auth;auth=auth->next)
|
for(auth=current->authlist;auth;auth=auth->next)
|
||||||
{
|
{
|
||||||
if ((auth->user == user) && !Strcasecmp(auth->nuh,userhost))
|
if ((auth->user == user) && !stringcasecmp(auth->nuh,userhost))
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ int make_auth(const char *userhost, const User *user)
|
|||||||
auth = (Auth*)Calloc(sizeof(Auth) + strlen(userhost));
|
auth = (Auth*)Calloc(sizeof(Auth) + strlen(userhost));
|
||||||
auth->user = (User*)user;
|
auth->user = (User*)user;
|
||||||
auth->active = now;
|
auth->active = now;
|
||||||
Strcpy(auth->nuh,userhost);
|
stringcpy(auth->nuh,userhost);
|
||||||
|
|
||||||
auth->next = current->authlist;
|
auth->next = current->authlist;
|
||||||
current->authlist = auth;
|
current->authlist = auth;
|
||||||
|
|||||||
16
src/bounce.c
16
src/bounce.c
@ -65,27 +65,27 @@ void bounce_parse(ircLink *irc, char *message)
|
|||||||
if (irc->status == BNC_LOGIN)
|
if (irc->status == BNC_LOGIN)
|
||||||
{
|
{
|
||||||
cmd = chop(&message);
|
cmd = chop(&message);
|
||||||
if (!Strcasecmp(cmd,"USER"))
|
if (!stringcasecmp(cmd,"USER"))
|
||||||
{
|
{
|
||||||
if (irc->userLine)
|
if (irc->userLine)
|
||||||
return;
|
return;
|
||||||
set_mallocdoer(bounce_parse);
|
set_mallocdoer(bounce_parse);
|
||||||
irc->userLine = Strdup(message);
|
irc->userLine = stringdup(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(cmd,"NICK"))
|
if (!stringcasecmp(cmd,"NICK"))
|
||||||
{
|
{
|
||||||
if (irc->nickLine)
|
if (irc->nickLine)
|
||||||
return;
|
return;
|
||||||
set_mallocdoer(bounce_parse);
|
set_mallocdoer(bounce_parse);
|
||||||
irc->nickLine = Strdup(message);
|
irc->nickLine = stringdup(message);
|
||||||
if ((cmd = chop(&message)) == NULL)
|
if ((cmd = chop(&message)) == NULL)
|
||||||
{
|
{
|
||||||
irc->status = BNC_DEAD;
|
irc->status = BNC_DEAD;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
set_mallocdoer(bounce_parse);
|
set_mallocdoer(bounce_parse);
|
||||||
irc->nick = Strdup(cmd);
|
irc->nick = stringdup(cmd);
|
||||||
}
|
}
|
||||||
if (irc->userLine && irc->nickLine)
|
if (irc->userLine && irc->nickLine)
|
||||||
{
|
{
|
||||||
@ -103,7 +103,7 @@ void bounce_parse(ircLink *irc, char *message)
|
|||||||
server = chop(&message);
|
server = chop(&message);
|
||||||
cmd = chop(&message);
|
cmd = chop(&message);
|
||||||
|
|
||||||
if (!cmd || Strcasecmp(server,"PRIVMSG") || nickcmp(cmd,INTERNAL_NICK)
|
if (!cmd || stringcasecmp(server,"PRIVMSG") || nickcmp(cmd,INTERNAL_NICK)
|
||||||
|| (*message != ':'))
|
|| (*message != ':'))
|
||||||
{
|
{
|
||||||
irc->status = BNC_DEAD;
|
irc->status = BNC_DEAD;
|
||||||
@ -119,7 +119,7 @@ void bounce_parse(ircLink *irc, char *message)
|
|||||||
if ((user = find_handle(message)))
|
if ((user = find_handle(message)))
|
||||||
{
|
{
|
||||||
set_mallocdoer(bounce_parse);
|
set_mallocdoer(bounce_parse);
|
||||||
irc->handle = Strdup(user->name);
|
irc->handle = stringdup(user->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ void bounce_parse(ircLink *irc, char *message)
|
|||||||
iport = 6667;
|
iport = 6667;
|
||||||
if (aport)
|
if (aport)
|
||||||
{
|
{
|
||||||
iport = a2i(aport);
|
iport = asc2int(aport);
|
||||||
if (errno || (iport < 1) || (iport > 65536))
|
if (errno || (iport < 1) || (iport > 65536))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ void chanban_action(char *nick, char *channel, Shit *shit)
|
|||||||
// check all current channels
|
// check all current channels
|
||||||
for(CurrentChan=current->chanlist;CurrentChan;CurrentChan=CurrentChan->next)
|
for(CurrentChan=current->chanlist;CurrentChan;CurrentChan=CurrentChan->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(channel,CurrentChan->name)) // if the bot is on the channel, skip it
|
if (!stringcasecmp(channel,CurrentChan->name)) // if the bot is on the channel, skip it
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(chanban_action) skipping %s: bot is on channel\n",channel);
|
debug("(chanban_action) skipping %s: bot is on channel\n",channel);
|
||||||
@ -125,7 +125,7 @@ void chanban_action(char *nick, char *channel, Shit *shit)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// is the shit for this channel?
|
// is the shit for this channel?
|
||||||
if (!Strcasecmp(shit->chan,CurrentChan->name))
|
if (!stringcasecmp(shit->chan,CurrentChan->name))
|
||||||
{
|
{
|
||||||
// if chanban is turned on && if bot is op (pretty pointless otherwise)
|
// if chanban is turned on && if bot is op (pretty pointless otherwise)
|
||||||
if (CurrentChan->setting[TOG_CHANBAN].int_var && CurrentChan->bot_is_op)
|
if (CurrentChan->setting[TOG_CHANBAN].int_var && CurrentChan->bot_is_op)
|
||||||
|
|||||||
@ -71,7 +71,7 @@ Chan *find_channel(const char *name, int anychannel)
|
|||||||
continue;
|
continue;
|
||||||
if (ni != tolowertab[(uchar)(chan->name[1])])
|
if (ni != tolowertab[(uchar)(chan->name[1])])
|
||||||
continue;
|
continue;
|
||||||
if (!Strcasecmp(name,chan->name))
|
if (!stringcasecmp(name,chan->name))
|
||||||
return(chan);
|
return(chan);
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -123,11 +123,11 @@ void join_channel(char *name, char *key)
|
|||||||
set_mallocdoer(join_channel);
|
set_mallocdoer(join_channel);
|
||||||
chan = (Chan*)Calloc(sizeof(Chan));
|
chan = (Chan*)Calloc(sizeof(Chan));
|
||||||
set_mallocdoer(join_channel);
|
set_mallocdoer(join_channel);
|
||||||
chan->name = Strdup(name);
|
chan->name = stringdup(name);
|
||||||
if (key)
|
if (key)
|
||||||
{
|
{
|
||||||
set_mallocdoer(join_channel);
|
set_mallocdoer(join_channel);
|
||||||
chan->key = Strdup(key);
|
chan->key = stringdup(key);
|
||||||
}
|
}
|
||||||
copy_vars(chan->setting,current->setting);
|
copy_vars(chan->setting,current->setting);
|
||||||
chan->next = current->chanlist;
|
chan->next = current->chanlist;
|
||||||
@ -151,7 +151,7 @@ void join_channel(char *name, char *key)
|
|||||||
{
|
{
|
||||||
Free(&chan->key);
|
Free(&chan->key);
|
||||||
set_mallocdoer(join_channel);
|
set_mallocdoer(join_channel);
|
||||||
chan->key = Strdup(key);
|
chan->key = stringdup(key);
|
||||||
}
|
}
|
||||||
if (chan->active)
|
if (chan->active)
|
||||||
{
|
{
|
||||||
@ -175,14 +175,14 @@ void reverse_topic(Chan *chan, char *from, char *topic)
|
|||||||
if ((chan->setting[TOG_TOP].int_var) &&
|
if ((chan->setting[TOG_TOP].int_var) &&
|
||||||
(get_useraccess(from,chan->name) < ASSTLEVEL))
|
(get_useraccess(from,chan->name) < ASSTLEVEL))
|
||||||
{
|
{
|
||||||
if (chan->topic && Strcasecmp(chan->topic,topic))
|
if (chan->topic && stringcasecmp(chan->topic,topic))
|
||||||
to_server("TOPIC %s :%s\n",chan->name,chan->topic);
|
to_server("TOPIC %s :%s\n",chan->name,chan->topic);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Free((char**)&chan->topic);
|
Free((char**)&chan->topic);
|
||||||
set_mallocdoer(reverse_topic);
|
set_mallocdoer(reverse_topic);
|
||||||
chan->topic = Strdup(topic);
|
chan->topic = stringdup(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cycle_channel(Chan *chan)
|
void cycle_channel(Chan *chan)
|
||||||
@ -228,7 +228,7 @@ int reverse_mode(char *from, Chan *chan, int m, int s)
|
|||||||
{
|
{
|
||||||
buffer[0] = mode;
|
buffer[0] = mode;
|
||||||
buffer[1] = 0;
|
buffer[1] = 0;
|
||||||
Strcat(buffer,ptr);
|
stringcat(buffer,ptr);
|
||||||
}
|
}
|
||||||
set_str_varc(chan,STR_ENFMODES,buffer);
|
set_str_varc(chan,STR_ENFMODES,buffer);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -263,8 +263,8 @@ void chan_modestr(Chan *chan, char *dest)
|
|||||||
}
|
}
|
||||||
if (chan->keymode)
|
if (chan->keymode)
|
||||||
{
|
{
|
||||||
Strcat(dest," ");
|
stringcat(dest," ");
|
||||||
Strcat(dest,(chan->key) ? chan->key : "???");
|
stringcat(dest,(chan->key) ? chan->key : "???");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ Ban *make_ban(Ban **banlist, char *from, char *banmask, time_t when)
|
|||||||
|
|
||||||
for(new=*banlist;new;new=new->next)
|
for(new=*banlist;new;new=new->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(new->banstring,banmask))
|
if (!stringcasecmp(new->banstring,banmask))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,8 +297,8 @@ Ban *make_ban(Ban **banlist, char *from, char *banmask, time_t when)
|
|||||||
set_mallocdoer(make_ban);
|
set_mallocdoer(make_ban);
|
||||||
new = (Ban*)Calloc(sz);
|
new = (Ban*)Calloc(sz);
|
||||||
|
|
||||||
new->bannedby = Strcpy(new->banstring,banmask) + 1;
|
new->bannedby = stringcpy(new->banstring,banmask) + 1;
|
||||||
Strcpy(new->bannedby,from);
|
stringcpy(new->bannedby,from);
|
||||||
|
|
||||||
new->time = when;
|
new->time = when;
|
||||||
new->next = *banlist;
|
new->next = *banlist;
|
||||||
@ -314,7 +314,7 @@ void delete_ban(Chan *chan, char *banmask)
|
|||||||
while(*pp)
|
while(*pp)
|
||||||
{
|
{
|
||||||
ban = *pp;
|
ban = *pp;
|
||||||
if (!Strcasecmp(ban->banstring,banmask))
|
if (!stringcasecmp(ban->banstring,banmask))
|
||||||
{
|
{
|
||||||
*pp = ban->next;
|
*pp = ban->next;
|
||||||
Free((char**)&ban);
|
Free((char**)&ban);
|
||||||
@ -337,7 +337,7 @@ void delete_modemask(Chan *chan, char *mask, int mode)
|
|||||||
if ((mode == 'I' && ban->imode == TRUE) ||
|
if ((mode == 'I' && ban->imode == TRUE) ||
|
||||||
(mode == 'e' && ban->emode == TRUE))
|
(mode == 'e' && ban->emode == TRUE))
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(ban->banstring,mask))
|
if (!stringcasecmp(ban->banstring,mask))
|
||||||
{
|
{
|
||||||
*pp = ban->next;
|
*pp = ban->next;
|
||||||
Free((char**)&ban);
|
Free((char**)&ban);
|
||||||
@ -364,7 +364,7 @@ void purge_banlist(Chan *chan)
|
|||||||
chan->banlist = NULL;
|
chan->banlist = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void channel_massmode(Chan *chan, char *pattern, int filtmode, char mode, char typechar)
|
void channel_massmode(const Chan *chan, char *pattern, int filtmode, char mode, char typechar)
|
||||||
{
|
{
|
||||||
ChanUser *cu;
|
ChanUser *cu;
|
||||||
char *pat,*uh,burst[MSGLEN],deopstring[MSGLEN];
|
char *pat,*uh,burst[MSGLEN],deopstring[MSGLEN];
|
||||||
@ -458,8 +458,8 @@ void channel_massmode(Chan *chan, char *pattern, int filtmode, char mode, char t
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (willdo && ((cu->flags & CU_MASSTMP) == 0))
|
if (willdo && ((cu->flags & CU_MASSTMP) == 0))
|
||||||
{
|
{
|
||||||
Strcat(deopstring," ");
|
stringcat(deopstring," ");
|
||||||
Strcat(deopstring,cu->nick);
|
stringcat(deopstring,cu->nick);
|
||||||
cu->flags |= CU_MASSTMP;
|
cu->flags |= CU_MASSTMP;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -482,8 +482,8 @@ void channel_massmode(Chan *chan, char *pattern, int filtmode, char mode, char t
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
*burst = 0;
|
*burst = 0;
|
||||||
}
|
}
|
||||||
Strcat(burst,deopstring);
|
stringcat(burst,deopstring);
|
||||||
Strcat(burst,"\n");
|
stringcat(burst,"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ void remove_chanuser(Chan *chan, char *nick)
|
|||||||
uchar ni;
|
uchar ni;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* avoid calling Strcasecmp if first char doesnt match
|
* avoid calling stringcasecmp if first char doesnt match
|
||||||
*/
|
*/
|
||||||
ni = nickcmptab[(uchar)(*nick)];
|
ni = nickcmptab[(uchar)(*nick)];
|
||||||
nick++;
|
nick++;
|
||||||
@ -635,13 +635,13 @@ void make_chanuser(char *nick, char *userhost)
|
|||||||
new->idletime = now;
|
new->idletime = now;
|
||||||
new->next = CurrentChan->users;
|
new->next = CurrentChan->users;
|
||||||
CurrentChan->users = new;
|
CurrentChan->users = new;
|
||||||
Strcpy(new->userhost,userhost);
|
stringcpy(new->userhost,userhost);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nick can change without anything else changing with it
|
* nick can change without anything else changing with it
|
||||||
*/
|
*/
|
||||||
set_mallocdoer(make_chanuser);
|
set_mallocdoer(make_chanuser);
|
||||||
new->nick = Strdup(nick);
|
new->nick = stringdup(nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
void purge_chanusers(Chan *chan)
|
void purge_chanusers(Chan *chan)
|
||||||
@ -789,9 +789,9 @@ void do_channels(COMMAND_ARGS)
|
|||||||
table_buffer("\037channel\037\t \037@\037\t\037users\037\t\037ops\037\t\037voiced\037\t\037modes\037");
|
table_buffer("\037channel\037\t \037@\037\t\037users\037\t\037ops\037\t\037voiced\037\t\037modes\037");
|
||||||
for(chan=current->chanlist;chan;chan=chan->next)
|
for(chan=current->chanlist;chan;chan=chan->next)
|
||||||
{
|
{
|
||||||
p = Strcpy(text,chan->name);
|
p = stringcpy(text,chan->name);
|
||||||
if (chan == current->activechan)
|
if (chan == current->activechan)
|
||||||
p = Strcat(p," (current)");
|
p = stringcat(p," (current)");
|
||||||
if (chan->active)
|
if (chan->active)
|
||||||
{
|
{
|
||||||
u = o = v = 0;
|
u = o = v = 0;
|
||||||
@ -902,17 +902,17 @@ void do_names(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
ChanUser *cu;
|
ChanUser *cu;
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
char names[MSGLEN];
|
char *p,names[MSGLEN];
|
||||||
char *p;
|
const char *tochan;
|
||||||
|
|
||||||
p = get_channel(to,&rest);
|
tochan = get_channel(to,&rest);
|
||||||
if ((chan = find_channel_ny(p)) == NULL)
|
if ((chan = find_channel_ny(tochan)) == NULL)
|
||||||
{
|
{
|
||||||
to_user(from,ERR_CHAN,p);
|
to_user(from,ERR_CHAN,tochan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
to_user(from,"Names on %s%s:",p,(chan->active) ? "" : " (from memory)");
|
to_user(from,"Names on %s%s:",tochan,(chan->active) ? "" : " (from memory)");
|
||||||
for(cu=chan->users;cu;)
|
for(cu=chan->users;cu;)
|
||||||
{
|
{
|
||||||
p = names;
|
p = names;
|
||||||
@ -928,7 +928,7 @@ void do_names(COMMAND_ARGS)
|
|||||||
if ((cu->flags) & CU_VOICE)
|
if ((cu->flags) & CU_VOICE)
|
||||||
*(p++) = '+';
|
*(p++) = '+';
|
||||||
|
|
||||||
p = Strcpy(p,cu->nick);
|
p = stringcpy(p,cu->nick);
|
||||||
cu = cu->next;
|
cu = cu->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,10 +1067,10 @@ void do_who(COMMAND_ARGS)
|
|||||||
|
|
||||||
if (nuh)
|
if (nuh)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(nuh,"-ops"))
|
if (!stringcasecmp(nuh,"-ops"))
|
||||||
flags = 1;
|
flags = 1;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(nuh,"-nonops"))
|
if (!stringcasecmp(nuh,"-nonops"))
|
||||||
flags = 2;
|
flags = 2;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1166,7 +1166,7 @@ void do_showidle(COMMAND_ARGS)
|
|||||||
n = 10;
|
n = 10;
|
||||||
if (*rest)
|
if (*rest)
|
||||||
{
|
{
|
||||||
n = a2i(chop(&rest));
|
n = asc2int(chop(&rest));
|
||||||
if (errno)
|
if (errno)
|
||||||
{
|
{
|
||||||
usage(from); /* usage for CurrentCmd->name */
|
usage(from); /* usage for CurrentCmd->name */
|
||||||
|
|||||||
@ -504,6 +504,13 @@ const char __mx_opts[] = ""
|
|||||||
#undef OPT_COREONLY
|
#undef OPT_COREONLY
|
||||||
#endif /* NEWBIE */
|
#endif /* NEWBIE */
|
||||||
|
|
||||||
|
#ifdef PERL
|
||||||
|
OPT_COMMA "perl"
|
||||||
|
#undef OPT_COMMA
|
||||||
|
#define OPT_COMMA ", "
|
||||||
|
#undef OPT_COREONLY
|
||||||
|
#endif /* PERL */
|
||||||
|
|
||||||
#ifdef PYTHON
|
#ifdef PYTHON
|
||||||
OPT_COMMA "python"
|
OPT_COMMA "python"
|
||||||
#undef OPT_COMMA
|
#undef OPT_COMMA
|
||||||
@ -546,6 +553,20 @@ const char __mx_opts[] = ""
|
|||||||
#undef OPT_COREONLY
|
#undef OPT_COREONLY
|
||||||
#endif /* TELNET */
|
#endif /* TELNET */
|
||||||
|
|
||||||
|
#ifdef TOYBOX
|
||||||
|
OPT_COMMA "toybox"
|
||||||
|
#undef OPT_COMMA
|
||||||
|
#define OPT_COMMA ", "
|
||||||
|
#undef OPT_COREONLY
|
||||||
|
#endif /* TOYBOX */
|
||||||
|
|
||||||
|
#ifdef TRIVIA
|
||||||
|
OPT_COMMA "trivia"
|
||||||
|
#undef OPT_COMMA
|
||||||
|
#define OPT_COMMA ", "
|
||||||
|
#undef OPT_COREONLY
|
||||||
|
#endif /* TRIVIA */
|
||||||
|
|
||||||
#ifdef WINGATES
|
#ifdef WINGATES
|
||||||
OPT_COMMA "wingate"
|
OPT_COMMA "wingate"
|
||||||
#undef OPT_COMMA
|
#undef OPT_COMMA
|
||||||
|
|||||||
58
src/core.c
58
src/core.c
@ -18,7 +18,7 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#define COMBOT_C
|
#define CORE_C
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
@ -66,7 +66,7 @@ void readcfgfile(void)
|
|||||||
in = -1;
|
in = -1;
|
||||||
|
|
||||||
#ifdef SESSION
|
#ifdef SESSION
|
||||||
if (!Strcmp(CFGFILE,configfile))
|
if (!stringcmp(CFGFILE,configfile))
|
||||||
{
|
{
|
||||||
if ((in = open(SESSIONFILE,O_RDONLY)) >= 0)
|
if ((in = open(SESSIONFILE,O_RDONLY)) >= 0)
|
||||||
{
|
{
|
||||||
@ -193,7 +193,7 @@ int write_session(void)
|
|||||||
#endif /* WEB */
|
#endif /* WEB */
|
||||||
|
|
||||||
#ifdef UPTIME
|
#ifdef UPTIME
|
||||||
if (uptimehost && Strcasecmp(uptimehost,defaultuptimehost))
|
if (uptimehost && stringcasecmp(uptimehost,defaultuptimehost))
|
||||||
to_file(sf,"set uphost %s\n",uptimehost);
|
to_file(sf,"set uphost %s\n",uptimehost);
|
||||||
if (uptimeport)
|
if (uptimeport)
|
||||||
to_file(sf,"set upport %i\n",uptimeport);
|
to_file(sf,"set upport %i\n",uptimeport);
|
||||||
@ -325,12 +325,12 @@ void setbotnick(Mech *bot, char *nick)
|
|||||||
/*
|
/*
|
||||||
* if its exactly the same we dont need to change it
|
* if its exactly the same we dont need to change it
|
||||||
*/
|
*/
|
||||||
if (!Strcmp(bot->nick,nick))
|
if (!stringcmp(bot->nick,nick))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Free((char**)&bot->nick);
|
Free((char**)&bot->nick);
|
||||||
set_mallocdoer(setbotnick);
|
set_mallocdoer(setbotnick);
|
||||||
bot->nick = Strdup(nick);
|
bot->nick = stringdup(nick);
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
botnet_refreshbotinfo();
|
botnet_refreshbotinfo();
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
@ -346,9 +346,9 @@ Mech *add_bot(int guid, char *nick)
|
|||||||
bot->sock = -1;
|
bot->sock = -1;
|
||||||
bot->guid = guid;
|
bot->guid = guid;
|
||||||
set_mallocdoer(add_bot);
|
set_mallocdoer(add_bot);
|
||||||
bot->nick = Strdup(nick);
|
bot->nick = stringdup(nick);
|
||||||
set_mallocdoer(add_bot);
|
set_mallocdoer(add_bot);
|
||||||
bot->wantnick = Strdup(nick);
|
bot->wantnick = stringdup(nick);
|
||||||
set_binarydefault(bot->setting);
|
set_binarydefault(bot->setting);
|
||||||
bot->next = botlist;
|
bot->next = botlist;
|
||||||
botlist = bot;
|
botlist = bot;
|
||||||
@ -511,16 +511,16 @@ Server *add_server(char *host, int port, char *pass)
|
|||||||
while(*pp)
|
while(*pp)
|
||||||
{
|
{
|
||||||
sp = *pp;
|
sp = *pp;
|
||||||
if ((!port || sp->port == port) && (!Strcasecmp(host,sp->name) || !Strcasecmp(host,sp->realname)))
|
if ((!port || sp->port == port) && (!stringcasecmp(host,sp->name) || !stringcasecmp(host,sp->realname)))
|
||||||
return(sp);
|
return(sp);
|
||||||
pp = &sp->next;
|
pp = &sp->next;
|
||||||
}
|
}
|
||||||
set_mallocdoer(add_server);
|
set_mallocdoer(add_server);
|
||||||
*pp = sp = (Server*)Calloc(sizeof(Server));
|
*pp = sp = (Server*)Calloc(sizeof(Server));
|
||||||
sp->ident = serverident++;
|
sp->ident = serverident++;
|
||||||
Strncpy(sp->name,host,NAMELEN);
|
stringcpy_n(sp->name,host,NAMELEN);
|
||||||
if (pass && *pass)
|
if (pass && *pass)
|
||||||
Strncpy(sp->pass,pass,PASSLEN);
|
stringcpy_n(sp->pass,pass,PASSLEN);
|
||||||
sp->port = (port) ? port : DEFAULT_IRC_PORT;
|
sp->port = (port) ? port : DEFAULT_IRC_PORT;
|
||||||
if (currentservergroup)
|
if (currentservergroup)
|
||||||
sp->servergroup = currentservergroup->servergroup;
|
sp->servergroup = currentservergroup->servergroup;
|
||||||
@ -533,7 +533,7 @@ ServerGroup *getservergroup(const char *name)
|
|||||||
|
|
||||||
for(sg=servergrouplist;sg;sg=sg->next)
|
for(sg=servergrouplist;sg;sg=sg->next)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(sg->name,name))
|
if (!stringcasecmp(sg->name,name))
|
||||||
return(sg);
|
return(sg);
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -584,7 +584,7 @@ int try_server(Server *sp, char *hostname)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(try_server) rawdns: %s ==> %s\n",sp->name,host);
|
debug("(try_server) rawdns: %s ==> %s\n",sp->name,host);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
Strcpy(temphost,host);
|
stringcpy(temphost,host);
|
||||||
hostname = temphost;
|
hostname = temphost;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -794,8 +794,8 @@ int sub_compile_timer(int limit, ulong *flags1, ulong *flags2, char *args)
|
|||||||
if (!*dash)
|
if (!*dash)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
lo = a2i(s);
|
lo = asc2int(s);
|
||||||
hi = a2i(dash);
|
hi = asc2int(dash);
|
||||||
|
|
||||||
if (lo < 0 || lo > limit || hi < 0 || hi > limit)
|
if (lo < 0 || lo > limit || hi < 0 || hi > limit)
|
||||||
return -1;
|
return -1;
|
||||||
@ -817,7 +817,7 @@ int sub_compile_timer(int limit, ulong *flags1, ulong *flags2, char *args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = a2i(s);
|
n = asc2int(s);
|
||||||
if (n < 0 || n > limit)
|
if (n < 0 || n > limit)
|
||||||
return -1;
|
return -1;
|
||||||
if (n >= 30)
|
if (n >= 30)
|
||||||
@ -910,7 +910,7 @@ int compile_timer(HookTimer *timer, char *rest)
|
|||||||
char backup[strlen(rest)+1];
|
char backup[strlen(rest)+1];
|
||||||
char *sec,*min,*hour,*day;
|
char *sec,*min,*hour,*day;
|
||||||
|
|
||||||
Strcpy(backup,rest);
|
stringcpy(backup,rest);
|
||||||
rest = backup;
|
rest = backup;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(compile_timer) rest = %s\n",nullstr(rest));
|
debug("(compile_timer) rest = %s\n",nullstr(rest));
|
||||||
@ -1020,7 +1020,7 @@ void update(SequenceTime *this)
|
|||||||
if ((now - current->lastreset) > RESETINTERVAL)
|
if ((now - current->lastreset) > RESETINTERVAL)
|
||||||
{
|
{
|
||||||
current->lastreset = now;
|
current->lastreset = now;
|
||||||
if (Strcmp(current->nick,current->wantnick))
|
if (stringcmp(current->nick,current->wantnick))
|
||||||
to_server("NICK %s\n",current->wantnick);
|
to_server("NICK %s\n",current->wantnick);
|
||||||
check_idlekick();
|
check_idlekick();
|
||||||
if ((x = current->setting[INT_AAWAY].int_var) && current->away == FALSE)
|
if ((x = current->setting[INT_AAWAY].int_var) && current->away == FALSE)
|
||||||
@ -1244,7 +1244,7 @@ void do_core(COMMAND_ARGS)
|
|||||||
bu++;
|
bu++;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = Strcmp(current->nick,current->wantnick);
|
i = stringcmp(current->nick,current->wantnick);
|
||||||
if (i)
|
if (i)
|
||||||
table_buffer(TEXT_CURRNICKWANT,current->nick,current->wantnick,current->guid);
|
table_buffer(TEXT_CURRNICKWANT,current->nick,current->wantnick,current->guid);
|
||||||
else
|
else
|
||||||
@ -1266,12 +1266,12 @@ void do_core(COMMAND_ARGS)
|
|||||||
if (chan == current->activechan)
|
if (chan == current->activechan)
|
||||||
{
|
{
|
||||||
*(pt++) = '\037';
|
*(pt++) = '\037';
|
||||||
pt = Strcpy(pt,chan->name);
|
pt = stringcpy(pt,chan->name);
|
||||||
*(pt++) = '\037';
|
*(pt++) = '\037';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pt = Strcpy(pt,chan->name);
|
pt = stringcpy(pt,chan->name);
|
||||||
}
|
}
|
||||||
if (chan->next)
|
if (chan->next)
|
||||||
*(pt++) = ' ';
|
*(pt++) = ' ';
|
||||||
@ -1341,9 +1341,9 @@ void do_die(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_mallocdoer(do_die);
|
set_mallocdoer(do_die);
|
||||||
current->signoff = Strdup(reason);
|
current->signoff = stringdup(reason);
|
||||||
set_mallocdoer(do_die);
|
set_mallocdoer(do_die);
|
||||||
current->from = Strdup(from);
|
current->from = stringdup(from);
|
||||||
|
|
||||||
current->connect = CN_BOTDIE;
|
current->connect = CN_BOTDIE;
|
||||||
}
|
}
|
||||||
@ -1394,7 +1394,7 @@ void do_servergroup(COMMAND_ARGS)
|
|||||||
new = (ServerGroup*)Calloc(sizeof(ServerGroup) + strlen(name));
|
new = (ServerGroup*)Calloc(sizeof(ServerGroup) + strlen(name));
|
||||||
servergroupid++;
|
servergroupid++;
|
||||||
new->servergroup = servergroupid;
|
new->servergroup = servergroupid;
|
||||||
strcpy(new->name,name);
|
stringcpy(new->name,name);
|
||||||
sgp = &servergrouplist;
|
sgp = &servergrouplist;
|
||||||
while(*sgp)
|
while(*sgp)
|
||||||
sgp = &(*sgp)->next;
|
sgp = &(*sgp)->next;
|
||||||
@ -1437,7 +1437,7 @@ void do_server(COMMAND_ARGS)
|
|||||||
*/
|
*/
|
||||||
if (!server)
|
if (!server)
|
||||||
{
|
{
|
||||||
if (dcc_only_command(from))
|
if (partyline_only_command(from))
|
||||||
return;
|
return;
|
||||||
if (servergrouplist->next)
|
if (servergrouplist->next)
|
||||||
table_buffer(str_underline("server") "\t" str_underline("last connect") "\t" str_underline("group"));
|
table_buffer(str_underline("server") "\t" str_underline("last connect") "\t" str_underline("group"));
|
||||||
@ -1515,7 +1515,7 @@ void do_server(COMMAND_ARGS)
|
|||||||
|
|
||||||
aport = chop(&rest);
|
aport = chop(&rest);
|
||||||
pass = chop(&rest);
|
pass = chop(&rest);
|
||||||
iport = a2i(aport);
|
iport = asc2int(aport);
|
||||||
|
|
||||||
if (aport && *aport == COMMENT_CHAR)
|
if (aport && *aport == COMMENT_CHAR)
|
||||||
{
|
{
|
||||||
@ -1548,7 +1548,7 @@ void do_server(COMMAND_ARGS)
|
|||||||
dp = NULL;
|
dp = NULL;
|
||||||
for(sp=serverlist;sp;sp=sp->next)
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
if ((!Strcasecmp(server,sp->name)) || (!Strcasecmp(server,sp->realname)))
|
if ((!stringcasecmp(server,sp->name)) || (!stringcasecmp(server,sp->realname)))
|
||||||
{
|
{
|
||||||
if (!iport || (iport && sp->port == iport))
|
if (!iport || (iport && sp->port == iport))
|
||||||
{
|
{
|
||||||
@ -1653,7 +1653,7 @@ void do_nick(COMMAND_ARGS)
|
|||||||
usage(from); /* usage for CurrentCmd->name */
|
usage(from); /* usage for CurrentCmd->name */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
guid = a2i(nick);
|
guid = asc2int(nick);
|
||||||
backup = current;
|
backup = current;
|
||||||
if (!errno)
|
if (!errno)
|
||||||
{
|
{
|
||||||
@ -1689,12 +1689,12 @@ void do_nick(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
Free((char**)¤t->nick);
|
Free((char**)¤t->nick);
|
||||||
set_mallocdoer(do_nick);
|
set_mallocdoer(do_nick);
|
||||||
current->nick = Strdup(nick);
|
current->nick = stringdup(nick);
|
||||||
current->guid = guid;
|
current->guid = guid;
|
||||||
}
|
}
|
||||||
Free((char**)¤t->wantnick);
|
Free((char**)¤t->wantnick);
|
||||||
set_mallocdoer(do_nick);
|
set_mallocdoer(do_nick);
|
||||||
current->wantnick = Strdup(nick);
|
current->wantnick = stringdup(nick);
|
||||||
to_server("NICK %s\n",current->wantnick);
|
to_server("NICK %s\n",current->wantnick);
|
||||||
}
|
}
|
||||||
current = backup;
|
current = backup;
|
||||||
|
|||||||
251
src/ctcp.c
251
src/ctcp.c
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
EnergyMech, IRC bot software
|
||||||
Parts Copyright (c) 1997-2004 proton
|
Parts Copyright (c) 1997-2018 proton
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -28,19 +28,6 @@
|
|||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "mcmd.h"
|
#include "mcmd.h"
|
||||||
|
|
||||||
int dcc_only_command(char *from)
|
|
||||||
{
|
|
||||||
#ifdef REDIRECT
|
|
||||||
if (!redirect.to)
|
|
||||||
#endif /* REDIRECT */
|
|
||||||
if (!CurrentDCC)
|
|
||||||
{
|
|
||||||
to_user(from,TEXT_DCC_ONLY,CurrentCmd->name);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *find_client(const char *nick)
|
Client *find_client(const char *nick)
|
||||||
{
|
{
|
||||||
Client *client;
|
Client *client;
|
||||||
@ -50,7 +37,7 @@ Client *find_client(const char *nick)
|
|||||||
|
|
||||||
for(client=current->clientlist;client;client=client->next)
|
for(client=current->clientlist;client;client=client->next)
|
||||||
{
|
{
|
||||||
if (((client->flags & DCC_SEND) == 0) && !Strcasecmp(nick,client->user->name))
|
if (((client->flags & DCC_SEND) == 0) && !stringcasecmp(nick,client->user->name))
|
||||||
return(client);
|
return(client);
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -106,49 +93,6 @@ void delete_client(Client *client)
|
|||||||
Free((char **)&client);
|
Free((char **)&client);
|
||||||
}
|
}
|
||||||
|
|
||||||
void partyline_broadcast(Client *from, char *format, char *rest)
|
|
||||||
{
|
|
||||||
Client *client;
|
|
||||||
Mech *bot;
|
|
||||||
|
|
||||||
for(bot=botlist;bot;bot=bot->next)
|
|
||||||
{
|
|
||||||
for(client=bot->clientlist;client;client=client->next)
|
|
||||||
{
|
|
||||||
if (0 == (client->flags & (DCC_ACTIVE|DCC_TELNET)))
|
|
||||||
continue;
|
|
||||||
if (client == from && client->user->x.x.echo == FALSE)
|
|
||||||
continue;
|
|
||||||
to_file(client->sock,format,CurrentNick,rest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dcc_banner(Client *client)
|
|
||||||
{
|
|
||||||
char tmp[MSGLEN];
|
|
||||||
|
|
||||||
client->flags = DCC_ACTIVE;
|
|
||||||
client->lasttime = now;
|
|
||||||
|
|
||||||
sprintf(tmp,"[%s] %s[%i] has connected",
|
|
||||||
current->nick,client->user->name,(int)client->user->x.x.access);
|
|
||||||
|
|
||||||
if ((to_file(client->sock,"[%s] %s\n",time2medium(now),tmp)) < 0)
|
|
||||||
{
|
|
||||||
client->flags = DCC_DELETE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
send_global(SPYSTR_STATUS,tmp);
|
|
||||||
if (client->user->x.x.access == OWNERLEVEL)
|
|
||||||
{
|
|
||||||
CurrentDCC = client;
|
|
||||||
Strcpy(tmp,SPYSTR_STATUS);
|
|
||||||
do_spy(client->user->name,current->nick,tmp,0);
|
|
||||||
CurrentDCC = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DCC_FILE
|
#ifdef DCC_FILE
|
||||||
|
|
||||||
int dcc_sendfile(char *target, char *filename)
|
int dcc_sendfile(char *target, char *filename)
|
||||||
@ -158,8 +102,8 @@ int dcc_sendfile(char *target, char *filename)
|
|||||||
int s,f,sz;
|
int s,f,sz;
|
||||||
char tempfile[strlen(filename)+strlen(DCC_PUBLICFILES)+2]; // strlen(DCC_PUBLICFILES) evaluates at compile time to a constant.
|
char tempfile[strlen(filename)+strlen(DCC_PUBLICFILES)+2]; // strlen(DCC_PUBLICFILES) evaluates at compile time to a constant.
|
||||||
|
|
||||||
Strcpy(tempfile,DCC_PUBLICFILES);
|
stringcpy(tempfile,DCC_PUBLICFILES);
|
||||||
Strcat(tempfile,filename);
|
stringcat(tempfile,filename);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(dcc_sendfile) opening %s for transfer\n",tempfile);
|
debug("(dcc_sendfile) opening %s for transfer\n",tempfile);
|
||||||
@ -184,8 +128,8 @@ int dcc_sendfile(char *target, char *filename)
|
|||||||
client->user = NULL;
|
client->user = NULL;
|
||||||
client->flags = DCC_WAIT|DCC_ASYNC|DCC_SEND;
|
client->flags = DCC_WAIT|DCC_ASYNC|DCC_SEND;
|
||||||
client->lasttime = now;
|
client->lasttime = now;
|
||||||
client->whom = Strcpy(client->filename,filename) + 1;
|
client->whom = stringcpy(client->filename,filename) + 1;
|
||||||
Strcpy(client->whom,target);
|
stringcpy(client->whom,target);
|
||||||
|
|
||||||
client->next = current->clientlist;
|
client->next = current->clientlist;
|
||||||
current->clientlist = client;
|
current->clientlist = client;
|
||||||
@ -265,7 +209,7 @@ void parse_dcc(Client *client)
|
|||||||
/*
|
/*
|
||||||
* tell them how much we love them
|
* tell them how much we love them
|
||||||
*/
|
*/
|
||||||
dcc_banner(client);
|
partyline_banner(client);
|
||||||
}
|
}
|
||||||
#ifdef DCC_FILE
|
#ifdef DCC_FILE
|
||||||
else
|
else
|
||||||
@ -392,7 +336,7 @@ void parse_dcc(Client *client)
|
|||||||
client->lasttime = now;
|
client->lasttime = now;
|
||||||
CurrentDCC = client;
|
CurrentDCC = client;
|
||||||
CurrentUser = client->user;
|
CurrentUser = client->user;
|
||||||
Strcpy(CurrentNick,CurrentUser->name);
|
stringcpy(CurrentNick,CurrentUser->name);
|
||||||
|
|
||||||
if (*ptr == 1)
|
if (*ptr == 1)
|
||||||
{
|
{
|
||||||
@ -438,7 +382,7 @@ void process_dcc(void)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(process_dcc) chat connected [ASYNC]\n");
|
debug("(process_dcc) chat connected [ASYNC]\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
dcc_banner(client);
|
partyline_banner(client);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ((client->flags & DCC_WAIT) && ((now - client->lasttime) >= WAITTIMEOUT))
|
if ((client->flags & DCC_WAIT) && ((now - client->lasttime) >= WAITTIMEOUT))
|
||||||
@ -471,51 +415,6 @@ void process_dcc(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dcc_chat(char *from)
|
|
||||||
{
|
|
||||||
struct sockaddr_in sai;
|
|
||||||
Client *client;
|
|
||||||
User *user;
|
|
||||||
int sock,sz;
|
|
||||||
|
|
||||||
if ((user = get_authuser(from,NULL)) == NULL)
|
|
||||||
return;
|
|
||||||
if (find_client(user->name))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((sock = SockListener(0)) < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
sz = sizeof(sai);
|
|
||||||
if (getsockname(sock,(struct sockaddr *)&sai,&sz) < 0)
|
|
||||||
{
|
|
||||||
close(sock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_mallocdoer(dcc_chat);
|
|
||||||
client = (Client*)Calloc(sizeof(Client));
|
|
||||||
#ifdef DCC_FILE
|
|
||||||
client->fileno = -1;
|
|
||||||
#endif /* DCC_FILE */
|
|
||||||
client->user = user;
|
|
||||||
client->sock = sock;
|
|
||||||
client->flags = DCC_WAIT;
|
|
||||||
client->lasttime = now;
|
|
||||||
|
|
||||||
client->next = current->clientlist;
|
|
||||||
current->clientlist = client;
|
|
||||||
|
|
||||||
to_server("PRIVMSG %s :\001DCC CHAT CHAT %u %u\001\n",
|
|
||||||
CurrentNick,htonl(current->ip.s_addr),ntohs(sai.sin_port));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* CTCP things...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ctcp_dcc(char *from, char *to, char *rest)
|
void ctcp_dcc(char *from, char *to, char *rest)
|
||||||
{
|
{
|
||||||
struct in_addr ia;
|
struct in_addr ia;
|
||||||
@ -545,7 +444,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
send_spy(SPYSTR_STATUS,"[DCC] :%s[%i]: Requested DCC %s [%s]",CurrentNick,x,port,nullstr(rest));
|
send_spy(SPYSTR_STATUS,"[DCC] :%s[%i]: Requested DCC %s [%s]",CurrentNick,x,port,nullstr(rest));
|
||||||
|
|
||||||
#ifdef DCC_FILE
|
#ifdef DCC_FILE
|
||||||
if (!Strcasecmp(port,"SEND"))
|
if (!stringcasecmp(port,"SEND"))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(ctcp_dcc) rest: `%s'\n",nullstr(rest));
|
debug("(ctcp_dcc) rest: `%s'\n",nullstr(rest));
|
||||||
@ -566,7 +465,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
{
|
{
|
||||||
char tempmask[strlen(addr)+1];
|
char tempmask[strlen(addr)+1];
|
||||||
|
|
||||||
Strcpy(tempmask,addr);
|
stringcpy(tempmask,addr);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
port = chop(&addr);
|
port = chop(&addr);
|
||||||
@ -591,9 +490,9 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
|
|
||||||
addr = chop(&rest);
|
addr = chop(&rest);
|
||||||
port = chop(&rest);
|
port = chop(&rest);
|
||||||
portnum = a2i(port);
|
portnum = asc2int(port);
|
||||||
x = errno;
|
x = errno;
|
||||||
filesz = a2i(rest);
|
filesz = asc2int(rest);
|
||||||
if (errno || x || portnum < 1024 || portnum > 63353 || filesz <= 0)
|
if (errno || x || portnum < 1024 || portnum > 63353 || filesz <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -604,13 +503,13 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
addr++;
|
addr++;
|
||||||
}
|
}
|
||||||
ia.s_addr = ntohl(longip);
|
ia.s_addr = ntohl(longip);
|
||||||
Strcpy(ip_addr,inet_ntoa(ia));
|
stringcpy(ip_addr,inet_ntoa(ia));
|
||||||
|
|
||||||
if (1)
|
if (1)
|
||||||
{
|
{
|
||||||
char tempname[strlen(filename)+strlen(DCC_PUBLICINCOMING)+1]; // strlen(DCC_PUBLICINCOMING) evaluates to a constant during compile.
|
char tempname[strlen(filename)+strlen(DCC_PUBLICINCOMING)+1]; // strlen(DCC_PUBLICINCOMING) evaluates to a constant during compile.
|
||||||
|
|
||||||
Strcpy(Strcpy(tempname,DCC_PUBLICINCOMING),filename);
|
stringcpy(stringcpy(tempname,DCC_PUBLICINCOMING),filename);
|
||||||
|
|
||||||
if ((f = open(tempname,O_RDWR|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
|
if ((f = open(tempname,O_RDWR|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
|
||||||
return;
|
return;
|
||||||
@ -626,8 +525,8 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
client->sock = s;
|
client->sock = s;
|
||||||
client->flags = DCC_WAIT|DCC_SEND|DCC_RECV;
|
client->flags = DCC_WAIT|DCC_SEND|DCC_RECV;
|
||||||
client->lasttime = client->start = now;
|
client->lasttime = client->start = now;
|
||||||
client->whom = Strcpy(client->filename,filename) + 1;
|
client->whom = stringcpy(client->filename,filename) + 1;
|
||||||
Strcpy(client->whom,from);
|
stringcpy(client->whom,from);
|
||||||
|
|
||||||
client->next = current->clientlist;
|
client->next = current->clientlist;
|
||||||
current->clientlist = client;
|
current->clientlist = client;
|
||||||
@ -635,7 +534,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* DCC_FILE */
|
#endif /* DCC_FILE */
|
||||||
if (x && (x < BOTLEVEL) && !Strcasecmp(port,"CHAT"))
|
if (x && (x < BOTLEVEL) && !stringcasecmp(port,"CHAT"))
|
||||||
{
|
{
|
||||||
if ((user = get_authuser(from,NULL)) == NULL)
|
if ((user = get_authuser(from,NULL)) == NULL)
|
||||||
{
|
{
|
||||||
@ -652,7 +551,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
if (!port || !*port)
|
if (!port || !*port)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x = a2i(port);
|
x = asc2int(port);
|
||||||
if (errno || (x < 1024) || (x > 65535))
|
if (errno || (x < 1024) || (x > 65535))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -667,7 +566,7 @@ void ctcp_dcc(char *from, char *to, char *rest)
|
|||||||
addr++;
|
addr++;
|
||||||
}
|
}
|
||||||
ia.s_addr = ntohl(longip);
|
ia.s_addr = ntohl(longip);
|
||||||
Strcpy(ip_addr,inet_ntoa(ia));
|
stringcpy(ip_addr,inet_ntoa(ia));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(ctcp_dcc) %s [%s,%s]\n",from,ip_addr,port);
|
debug("(ctcp_dcc) %s [%s,%s]\n",from,ip_addr,port);
|
||||||
@ -821,7 +720,7 @@ void on_ctcp(char *from, char *to, char *rest)
|
|||||||
}
|
}
|
||||||
for(i=0;ctcp_commands[i].name;i++)
|
for(i=0;ctcp_commands[i].name;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(ctcp_commands[i].name,command))
|
if (!stringcasecmp(ctcp_commands[i].name,command))
|
||||||
{
|
{
|
||||||
#ifdef CTCP
|
#ifdef CTCP
|
||||||
if (ctcp_commands[i].need_slot)
|
if (ctcp_commands[i].need_slot)
|
||||||
@ -861,21 +760,6 @@ void on_ctcp(char *from, char *to, char *rest)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void do_chat(COMMAND_ARGS)
|
|
||||||
{
|
|
||||||
User *user;
|
|
||||||
|
|
||||||
user = get_authuser(from,NULL);
|
|
||||||
if (!user)
|
|
||||||
return;
|
|
||||||
if (find_client(user->name))
|
|
||||||
{
|
|
||||||
to_user(from,"You are already DCC chatting me");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dcc_chat(from);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CTCP
|
#ifdef CTCP
|
||||||
|
|
||||||
void do_ping_ctcp(COMMAND_ARGS)
|
void do_ping_ctcp(COMMAND_ARGS)
|
||||||
@ -887,7 +771,7 @@ void do_ping_ctcp(COMMAND_ARGS)
|
|||||||
|
|
||||||
if ((target = chop(&rest)))
|
if ((target = chop(&rest)))
|
||||||
{
|
{
|
||||||
if (CurrentCmd->name == C_PING || !Strcasecmp(rest,"PING"))
|
if (CurrentCmd->name == C_PING || !stringcasecmp(rest,"PING"))
|
||||||
{
|
{
|
||||||
to_server("PRIVMSG %s :\001PING %lu\001\n",target,now);
|
to_server("PRIVMSG %s :\001PING %lu\001\n",target,now);
|
||||||
return;
|
return;
|
||||||
@ -903,97 +787,6 @@ void do_ping_ctcp(COMMAND_ARGS)
|
|||||||
|
|
||||||
#endif /* CTCP */
|
#endif /* CTCP */
|
||||||
|
|
||||||
#ifdef BOTNET
|
|
||||||
|
|
||||||
void whom_printbot(char *from, BotInfo *binfo, char *stt)
|
|
||||||
{
|
|
||||||
char *us;
|
|
||||||
int uaccess;
|
|
||||||
|
|
||||||
us = "";
|
|
||||||
if (binfo->nuh)
|
|
||||||
{
|
|
||||||
uaccess = get_maxaccess(binfo->nuh);
|
|
||||||
if (uaccess == BOTLEVEL)
|
|
||||||
us = "b200";
|
|
||||||
else
|
|
||||||
if (uaccess)
|
|
||||||
sprintf((us = stt),"u%i",uaccess);
|
|
||||||
}
|
|
||||||
uaccess = get_authaccess(from,MATCH_ALL);
|
|
||||||
table_buffer((uaccess >= ASSTLEVEL) ? TEXT_WHOMBOTGUID : TEXT_WHOMBOTLINE,(binfo->nuh) ? nickcpy(NULL,binfo->nuh) : "???",us,
|
|
||||||
(binfo->server) ? binfo->server : "???",(binfo->version) ? binfo->version : "???",binfo->guid);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* BOTNET */
|
|
||||||
|
|
||||||
void do_whom(COMMAND_ARGS)
|
|
||||||
{
|
|
||||||
#ifdef BOTNET
|
|
||||||
BotNet *bn;
|
|
||||||
BotInfo *binfo;
|
|
||||||
#endif /* BOTNET */
|
|
||||||
Server *sp;
|
|
||||||
char stt[NUHLEN];
|
|
||||||
Client *client;
|
|
||||||
Mech *bot;
|
|
||||||
int m,s;
|
|
||||||
|
|
||||||
if (dcc_only_command(from))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for(bot=botlist;bot;bot=bot->next)
|
|
||||||
{
|
|
||||||
if (bot->connect == CN_ONLINE)
|
|
||||||
{
|
|
||||||
sp = find_server(bot->server);
|
|
||||||
if (sp)
|
|
||||||
{
|
|
||||||
sprintf(stt,"%s:%i",(*sp->realname) ? sp->realname : sp->name,sp->port);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Strcpy(stt,TEXT_NOTINSERVLIST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Strcpy(stt,TEXT_NOTCONNECTED);
|
|
||||||
}
|
|
||||||
table_buffer(TEXT_WHOMSELFLINE,bot->nick,(bot == current) ? "(me)" : "b200",stt);
|
|
||||||
for(client=bot->clientlist;client;client=client->next)
|
|
||||||
{
|
|
||||||
m = (now - client->lasttime) / 60;
|
|
||||||
s = (now - client->lasttime) % 60;
|
|
||||||
table_buffer(TEXT_WHOMUSERLINE,
|
|
||||||
#ifdef TELNET
|
|
||||||
client->user->name,client->user->x.x.access,(client->flags & DCC_TELNET) ? "telnet" : "DCC",m,s);
|
|
||||||
#else
|
|
||||||
client->user->name,client->user->x.x.access,"DCC",m,s);
|
|
||||||
#endif /* TELNET */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef BOTNET
|
|
||||||
for(bn=botnetlist;bn;bn=bn->next)
|
|
||||||
{
|
|
||||||
if (bn->status != BN_LINKED)
|
|
||||||
continue;
|
|
||||||
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
|
||||||
whom_printbot(from,binfo,stt);
|
|
||||||
}
|
|
||||||
#endif /* BOTNET */
|
|
||||||
table_send(from,3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void do_bye(COMMAND_ARGS)
|
|
||||||
{
|
|
||||||
if (CurrentDCC)
|
|
||||||
{
|
|
||||||
to_user(from,TEXT_DCC_GOODBYE);
|
|
||||||
CurrentDCC->flags = DCC_DELETE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DCC_FILE
|
#ifdef DCC_FILE
|
||||||
|
|
||||||
void do_send(COMMAND_ARGS)
|
void do_send(COMMAND_ARGS)
|
||||||
|
|||||||
12
src/debug.c
12
src/debug.c
@ -347,8 +347,8 @@ void strflags(char *dst, const DEFstruct *flagsstruct, int flags)
|
|||||||
if (flagsstruct[i].v.id & flags)
|
if (flagsstruct[i].v.id & flags)
|
||||||
{
|
{
|
||||||
if (*dst)
|
if (*dst)
|
||||||
Strcat(dst,"|");
|
stringcat(dst,"|");
|
||||||
Strcat(dst,flagsstruct[i].idstr);
|
stringcat(dst,flagsstruct[i].idstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -608,7 +608,7 @@ void debug_memory(void)
|
|||||||
funcname = (char*)proc_lookup(mea->mme[i].doer,mea->mme[i].size);
|
funcname = (char*)proc_lookup(mea->mme[i].doer,mea->mme[i].size);
|
||||||
if (funcname)
|
if (funcname)
|
||||||
{
|
{
|
||||||
Strcpy(t,funcname);
|
stringcpy(t,funcname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -635,14 +635,14 @@ void debug_memory(void)
|
|||||||
while(n > 0)
|
while(n > 0)
|
||||||
{
|
{
|
||||||
n = n - 8;
|
n = n - 8;
|
||||||
Strcat(t,"\t");
|
stringcat(t,"\t");
|
||||||
}
|
}
|
||||||
Strcat(t,ProcList[i].name);
|
stringcat(t,ProcList[i].name);
|
||||||
n = 32 - strlen(ProcList[i].name);
|
n = 32 - strlen(ProcList[i].name);
|
||||||
while(n > 0)
|
while(n > 0)
|
||||||
{
|
{
|
||||||
n = n - 8;
|
n = n - 8;
|
||||||
Strcat(t,"\t");
|
stringcat(t,"\t");
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("%s%i\t\t%i\t\t%i\n",t,ProcList[i].num,ProcList[i].size,ProcList[i].mall_size);
|
debug("%s%i\t\t%i\t\t%i\n",t,ProcList[i].num,ProcList[i].size,ProcList[i].mall_size);
|
||||||
|
|||||||
@ -82,6 +82,9 @@
|
|||||||
#define MAXSHITLEVELSTRING "4"
|
#define MAXSHITLEVELSTRING "4"
|
||||||
#define MAXSHITLEVELCHAR '4'
|
#define MAXSHITLEVELCHAR '4'
|
||||||
|
|
||||||
|
#define __STR_ON "on"
|
||||||
|
#define __STR_OFF "off"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* channel modequeues
|
* channel modequeues
|
||||||
*/
|
*/
|
||||||
|
|||||||
36
src/dns.c
36
src/dns.c
@ -97,7 +97,7 @@ struct in_addr dnsroot_lookup(const char *hostname)
|
|||||||
|
|
||||||
for(da=dnsroot;da;da=da->next)
|
for(da=dnsroot;da;da=da->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(hostname,da->hostname))
|
if (!stringcasecmp(hostname,da->hostname))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(dnsroot_lookup) %s = %s\n",hostname,inet_ntoa(da->ip));
|
debug("(dnsroot_lookup) %s = %s\n",hostname,inet_ntoa(da->ip));
|
||||||
@ -208,7 +208,7 @@ void dns_hook(char *host, char * resolved)
|
|||||||
backbot = current;
|
backbot = current;
|
||||||
for(hook=hooklist;hook;hook=hook->next)
|
for(hook=hooklist;hook;hook=hook->next)
|
||||||
{
|
{
|
||||||
if (hook->flags == HOOK_DNS && !Strcasecmp(host,hook->type.host))
|
if (hook->flags == HOOK_DNS && !stringcasecmp(host,hook->type.host))
|
||||||
{
|
{
|
||||||
for(current=botlist;current;current=current->next)
|
for(current=botlist;current;current=current->next)
|
||||||
{
|
{
|
||||||
@ -294,7 +294,7 @@ void parse_query(int psz, dnsQuery *query)
|
|||||||
Free((char**)&dns->cname);
|
Free((char**)&dns->cname);
|
||||||
dns->when = now + 30;
|
dns->when = now + 30;
|
||||||
set_mallocdoer(parse_query);
|
set_mallocdoer(parse_query);
|
||||||
dns->cname = Strdup(token2);
|
dns->cname = stringdup(token2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((unpack_ushort(&rtyp[0]) == DNS_TYPE_A) &&
|
if ((unpack_ushort(&rtyp[0]) == DNS_TYPE_A) &&
|
||||||
@ -302,7 +302,7 @@ void parse_query(int psz, dnsQuery *query)
|
|||||||
(unpack_ushort(&rtyp[8]) == 4))
|
(unpack_ushort(&rtyp[8]) == 4))
|
||||||
{
|
{
|
||||||
ip = get_stored_ip(src);
|
ip = get_stored_ip(src);
|
||||||
if (dns->auth && !Strcasecmp(dns->auth->hostname,token))
|
if (dns->auth && !stringcasecmp(dns->auth->hostname,token))
|
||||||
{
|
{
|
||||||
dns->auth->ip.s_addr = ip->s_addr;
|
dns->auth->ip.s_addr = ip->s_addr;
|
||||||
dns->when = now + 60;
|
dns->when = now + 60;
|
||||||
@ -311,7 +311,7 @@ void parse_query(int psz, dnsQuery *query)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(dns->host,token) || (dns->cname && !Strcasecmp(dns->cname,token)))
|
if (!stringcasecmp(dns->host,token) || (dns->cname && !stringcasecmp(dns->cname,token)))
|
||||||
{
|
{
|
||||||
dns->ip.s_addr = ip->s_addr;
|
dns->ip.s_addr = ip->s_addr;
|
||||||
dns->when = now + 3600;
|
dns->when = now + 3600;
|
||||||
@ -359,7 +359,7 @@ void parse_query(int psz, dnsQuery *query)
|
|||||||
set_mallocdoer(parse_query);
|
set_mallocdoer(parse_query);
|
||||||
da = dns->auth = (dnsAuthority*)Calloc(sizeof(dnsAuthority) + strlen(token2));
|
da = dns->auth = (dnsAuthority*)Calloc(sizeof(dnsAuthority) + strlen(token2));
|
||||||
/* Calloc sets to zero da->ip.s_addr = 0; */
|
/* Calloc sets to zero da->ip.s_addr = 0; */
|
||||||
Strcpy(da->hostname,token2);
|
stringcpy(da->hostname,token2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (dns->findauth == 1)
|
if (dns->findauth == 1)
|
||||||
@ -370,7 +370,7 @@ void parse_query(int psz, dnsQuery *query)
|
|||||||
set_mallocdoer(parse_query);
|
set_mallocdoer(parse_query);
|
||||||
da = dns->auth2 = (dnsAuthority*)Calloc(sizeof(dnsAuthority) + strlen(token2));
|
da = dns->auth2 = (dnsAuthority*)Calloc(sizeof(dnsAuthority) + strlen(token2));
|
||||||
/* Calloc sets to zero da->ip.s_addr = 0; */
|
/* Calloc sets to zero da->ip.s_addr = 0; */
|
||||||
Strcpy(da->hostname,token2);
|
stringcpy(da->hostname,token2);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_query) 2nd auth set: %s\n",token2);
|
debug("(parse_query) 2nd auth set: %s\n",token2);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -407,9 +407,9 @@ void parse_query(int psz, dnsQuery *query)
|
|||||||
(unpack_ushort(&rtyp[8]) == 4))
|
(unpack_ushort(&rtyp[8]) == 4))
|
||||||
{
|
{
|
||||||
ip = get_stored_ip(src);
|
ip = get_stored_ip(src);
|
||||||
if (dns->auth && !Strcasecmp(dns->auth->hostname,token))
|
if (dns->auth && !stringcasecmp(dns->auth->hostname,token))
|
||||||
dns->auth->ip.s_addr = ip->s_addr;
|
dns->auth->ip.s_addr = ip->s_addr;
|
||||||
if (dns->auth2 && !Strcasecmp(dns->auth2->hostname,token))
|
if (dns->auth2 && !stringcasecmp(dns->auth2->hostname,token))
|
||||||
dns->auth2->ip.s_addr = ip->s_addr;
|
dns->auth2->ip.s_addr = ip->s_addr;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_query) resources: %s = %s\n",token,inet_ntoa(*ip));
|
debug("(parse_query) resources: %s = %s\n",token,inet_ntoa(*ip));
|
||||||
@ -569,7 +569,7 @@ void rawdns(const char *hostname)
|
|||||||
|
|
||||||
set_mallocdoer(rawdns);
|
set_mallocdoer(rawdns);
|
||||||
item = (dnsList*)Calloc(sizeof(dnsList) + strlen(hostname));
|
item = (dnsList*)Calloc(sizeof(dnsList) + strlen(hostname));
|
||||||
Strcpy(item->host,hostname);
|
stringcpy(item->host,hostname);
|
||||||
item->id = ntohs(query->qid);
|
item->id = ntohs(query->qid);
|
||||||
item->when = now + 30;
|
item->when = now + 30;
|
||||||
item->next = dnslist;
|
item->next = dnslist;
|
||||||
@ -664,7 +664,7 @@ char *poll_rawdns(char *hostname)
|
|||||||
|
|
||||||
for(dns=dnslist;dns;dns=dns->next)
|
for(dns=dnslist;dns;dns=dns->next)
|
||||||
{
|
{
|
||||||
if (dns->ip.s_addr && !Strcasecmp(dns->host,hostname))
|
if (dns->ip.s_addr && !stringcasecmp(dns->host,hostname))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(poll_rawdns) a: %s ==> %s\n",hostname,inet_ntoa(dns->ip));
|
debug("(poll_rawdns) a: %s ==> %s\n",hostname,inet_ntoa(dns->ip));
|
||||||
@ -685,11 +685,11 @@ int read_dnsroot(char *line)
|
|||||||
|
|
||||||
name = chop(&line);
|
name = chop(&line);
|
||||||
a = chop(&line); /* TTL is optional */
|
a = chop(&line); /* TTL is optional */
|
||||||
if (a && Strcmp(a,"A"))
|
if (a && stringcmp(a,"A"))
|
||||||
a = chop(&line);
|
a = chop(&line);
|
||||||
ip = chop(&line);
|
ip = chop(&line);
|
||||||
|
|
||||||
if (a && !Strcmp(a,"A") && ip && inet_aton(ip,&ia) != 0)
|
if (a && !stringcmp(a,"A") && ip && inet_aton(ip,&ia) != 0)
|
||||||
{
|
{
|
||||||
/* remove trailing dot */
|
/* remove trailing dot */
|
||||||
for(src=name;*src;)
|
for(src=name;*src;)
|
||||||
@ -701,7 +701,7 @@ int read_dnsroot(char *line)
|
|||||||
}
|
}
|
||||||
set_mallocdoer(read_dnsroot);
|
set_mallocdoer(read_dnsroot);
|
||||||
da = (dnsAuthority*)Calloc(sizeof(dnsAuthority) + strlen(name));
|
da = (dnsAuthority*)Calloc(sizeof(dnsAuthority) + strlen(name));
|
||||||
Strcpy(da->hostname,name);
|
stringcpy(da->hostname,name);
|
||||||
da->ip.s_addr = ia.s_addr;
|
da->ip.s_addr = ia.s_addr;
|
||||||
da->next = dnsroot;
|
da->next = dnsroot;
|
||||||
dnsroot = da;
|
dnsroot = da;
|
||||||
@ -747,7 +747,7 @@ void do_dnsroot(COMMAND_ARGS)
|
|||||||
|
|
||||||
p = (Strp*)Calloc(strlen(rest)+1);
|
p = (Strp*)Calloc(strlen(rest)+1);
|
||||||
p->next = dnsrootfiles;
|
p->next = dnsrootfiles;
|
||||||
Strcpy(p->p,rest);
|
stringcpy(p->p,rest);
|
||||||
dnsrootfiles = p;
|
dnsrootfiles = p;
|
||||||
#endif /* SESSION */
|
#endif /* SESSION */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -785,14 +785,14 @@ void do_dnsserver(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p = Strcpy(p,inet_ntoa(ia_ns[i]));
|
p = stringcpy(p,inet_ntoa(ia_ns[i]));
|
||||||
*(p++) = ' ';
|
*(p++) = ' ';
|
||||||
*p = 0;
|
*p = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*tempservers == 0)
|
if (*tempservers == 0)
|
||||||
Strcpy(tempservers,"\037127.0.0.1\037");
|
stringcpy(tempservers,"\037127.0.0.1\037");
|
||||||
to_user(from,"Current DNS Servers: %s",tempservers);
|
to_user(from,"Current DNS Servers: %s",tempservers);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -900,7 +900,7 @@ flipstep:
|
|||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
goto flipstep;
|
goto flipstep;
|
||||||
}
|
}
|
||||||
Strcpy(Strcpy(dst,host),".in-addr.arpa");
|
stringcpy(stringcpy(dst,host),".in-addr.arpa");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(do_dns) host flipped to %s\n",gsockdata);
|
debug("(do_dns) host flipped to %s\n",gsockdata);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|||||||
@ -1,88 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
|
||||||
Copyright (c) 2001-2004 proton
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#define DYNAMODE_C
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#ifdef DYNAMODE
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "global.h"
|
|
||||||
#include "h.h"
|
|
||||||
|
|
||||||
void check_dynamode(Chan *chan)
|
|
||||||
{
|
|
||||||
ChanUser *cu;
|
|
||||||
char tempconf[strlen(chan->setting[STR_DYNLIMIT].str_var)+2];
|
|
||||||
char ascnum[11];
|
|
||||||
char *src,*num,*end;
|
|
||||||
int n = 0,wind,v[3];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* parse `delay:window:minwin'
|
|
||||||
*/
|
|
||||||
end = Strcpy(tempconf,chan->setting[STR_DYNLIMIT].str_var);
|
|
||||||
num = src = tempconf;
|
|
||||||
for(;(src<=end) && (n<3);src++)
|
|
||||||
{
|
|
||||||
if (*src == 0 || *src == ':')
|
|
||||||
{
|
|
||||||
*src = 0;
|
|
||||||
v[n] = a2i(num);
|
|
||||||
if (errno)
|
|
||||||
{
|
|
||||||
v[0] = 90; /* delay */
|
|
||||||
v[1] = 10; /* window */
|
|
||||||
v[2] = 4; /* minwin */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
num = src+1;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
v[0] = (v[0] < 20) ? 20 : (v[0] > 600) ? 600 : v[0];
|
|
||||||
if ((now - chan->lastlimit) < v[0])
|
|
||||||
return;
|
|
||||||
v[1] = (v[1] < 5) ? 5 : (v[1] > 50) ? 50 : v[1];
|
|
||||||
v[2] = (v[2] < 1) ? 1 : (v[2] > 50) ? 50 : v[2];
|
|
||||||
|
|
||||||
chan->lastlimit = now;
|
|
||||||
|
|
||||||
n = 0;
|
|
||||||
for(cu=chan->users;cu;cu=cu->next)
|
|
||||||
n++;
|
|
||||||
|
|
||||||
wind = n / v[1];
|
|
||||||
if (wind < v[2])
|
|
||||||
wind = v[2];
|
|
||||||
|
|
||||||
wind += n;
|
|
||||||
|
|
||||||
n = wind - chan->limit;
|
|
||||||
|
|
||||||
if (!chan->limitmode || (n < -2) || (n > 1))
|
|
||||||
{
|
|
||||||
sprintf(ascnum,"%i",wind);
|
|
||||||
send_mode(chan,160,QM_RAWMODE,'+','l',ascnum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* DYNAMODE */
|
|
||||||
471
src/function.c
471
src/function.c
@ -171,7 +171,7 @@ Strp *make_strp(Strp **pp, const char *string)
|
|||||||
{
|
{
|
||||||
set_mallocdoer(make_strp);
|
set_mallocdoer(make_strp);
|
||||||
*pp = (Strp*)Calloc(sizeof(Strp) + strlen(string));
|
*pp = (Strp*)Calloc(sizeof(Strp) + strlen(string));
|
||||||
Strcpy((*pp)->p,string);
|
stringcpy((*pp)->p,string);
|
||||||
return(*pp);
|
return(*pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +193,9 @@ Strp *prepend_strp(Strp **pp, const char *string)
|
|||||||
return(sp);
|
return(sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free() a chain of Strp's
|
||||||
|
*/
|
||||||
void purge_strplist(Strp *sp)
|
void purge_strplist(Strp *sp)
|
||||||
{
|
{
|
||||||
Strp *nxt;
|
Strp *nxt;
|
||||||
@ -218,54 +221,94 @@ void dupe_strp(Strp *sp, Strp **pp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int StrlenX(const char *first, ...)
|
Strp *e_table = NULL;
|
||||||
|
|
||||||
|
void table_buffer(const char *format, ...)
|
||||||
{
|
{
|
||||||
const char *s,*o;
|
Strp **sp;
|
||||||
int n;
|
va_list msg;
|
||||||
va_list vlist;
|
int sz;
|
||||||
|
|
||||||
va_start(vlist,first);
|
va_start(msg,format);
|
||||||
|
sz = sizeof(Strp) + vsprintf(gsockdata,format,msg);
|
||||||
|
va_end(msg);
|
||||||
|
|
||||||
n = 0;
|
for(sp=&e_table;*sp;sp=&(*sp)->next)
|
||||||
o = s = first;
|
;
|
||||||
do
|
|
||||||
|
set_mallocdoer(table_buffer);
|
||||||
|
*sp = (Strp*)Calloc(sz);
|
||||||
|
/* Calloc sets to zero (*sp)->next = NULL; */
|
||||||
|
stringcpy((*sp)->p,gsockdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
void table_send(const char *from, const int space)
|
||||||
|
{
|
||||||
|
char message[MAXLEN];
|
||||||
|
Strp *sp,*next;
|
||||||
|
char *src,*o,*end;
|
||||||
|
int i,u,g,x,z[6];
|
||||||
|
|
||||||
|
z[0] = z[1] = z[2] = z[3] = z[4] = z[5] = 0;
|
||||||
|
for(sp=e_table;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
while(*s)
|
u = i = 0;
|
||||||
s++;
|
src = o = sp->p;
|
||||||
n += (s - o);
|
while(*src)
|
||||||
s = o = va_arg(vlist,const char *);
|
{
|
||||||
|
if (*src == '\037' || *src == '\002')
|
||||||
|
u++;
|
||||||
|
if (*src == '\t' || *src == '\r')
|
||||||
|
{
|
||||||
|
x = (src - o) - u;
|
||||||
|
if (x > z[i])
|
||||||
|
z[i] = x;
|
||||||
|
i++;
|
||||||
|
o = src+1;
|
||||||
|
u = 0;
|
||||||
|
}
|
||||||
|
src++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while(s);
|
|
||||||
|
|
||||||
va_end(vlist);
|
for(sp=e_table;sp;sp=next)
|
||||||
return(n);
|
{
|
||||||
}
|
next = sp->next;
|
||||||
|
|
||||||
const int Strlen2(const char *one, const char *two)
|
o = message;
|
||||||
{
|
src = sp->p;
|
||||||
const char *s1,*s2;
|
g = x = i = 0;
|
||||||
|
while(*src)
|
||||||
|
{
|
||||||
|
if (g)
|
||||||
|
{
|
||||||
|
end = src;
|
||||||
|
while(*end && *end != '\t' && *end != '\r')
|
||||||
|
end++;
|
||||||
|
g -= (end - src);
|
||||||
|
while(g-- > 0)
|
||||||
|
*(o++) = ' ';
|
||||||
|
}
|
||||||
|
if (*src == '\037' || *src == '\002')
|
||||||
|
x++;
|
||||||
|
if (*src == '\t' || *src == '\r')
|
||||||
|
{
|
||||||
|
if (*src == '\r')
|
||||||
|
g = z[i+1];
|
||||||
|
src++;
|
||||||
|
x += (z[i++] + space);
|
||||||
|
while(o < (message + x))
|
||||||
|
*(o++) = ' ';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*(o++) = *(src++);
|
||||||
|
}
|
||||||
|
*o = 0;
|
||||||
|
to_user(from,FMT_PLAIN,message);
|
||||||
|
|
||||||
if (one)
|
Free((char**)&sp);
|
||||||
for(s1=one;*s1;s1++);
|
}
|
||||||
if (two)
|
e_table = NULL;
|
||||||
for(s2=two;*s2;s2++);
|
|
||||||
|
|
||||||
return((s1 - one) + (s2 - two));
|
|
||||||
}
|
|
||||||
|
|
||||||
char *nickcpy(char *dest, const char *nuh)
|
|
||||||
{
|
|
||||||
char *ret;
|
|
||||||
|
|
||||||
if (!dest)
|
|
||||||
dest = nick_buf;
|
|
||||||
ret = dest;
|
|
||||||
|
|
||||||
while(*nuh && (*nuh != '!'))
|
|
||||||
*(dest++) = *(nuh++);
|
|
||||||
*dest = 0;
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getuh(char *nuh)
|
char *getuh(char *nuh)
|
||||||
@ -451,9 +494,9 @@ char *idle2str(time_t when, int small)
|
|||||||
return(idlestr);
|
return(idlestr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *get_channel(char *to, char **rest)
|
const char *get_channel(const char *to, char **rest)
|
||||||
{
|
{
|
||||||
char *channel;
|
const char *channel;
|
||||||
|
|
||||||
if (*rest && ischannel(*rest))
|
if (*rest && ischannel(*rest))
|
||||||
{
|
{
|
||||||
@ -469,9 +512,9 @@ char *get_channel(char *to, char **rest)
|
|||||||
return(channel);
|
return(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *get_channel2(char *to, char **rest)
|
const char *get_channel2(const char *to, char **rest)
|
||||||
{
|
{
|
||||||
char *channel;
|
const char *channel;
|
||||||
|
|
||||||
if (*rest && (**rest == '*' || ischannel(*rest)))
|
if (*rest && (**rest == '*' || ischannel(*rest)))
|
||||||
{
|
{
|
||||||
@ -528,7 +571,7 @@ char *cluster(char *hostname)
|
|||||||
}
|
}
|
||||||
*(p++) = *(host++);
|
*(p++) = *(host++);
|
||||||
}
|
}
|
||||||
Strcpy(p,".*.*");
|
stringcpy(p,".*.*");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -546,9 +589,9 @@ char *cluster(char *hostname)
|
|||||||
break;
|
break;
|
||||||
host++;
|
host++;
|
||||||
}
|
}
|
||||||
Strcpy(p,host);
|
stringcpy(p,host);
|
||||||
}
|
}
|
||||||
Strcpy(hostname,mask);
|
stringcpy(hostname,mask);
|
||||||
return(hostname);
|
return(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,7 +609,7 @@ char *format_uh(char *userhost, int type)
|
|||||||
if (STRCHR(userhost,'*'))
|
if (STRCHR(userhost,'*'))
|
||||||
return(userhost);
|
return(userhost);
|
||||||
|
|
||||||
Strcpy(tmpmask,userhost);
|
stringcpy(tmpmask,userhost);
|
||||||
|
|
||||||
h = tmpmask;
|
h = tmpmask;
|
||||||
get_token(&h,"!"); /* discard nickname */
|
get_token(&h,"!"); /* discard nickname */
|
||||||
@ -594,7 +637,7 @@ char *nick2uh(char *from, char *userhost)
|
|||||||
{
|
{
|
||||||
if (STRCHR(userhost,'!') && STRCHR(userhost,'@'))
|
if (STRCHR(userhost,'!') && STRCHR(userhost,'@'))
|
||||||
{
|
{
|
||||||
Strcpy(nuh_buf,userhost);
|
stringcpy(nuh_buf,userhost);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!STRCHR(userhost,'!') && !STRCHR(userhost,'@'))
|
if (!STRCHR(userhost,'!') && !STRCHR(userhost,'@'))
|
||||||
@ -609,10 +652,10 @@ char *nick2uh(char *from, char *userhost)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Strcpy(nuh_buf,"*!");
|
stringcpy(nuh_buf,"*!");
|
||||||
if (!STRCHR(userhost,'@'))
|
if (!STRCHR(userhost,'@'))
|
||||||
Strcat(nuh_buf,"*@");
|
stringcat(nuh_buf,"*@");
|
||||||
Strcat(nuh_buf,userhost);
|
stringcat(nuh_buf,userhost);
|
||||||
}
|
}
|
||||||
return(nuh_buf);
|
return(nuh_buf);
|
||||||
}
|
}
|
||||||
@ -684,26 +727,7 @@ int is_nick(const char *nick)
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int capslevel(char *text)
|
int asc2int(const char *anum)
|
||||||
{
|
|
||||||
int sz,upper;
|
|
||||||
|
|
||||||
if (!*text)
|
|
||||||
return(0);
|
|
||||||
|
|
||||||
sz = upper = 0;
|
|
||||||
while(*text)
|
|
||||||
{
|
|
||||||
if ((*text >= 'A' && *text <= 'Z') || (*text == '!'))
|
|
||||||
upper++;
|
|
||||||
sz++;
|
|
||||||
text++;
|
|
||||||
}
|
|
||||||
sz = sz / 2;
|
|
||||||
return(upper >= sz);
|
|
||||||
}
|
|
||||||
|
|
||||||
int a2i(char *anum)
|
|
||||||
{
|
{
|
||||||
int res = 0,neg;
|
int res = 0,neg;
|
||||||
|
|
||||||
@ -760,146 +784,7 @@ void fix_config_line(char *text)
|
|||||||
*space = 0;
|
*space = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#endif /* ifndef TEST */
|
||||||
* returns NULL or non-zero length string
|
|
||||||
*/
|
|
||||||
char *chop(char **src)
|
|
||||||
{
|
|
||||||
char *tok,*cut = *src;
|
|
||||||
|
|
||||||
while(*cut && *cut == ' ')
|
|
||||||
cut++;
|
|
||||||
|
|
||||||
if (*cut)
|
|
||||||
{
|
|
||||||
tok = cut;
|
|
||||||
while(*cut && *cut != ' ')
|
|
||||||
cut++;
|
|
||||||
*src = cut;
|
|
||||||
while(*cut && *cut == ' ')
|
|
||||||
cut++;
|
|
||||||
**src = 0;
|
|
||||||
*src = cut;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tok = NULL;
|
|
||||||
}
|
|
||||||
return(tok);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* remove all '\0' in an array bounded by two pointers
|
|
||||||
*/
|
|
||||||
void unchop(char *orig, char *rest)
|
|
||||||
{
|
|
||||||
for(;orig<rest;orig++)
|
|
||||||
{
|
|
||||||
if (*orig == 0)
|
|
||||||
*orig = ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int Strcasecmp(const char *p1, const char *p2)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (p1 != p2)
|
|
||||||
{
|
|
||||||
while(!(ret = tolowertab[(uchar)*(p1++)] - tolowertab[(uchar)*p2]) && *(p2++))
|
|
||||||
;
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Strcmp(const char *p1, const char *p2)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (p1 != p2)
|
|
||||||
{
|
|
||||||
while(!(ret = *(p1++) - *p2) && *(p2++))
|
|
||||||
;
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int nickcmp(const char *p1, const char *p2)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
int c;
|
|
||||||
|
|
||||||
if (p1 != p2)
|
|
||||||
{
|
|
||||||
while(!(ret = nickcmptab[(uchar)*(p1++)] - (c = nickcmptab[(uchar)*(p2++)])) && c)
|
|
||||||
;
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Strncpy(char *dst, const char *src, int sz)
|
|
||||||
{
|
|
||||||
char *stop = dst + sz - 1;
|
|
||||||
|
|
||||||
while(*src)
|
|
||||||
{
|
|
||||||
*(dst++) = *(src++);
|
|
||||||
if (dst == stop)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*dst = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *Strcpy(char *dst, const char *src)
|
|
||||||
{
|
|
||||||
while(*src)
|
|
||||||
*(dst++) = *(src++);
|
|
||||||
*dst = 0;
|
|
||||||
return(dst);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *Strchr(const char *t, int c)
|
|
||||||
{
|
|
||||||
char ch = c;
|
|
||||||
|
|
||||||
while(*t != ch && *t)
|
|
||||||
t++;
|
|
||||||
return((*t == ch) ? (char*)t : NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *Strdup(const char *src)
|
|
||||||
{
|
|
||||||
char *dest;
|
|
||||||
|
|
||||||
dest = (char*)Calloc(strlen(src)+1);
|
|
||||||
Strcpy(dest,src);
|
|
||||||
return(dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *tolowercat(char *dest, const char *src)
|
|
||||||
{
|
|
||||||
dest = STREND(dest);
|
|
||||||
while(*src)
|
|
||||||
*(dest++) = (char)tolowertab[(uchar)*(src++)];
|
|
||||||
return(dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This code might look odd but its optimized for size,
|
|
||||||
* so dont change it!
|
|
||||||
*/
|
|
||||||
char *Strcat(char *dst, const char *src)
|
|
||||||
{
|
|
||||||
while(*(dst++))
|
|
||||||
;
|
|
||||||
--dst;
|
|
||||||
while((*(dst++) = *(src++)) != 0)
|
|
||||||
;
|
|
||||||
return(dst-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mask matching
|
* mask matching
|
||||||
@ -998,140 +883,6 @@ int num_matches(const char *mask, const char *text)
|
|||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
Strp *e_table = NULL;
|
|
||||||
|
|
||||||
void table_buffer(const char *format, ...)
|
|
||||||
{
|
|
||||||
Strp **sp;
|
|
||||||
va_list msg;
|
|
||||||
int sz;
|
|
||||||
|
|
||||||
va_start(msg,format);
|
|
||||||
sz = sizeof(Strp) + vsprintf(gsockdata,format,msg);
|
|
||||||
va_end(msg);
|
|
||||||
|
|
||||||
for(sp=&e_table;*sp;sp=&(*sp)->next)
|
|
||||||
;
|
|
||||||
|
|
||||||
set_mallocdoer(table_buffer);
|
|
||||||
*sp = (Strp*)Calloc(sz);
|
|
||||||
/* Calloc sets to zero (*sp)->next = NULL; */
|
|
||||||
Strcpy((*sp)->p,gsockdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
void table_send(const char *from, const int space)
|
|
||||||
{
|
|
||||||
char message[MAXLEN];
|
|
||||||
Strp *sp,*next;
|
|
||||||
char *src,*o,*end;
|
|
||||||
int i,u,g,x,z[6];
|
|
||||||
|
|
||||||
z[0] = z[1] = z[2] = z[3] = z[4] = z[5] = 0;
|
|
||||||
for(sp=e_table;sp;sp=sp->next)
|
|
||||||
{
|
|
||||||
u = i = 0;
|
|
||||||
src = o = sp->p;
|
|
||||||
while(*src)
|
|
||||||
{
|
|
||||||
if (*src == '\037' || *src == '\002')
|
|
||||||
u++;
|
|
||||||
if (*src == '\t' || *src == '\r')
|
|
||||||
{
|
|
||||||
x = (src - o) - u;
|
|
||||||
if (x > z[i])
|
|
||||||
z[i] = x;
|
|
||||||
i++;
|
|
||||||
o = src+1;
|
|
||||||
u = 0;
|
|
||||||
}
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(sp=e_table;sp;sp=next)
|
|
||||||
{
|
|
||||||
next = sp->next;
|
|
||||||
|
|
||||||
o = message;
|
|
||||||
src = sp->p;
|
|
||||||
g = x = i = 0;
|
|
||||||
while(*src)
|
|
||||||
{
|
|
||||||
if (g)
|
|
||||||
{
|
|
||||||
end = src;
|
|
||||||
while(*end && *end != '\t' && *end != '\r')
|
|
||||||
end++;
|
|
||||||
g -= (end - src);
|
|
||||||
while(g-- > 0)
|
|
||||||
*(o++) = ' ';
|
|
||||||
}
|
|
||||||
if (*src == '\037' || *src == '\002')
|
|
||||||
x++;
|
|
||||||
if (*src == '\t' || *src == '\r')
|
|
||||||
{
|
|
||||||
if (*src == '\r')
|
|
||||||
g = z[i+1];
|
|
||||||
src++;
|
|
||||||
x += (z[i++] + space);
|
|
||||||
while(o < (message + x))
|
|
||||||
*(o++) = ' ';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*(o++) = *(src++);
|
|
||||||
}
|
|
||||||
*o = 0;
|
|
||||||
to_user(from,FMT_PLAIN,message);
|
|
||||||
|
|
||||||
Free((char**)&sp);
|
|
||||||
}
|
|
||||||
e_table = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef OLDCODE
|
|
||||||
|
|
||||||
int is_safepath(const char *path)
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
ino_t ino;
|
|
||||||
char tmp[PATH_MAX];
|
|
||||||
const char *src;
|
|
||||||
char *dst;
|
|
||||||
|
|
||||||
int path_token_check(void)
|
|
||||||
{
|
|
||||||
*dst = 0;
|
|
||||||
lstat(tmp,&st);
|
|
||||||
if (!(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode)))
|
|
||||||
return(FALSE);
|
|
||||||
if (st.st_ino == parent_inode)
|
|
||||||
return(FALSE);
|
|
||||||
return(S_ISDIR(st.st_mode) ? 2 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(src = path) == '/')
|
|
||||||
return(FALSE);
|
|
||||||
|
|
||||||
dst = tmp;
|
|
||||||
while(*src)
|
|
||||||
{
|
|
||||||
if (*src == '/' && !path_token_check())
|
|
||||||
return(FALSE);
|
|
||||||
if (dst == tmp + PATH_MAX-1)
|
|
||||||
return(FALSE);
|
|
||||||
*dst++ = *src++;
|
|
||||||
}
|
|
||||||
return(path_token_check() == 1 ? TRUE : FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ifndef TEST at the beginning of file */
|
|
||||||
|
|
||||||
#define FILE_MUST_EXIST 1
|
|
||||||
#define FILE_MAY_EXIST 2
|
|
||||||
#define FILE_MUST_NOTEXIST 3
|
|
||||||
|
|
||||||
int is_safepath(const char *path, int filemustexist)
|
int is_safepath(const char *path, int filemustexist)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -1210,6 +961,31 @@ void testcase(const char *str, int expected, int filemustexist)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char teststr[] = "dingchat";
|
||||||
|
|
||||||
|
void teststring(void)
|
||||||
|
{
|
||||||
|
char str[100];
|
||||||
|
|
||||||
|
stringcpy(str,teststr);
|
||||||
|
if (stringcmp(str,teststr))
|
||||||
|
debug("teststring FAIL: stringcpy(str,%s) != %s (%s)\n",teststr,teststr,str);
|
||||||
|
else
|
||||||
|
debug("teststring SUCCESS: stringcpy(str,%s) == %s\n",teststr,teststr);
|
||||||
|
|
||||||
|
stringcpy_n(str+4,"xoom",2);
|
||||||
|
if (stringcmp(str,"dingxo"))
|
||||||
|
debug("teststring FAIL: stringcpy_n(str+4,%s,2) != %s (%s)\n","xoom","dingxo",str);
|
||||||
|
else
|
||||||
|
debug("teststring SUCCESS: stringcpy_n(str+4,%s,2) == %s\n","xoom","dingxo");
|
||||||
|
|
||||||
|
stringcat(str,"free");
|
||||||
|
if (stringcmp(str,"dingxofree"))
|
||||||
|
debug("teststring FAIL: stringcat(str,%s) != %s (%s)\n","free","dingxofree",str);
|
||||||
|
else
|
||||||
|
debug("teststring SUCCESS: stringcat(str,%s) == %s\n","free","dingxofree");
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -1235,6 +1011,7 @@ int main(int argc, char **argv)
|
|||||||
testcase("./nosuchfile",1,FILE_MUST_NOTEXIST);
|
testcase("./nosuchfile",1,FILE_MUST_NOTEXIST);
|
||||||
testcase("../../nosuchfile",-5,FILE_MUST_NOTEXIST);
|
testcase("../../nosuchfile",-5,FILE_MUST_NOTEXIST);
|
||||||
testcase(P2,-6,FILE_MAY_EXIST);
|
testcase(P2,-6,FILE_MAY_EXIST);
|
||||||
|
teststring();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -193,6 +193,7 @@ struct
|
|||||||
* Level 80 == ASSTLEVEL
|
* Level 80 == ASSTLEVEL
|
||||||
*/
|
*/
|
||||||
{ 0, "AWAY", "do_away", 80 | CCPW | GAXS },
|
{ 0, "AWAY", "do_away", 80 | CCPW | GAXS },
|
||||||
|
{ 0, "BOOT", "do_boot", 80 | CCPW | GAXS | CARGS },
|
||||||
#if defined(BOTNET) && defined(REDIRECT)
|
#if defined(BOTNET) && defined(REDIRECT)
|
||||||
{ 0, "CMD", "do_cmd", 80 | CCPW | CARGS },
|
{ 0, "CMD", "do_cmd", 80 | CCPW | CARGS },
|
||||||
#endif /* BOTNET && REDIRECT */
|
#endif /* BOTNET && REDIRECT */
|
||||||
|
|||||||
@ -138,7 +138,7 @@ void do_greet(COMMAND_ARGS)
|
|||||||
user->x.x.randline = (isfile == '%') ? TRUE : FALSE;
|
user->x.x.randline = (isfile == '%') ? TRUE : FALSE;
|
||||||
|
|
||||||
set_mallocdoer(do_greet);
|
set_mallocdoer(do_greet);
|
||||||
user->greet = Strdup(rest);
|
user->greet = stringdup(rest);
|
||||||
|
|
||||||
to_user(from,"greeting for user %s has been set to: %s%s",user->name,user->greet,
|
to_user(from,"greeting for user %s has been set to: %s%s",user->name,user->greet,
|
||||||
(isfile == '@') ? " (file)" : ((isfile == '%') ? " (random line from file)" : ""));
|
(isfile == '@') ? " (file)" : ((isfile == '%') ? " (random line from file)" : ""));
|
||||||
|
|||||||
26
src/help.c
26
src/help.c
@ -68,7 +68,7 @@ void do_help(COMMAND_ARGS)
|
|||||||
int cur,nxt,count,ci,tl;
|
int cur,nxt,count,ci,tl;
|
||||||
int in;
|
int in;
|
||||||
|
|
||||||
if (dcc_only_command(from))
|
if (partyline_only_command(from))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
axs = get_maxaccess(from);
|
axs = get_maxaccess(from);
|
||||||
@ -104,11 +104,11 @@ help_loop:
|
|||||||
if (tl != cur)
|
if (tl != cur)
|
||||||
continue;
|
continue;
|
||||||
if (ci != count)
|
if (ci != count)
|
||||||
Strcat(line,", ");
|
stringcat(line,", ");
|
||||||
print_help(from,line,strlen(mcmd[i].name));
|
print_help(from,line,strlen(mcmd[i].name));
|
||||||
if (*line == 0)
|
if (*line == 0)
|
||||||
Strcpy(line," ");
|
stringcpy(line," ");
|
||||||
Strcat(line,(char*)mcmd[i].name);
|
stringcat(line,(char*)mcmd[i].name);
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
print_help(from,line,500);
|
print_help(from,line,500);
|
||||||
@ -119,7 +119,7 @@ help_loop:
|
|||||||
goto help_loop;
|
goto help_loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
level = a2i(rest);
|
level = asc2int(rest);
|
||||||
if (!errno)
|
if (!errno)
|
||||||
{
|
{
|
||||||
if ((level > axs) || (level < 0))
|
if ((level > axs) || (level < 0))
|
||||||
@ -132,10 +132,10 @@ help_loop:
|
|||||||
if (acmd[i] <= level)
|
if (acmd[i] <= level)
|
||||||
{
|
{
|
||||||
if (ci != 0)
|
if (ci != 0)
|
||||||
Strcat(line,", ");
|
stringcat(line,", ");
|
||||||
ci++;
|
ci++;
|
||||||
print_help(from,line,strlen(mcmd[i].name));
|
print_help(from,line,strlen(mcmd[i].name));
|
||||||
Strcat(line,(char*)mcmd[i].name);
|
stringcat(line,(char*)mcmd[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ci)
|
if (ci)
|
||||||
@ -155,10 +155,10 @@ help_loop:
|
|||||||
if ((!matches(rest,(char*)mcmd[i].name)) && (acmd[i] <= axs))
|
if ((!matches(rest,(char*)mcmd[i].name)) && (acmd[i] <= axs))
|
||||||
{
|
{
|
||||||
if (ci != 0)
|
if (ci != 0)
|
||||||
Strcat(line,", ");
|
stringcat(line,", ");
|
||||||
ci++;
|
ci++;
|
||||||
print_help(from,line,strlen(mcmd[i].name));
|
print_help(from,line,strlen(mcmd[i].name));
|
||||||
Strcat(line,(char*)mcmd[i].name);
|
stringcat(line,(char*)mcmd[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ci)
|
if (ci)
|
||||||
@ -168,7 +168,7 @@ help_loop:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pt = Strcpy(line,HELPDIR);
|
pt = stringcpy(line,HELPDIR);
|
||||||
for(i=0;(rest[i]);i++)
|
for(i=0;(rest[i]);i++)
|
||||||
{
|
{
|
||||||
if (rest[i] >= 'a' && rest[i] <= 'z')
|
if (rest[i] >= 'a' && rest[i] <= 'z')
|
||||||
@ -213,7 +213,7 @@ help_loop:
|
|||||||
table_buffer("Level needed: %i",level);
|
table_buffer("Level needed: %i",level);
|
||||||
for(i=0;ulist[i].command;i++)
|
for(i=0;ulist[i].command;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(rest,ulist[i].command))
|
if (!stringcasecmp(rest,ulist[i].command))
|
||||||
{
|
{
|
||||||
pt = (ulist[i].usage) ? ulist[i].usage : "";
|
pt = (ulist[i].usage) ? ulist[i].usage : "";
|
||||||
table_buffer("Usage: %s %s",ulist[i].command,pt);
|
table_buffer("Usage: %s %s",ulist[i].command,pt);
|
||||||
@ -231,7 +231,7 @@ void usage_command(char *to, const char *arg)
|
|||||||
|
|
||||||
for(i=0;ulist[i].command;i++)
|
for(i=0;ulist[i].command;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(arg,ulist[i].command))
|
if (!stringcasecmp(arg,ulist[i].command))
|
||||||
{
|
{
|
||||||
pt = ulist[i].usage;
|
pt = ulist[i].usage;
|
||||||
to_user_q(to,(pt) ? "Usage: %s %s" : "Usage: %s",ulist[i].command,pt);
|
to_user_q(to,(pt) ? "Usage: %s %s" : "Usage: %s",ulist[i].command,pt);
|
||||||
@ -258,7 +258,7 @@ void do_usage(COMMAND_ARGS)
|
|||||||
cmd = chop(&rest);
|
cmd = chop(&rest);
|
||||||
for(i=0;mcmd[i].name;i++)
|
for(i=0;mcmd[i].name;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(cmd,mcmd[i].name))
|
if (!stringcasecmp(cmd,mcmd[i].name))
|
||||||
{
|
{
|
||||||
usage_command(from,mcmd[i].name);
|
usage_command(from,mcmd[i].name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
EnergyMech, IRC bot software
|
||||||
Copyright (c) 2001-2018 proton
|
Copyright (c) 2018 proton
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -26,25 +26,9 @@
|
|||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "text.h"
|
|
||||||
#include "mcmd.h"
|
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
|
||||||
/*---Help:HOSTINFO:(no arguments)
|
|
||||||
|
|
||||||
Equivalent to ``uname -orm''
|
|
||||||
|
|
||||||
See also: meminfo, cpuinfo
|
|
||||||
*/
|
|
||||||
void do_hostinfo(COMMAND_ARGS)
|
|
||||||
{
|
|
||||||
struct utsname un;
|
|
||||||
|
|
||||||
if (uname(&un) == 0)
|
|
||||||
to_user_q(from,"%s %s %s",un.sysname,un.release,un.machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
char vmpeak[32];
|
char vmpeak[32];
|
||||||
char vmsize[32];
|
char vmsize[32];
|
||||||
char vmrss[32];
|
char vmrss[32];
|
||||||
@ -102,7 +86,54 @@ int parse_proc_status(char *line)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---Help:MEMINFO:(no arguments)
|
char *cpufrom,cpuline[MSGLEN];
|
||||||
|
int sentmodel;
|
||||||
|
int cpus;
|
||||||
|
int cores;
|
||||||
|
|
||||||
|
/*
|
||||||
|
proton@endemic:~/energymech/src> cat /proc/loadavg
|
||||||
|
0.00 0.00 0.00 1/178 6759
|
||||||
|
processor : 0
|
||||||
|
vendor_id : GenuineIntel
|
||||||
|
cpu family : 6
|
||||||
|
model : 23
|
||||||
|
model name : Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
|
||||||
|
stepping : 7
|
||||||
|
microcode : 0x705
|
||||||
|
cpu MHz : 2024.267
|
||||||
|
cache size : 2048 KB
|
||||||
|
physical id : 0
|
||||||
|
siblings : 4
|
||||||
|
core id : 0
|
||||||
|
cpu cores : 4
|
||||||
|
*/
|
||||||
|
|
||||||
|
int parse_proc_cpuinfo(char *line)
|
||||||
|
{
|
||||||
|
char *src,*dst;
|
||||||
|
|
||||||
|
if (strncmp(line,"model name\t:",12) == 0)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
help:HOSTINFO:(no arguments)
|
||||||
|
|
||||||
|
Equivalent to ``uname -orm''
|
||||||
|
|
||||||
|
See also: meminfo, cpuinfo
|
||||||
|
*/
|
||||||
|
void do_hostinfo(COMMAND_ARGS)
|
||||||
|
{
|
||||||
|
struct utsname un;
|
||||||
|
|
||||||
|
if (uname(&un) == 0)
|
||||||
|
to_user_q(from,"%s %s %s",un.sysname,un.release,un.machine);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
help:MEMINFO:(no arguments)
|
||||||
|
|
||||||
Will display memory usage of the energymech process.
|
Will display memory usage of the energymech process.
|
||||||
|
|
||||||
@ -134,38 +165,8 @@ void do_meminfo(COMMAND_ARGS)
|
|||||||
vmsize,vmpeak,vmrss,vmexe,vmdata,vmlib,vmstk);
|
vmsize,vmpeak,vmrss,vmexe,vmdata,vmlib,vmstk);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cpufrom,cpuline[MSGLEN];
|
|
||||||
int sentmodel;
|
|
||||||
int cpus;
|
|
||||||
int cores;
|
|
||||||
|
|
||||||
int parse_proc_cpuinfo(char *line)
|
|
||||||
{
|
|
||||||
char *src,*dst;
|
|
||||||
|
|
||||||
if (strncmp(line,"model name\t:",12) == 0)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
proton@endemic:~/energymech/src> cat /proc/loadavg
|
help:CPUINFO:(no arguments)
|
||||||
0.00 0.00 0.00 1/178 6759
|
|
||||||
processor : 0
|
|
||||||
vendor_id : GenuineIntel
|
|
||||||
cpu family : 6
|
|
||||||
model : 23
|
|
||||||
model name : Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
|
|
||||||
stepping : 7
|
|
||||||
microcode : 0x705
|
|
||||||
cpu MHz : 2024.267
|
|
||||||
cache size : 2048 KB
|
|
||||||
physical id : 0
|
|
||||||
siblings : 4
|
|
||||||
core id : 0
|
|
||||||
cpu cores : 4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*---Help:CPUINFO:(no arguments)
|
|
||||||
|
|
||||||
See also: hostinfo, meminfo
|
See also: hostinfo, meminfo
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
/*
|
/*
|
||||||
* nick can be NULL
|
* nick can be NULL
|
||||||
*/
|
*/
|
||||||
void make_ireq(int t, char *from, char *nick)
|
void make_ireq(int t, const char *from, const char *nick)
|
||||||
{
|
{
|
||||||
IReq *ir;
|
IReq *ir;
|
||||||
char *pt;
|
char *pt;
|
||||||
@ -42,11 +42,11 @@ void make_ireq(int t, char *from, char *nick)
|
|||||||
ir->t = t;
|
ir->t = t;
|
||||||
ir->when = now;
|
ir->when = now;
|
||||||
|
|
||||||
pt = Strcat(ir->from,from) + 1;
|
pt = stringcat(ir->from,from) + 1;
|
||||||
if (nick)
|
if (nick)
|
||||||
{
|
{
|
||||||
ir->nick = pt;
|
ir->nick = pt;
|
||||||
Strcpy(ir->nick,nick);
|
stringcpy(ir->nick,nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
ir->next = current->parselist;
|
ir->next = current->parselist;
|
||||||
@ -67,7 +67,7 @@ void send_pa(int type, const char *nick, const char *format, ...)
|
|||||||
for(pp=¤t->parselist;(ir = *pp);)
|
for(pp=¤t->parselist;(ir = *pp);)
|
||||||
{
|
{
|
||||||
#ifdef RAWDNS
|
#ifdef RAWDNS
|
||||||
if (ir->t == PA_DNS && !Strcasecmp(nick,ir->nick))
|
if (ir->t == PA_DNS && !stringcasecmp(nick,ir->nick))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(send_pa) PA_DNS %s\n",ir->nick);
|
debug("(send_pa) PA_DNS %s\n",ir->nick);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ KickSay *find_kicksay(char *text, char *channel)
|
|||||||
best = 0;
|
best = 0;
|
||||||
for(kick=current->kicklist;kick;kick=kick->next)
|
for(kick=current->kicklist;kick;kick=kick->next)
|
||||||
{
|
{
|
||||||
if (!channel || *kick->chan == '*' || !Strcasecmp(channel,kick->chan))
|
if (!channel || *kick->chan == '*' || !stringcasecmp(channel,kick->chan))
|
||||||
{
|
{
|
||||||
num = num_matches(kick->mask,text);
|
num = num_matches(kick->mask,text);
|
||||||
if (num > best)
|
if (num > best)
|
||||||
@ -60,7 +60,7 @@ void check_kicksay(Chan *chan, ChanUser *doer, char *text)
|
|||||||
action = -1;
|
action = -1;
|
||||||
for(kick=current->kicklist;kick;kick=kick->next)
|
for(kick=current->kicklist;kick;kick=kick->next)
|
||||||
{
|
{
|
||||||
if (*kick->chan == '*' || !Strcasecmp(chan->name,kick->chan))
|
if (*kick->chan == '*' || !stringcasecmp(chan->name,kick->chan))
|
||||||
{
|
{
|
||||||
if (!matches(kick->mask,text))
|
if (!matches(kick->mask,text))
|
||||||
{
|
{
|
||||||
@ -158,7 +158,7 @@ void do_kicksay(COMMAND_ARGS)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcc_only_command(from))
|
if (partyline_only_command(from))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
table_buffer("\037channel\037\t\037action\037\t\037string\037\t\037kick reason\037");
|
table_buffer("\037channel\037\t\037action\037\t\037string\037\t\037kick reason\037");
|
||||||
@ -179,7 +179,7 @@ void do_kicksay(COMMAND_ARGS)
|
|||||||
inum = DEFAULT_KS_LEVEL;
|
inum = DEFAULT_KS_LEVEL;
|
||||||
if (*rest != '"')
|
if (*rest != '"')
|
||||||
{
|
{
|
||||||
inum = a2i(chop(&rest));
|
inum = asc2int(chop(&rest));
|
||||||
if (errno || inum < 0 || inum > MAX_KS_LEVEL)
|
if (errno || inum < 0 || inum > MAX_KS_LEVEL)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -217,15 +217,15 @@ void do_kicksay(COMMAND_ARGS)
|
|||||||
kick->action = inum;
|
kick->action = inum;
|
||||||
|
|
||||||
if (!matches("\\*?*\\*",mask))
|
if (!matches("\\*?*\\*",mask))
|
||||||
kick->chan = Strcpy(kick->mask,mask) + 1;
|
kick->chan = stringcpy(kick->mask,mask) + 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kick->mask[0] = '*';
|
kick->mask[0] = '*';
|
||||||
Strcpy(kick->mask+1,mask);
|
stringcpy(kick->mask+1,mask);
|
||||||
kick->chan = Strcat(kick->mask,MATCH_ALL) + 1;
|
kick->chan = stringcat(kick->mask,MATCH_ALL) + 1;
|
||||||
}
|
}
|
||||||
kick->reason = Strcpy(kick->chan,channel) + 1;
|
kick->reason = stringcpy(kick->chan,channel) + 1;
|
||||||
Strcpy(kick->reason,rest);
|
stringcpy(kick->reason,rest);
|
||||||
|
|
||||||
to_user(from,"Now kicking on \"%s\" on %s",mask,channel);
|
to_user(from,"Now kicking on \"%s\" on %s",mask,channel);
|
||||||
current->ul_save++;
|
current->ul_save++;
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include "sha1.h"
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
SHA1_CTX sha;
|
|
||||||
uint8_t results[20];
|
|
||||||
char *buf;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
buf = "abc";
|
|
||||||
n = strlen(buf);
|
|
||||||
SHA1Init(&sha);
|
|
||||||
SHA1Update(&sha, (uint8_t *)buf, n);
|
|
||||||
SHA1Final(results, &sha);
|
|
||||||
|
|
||||||
/* Print the digest as one long hex value */
|
|
||||||
printf("a9993e364706816aba3e25717850c26c9cd0d89d <-- expected result\n");
|
|
||||||
for (n = 0; n < 20; n++)
|
|
||||||
printf("%02x", results[n]);
|
|
||||||
|
|
||||||
putchar('\n');
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
@ -19,27 +19,24 @@ A million repetitions of "a"
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* for uint32_t */
|
/* for uint32_t */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
|
||||||
|
|
||||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||||
|
|
||||||
/* blk0() and blk() perform the initial expand. */
|
/* blk0() and blk() perform the initial expand. */
|
||||||
/* I got the idea of expanding during the round function from SSLeay */
|
/* I got the idea of expanding during the round function from SSLeay */
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00)|(rol(block->l[i],8)&0x00FF00FF))
|
||||||
|(rol(block->l[i],8)&0x00FF00FF))
|
|
||||||
#elif BYTE_ORDER == BIG_ENDIAN
|
#elif BYTE_ORDER == BIG_ENDIAN
|
||||||
#define blk0(i) block->l[i]
|
#define blk0(i) block->l[i]
|
||||||
#else
|
#else
|
||||||
#error "Endianness not defined!"
|
#error "Endianness not defined!"
|
||||||
#endif
|
#endif
|
||||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
|
||||||
^block->l[(i+2)&15]^block->l[i&15],1))
|
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15]^block->l[(i+2)&15]^block->l[i&15],1))
|
||||||
|
|
||||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||||
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
||||||
@ -51,10 +48,7 @@ A million repetitions of "a"
|
|||||||
|
|
||||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
||||||
|
|
||||||
void SHA1Transform(
|
void SHA1Transform(uint32_t state[5], const unsigned char buffer[64])
|
||||||
uint32_t state[5],
|
|
||||||
const unsigned char buffer[64]
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
uint32_t a, b, c, d, e;
|
uint32_t a, b, c, d, e;
|
||||||
|
|
||||||
@ -176,12 +170,8 @@ void SHA1Transform(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* SHA1Init - Initialize new context */
|
/* SHA1Init - Initialize new context */
|
||||||
|
void SHA1Init(SHA1_CTX *context)
|
||||||
void SHA1Init(
|
|
||||||
SHA1_CTX * context
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
/* SHA1 initialization constants */
|
/* SHA1 initialization constants */
|
||||||
context->state[0] = 0x67452301;
|
context->state[0] = 0x67452301;
|
||||||
@ -192,14 +182,8 @@ void SHA1Init(
|
|||||||
context->count[0] = context->count[1] = 0;
|
context->count[0] = context->count[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Run your data through this. */
|
/* Run your data through this. */
|
||||||
|
void SHA1Update(SHA1_CTX * context, const unsigned char *data, uint32_t len)
|
||||||
void SHA1Update(
|
|
||||||
SHA1_CTX * context,
|
|
||||||
const unsigned char *data,
|
|
||||||
uint32_t len
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
@ -225,13 +209,8 @@ void SHA1Update(
|
|||||||
memcpy(&context->buffer[j], &data[i], len - i);
|
memcpy(&context->buffer[j], &data[i], len - i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Add padding and return the message digest. */
|
/* Add padding and return the message digest. */
|
||||||
|
void SHA1Final(unsigned char digest[20], SHA1_CTX *context)
|
||||||
void SHA1Final(
|
|
||||||
unsigned char digest[20],
|
|
||||||
SHA1_CTX * context
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
@ -279,10 +258,7 @@ void SHA1Final(
|
|||||||
memset(&finalcount, '\0', sizeof(finalcount));
|
memset(&finalcount, '\0', sizeof(finalcount));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHA1(
|
void SHA1(char *hash_out, const char *str, int len)
|
||||||
char *hash_out,
|
|
||||||
const char *str,
|
|
||||||
int len)
|
|
||||||
{
|
{
|
||||||
SHA1_CTX ctx;
|
SHA1_CTX ctx;
|
||||||
unsigned int ii;
|
unsigned int ii;
|
||||||
@ -294,3 +270,28 @@ void SHA1(
|
|||||||
hash_out[20] = '\0';
|
hash_out[20] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TEST
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
SHA1_CTX sha;
|
||||||
|
uint8_t results[20];
|
||||||
|
char *buf;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
buf = "abc";
|
||||||
|
n = strlen(buf);
|
||||||
|
SHA1Init(&sha);
|
||||||
|
SHA1Update(&sha, (uint8_t *)buf, n);
|
||||||
|
SHA1Final(results, &sha);
|
||||||
|
|
||||||
|
/* Print the digest as one long hex value */
|
||||||
|
printf("a9993e364706816aba3e25717850c26c9cd0d89d <-- expected result\n");
|
||||||
|
for (n = 0; n < 20; n++)
|
||||||
|
printf("%02x", results[n]);
|
||||||
|
|
||||||
|
putchar('\n');
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif TEST
|
||||||
|
|||||||
@ -20,28 +20,12 @@
|
|||||||
*/
|
*/
|
||||||
#define STRING_C
|
#define STRING_C
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* callers responsibility to make sure text is not NULL
|
|
||||||
*/
|
|
||||||
int stringiscaps(const char *text)
|
|
||||||
{
|
|
||||||
int n,upper;
|
|
||||||
|
|
||||||
n = upper = 0;
|
|
||||||
while(text[n])
|
|
||||||
{
|
|
||||||
if ((text[n] >= 'A' && text[n] <= 'Z') || (text[n] == '!'))
|
|
||||||
upper += 2;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
return(upper >= n);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* returns NULL or non-zero length string
|
* returns NULL or non-zero length string
|
||||||
* callers responsibility that src is not NULL
|
* callers responsibility that src is not NULL
|
||||||
|
|||||||
BIN
src/lib/string.o
BIN
src/lib/string.o
Binary file not shown.
16
src/main.c
16
src/main.c
@ -98,13 +98,13 @@ int randstring_getline(char *line)
|
|||||||
{
|
{
|
||||||
if (--r_ct == 0)
|
if (--r_ct == 0)
|
||||||
{
|
{
|
||||||
Strcpy(r_str,line);
|
stringcpy(r_str,line);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *randstring(char *file)
|
char *randstring(const char *file)
|
||||||
{
|
{
|
||||||
int in;
|
int in;
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ mainloop:
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(doit) rawdns: %s ==> %s\n",sp->name,host);
|
debug("(doit) rawdns: %s ==> %s\n",sp->name,host);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
Strcpy(hosttemp,host);
|
stringcpy(hosttemp,host);
|
||||||
host = hosttemp;
|
host = hosttemp;
|
||||||
try_server(sp,host);
|
try_server(sp,host);
|
||||||
}
|
}
|
||||||
@ -838,10 +838,10 @@ int main(int argc, char **argv, char **envp)
|
|||||||
/*
|
/*
|
||||||
* Code to detect and recover after a RESET
|
* Code to detect and recover after a RESET
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
execve( ./energymech, argv = { ./energymech <NULL> <NULL> <NULL> <NULL> }, envp = { MECHRESET=d3 f1881:2:X12 } )
|
execve( ./energymech, argv = { ./energymech <NULL> <NULL> <NULL> <NULL> },
|
||||||
(recover_debug) debug fd recovered
|
envp = { MECHRESET=d3 f1881:2:X12 } )
|
||||||
*/
|
*/
|
||||||
while(*envp)
|
while(*envp)
|
||||||
{
|
{
|
||||||
char *p1;
|
char *p1;
|
||||||
@ -881,7 +881,7 @@ execve( ./energymech, argv = { ./energymech <NULL> <NULL> <NULL> <NULL> }, envp
|
|||||||
if ((opt = STRCHR(*argv,' ')) != NULL)
|
if ((opt = STRCHR(*argv,' ')) != NULL)
|
||||||
{
|
{
|
||||||
*(opt++) = 0;
|
*(opt++) = 0;
|
||||||
respawn = a2i(opt);
|
respawn = asc2int(opt);
|
||||||
if (errno)
|
if (errno)
|
||||||
{
|
{
|
||||||
to_file(1,bad_exe);
|
to_file(1,bad_exe);
|
||||||
|
|||||||
400
src/md5/md5.c
400
src/md5/md5.c
@ -1,400 +0,0 @@
|
|||||||
/* md5.c */
|
|
||||||
/*
|
|
||||||
* This code implements the MD5 message-digest algorithm.
|
|
||||||
* The algorithm is due to Ron Rivest. This code was
|
|
||||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
|
||||||
* This code is in the public domain; do with it what you wish.
|
|
||||||
*
|
|
||||||
* Equivalent code is available from RSA Data Security, Inc.
|
|
||||||
* This code has been tested against that, and is equivalent,
|
|
||||||
* except that you don't need to include two pages of legalese
|
|
||||||
* with every copy.
|
|
||||||
*
|
|
||||||
* To compute the message digest of a chunk of bytes, declare an
|
|
||||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
|
||||||
* needed on buffers full of bytes, and then call MD5Final, which
|
|
||||||
* will fill a supplied 16-byte array with the digest.
|
|
||||||
*/
|
|
||||||
#ifndef MD5_CRYPT_C
|
|
||||||
#define MD5_CRYPT_C
|
|
||||||
|
|
||||||
#include <string.h> /* for memcpy() */
|
|
||||||
#include "md5.h"
|
|
||||||
|
|
||||||
#ifndef HIGHFIRST
|
|
||||||
#define byteReverse(buf, len) /* Nothing */
|
|
||||||
#else
|
|
||||||
void byteReverse(unsigned char *buf, unsigned longs);
|
|
||||||
|
|
||||||
#ifndef ASM_MD5
|
|
||||||
/*
|
|
||||||
* Note: this code is harmless on little-endian machines.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
byteReverse(unsigned char *buf, unsigned longs)
|
|
||||||
{
|
|
||||||
uint32 t;
|
|
||||||
do {
|
|
||||||
t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
|
||||||
((unsigned) buf[1] << 8 | buf[0]);
|
|
||||||
*(uint32 *) buf = t;
|
|
||||||
buf += 4;
|
|
||||||
} while (--longs);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
|
||||||
* initialization constants.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
MD5Init(struct MD5Context *ctx)
|
|
||||||
{
|
|
||||||
ctx->buf[0] = 0x67452301;
|
|
||||||
ctx->buf[1] = 0xefcdab89;
|
|
||||||
ctx->buf[2] = 0x98badcfe;
|
|
||||||
ctx->buf[3] = 0x10325476;
|
|
||||||
|
|
||||||
ctx->bits[0] = 0;
|
|
||||||
ctx->bits[1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Update context to reflect the concatenation of another buffer full
|
|
||||||
* of bytes.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
|
|
||||||
{
|
|
||||||
uint32 t;
|
|
||||||
|
|
||||||
/* Update bitcount */
|
|
||||||
|
|
||||||
t = ctx->bits[0];
|
|
||||||
if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
|
|
||||||
ctx->bits[1]++; /* Carry from low to high */
|
|
||||||
ctx->bits[1] += len >> 29;
|
|
||||||
|
|
||||||
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
|
||||||
|
|
||||||
/* Handle any leading odd-sized chunks */
|
|
||||||
|
|
||||||
if (t) {
|
|
||||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
|
||||||
|
|
||||||
t = 64 - t;
|
|
||||||
if (len < t) {
|
|
||||||
memcpy(p, buf, len);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
memcpy(p, buf, t);
|
|
||||||
byteReverse(ctx->in, 16);
|
|
||||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
|
||||||
buf += t;
|
|
||||||
len -= t;
|
|
||||||
}
|
|
||||||
/* Process data in 64-byte chunks */
|
|
||||||
|
|
||||||
while (len >= 64) {
|
|
||||||
memcpy(ctx->in, buf, 64);
|
|
||||||
byteReverse(ctx->in, 16);
|
|
||||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
|
||||||
buf += 64;
|
|
||||||
len -= 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle any remaining bytes of data. */
|
|
||||||
|
|
||||||
memcpy(ctx->in, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
|
||||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
MD5Final(unsigned char digest[16], struct MD5Context *ctx)
|
|
||||||
{
|
|
||||||
unsigned count;
|
|
||||||
unsigned char *p;
|
|
||||||
|
|
||||||
/* Compute number of bytes mod 64 */
|
|
||||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
|
||||||
|
|
||||||
/* Set the first char of padding to 0x80. This is safe since there is
|
|
||||||
always at least one byte free */
|
|
||||||
p = ctx->in + count;
|
|
||||||
*p++ = 0x80;
|
|
||||||
|
|
||||||
/* Bytes of padding needed to make 64 bytes */
|
|
||||||
count = 64 - 1 - count;
|
|
||||||
|
|
||||||
/* Pad out to 56 mod 64 */
|
|
||||||
if (count < 8) {
|
|
||||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
|
||||||
memset(p, 0, count);
|
|
||||||
byteReverse(ctx->in, 16);
|
|
||||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
|
||||||
|
|
||||||
/* Now fill the next block with 56 bytes */
|
|
||||||
memset(ctx->in, 0, 56);
|
|
||||||
} else {
|
|
||||||
/* Pad block to 56 bytes */
|
|
||||||
memset(p, 0, count - 8);
|
|
||||||
}
|
|
||||||
byteReverse(ctx->in, 14);
|
|
||||||
|
|
||||||
/* Append length in bits and transform */
|
|
||||||
((uint32 *) ctx->in)[14] = ctx->bits[0];
|
|
||||||
((uint32 *) ctx->in)[15] = ctx->bits[1];
|
|
||||||
|
|
||||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
|
||||||
byteReverse((unsigned char *) ctx->buf, 4);
|
|
||||||
memcpy(digest, ctx->buf, 16);
|
|
||||||
memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef ASM_MD5
|
|
||||||
|
|
||||||
/* The four core functions - F1 is optimized somewhat */
|
|
||||||
|
|
||||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
|
||||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
|
||||||
#define F2(x, y, z) F1(z, x, y)
|
|
||||||
#define F3(x, y, z) (x ^ y ^ z)
|
|
||||||
#define F4(x, y, z) (y ^ (x | ~z))
|
|
||||||
|
|
||||||
/* This is the central step in the MD5 algorithm. */
|
|
||||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
|
||||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
|
||||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
|
||||||
* the data and converts bytes into longwords for this routine.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
MD5Transform(uint32 buf[4], uint32 const in[16])
|
|
||||||
{
|
|
||||||
register uint32 a, b, c, d;
|
|
||||||
|
|
||||||
a = buf[0];
|
|
||||||
b = buf[1];
|
|
||||||
c = buf[2];
|
|
||||||
d = buf[3];
|
|
||||||
|
|
||||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
|
||||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
|
||||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
|
||||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
|
||||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
|
||||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
|
||||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
|
||||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
|
||||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
|
||||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
|
||||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
|
||||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
|
||||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
|
||||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
|
||||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
|
||||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
|
||||||
|
|
||||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
|
||||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
|
||||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
|
||||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
|
||||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
|
||||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
|
||||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
|
||||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
|
||||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
|
||||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
|
||||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
|
||||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
|
||||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
|
||||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
|
||||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
|
||||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
|
||||||
|
|
||||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
|
||||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
|
||||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
|
||||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
|
||||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
|
||||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
|
||||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
|
||||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
|
||||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
|
||||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
|
||||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
|
||||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
|
||||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
|
||||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
|
||||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
|
||||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
|
||||||
|
|
||||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
|
||||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
|
||||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
|
||||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
|
||||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
|
||||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
|
||||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
|
||||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
|
||||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
|
||||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
|
||||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
|
||||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
|
||||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
|
||||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
|
||||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
|
||||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
|
||||||
|
|
||||||
buf[0] += a;
|
|
||||||
buf[1] += b;
|
|
||||||
buf[2] += c;
|
|
||||||
buf[3] += d;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* md5crypt.c */
|
|
||||||
/*
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
|
||||||
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
|
|
||||||
* can do whatever you want with this stuff. If we meet some day, and you think
|
|
||||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Ported from FreeBSD to Linux, only minimal changes. --marekm
|
|
||||||
*/
|
|
||||||
|
|
||||||
static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */
|
|
||||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
||||||
|
|
||||||
static void
|
|
||||||
to64(char *s, unsigned long v, int n)
|
|
||||||
{
|
|
||||||
while (--n >= 0) {
|
|
||||||
*s++ = itoa64[v&0x3f];
|
|
||||||
v >>= 6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* UNIX password
|
|
||||||
*
|
|
||||||
* Use MD5 for what it is best at...
|
|
||||||
*/
|
|
||||||
char *md5_crypt(const char *pw, const char *salt)
|
|
||||||
{
|
|
||||||
static char *magic = "$1$"; /*
|
|
||||||
* This string is magic for
|
|
||||||
* this algorithm. Having
|
|
||||||
* it this way, we can get
|
|
||||||
* get better later on
|
|
||||||
*/
|
|
||||||
static char passwd[120], *p;
|
|
||||||
static const char *sp,*ep;
|
|
||||||
unsigned char final[16];
|
|
||||||
int sl,pl,i,j;
|
|
||||||
MD5_CTX ctx,ctx1;
|
|
||||||
unsigned long l;
|
|
||||||
|
|
||||||
/* Refine the Salt first */
|
|
||||||
sp = salt;
|
|
||||||
|
|
||||||
/* If it starts with the magic string, then skip that */
|
|
||||||
if(!strncmp(sp,magic,strlen(magic)))
|
|
||||||
sp += strlen(magic);
|
|
||||||
|
|
||||||
/* It stops at the first '$', max 8 chars */
|
|
||||||
for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* get the length of the true salt */
|
|
||||||
sl = ep - sp;
|
|
||||||
|
|
||||||
MD5Init(&ctx);
|
|
||||||
|
|
||||||
/* The password first, since that is what is most unknown */
|
|
||||||
MD5Update(&ctx,pw,strlen(pw));
|
|
||||||
|
|
||||||
/* Then our magic string */
|
|
||||||
MD5Update(&ctx,magic,strlen(magic));
|
|
||||||
|
|
||||||
/* Then the raw salt */
|
|
||||||
MD5Update(&ctx,sp,sl);
|
|
||||||
|
|
||||||
/* Then just as many characters of the MD5(pw,salt,pw) */
|
|
||||||
MD5Init(&ctx1);
|
|
||||||
MD5Update(&ctx1,pw,strlen(pw));
|
|
||||||
MD5Update(&ctx1,sp,sl);
|
|
||||||
MD5Update(&ctx1,pw,strlen(pw));
|
|
||||||
MD5Final(final,&ctx1);
|
|
||||||
for(pl = strlen(pw); pl > 0; pl -= 16)
|
|
||||||
MD5Update(&ctx,final,pl>16 ? 16 : pl);
|
|
||||||
|
|
||||||
/* Don't leave anything around in vm they could use. */
|
|
||||||
memset(final,0,sizeof final);
|
|
||||||
|
|
||||||
/* Then something really weird... */
|
|
||||||
for (j=0,i = strlen(pw); i ; i >>= 1)
|
|
||||||
if(i&1)
|
|
||||||
MD5Update(&ctx, final+j, 1);
|
|
||||||
else
|
|
||||||
MD5Update(&ctx, pw+j, 1);
|
|
||||||
|
|
||||||
/* Now make the output string */
|
|
||||||
strcpy(passwd,magic);
|
|
||||||
strncat(passwd,sp,sl);
|
|
||||||
strcat(passwd,"$");
|
|
||||||
|
|
||||||
MD5Final(final,&ctx);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* and now, just to make sure things don't run too fast
|
|
||||||
* On a 60 Mhz Pentium this takes 34 msec, so you would
|
|
||||||
* need 30 seconds to build a 1000 entry dictionary...
|
|
||||||
*/
|
|
||||||
for(i=0;i<1000;i++) {
|
|
||||||
MD5Init(&ctx1);
|
|
||||||
if(i & 1)
|
|
||||||
MD5Update(&ctx1,pw,strlen(pw));
|
|
||||||
else
|
|
||||||
MD5Update(&ctx1,final,16);
|
|
||||||
|
|
||||||
if(i % 3)
|
|
||||||
MD5Update(&ctx1,sp,sl);
|
|
||||||
|
|
||||||
if(i % 7)
|
|
||||||
MD5Update(&ctx1,pw,strlen(pw));
|
|
||||||
|
|
||||||
if(i & 1)
|
|
||||||
MD5Update(&ctx1,final,16);
|
|
||||||
else
|
|
||||||
MD5Update(&ctx1,pw,strlen(pw));
|
|
||||||
MD5Final(final,&ctx1);
|
|
||||||
}
|
|
||||||
|
|
||||||
p = passwd + strlen(passwd);
|
|
||||||
|
|
||||||
l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4;
|
|
||||||
l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4;
|
|
||||||
l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4;
|
|
||||||
l = (final[ 3]<<16) | (final[ 9]<<8) | final[15]; to64(p,l,4); p += 4;
|
|
||||||
l = (final[ 4]<<16) | (final[10]<<8) | final[ 5]; to64(p,l,4); p += 4;
|
|
||||||
l = final[11] ; to64(p,l,2); p += 2;
|
|
||||||
*p = '\0';
|
|
||||||
|
|
||||||
/* Don't leave anything around in vm they could use. */
|
|
||||||
memset(final,0,sizeof final);
|
|
||||||
|
|
||||||
return passwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* MD5_CRYPT_C */
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
#ifndef MD5_H
|
|
||||||
#define MD5_H
|
|
||||||
|
|
||||||
#ifdef __alpha
|
|
||||||
typedef unsigned int uint32;
|
|
||||||
#else
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct MD5Context {
|
|
||||||
uint32 buf[4];
|
|
||||||
uint32 bits[2];
|
|
||||||
unsigned char in[64];
|
|
||||||
};
|
|
||||||
|
|
||||||
void MD5Init(struct MD5Context *context);
|
|
||||||
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
|
||||||
unsigned len);
|
|
||||||
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
|
||||||
void MD5Transform(uint32 buf[4], uint32 const in[16]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
|
||||||
*/
|
|
||||||
typedef struct MD5Context MD5_CTX;
|
|
||||||
|
|
||||||
#endif /* !MD5_H */
|
|
||||||
@ -34,6 +34,7 @@
|
|||||||
#include "notify.c"
|
#include "notify.c"
|
||||||
#include "ons.c"
|
#include "ons.c"
|
||||||
#include "parse.c"
|
#include "parse.c"
|
||||||
|
#include "partyline.c"
|
||||||
#include "perl.c"
|
#include "perl.c"
|
||||||
#include "prot.c"
|
#include "prot.c"
|
||||||
#include "python.c"
|
#include "python.c"
|
||||||
@ -45,7 +46,6 @@
|
|||||||
#include "spy.c"
|
#include "spy.c"
|
||||||
#include "stats.c"
|
#include "stats.c"
|
||||||
#include "tcl.c"
|
#include "tcl.c"
|
||||||
#include "telnet.c"
|
|
||||||
#include "toybox.c"
|
#include "toybox.c"
|
||||||
#include "trivia.c"
|
#include "trivia.c"
|
||||||
#include "uptime.c"
|
#include "uptime.c"
|
||||||
|
|||||||
74
src/net.c
74
src/net.c
@ -164,9 +164,9 @@ BotInfo *make_botinfo(int guid, int hops, char *nuh, char *server, char *version
|
|||||||
new->guid = guid;
|
new->guid = guid;
|
||||||
new->hops = hops;
|
new->hops = hops;
|
||||||
|
|
||||||
new->server = Strcat(new->nuh,nuh) + 1;
|
new->server = stringcat(new->nuh,nuh) + 1;
|
||||||
new->version = Strcat(new->server,server) + 1;
|
new->version = stringcat(new->server,server) + 1;
|
||||||
Strcpy(new->version,version);
|
stringcpy(new->version,version);
|
||||||
|
|
||||||
return(new);
|
return(new);
|
||||||
}
|
}
|
||||||
@ -312,14 +312,14 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
|
|
||||||
if ((pass = chop(&rest)))
|
if ((pass = chop(&rest)))
|
||||||
{
|
{
|
||||||
if (!Strcmp(pass,"PTA"))
|
if (!stringcmp(pass,"PTA"))
|
||||||
authtype = BNAUTH_PLAINTEXT;
|
authtype = BNAUTH_PLAINTEXT;
|
||||||
#ifdef SHACRYPT
|
#ifdef SHACRYPT
|
||||||
if (!Strcmp(pass,"SHA"))
|
if (!stringcmp(pass,"SHA"))
|
||||||
authtype = BNAUTH_SHA;
|
authtype = BNAUTH_SHA;
|
||||||
#endif /* SHACRYPT */
|
#endif /* SHACRYPT */
|
||||||
#ifdef MD5CRYPT
|
#ifdef MD5CRYPT
|
||||||
if (!Strcmp(pass,"MD5"))
|
if (!stringcmp(pass,"MD5"))
|
||||||
authtype = BNAUTH_MD5;
|
authtype = BNAUTH_MD5;
|
||||||
#endif /* MD5CRYPT */
|
#endif /* MD5CRYPT */
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug(">> plain text given: \"%s\" stored \"%s\"\n",pass,rest);
|
debug(">> plain text given: \"%s\" stored \"%s\"\n",pass,rest);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (Strcmp(pass,rest))
|
if (stringcmp(pass,rest))
|
||||||
goto badpass;
|
goto badpass;
|
||||||
break;
|
break;
|
||||||
#ifdef SHACRYPT
|
#ifdef SHACRYPT
|
||||||
@ -371,7 +371,7 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
debug("(basicAuth) their = %s, mypass = %s :: sha = %s\n",
|
debug("(basicAuth) their = %s, mypass = %s :: sha = %s\n",
|
||||||
pass,linkpass,enc);
|
pass,linkpass,enc);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (!Strcmp(enc,rest))
|
if (!stringcmp(enc,rest))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* SHACRYPT */
|
#endif /* SHACRYPT */
|
||||||
@ -390,7 +390,7 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
debug("(basicAuth) their = %s, mypass = %s :: md5 = %s\n",
|
debug("(basicAuth) their = %s, mypass = %s :: md5 = %s\n",
|
||||||
pass,linkpass,enc);
|
pass,linkpass,enc);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (!Strcmp(enc,rest))
|
if (!stringcmp(enc,rest))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* MD5CRYPT */
|
#endif /* MD5CRYPT */
|
||||||
@ -448,7 +448,7 @@ void basicBanner(BotNet *bn, char *rest)
|
|||||||
* find out who's calling
|
* find out who's calling
|
||||||
*/
|
*/
|
||||||
p = chop(&rest);
|
p = chop(&rest);
|
||||||
guid = a2i(p);
|
guid = asc2int(p);
|
||||||
/*
|
/*
|
||||||
* bad guid received
|
* bad guid received
|
||||||
*/
|
*/
|
||||||
@ -518,7 +518,7 @@ void basicBanner(BotNet *bn, char *rest)
|
|||||||
* get a session number
|
* get a session number
|
||||||
*/
|
*/
|
||||||
p = chop(&rest);
|
p = chop(&rest);
|
||||||
bn->rsid = a2i(p);
|
bn->rsid = asc2int(p);
|
||||||
if (errno)
|
if (errno)
|
||||||
{
|
{
|
||||||
botnet_deaduplink(bn);
|
botnet_deaduplink(bn);
|
||||||
@ -530,14 +530,14 @@ void basicBanner(BotNet *bn, char *rest)
|
|||||||
*/
|
*/
|
||||||
while((p = chop(&rest)))
|
while((p = chop(&rest)))
|
||||||
{
|
{
|
||||||
if (!Strcmp(p,"PTA"))
|
if (!stringcmp(p,"PTA"))
|
||||||
bn->opt.pta = TRUE;
|
bn->opt.pta = TRUE;
|
||||||
#ifdef SHACRYPT
|
#ifdef SHACRYPT
|
||||||
if (!Strcmp(p,"SHA"))
|
if (!stringcmp(p,"SHA"))
|
||||||
bn->opt.sha = TRUE;
|
bn->opt.sha = TRUE;
|
||||||
#endif /* SHACRYPT */
|
#endif /* SHACRYPT */
|
||||||
#ifdef MD5CRYPT
|
#ifdef MD5CRYPT
|
||||||
if (!Strcmp(p,"MD5"))
|
if (!stringcmp(p,"MD5"))
|
||||||
bn->opt.md5 = TRUE;
|
bn->opt.md5 = TRUE;
|
||||||
#endif /* MD5CRYPT */
|
#endif /* MD5CRYPT */
|
||||||
}
|
}
|
||||||
@ -693,12 +693,12 @@ void basicLink(BotNet *bn, char *version)
|
|||||||
* BL<guid> <hops> <nick>!<userhost> <server> <version>
|
* BL<guid> <hops> <nick>!<userhost> <server> <version>
|
||||||
*/
|
*/
|
||||||
nuh = chop(&version);
|
nuh = chop(&version);
|
||||||
guid = a2i(nuh);
|
guid = asc2int(nuh);
|
||||||
if (errno)
|
if (errno)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nuh = chop(&version);
|
nuh = chop(&version);
|
||||||
hops = a2i(nuh);
|
hops = asc2int(nuh);
|
||||||
if (errno)
|
if (errno)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ void basicQuit(BotNet *bn, char *rest)
|
|||||||
if (bn->status != BN_LINKED)
|
if (bn->status != BN_LINKED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
guid = a2i(rest);
|
guid = asc2int(rest);
|
||||||
if (errno)
|
if (errno)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -837,7 +837,7 @@ int commandlocal(int dg, int sg, char *from, char *command)
|
|||||||
{
|
{
|
||||||
for(sp=user->mask;sp;sp=sp->next)
|
for(sp=user->mask;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
if (!Strcmp(sp->p,uh))
|
if (!stringcmp(sp->p,uh))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -851,13 +851,13 @@ int commandlocal(int dg, int sg, char *from, char *command)
|
|||||||
redirect.method = R_BOTNET;
|
redirect.method = R_BOTNET;
|
||||||
redirect.guid = sg;
|
redirect.guid = sg;
|
||||||
set_mallocdoer(commandlocal);
|
set_mallocdoer(commandlocal);
|
||||||
redirect.to = Strdup(CurrentNick);
|
redirect.to = stringdup(CurrentNick);
|
||||||
|
|
||||||
p1 = tempdata;
|
p1 = tempdata;
|
||||||
p2 = Strcpy(p1,from);
|
p2 = stringcpy(p1,from);
|
||||||
p2++; /* skip past '0' */
|
p2++; /* skip past '0' */
|
||||||
*p2 = current->setting[CHR_CMDCHAR].char_var;
|
*p2 = current->setting[CHR_CMDCHAR].char_var;
|
||||||
Strcpy((*p2 == *command) ? p2 : p2+1,command);
|
stringcpy((*p2 == *command) ? p2 : p2+1,command);
|
||||||
|
|
||||||
on_msg(p1,current->nick,p2);
|
on_msg(p1,current->nick,p2);
|
||||||
CurrentDCC = NULL;
|
CurrentDCC = NULL;
|
||||||
@ -887,11 +887,11 @@ void partyCommand(BotNet *bn, char *rest)
|
|||||||
if ((userhost = chop(&rest)) == NULL || *rest == 0)
|
if ((userhost = chop(&rest)) == NULL || *rest == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isguid = a2i(sguid);
|
isguid = asc2int(sguid);
|
||||||
if (errno)
|
if (errno)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
idguid = a2i(dguid);
|
idguid = asc2int(dguid);
|
||||||
if (errno) /* == "*" */
|
if (errno) /* == "*" */
|
||||||
{
|
{
|
||||||
commandlocal(-1,isguid,userhost,rest);
|
commandlocal(-1,isguid,userhost,rest);
|
||||||
@ -935,10 +935,10 @@ void partyMessage(BotNet *bn, char *rest)
|
|||||||
if ((src = chop(&rest)) == NULL || *rest == 0)
|
if ((src = chop(&rest)) == NULL || *rest == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
guid = a2i(dst);
|
guid = asc2int(dst);
|
||||||
if (errno) /* == "*" */
|
if (errno) /* == "*" */
|
||||||
{
|
{
|
||||||
Strncpy(CurrentNick,src,NUHLEN-1);
|
stringcpy_n(CurrentNick,src,NUHLEN-1);
|
||||||
/*
|
/*
|
||||||
* partyline_broadcast() uses CurrentNick for the first %s in the format
|
* partyline_broadcast() uses CurrentNick for the first %s in the format
|
||||||
*/
|
*/
|
||||||
@ -989,7 +989,7 @@ void ushareUser(BotNet *bn, char *rest)
|
|||||||
int i,tick,modcount,uaccess;
|
int i,tick,modcount,uaccess;
|
||||||
|
|
||||||
c = *(rest++);
|
c = *(rest++);
|
||||||
tick = a2i(chop(&rest));
|
tick = asc2int(chop(&rest));
|
||||||
if (errno)
|
if (errno)
|
||||||
return;
|
return;
|
||||||
if ((c != '-' && bn->tick >= tick) && (c != '+' && bn->tick != tick))
|
if ((c != '-' && bn->tick >= tick) && (c != '+' && bn->tick != tick))
|
||||||
@ -1007,15 +1007,15 @@ void ushareUser(BotNet *bn, char *rest)
|
|||||||
/* `UU+tick modcount access handle chan pass' */
|
/* `UU+tick modcount access handle chan pass' */
|
||||||
/* UU+0 4 100 proton * $1$3484$AxMkHvZijkeqb8hA6h9AB/ */
|
/* UU+0 4 100 proton * $1$3484$AxMkHvZijkeqb8hA6h9AB/ */
|
||||||
i = 0;
|
i = 0;
|
||||||
modcount = a2i(chop(&rest));
|
modcount = asc2int(chop(&rest));
|
||||||
i += errno;
|
i += errno;
|
||||||
uaccess = a2i(chop(&rest));
|
uaccess = asc2int(chop(&rest));
|
||||||
i += errno;
|
i += errno;
|
||||||
handle = chop(&rest);
|
handle = chop(&rest);
|
||||||
pass = chop(&rest);
|
pass = chop(&rest);
|
||||||
if (i == 0 && handle && pass && *pass)
|
if (i == 0 && handle && pass && *pass)
|
||||||
{
|
{
|
||||||
if (!Strcmp(pass,"none"))
|
if (!stringcmp(pass,"none"))
|
||||||
pass = NULL;
|
pass = NULL;
|
||||||
i = 0;
|
i = 0;
|
||||||
bn->addsession = (rand() | 1);
|
bn->addsession = (rand() | 1);
|
||||||
@ -1129,7 +1129,7 @@ void ushareTick(BotNet *bn, char *rest)
|
|||||||
User *user,*senduser;
|
User *user,*senduser;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = a2i(rest);
|
i = asc2int(rest);
|
||||||
if (errno)
|
if (errno)
|
||||||
return;
|
return;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -1195,7 +1195,7 @@ void ushareDelete(BotNet *bn, char *rest)
|
|||||||
int modcount;
|
int modcount;
|
||||||
|
|
||||||
orig = rest;
|
orig = rest;
|
||||||
modcount = a2i(chop(&rest));
|
modcount = asc2int(chop(&rest));
|
||||||
if (errno)
|
if (errno)
|
||||||
return;
|
return;
|
||||||
for(current=botlist;current;current=current->next)
|
for(current=botlist;current;current=current->next)
|
||||||
@ -1225,7 +1225,7 @@ void botnet_parse(BotNet *bn, char *rest)
|
|||||||
#ifdef TELNET
|
#ifdef TELNET
|
||||||
if (bn->status == BN_UNKNOWN)
|
if (bn->status == BN_UNKNOWN)
|
||||||
{
|
{
|
||||||
if (!Strcmp(rest,telnetprompt))
|
if (!stringcmp(rest,telnetprompt))
|
||||||
return;
|
return;
|
||||||
if (*rest != 'B')
|
if (*rest != 'B')
|
||||||
{
|
{
|
||||||
@ -1535,7 +1535,7 @@ void do_link(COMMAND_ARGS)
|
|||||||
else
|
else
|
||||||
mode = 0;
|
mode = 0;
|
||||||
|
|
||||||
iguid = a2i(guid);
|
iguid = asc2int(guid);
|
||||||
if (errno)
|
if (errno)
|
||||||
{
|
{
|
||||||
usage:
|
usage:
|
||||||
@ -1562,7 +1562,7 @@ usage:
|
|||||||
host = chop(&rest);
|
host = chop(&rest);
|
||||||
port = chop(&rest);
|
port = chop(&rest);
|
||||||
|
|
||||||
iport = a2i(port);
|
iport = asc2int(port);
|
||||||
if (!pass || (host && !port) || (port && (errno || iport < 1 || iport > 65535)))
|
if (!pass || (host && !port) || (port && (errno || iport < 1 || iport > 65535)))
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
@ -1571,10 +1571,10 @@ usage:
|
|||||||
|
|
||||||
cfg->guid = iguid;
|
cfg->guid = iguid;
|
||||||
cfg->port = iport;
|
cfg->port = iport;
|
||||||
cfg->host = Strcat(cfg->pass,pass) + 1;
|
cfg->host = stringcat(cfg->pass,pass) + 1;
|
||||||
|
|
||||||
if (host)
|
if (host)
|
||||||
Strcpy(cfg->host,host);
|
stringcpy(cfg->host,host);
|
||||||
else
|
else
|
||||||
cfg->host = NULL;
|
cfg->host = NULL;
|
||||||
|
|
||||||
@ -1627,7 +1627,7 @@ void do_cmd(COMMAND_ARGS)
|
|||||||
int guid;
|
int guid;
|
||||||
|
|
||||||
target = chop(&rest);
|
target = chop(&rest);
|
||||||
guid = a2i(target);
|
guid = asc2int(target);
|
||||||
if (errno)
|
if (errno)
|
||||||
{
|
{
|
||||||
unchop(orig,rest);
|
unchop(orig,rest);
|
||||||
|
|||||||
@ -100,7 +100,7 @@ void check_botjoin(Chan *chan, ChanUser *cu)
|
|||||||
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
||||||
{
|
{
|
||||||
if (!nickcmp(cu->nick,binfo->nuh) &&
|
if (!nickcmp(cu->nick,binfo->nuh) &&
|
||||||
!Strcasecmp(cu->userhost,getuh(binfo->nuh)))
|
!stringcasecmp(cu->userhost,getuh(binfo->nuh)))
|
||||||
{
|
{
|
||||||
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
||||||
return;
|
return;
|
||||||
@ -129,11 +129,11 @@ void check_botinfo(BotInfo *binfo, const char *channel)
|
|||||||
{
|
{
|
||||||
for(chan=current->chanlist;chan;chan=chan->next)
|
for(chan=current->chanlist;chan;chan=chan->next)
|
||||||
{
|
{
|
||||||
if (channel && Strcasecmp(channel,chan->name))
|
if (channel && stringcasecmp(channel,chan->name))
|
||||||
continue;
|
continue;
|
||||||
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
if ((cu = find_chanbot(chan,binfo->nuh)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (!Strcasecmp(cu->userhost,userhost))
|
if (!stringcasecmp(cu->userhost,userhost))
|
||||||
{
|
{
|
||||||
cu->flags |= CU_NEEDOP;
|
cu->flags |= CU_NEEDOP;
|
||||||
send_mode(chan,50,QM_CHANUSER,'+','o',(void*)cu);
|
send_mode(chan,50,QM_CHANUSER,'+','o',(void*)cu);
|
||||||
@ -156,7 +156,7 @@ void netchanNeedop(BotNet *source, char *rest)
|
|||||||
char *channel;
|
char *channel;
|
||||||
int guid;
|
int guid;
|
||||||
|
|
||||||
guid = a2i(chop(&rest));
|
guid = asc2int(chop(&rest));
|
||||||
channel = chop(&rest);
|
channel = chop(&rest);
|
||||||
if (errno || guid < 1 || !channel)
|
if (errno || guid < 1 || !channel)
|
||||||
return;
|
return;
|
||||||
@ -190,7 +190,7 @@ void netchanSuppress(BotNet *source, char *rest)
|
|||||||
// convert command to const command
|
// convert command to const command
|
||||||
for(i=0;mcmd[i].name;i++)
|
for(i=0;mcmd[i].name;i++)
|
||||||
{
|
{
|
||||||
j = Strcasecmp(mcmd[i].name,cmd);
|
j = stringcasecmp(mcmd[i].name,cmd);
|
||||||
if (j < 0)
|
if (j < 0)
|
||||||
continue;
|
continue;
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
@ -202,7 +202,7 @@ void netchanSuppress(BotNet *source, char *rest)
|
|||||||
if (mcmd[i].name == NULL)
|
if (mcmd[i].name == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
crc = a2i(rest);
|
crc = asc2int(rest);
|
||||||
|
|
||||||
// to all local bots
|
// to all local bots
|
||||||
for(backup=botlist;backup;backup=backup->next)
|
for(backup=botlist;backup;backup=backup->next)
|
||||||
|
|||||||
15
src/note.c
15
src/note.c
@ -47,12 +47,12 @@ int catch_note(char *from, char *to, char *rest)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(catch_note) n->from = %s, n->to = %s\n",n->from,n->to);
|
debug("(catch_note) n->from = %s, n->to = %s\n",n->from,n->to);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (!Strcasecmp(from,n->from) && !Strcasecmp(to,n->to))
|
if (!stringcasecmp(from,n->from) && !stringcasecmp(to,n->to))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(catch_note) note to user = %s\n",n->user);
|
debug("(catch_note) note to user = %s\n",n->user);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (!Strcasecmp(rest,"."))
|
if (rest[0] == '.' && rest[1] == 0)
|
||||||
{
|
{
|
||||||
to_user(from,"Note for %s has been saved",n->user);
|
to_user(from,"Note for %s has been saved",n->user);
|
||||||
*pp = n->next;
|
*pp = n->next;
|
||||||
@ -105,12 +105,9 @@ void do_note(COMMAND_ARGS)
|
|||||||
n->next = notelist;
|
n->next = notelist;
|
||||||
notelist = n;
|
notelist = n;
|
||||||
|
|
||||||
/*
|
n->to = stringcat(n->from,from) + 1;
|
||||||
* custom Strcat makes it sooooo easy
|
n->user = stringcat(n->to,to) + 1;
|
||||||
*/
|
stringcpy(n->user,rest);
|
||||||
n->to = Strcat(n->from,from) + 1;
|
|
||||||
n->user = Strcat(n->to,to) + 1;
|
|
||||||
Strcpy(n->user,rest);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add a note header
|
* add a note header
|
||||||
@ -143,7 +140,7 @@ void do_read(COMMAND_ARGS)
|
|||||||
|
|
||||||
if (rest && (opt = chop(&rest)))
|
if (rest && (opt = chop(&rest)))
|
||||||
{
|
{
|
||||||
which = a2i(opt);
|
which = asc2int(opt);
|
||||||
if (errno || !which)
|
if (errno || !which)
|
||||||
goto read_usage;
|
goto read_usage;
|
||||||
|
|
||||||
|
|||||||
37
src/notify.c
37
src/notify.c
@ -195,7 +195,7 @@ void catch_ison(char *rest)
|
|||||||
{
|
{
|
||||||
if (*whoismsg) *(dst++) = ',';
|
if (*whoismsg) *(dst++) = ',';
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
dst = Strcat(dst,nf->nick);
|
dst = stringcat(dst,nf->nick);
|
||||||
nf->status = NF_WHOIS;
|
nf->status = NF_WHOIS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,8 +248,8 @@ void catch_whois(char *nick, char *userhost, char *realname)
|
|||||||
nlog->signon = now;
|
nlog->signon = now;
|
||||||
nlog->next = nf->log;
|
nlog->next = nf->log;
|
||||||
nf->log = nlog;
|
nf->log = nlog;
|
||||||
nlog->realname = Strcat(nlog->userhost,userhost) + 1;
|
nlog->realname = stringcat(nlog->userhost,userhost) + 1;
|
||||||
Strcpy(nlog->realname,realname);
|
stringcpy(nlog->realname,realname);
|
||||||
/*
|
/*
|
||||||
* if there is a mask, we need a match to announce the online status
|
* if there is a mask, we need a match to announce the online status
|
||||||
*/
|
*/
|
||||||
@ -279,11 +279,11 @@ int notifylog_callback(char *rest)
|
|||||||
|
|
||||||
nick = chop(&rest);
|
nick = chop(&rest);
|
||||||
|
|
||||||
on = a2i(chop(&rest));
|
on = asc2int(chop(&rest));
|
||||||
if (errno)
|
if (errno)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
off = a2i(chop(&rest));
|
off = asc2int(chop(&rest));
|
||||||
if (errno)
|
if (errno)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
@ -311,8 +311,8 @@ int notifylog_callback(char *rest)
|
|||||||
nlog->signoff = off;
|
nlog->signoff = off;
|
||||||
nlog->next = *pp;
|
nlog->next = *pp;
|
||||||
*pp = nlog;
|
*pp = nlog;
|
||||||
nlog->realname = Strcat(nlog->userhost,userhost) + 1;
|
nlog->realname = stringcat(nlog->userhost,userhost) + 1;
|
||||||
Strcpy(nlog->realname,rest);
|
stringcpy(nlog->realname,rest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,7 +381,6 @@ void write_notifylog(void)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int notify_callback(char *rest)
|
int notify_callback(char *rest)
|
||||||
{
|
{
|
||||||
Notify *nf;
|
Notify *nf;
|
||||||
@ -443,18 +442,18 @@ int notify_callback(char *rest)
|
|||||||
*/
|
*/
|
||||||
set_mallocdoer(notify_callback);
|
set_mallocdoer(notify_callback);
|
||||||
nf = (Notify*)Calloc(sizeof(Notify) + StrlenX(nick,rest,src,NULL));
|
nf = (Notify*)Calloc(sizeof(Notify) + StrlenX(nick,rest,src,NULL));
|
||||||
dst = Strcat(nf->nick,nick);
|
dst = stringcat(nf->nick,nick);
|
||||||
if (*rest)
|
if (*rest)
|
||||||
{
|
{
|
||||||
nf->mask = dst + 1;
|
nf->mask = dst + 1;
|
||||||
dst = Strcat(nf->mask,rest);
|
dst = stringcat(nf->mask,rest);
|
||||||
if (STRCHR(nf->mask,' '))
|
if (STRCHR(nf->mask,' '))
|
||||||
nf->endofmask = dst;
|
nf->endofmask = dst;
|
||||||
}
|
}
|
||||||
if (src)
|
if (src)
|
||||||
{
|
{
|
||||||
nf->info = dst + 1;
|
nf->info = dst + 1;
|
||||||
Strcpy(nf->info,src);
|
stringcpy(nf->info,src);
|
||||||
}
|
}
|
||||||
/* put it at the end of notifylist */
|
/* put it at the end of notifylist */
|
||||||
*endoflist = nf;
|
*endoflist = nf;
|
||||||
@ -577,11 +576,11 @@ void nfshow_full(Notify *nf)
|
|||||||
if (s[1] == ':')
|
if (s[1] == ':')
|
||||||
*(opt++) = ' ';
|
*(opt++) = ' ';
|
||||||
*opt = 0;
|
*opt = 0;
|
||||||
opt = Strcat(opt,s);
|
opt = stringcat(opt,s);
|
||||||
while(opt < (mem+18))
|
while(opt < (mem+18))
|
||||||
*(opt++) = ' ';
|
*(opt++) = ' ';
|
||||||
*opt = 0;
|
*opt = 0;
|
||||||
opt = Strcat(opt," -- ");
|
opt = stringcat(opt," -- ");
|
||||||
if (nlog->signoff)
|
if (nlog->signoff)
|
||||||
{
|
{
|
||||||
s = time2away(nlog->signoff);
|
s = time2away(nlog->signoff);
|
||||||
@ -593,7 +592,7 @@ void nfshow_full(Notify *nf)
|
|||||||
{
|
{
|
||||||
s = " online now";
|
s = " online now";
|
||||||
}
|
}
|
||||||
opt = Strcat(opt,s);
|
opt = stringcat(opt,s);
|
||||||
while(opt < (mem+41))
|
while(opt < (mem+41))
|
||||||
*(opt++) = ' ';
|
*(opt++) = ' ';
|
||||||
*opt = 0;
|
*opt = 0;
|
||||||
@ -654,7 +653,7 @@ void do_notify(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
while((opt = chop(&rest)))
|
while((opt = chop(&rest)))
|
||||||
{
|
{
|
||||||
if (!Strcmp(opt,"+"))
|
if (!stringcmp(opt,"+"))
|
||||||
{
|
{
|
||||||
endoflist = ¤t->notifylist;
|
endoflist = ¤t->notifylist;
|
||||||
while(*endoflist)
|
while(*endoflist)
|
||||||
@ -662,14 +661,14 @@ void do_notify(COMMAND_ARGS)
|
|||||||
notify_callback(rest);
|
notify_callback(rest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Strcmp(opt,"-"))
|
if (!stringcmp(opt,"-"))
|
||||||
{
|
{
|
||||||
sub_notifynick(from,rest);
|
sub_notifynick(from,rest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(n=0;n<NF_OPTIONS;n++)
|
for(n=0;n<NF_OPTIONS;n++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(notify_opt[n],opt))
|
if (!stringcasecmp(notify_opt[n],opt))
|
||||||
{
|
{
|
||||||
flags |= (1 << n);
|
flags |= (1 << n);
|
||||||
break;
|
break;
|
||||||
@ -691,8 +690,8 @@ void do_notify(COMMAND_ARGS)
|
|||||||
if (!nf)
|
if (!nf)
|
||||||
{
|
{
|
||||||
if (*message)
|
if (*message)
|
||||||
Strcat(message,", ");
|
stringcat(message,", ");
|
||||||
Strcat(message,opt);
|
stringcat(message,opt);
|
||||||
}
|
}
|
||||||
nf_header++;
|
nf_header++;
|
||||||
}
|
}
|
||||||
|
|||||||
49
src/ons.c
49
src/ons.c
@ -57,7 +57,7 @@ void on_kick(char *from, char *rest)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
Free(&chan->kickedby);
|
Free(&chan->kickedby);
|
||||||
set_mallocdoer(on_kick);
|
set_mallocdoer(on_kick);
|
||||||
chan->kickedby = Strdup(from);
|
chan->kickedby = stringdup(from);
|
||||||
chan->active = FALSE;
|
chan->active = FALSE;
|
||||||
chan->sync = TRUE;
|
chan->sync = TRUE;
|
||||||
chan->bot_is_op = FALSE;
|
chan->bot_is_op = FALSE;
|
||||||
@ -296,13 +296,13 @@ void on_nick(char *from, char *newnick)
|
|||||||
*/
|
*/
|
||||||
if (strlen(cu->nick) >= strlen(newnick))
|
if (strlen(cu->nick) >= strlen(newnick))
|
||||||
{
|
{
|
||||||
Strcpy(cu->nick,newnick);
|
stringcpy(cu->nick,newnick);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Free((char**)&cu->nick);
|
Free((char**)&cu->nick);
|
||||||
set_mallocdoer(on_nick);
|
set_mallocdoer(on_nick);
|
||||||
cu->nick = Strdup(newnick);
|
cu->nick = stringdup(newnick);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -447,7 +447,7 @@ recheck_alias:
|
|||||||
#ifdef ALIAS
|
#ifdef ALIAS
|
||||||
for(alias=aliaslist;alias;alias=alias->next)
|
for(alias=aliaslist;alias;alias=alias->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(alias->alias,command))
|
if (!stringcasecmp(alias->alias,command))
|
||||||
{
|
{
|
||||||
unchop(command,rest);
|
unchop(command,rest);
|
||||||
afmt(amem,alias->format,command);
|
afmt(amem,alias->format,command);
|
||||||
@ -456,7 +456,7 @@ recheck_alias:
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
rest = amem;
|
rest = amem;
|
||||||
pt = chop(&rest);
|
pt = chop(&rest);
|
||||||
i = Strcasecmp(pt,command);
|
i = stringcasecmp(pt,command);
|
||||||
command = pt;
|
command = pt;
|
||||||
arec++;
|
arec++;
|
||||||
if ((arec < MAXALIASRECURSE) && (i != 0))
|
if ((arec < MAXALIASRECURSE) && (i != 0))
|
||||||
@ -481,7 +481,7 @@ recheck_alias:
|
|||||||
/*
|
/*
|
||||||
* does the hook match?
|
* does the hook match?
|
||||||
*/
|
*/
|
||||||
if (hook->flags == HOOK_COMMAND && !Strcasecmp(command,hook->type.command))
|
if (hook->flags == HOOK_COMMAND && !stringcasecmp(command,hook->type.command))
|
||||||
{
|
{
|
||||||
if (hook->func(from,rest,hook))
|
if (hook->func(from,rest,hook))
|
||||||
/* if the hook returns non-zero, the input should not be parsed internally */
|
/* if the hook returns non-zero, the input should not be parsed internally */
|
||||||
@ -500,7 +500,7 @@ recheck_alias:
|
|||||||
continue;
|
continue;
|
||||||
if (uaccess < acmd[i])
|
if (uaccess < acmd[i])
|
||||||
continue;
|
continue;
|
||||||
j = Strcasecmp(mcmd[i].name,command);
|
j = stringcasecmp(mcmd[i].name,command);
|
||||||
if (j < 0)
|
if (j < 0)
|
||||||
continue;
|
continue;
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
@ -550,7 +550,7 @@ recheck_alias:
|
|||||||
/*
|
/*
|
||||||
* convert the command to uppercase
|
* convert the command to uppercase
|
||||||
*/
|
*/
|
||||||
Strcpy(command,mcmd[i].name);
|
stringcpy(command,mcmd[i].name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* send statmsg with info on the command executed
|
* send statmsg with info on the command executed
|
||||||
@ -593,7 +593,7 @@ recheck_alias:
|
|||||||
if (mcmd[i].caxs)
|
if (mcmd[i].caxs)
|
||||||
{
|
{
|
||||||
/* get channel name; 1: msg, 2: to, 3: active channel */
|
/* get channel name; 1: msg, 2: to, 3: active channel */
|
||||||
to = get_channel(to,&rest);
|
to = (char*)get_channel(to,&rest);
|
||||||
if (!ischannel(to))
|
if (!ischannel(to))
|
||||||
return;
|
return;
|
||||||
uaccess = get_authaccess(from,to);
|
uaccess = get_authaccess(from,to);
|
||||||
@ -634,7 +634,7 @@ recheck_alias:
|
|||||||
{
|
{
|
||||||
if (mcmd[i].lbuf && ischannel(orig_to))
|
if (mcmd[i].lbuf && ischannel(orig_to))
|
||||||
{
|
{
|
||||||
redirect.to = Strdup(to);
|
redirect.to = stringdup(to);
|
||||||
redirect.method = R_PRIVMSG;
|
redirect.method = R_PRIVMSG;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -643,7 +643,7 @@ recheck_alias:
|
|||||||
}
|
}
|
||||||
#endif /* REDIRECT */
|
#endif /* REDIRECT */
|
||||||
|
|
||||||
if (mcmd[i].dcc && dcc_only_command(from))
|
if (mcmd[i].dcc && partyline_only_command(from))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcmd[i].func(from,to,rest,acmd[i]);
|
mcmd[i].func(from,to,rest,acmd[i]);
|
||||||
@ -958,7 +958,7 @@ modeloop:
|
|||||||
}
|
}
|
||||||
Free(&chan->key);
|
Free(&chan->key);
|
||||||
set_mallocdoer(on_mode);
|
set_mallocdoer(on_mode);
|
||||||
chan->key = Strdup((parm) ? parm : "???");
|
chan->key = stringdup((parm) ? parm : "???");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -974,7 +974,7 @@ modeloop:
|
|||||||
if (sign == '+')
|
if (sign == '+')
|
||||||
{
|
{
|
||||||
parm = chop(&rest);
|
parm = chop(&rest);
|
||||||
chan->limit = a2i(parm);
|
chan->limit = asc2int(parm);
|
||||||
if (errno)
|
if (errno)
|
||||||
chan->limit = 0;
|
chan->limit = 0;
|
||||||
chan->limitmode = TRUE;
|
chan->limitmode = TRUE;
|
||||||
@ -1007,6 +1007,7 @@ modeloop:
|
|||||||
void common_public(Chan *chan, char *from, char *spyformat, char *rest)
|
void common_public(Chan *chan, char *from, char *spyformat, char *rest)
|
||||||
{
|
{
|
||||||
ChanUser *doer;
|
ChanUser *doer;
|
||||||
|
int n,upper;
|
||||||
|
|
||||||
if (current->spy & SPYF_CHANNEL)
|
if (current->spy & SPYF_CHANNEL)
|
||||||
send_spy(chan->name,spyformat,CurrentNick,rest);
|
send_spy(chan->name,spyformat,CurrentNick,rest);
|
||||||
@ -1016,7 +1017,17 @@ void common_public(Chan *chan, char *from, char *spyformat, char *rest)
|
|||||||
|
|
||||||
doer = find_chanuser(chan,from);
|
doer = find_chanuser(chan,from);
|
||||||
|
|
||||||
if (capslevel(rest))
|
// check if more than half of rest is caps
|
||||||
|
n = upper = 0;
|
||||||
|
while(rest[n])
|
||||||
|
{
|
||||||
|
if ((rest[n] >= 'A' && rest[n] <= 'Z') || (rest[n] == '!'))
|
||||||
|
upper += 2;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// trigger caps flood action
|
||||||
|
if (upper >= n)
|
||||||
{
|
{
|
||||||
if (check_mass(chan,doer,INT_CKL))
|
if (check_mass(chan,doer,INT_CKL))
|
||||||
send_kick(chan,CurrentNick,KICK_CAPS);
|
send_kick(chan,CurrentNick,KICK_CAPS);
|
||||||
@ -1082,10 +1093,10 @@ void do_chaccess(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dis = FALSE;
|
dis = FALSE;
|
||||||
newaccess = a2i(axs);
|
newaccess = asc2int(axs);
|
||||||
if (axs)
|
if (axs)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(axs,"disable"))
|
if (!stringcasecmp(axs,"disable"))
|
||||||
{
|
{
|
||||||
dis = TRUE;
|
dis = TRUE;
|
||||||
newaccess = 100;
|
newaccess = 100;
|
||||||
@ -1114,7 +1125,7 @@ void do_chaccess(COMMAND_ARGS)
|
|||||||
|
|
||||||
for(i=0;mcmd[i].name;i++)
|
for(i=0;mcmd[i].name;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(mcmd[i].name,name))
|
if (!stringcasecmp(mcmd[i].name,name))
|
||||||
{
|
{
|
||||||
oldaccess = acmd[i];
|
oldaccess = acmd[i];
|
||||||
if (dis || oldaccess > 200)
|
if (dis || oldaccess > 200)
|
||||||
@ -1153,7 +1164,7 @@ int access_needed(char *name)
|
|||||||
|
|
||||||
for(i=0;mcmd[i].name;i++)
|
for(i=0;mcmd[i].name;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(mcmd[i].name,name))
|
if (!stringcasecmp(mcmd[i].name,name))
|
||||||
{
|
{
|
||||||
return(acmd[i]);
|
return(acmd[i]);
|
||||||
}
|
}
|
||||||
@ -1171,7 +1182,7 @@ void do_last(COMMAND_ARGS)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
thenum = chop(&rest);
|
thenum = chop(&rest);
|
||||||
num = a2i(thenum);
|
num = asc2int(thenum);
|
||||||
}
|
}
|
||||||
if ((num < 1) || (num > LASTCMDSIZE))
|
if ((num < 1) || (num > LASTCMDSIZE))
|
||||||
usage(from); /* usage for CurrentCmd->name */
|
usage(from); /* usage for CurrentCmd->name */
|
||||||
|
|||||||
28
src/parse.c
28
src/parse.c
@ -202,7 +202,7 @@ void parse_mode(char *from, char *rest)
|
|||||||
on_mode(from,to,rest);
|
on_mode(from,to,rest);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(current->nick,to))
|
if (!stringcasecmp(current->nick,to))
|
||||||
{
|
{
|
||||||
char *dst;
|
char *dst;
|
||||||
char sign;
|
char sign;
|
||||||
@ -256,7 +256,7 @@ void parse_notice(char *from, char *rest)
|
|||||||
rest++;
|
rest++;
|
||||||
ctcp = get_token(&rest," \001"); /* rest cannot be NULL */
|
ctcp = get_token(&rest," \001"); /* rest cannot be NULL */
|
||||||
|
|
||||||
if (!Strcasecmp(ctcp,"PING") && ((pingtime = get_number(rest)) != -1))
|
if (!stringcasecmp(ctcp,"PING") && ((pingtime = get_number(rest)) != -1))
|
||||||
{
|
{
|
||||||
send_spy(SPYSTR_STATUS,"[CTCP PING Reply From %s] %i second(s)",
|
send_spy(SPYSTR_STATUS,"[CTCP PING Reply From %s] %i second(s)",
|
||||||
CurrentNick,(int)(now - pingtime));
|
CurrentNick,(int)(now - pingtime));
|
||||||
@ -298,7 +298,7 @@ void parse_part(char *from, char *rest)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
nick = from;
|
nick = from;
|
||||||
if ((from = Strchr(from,'!')))
|
if ((from = stringchr(from,'!')))
|
||||||
{
|
{
|
||||||
*from = 0;
|
*from = 0;
|
||||||
from++;
|
from++;
|
||||||
@ -549,7 +549,7 @@ void parse_251(char *from, char *rest)
|
|||||||
setbotnick(current,nick);
|
setbotnick(current,nick);
|
||||||
for(sp=serverlist;sp;sp=sp->next)
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(sp->name,from) || !Strcasecmp(sp->realname,from))
|
if (!stringcasecmp(sp->name,from) || !stringcasecmp(sp->realname,from))
|
||||||
{
|
{
|
||||||
sp->lastconnect = now;
|
sp->lastconnect = now;
|
||||||
current->ontime = now;
|
current->ontime = now;
|
||||||
@ -706,7 +706,7 @@ void parse_311(char *from, char *rest)
|
|||||||
{
|
{
|
||||||
Free((char**)¤t->userhost);
|
Free((char**)¤t->userhost);
|
||||||
set_mallocdoer(parse_311);
|
set_mallocdoer(parse_311);
|
||||||
current->userhost = Strdup(user);
|
current->userhost = stringdup(user);
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
botnet_refreshbotinfo();
|
botnet_refreshbotinfo();
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
@ -1059,7 +1059,7 @@ void parse_376(char *from, char *rest)
|
|||||||
if ((sp = find_server(current->server)))
|
if ((sp = find_server(current->server)))
|
||||||
{
|
{
|
||||||
if (*sp->realname == 0)
|
if (*sp->realname == 0)
|
||||||
Strncpy(sp->realname,from,NAMELEN);
|
stringcpy_n(sp->realname,from,NAMELEN);
|
||||||
sp->lastconnect = now;
|
sp->lastconnect = now;
|
||||||
}
|
}
|
||||||
if (current->connect != CN_ONLINE)
|
if (current->connect != CN_ONLINE)
|
||||||
@ -1107,20 +1107,20 @@ void parse_433(char *from, char *rest)
|
|||||||
|
|
||||||
chop(&rest);
|
chop(&rest);
|
||||||
trynick = chop(&rest);
|
trynick = chop(&rest);
|
||||||
Strcpy(scopy,s);
|
stringcpy(scopy,s);
|
||||||
s = scopy;
|
s = scopy;
|
||||||
nick = NULL;
|
nick = NULL;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
s2 = chop(&s);
|
s2 = chop(&s);
|
||||||
if (current->connect == CN_ONLINE && !Strcasecmp(current->nick,s2))
|
if (current->connect == CN_ONLINE && !stringcasecmp(current->nick,s2))
|
||||||
{
|
{
|
||||||
/* nicks listed first are more worth, dont try nicks after */
|
/* nicks listed first are more worth, dont try nicks after */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!nick)
|
if (!nick)
|
||||||
nick = s2;
|
nick = s2;
|
||||||
if (!Strcasecmp(trynick,s2))
|
if (!stringcasecmp(trynick,s2))
|
||||||
{
|
{
|
||||||
nick = NULL;
|
nick = NULL;
|
||||||
}
|
}
|
||||||
@ -1141,7 +1141,7 @@ void parse_433(char *from, char *rest)
|
|||||||
{
|
{
|
||||||
Free((char**)¤t->nick);
|
Free((char**)¤t->nick);
|
||||||
set_mallocdoer(parse_433);
|
set_mallocdoer(parse_433);
|
||||||
current->nick = Strdup(nick);
|
current->nick = stringdup(nick);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1313,7 +1313,7 @@ void parse_005(char *from, char *rest)
|
|||||||
break;
|
break;
|
||||||
if (!matches("modes=?",opt))
|
if (!matches("modes=?",opt))
|
||||||
{
|
{
|
||||||
n = a2i(opt+6);
|
n = asc2int(opt+6);
|
||||||
if (!errno && n >= 1 && n <= 20)
|
if (!errno && n >= 1 && n <= 20)
|
||||||
{
|
{
|
||||||
current->setting[INT_MODES].int_var = n;
|
current->setting[INT_MODES].int_var = n;
|
||||||
@ -1323,7 +1323,7 @@ void parse_005(char *from, char *rest)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp("WALLCHOPS",opt))
|
if (!stringcasecmp("WALLCHOPS",opt))
|
||||||
{
|
{
|
||||||
current->ircx_flags |= IRCX_WALLCHOPS;
|
current->ircx_flags |= IRCX_WALLCHOPS;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -1331,7 +1331,7 @@ void parse_005(char *from, char *rest)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp("WALLVOICES",opt))
|
if (!stringcasecmp("WALLVOICES",opt))
|
||||||
{
|
{
|
||||||
current->ircx_flags |= IRCX_WALLVOICES;
|
current->ircx_flags |= IRCX_WALLVOICES;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -1513,7 +1513,7 @@ void parseline(char *rest)
|
|||||||
/*
|
/*
|
||||||
* does the hook match?
|
* does the hook match?
|
||||||
*/
|
*/
|
||||||
if (hook->flags == HOOK_PARSE && !Strcasecmp(command,hook->type.command))
|
if (hook->flags == HOOK_PARSE && !stringcasecmp(command,hook->type.command))
|
||||||
{
|
{
|
||||||
if (hook->func(from,rest,hook))
|
if (hook->func(from,rest,hook))
|
||||||
/* if the hook returns non-zero, the input should not be parsed internally */
|
/* if the hook returns non-zero, the input should not be parsed internally */
|
||||||
|
|||||||
240
src/partyline.c
240
src/partyline.c
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
EnergyMech, IRC bot software
|
||||||
Copyright (c) 1997-2004 proton
|
Copyright (c) 1997-2018 proton
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -18,17 +18,17 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#define TELNET_C
|
#define PARTYLINE_C
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef TELNET
|
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
|
#ifdef TELNET
|
||||||
|
|
||||||
int check_telnet(int s, char *rest)
|
int check_telnet(int s, char *rest)
|
||||||
{
|
{
|
||||||
Client *client;
|
Client *client;
|
||||||
@ -39,7 +39,7 @@ int check_telnet(int s, char *rest)
|
|||||||
{
|
{
|
||||||
for(user=current->userlist;user;user=user->next)
|
for(user=current->userlist;user;user=user->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(user->name,rest))
|
if (!stringcasecmp(user->name,rest))
|
||||||
goto check_telnet_malloc;
|
goto check_telnet_malloc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,9 +76,235 @@ void check_telnet_pass(Client *client, char *rest)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Strcpy(CurrentNick,client->user->name);
|
stringcpy(CurrentNick,client->user->name);
|
||||||
dcc_banner(client);
|
partyline_banner(client);
|
||||||
client->flags = DCC_TELNET|DCC_ACTIVE;
|
client->flags = DCC_TELNET|DCC_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* TELNET */
|
#endif /* TELNET */
|
||||||
|
|
||||||
|
int partyline_only_command(const char *from)
|
||||||
|
{
|
||||||
|
#ifdef REDIRECT
|
||||||
|
if (!redirect.to)
|
||||||
|
#endif /* REDIRECT */
|
||||||
|
if (!CurrentDCC)
|
||||||
|
{
|
||||||
|
to_user(from,TEXT_DCC_ONLY,CurrentCmd->name);
|
||||||
|
return(TRUE);
|
||||||
|
}
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void partyline_broadcast(const Client *from, const char *format, const char *rest)
|
||||||
|
{
|
||||||
|
Client *client;
|
||||||
|
Mech *bot;
|
||||||
|
|
||||||
|
for(bot=botlist;bot;bot=bot->next)
|
||||||
|
{
|
||||||
|
for(client=bot->clientlist;client;client=client->next)
|
||||||
|
{
|
||||||
|
if (0 == (client->flags & (DCC_ACTIVE|DCC_TELNET)))
|
||||||
|
continue;
|
||||||
|
if (client == from && client->user->x.x.echo == FALSE)
|
||||||
|
continue;
|
||||||
|
to_file(client->sock,format,CurrentNick,rest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void partyline_banner(Client *client)
|
||||||
|
{
|
||||||
|
char tmp[MSGLEN];
|
||||||
|
|
||||||
|
client->flags = DCC_ACTIVE;
|
||||||
|
client->lasttime = now;
|
||||||
|
|
||||||
|
sprintf(tmp,"[%s] %s[%i] has connected",
|
||||||
|
current->nick,client->user->name,(int)client->user->x.x.access);
|
||||||
|
|
||||||
|
if ((to_file(client->sock,"[%s] %s\n",time2medium(now),tmp)) < 0)
|
||||||
|
{
|
||||||
|
client->flags = DCC_DELETE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
send_global(SPYSTR_STATUS,tmp);
|
||||||
|
if (client->user->x.x.access == OWNERLEVEL)
|
||||||
|
{
|
||||||
|
CurrentDCC = client;
|
||||||
|
stringcpy(tmp,SPYSTR_STATUS);
|
||||||
|
do_spy(client->user->name,current->nick,tmp,0);
|
||||||
|
CurrentDCC = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dcc_chat(char *from)
|
||||||
|
{
|
||||||
|
struct sockaddr_in sai;
|
||||||
|
Client *client;
|
||||||
|
User *user;
|
||||||
|
int sock,sz;
|
||||||
|
|
||||||
|
if ((user = get_authuser(from,NULL)) == NULL)
|
||||||
|
return;
|
||||||
|
if (find_client(user->name))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((sock = SockListener(0)) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sz = sizeof(sai);
|
||||||
|
if (getsockname(sock,(struct sockaddr *)&sai,&sz) < 0)
|
||||||
|
{
|
||||||
|
close(sock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_mallocdoer(dcc_chat);
|
||||||
|
client = (Client*)Calloc(sizeof(Client));
|
||||||
|
#ifdef DCC_FILE
|
||||||
|
client->fileno = -1;
|
||||||
|
#endif /* DCC_FILE */
|
||||||
|
client->user = user;
|
||||||
|
client->sock = sock;
|
||||||
|
client->flags = DCC_WAIT;
|
||||||
|
client->lasttime = now;
|
||||||
|
|
||||||
|
client->next = current->clientlist;
|
||||||
|
current->clientlist = client;
|
||||||
|
|
||||||
|
to_server("PRIVMSG %s :\001DCC CHAT CHAT %u %u\001\n",
|
||||||
|
CurrentNick,htonl(current->ip.s_addr),ntohs(sai.sin_port));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef BOTNET
|
||||||
|
|
||||||
|
void whom_printbot(char *from, BotInfo *binfo, char *stt)
|
||||||
|
{
|
||||||
|
char *us;
|
||||||
|
int uaccess;
|
||||||
|
|
||||||
|
us = "";
|
||||||
|
if (binfo->nuh)
|
||||||
|
{
|
||||||
|
uaccess = get_maxaccess(binfo->nuh);
|
||||||
|
if (uaccess == BOTLEVEL)
|
||||||
|
us = "b200";
|
||||||
|
else
|
||||||
|
if (uaccess)
|
||||||
|
sprintf((us = stt),"u%i",uaccess);
|
||||||
|
}
|
||||||
|
uaccess = get_authaccess(from,MATCH_ALL);
|
||||||
|
table_buffer((uaccess >= ASSTLEVEL) ? TEXT_WHOMBOTGUID : TEXT_WHOMBOTLINE,(binfo->nuh) ? nickcpy(NULL,binfo->nuh) : "???",us,
|
||||||
|
(binfo->server) ? binfo->server : "???",(binfo->version) ? binfo->version : "???",binfo->guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BOTNET */
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void do_whom(COMMAND_ARGS)
|
||||||
|
{
|
||||||
|
#ifdef BOTNET
|
||||||
|
BotNet *bn;
|
||||||
|
BotInfo *binfo;
|
||||||
|
#endif /* BOTNET */
|
||||||
|
Server *sp;
|
||||||
|
char stt[NUHLEN];
|
||||||
|
Client *client;
|
||||||
|
Mech *bot;
|
||||||
|
int m,s;
|
||||||
|
|
||||||
|
if (partyline_only_command(from))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(bot=botlist;bot;bot=bot->next)
|
||||||
|
{
|
||||||
|
if (bot->connect == CN_ONLINE)
|
||||||
|
{
|
||||||
|
sp = find_server(bot->server);
|
||||||
|
if (sp)
|
||||||
|
{
|
||||||
|
sprintf(stt,"%s:%i",(*sp->realname) ? sp->realname : sp->name,sp->port);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stringcpy(stt,TEXT_NOTINSERVLIST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stringcpy(stt,TEXT_NOTCONNECTED);
|
||||||
|
}
|
||||||
|
table_buffer(TEXT_WHOMSELFLINE,bot->nick,(bot == current) ? "(me)" : "b200",stt);
|
||||||
|
for(client=bot->clientlist;client;client=client->next)
|
||||||
|
{
|
||||||
|
m = (now - client->lasttime) / 60;
|
||||||
|
s = (now - client->lasttime) % 60;
|
||||||
|
table_buffer(TEXT_WHOMUSERLINE,
|
||||||
|
#ifdef TELNET
|
||||||
|
client->user->name,client->user->x.x.access,(client->flags & DCC_TELNET) ? "telnet" : "DCC",m,s);
|
||||||
|
#else
|
||||||
|
client->user->name,client->user->x.x.access,"DCC",m,s);
|
||||||
|
#endif /* TELNET */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef BOTNET
|
||||||
|
for(bn=botnetlist;bn;bn=bn->next)
|
||||||
|
{
|
||||||
|
if (bn->status != BN_LINKED)
|
||||||
|
continue;
|
||||||
|
for(binfo=bn->botinfo;binfo;binfo=binfo->next)
|
||||||
|
whom_printbot(from,binfo,stt);
|
||||||
|
}
|
||||||
|
#endif /* BOTNET */
|
||||||
|
table_send(from,3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
help:CHAT:(no arguments)
|
||||||
|
begin
|
||||||
|
end
|
||||||
|
*/
|
||||||
|
void do_chat(COMMAND_ARGS)
|
||||||
|
{
|
||||||
|
User *user;
|
||||||
|
|
||||||
|
user = get_authuser(from,NULL);
|
||||||
|
if (!user)
|
||||||
|
return;
|
||||||
|
if (find_client(user->name))
|
||||||
|
{
|
||||||
|
to_user(from,"You are already DCC chatting me");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dcc_chat(from);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
help:BYE:(no arguments)
|
||||||
|
begin
|
||||||
|
end
|
||||||
|
*/
|
||||||
|
void do_bye(COMMAND_ARGS)
|
||||||
|
{
|
||||||
|
if (CurrentDCC)
|
||||||
|
{
|
||||||
|
to_user(from,TEXT_DCC_GOODBYE);
|
||||||
|
CurrentDCC->flags = DCC_DELETE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
help:BOOT:<nick>
|
||||||
|
begin
|
||||||
|
Forcefully disconnect someone from the partyline.
|
||||||
|
end
|
||||||
|
*/
|
||||||
|
void do_boot(COMMAND_ARGS)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
@ -107,8 +107,8 @@ XS(XS_perl_parse_hook)
|
|||||||
hook->next = hooklist;
|
hook->next = hooklist;
|
||||||
hooklist = hook;
|
hooklist = hook;
|
||||||
|
|
||||||
hook->type.command = Strcpy(hook->self,sub) + 1;
|
hook->type.command = stringcpy(hook->self,sub) + 1;
|
||||||
Strcpy(hook->type.command,name);
|
stringcpy(hook->type.command,name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return successful status to script
|
* return successful status to script
|
||||||
|
|||||||
75
src/prot.c
75
src/prot.c
@ -54,8 +54,8 @@ void send_kick(Chan *chan, const char *nick, const char *format, ...)
|
|||||||
*pp = new = (qKick*)Calloc(sizeof(qKick) + Strlen2(nick,gsockdata)); // gsockdata is never NULL
|
*pp = new = (qKick*)Calloc(sizeof(qKick) + Strlen2(nick,gsockdata)); // gsockdata is never NULL
|
||||||
/* Calloc sets to zero new->next = NULL; */
|
/* Calloc sets to zero new->next = NULL; */
|
||||||
|
|
||||||
new->reason = Strcpy(new->nick,nick) + 1;
|
new->reason = stringcpy(new->nick,nick) + 1;
|
||||||
Strcpy(new->reason,gsockdata);
|
stringcpy(new->reason,gsockdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void push_kicks(Chan *chan)
|
void push_kicks(Chan *chan)
|
||||||
@ -148,7 +148,7 @@ void send_mode(Chan *chan, int pri, int type, char plusminus, char modeflag, voi
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
set_mallocdoer(send_mode);
|
set_mallocdoer(send_mode);
|
||||||
mode->data = (void*)Strdup((char*)data);
|
mode->data = (void*)stringdup((char*)data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -220,7 +220,7 @@ loop:
|
|||||||
if (srcparm)
|
if (srcparm)
|
||||||
{
|
{
|
||||||
*(dstparm++) = ' ';
|
*(dstparm++) = ' ';
|
||||||
dstparm = Strcpy(dstparm,srcparm);
|
dstparm = stringcpy(dstparm,srcparm);
|
||||||
}
|
}
|
||||||
maxmodes--;
|
maxmodes--;
|
||||||
}
|
}
|
||||||
@ -408,6 +408,67 @@ void prot_action(Chan *chan, char *from, ChanUser *doer, char *target, ChanUser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DYNAMODE
|
||||||
|
|
||||||
|
void check_dynamode(Chan *chan)
|
||||||
|
{
|
||||||
|
ChanUser *cu;
|
||||||
|
char tempconf[strlen(chan->setting[STR_DYNLIMIT].str_var)+2];
|
||||||
|
char ascnum[11];
|
||||||
|
char *src,*num,*end;
|
||||||
|
int n = 0,wind,v[3];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* parse `delay:window:minwin'
|
||||||
|
*/
|
||||||
|
end = stringcpy(tempconf,chan->setting[STR_DYNLIMIT].str_var);
|
||||||
|
num = src = tempconf;
|
||||||
|
for(;(src<=end) && (n<3);src++)
|
||||||
|
{
|
||||||
|
if (*src == 0 || *src == ':')
|
||||||
|
{
|
||||||
|
*src = 0;
|
||||||
|
v[n] = asc2int(num);
|
||||||
|
if (errno)
|
||||||
|
{
|
||||||
|
v[0] = 90; /* delay */
|
||||||
|
v[1] = 10; /* window */
|
||||||
|
v[2] = 4; /* minwin */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
num = src+1;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
v[0] = (v[0] < 20) ? 20 : (v[0] > 600) ? 600 : v[0];
|
||||||
|
if ((now - chan->lastlimit) < v[0])
|
||||||
|
return;
|
||||||
|
v[1] = (v[1] < 5) ? 5 : (v[1] > 50) ? 50 : v[1];
|
||||||
|
v[2] = (v[2] < 1) ? 1 : (v[2] > 50) ? 50 : v[2];
|
||||||
|
|
||||||
|
chan->lastlimit = now;
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
for(cu=chan->users;cu;cu=cu->next)
|
||||||
|
n++;
|
||||||
|
|
||||||
|
wind = n / v[1];
|
||||||
|
if (wind < v[2])
|
||||||
|
wind = v[2];
|
||||||
|
|
||||||
|
wind += n;
|
||||||
|
|
||||||
|
n = wind - chan->limit;
|
||||||
|
|
||||||
|
if (!chan->limitmode || (n < -2) || (n > 1))
|
||||||
|
{
|
||||||
|
sprintf(ascnum,"%i",wind);
|
||||||
|
send_mode(chan,160,QM_RAWMODE,'+','l',ascnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* DYNAMODE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* mode commands
|
* mode commands
|
||||||
@ -437,8 +498,8 @@ void do_opvoice(COMMAND_ARGS)
|
|||||||
/*
|
/*
|
||||||
* on_msg checks CAXS + CARGS
|
* on_msg checks CAXS + CARGS
|
||||||
*/
|
*/
|
||||||
Chan *chan;
|
const Chan *chan;
|
||||||
char *m;
|
const char *m;
|
||||||
|
|
||||||
if ((chan = CurrentChan) && chan->bot_is_op)
|
if ((chan = CurrentChan) && chan->bot_is_op)
|
||||||
{
|
{
|
||||||
@ -598,7 +659,7 @@ void do_banlist(COMMAND_ARGS)
|
|||||||
#else /* IRCD_EXTENSIONS */
|
#else /* IRCD_EXTENSIONS */
|
||||||
if (chan->banlist)
|
if (chan->banlist)
|
||||||
{
|
{
|
||||||
table_buffer(str_underline("channel") "\t\037ban mask\037\t\037set by\037");
|
table_buffer(str_underline("channel") "\t" str_underline("ban mask") "\t" str_underline("set by"));
|
||||||
for(ban=chan->banlist;ban;ban=ban->next)
|
for(ban=chan->banlist;ban;ban=ban->next)
|
||||||
table_buffer("%s\t%s\t%s",to,ban->banstring,ban->bannedby);
|
table_buffer("%s\t%s\t%s",to,ban->banstring,ban->bannedby);
|
||||||
table_send(from,2);
|
table_send(from,2);
|
||||||
|
|||||||
20
src/python.c
20
src/python.c
@ -334,16 +334,16 @@ PyObject *python_hook(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Strcasecmp(type, "command"))
|
if (!stringcasecmp(type, "command"))
|
||||||
mode = HOOK_COMMAND;
|
mode = HOOK_COMMAND;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(type, "dcc_complete"))
|
if (!stringcasecmp(type, "dcc_complete"))
|
||||||
mode = HOOK_DCC_COMPLETE;
|
mode = HOOK_DCC_COMPLETE;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(type, "parse"))
|
if (!stringcasecmp(type, "parse"))
|
||||||
mode = HOOK_PARSE;
|
mode = HOOK_PARSE;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(type, "timer"))
|
if (!stringcasecmp(type, "timer"))
|
||||||
{
|
{
|
||||||
if (compile_timer(&hooktimer, command) < 0)
|
if (compile_timer(&hooktimer, command) < 0)
|
||||||
{
|
{
|
||||||
@ -374,13 +374,13 @@ PyObject *python_hook(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
hook->next = hooklist;
|
hook->next = hooklist;
|
||||||
hooklist = hook;
|
hooklist = hook;
|
||||||
|
|
||||||
hook->type.any = (void*) (Strcpy(hook->self, cbname) + 1);
|
hook->type.any = (void*) (stringcpy(hook->self, cbname) + 1);
|
||||||
|
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case HOOK_COMMAND:
|
case HOOK_COMMAND:
|
||||||
case HOOK_PARSE:
|
case HOOK_PARSE:
|
||||||
Strcpy(hook->type.command, command);
|
stringcpy(hook->type.command, command);
|
||||||
hook->func = python_parse_jump;
|
hook->func = python_parse_jump;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -718,8 +718,8 @@ static PyObject *python_dns(PyObject *self, PyObject *args, PyObject *keywds)
|
|||||||
hook->flags = HOOK_DNS;
|
hook->flags = HOOK_DNS;
|
||||||
hook->next = hooklist;
|
hook->next = hooklist;
|
||||||
hooklist = hook;
|
hooklist = hook;
|
||||||
hook->type.host = Strcpy(hook->self, cbname) + 1;
|
hook->type.host = stringcpy(hook->self, cbname) + 1;
|
||||||
Strcpy(hook->type.host, host);
|
stringcpy(hook->type.host, host);
|
||||||
hook->func = python_dns_jump;
|
hook->func = python_dns_jump;
|
||||||
|
|
||||||
rawdns(host);
|
rawdns(host);
|
||||||
@ -737,7 +737,7 @@ static PyObject *python_execute(PyObject *self, PyObject *args)
|
|||||||
PyObject *cmd, *from, *to, *rest;
|
PyObject *cmd, *from, *to, *rest;
|
||||||
char *c_cmd, *c_from, *c_to, *c_rest;
|
char *c_cmd, *c_from, *c_to, *c_rest;
|
||||||
int cmdaccess, i;
|
int cmdaccess, i;
|
||||||
void (*found)(char*,char*,char*,int) = NULL;
|
void (*found)(char*, const char*,char*, const int) = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "OOOOi", &cmd, &from, &to, &rest, &cmdaccess))
|
if (!PyArg_ParseTuple(args, "OOOOi", &cmd, &from, &to, &rest, &cmdaccess))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -781,7 +781,7 @@ static PyObject *python_execute(PyObject *self, PyObject *args)
|
|||||||
/* check command exists */
|
/* check command exists */
|
||||||
for (i = 0; mcmd[i].name; ++i)
|
for (i = 0; mcmd[i].name; ++i)
|
||||||
{
|
{
|
||||||
if (!Strcmp(mcmd[i].name, c_cmd))
|
if (!stringcmp(mcmd[i].name, c_cmd))
|
||||||
{
|
{
|
||||||
found = mcmd[i].func;
|
found = mcmd[i].func;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -58,7 +58,7 @@ int begin_redirect(char *from, char *args)
|
|||||||
{
|
{
|
||||||
if (find_channel_ac(nick))
|
if (find_channel_ac(nick))
|
||||||
{
|
{
|
||||||
redirect.to = Strdup(nick);
|
redirect.to = stringdup(nick);
|
||||||
redirect.method = R_PRIVMSG;
|
redirect.method = R_PRIVMSG;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -83,13 +83,13 @@ int begin_redirect(char *from, char *args)
|
|||||||
to_user(from,"Bad filename.");
|
to_user(from,"Bad filename.");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
redirect.to = Strdup(nick);
|
redirect.to = stringdup(nick);
|
||||||
redirect.method = R_FILE;
|
redirect.method = R_FILE;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
if ((pt = find_nuh(nick)))
|
if ((pt = find_nuh(nick)))
|
||||||
{
|
{
|
||||||
redirect.to = Strdup(nick);
|
redirect.to = stringdup(nick);
|
||||||
redirect.method = R_NOTICE;
|
redirect.method = R_NOTICE;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ void send_redirect(char *message)
|
|||||||
case R_FILE:
|
case R_FILE:
|
||||||
if ((fd = open(redirect.to,O_WRONLY|O_CREAT|O_APPEND,NEWFILEMODE)) < 0)
|
if ((fd = open(redirect.to,O_WRONLY|O_CREAT|O_APPEND,NEWFILEMODE)) < 0)
|
||||||
return;
|
return;
|
||||||
fmt = Strcat(message,"\n");
|
fmt = stringcat(message,"\n");
|
||||||
write(fd,message,(fmt-message));
|
write(fd,message,(fmt-message));
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -98,7 +98,7 @@ char *recover_client(char *env)
|
|||||||
{
|
{
|
||||||
for(user=current->userlist;user;user=user->next)
|
for(user=current->userlist;user;user=user->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(user->name,handle))
|
if (!stringcasecmp(user->name,handle))
|
||||||
goto found_user;
|
goto found_user;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -133,7 +133,7 @@ found_user:
|
|||||||
if (user->x.x.access == OWNERLEVEL)
|
if (user->x.x.access == OWNERLEVEL)
|
||||||
{
|
{
|
||||||
CurrentDCC = client;
|
CurrentDCC = client;
|
||||||
Strcpy(client->sockdata,"status");
|
stringcpy(client->sockdata,"status");
|
||||||
do_spy(user->name,current->wantnick,client->sockdata,0);
|
do_spy(user->name,current->wantnick,client->sockdata,0);
|
||||||
*client->sockdata = 0;
|
*client->sockdata = 0;
|
||||||
CurrentDCC = NULL;
|
CurrentDCC = NULL;
|
||||||
@ -371,7 +371,7 @@ void do_reset(COMMAND_ARGS)
|
|||||||
#endif /* NOTIFY */
|
#endif /* NOTIFY */
|
||||||
|
|
||||||
*env = 0;
|
*env = 0;
|
||||||
p = Strcat(env,STR_MECHRESET);
|
p = stringcat(env,STR_MECHRESET);
|
||||||
n = 0;
|
n = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/*
|
/*
|
||||||
|
|||||||
17
src/seen.c
17
src/seen.c
@ -81,11 +81,11 @@ int read_seenlist_callback(char *rest)
|
|||||||
nick = chop(&rest);
|
nick = chop(&rest);
|
||||||
uh = chop(&rest);
|
uh = chop(&rest);
|
||||||
|
|
||||||
when = a2i(chop(&rest)); /* seen time, a2i handles NULL */
|
when = asc2int(chop(&rest)); /* seen time, asc2int handles NULL */
|
||||||
if (errno)
|
if (errno)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
t = a2i(chop(&rest)); /* seen type, a2i handles NULL */
|
t = asc2int(chop(&rest)); /* seen type, asc2int handles NULL */
|
||||||
if (errno)
|
if (errno)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
||||||
@ -197,16 +197,16 @@ step_two:
|
|||||||
seen->t = t;
|
seen->t = t;
|
||||||
/* Calloc sets to zero seen->pa = seen->pb = NULL; */
|
/* Calloc sets to zero seen->pa = seen->pb = NULL; */
|
||||||
|
|
||||||
seen->userhost = Strcpy(seen->nick,nick) + 1;
|
seen->userhost = stringcpy(seen->nick,nick) + 1;
|
||||||
pt = Strcpy(seen->userhost,userhost) + 1;
|
pt = stringcpy(seen->userhost,userhost) + 1;
|
||||||
if (pa)
|
if (pa)
|
||||||
{
|
{
|
||||||
seen->pa = pt;
|
seen->pa = pt;
|
||||||
pt = Strcpy(seen->pa,pa) + 1;
|
pt = stringcpy(seen->pa,pa) + 1;
|
||||||
if (pb)
|
if (pb)
|
||||||
{
|
{
|
||||||
seen->pb = pt;
|
seen->pb = pt;
|
||||||
Strcpy(seen->pb,pb);
|
stringcpy(seen->pb,pb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,8 @@ void do_seen(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
Seen *seen;
|
Seen *seen;
|
||||||
char ago[35]; /* enought for "36500 days, 23 hours and 59 minutes" (100 years) */
|
char ago[35]; /* enought for "36500 days, 23 hours and 59 minutes" (100 years) */
|
||||||
char *chan,*fmt,*n,*u,*c1,*c2,*c3;
|
const char *chan;
|
||||||
|
char *fmt,*n,*u,*c1,*c2,*c3;
|
||||||
time_t when;
|
time_t when;
|
||||||
int d,h,m,mul;
|
int d,h,m,mul;
|
||||||
|
|
||||||
@ -255,7 +256,7 @@ void do_seen(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
for(seen=seenlist;seen;seen=seen->next)
|
for(seen=seenlist;seen;seen=seen->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(n,seen->nick))
|
if (!stringcasecmp(n,seen->nick))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,27 +0,0 @@
|
|||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include "sha1.h"
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
SHA1_CTX sha;
|
|
||||||
uint8_t results[20];
|
|
||||||
char *buf;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
buf = "abc";
|
|
||||||
n = strlen(buf);
|
|
||||||
SHA1Init(&sha);
|
|
||||||
SHA1Update(&sha, (uint8_t *)buf, n);
|
|
||||||
SHA1Final(results, &sha);
|
|
||||||
|
|
||||||
/* Print the digest as one long hex value */
|
|
||||||
printf("a9993e364706816aba3e25717850c26c9cd0d89d <-- expected result\n");
|
|
||||||
for (n = 0; n < 20; n++)
|
|
||||||
printf("%02x", results[n]);
|
|
||||||
|
|
||||||
putchar('\n');
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
296
src/sha/sha1.c
296
src/sha/sha1.c
@ -1,296 +0,0 @@
|
|||||||
/*
|
|
||||||
SHA-1 in C
|
|
||||||
By Steve Reid <steve@edmweb.com>
|
|
||||||
100% Public Domain
|
|
||||||
|
|
||||||
Test Vectors (from FIPS PUB 180-1)
|
|
||||||
"abc"
|
|
||||||
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
|
||||||
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
|
|
||||||
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
|
||||||
A million repetitions of "a"
|
|
||||||
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */
|
|
||||||
/* #define SHA1HANDSOFF * Copies data before messing with it. */
|
|
||||||
|
|
||||||
#define SHA1HANDSOFF
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* for uint32_t */
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "sha1.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
|
||||||
|
|
||||||
/* blk0() and blk() perform the initial expand. */
|
|
||||||
/* I got the idea of expanding during the round function from SSLeay */
|
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
|
||||||
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
|
||||||
|(rol(block->l[i],8)&0x00FF00FF))
|
|
||||||
#elif BYTE_ORDER == BIG_ENDIAN
|
|
||||||
#define blk0(i) block->l[i]
|
|
||||||
#else
|
|
||||||
#error "Endianness not defined!"
|
|
||||||
#endif
|
|
||||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
|
||||||
^block->l[(i+2)&15]^block->l[i&15],1))
|
|
||||||
|
|
||||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
|
||||||
#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
|
||||||
#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
|
|
||||||
#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
|
|
||||||
#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
|
|
||||||
#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
|
|
||||||
|
|
||||||
|
|
||||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
|
||||||
|
|
||||||
void SHA1Transform(
|
|
||||||
uint32_t state[5],
|
|
||||||
const unsigned char buffer[64]
|
|
||||||
)
|
|
||||||
{
|
|
||||||
uint32_t a, b, c, d, e;
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
unsigned char c[64];
|
|
||||||
uint32_t l[16];
|
|
||||||
} CHAR64LONG16;
|
|
||||||
|
|
||||||
#ifdef SHA1HANDSOFF
|
|
||||||
CHAR64LONG16 block[1]; /* use array to appear as a pointer */
|
|
||||||
|
|
||||||
memcpy(block, buffer, 64);
|
|
||||||
#else
|
|
||||||
/* The following had better never be used because it causes the
|
|
||||||
* pointer-to-const buffer to be cast into a pointer to non-const.
|
|
||||||
* And the result is written through. I threw a "const" in, hoping
|
|
||||||
* this will cause a diagnostic.
|
|
||||||
*/
|
|
||||||
CHAR64LONG16 *block = (const CHAR64LONG16 *) buffer;
|
|
||||||
#endif
|
|
||||||
/* Copy context->state[] to working vars */
|
|
||||||
a = state[0];
|
|
||||||
b = state[1];
|
|
||||||
c = state[2];
|
|
||||||
d = state[3];
|
|
||||||
e = state[4];
|
|
||||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
|
||||||
R0(a, b, c, d, e, 0);
|
|
||||||
R0(e, a, b, c, d, 1);
|
|
||||||
R0(d, e, a, b, c, 2);
|
|
||||||
R0(c, d, e, a, b, 3);
|
|
||||||
R0(b, c, d, e, a, 4);
|
|
||||||
R0(a, b, c, d, e, 5);
|
|
||||||
R0(e, a, b, c, d, 6);
|
|
||||||
R0(d, e, a, b, c, 7);
|
|
||||||
R0(c, d, e, a, b, 8);
|
|
||||||
R0(b, c, d, e, a, 9);
|
|
||||||
R0(a, b, c, d, e, 10);
|
|
||||||
R0(e, a, b, c, d, 11);
|
|
||||||
R0(d, e, a, b, c, 12);
|
|
||||||
R0(c, d, e, a, b, 13);
|
|
||||||
R0(b, c, d, e, a, 14);
|
|
||||||
R0(a, b, c, d, e, 15);
|
|
||||||
R1(e, a, b, c, d, 16);
|
|
||||||
R1(d, e, a, b, c, 17);
|
|
||||||
R1(c, d, e, a, b, 18);
|
|
||||||
R1(b, c, d, e, a, 19);
|
|
||||||
R2(a, b, c, d, e, 20);
|
|
||||||
R2(e, a, b, c, d, 21);
|
|
||||||
R2(d, e, a, b, c, 22);
|
|
||||||
R2(c, d, e, a, b, 23);
|
|
||||||
R2(b, c, d, e, a, 24);
|
|
||||||
R2(a, b, c, d, e, 25);
|
|
||||||
R2(e, a, b, c, d, 26);
|
|
||||||
R2(d, e, a, b, c, 27);
|
|
||||||
R2(c, d, e, a, b, 28);
|
|
||||||
R2(b, c, d, e, a, 29);
|
|
||||||
R2(a, b, c, d, e, 30);
|
|
||||||
R2(e, a, b, c, d, 31);
|
|
||||||
R2(d, e, a, b, c, 32);
|
|
||||||
R2(c, d, e, a, b, 33);
|
|
||||||
R2(b, c, d, e, a, 34);
|
|
||||||
R2(a, b, c, d, e, 35);
|
|
||||||
R2(e, a, b, c, d, 36);
|
|
||||||
R2(d, e, a, b, c, 37);
|
|
||||||
R2(c, d, e, a, b, 38);
|
|
||||||
R2(b, c, d, e, a, 39);
|
|
||||||
R3(a, b, c, d, e, 40);
|
|
||||||
R3(e, a, b, c, d, 41);
|
|
||||||
R3(d, e, a, b, c, 42);
|
|
||||||
R3(c, d, e, a, b, 43);
|
|
||||||
R3(b, c, d, e, a, 44);
|
|
||||||
R3(a, b, c, d, e, 45);
|
|
||||||
R3(e, a, b, c, d, 46);
|
|
||||||
R3(d, e, a, b, c, 47);
|
|
||||||
R3(c, d, e, a, b, 48);
|
|
||||||
R3(b, c, d, e, a, 49);
|
|
||||||
R3(a, b, c, d, e, 50);
|
|
||||||
R3(e, a, b, c, d, 51);
|
|
||||||
R3(d, e, a, b, c, 52);
|
|
||||||
R3(c, d, e, a, b, 53);
|
|
||||||
R3(b, c, d, e, a, 54);
|
|
||||||
R3(a, b, c, d, e, 55);
|
|
||||||
R3(e, a, b, c, d, 56);
|
|
||||||
R3(d, e, a, b, c, 57);
|
|
||||||
R3(c, d, e, a, b, 58);
|
|
||||||
R3(b, c, d, e, a, 59);
|
|
||||||
R4(a, b, c, d, e, 60);
|
|
||||||
R4(e, a, b, c, d, 61);
|
|
||||||
R4(d, e, a, b, c, 62);
|
|
||||||
R4(c, d, e, a, b, 63);
|
|
||||||
R4(b, c, d, e, a, 64);
|
|
||||||
R4(a, b, c, d, e, 65);
|
|
||||||
R4(e, a, b, c, d, 66);
|
|
||||||
R4(d, e, a, b, c, 67);
|
|
||||||
R4(c, d, e, a, b, 68);
|
|
||||||
R4(b, c, d, e, a, 69);
|
|
||||||
R4(a, b, c, d, e, 70);
|
|
||||||
R4(e, a, b, c, d, 71);
|
|
||||||
R4(d, e, a, b, c, 72);
|
|
||||||
R4(c, d, e, a, b, 73);
|
|
||||||
R4(b, c, d, e, a, 74);
|
|
||||||
R4(a, b, c, d, e, 75);
|
|
||||||
R4(e, a, b, c, d, 76);
|
|
||||||
R4(d, e, a, b, c, 77);
|
|
||||||
R4(c, d, e, a, b, 78);
|
|
||||||
R4(b, c, d, e, a, 79);
|
|
||||||
/* Add the working vars back into context.state[] */
|
|
||||||
state[0] += a;
|
|
||||||
state[1] += b;
|
|
||||||
state[2] += c;
|
|
||||||
state[3] += d;
|
|
||||||
state[4] += e;
|
|
||||||
/* Wipe variables */
|
|
||||||
a = b = c = d = e = 0;
|
|
||||||
#ifdef SHA1HANDSOFF
|
|
||||||
memset(block, '\0', sizeof(block));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* SHA1Init - Initialize new context */
|
|
||||||
|
|
||||||
void SHA1Init(
|
|
||||||
SHA1_CTX * context
|
|
||||||
)
|
|
||||||
{
|
|
||||||
/* SHA1 initialization constants */
|
|
||||||
context->state[0] = 0x67452301;
|
|
||||||
context->state[1] = 0xEFCDAB89;
|
|
||||||
context->state[2] = 0x98BADCFE;
|
|
||||||
context->state[3] = 0x10325476;
|
|
||||||
context->state[4] = 0xC3D2E1F0;
|
|
||||||
context->count[0] = context->count[1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Run your data through this. */
|
|
||||||
|
|
||||||
void SHA1Update(
|
|
||||||
SHA1_CTX * context,
|
|
||||||
const unsigned char *data,
|
|
||||||
uint32_t len
|
|
||||||
)
|
|
||||||
{
|
|
||||||
uint32_t i;
|
|
||||||
|
|
||||||
uint32_t j;
|
|
||||||
|
|
||||||
j = context->count[0];
|
|
||||||
if ((context->count[0] += len << 3) < j)
|
|
||||||
context->count[1]++;
|
|
||||||
context->count[1] += (len >> 29);
|
|
||||||
j = (j >> 3) & 63;
|
|
||||||
if ((j + len) > 63)
|
|
||||||
{
|
|
||||||
memcpy(&context->buffer[j], data, (i = 64 - j));
|
|
||||||
SHA1Transform(context->state, context->buffer);
|
|
||||||
for (; i + 63 < len; i += 64)
|
|
||||||
{
|
|
||||||
SHA1Transform(context->state, &data[i]);
|
|
||||||
}
|
|
||||||
j = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
i = 0;
|
|
||||||
memcpy(&context->buffer[j], &data[i], len - i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Add padding and return the message digest. */
|
|
||||||
|
|
||||||
void SHA1Final(
|
|
||||||
unsigned char digest[20],
|
|
||||||
SHA1_CTX * context
|
|
||||||
)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
unsigned char finalcount[8];
|
|
||||||
|
|
||||||
unsigned char c;
|
|
||||||
|
|
||||||
#if 0 /* untested "improvement" by DHR */
|
|
||||||
/* Convert context->count to a sequence of bytes
|
|
||||||
* in finalcount. Second element first, but
|
|
||||||
* big-endian order within element.
|
|
||||||
* But we do it all backwards.
|
|
||||||
*/
|
|
||||||
unsigned char *fcp = &finalcount[8];
|
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
uint32_t t = context->count[i];
|
|
||||||
|
|
||||||
int j;
|
|
||||||
|
|
||||||
for (j = 0; j < 4; t >>= 8, j++)
|
|
||||||
*--fcp = (unsigned char) t}
|
|
||||||
#else
|
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
finalcount[i] = (unsigned char) ((context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); /* Endian independent */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
c = 0200;
|
|
||||||
SHA1Update(context, &c, 1);
|
|
||||||
while ((context->count[0] & 504) != 448)
|
|
||||||
{
|
|
||||||
c = 0000;
|
|
||||||
SHA1Update(context, &c, 1);
|
|
||||||
}
|
|
||||||
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
|
|
||||||
for (i = 0; i < 20; i++)
|
|
||||||
{
|
|
||||||
digest[i] = (unsigned char)
|
|
||||||
((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);
|
|
||||||
}
|
|
||||||
/* Wipe variables */
|
|
||||||
memset(context, '\0', sizeof(*context));
|
|
||||||
memset(&finalcount, '\0', sizeof(finalcount));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SHA1(
|
|
||||||
char *hash_out,
|
|
||||||
const char *str,
|
|
||||||
int len)
|
|
||||||
{
|
|
||||||
SHA1_CTX ctx;
|
|
||||||
unsigned int ii;
|
|
||||||
|
|
||||||
SHA1Init(&ctx);
|
|
||||||
for (ii=0; ii<len; ii+=1)
|
|
||||||
SHA1Update(&ctx, (const unsigned char*)str + ii, 1);
|
|
||||||
SHA1Final((unsigned char *)hash_out, &ctx);
|
|
||||||
hash_out[20] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
#ifndef SHA1_H
|
|
||||||
#define SHA1_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
SHA-1 in C
|
|
||||||
By Steve Reid <steve@edmweb.com>
|
|
||||||
100% Public Domain
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdint.h"
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t state[5];
|
|
||||||
uint32_t count[2];
|
|
||||||
unsigned char buffer[64];
|
|
||||||
} SHA1_CTX;
|
|
||||||
|
|
||||||
void SHA1Transform(
|
|
||||||
uint32_t state[5],
|
|
||||||
const unsigned char buffer[64]
|
|
||||||
);
|
|
||||||
|
|
||||||
void SHA1Init(
|
|
||||||
SHA1_CTX * context
|
|
||||||
);
|
|
||||||
|
|
||||||
void SHA1Update(
|
|
||||||
SHA1_CTX * context,
|
|
||||||
const unsigned char *data,
|
|
||||||
uint32_t len
|
|
||||||
);
|
|
||||||
|
|
||||||
void SHA1Final(
|
|
||||||
unsigned char digest[20],
|
|
||||||
SHA1_CTX * context
|
|
||||||
);
|
|
||||||
|
|
||||||
void SHA1(
|
|
||||||
char *hash_out,
|
|
||||||
const char *str,
|
|
||||||
int len);
|
|
||||||
|
|
||||||
#endif /* SHA1_H */
|
|
||||||
16
src/shit.c
16
src/shit.c
@ -98,7 +98,7 @@ void remove_shit(Shit *shit)
|
|||||||
Shit **pp;
|
Shit **pp;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(remove_shit) removing shit %s on channel %s (Level 4)\n",shit->mask,shit->chan,shit->action);
|
debug("(remove_shit) removing shit %s on channel %s (Level %i)\n",shit->mask,shit->chan,shit->action);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
pp = ¤t->shitlist;
|
pp = ¤t->shitlist;
|
||||||
while(*pp)
|
while(*pp)
|
||||||
@ -145,10 +145,10 @@ Shit *add_shit(char *from, char *chan, char *mask, char *reason, int axs, int ex
|
|||||||
shit->next = current->shitlist;
|
shit->next = current->shitlist;
|
||||||
current->shitlist = shit;
|
current->shitlist = shit;
|
||||||
|
|
||||||
shit->chan = Strcpy(shit->mask,mask) + 1;
|
shit->chan = stringcpy(shit->mask,mask) + 1;
|
||||||
shit->from = Strcpy(shit->chan,chan) + 1;
|
shit->from = stringcpy(shit->chan,chan) + 1;
|
||||||
shit->reason = Strcpy(shit->from,from) + 1;
|
shit->reason = stringcpy(shit->from,from) + 1;
|
||||||
Strcpy(shit->reason,reason);
|
stringcpy(shit->reason,reason);
|
||||||
|
|
||||||
current->ul_save++;
|
current->ul_save++;
|
||||||
return(shit);
|
return(shit);
|
||||||
@ -165,7 +165,7 @@ Shit *find_shit(const char *userhost, const char *channel)
|
|||||||
best = 0;
|
best = 0;
|
||||||
for(shit=current->shitlist;shit;shit=shit->next)
|
for(shit=current->shitlist;shit;shit=shit->next)
|
||||||
{
|
{
|
||||||
if (!channel || !Strcasecmp(channel,shit->chan) ||
|
if (!channel || !stringcasecmp(channel,shit->chan) ||
|
||||||
(*shit->chan == '*') || (*channel == '*'))
|
(*shit->chan == '*') || (*channel == '*'))
|
||||||
{
|
{
|
||||||
num = num_matches(shit->mask,userhost);
|
num = num_matches(shit->mask,userhost);
|
||||||
@ -272,7 +272,7 @@ void do_shit(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shitlevel = a2i(chop(&rest));
|
shitlevel = asc2int(chop(&rest));
|
||||||
if (errno)
|
if (errno)
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ void do_shit(COMMAND_ARGS)
|
|||||||
days = 86400 * 30;
|
days = 86400 * 30;
|
||||||
if (*rest >= '1' && *rest <= '9')
|
if (*rest >= '1' && *rest <= '9')
|
||||||
{
|
{
|
||||||
days = 86400 * a2i(chop(&rest));
|
days = 86400 * asc2int(chop(&rest));
|
||||||
if (errno)
|
if (errno)
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/socket.c
10
src/socket.c
@ -353,7 +353,7 @@ void to_user_q(const char *target, const char *format, ...)
|
|||||||
vsprintf(message,format,args);
|
vsprintf(message,format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
Strcat(message,"\n");
|
stringcat(message,"\n");
|
||||||
|
|
||||||
fmt = "NOTICE %s :%s";
|
fmt = "NOTICE %s :%s";
|
||||||
if (CurrentChan)
|
if (CurrentChan)
|
||||||
@ -434,12 +434,12 @@ void to_user(const char *target, const char *format, ...)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s = Strcpy(message,"NOTICE ");
|
s = stringcpy(message,"NOTICE ");
|
||||||
if (ischannel(target))
|
if (ischannel(target))
|
||||||
Strcat(message,target);
|
stringcat(message,target);
|
||||||
else
|
else
|
||||||
nickcpy(s,target);
|
nickcpy(s,target);
|
||||||
s = Strcat(message," :");
|
s = stringcat(message," :");
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
@ -457,7 +457,7 @@ void to_user(const char *target, const char *format, ...)
|
|||||||
/*
|
/*
|
||||||
* tag on a newline for DCC or server
|
* tag on a newline for DCC or server
|
||||||
*/
|
*/
|
||||||
s = Strcat(message,"\n");
|
s = stringcat(message,"\n");
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
*s = 0;
|
*s = 0;
|
||||||
|
|||||||
16
src/spy.c
16
src/spy.c
@ -65,7 +65,7 @@ void send_spy(const char *src, const char *format, ...)
|
|||||||
{
|
{
|
||||||
if ((*src == '#' || *src == '*') && spy->t_src == SPY_CHANNEL)
|
if ((*src == '#' || *src == '*') && spy->t_src == SPY_CHANNEL)
|
||||||
{
|
{
|
||||||
if ((*src != '*') && Strcasecmp(spy->src,src))
|
if ((*src != '*') && stringcasecmp(spy->src,src))
|
||||||
continue;
|
continue;
|
||||||
if ((chan = find_channel_ac(spy->src)) == NULL)
|
if ((chan = find_channel_ac(spy->src)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -187,7 +187,7 @@ int spy_source(char *from, int *t_src, const char **src)
|
|||||||
|
|
||||||
for(i=0;spy_source_list[i].idstring;i++)
|
for(i=0;spy_source_list[i].idstring;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(*src,spy_source_list[i].idstring))
|
if (!stringcasecmp(*src,spy_source_list[i].idstring))
|
||||||
{
|
{
|
||||||
*src = spy_source_list[i].idstring;
|
*src = spy_source_list[i].idstring;
|
||||||
*t_src = spy_source_list[i].typenum;
|
*t_src = spy_source_list[i].typenum;
|
||||||
@ -251,7 +251,7 @@ void do_spy(COMMAND_ARGS)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dcc_only_command(from))
|
if (partyline_only_command(from))
|
||||||
return;
|
return;
|
||||||
table_buffer("\037source\037\t\037target\037");
|
table_buffer("\037source\037\t\037target\037");
|
||||||
for(spy=current->spylist;spy;spy=spy->next)
|
for(spy=current->spylist;spy;spy=spy->next)
|
||||||
@ -393,7 +393,7 @@ spy_dest_ok:
|
|||||||
for(spy=current->spylist;spy;spy=spy->next)
|
for(spy=current->spylist;spy;spy=spy->next)
|
||||||
{
|
{
|
||||||
if ((spy->t_src == t_src) && (spy->t_dest == t_dest) &&
|
if ((spy->t_src == t_src) && (spy->t_dest == t_dest) &&
|
||||||
!Strcasecmp(spy->src,src) && !Strcasecmp(spy->dest,dest))
|
!stringcasecmp(spy->src,src) && !stringcasecmp(spy->dest,dest))
|
||||||
{
|
{
|
||||||
to_user(from,"Requested spy channel is already active");
|
to_user(from,"Requested spy channel is already active");
|
||||||
return;
|
return;
|
||||||
@ -415,7 +415,7 @@ spy_dest_ok:
|
|||||||
if (t_dest != SPY_DCC)
|
if (t_dest != SPY_DCC)
|
||||||
{
|
{
|
||||||
spy->dest = spy->p;
|
spy->dest = spy->p;
|
||||||
spy->src = Strcat(spy->p,dest) + 1;
|
spy->src = stringcat(spy->p,dest) + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -426,7 +426,7 @@ spy_dest_ok:
|
|||||||
|
|
||||||
if (t_src == SPY_CHANNEL)
|
if (t_src == SPY_CHANNEL)
|
||||||
{
|
{
|
||||||
Strcpy((char*)spy->src,src);
|
stringcpy((char*)spy->src,src);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -537,12 +537,12 @@ rspy_dest_ok:
|
|||||||
*/
|
*/
|
||||||
for(spy=current->spylist;spy;spy=spy->next)
|
for(spy=current->spylist;spy;spy=spy->next)
|
||||||
{
|
{
|
||||||
if ((spy->t_src == t_src) && (spy->t_dest == t_dest) && (!Strcasecmp(spy->src,src)))
|
if ((spy->t_src == t_src) && (spy->t_dest == t_dest) && (!stringcasecmp(spy->src,src)))
|
||||||
{
|
{
|
||||||
if ((t_dest == SPY_DCC) && (!nickcmp(spy->dest,dest)))
|
if ((t_dest == SPY_DCC) && (!nickcmp(spy->dest,dest)))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(spy->dest,dest))
|
if (!stringcasecmp(spy->dest,dest))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,13 +111,13 @@ void do_info(COMMAND_ARGS)
|
|||||||
for(chan=current->chanlist;chan;chan=chan->next)
|
for(chan=current->chanlist;chan;chan=chan->next)
|
||||||
{
|
{
|
||||||
*(p = text) = 0;
|
*(p = text) = 0;
|
||||||
p = Strcat(p,chan->name);
|
p = stringcat(p,chan->name);
|
||||||
if (chan == current->activechan)
|
if (chan == current->activechan)
|
||||||
p = Strcat(p," (current)");
|
p = stringcat(p," (current)");
|
||||||
if ((stats = chan->stats))
|
if ((stats = chan->stats))
|
||||||
{
|
{
|
||||||
if (stats && stats->flags == CSTAT_PARTIAL)
|
if (stats && stats->flags == CSTAT_PARTIAL)
|
||||||
p = Strcat(p," (partial)");
|
p = stringcat(p," (partial)");
|
||||||
while(p < text+35)
|
while(p < text+35)
|
||||||
*(p++) = ' ';
|
*(p++) = ' ';
|
||||||
if (stats->LHuserseconds > 0)
|
if (stats->LHuserseconds > 0)
|
||||||
@ -135,7 +135,7 @@ void do_info(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Strcpy(p," (no current data)");
|
stringcpy(p," (no current data)");
|
||||||
}
|
}
|
||||||
to_user(from,FMT_PLAIN,text);
|
to_user(from,FMT_PLAIN,text);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ typedef union usercombo
|
|||||||
typedef struct OnMsg
|
typedef struct OnMsg
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
void (*func)(char *, char *, char *, int);
|
void (*func)(char *, const char *, char *, const int);
|
||||||
ulong defaultaccess:8, /* defaultaccess */
|
ulong defaultaccess:8, /* defaultaccess */
|
||||||
dcc:1,
|
dcc:1,
|
||||||
cc:1,
|
cc:1,
|
||||||
@ -64,7 +64,7 @@ typedef struct OnMsg
|
|||||||
cbang:1,
|
cbang:1,
|
||||||
acchan:1,
|
acchan:1,
|
||||||
supres:1; // -- 21 bits
|
supres:1; // -- 21 bits
|
||||||
char *cmdarg;
|
const char *cmdarg;
|
||||||
|
|
||||||
} OnMsg;
|
} OnMsg;
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ typedef struct ChanStats
|
|||||||
typedef struct ShortChan
|
typedef struct ShortChan
|
||||||
{
|
{
|
||||||
struct ShortChan *next;
|
struct ShortChan *next;
|
||||||
char *name;
|
const char *name;
|
||||||
|
|
||||||
} ShortChan;
|
} ShortChan;
|
||||||
|
|
||||||
|
|||||||
18
src/tcl.c
18
src/tcl.c
@ -233,16 +233,16 @@ int tcl_hook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[])
|
|||||||
if (!mode || !sz1 || !sz2)
|
if (!mode || !sz1 || !sz2)
|
||||||
return(TCL_ERROR);
|
return(TCL_ERROR);
|
||||||
|
|
||||||
if (!Strcasecmp(type,"command"))
|
if (!stringcasecmp(type,"command"))
|
||||||
mode = HOOK_COMMAND;
|
mode = HOOK_COMMAND;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(type,"dcc_complete"))
|
if (!stringcasecmp(type,"dcc_complete"))
|
||||||
mode = HOOK_DCC_COMPLETE;
|
mode = HOOK_DCC_COMPLETE;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(type,"parse"))
|
if (!stringcasecmp(type,"parse"))
|
||||||
mode = HOOK_PARSE;
|
mode = HOOK_PARSE;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(type,"timer"))
|
if (!stringcasecmp(type,"timer"))
|
||||||
{
|
{
|
||||||
if (compile_timer(&hooktimer,command) < 0)
|
if (compile_timer(&hooktimer,command) < 0)
|
||||||
return(TCL_ERROR);
|
return(TCL_ERROR);
|
||||||
@ -261,13 +261,13 @@ int tcl_hook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[])
|
|||||||
hook->next = hooklist;
|
hook->next = hooklist;
|
||||||
hooklist = hook;
|
hooklist = hook;
|
||||||
|
|
||||||
hook->type.any = (void*)(Strcpy(hook->self,self) + 1);
|
hook->type.any = (void*)(stringcpy(hook->self,self) + 1);
|
||||||
|
|
||||||
switch(mode)
|
switch(mode)
|
||||||
{
|
{
|
||||||
case HOOK_COMMAND:
|
case HOOK_COMMAND:
|
||||||
case HOOK_PARSE:
|
case HOOK_PARSE:
|
||||||
Strcpy(hook->type.command,command);
|
stringcpy(hook->type.command,command);
|
||||||
hook->func = tcl_parse_jump;
|
hook->func = tcl_parse_jump;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -384,7 +384,7 @@ int tcl_to_server(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[])
|
|||||||
{
|
{
|
||||||
*pp = sp = (Strp*)Calloc(sizeof(Strp) + sz);
|
*pp = sp = (Strp*)Calloc(sizeof(Strp) + sz);
|
||||||
/* Calloc sets to zero sp->next = NULL; */
|
/* Calloc sets to zero sp->next = NULL; */
|
||||||
Strcpy(sp->p,line);
|
stringcpy(sp->p,line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -502,8 +502,8 @@ int tcl_dns(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[])
|
|||||||
hook->flags = HOOK_DNS;
|
hook->flags = HOOK_DNS;
|
||||||
hook->next = hooklist;
|
hook->next = hooklist;
|
||||||
hooklist = hook;
|
hooklist = hook;
|
||||||
hook->type.host = Strcpy(hook->self,callback) + 1;
|
hook->type.host = stringcpy(hook->self,callback) + 1;
|
||||||
Strcpy(hook->type.host,host);
|
stringcpy(hook->type.host,host);
|
||||||
hook->func = tcl_dns_jump;
|
hook->func = tcl_dns_jump;
|
||||||
|
|
||||||
rawdns(host);
|
rawdns(host);
|
||||||
|
|||||||
30
src/toybox.c
30
src/toybox.c
@ -58,7 +58,7 @@ int read_bigcharset_callback(char *rest)
|
|||||||
opt = chop(&rest);
|
opt = chop(&rest);
|
||||||
n = NULL;
|
n = NULL;
|
||||||
|
|
||||||
if (!Strcasecmp(opt,"chars") && charheight)
|
if (!stringcasecmp(opt,"chars") && charheight)
|
||||||
{
|
{
|
||||||
charlines = charheight;
|
charlines = charheight;
|
||||||
|
|
||||||
@ -71,28 +71,28 @@ int read_bigcharset_callback(char *rest)
|
|||||||
*/
|
*/
|
||||||
newchar->next = fontlist;
|
newchar->next = fontlist;
|
||||||
fontlist = newchar;
|
fontlist = newchar;
|
||||||
Strcpy(newchar->chars,opt);
|
stringcpy(newchar->chars,opt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(opt,"spacewidth"))
|
if (!stringcasecmp(opt,"spacewidth"))
|
||||||
{
|
{
|
||||||
n = &spacewidth;
|
n = &spacewidth;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(opt,"charheight"))
|
if (!stringcasecmp(opt,"charheight"))
|
||||||
{
|
{
|
||||||
n = &charheight;
|
n = &charheight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(opt,"kerning"))
|
if (!stringcasecmp(opt,"kerning"))
|
||||||
{
|
{
|
||||||
n = &kerning;
|
n = &kerning;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(opt,"fontname"))
|
if (!stringcasecmp(opt,"fontname"))
|
||||||
{
|
{
|
||||||
opt = chop(&rest);
|
opt = chop(&rest);
|
||||||
if (fontname && !Strcasecmp(fontname,opt))
|
if (fontname && !stringcasecmp(fontname,opt))
|
||||||
{
|
{
|
||||||
fontlist = orig_fontlist;
|
fontlist = orig_fontlist;
|
||||||
charlines = orig_charlines;
|
charlines = orig_charlines;
|
||||||
@ -104,12 +104,12 @@ int read_bigcharset_callback(char *rest)
|
|||||||
}
|
}
|
||||||
Free((char**)&fontname);
|
Free((char**)&fontname);
|
||||||
set_mallocdoer(read_bigcharset_callback);
|
set_mallocdoer(read_bigcharset_callback);
|
||||||
fontname = Strdup(opt);
|
fontname = stringdup(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
*n = a2i(rest);
|
*n = asc2int(rest);
|
||||||
if (errno) *n = 0;
|
if (errno) *n = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ int read_bigcharset(char *fname)
|
|||||||
|
|
||||||
if ((fd = open(fname,O_RDONLY)) < 0)
|
if ((fd = open(fname,O_RDONLY)) < 0)
|
||||||
{
|
{
|
||||||
Strcat(fname,FONT_EXTENSION);
|
stringcat(fname,FONT_EXTENSION);
|
||||||
if ((fd = open(fname,O_RDONLY)) < 0)
|
if ((fd = open(fname,O_RDONLY)) < 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ void do_bigsay(COMMAND_ARGS)
|
|||||||
debug("(do_bigsay) rest = \"%s\"\n",rest);
|
debug("(do_bigsay) rest = \"%s\"\n",rest);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
Strcpy(output,BIGSAY_DEFAULTFONT);
|
stringcpy(output,BIGSAY_DEFAULTFONT);
|
||||||
|
|
||||||
if (read_bigcharset(output) < 0)
|
if (read_bigcharset(output) < 0)
|
||||||
{
|
{
|
||||||
@ -214,7 +214,6 @@ void do_bigsay(COMMAND_ARGS)
|
|||||||
temp2 = tail;
|
temp2 = tail;
|
||||||
while(*temp && tail < OEND)
|
while(*temp && tail < OEND)
|
||||||
*(tail++) = *(temp++);
|
*(tail++) = *(temp++);
|
||||||
//temp = Strcat(tail,sp->p);
|
|
||||||
while(tail < (temp2 + bigc->width) && tail < OEND)
|
while(tail < (temp2 + bigc->width) && tail < OEND)
|
||||||
*(tail++) = ' ';
|
*(tail++) = ' ';
|
||||||
if (pt[1])
|
if (pt[1])
|
||||||
@ -248,7 +247,8 @@ void do_bigsay(COMMAND_ARGS)
|
|||||||
|
|
||||||
void do_random_msg(COMMAND_ARGS)
|
void do_random_msg(COMMAND_ARGS)
|
||||||
{
|
{
|
||||||
char *filename,*message;
|
const char *filename;
|
||||||
|
const char *message;
|
||||||
|
|
||||||
filename = CurrentCmd->cmdarg;
|
filename = CurrentCmd->cmdarg;
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ ascii_badfile:
|
|||||||
to_user_q(from,"%s","Bad filename or file does not exist");
|
to_user_q(from,"%s","Bad filename or file does not exist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Strcat(Strcpy(fname,"ascii/"),rest);
|
stringcat(stringcpy(fname,"ascii/"),rest);
|
||||||
debug("(do_ascii) file = \"%s\"\n",fname);
|
debug("(do_ascii) file = \"%s\"\n",fname);
|
||||||
if (is_safepath(fname,FILE_MUST_EXIST) != FILE_IS_SAFE)
|
if (is_safepath(fname,FILE_MUST_EXIST) != FILE_IS_SAFE)
|
||||||
{
|
{
|
||||||
@ -361,7 +361,7 @@ ascii_badfile:
|
|||||||
to_user_q(from,"%s","Bad filename or file does not exist");
|
to_user_q(from,"%s","Bad filename or file does not exist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Strcat(Strcpy(fname,"ascii/"),rest);
|
stringcat(stringcpy2(fname,"ascii/"),rest);
|
||||||
if (is_safepath(fname,FILE_MUST_EXIST) != FILE_IS_SAFE)
|
if (is_safepath(fname,FILE_MUST_EXIST) != FILE_IS_SAFE)
|
||||||
goto ascii_badfile;
|
goto ascii_badfile;
|
||||||
if ((fd = open(fname,O_RDONLY)) < 0)
|
if ((fd = open(fname,O_RDONLY)) < 0)
|
||||||
|
|||||||
34
src/trivia.c
34
src/trivia.c
@ -144,7 +144,7 @@ void hint_two(void)
|
|||||||
dst = STREND(triv_str);
|
dst = STREND(triv_str);
|
||||||
src = triv_answers->p;
|
src = triv_answers->p;
|
||||||
|
|
||||||
n = a2i(src);
|
n = asc2int(src);
|
||||||
if (!errno)
|
if (!errno)
|
||||||
{
|
{
|
||||||
if (n > 99 && *src) *(dst++) = *(src++);
|
if (n > 99 && *src) *(dst++) = *(src++);
|
||||||
@ -181,7 +181,7 @@ void hint_three(void)
|
|||||||
dst = STREND(triv_str);
|
dst = STREND(triv_str);
|
||||||
src = triv_answers->p;
|
src = triv_answers->p;
|
||||||
|
|
||||||
n = a2i(src);
|
n = asc2int(src);
|
||||||
if (!errno)
|
if (!errno)
|
||||||
{
|
{
|
||||||
if (n > 9 && *src) *(dst++) = *(src++);
|
if (n > 9 && *src) *(dst++) = *(src++);
|
||||||
@ -238,7 +238,7 @@ void trivia_check(Chan *chan, char *rest)
|
|||||||
|
|
||||||
for(ans=triv_answers;ans;ans=ans->next)
|
for(ans=triv_answers;ans;ans=ans->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(ans->p,rest))
|
if (!stringcasecmp(ans->p,rest))
|
||||||
goto have_answer;
|
goto have_answer;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -275,7 +275,7 @@ have_answer:
|
|||||||
su->score_wk = su->score_mo = triv_score;
|
su->score_wk = su->score_mo = triv_score;
|
||||||
su->week_nr = week;
|
su->week_nr = week;
|
||||||
/* su->month_nr = 0; * fix this */
|
/* su->month_nr = 0; * fix this */
|
||||||
Strcpy(su->nick,CurrentNick);
|
stringcpy(su->nick,CurrentNick);
|
||||||
}
|
}
|
||||||
|
|
||||||
to_server("PRIVMSG %s :Yes, %s! got the answer -> %s <- in %i seconds, and gets %i points!\n",
|
to_server("PRIVMSG %s :Yes, %s! got the answer -> %s <- in %i seconds, and gets %i points!\n",
|
||||||
@ -339,7 +339,7 @@ char *random_question(char *triv_rand)
|
|||||||
if (STRCHR(triv_qfile,'/') || strlen(triv_qfile) > 100) // really bad filenames...
|
if (STRCHR(triv_qfile,'/') || strlen(triv_qfile) > 100) // really bad filenames...
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
Strcat(Strcpy(tmpname,"trivia/"),triv_qfile);
|
stringcat(stringcpy(tmpname,"trivia/"),triv_qfile);
|
||||||
|
|
||||||
if ((fd = open(tmpname,O_RDONLY)) < 0)
|
if ((fd = open(tmpname,O_RDONLY)) < 0)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -351,10 +351,10 @@ char *random_question(char *triv_rand)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
Strcpy(triv_rand,tmpname);
|
stringcpy(triv_rand,tmpname);
|
||||||
if ((p = STRCHR(triv_rand,'.')) == NULL)
|
if ((p = STRCHR(triv_rand,'.')) == NULL)
|
||||||
p = STREND(triv_rand);
|
p = STREND(triv_rand);
|
||||||
Strcpy(p,".index");
|
stringcpy(p,".index");
|
||||||
|
|
||||||
if ((ifd = open(triv_rand,O_RDONLY)) < 0)
|
if ((ifd = open(triv_rand,O_RDONLY)) < 0)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -508,17 +508,17 @@ int trivia_score_callback(char *rest)
|
|||||||
|
|
||||||
if (mnr)
|
if (mnr)
|
||||||
{
|
{
|
||||||
score_wk = a2i(wk);
|
score_wk = asc2int(wk);
|
||||||
err = errno;
|
err = errno;
|
||||||
score_mo = a2i(mo);
|
score_mo = asc2int(mo);
|
||||||
err += errno;
|
err += errno;
|
||||||
score_last_wk = a2i(lwk);
|
score_last_wk = asc2int(lwk);
|
||||||
err += errno;
|
err += errno;
|
||||||
score_last_mo = a2i(lmo);
|
score_last_mo = asc2int(lmo);
|
||||||
err += errno;
|
err += errno;
|
||||||
week_nr = a2i(wnr);
|
week_nr = asc2int(wnr);
|
||||||
err += errno;
|
err += errno;
|
||||||
month_nr = a2i(mnr);
|
month_nr = asc2int(mnr);
|
||||||
err += errno;
|
err += errno;
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
@ -533,7 +533,7 @@ int trivia_score_callback(char *rest)
|
|||||||
su->score_last_mo = score_last_mo;
|
su->score_last_mo = score_last_mo;
|
||||||
su->week_nr = week_nr;
|
su->week_nr = week_nr;
|
||||||
su->month_nr = month_nr;
|
su->month_nr = month_nr;
|
||||||
Strcpy(su->nick,nick);
|
stringcpy(su->nick,nick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,7 +580,7 @@ void do_trivia(COMMAND_ARGS)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Strcasecmp(rest,"start"))
|
if (!stringcasecmp(rest,"start"))
|
||||||
{
|
{
|
||||||
if (triv_chan)
|
if (triv_chan)
|
||||||
{
|
{
|
||||||
@ -606,7 +606,7 @@ void do_trivia(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(rest,"stop"))
|
if (!stringcasecmp(rest,"stop"))
|
||||||
{
|
{
|
||||||
if (chan == triv_chan)
|
if (chan == triv_chan)
|
||||||
{
|
{
|
||||||
@ -616,7 +616,7 @@ void do_trivia(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(rest,"top10"))
|
if (!stringcasecmp(rest,"top10"))
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ void init_uptime(void)
|
|||||||
if (!uptimehost)
|
if (!uptimehost)
|
||||||
{
|
{
|
||||||
set_mallocdoer(init_uptime);
|
set_mallocdoer(init_uptime);
|
||||||
uptimehost = Strdup(defaultuptimehost);
|
uptimehost = stringdup(defaultuptimehost);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((uptimesock = socket(AF_INET,SOCK_DGRAM,0)) < 0)
|
if ((uptimesock = socket(AF_INET,SOCK_DGRAM,0)) < 0)
|
||||||
@ -116,7 +116,7 @@ void send_uptime(int type)
|
|||||||
{
|
{
|
||||||
Free((char**)&uptimehost);
|
Free((char**)&uptimehost);
|
||||||
set_mallocdoer(send_uptime);
|
set_mallocdoer(send_uptime);
|
||||||
uptimehost = Strdup(host);
|
uptimehost = stringdup(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -160,7 +160,7 @@ void send_uptime(int type)
|
|||||||
upPack.sysup = htonl(st.st_ctime);
|
upPack.sysup = htonl(st.st_ctime);
|
||||||
}
|
}
|
||||||
|
|
||||||
server = "unknown";
|
server = UNKNOWN;
|
||||||
nick = BOTLOGIN;
|
nick = BOTLOGIN;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
32
src/urlcap.c
32
src/urlcap.c
@ -29,6 +29,35 @@
|
|||||||
#include "h.h"
|
#include "h.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
|
char *urlhost(const char *url)
|
||||||
|
{
|
||||||
|
char copy[strlen(url)];
|
||||||
|
const char *end,*beg,*dst;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
beg = end = url;
|
||||||
|
while(*end)
|
||||||
|
{
|
||||||
|
if (*end == '@')
|
||||||
|
beg = end+1;
|
||||||
|
else
|
||||||
|
if (*end == '/')
|
||||||
|
{
|
||||||
|
if (n == 1)
|
||||||
|
beg = end+1;
|
||||||
|
else
|
||||||
|
if (n == 2)
|
||||||
|
break;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
end++;
|
||||||
|
}
|
||||||
|
stringcpy_n(copy,beg,(end-beg));
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug("(urlhost) host = %s\n",copy);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void urlcapture(const char *rest)
|
void urlcapture(const char *rest)
|
||||||
{
|
{
|
||||||
Strp *sp,*nx;
|
Strp *sp,*nx;
|
||||||
@ -43,6 +72,7 @@ void urlcapture(const char *rest)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(urlcapture) URL = \"%s\"\n",url);
|
debug("(urlcapture) URL = \"%s\"\n",url);
|
||||||
#endif /* ifdef DEBUG */
|
#endif /* ifdef DEBUG */
|
||||||
|
urlhost(url);
|
||||||
|
|
||||||
send_spy(SPYSTR_URL,"%s",url);
|
send_spy(SPYSTR_URL,"%s",url);
|
||||||
|
|
||||||
@ -92,7 +122,7 @@ void do_urlhist(COMMAND_ARGS)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
thenum = chop(&rest);
|
thenum = chop(&rest);
|
||||||
maxnum = a2i(thenum);
|
maxnum = asc2int(thenum);
|
||||||
}
|
}
|
||||||
if ((maxnum < 1) || (maxnum > urlhistmax))
|
if ((maxnum < 1) || (maxnum > urlhistmax))
|
||||||
usage(from); /* usage for CurrentCmd->name */
|
usage(from); /* usage for CurrentCmd->name */
|
||||||
|
|||||||
79
src/user.c
79
src/user.c
@ -43,7 +43,7 @@ void cfg_user(char *rest)
|
|||||||
{
|
{
|
||||||
set_mallocdoer(cfg_user);
|
set_mallocdoer(cfg_user);
|
||||||
cfgUser = Calloc(sizeof(User) + strlen(rest));
|
cfgUser = Calloc(sizeof(User) + strlen(rest));
|
||||||
Strcpy(cfgUser->name,rest);
|
stringcpy(cfgUser->name,rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
@ -52,7 +52,7 @@ void cfg_modcount(char *rest)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = a2i(rest);
|
i = asc2int(rest);
|
||||||
if (errno || i < 1)
|
if (errno || i < 1)
|
||||||
return;
|
return;
|
||||||
cfgUser->modcount = i;
|
cfgUser->modcount = i;
|
||||||
@ -64,7 +64,7 @@ void cfg_pass(char *rest)
|
|||||||
{
|
{
|
||||||
Free((char**)&cfgUser->pass);
|
Free((char**)&cfgUser->pass);
|
||||||
set_mallocdoer(cfg_pass);
|
set_mallocdoer(cfg_pass);
|
||||||
cfgUser->pass = Strdup(rest);
|
cfgUser->pass = stringdup(rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cfg_mask(char *rest)
|
void cfg_mask(char *rest)
|
||||||
@ -118,7 +118,7 @@ void cfg_opt(char *rest)
|
|||||||
cfgUser->x.x.prot = rest[1] - '0';
|
cfgUser->x.x.prot = rest[1] - '0';
|
||||||
if (*rest == 'u')
|
if (*rest == 'u')
|
||||||
{
|
{
|
||||||
cfgUser->x.x.access = a2i(rest+1);
|
cfgUser->x.x.access = asc2int(rest+1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rest++;
|
rest++;
|
||||||
@ -147,14 +147,14 @@ void cfg_shit(char *rest)
|
|||||||
/*
|
/*
|
||||||
* convert the expiry time
|
* convert the expiry time
|
||||||
*/
|
*/
|
||||||
expire = a2i(chop(&rest)); /* a2i() can handle NULLs */
|
expire = asc2int(chop(&rest)); /* asc2int() can handle NULLs */
|
||||||
if (errno || expire < now)
|
if (errno || expire < now)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* convert time when the shit was added
|
* convert time when the shit was added
|
||||||
*/
|
*/
|
||||||
when = a2i(chop(&rest));
|
when = asc2int(chop(&rest));
|
||||||
if (errno || *rest == 0) /* if *rest == 0, the reason is missing */
|
if (errno || *rest == 0) /* if *rest == 0, the reason is missing */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ void cfg_greet(char *rest)
|
|||||||
{
|
{
|
||||||
Free((char**)&cfgUser->greet);
|
Free((char**)&cfgUser->greet);
|
||||||
set_mallocdoer(cfg_greet);
|
set_mallocdoer(cfg_greet);
|
||||||
cfgUser->greet = Strdup(rest);
|
cfgUser->greet = stringdup(rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* GREET */
|
#endif /* GREET */
|
||||||
@ -199,7 +199,7 @@ void cfg_note(char *rest)
|
|||||||
np = &(*np)->next;
|
np = &(*np)->next;
|
||||||
*np = sp = Calloc(sizeof(Strp) + strlen(rest));
|
*np = sp = Calloc(sizeof(Strp) + strlen(rest));
|
||||||
/* Calloc sets to zero sp->next = NULL; */
|
/* Calloc sets to zero sp->next = NULL; */
|
||||||
Strcpy(sp->p,rest);
|
stringcpy(sp->p,rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NOTE */
|
#endif /* NOTE */
|
||||||
@ -264,7 +264,7 @@ int read_userlist_callback(char *line)
|
|||||||
command = chop(&line);
|
command = chop(&line);
|
||||||
for(i=0;userlist_cmds[i].name;i++)
|
for(i=0;userlist_cmds[i].name;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(command,userlist_cmds[i].name))
|
if (!stringcasecmp(command,userlist_cmds[i].name))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (userlist_cmds[i].name)
|
if (userlist_cmds[i].name)
|
||||||
@ -526,14 +526,14 @@ void addtouser(Strp **pp, const char *string, int rehash)
|
|||||||
while(*pp)
|
while(*pp)
|
||||||
{
|
{
|
||||||
um = *pp;
|
um = *pp;
|
||||||
if (!Strcasecmp(um->p,string))
|
if (!stringcasecmp(um->p,string))
|
||||||
return;
|
return;
|
||||||
pp = &um->next;
|
pp = &um->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mallocdoer(addtouser);
|
set_mallocdoer(addtouser);
|
||||||
*pp = um = (Strp*)Calloc(sizeof(Strp) + strlen(string));
|
*pp = um = (Strp*)Calloc(sizeof(Strp) + strlen(string));
|
||||||
Strcpy(um->p,string);
|
stringcpy(um->p,string);
|
||||||
if (rehash)
|
if (rehash)
|
||||||
rehash_chanusers();
|
rehash_chanusers();
|
||||||
}
|
}
|
||||||
@ -545,7 +545,7 @@ int remfromuser(Strp **pp, const char *string)
|
|||||||
while(*pp)
|
while(*pp)
|
||||||
{
|
{
|
||||||
um = *pp;
|
um = *pp;
|
||||||
if (!Strcasecmp(um->p,string))
|
if (!stringcasecmp(um->p,string))
|
||||||
{
|
{
|
||||||
*pp = um->next;
|
*pp = um->next;
|
||||||
Free((char**)&um);
|
Free((char**)&um);
|
||||||
@ -578,7 +578,7 @@ void mirror_user(User *user)
|
|||||||
continue;
|
continue;
|
||||||
for(olduser=anybot->userlist;olduser;olduser=olduser->next)
|
for(olduser=anybot->userlist;olduser;olduser=olduser->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(user->name,olduser->name))
|
if (!stringcasecmp(user->name,olduser->name))
|
||||||
{
|
{
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
/* dont overwrite "better" users */
|
/* dont overwrite "better" users */
|
||||||
@ -780,11 +780,11 @@ User *add_user(char *handle, char *pass, int axs)
|
|||||||
/*
|
/*
|
||||||
* "name\0pass\0"
|
* "name\0pass\0"
|
||||||
*/
|
*/
|
||||||
p = Strcpy(user->name,handle) + 1;
|
p = stringcpy(user->name,handle) + 1;
|
||||||
if (pass)
|
if (pass)
|
||||||
{
|
{
|
||||||
user->pass = p;
|
user->pass = p;
|
||||||
Strcpy(user->pass,pass);
|
stringcpy(user->pass,pass);
|
||||||
}
|
}
|
||||||
current->ul_save++;
|
current->ul_save++;
|
||||||
return(user);
|
return(user);
|
||||||
@ -799,7 +799,7 @@ User *find_handle(const char *handle)
|
|||||||
|
|
||||||
for(user=current->userlist;user;user=user->next)
|
for(user=current->userlist;user;user=user->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(handle,user->name))
|
if (!stringcasecmp(handle,user->name))
|
||||||
return(user);
|
return(user);
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@ -813,7 +813,7 @@ int userhaschannel(const User *user, const char *channel)
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
for(ump=user->chan;ump;ump=ump->next)
|
for(ump=user->chan;ump;ump=ump->next)
|
||||||
{
|
{
|
||||||
if (*ump->p == '*' || !Strcasecmp(ump->p,channel))
|
if (*ump->p == '*' || !stringcasecmp(ump->p,channel))
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -963,7 +963,7 @@ int usercanmodify(const char *from, const User *user)
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
for(ump=user->chan;ump;ump=ump->next)
|
for(ump=user->chan;ump;ump=ump->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(ump->p,fmp->p))
|
if (!stringcasecmp(ump->p,fmp->p))
|
||||||
{
|
{
|
||||||
if (u->x.x.access >= ua)
|
if (u->x.x.access >= ua)
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@ -982,7 +982,8 @@ int usercanmodify(const char *from, const User *user)
|
|||||||
|
|
||||||
void do_access(COMMAND_ARGS)
|
void do_access(COMMAND_ARGS)
|
||||||
{
|
{
|
||||||
char *chan,*nuh;
|
const char *chan;
|
||||||
|
char *nuh;
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
chan = get_channel(to,&rest);
|
chan = get_channel(to,&rest);
|
||||||
@ -1053,12 +1054,12 @@ void do_userlist(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
if (*rest == '+' && rest[1] >= '0' && rest[1] <= '9')
|
if (*rest == '+' && rest[1] >= '0' && rest[1] <= '9')
|
||||||
{
|
{
|
||||||
minlevel = a2i(rest+1);
|
minlevel = asc2int(rest+1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (*rest == '-' && rest[1] >= '0' && rest[1] <= '9')
|
if (*rest == '-' && rest[1] >= '0' && rest[1] <= '9')
|
||||||
{
|
{
|
||||||
maxlevel = a2i(rest+1);
|
maxlevel = asc2int(rest+1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (*rest == '-' && (*rest|32) == 'b')
|
if (*rest == '-' && (*rest|32) == 'b')
|
||||||
@ -1165,7 +1166,7 @@ void do_userlist(COMMAND_ARGS)
|
|||||||
else
|
else
|
||||||
sz += strlen(ump->p);
|
sz += strlen(ump->p);
|
||||||
}
|
}
|
||||||
table_buffer(from,"Message\t: %i message%s (%i bytes)",n,(n == 1) ? "" : "s",sz);
|
table_buffer("Message\t: %i message%s (%i bytes)",n,(n == 1) ? "" : "s",sz);
|
||||||
}
|
}
|
||||||
#endif /* NOTE */
|
#endif /* NOTE */
|
||||||
table_buffer(" ");
|
table_buffer(" ");
|
||||||
@ -1237,7 +1238,7 @@ void do_user(COMMAND_ARGS)
|
|||||||
anum = chop(&rest);
|
anum = chop(&rest);
|
||||||
pass = chop(&rest);
|
pass = chop(&rest);
|
||||||
|
|
||||||
newaccess = a2i(anum);
|
newaccess = asc2int(anum);
|
||||||
if (errno)
|
if (errno)
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
@ -1267,7 +1268,7 @@ void do_user(COMMAND_ARGS)
|
|||||||
*/
|
*/
|
||||||
if ((mask = nick2uh(from,nick)) == NULL) // nick2uh uses nuh_buf
|
if ((mask = nick2uh(from,nick)) == NULL) // nick2uh uses nuh_buf
|
||||||
return;
|
return;
|
||||||
Strcpy(tmpmask,mask);
|
stringcpy(tmpmask,mask);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(do_user) nick2uh(from \"%s\", nick \"%s\") = mask \"%s\"\n",from,nick,tmpmask);
|
debug("(do_user) nick2uh(from \"%s\", nick \"%s\") = mask \"%s\"\n",from,nick,tmpmask);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -1381,28 +1382,28 @@ void do_user(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
if (!Strcasecmp(pt,"NS"))
|
if (!stringcasecmp(pt,"NS"))
|
||||||
combo.x.noshare = mode;
|
combo.x.noshare = mode;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(pt,"RO"))
|
if (!stringcasecmp(pt,"RO"))
|
||||||
combo.x.readonly = mode;
|
combo.x.readonly = mode;
|
||||||
else
|
else
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
#ifdef BOUNCE
|
#ifdef BOUNCE
|
||||||
if (!Strcasecmp(pt,"BNC"))
|
if (!stringcasecmp(pt,"BNC"))
|
||||||
combo.x.bounce = mode;
|
combo.x.bounce = mode;
|
||||||
else
|
else
|
||||||
#endif /* BOUNCE */
|
#endif /* BOUNCE */
|
||||||
if (!Strcasecmp(pt,"AV"))
|
if (!stringcasecmp(pt,"AV"))
|
||||||
combo.x.avoice = mode;
|
combo.x.avoice = mode;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(pt,"AO"))
|
if (!stringcasecmp(pt,"AO"))
|
||||||
combo.x.aop = mode;
|
combo.x.aop = mode;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(pt,"ECHO"))
|
if (!stringcasecmp(pt,"ECHO"))
|
||||||
combo.x.echo = mode;
|
combo.x.echo = mode;
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(pt,"CHAN"))
|
if (!stringcasecmp(pt,"CHAN"))
|
||||||
{
|
{
|
||||||
ch = (mode) ? _ADD : _SUB;
|
ch = (mode) ? _ADD : _SUB;
|
||||||
mask = chop(&rest);
|
mask = chop(&rest);
|
||||||
@ -1410,7 +1411,7 @@ void do_user(COMMAND_ARGS)
|
|||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(pt,"HOST"))
|
if (!stringcasecmp(pt,"HOST"))
|
||||||
{
|
{
|
||||||
ho = (mode) ? _ADD : _SUB;
|
ho = (mode) ? _ADD : _SUB;
|
||||||
mask = chop(&rest);
|
mask = chop(&rest);
|
||||||
@ -1434,7 +1435,7 @@ void do_user(COMMAND_ARGS)
|
|||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ((uaccess = a2i(pt)) >= 0 && uaccess <= BOTLEVEL && errno == 0)
|
if ((uaccess = asc2int(pt)) >= 0 && uaccess <= BOTLEVEL && errno == 0)
|
||||||
{
|
{
|
||||||
combo.x.access = uaccess;
|
combo.x.access = uaccess;
|
||||||
}
|
}
|
||||||
@ -1463,7 +1464,7 @@ usage:
|
|||||||
{
|
{
|
||||||
for(ump=user->chan;ump;ump=ump->next)
|
for(ump=user->chan;ump;ump=ump->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(ump->p,mask))
|
if (!stringcasecmp(ump->p,mask))
|
||||||
{
|
{
|
||||||
to_user(from,"Channel %s already exists for %s",mask,user->name);
|
to_user(from,"Channel %s already exists for %s",mask,user->name);
|
||||||
return;
|
return;
|
||||||
@ -1489,7 +1490,7 @@ usage:
|
|||||||
{
|
{
|
||||||
for(ump=user->mask;ump;ump=ump->next)
|
for(ump=user->mask;ump;ump=ump->next)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(ump->p,mask))
|
if (!stringcasecmp(ump->p,mask))
|
||||||
{
|
{
|
||||||
to_user(from,"Mask %s already exists for %s",mask,user->name);
|
to_user(from,"Mask %s already exists for %s",mask,user->name);
|
||||||
return;
|
return;
|
||||||
@ -1544,7 +1545,7 @@ void do_echo(COMMAND_ARGS)
|
|||||||
|
|
||||||
if ((tmp = chop(&rest)))
|
if ((tmp = chop(&rest)))
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(tmp,"on"))
|
if (!stringcasecmp(tmp,__STR_ON))
|
||||||
{
|
{
|
||||||
if (CurrentUser->x.x.echo == FALSE)
|
if (CurrentUser->x.x.echo == FALSE)
|
||||||
{
|
{
|
||||||
@ -1555,7 +1556,7 @@ void do_echo(COMMAND_ARGS)
|
|||||||
to_user(from,TEXT_PARTYECHOON);
|
to_user(from,TEXT_PARTYECHOON);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Strcasecmp(tmp,"off"))
|
if (!stringcasecmp(tmp,__STR_OFF))
|
||||||
{
|
{
|
||||||
if (CurrentUser->x.x.echo == TRUE)
|
if (CurrentUser->x.x.echo == TRUE)
|
||||||
{
|
{
|
||||||
@ -1579,7 +1580,7 @@ void change_pass(User *user, char *pass)
|
|||||||
enc = makepass(pass);
|
enc = makepass(pass);
|
||||||
if (strlen(user->pass) <= strlen(enc))
|
if (strlen(user->pass) <= strlen(enc))
|
||||||
{
|
{
|
||||||
Strcpy(user->pass,enc);
|
stringcpy(user->pass,enc);
|
||||||
user->modcount++;
|
user->modcount++;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -1688,7 +1689,7 @@ void do_setpass(COMMAND_ARGS)
|
|||||||
to_user(from,TEXT_USEROWNSYOU,user->name);
|
to_user(from,TEXT_USEROWNSYOU,user->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Strcasecmp(pass,"none"))
|
if (!stringcasecmp(pass,"none"))
|
||||||
{
|
{
|
||||||
user->pass = NULL;
|
user->pass = NULL;
|
||||||
to_user(from,"password for %s has been removed",user->name);
|
to_user(from,"password for %s has been removed",user->name);
|
||||||
|
|||||||
49
src/vars.c
49
src/vars.c
@ -36,7 +36,7 @@ void set_str_varc(Chan *channel, int which, char *value)
|
|||||||
if (value && *value)
|
if (value && *value)
|
||||||
{
|
{
|
||||||
set_mallocdoer(set_str_varc);
|
set_mallocdoer(set_str_varc);
|
||||||
temp = Strdup(value);
|
temp = stringdup(value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
temp = NULL;
|
temp = NULL;
|
||||||
@ -49,13 +49,13 @@ void set_str_varc(Chan *channel, int which, char *value)
|
|||||||
/*
|
/*
|
||||||
* The rest
|
* The rest
|
||||||
*/
|
*/
|
||||||
int find_setting(char *name)
|
int find_setting(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;VarName[i].name;i++)
|
for(i=0;VarName[i].name;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(name,VarName[i].name))
|
if (!stringcasecmp(name,VarName[i].name))
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -72,7 +72,7 @@ void copy_vars(UniVar *dst, UniVar *src)
|
|||||||
if (src[i].str_var)
|
if (src[i].str_var)
|
||||||
{
|
{
|
||||||
set_mallocdoer(copy_vars);
|
set_mallocdoer(copy_vars);
|
||||||
dst[i].str_var = Strdup(src[i].str_var);
|
dst[i].str_var = stringdup(src[i].str_var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -125,7 +125,7 @@ void nobo_strcpy(const char *src)
|
|||||||
*ec_dest = 0;
|
*ec_dest = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_access(char *from, char *to)
|
void ec_access(char *from, const char *to)
|
||||||
{
|
{
|
||||||
char num[20];
|
char num[20];
|
||||||
|
|
||||||
@ -133,17 +133,17 @@ void ec_access(char *from, char *to)
|
|||||||
nobo_strcpy(num);
|
nobo_strcpy(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_capabilities(char *from, char *to)
|
void ec_capabilities(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy(__mx_opts);
|
nobo_strcpy(__mx_opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_cc(char *from, char *to)
|
void ec_cc(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy((current->activechan) ? current->activechan->name : TEXT_NONE);
|
nobo_strcpy((current->activechan) ? current->activechan->name : TEXT_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_channels(char *from, char *to)
|
void ec_channels(char *from, const char *to)
|
||||||
{
|
{
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
int n;
|
int n;
|
||||||
@ -166,12 +166,12 @@ void ec_channels(char *from, char *to)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_time(char *from, char *to)
|
void ec_time(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy(time2away(now));
|
nobo_strcpy(time2away(now));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_set(char *from, char *to)
|
void ec_set(char *from, const char *to)
|
||||||
{
|
{
|
||||||
Chan *chan;
|
Chan *chan;
|
||||||
UniVar *varval;
|
UniVar *varval;
|
||||||
@ -225,7 +225,7 @@ void ec_set(char *from, char *to)
|
|||||||
else
|
else
|
||||||
if (IsTog(which))
|
if (IsTog(which))
|
||||||
{
|
{
|
||||||
nobo_strcpy((varval->int_var) ? "on" : "off");
|
nobo_strcpy((varval->int_var) ? __STR_ON : __STR_OFF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (IsStr(which))
|
if (IsStr(which))
|
||||||
@ -240,12 +240,12 @@ void ec_set(char *from, char *to)
|
|||||||
ec_src = src;
|
ec_src = src;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_on(char *from, char *to)
|
void ec_on(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy(idle2str(now - current->ontime,FALSE));
|
nobo_strcpy(idle2str(now - current->ontime,FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_server(char *from, char *to)
|
void ec_server(char *from, const char *to)
|
||||||
{
|
{
|
||||||
Server *sv;
|
Server *sv;
|
||||||
char *s;
|
char *s;
|
||||||
@ -257,12 +257,12 @@ void ec_server(char *from, char *to)
|
|||||||
nobo_strcpy(s);
|
nobo_strcpy(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_up(char *from, char *to)
|
void ec_up(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy(idle2str(now - uptime,FALSE));
|
nobo_strcpy(idle2str(now - uptime,FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ec_ver(char *from, char *to)
|
void ec_ver(char *from, const char *to)
|
||||||
{
|
{
|
||||||
nobo_strcpy(BOTCLASS);
|
nobo_strcpy(BOTCLASS);
|
||||||
nobo_strcpy(" ");
|
nobo_strcpy(" ");
|
||||||
@ -271,7 +271,7 @@ void ec_ver(char *from, char *to)
|
|||||||
|
|
||||||
LS const struct
|
LS const struct
|
||||||
{
|
{
|
||||||
void (*func)(char *, char *);
|
void (*func)(char *, const char *);
|
||||||
char name[12];
|
char name[12];
|
||||||
char len;
|
char len;
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ void do_esay(COMMAND_ARGS)
|
|||||||
c = *chp;
|
c = *chp;
|
||||||
*chp = 0;
|
*chp = 0;
|
||||||
}
|
}
|
||||||
n = Strcasecmp(ecmd[i].name,ec_src);
|
n = stringcasecmp(ecmd[i].name,ec_src);
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
*chp = c;
|
*chp = c;
|
||||||
@ -356,7 +356,8 @@ void do_set(COMMAND_ARGS)
|
|||||||
Chan *chan;
|
Chan *chan;
|
||||||
UniVar *univar,*varval;
|
UniVar *univar,*varval;
|
||||||
char tmp[MSGLEN];
|
char tmp[MSGLEN];
|
||||||
char *pp,*channel,*name;
|
char *pp,*name;
|
||||||
|
const char *channel;
|
||||||
int n,which,i,sz,limit,uaccess;
|
int n,which,i,sz,limit,uaccess;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -421,7 +422,7 @@ second_pass:
|
|||||||
else
|
else
|
||||||
if (IsTog(i))
|
if (IsTog(i))
|
||||||
{
|
{
|
||||||
pp = Strcat(tmp,(varval->int_var) ? "+" : "-");
|
pp = stringcat(tmp,(varval->int_var) ? "+" : "-");
|
||||||
pp = tolowercat(pp,VarName[i].name);
|
pp = tolowercat(pp,VarName[i].name);
|
||||||
pp[0] = ' ';
|
pp[0] = ' ';
|
||||||
pp[1] = 0;
|
pp[1] = 0;
|
||||||
@ -492,19 +493,19 @@ set_usage:
|
|||||||
{
|
{
|
||||||
if (IsTog(which))
|
if (IsTog(which))
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(rest,"ON"))
|
if (!stringcasecmp(rest,__STR_ON))
|
||||||
{
|
{
|
||||||
n = 1;
|
n = 1;
|
||||||
goto num_data_ok;
|
goto num_data_ok;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!Strcasecmp(rest,"OFF"))
|
if (!stringcasecmp(rest,__STR_OFF))
|
||||||
{
|
{
|
||||||
/* n is 0 by default */
|
/* n is 0 by default */
|
||||||
goto num_data_ok;
|
goto num_data_ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
n = a2i((rest = chop(&rest)));
|
n = asc2int((rest = chop(&rest)));
|
||||||
if (errno || n < VarName[which].min || n > VarName[which].max)
|
if (errno || n < VarName[which].min || n > VarName[which].max)
|
||||||
{
|
{
|
||||||
to_user(from,"Possible values are %i through %i",VarName[which].min,VarName[which].max);
|
to_user(from,"Possible values are %i through %i",VarName[which].min,VarName[which].max);
|
||||||
@ -530,7 +531,7 @@ num_data_ok:
|
|||||||
if (*rest)
|
if (*rest)
|
||||||
{
|
{
|
||||||
set_mallocdoer(do_set);
|
set_mallocdoer(do_set);
|
||||||
chan->setting[which].str_var = Strdup(rest);
|
chan->setting[which].str_var = stringdup(rest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -553,7 +554,7 @@ num_data_ok:
|
|||||||
if (*rest)
|
if (*rest)
|
||||||
{
|
{
|
||||||
set_mallocdoer(do_set);
|
set_mallocdoer(do_set);
|
||||||
varval->str_var = Strdup(rest);
|
varval->str_var = stringdup(rest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/web.c
16
src/web.c
@ -72,9 +72,9 @@ char *webread(int s, char *rest, char *line)
|
|||||||
if (np)
|
if (np)
|
||||||
*np = 0;
|
*np = 0;
|
||||||
*pt = 0;
|
*pt = 0;
|
||||||
Strcpy(line,rest);
|
stringcpy(line,rest);
|
||||||
pt++;
|
pt++;
|
||||||
Strcpy(rest,pt);
|
stringcpy(rest,pt);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("[WoR] {%i} `%s'\n",s,line);
|
debug("[WoR] {%i} `%s'\n",s,line);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -104,9 +104,9 @@ char *webread(int s, char *rest, char *line)
|
|||||||
if (np)
|
if (np)
|
||||||
*np = 0;
|
*np = 0;
|
||||||
*tp = *pt = 0;
|
*tp = *pt = 0;
|
||||||
Strcpy(line,rest);
|
stringcpy(line,rest);
|
||||||
pt++;
|
pt++;
|
||||||
Strcpy(rest,pt);
|
stringcpy(rest,pt);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("[WoR] {%i} `%s'\n",s,line);
|
debug("[WoR] {%i} `%s'\n",s,line);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -250,7 +250,7 @@ void web_raw(WebSock *client, char *url)
|
|||||||
goto error;
|
goto error;
|
||||||
ino = s.st_ino;
|
ino = s.st_ino;
|
||||||
|
|
||||||
dest = Strcpy(path,WEBROOT);
|
dest = stringcpy(path,WEBROOT);
|
||||||
src = url;
|
src = url;
|
||||||
if (*src == '/')
|
if (*src == '/')
|
||||||
src++;
|
src++;
|
||||||
@ -401,7 +401,7 @@ void parse(WebSock *client, char *rest)
|
|||||||
method = chop(&rest);
|
method = chop(&rest);
|
||||||
url = chop(&rest);
|
url = chop(&rest);
|
||||||
proto = chop(&rest);
|
proto = chop(&rest);
|
||||||
if (!method || !proto || Strcasecmp(method,"GET"))
|
if (!method || !proto || stringcasecmp(method,"GET"))
|
||||||
{
|
{
|
||||||
client->status = WEB_DEAD;
|
client->status = WEB_DEAD;
|
||||||
return;
|
return;
|
||||||
@ -409,13 +409,13 @@ void parse(WebSock *client, char *rest)
|
|||||||
client->docptr = &docraw;
|
client->docptr = &docraw;
|
||||||
for(i=0;doclist[i].proc;i++)
|
for(i=0;doclist[i].proc;i++)
|
||||||
{
|
{
|
||||||
if (!Strcasecmp(doclist[i].url,url))
|
if (!stringcasecmp(doclist[i].url,url))
|
||||||
{
|
{
|
||||||
client->docptr = &doclist[i];
|
client->docptr = &doclist[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client->url = Strdup(url);
|
client->url = stringdup(url);
|
||||||
client->status = WEB_WAITCR;
|
client->status = WEB_WAITCR;
|
||||||
break;
|
break;
|
||||||
case WEB_WAITCR:
|
case WEB_WAITCR:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user