mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 15:36:50 +00:00
compiles clean using -std=c89
This commit is contained in:
parent
e92d9fd83e
commit
017f85e1ee
1
VERSIONS
1
VERSIONS
@ -1,5 +1,6 @@
|
|||||||
3.1 -- WORK IN PROGRESS (~April, 2018)
|
3.1 -- WORK IN PROGRESS (~April, 2018)
|
||||||
|
|
||||||
|
* Fixed: Compiles clean with -std=c89
|
||||||
* Added: $guid to esay variables
|
* Added: $guid to esay variables
|
||||||
* Added: New bigsay font: spider, use with .bigsay -spider cowabunga!
|
* Added: New bigsay font: spider, use with .bigsay -spider cowabunga!
|
||||||
* Fixed: Error in printing pointers would make lots of debug output go missing
|
* Fixed: Error in printing pointers would make lots of debug output go missing
|
||||||
|
|||||||
107
configure
vendored
107
configure
vendored
@ -379,7 +379,11 @@ __EOT__
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
CC=*)
|
CC=*)
|
||||||
CC=`echo $opt | sed 's/.*=//;'`
|
CC=`echo $opt | sed 's/CC=//;'`
|
||||||
|
;;
|
||||||
|
CFLAGS=*)
|
||||||
|
CFLAGS=`echo $opt | sed 's/CFLAGS=//;'`
|
||||||
|
echo "cflags is $CFLAGS"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unknown option: $opt"
|
echo "unknown option: $opt"
|
||||||
@ -441,44 +445,13 @@ fi
|
|||||||
|
|
||||||
echo $ac_t "$cf_SYSMACH"
|
echo $ac_t "$cf_SYSMACH"
|
||||||
|
|
||||||
#
|
CCshort=
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
echo $ac_n "checking for C compiler ... "$ac_c
|
|
||||||
if [ "$CC" ]; then
|
|
||||||
CCshort="$CC"
|
|
||||||
CC=`config/which $CC`
|
|
||||||
else
|
|
||||||
CCshort=gcc
|
|
||||||
CC=`config/which gcc`
|
|
||||||
fi
|
|
||||||
if [ ! -x "$CC" ]; then
|
|
||||||
CCshort=cc
|
|
||||||
CC=`config/which cc`
|
|
||||||
if [ ! -x "$CC" ]; then
|
|
||||||
echo $ac_t "not found"
|
|
||||||
echo "A working C compiler is needed to compile the EnergyMech"
|
|
||||||
echo "exiting ..."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
CClong="$CC"
|
|
||||||
CC="$CCshort"
|
|
||||||
echo $ac_t "$CC"
|
|
||||||
|
|
||||||
# set up things for test compiling
|
|
||||||
|
|
||||||
TESTO=./test$$.o
|
|
||||||
TESTP=./test$$
|
|
||||||
rm -f $TESTO $TESTP
|
|
||||||
|
|
||||||
has_musl=no
|
has_musl=no
|
||||||
#
|
#
|
||||||
# if directed to use libmusl instead of (g)libc ...
|
# if directed to use libmusl instead of (g)libc ...
|
||||||
#
|
#
|
||||||
if [ ! "$try_libmusl" = no ]; then
|
if [ ! "$try_libmusl" = no ]; then
|
||||||
echo $ac_n "checking for libmusl ... "$ac_c
|
echo $ac_n "checking for libmusl gcc wrapper ... "$ac_c
|
||||||
mgcc=`config/which musl-gcc`
|
mgcc=`config/which musl-gcc`
|
||||||
if [ -x "$mgcc" ]; then
|
if [ -x "$mgcc" ]; then
|
||||||
CC="$mgcc"
|
CC="$mgcc"
|
||||||
@ -496,15 +469,47 @@ if [ ! "$try_libmusl" = no ]; then
|
|||||||
CC=/opt/musl/bin/musl-gcc
|
CC=/opt/musl/bin/musl-gcc
|
||||||
fi
|
fi
|
||||||
CCshort=$CC
|
CCshort=$CC
|
||||||
echo $ac_t yes
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# a C compiler is good to have
|
||||||
|
#
|
||||||
|
if [ -z "$CCshort" ]; then
|
||||||
|
echo $ac_n "checking for C compiler ... "$ac_c
|
||||||
|
if [ "$CC" ]; then
|
||||||
|
CCshort="$CC"
|
||||||
|
CC=`config/which $CC`
|
||||||
|
fi
|
||||||
|
if [ ! -x "$CC" ]; then
|
||||||
|
CCshort=gcc
|
||||||
|
CC=`config/which gcc`
|
||||||
|
fi
|
||||||
|
if [ ! -x "$CC" ]; then
|
||||||
|
CCshort=cc
|
||||||
|
CC=`config/which cc`
|
||||||
|
if [ ! -x "$CC" ]; then
|
||||||
|
echo $ac_t "not found"
|
||||||
|
echo "A working C compiler is needed to compile the EnergyMech"
|
||||||
|
echo "exiting ..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
CClong="$CC"
|
||||||
|
CC="$CCshort"
|
||||||
|
echo $ac_t "$CC"
|
||||||
|
|
||||||
|
#
|
||||||
|
# set up things for test compiling
|
||||||
|
#
|
||||||
|
TESTO=./test$$.o
|
||||||
|
TESTP=./test$$
|
||||||
|
rm -f $TESTO $TESTP
|
||||||
|
|
||||||
#
|
#
|
||||||
# does the C compile work?
|
# does the C compile work?
|
||||||
#
|
#
|
||||||
|
|
||||||
TESTC=config/cc.c
|
TESTC=config/cc.c
|
||||||
|
|
||||||
echo $ac_n "checking whether $CC works or not ... "$ac_c
|
echo $ac_n "checking whether $CC works or not ... "$ac_c
|
||||||
$CC -o $TESTP $TESTC 1> /dev/null 2> /dev/null
|
$CC -o $TESTP $TESTC 1> /dev/null 2> /dev/null
|
||||||
WORK=no
|
WORK=no
|
||||||
@ -543,13 +548,23 @@ fi
|
|||||||
#
|
#
|
||||||
# compiler flags
|
# compiler flags
|
||||||
#
|
#
|
||||||
|
|
||||||
echo $ac_n "checking C compiler flags ... "$ac_c
|
echo $ac_n "checking C compiler flags ... "$ac_c
|
||||||
|
|
||||||
|
#
|
||||||
|
# user defined CFLAGS
|
||||||
|
#
|
||||||
|
cf_cflags=
|
||||||
|
if [ -n "$CFLAGS" ]; then
|
||||||
|
if $CC $CFLAGS -c -o $TESTO $TESTC 1> /dev/null 2> /dev/null && test -r $TESTO; then
|
||||||
|
cf_cflags="$CFLAGS"
|
||||||
|
echo $ac_n "$CFLAGS "$ac_c
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# -g
|
# -g
|
||||||
#
|
#
|
||||||
if [ -z "$cc_g_opt" ]; then
|
if [ -z "$cf_cflags" -a -z "$cc_g_opt" ]; then
|
||||||
cc_g_opt=no
|
cc_g_opt=no
|
||||||
if $CC -g -c -o $TESTO $TESTC 1> /dev/null 2> /dev/null && test -r $TESTO; then
|
if $CC -g -c -o $TESTO $TESTC 1> /dev/null 2> /dev/null && test -r $TESTO; then
|
||||||
cc_g_opt=yes
|
cc_g_opt=yes
|
||||||
@ -557,10 +572,11 @@ if [ -z "$cc_g_opt" ]; then
|
|||||||
echo $ac_n "-g "$ac_c
|
echo $ac_n "-g "$ac_c
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# GNU GCC
|
# GNU GCC
|
||||||
#
|
#
|
||||||
if [ -n "$cf_GNUCC" ]; then
|
if [ -z "$cf_cflags" -a -n "$cf_GNUCC" ]; then
|
||||||
#
|
#
|
||||||
# -Wall -Wshadow
|
# -Wall -Wshadow
|
||||||
#
|
#
|
||||||
@ -611,7 +627,7 @@ if [ -n "$cf_GNUCC" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$cc_pipe_opt" ]; then
|
if [ -z "$cf_cflags" -a -z "$cc_pipe_opt" ]; then
|
||||||
if $CC -pipe -c -o $TESTO $TESTC 1> /dev/null 2> /dev/null && test -r $TESTO; then
|
if $CC -pipe -c -o $TESTO $TESTC 1> /dev/null 2> /dev/null && test -r $TESTO; then
|
||||||
cc_pipe_flag="-pipe"
|
cc_pipe_flag="-pipe"
|
||||||
echo $ac_n "-pipe "$ac_c
|
echo $ac_n "-pipe "$ac_c
|
||||||
@ -623,7 +639,7 @@ if [ "$optitype" = size ]; then
|
|||||||
oflag="-Os"
|
oflag="-Os"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$cc_optimize_opt" ]; then
|
if [ -z "$cf_cflags" -a -z "$cc_optimize_opt" ]; then
|
||||||
if $CC $oflag -o $TESTO $TESTC 1> /dev/null 2> /dev/null; then
|
if $CC $oflag -o $TESTO $TESTC 1> /dev/null 2> /dev/null; then
|
||||||
cc_optimize_flag="$oflag"
|
cc_optimize_flag="$oflag"
|
||||||
echo $ac_n "$oflag "$ac_c
|
echo $ac_n "$oflag "$ac_c
|
||||||
@ -1413,6 +1429,10 @@ lflags="$cc_g_flag -o"
|
|||||||
cprof="$cc_pg_flag $cc_pg_define"
|
cprof="$cc_pg_flag $cc_pg_define"
|
||||||
lprof="$cc_pg_flag $cc_pg_define $libpgdl"
|
lprof="$cc_pg_flag $cc_pg_define $libpgdl"
|
||||||
|
|
||||||
|
if [ -z "$cf_cflags" ]; then
|
||||||
|
cf_cflags='$(PIPEFLAG) $(GDBFLAG) $(WARNFLAG) $(OPTIMIZE)'
|
||||||
|
fi
|
||||||
|
|
||||||
echo '# This file is generated from Makefile.in' > src/Makefile
|
echo '# This file is generated from Makefile.in' > src/Makefile
|
||||||
sed "
|
sed "
|
||||||
s%@CC@%$CCshort%;
|
s%@CC@%$CCshort%;
|
||||||
@ -1425,6 +1445,7 @@ s%@gdbflag@%$cc_g_flag%;
|
|||||||
/@libflags@/ { s,@libflags@,$libflags,; };
|
/@libflags@/ { s,@libflags@,$libflags,; };
|
||||||
/@W_FLAGS@/ { s/@W_FLAGS@/$W_FLAGS/; };
|
/@W_FLAGS@/ { s/@W_FLAGS@/$W_FLAGS/; };
|
||||||
/@O_FLAGS@/ { s/@O_FLAGS@/$O_FLAGS/; };
|
/@O_FLAGS@/ { s/@O_FLAGS@/$O_FLAGS/; };
|
||||||
|
/@CFLAGS@/ { s/@CFLAGS@/$cf_cflags/; };
|
||||||
/@I_PERL@/ { s,@I_PERL@,$I_PERL,; };
|
/@I_PERL@/ { s,@I_PERL@,$I_PERL,; };
|
||||||
/@L_PERL@/ { s,@L_PERL@,$L_PERL,; };
|
/@L_PERL@/ { s,@L_PERL@,$L_PERL,; };
|
||||||
/@PYINCLUDE@/ { s,@PYINCLUDE@,$incpython,; };
|
/@PYINCLUDE@/ { s,@PYINCLUDE@,$incpython,; };
|
||||||
@ -1552,5 +1573,3 @@ $out 'Submit your bugreports at https://github.com/MadCamel/energymech/issues'
|
|||||||
$out ''
|
$out ''
|
||||||
$out 'You have read the README file I hope?'
|
$out 'You have read the README file I hope?'
|
||||||
$out ''
|
$out ''
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ TCLINCLUDE = @TCLINCLUDE@
|
|||||||
I_PERL = @I_PERL@
|
I_PERL = @I_PERL@
|
||||||
L_PERL = @L_PERL@
|
L_PERL = @L_PERL@
|
||||||
|
|
||||||
CFLAGS = $(PIPEFLAG) $(GDBFLAG) $(WARNFLAG) $(OPTIMIZE)
|
CFLAGS = @CFLAGS@
|
||||||
LFLAGS = $(PIPEFLAG) $(GDBFLAG)
|
LFLAGS = $(PIPEFLAG) $(GDBFLAG)
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
|
|||||||
@ -53,7 +53,7 @@ int main(int argc, char **argv)
|
|||||||
strcpy(CurrentNick,"noob");
|
strcpy(CurrentNick,"noob");
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
{
|
{
|
||||||
// testcases
|
/* testcases */
|
||||||
testcase("cmd","cmd");
|
testcase("cmd","cmd");
|
||||||
testcase("cmd cmd","cmd cmd");
|
testcase("cmd cmd","cmd cmd");
|
||||||
testcase("cmd $$","cmd $");
|
testcase("cmd $$","cmd $");
|
||||||
@ -132,7 +132,7 @@ void afmt(char *copy_to, const char *src, const char *input)
|
|||||||
{
|
{
|
||||||
if (*argstart == ' ')
|
if (*argstart == ' ')
|
||||||
{
|
{
|
||||||
while(*argstart == ' ') // skip multiple spaces
|
while(*argstart == ' ') /* skip multiple spaces */
|
||||||
argstart++;
|
argstart++;
|
||||||
if (++spc >= startnum)
|
if (++spc >= startnum)
|
||||||
break;
|
break;
|
||||||
@ -145,7 +145,7 @@ void afmt(char *copy_to, const char *src, const char *input)
|
|||||||
{
|
{
|
||||||
if (++spc > endnum)
|
if (++spc > endnum)
|
||||||
break;
|
break;
|
||||||
while(*argend == ' ') // skip multiple spaces
|
while(*argend == ' ') /* skip multiple spaces */
|
||||||
argend++;
|
argend++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -292,7 +292,7 @@ Ban *make_ban(Ban **banlist, char *from, char *banmask, time_t when)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
sz = sizeof(Ban) + Strlen2(from,banmask); // banmask is never NULL
|
sz = sizeof(Ban) + Strlen2(from,banmask); /* banmask is never NULL */
|
||||||
|
|
||||||
set_mallocdoer(make_ban);
|
set_mallocdoer(make_ban);
|
||||||
new = (Ban*)Calloc(sz);
|
new = (Ban*)Calloc(sz);
|
||||||
@ -460,7 +460,7 @@ void channel_massmode(const Chan *chan, char *pattern, int filtmode, char mode,
|
|||||||
|
|
||||||
if (i)
|
if (i)
|
||||||
{
|
{
|
||||||
if ((Strlen2(deopstring,burst)) >= MSGLEN-2) // burst is never NULL
|
if ((Strlen2(deopstring,burst)) >= MSGLEN-2) /* burst is never NULL */
|
||||||
{
|
{
|
||||||
if (write(current->sock,burst,strlen(burst)) == -1)
|
if (write(current->sock,burst,strlen(burst)) == -1)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -268,6 +268,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|||||||
16
src/debug.c
16
src/debug.c
@ -45,7 +45,7 @@ LS const struct
|
|||||||
|
|
||||||
} StructList[] =
|
} StructList[] =
|
||||||
{
|
{
|
||||||
{ "aME\t", sizeof(aME) }, // for memory allocation debugging
|
{ "aME\t", sizeof(aME) }, /* for memory allocation debugging */
|
||||||
{ "aMEA", sizeof(aMEA) },
|
{ "aMEA", sizeof(aMEA) },
|
||||||
#ifdef ALIAS
|
#ifdef ALIAS
|
||||||
{ "Alias", sizeof(Alias) },
|
{ "Alias", sizeof(Alias) },
|
||||||
@ -524,7 +524,7 @@ void debug_settings(UniVar *setting, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tpad = STREND(tabs);
|
tpad = STREND(tabs);
|
||||||
n = 24 - (Strlen2(pad,VarName[i].name) + 2); // VarName[i].name is never NULL
|
n = 24 - (Strlen2(pad,VarName[i].name) + 2); /* VarName[i].name is never NULL */
|
||||||
while(n >= 8)
|
while(n >= 8)
|
||||||
{
|
{
|
||||||
n = n - 8;
|
n = n - 8;
|
||||||
@ -1250,12 +1250,12 @@ typedef struct
|
|||||||
{
|
{
|
||||||
time_t last;
|
time_t last;
|
||||||
time_t next;
|
time_t next;
|
||||||
uint32_t second1; //:30;
|
uint32_t second1; /*:30;*/
|
||||||
uint32_t second2; //:30;
|
uint32_t second2; /*:30;*/
|
||||||
uint32_t minute1; //:30;
|
uint32_t minute1; /*:30;*/
|
||||||
uint32_t minute2; //:30;
|
uint32_t minute2; /*:30;*/
|
||||||
uint32_t hour; //:24;
|
uint32_t hour; /*:24;*/
|
||||||
uint32_t weekday; //:7;
|
uint32_t weekday; /*:7;*/
|
||||||
|
|
||||||
} HookTimer;
|
} HookTimer;
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
|
|||||||
@ -72,10 +72,10 @@
|
|||||||
#define CU_KSWARN 0x1000
|
#define CU_KSWARN 0x1000
|
||||||
#define CU_CHANBAN 0x2000
|
#define CU_CHANBAN 0x2000
|
||||||
|
|
||||||
#define SHIT_NOOP 0 // do nothing
|
#define SHIT_NOOP 0 /* do nothing */
|
||||||
#define SHIT_CHANOP 1 // not allowed to be chanop
|
#define SHIT_CHANOP 1 /* not allowed to be chanop */
|
||||||
#define SHIT_KB 2 // simple kick and ban
|
#define SHIT_KB 2 /* simple kick and ban */
|
||||||
#define SHIT_PERMABAN 3 // permanent ban, re-ban if unbanned
|
#define SHIT_PERMABAN 3 /* permanent ban, re-ban if unbanned */
|
||||||
#define SHIT_CHANBAN 4
|
#define SHIT_CHANBAN 4
|
||||||
|
|
||||||
#define MAXSHITLEVEL 4
|
#define MAXSHITLEVEL 4
|
||||||
|
|||||||
12
src/dns.c
12
src/dns.c
@ -155,7 +155,7 @@ int make_query(char *packet, const char *hostname)
|
|||||||
memset(packet,0,12);
|
memset(packet,0,12);
|
||||||
h = (dnsQuery*)packet;
|
h = (dnsQuery*)packet;
|
||||||
h->qid = rand() & 0xffff;
|
h->qid = rand() & 0xffff;
|
||||||
h->flags = htons(0x0100);; // Query = 0, Recursion Desired = 1
|
h->flags = htons(0x0100);; /* Query = 0, Recursion Desired = 1 */
|
||||||
h->questions = htons(1);
|
h->questions = htons(1);
|
||||||
size = packet + 12;
|
size = packet + 12;
|
||||||
dst = size + 1;
|
dst = size + 1;
|
||||||
@ -244,7 +244,7 @@ void parse_query(int psz, dnsQuery *query)
|
|||||||
n = ntohs(query->flags);
|
n = ntohs(query->flags);
|
||||||
debug("(parse_query) %i: flags = %i { %s %i %s%s%s%s%s }\n",
|
debug("(parse_query) %i: flags = %i { %s %i %s%s%s%s%s }\n",
|
||||||
sz,n,token,
|
sz,n,token,
|
||||||
(n&15), // result code
|
(n&15), /* result code */
|
||||||
(n&32768) ? "QR 1 (Answer) ":"QR 0 (Question) ",
|
(n&32768) ? "QR 1 (Answer) ":"QR 0 (Question) ",
|
||||||
(n&1024) ? "AA ":"",
|
(n&1024) ? "AA ":"",
|
||||||
(n&512) ? "TC ":"",
|
(n&512) ? "TC ":"",
|
||||||
@ -879,8 +879,8 @@ void do_dns(COMMAND_ARGS)
|
|||||||
if ((ip = inet_addr(host)) != INADDR_NONE)
|
if ((ip = inet_addr(host)) != INADDR_NONE)
|
||||||
{
|
{
|
||||||
/* flip an IP backwards to resolve hostname */
|
/* flip an IP backwards to resolve hostname */
|
||||||
// a11.b22.c33.d44
|
/* a11.b22.c33.d44 */
|
||||||
// d44.c33.b22.a11.in-addr.arpa
|
/* d44.c33.b22.a11.in-addr.arpa */
|
||||||
dst = globaldata;
|
dst = globaldata;
|
||||||
flipstep:
|
flipstep:
|
||||||
src = host;
|
src = host;
|
||||||
@ -894,7 +894,7 @@ flipstep:
|
|||||||
}
|
}
|
||||||
if (dot)
|
if (dot)
|
||||||
{
|
{
|
||||||
*dot++ = 0; // safe to modify buffer?
|
*dot++ = 0; /* safe to modify buffer? */
|
||||||
while(*dot)
|
while(*dot)
|
||||||
*dst++ = *dot++;
|
*dst++ = *dot++;
|
||||||
*dst++ = '.';
|
*dst++ = '.';
|
||||||
@ -909,7 +909,7 @@ flipstep:
|
|||||||
/* check if its in cache now */
|
/* check if its in cache now */
|
||||||
if ((res = poll_rawdns(host)))
|
if ((res = poll_rawdns(host)))
|
||||||
{
|
{
|
||||||
//Resolved: irc.dal.net (194.68.45.50)
|
/* Resolved: irc.dal.net (194.68.45.50) */
|
||||||
send_pa(PA_DNS|PA_END,NULL,"Resolved: %s (%s)",host,res);
|
send_pa(PA_DNS|PA_END,NULL,"Resolved: %s (%s)",host,res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,7 +126,7 @@ void Free(char **mem)
|
|||||||
{
|
{
|
||||||
debug("(Free) PANIC: Free(0x"mx_pfmt"); Unregistered memory block\n",(mx_ptr)src);
|
debug("(Free) PANIC: Free(0x"mx_pfmt"); Unregistered memory block\n",(mx_ptr)src);
|
||||||
run_debug();
|
run_debug();
|
||||||
//exit(1); // overreacting. just ignore it and accept the leak.
|
/*exit(1); /* overreacting. just ignore it and accept the leak. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mp = mp->next;
|
mp = mp->next;
|
||||||
@ -896,8 +896,8 @@ int is_safepath(const char *path, int filemustexist)
|
|||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
memset(&st,0,sizeof(st));
|
memset(&st,0,sizeof(st));
|
||||||
#endif
|
#endif
|
||||||
if (*(src = path) == '/') // dont allow starting at root, only allow relative paths
|
if (*(src = path) == '/') /* dont allow starting at root, only allow relative paths */
|
||||||
return(-1);//(FALSE);
|
return(-1);
|
||||||
|
|
||||||
if (strlen(path) >= PATH_MAX)
|
if (strlen(path) >= PATH_MAX)
|
||||||
return(-6);
|
return(-6);
|
||||||
@ -910,7 +910,7 @@ int is_safepath(const char *path, int filemustexist)
|
|||||||
if (filemustexist == FILE_MUST_NOTEXIST && orr == 0)
|
if (filemustexist == FILE_MUST_NOTEXIST && orr == 0)
|
||||||
return(-3);
|
return(-3);
|
||||||
|
|
||||||
mo = st.st_mode; // save mode for later
|
mo = st.st_mode; /* save mode for later */
|
||||||
dir_r = -1;
|
dir_r = -1;
|
||||||
|
|
||||||
for(dst=tmp;*src;)
|
for(dst=tmp;*src;)
|
||||||
@ -920,9 +920,9 @@ int is_safepath(const char *path, int filemustexist)
|
|||||||
*dst = 0;
|
*dst = 0;
|
||||||
if ((dir_r = lstat(tmp,&st)) == -1 && errno == ENOENT)
|
if ((dir_r = lstat(tmp,&st)) == -1 && errno == ENOENT)
|
||||||
return(-7);
|
return(-7);
|
||||||
if (!(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) // disallow all except regular files and directories
|
if (!(S_ISREG(st.st_mode) || S_ISDIR(st.st_mode))) /* disallow all except regular files and directories */
|
||||||
return(-4);
|
return(-4);
|
||||||
if (st.st_ino == parent_inode) // disallow traversing below bots homedir
|
if (st.st_ino == parent_inode) /* disallow traversing below bots homedir */
|
||||||
return(-5);
|
return(-5);
|
||||||
}
|
}
|
||||||
if (dst == tmp + PATH_MAX-1)
|
if (dst == tmp + PATH_MAX-1)
|
||||||
@ -958,7 +958,7 @@ void testcase(const char *str, int expected, int filemustexist)
|
|||||||
{
|
{
|
||||||
debug("testcase FAIL: testpath %s(%i) %s -> result %i, expected %i\n",
|
debug("testcase FAIL: testpath %s(%i) %s -> result %i, expected %i\n",
|
||||||
(strlen(str)>50) ? "(very long string)" : str,
|
(strlen(str)>50) ? "(very long string)" : str,
|
||||||
strlen(str),tostr[filemustexist],r,expected);//(r) ? "TRUE" : "FALSE",(expected) ? "TRUE" : "FALSE");
|
strlen(str),tostr[filemustexist],r,expected);/*(r) ? "TRUE" : "FALSE",(expected) ? "TRUE" : "FALSE"); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -994,7 +994,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
dodebug = 1;
|
dodebug = 1;
|
||||||
stat("../..",&st);
|
stat("../..",&st);
|
||||||
parent_inode = st.st_ino; // used for is_safepath()
|
parent_inode = st.st_ino; /* used for is_safepath() */
|
||||||
|
|
||||||
debug("PATH_MAX = %i\n",PATH_MAX);
|
debug("PATH_MAX = %i\n",PATH_MAX);
|
||||||
if (argv[1] == NULL)
|
if (argv[1] == NULL)
|
||||||
|
|||||||
46
src/h.h
46
src/h.h
@ -67,7 +67,7 @@
|
|||||||
#define __att2(x,y,z) /* nothing */
|
#define __att2(x,y,z) /* nothing */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// __x86_64__ automatically compiles for regparm optimization
|
/* __x86_64__ automatically compiles for regparm optimization */
|
||||||
#if !defined(__profiling__) && defined(__i386__)
|
#if !defined(__profiling__) && defined(__i386__)
|
||||||
# define __regparm(x) regparm(x)
|
# define __regparm(x) regparm(x)
|
||||||
#else
|
#else
|
||||||
@ -406,7 +406,11 @@ LS void sig_int(int) __page(RARE_SEG); /* rare */
|
|||||||
LS void sig_ill(int) __page(RARE_SEG);
|
LS void sig_ill(int) __page(RARE_SEG);
|
||||||
LS void sig_abrt(int) __page(RARE_SEG);
|
LS void sig_abrt(int) __page(RARE_SEG);
|
||||||
LS void sig_bus(int) __page(CMD1_SEG);
|
LS void sig_bus(int) __page(CMD1_SEG);
|
||||||
|
#if defined(__linux__) && defined(__x86_64__) && defined(DEBUG) && !defined(__STRICT_ANSI__)
|
||||||
LS void sig_segv(int, siginfo_t *, void *) __attr(RARE_SEG, __noreturn__);
|
LS void sig_segv(int, siginfo_t *, void *) __attr(RARE_SEG, __noreturn__);
|
||||||
|
#else
|
||||||
|
LS void sig_segv(int) __attr(RARE_SEG, __noreturn__);
|
||||||
|
#endif
|
||||||
LS void sig_term(int) __attr(RARE_SEG, __noreturn__); /* rare */
|
LS void sig_term(int) __attr(RARE_SEG, __noreturn__); /* rare */
|
||||||
LS void doit(void);
|
LS void doit(void);
|
||||||
LS int main(int argc, char **argv, char **envp);
|
LS int main(int argc, char **argv, char **envp);
|
||||||
@ -579,13 +583,15 @@ LS void do_banlist(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
PyObject *python_hook(PyObject *self, PyObject *args, PyObject *keywds);
|
PyObject *python_hook(PyObject *self, PyObject *args, PyObject *keywds);
|
||||||
PyObject *python_unhook(PyObject *self, PyObject *args, PyObject *keywds);
|
PyObject *python_unhook(PyObject *self, PyObject *args, PyObject *keywds);
|
||||||
#endif
|
#endif
|
||||||
//char *python_unicode2char(PyUnicodeObject *obj);
|
/*
|
||||||
//PyObject *python_userlevel(PyObject *self, PyObject *args, PyObject *keywds);
|
char *python_unicode2char(PyUnicodeObject *obj);
|
||||||
//PyObject *python_to_server(PyObject *self, PyObject *args, PyObject *keywds);
|
PyObject *python_userlevel(PyObject *self, PyObject *args, PyObject *keywds);
|
||||||
//PyObject *python_to_file(PyObject *self, PyObject *args, PyObject *keywds);
|
PyObject *python_to_server(PyObject *self, PyObject *args, PyObject *keywds);
|
||||||
//static PyObject *python_dcc_sendfile(PyObject *self, PyObject *args, PyObject *keywds);
|
PyObject *python_to_file(PyObject *self, PyObject *args, PyObject *keywds);
|
||||||
//PyObject *python_debug(PyObject *self, PyObject *args);
|
static PyObject *python_dcc_sendfile(PyObject *self, PyObject *args, PyObject *keywds);
|
||||||
//PyMODINIT_FUNC pythonInit(void);
|
PyObject *python_debug(PyObject *self, PyObject *args);
|
||||||
|
PyMODINIT_FUNC pythonInit(void);
|
||||||
|
*/
|
||||||
int python_parse_jump(char *, char *, Hook *);
|
int python_parse_jump(char *, char *, Hook *);
|
||||||
int python_timer_jump(Hook *hook);
|
int python_timer_jump(Hook *hook);
|
||||||
void python_dcc_complete(Client *client, int cps);
|
void python_dcc_complete(Client *client, int cps);
|
||||||
@ -649,22 +655,26 @@ LS void do_urlhist(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
/* tcl.c */
|
/* tcl.c */
|
||||||
#ifdef TCL
|
#ifdef TCL
|
||||||
|
|
||||||
//LS char *tcl_var_read(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
/*
|
||||||
//LS char *tcl_var_write(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
LS char *tcl_var_read(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
||||||
|
LS char *tcl_var_write(Tcl_TVInfo *vinfo, Tcl_Interp *I, char *n1, char *n2, int flags);
|
||||||
|
*/
|
||||||
LS int tcl_timer_jump(Hook *hook);
|
LS int tcl_timer_jump(Hook *hook);
|
||||||
LS int tcl_parse_jump(char *from, char *rest, Hook *hook);
|
LS int tcl_parse_jump(char *from, char *rest, Hook *hook);
|
||||||
LS void tcl_dcc_complete(Client *client, int cps);
|
LS void tcl_dcc_complete(Client *client, int cps);
|
||||||
#if defined(DEBUG_C) || defined(MEGA_C)
|
#if defined(DEBUG_C) || defined(MEGA_C)
|
||||||
LS int tcl_hook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_hook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
#endif
|
#endif
|
||||||
//LS int tcl_unhook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
/*
|
||||||
//LS int tcl_userlevel(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_unhook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
//LS int tcl_debug(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_userlevel(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
//LS int tcl_to_server(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_debug(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
//LS int tcl_to_file(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_to_server(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
//LS int tcl_dcc_sendfile(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_to_file(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
//LS int tcl_dns_jump(char *host, char *resolved, Hook *hook);
|
LS int tcl_dcc_sendfile(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
//LS int tcl_dns(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
LS int tcl_dns_jump(char *host, char *resolved, Hook *hook);
|
||||||
|
LS int tcl_dns(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
|
||||||
|
*/
|
||||||
LS void init_tcl(void);
|
LS void init_tcl(void);
|
||||||
LS void do_tcl(COMMAND_ARGS) __page(CMD1_SEG);
|
LS void do_tcl(COMMAND_ARGS) __page(CMD1_SEG);
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ char vmstk[32];
|
|||||||
char vmexe[32];
|
char vmexe[32];
|
||||||
char vmlib[32];
|
char vmlib[32];
|
||||||
*/
|
*/
|
||||||
char omni[224]; // 32*7
|
char omni[224]; /* 32*7 */
|
||||||
#define vmpeak &omni[0]
|
#define vmpeak &omni[0]
|
||||||
#define vmsize &omni[32]
|
#define vmsize &omni[32]
|
||||||
#define vmrss &omni[64]
|
#define vmrss &omni[64]
|
||||||
@ -47,7 +47,7 @@ char omni[224]; // 32*7
|
|||||||
#define vmexe &omni[160]
|
#define vmexe &omni[160]
|
||||||
#define vmlib &omni[192]
|
#define vmlib &omni[192]
|
||||||
|
|
||||||
struct // statusvalues
|
struct /* statusvalues */
|
||||||
{
|
{
|
||||||
const char *key;
|
const char *key;
|
||||||
const int klen;
|
const int klen;
|
||||||
@ -138,7 +138,7 @@ int parse_proc_cpuinfo(char *line)
|
|||||||
{
|
{
|
||||||
if (havemodel == 1)
|
if (havemodel == 1)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
*(dst++) = ' '; // prime with a leading space
|
*(dst++) = ' '; /* prime with a leading space */
|
||||||
while(*src && dst < end)
|
while(*src && dst < end)
|
||||||
{
|
{
|
||||||
if (*src != ' ' || dst[-1] != ' ')
|
if (*src != ' ' || dst[-1] != ' ')
|
||||||
@ -179,7 +179,7 @@ int parse_proc_cpuinfo(char *line)
|
|||||||
}
|
}
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
}
|
}
|
||||||
return(FALSE); // return false to continue reading lines
|
return(FALSE); /* return false to continue reading lines */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -224,7 +224,7 @@ void do_meminfo(COMMAND_ARGS)
|
|||||||
*(sv[i].valbuf) = 0;
|
*(sv[i].valbuf) = 0;
|
||||||
if ((fd = open(fn,O_RDONLY)) < 0)
|
if ((fd = open(fn,O_RDONLY)) < 0)
|
||||||
return;
|
return;
|
||||||
readline(fd,&parse_proc_status); // readline closes fd
|
readline(fd,&parse_proc_status); /* readline closes fd */
|
||||||
|
|
||||||
to_user_q(from,"VM %s (Max %s), RSS %s [ Code %s, Data %s, Libs %s, Stack %s ]",
|
to_user_q(from,"VM %s (Max %s), RSS %s [ Code %s, Data %s, Libs %s, Stack %s ]",
|
||||||
vmsize,vmpeak,vmrss,vmexe,vmdata,vmlib,vmstk);
|
vmsize,vmpeak,vmrss,vmexe,vmdata,vmlib,vmstk);
|
||||||
@ -248,11 +248,13 @@ void do_cpuinfo(COMMAND_ARGS)
|
|||||||
else
|
else
|
||||||
stringcpy(bogostr,"/proc/cpuinfo");
|
stringcpy(bogostr,"/proc/cpuinfo");
|
||||||
if ((fd = open(bogostr,O_RDONLY)) < 0)
|
if ((fd = open(bogostr,O_RDONLY)) < 0)
|
||||||
// if ((fd = open("/home/git/cpuinfo/mips3",O_RDONLY)) < 0)
|
/*
|
||||||
// if ((fd = open("/home/git/cpuinfo/mips2",O_RDONLY)) < 0)
|
if ((fd = open("/home/git/cpuinfo/mips3",O_RDONLY)) < 0)
|
||||||
// if ((fd = open("/home/git/cpuinfo/mips1",O_RDONLY)) < 0)
|
if ((fd = open("/home/git/cpuinfo/mips2",O_RDONLY)) < 0)
|
||||||
// if ((fd = open("/home/git/cpuinfo/intel1",O_RDONLY)) < 0)
|
if ((fd = open("/home/git/cpuinfo/mips1",O_RDONLY)) < 0)
|
||||||
// if ((fd = open("/home/git/cpuinfo/cosmiccow",O_RDONLY)) < 0)
|
if ((fd = open("/home/git/cpuinfo/intel1",O_RDONLY)) < 0)
|
||||||
|
if ((fd = open("/home/git/cpuinfo/cosmiccow",O_RDONLY)) < 0)
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
if ((fd = open("/proc/cpuinfo",O_RDONLY)) < 0)
|
if ((fd = open("/proc/cpuinfo",O_RDONLY)) < 0)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -267,7 +269,7 @@ void do_cpuinfo(COMMAND_ARGS)
|
|||||||
global_from = from;
|
global_from = from;
|
||||||
havemodel = bogo = siblings = procct = cpus = cores = physid = 0;
|
havemodel = bogo = siblings = procct = cpus = cores = physid = 0;
|
||||||
omni[1] = 0;
|
omni[1] = 0;
|
||||||
readline(fd,&parse_proc_cpuinfo); // readline closes fd
|
readline(fd,&parse_proc_cpuinfo); /* readline closes fd */
|
||||||
|
|
||||||
if ((fd = open("/proc/loadavg",O_RDONLY)) < 0)
|
if ((fd = open("/proc/loadavg",O_RDONLY)) < 0)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -315,7 +317,7 @@ void do_cpuinfo(COMMAND_ARGS)
|
|||||||
omni+1,bogostr,cpustr,a1,a2,a3);
|
omni+1,bogostr,cpustr,a1,a2,a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
@ -326,18 +328,18 @@ struct
|
|||||||
|
|
||||||
} in2str[] =
|
} in2str[] =
|
||||||
{
|
{
|
||||||
{ IN_ACCESS, "IN_ACCESS" }, // File was accessed (read)
|
{ IN_ACCESS, "IN_ACCESS" }, /* File was accessed (read) */
|
||||||
{ IN_ATTRIB, "IN_ATTRIB" }, // Metadata changed, e.g., permissions, timestamps, extended attributes, link count, UID, GID, etc.
|
{ IN_ATTRIB, "IN_ATTRIB" }, /* Metadata changed, e.g., permissions, timestamps, extended attributes, link count, UID, GID, etc. */
|
||||||
{ IN_CLOSE_WRITE, "IN_CLOSE_WRITE" }, // File opened for writing was closed
|
{ IN_CLOSE_WRITE, "IN_CLOSE_WRITE" }, /* File opened for writing was closed */
|
||||||
{ IN_CLOSE_NOWRITE, "IN_CLOSE_NOWRITE" }, // File not opened for writing was closed
|
{ IN_CLOSE_NOWRITE, "IN_CLOSE_NOWRITE" }, /* File not opened for writing was closed */
|
||||||
{ IN_CREATE, "IN_CREATE" }, // File/directory created in watched directory
|
{ IN_CREATE, "IN_CREATE" }, /* File/directory created in watched directory */
|
||||||
{ IN_DELETE, "IN_DELETE" }, // File/directory deleted from watched directory
|
{ IN_DELETE, "IN_DELETE" }, /* File/directory deleted from watched directory */
|
||||||
{ IN_DELETE_SELF, "IN_DELETE_SELF" }, // Watched file/directory was itself deleted
|
{ IN_DELETE_SELF, "IN_DELETE_SELF" }, /* Watched file/directory was itself deleted */
|
||||||
{ IN_MODIFY, "IN_MODIFY" }, // File was modified
|
{ IN_MODIFY, "IN_MODIFY" }, /* File was modified */
|
||||||
{ IN_MOVE_SELF, "IN_MOVE_SELF" }, // Watched file/directory was itself moved
|
{ IN_MOVE_SELF, "IN_MOVE_SELF" }, /* Watched file/directory was itself moved */
|
||||||
{ IN_MOVED_FROM, "IN_MOVED_FROM" }, // Generated for the directory containing the old filename when a file is renamed
|
{ IN_MOVED_FROM, "IN_MOVED_FROM" }, /* Generated for the directory containing the old filename when a file is renamed */
|
||||||
{ IN_MOVED_TO, "IN_MOVED_TO" }, // Generated for the directory containing the new filename when a file is renamed
|
{ IN_MOVED_TO, "IN_MOVED_TO" }, /* Generated for the directory containing the new filename when a file is renamed */
|
||||||
{ IN_OPEN, "IN_OPEN" }, // File was opened
|
{ IN_OPEN, "IN_OPEN" }, /* File was opened */
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ void make_ireq(int t, const char *from, const char *nick)
|
|||||||
char *pt;
|
char *pt;
|
||||||
|
|
||||||
set_mallocdoer(make_ireq);
|
set_mallocdoer(make_ireq);
|
||||||
ir = (IReq*)Calloc(sizeof(IReq) + StrlenX(from,nick,NULL)); // can not use Strlen2() if 2nd arg might be NULL, StrlenX() handles NULLs.
|
ir = (IReq*)Calloc(sizeof(IReq) + StrlenX(from,nick,NULL)); /* can not use Strlen2() if 2nd arg might be NULL, StrlenX() handles NULLs. */
|
||||||
|
|
||||||
ir->t = t;
|
ir->t = t;
|
||||||
ir->when = now;
|
ir->when = now;
|
||||||
|
|||||||
52
src/main.c
52
src/main.c
@ -440,35 +440,51 @@ void sig_bus(int crap)
|
|||||||
/*
|
/*
|
||||||
* SIGSEGV shows no mercy, cant schedule it.
|
* SIGSEGV shows no mercy, cant schedule it.
|
||||||
*/
|
*/
|
||||||
#ifdef __x86_64__
|
#if defined(__linux__) && defined(__x86_64__) && defined(DEBUG) && !defined(__STRICT_ANSI__)
|
||||||
#include <sys/ucontext.h>
|
#include <sys/ucontext.h>
|
||||||
#endif
|
|
||||||
void sig_segv(int crap, siginfo_t *si, void *uap)
|
void sig_segv(int crap, siginfo_t *si, void *uap)
|
||||||
{
|
{
|
||||||
#ifdef __x86_64__
|
|
||||||
mcontext_t *mctx;
|
mcontext_t *mctx;
|
||||||
greg_t *rsp,*rip; // general registers
|
greg_t *rsp,*rip; /* general registers */
|
||||||
#endif /* __x86_64__ */
|
|
||||||
|
|
||||||
time(&now);
|
time(&now);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
debug("(sigsegv) trying to access "mx_pfmt"\n",(mx_ptr)si->si_addr);
|
debug("(sigsegv) trying to access "mx_pfmt"\n",(mx_ptr)si->si_addr);
|
||||||
#ifdef __x86_64__
|
|
||||||
mctx = &((ucontext_t *)uap)->uc_mcontext;
|
mctx = &((ucontext_t *)uap)->uc_mcontext;
|
||||||
rsp = &mctx->gregs[15]; // RSP, 64-bit stack pointer
|
rsp = &mctx->gregs[15]; /* RSP, 64-bit stack pointer */
|
||||||
rip = &mctx->gregs[16]; // RIP, 64-bit instruction pointer
|
rip = &mctx->gregs[16]; /* RIP, 64-bit instruction pointer */
|
||||||
|
|
||||||
debug("(sigsegv) Stack pointer: "mx_pfmt", Instruction pointer: "mx_pfmt"\n",(mx_ptr)*rsp,(mx_ptr)*rip);
|
debug("(sigsegv) Stack pointer: "mx_pfmt", Instruction pointer: "mx_pfmt"\n",(mx_ptr)*rsp,(mx_ptr)*rip);
|
||||||
debug("(sigsegv) sig_segv() = "mx_pfmt"\n",(mx_ptr)sig_segv);
|
debug("(sigsegv) sig_segv() = "mx_pfmt"\n",(mx_ptr)sig_segv);
|
||||||
debug("(sigsegv) do_crash() = "mx_pfmt"\n",(mx_ptr)do_crash);
|
debug("(sigsegv) do_crash() = "mx_pfmt"\n",(mx_ptr)do_crash);
|
||||||
#endif /* __x86_64__ */
|
|
||||||
|
|
||||||
if (debug_on_exit)
|
if (debug_on_exit)
|
||||||
{
|
{
|
||||||
run_debug();
|
run_debug();
|
||||||
debug_on_exit = FALSE;
|
debug_on_exit = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
respawn++;
|
||||||
|
if (respawn > 10)
|
||||||
|
mechexit(1,exit);
|
||||||
|
|
||||||
|
do_exec = TRUE;
|
||||||
|
sig_suicide(TEXT_SIGSEGV /* comma */ UP_CALL(UPTIME_SIGSEGV));
|
||||||
|
/* NOT REACHED */
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* defined(__linux__) && defined(__x86_64__) && defined(DEBUG) && !defined(__STRICT_ANSI__) */
|
||||||
|
|
||||||
|
void sig_segv(int signum)
|
||||||
|
{
|
||||||
|
time(&now);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (debug_on_exit)
|
||||||
|
{
|
||||||
|
run_debug();
|
||||||
|
debug_on_exit = FALSE;
|
||||||
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
respawn++;
|
respawn++;
|
||||||
@ -480,6 +496,8 @@ void sig_segv(int crap, siginfo_t *si, void *uap)
|
|||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* else defined(__linux__) && defined(__x86_64__) && defined(DEBUG) && !defined(__STRICT_ANSI__) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SIGTERM
|
* SIGTERM
|
||||||
*/
|
*/
|
||||||
@ -897,7 +915,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
stat("..",&st);
|
stat("..",&st);
|
||||||
parent_inode = st.st_ino; // used for is_safepath()
|
parent_inode = st.st_ino; /* used for is_safepath() */
|
||||||
|
|
||||||
srand(now+getpid());
|
srand(now+getpid());
|
||||||
|
|
||||||
@ -1018,13 +1036,13 @@ int main(int argc, char **argv, char **envp)
|
|||||||
debug_on_exit = TRUE;
|
debug_on_exit = TRUE;
|
||||||
break;
|
break;
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
case 'e': // run a single command before exiting
|
case 'e': /* run a single command before exiting */
|
||||||
startup = 3;
|
startup = 3;
|
||||||
++argv;
|
++argv;
|
||||||
if (*argv)
|
if (*argv)
|
||||||
{
|
{
|
||||||
//void on_msg(char *from, char *to, char *rest)
|
/*void on_msg(char *from, char *to, char *rest)
|
||||||
//on_msg();
|
on_msg(); */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
to_file(1,"error: Missing argument for -e <command string>\n");
|
to_file(1,"error: Missing argument for -e <command string>\n");
|
||||||
@ -1224,16 +1242,18 @@ int main(int argc, char **argv, char **envp)
|
|||||||
*/
|
*/
|
||||||
if (!makecore)
|
if (!makecore)
|
||||||
{
|
{
|
||||||
|
#if defined(__linux__) && defined(__x86_64__) && defined(DEBUG) && !defined(__STRICT_ANSI__)
|
||||||
struct sigaction s;
|
struct sigaction s;
|
||||||
s.sa_flags = SA_SIGINFO;
|
s.sa_flags = SA_SIGINFO;
|
||||||
sigemptyset(&s.sa_mask);
|
sigemptyset(&s.sa_mask);
|
||||||
s.sa_sigaction = sig_segv;
|
s.sa_sigaction = sig_segv;
|
||||||
if (sigaction(SIGSEGV, &s, NULL) < 0)
|
if (sigaction(SIGSEGV, &s, NULL) < 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
|
||||||
debug("(main) binding SIGSEGV handler failed: %s\n",strerror(errno));
|
debug("(main) binding SIGSEGV handler failed: %s\n",strerror(errno));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
signal(SIGSEGV,sig_segv);
|
||||||
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
signal(SIGILL,sig_ill);
|
signal(SIGILL,sig_ill);
|
||||||
signal(SIGABRT,sig_abrt);
|
signal(SIGABRT,sig_abrt);
|
||||||
|
|||||||
22
src/net.c
22
src/net.c
@ -82,7 +82,7 @@ LS const LinkCmd basicProto[] =
|
|||||||
{ "BQ", basicQuit, RELAY_NO },
|
{ "BQ", basicQuit, RELAY_NO },
|
||||||
{ "CO", netchanNeedop, RELAY_YES },
|
{ "CO", netchanNeedop, RELAY_YES },
|
||||||
#ifdef SUPPRESS
|
#ifdef SUPPRESS
|
||||||
{ "CS", netchanSuppress, RELAY_YES }, // experimental command supression
|
{ "CS", netchanSuppress, RELAY_YES }, /* experimental command supression */
|
||||||
#endif /* SUPPRESS */
|
#endif /* SUPPRESS */
|
||||||
{ "PA", partyAuth, RELAY_YES },
|
{ "PA", partyAuth, RELAY_YES },
|
||||||
#ifdef REDIRECT
|
#ifdef REDIRECT
|
||||||
@ -103,7 +103,7 @@ LS int deadlinks = FALSE;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Mech *get_netbot(void) //get local bot with the lowes guid to act as local master
|
Mech *get_netbot(void) /*get local bot with the lowes guid to act as local master */
|
||||||
{
|
{
|
||||||
Mech *netbot,*bot;
|
Mech *netbot,*bot;
|
||||||
int uid;
|
int uid;
|
||||||
@ -422,7 +422,7 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
#ifdef SHACRYPT
|
#ifdef SHACRYPT
|
||||||
case BNAUTH_SHA:
|
case BNAUTH_SHA:
|
||||||
{
|
{
|
||||||
char *enc,temppass[24 + Strlen2(pass,linkpass)]; // linkpass is never NULL
|
char *enc,temppass[24 + Strlen2(pass,linkpass)]; /* linkpass is never NULL */
|
||||||
|
|
||||||
/* "mypass theirpass REMOTEsid LOCALsid" */
|
/* "mypass theirpass REMOTEsid LOCALsid" */
|
||||||
sprintf(temppass,"%s %s %i %i",linkpass,pass,bn->rsid,bn->lsid);
|
sprintf(temppass,"%s %s %i %i",linkpass,pass,bn->rsid,bn->lsid);
|
||||||
@ -441,7 +441,7 @@ void basicAuth(BotNet *bn, char *rest)
|
|||||||
#ifdef MD5CRYPT
|
#ifdef MD5CRYPT
|
||||||
case BNAUTH_MD5:
|
case BNAUTH_MD5:
|
||||||
{
|
{
|
||||||
char *enc,temppass[24 + Strlen2(pass,linkpass)]; // linkpass is never NULL
|
char *enc,temppass[24 + Strlen2(pass,linkpass)]; /* linkpass is never NULL */
|
||||||
|
|
||||||
/* "mypass theirpass REMOTEsid LOCALsid" */
|
/* "mypass theirpass REMOTEsid LOCALsid" */
|
||||||
sprintf(temppass,"%s %s %i %i",linkpass,pass,bn->rsid,bn->lsid);
|
sprintf(temppass,"%s %s %i %i",linkpass,pass,bn->rsid,bn->lsid);
|
||||||
@ -657,7 +657,7 @@ void basicBanner(BotNet *bn, char *rest)
|
|||||||
if (cfg->pass && *cfg->pass)
|
if (cfg->pass && *cfg->pass)
|
||||||
{
|
{
|
||||||
char *enc,salt[8];
|
char *enc,salt[8];
|
||||||
char temppass[24 + Strlen2(cfg->pass,linkpass)]; // linkpass(procvar) is not NULL
|
char temppass[24 + Strlen2(cfg->pass,linkpass)]; /* linkpass(procvar) is not NULL */
|
||||||
|
|
||||||
/* "theirpass mypass LOCALsid REMOTEsid" */
|
/* "theirpass mypass LOCALsid REMOTEsid" */
|
||||||
sprintf(temppass,"%s %s %i %i",cfg->pass,linkpass,bn->lsid,bn->rsid);
|
sprintf(temppass,"%s %s %i %i",cfg->pass,linkpass,bn->lsid,bn->rsid);
|
||||||
@ -678,7 +678,7 @@ void basicBanner(BotNet *bn, char *rest)
|
|||||||
if (cfg->pass && *cfg->pass)
|
if (cfg->pass && *cfg->pass)
|
||||||
{
|
{
|
||||||
char *enc,salt[8];
|
char *enc,salt[8];
|
||||||
char temppass[24 + Strlen2(cfg->pass,linkpass)]; // linkpass(procvar) is not NULL
|
char temppass[24 + Strlen2(cfg->pass,linkpass)]; /* linkpass(procvar) is not NULL */
|
||||||
|
|
||||||
/* "theirpass mypass LOCALsid REMOTEsid" */
|
/* "theirpass mypass LOCALsid REMOTEsid" */
|
||||||
sprintf(temppass,"%s %s %i %i",cfg->pass,linkpass,bn->lsid,bn->rsid);
|
sprintf(temppass,"%s %s %i %i",cfg->pass,linkpass,bn->lsid,bn->rsid);
|
||||||
@ -869,7 +869,7 @@ void netchanSuppress(BotNet *source, char *rest)
|
|||||||
|
|
||||||
cmd = chop(&rest);
|
cmd = chop(&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 = stringcasecmp(mcmd[i].name,cmd);
|
j = stringcasecmp(mcmd[i].name,cmd);
|
||||||
@ -886,7 +886,7 @@ void netchanSuppress(BotNet *source, char *rest)
|
|||||||
|
|
||||||
crc = asc2int(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)
|
||||||
{
|
{
|
||||||
backup->supres_cmd = cmd;
|
backup->supres_cmd = cmd;
|
||||||
@ -1193,7 +1193,7 @@ void ushareUser(BotNet *bn, char *rest)
|
|||||||
if (user->guid == bn->guid && user->addsession)
|
if (user->guid == bn->guid && user->addsession)
|
||||||
{
|
{
|
||||||
user->addsession = 0;
|
user->addsession = 0;
|
||||||
mirror_user(user); // copy to other local bots
|
mirror_user(user); /* copy to other local bots */
|
||||||
}
|
}
|
||||||
bn->addsession = 0;
|
bn->addsession = 0;
|
||||||
bn->tick++;
|
bn->tick++;
|
||||||
@ -1356,8 +1356,6 @@ void parse_botnet(BotNet *bn, char *rest)
|
|||||||
basicBanner(bn,rest+2);
|
basicBanner(bn,rest+2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if (!stringcmp(rest,telnetprompt)) // another bot sent me its telnetprompt // dont assume identical prompts
|
|
||||||
// return;
|
|
||||||
#ifdef NETCFG
|
#ifdef NETCFG
|
||||||
if (strncmp(rest,"netcfg ",7) == 0)
|
if (strncmp(rest,"netcfg ",7) == 0)
|
||||||
{
|
{
|
||||||
@ -1704,7 +1702,7 @@ usage:
|
|||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
set_mallocdoer(do_link);
|
set_mallocdoer(do_link);
|
||||||
cfg = (NetCfg*)Calloc(sizeof(NetCfg) + StrlenX(pass,host,NULL)); // host might be NULL, StrlenX() handles NULLs, Strlen2() does not.
|
cfg = (NetCfg*)Calloc(sizeof(NetCfg) + StrlenX(pass,host,NULL)); /* host might be NULL, StrlenX() handles NULLs, Strlen2() does not. */
|
||||||
|
|
||||||
cfg->guid = iguid;
|
cfg->guid = iguid;
|
||||||
cfg->port = iport;
|
cfg->port = iport;
|
||||||
|
|||||||
12
src/ons.c
12
src/ons.c
@ -553,7 +553,7 @@ recheck_alias:
|
|||||||
|
|
||||||
#ifdef SUPPRESS
|
#ifdef SUPPRESS
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
// experimental command supression
|
/* experimental command supression */
|
||||||
if (CurrentCmd->name == current->supres_cmd)
|
if (CurrentCmd->name == current->supres_cmd)
|
||||||
{
|
{
|
||||||
int crc;
|
int crc;
|
||||||
@ -561,7 +561,7 @@ recheck_alias:
|
|||||||
crc = makecrc(rest);
|
crc = makecrc(rest);
|
||||||
if (current->supres_crc == crc)
|
if (current->supres_crc == crc)
|
||||||
{
|
{
|
||||||
// another bot has already executed this command and is trying to supress its execution on other bots
|
/* another bot has already executed this command and is trying to supress its execution on other bots */
|
||||||
current->supres_cmd = NULL;
|
current->supres_cmd = NULL;
|
||||||
current->supres_crc = 0;
|
current->supres_crc = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -570,7 +570,7 @@ recheck_alias:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if command should be supressed ...
|
/*if command should be supressed ... */
|
||||||
if (mcmd[i].supres && CurrentChan)
|
if (mcmd[i].supres && CurrentChan)
|
||||||
{
|
{
|
||||||
send_suppress(CurrentCmd->name,rest);
|
send_suppress(CurrentCmd->name,rest);
|
||||||
@ -925,7 +925,7 @@ modeloop:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* whats this??? */
|
/* whats this??? */
|
||||||
shit = get_shituser(parm,channel); // calls find_shit? clobbers get_nuh buffer
|
shit = get_shituser(parm,channel); /* calls find_shit? clobbers get_nuh buffer */
|
||||||
i = (shit) ? shit->action : 0;
|
i = (shit) ? shit->action : 0;
|
||||||
if (i < SHIT_PERMABAN)
|
if (i < SHIT_PERMABAN)
|
||||||
{
|
{
|
||||||
@ -1047,7 +1047,7 @@ void common_public(Chan *chan, char *from, char *spyformat, char *rest)
|
|||||||
|
|
||||||
doer = find_chanuser(chan,from);
|
doer = find_chanuser(chan,from);
|
||||||
|
|
||||||
// check if more than half of rest is caps
|
/* check if more than half of rest is caps */
|
||||||
n = upper = 0;
|
n = upper = 0;
|
||||||
while(rest[n])
|
while(rest[n])
|
||||||
{
|
{
|
||||||
@ -1056,7 +1056,7 @@ void common_public(Chan *chan, char *from, char *spyformat, char *rest)
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// trigger caps flood action
|
/* trigger caps flood action */
|
||||||
if (upper >= n)
|
if (upper >= n)
|
||||||
{
|
{
|
||||||
if (check_mass(chan,doer,INT_CKL))
|
if (check_mass(chan,doer,INT_CKL))
|
||||||
|
|||||||
44
src/parse.c
44
src/parse.c
@ -437,8 +437,8 @@ void parse_privmsg(char *from, char *rest)
|
|||||||
{
|
{
|
||||||
if (tolowertab[src[1]] == 't' && tolowertab[src[2]] == 't' && tolowertab[src[3]] == 'p')
|
if (tolowertab[src[1]] == 't' && tolowertab[src[2]] == 't' && tolowertab[src[3]] == 'p')
|
||||||
{
|
{
|
||||||
if ((src[4] == ':') || // "http:"
|
if ((src[4] == ':') || /* "http:" */
|
||||||
(tolowertab[src[4]] == 's' && src[5] == ':')) // "https:"
|
(tolowertab[src[4]] == 's' && src[5] == ':')) /* "https:" */
|
||||||
{
|
{
|
||||||
urlcapture(src);
|
urlcapture(src);
|
||||||
}
|
}
|
||||||
@ -854,7 +854,7 @@ void parse_319(char *from, char *rest)
|
|||||||
|
|
||||||
send_pa(PA_WHOIS,nick,"Channels: %s",rest);
|
send_pa(PA_WHOIS,nick,"Channels: %s",rest);
|
||||||
|
|
||||||
// if nick is myself (the bot), check for reset recovery
|
/* if nick is myself (the bot), check for reset recovery */
|
||||||
if (!nickcmp(nick,current->nick))
|
if (!nickcmp(nick,current->nick))
|
||||||
{
|
{
|
||||||
if (current->reset)
|
if (current->reset)
|
||||||
@ -869,7 +869,7 @@ loop:
|
|||||||
/*
|
/*
|
||||||
* skip past '+', '-' and '@', etc.
|
* skip past '+', '-' and '@', etc.
|
||||||
*/
|
*/
|
||||||
while(*channel && *channel != '#') // this is a recipe for disaster with other valid channels than '#'
|
while(*channel && *channel != '#') /* this is a recipe for disaster with other valid channels than '#' */
|
||||||
channel++;
|
channel++;
|
||||||
sprintf(nuh,"%s!%s",current->nick,current->userhost);
|
sprintf(nuh,"%s!%s",current->nick,current->userhost);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -890,7 +890,7 @@ loop:
|
|||||||
*/
|
*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check if all sendq is empty (text, kicks and modes)
|
/* check if all sendq is empty (text, kicks and modes) */
|
||||||
if (current->sendq)
|
if (current->sendq)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -898,7 +898,7 @@ loop:
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// CurrentChan is unset and can be used
|
/* CurrentChan is unset and can be used */
|
||||||
for(CurrentChan=current->chanlist;CurrentChan;CurrentChan=CurrentChan->next)
|
for(CurrentChan=current->chanlist;CurrentChan;CurrentChan=CurrentChan->next)
|
||||||
{
|
{
|
||||||
if (CurrentChan->kicklist || CurrentChan->modelist)
|
if (CurrentChan->kicklist || CurrentChan->modelist)
|
||||||
@ -910,11 +910,11 @@ loop:
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_319) Cb: checking %s\n",channel);
|
debug("(parse_319) Cb: checking %s\n",channel);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (*channel == '@' || *channel == '+') // opped/voiced user, spin 1
|
if (*channel == '@' || *channel == '+') /* opped/voiced user, spin 1 */
|
||||||
channel++;
|
channel++;
|
||||||
// other user modes might also be present (crazy ircd's), this is insufficient testing
|
/* other user modes might also be present (crazy ircd's), this is insufficient testing */
|
||||||
|
|
||||||
// check if the channel is shitted
|
/* check if the channel is shitted */
|
||||||
for(shit=current->shitlist;shit;shit=shit->next)
|
for(shit=current->shitlist;shit;shit=shit->next)
|
||||||
{
|
{
|
||||||
if (!matches(shit->mask,channel))
|
if (!matches(shit->mask,channel))
|
||||||
@ -1347,7 +1347,7 @@ void parse_005(char *from, char *rest)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
while(*s)
|
while(*s)
|
||||||
{
|
{
|
||||||
//CHANMODES=beIR,k,l,imnpstaqr
|
/*CHANMODES=beIR,k,l,imnpstaqr */
|
||||||
if (*s == 'e')
|
if (*s == 'e')
|
||||||
{
|
{
|
||||||
current->ircx_flags |= IRCX_EMODE;
|
current->ircx_flags |= IRCX_EMODE;
|
||||||
@ -1471,8 +1471,8 @@ void parseline(char *rest)
|
|||||||
if (current->spy & SPYF_RAWIRC)
|
if (current->spy & SPYF_RAWIRC)
|
||||||
send_spy(SPYSTR_RAWIRC,FMT_PLAIN,rest);
|
send_spy(SPYSTR_RAWIRC,FMT_PLAIN,rest);
|
||||||
|
|
||||||
//new undernet amusements
|
/*new undernet amusements */
|
||||||
//(in) {5} NOTICE AUTH :*** You have identd disabled (or broken), to continue to connect you must type /QUOTE PASS 17071
|
/*(in) {5} NOTICE AUTH :*** You have identd disabled (or broken), to continue to connect you must type /QUOTE PASS 17071 */
|
||||||
if (current->connect == CN_CONNECTED && *rest == 'N' && !matches("NOTICE AUTH * /QUOTE PASS *",rest))
|
if (current->connect == CN_CONNECTED && *rest == 'N' && !matches("NOTICE AUTH * /QUOTE PASS *",rest))
|
||||||
{
|
{
|
||||||
from = STREND(rest);
|
from = STREND(rest);
|
||||||
@ -1526,7 +1526,7 @@ void parseline(char *rest)
|
|||||||
|
|
||||||
cmdhash = stringhash(command);
|
cmdhash = stringhash(command);
|
||||||
|
|
||||||
//debug("cmdhash = %08X\n",cmdhash);
|
/*debug("cmdhash = %08X\n",cmdhash); */
|
||||||
for(i=0;pFuncs[i].hash;i++)
|
for(i=0;pFuncs[i].hash;i++)
|
||||||
{
|
{
|
||||||
if (cmdhash == pFuncs[i].hash)
|
if (cmdhash == pFuncs[i].hash)
|
||||||
@ -1539,21 +1539,5 @@ void parseline(char *rest)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//debug("unmatched cmdhash %08X\n",cmdhash);
|
/*debug("unmatched cmdhash %08X\n",cmdhash); */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
(in) {2} :weber.freenode.net PONG weber.freenode.net :OT1521044136
|
|
||||||
cmdhash = 504F4E47
|
|
||||||
unmatched cmdhash 504F4E47
|
|
||||||
|
|
||||||
(in) {2} :weber.freenode.net 347 jooboy #amdx :End of Channel Invite List
|
|
||||||
cmdhash = 00333437
|
|
||||||
unmatched cmdhash 00333437
|
|
||||||
|
|
||||||
(in) {2} :weber.freenode.net 349 jooboy #amdx :End of Channel Exception List
|
|
||||||
cmdhash = 00333439
|
|
||||||
unmatched cmdhash 00333439
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|||||||
36
src/prot.c
36
src/prot.c
@ -51,7 +51,7 @@ void send_kick(Chan *chan, const char *nick, const char *format, ...)
|
|||||||
pp = &(*pp)->next;
|
pp = &(*pp)->next;
|
||||||
|
|
||||||
set_mallocdoer(send_kick);
|
set_mallocdoer(send_kick);
|
||||||
*pp = new = (qKick*)Calloc(sizeof(qKick) + Strlen2(nick,globaldata)); // globaldata is never NULL
|
*pp = new = (qKick*)Calloc(sizeof(qKick) + Strlen2(nick,globaldata)); /* globaldata is never NULL */
|
||||||
/* Calloc sets to zero new->next = NULL; */
|
/* Calloc sets to zero new->next = NULL; */
|
||||||
|
|
||||||
new->reason = stringcpy(new->nick,nick) + 1;
|
new->reason = stringcpy(new->nick,nick) + 1;
|
||||||
@ -299,22 +299,22 @@ int check_mass(Chan *chan, ChanUser *doer, int type)
|
|||||||
/*
|
/*
|
||||||
* two things we dont want channel users to do
|
* two things we dont want channel users to do
|
||||||
*/
|
*/
|
||||||
//case CHK_CAPS:
|
/*case CHK_CAPS: */
|
||||||
case INT_CKL:
|
case INT_CKL:
|
||||||
num = INDEX_CAPS;
|
num = INDEX_CAPS;
|
||||||
break;
|
break;
|
||||||
//case CHK_PUB:
|
/*case CHK_PUB: */
|
||||||
case INT_FL:
|
case INT_FL:
|
||||||
num = INDEX_FLOOD;
|
num = INDEX_FLOOD;
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
* three things we dont want channel ops to do
|
* three things we dont want channel ops to do
|
||||||
*/
|
*/
|
||||||
//case CHK_DEOP:
|
/*case CHK_DEOP: */
|
||||||
case INT_MDL:
|
case INT_MDL:
|
||||||
num = INDEX_DEOP;
|
num = INDEX_DEOP;
|
||||||
break;
|
break;
|
||||||
//case CHK_BAN:
|
/*case CHK_BAN: */
|
||||||
case INT_MBL:
|
case INT_MBL:
|
||||||
num = INDEX_BAN;
|
num = INDEX_BAN;
|
||||||
break;
|
break;
|
||||||
@ -502,7 +502,7 @@ void process_chanbans(void)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (current->sendq) // only do chanbans on empty queue
|
if (current->sendq) /* only do chanbans on empty queue */
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(process_chanbans) skipping %s (%i), sendq not empty\n",current->nick,current->guid);
|
debug("(process_chanbans) skipping %s (%i), sendq not empty\n",current->nick,current->guid);
|
||||||
@ -513,7 +513,7 @@ void process_chanbans(void)
|
|||||||
selcu = NULL;
|
selcu = NULL;
|
||||||
for(anychan=current->chanlist;anychan;anychan=anychan->next)
|
for(anychan=current->chanlist;anychan;anychan=anychan->next)
|
||||||
{
|
{
|
||||||
if (anychan->modelist || anychan->kicklist) // only do chanbans on empty queue
|
if (anychan->modelist || anychan->kicklist) /* only do chanbans on empty queue */
|
||||||
goto has_queue;
|
goto has_queue;
|
||||||
if (anychan->setting[TOG_CHANBAN].int_var && anychan->bot_is_op)
|
if (anychan->setting[TOG_CHANBAN].int_var && anychan->bot_is_op)
|
||||||
{
|
{
|
||||||
@ -554,24 +554,24 @@ void chanban_action(char *nick, char *channel, Shit *shit)
|
|||||||
ChanUser *cu;
|
ChanUser *cu;
|
||||||
char *nuh;
|
char *nuh;
|
||||||
|
|
||||||
// the channel is shitted and the user is on it...
|
/* the channel is shitted and the user is on it...
|
||||||
// 1, make sure the bot isnt on the channel
|
1, make sure the bot isnt on the channel
|
||||||
// 2, kb the user on all channels where the shit is active and i am op
|
2, kb the user on all channels where the shit is active and i am op */
|
||||||
|
|
||||||
// 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 (!stringcasecmp(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);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// is the shit for this channel?
|
/* is the shit for this channel? */
|
||||||
if (!stringcasecmp(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)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -579,17 +579,17 @@ void chanban_action(char *nick, char *channel, Shit *shit)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
cu = find_chanuser(CurrentChan,nick);
|
cu = find_chanuser(CurrentChan,nick);
|
||||||
if (!(cu->flags & CU_CHANBAN))
|
if (!(cu->flags & CU_CHANBAN))
|
||||||
// dont kickban the same user multiple times from the same channel
|
/* dont kickban the same user multiple times from the same channel */
|
||||||
{
|
{
|
||||||
nuh = get_nuh(cu); // clobbers nuh_buf
|
nuh = get_nuh(cu); /* clobbers nuh_buf */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(chanban_action) slapping %s on %s for being on %s (mask %s): %s\n",
|
debug("(chanban_action) slapping %s on %s for being on %s (mask %s): %s\n",
|
||||||
nick,CurrentChan->name,channel,shit->mask,shit->reason);
|
nick,CurrentChan->name,channel,shit->mask,shit->reason);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
cu->flags |= CU_CHANBAN;
|
cu->flags |= CU_CHANBAN;
|
||||||
format_uh(nuh,1); // returns mask in 'nuh' buffer (nuh_buf)
|
format_uh(nuh,1); /* returns mask in 'nuh' buffer (nuh_buf) */
|
||||||
send_mode(CurrentChan,90,QM_RAWMODE,'+','b',(void*)nuh);
|
send_mode(CurrentChan,90,QM_RAWMODE,'+','b',(void*)nuh);
|
||||||
send_kick(CurrentChan,nick,"%s (%s)",shit->reason,channel); // clobbers globaldata
|
send_kick(CurrentChan,nick,"%s (%s)",shit->reason,channel); /* clobbers globaldata */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/reset.c
16
src/reset.c
@ -48,7 +48,7 @@ char *recover_client(char *env)
|
|||||||
if (env[8] != ':')
|
if (env[8] != ':')
|
||||||
return(env);
|
return(env);
|
||||||
|
|
||||||
memcpy(axx.asc,env,8); // compiler is not stupid and will optimize the shit out of this
|
memcpy(axx.asc,env,8); /* compiler is not stupid and will optimize the shit out of this */
|
||||||
guid = getaxx(axx.num[0]);
|
guid = getaxx(axx.num[0]);
|
||||||
fd = getaxx(axx.num[1]);
|
fd = getaxx(axx.num[1]);
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ char *recover_debug(char *env)
|
|||||||
/*
|
/*
|
||||||
* get the fd number
|
* get the fd number
|
||||||
*/
|
*/
|
||||||
memcpy(axx.asc,env,4); // compiler is not stupid and will optimize the shit out of this
|
memcpy(axx.asc,env,4); /* compiler is not stupid and will optimize the shit out of this */
|
||||||
debug_fd = getaxx(axx.num);
|
debug_fd = getaxx(axx.num);
|
||||||
|
|
||||||
if (fstat(debug_fd,&s) < 0)
|
if (fstat(debug_fd,&s) < 0)
|
||||||
@ -207,7 +207,7 @@ char *recover_server(char *env)
|
|||||||
if (env[sz] != ' ' && env[sz] != 0)
|
if (env[sz] != ' ' && env[sz] != 0)
|
||||||
return(env);
|
return(env);
|
||||||
|
|
||||||
memcpy(axx.asc,env,sz); // compiler is not stupid and will optimize the shit out of this
|
memcpy(axx.asc,env,sz); /* compiler is not stupid and will optimize the shit out of this */
|
||||||
env += sz;
|
env += sz;
|
||||||
guid = getaxx(axx.num[0]);
|
guid = getaxx(axx.num[0]);
|
||||||
fd = getaxx(axx.num[1]);
|
fd = getaxx(axx.num[1]);
|
||||||
@ -247,8 +247,8 @@ char *recover_server(char *env)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we recover a guid:socket without a matching bot in config, it got removed or changed guid
|
/* if we recover a guid:socket without a matching bot in config, it got removed or changed guid */
|
||||||
// if the guid changed, we cant guess which old<-->new is the matching one so
|
/* if the guid changed, we cant guess which old<-->new is the matching one so */
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
to_file(fd,"QUIT :I'm no longer wanted *cry*\n");
|
to_file(fd,"QUIT :I'm no longer wanted *cry*\n");
|
||||||
@ -257,8 +257,10 @@ char *recover_server(char *env)
|
|||||||
return(env);
|
return(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
//(do_reset) MECHRESET=dC@@@ fXIGE@A@@@L@@@ tIGE@F@@@:joo [44]
|
/*
|
||||||
//execve( ./energymech, argv = { ./energymech <NULL> <NULL> <NULL> <NULL> }, envp = { MECHRESET=dC@@@ fXIGE@A@@@L@@@ tIGE@F@@@:joo } )
|
(do_reset) MECHRESET=dC@@@ fXIGE@A@@@L@@@ tIGE@F@@@:joo [44]
|
||||||
|
execve( ./energymech, argv = { ./energymech <NULL> <NULL> <NULL> <NULL> }, envp = { MECHRESET=dC@@@ fXIGE@A@@@L@@@ tIGE@F@@@:joo } )
|
||||||
|
*/
|
||||||
|
|
||||||
void recover_reset(void)
|
void recover_reset(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -258,7 +258,7 @@ int begin_redirect(char *from, char *args)
|
|||||||
to_user(from,"Missing name for redirect.");
|
to_user(from,"Missing name for redirect.");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
if (is_safepath(nick,FILE_MAY_EXIST) != FILE_IS_SAFE) // redirect output is appended
|
if (is_safepath(nick,FILE_MAY_EXIST) != FILE_IS_SAFE) /* redirect output is appended */
|
||||||
{
|
{
|
||||||
to_user(from,"Bad filename.");
|
to_user(from,"Bad filename.");
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -606,9 +606,9 @@ guid_ok:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sz = spy_source(from,&t_src,&src);
|
sz = spy_source(from,&t_src,&src);
|
||||||
if (sz < 0) // user has insufficient access to source
|
if (sz < 0) /* user has insufficient access to source */
|
||||||
goto spy_usage;
|
goto spy_usage;
|
||||||
if (sz < cmdaccess) // user has less access relative to source than the command level of SPY
|
if (sz < cmdaccess) /* user has less access relative to source than the command level of SPY */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ guid_ok:
|
|||||||
*/
|
*/
|
||||||
if (*dest == '>')
|
if (*dest == '>')
|
||||||
{
|
{
|
||||||
// accept both ">file" and "> file"
|
/* accept both ">file" and "> file" */
|
||||||
dest++;
|
dest++;
|
||||||
if (!*dest)
|
if (!*dest)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,7 +63,7 @@ typedef struct OnMsg
|
|||||||
lbuf:1,
|
lbuf:1,
|
||||||
cbang:1,
|
cbang:1,
|
||||||
acchan:1,
|
acchan:1,
|
||||||
supres:1; // -- 21 bits
|
supres:1; /* -- 21 bits */
|
||||||
const char *cmdarg;
|
const char *cmdarg;
|
||||||
|
|
||||||
} OnMsg;
|
} OnMsg;
|
||||||
@ -206,7 +206,6 @@ typedef struct Setting
|
|||||||
char **strptr;
|
char **strptr;
|
||||||
|
|
||||||
} v;
|
} v;
|
||||||
//void *setto; /* type-casted to whatever */
|
|
||||||
char *name;
|
char *name;
|
||||||
int max;
|
int max;
|
||||||
void (*func)(const struct Setting *);
|
void (*func)(const struct Setting *);
|
||||||
@ -711,7 +710,7 @@ typedef struct NetCfg
|
|||||||
|
|
||||||
uint16_t guid;
|
uint16_t guid;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
uint16_t linked; //:1;
|
uint16_t linked; /*:1;*/
|
||||||
|
|
||||||
char *host;
|
char *host;
|
||||||
char pass[2];
|
char pass[2];
|
||||||
@ -748,12 +747,12 @@ typedef struct
|
|||||||
{
|
{
|
||||||
time_t last;
|
time_t last;
|
||||||
time_t next;
|
time_t next;
|
||||||
uint32_t second1; //:30;
|
uint32_t second1; /*:30;*/
|
||||||
uint32_t second2; //:30;
|
uint32_t second2; /*:30;*/
|
||||||
uint32_t minute1; //:30;
|
uint32_t minute1; /*:30;*/
|
||||||
uint32_t minute2; //:30;
|
uint32_t minute2; /*:30;*/
|
||||||
uint32_t hour; //:24;
|
uint32_t hour; /*:24;*/
|
||||||
uint32_t weekday; //:7;
|
uint32_t weekday; /*:7;*/
|
||||||
|
|
||||||
} HookTimer;
|
} HookTimer;
|
||||||
|
|
||||||
|
|||||||
@ -473,7 +473,7 @@ char *random_question(char *triv_rand)
|
|||||||
|
|
||||||
} entry;
|
} entry;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
stringcat(stringcpy(tmpname,"trivia/"),triv_qfile);
|
stringcat(stringcpy(tmpname,"trivia/"),triv_qfile);
|
||||||
@ -727,11 +727,11 @@ void do_bigsay(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
temp = chop(&rest);
|
temp = chop(&rest);
|
||||||
if (temp[1] == '-')
|
if (temp[1] == '-')
|
||||||
; // allow .bigsay -- -dash-
|
; /* allow .bigsay -- -dash- */
|
||||||
else
|
else
|
||||||
if (STRCHR(temp,'/') == NULL) // no filesystem perversions...
|
if (STRCHR(temp,'/') == NULL) /* no filesystem perversions... */
|
||||||
{
|
{
|
||||||
stringcat(stringcpy(output,temp+1),".bigchars"); // temp+1 = skip initial '-'
|
stringcat(stringcpy(output,temp+1),".bigchars"); /* temp+1 = skip initial '-' */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|||||||
45
src/user.c
45
src/user.c
@ -306,7 +306,7 @@ int read_userlist(char *filename)
|
|||||||
debug("(read_userlist) filename is NULL\n");
|
debug("(read_userlist) filename is NULL\n");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (*filename == '<') // read only userfile
|
if (*filename == '<') /* read only userfile */
|
||||||
filename++;
|
filename++;
|
||||||
if ((r = is_safepath(filename,FILE_MAY_EXIST)) != FILE_IS_SAFE)
|
if ((r = is_safepath(filename,FILE_MAY_EXIST)) != FILE_IS_SAFE)
|
||||||
{
|
{
|
||||||
@ -335,7 +335,7 @@ int read_userlist(char *filename)
|
|||||||
#endif /* NEWBIE */
|
#endif /* NEWBIE */
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (*filename == '<') // read only userfile
|
if (*filename == '<') /* read only userfile */
|
||||||
filename++;
|
filename++;
|
||||||
if (is_safepath(filename,FILE_MAY_EXIST) != FILE_IS_SAFE)
|
if (is_safepath(filename,FILE_MAY_EXIST) != FILE_IS_SAFE)
|
||||||
{
|
{
|
||||||
@ -410,7 +410,7 @@ int write_userlist(char *filename)
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (*filename == '<') // we dont write to read only userfiles
|
if (*filename == '<') /* we dont write to read only userfiles */
|
||||||
{
|
{
|
||||||
debug("(write_userlist) %s: writing to read only userfile is prohibited...\n",filename);
|
debug("(write_userlist) %s: writing to read only userfile is prohibited...\n",filename);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -421,7 +421,7 @@ int write_userlist(char *filename)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (*filename == '<') // we dont write to read only userfiles
|
if (*filename == '<') /* we dont write to read only userfiles */
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
if (is_safepath(filename,FILE_MAY_EXIST) != FILE_IS_SAFE)
|
if (is_safepath(filename,FILE_MAY_EXIST) != FILE_IS_SAFE)
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
@ -574,7 +574,7 @@ void mirror_user(User *user)
|
|||||||
backup = current;
|
backup = current;
|
||||||
for(anybot=botlist;anybot;anybot=anybot->next)
|
for(anybot=botlist;anybot;anybot=anybot->next)
|
||||||
{
|
{
|
||||||
if (anybot == backup) // dont try to copy to myself, bad things will happen
|
if (anybot == backup) /* dont try to copy to myself, bad things will happen */
|
||||||
continue;
|
continue;
|
||||||
for(olduser=anybot->userlist;olduser;olduser=olduser->next)
|
for(olduser=anybot->userlist;olduser;olduser=olduser->next)
|
||||||
{
|
{
|
||||||
@ -604,10 +604,10 @@ void mirror_user(User *user)
|
|||||||
notes = olduser->note;
|
notes = olduser->note;
|
||||||
olduser->note = NULL;
|
olduser->note = NULL;
|
||||||
#endif /* NOTE */
|
#endif /* NOTE */
|
||||||
remove_user(olduser); // uses current->userlist
|
remove_user(olduser); /* uses current->userlist */
|
||||||
// authlist/chanuserlist/dcclist is now a minefield
|
/* authlist/chanuserlist/dcclist is now a minefield */
|
||||||
}
|
}
|
||||||
newuser = add_user(user->name,user->pass,user->x.x.access); // uses current->userlist
|
newuser = add_user(user->name,user->pass,user->x.x.access); /* uses current->userlist */
|
||||||
if (olduser)
|
if (olduser)
|
||||||
{
|
{
|
||||||
#ifdef NOTE
|
#ifdef NOTE
|
||||||
@ -616,26 +616,26 @@ void mirror_user(User *user)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(1)\n");
|
debug("(1)\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
reset_userlink(olduser,newuser); // uses current->userlist
|
reset_userlink(olduser,newuser); /* uses current->userlist */
|
||||||
// authlist/chanuserlist/dcclist should now be safe again.
|
/* authlist/chanuserlist/dcclist should now be safe again. */
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(2)\n");
|
debug("(2)\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
dupe_strp(user->mask,&newuser->mask); // copy masks
|
dupe_strp(user->mask,&newuser->mask); /* copy masks */
|
||||||
dupe_strp(user->chan,&newuser->chan); // copy channels
|
dupe_strp(user->chan,&newuser->chan); /* copy channels */
|
||||||
// do not copy notes (creates spam)
|
/* do not copy notes (creates spam) */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(3)\n");
|
debug("(3)\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
newuser->x.comboflags = user->x.comboflags;
|
newuser->x.comboflags = user->x.comboflags;
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
newuser->x.x.readonly = 0; // dont copy the RO flag
|
newuser->x.x.readonly = 0; /* dont copy the RO flag */
|
||||||
newuser->modcount = user->modcount;
|
newuser->modcount = user->modcount;
|
||||||
newuser->tick = user->tick; // is this proper???
|
newuser->tick = user->tick; /* is this proper??? */
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
}
|
}
|
||||||
current = backup; // assume my old identity
|
current = backup; /* assume my old identity */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(mirror_user) %s[%i] finished\n",user->name,user->x.x.access);
|
debug("(mirror_user) %s[%i] finished\n",user->name,user->x.x.access);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -772,7 +772,7 @@ User *add_user(char *handle, char *pass, int axs)
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
set_mallocdoer(add_user);
|
set_mallocdoer(add_user);
|
||||||
user = (User*)Calloc(sizeof(User) + StrlenX(handle,pass,NULL)); // StrlenX() tolerates pass being NULL, Strlen2() does not.
|
user = (User*)Calloc(sizeof(User) + StrlenX(handle,pass,NULL)); /* StrlenX() tolerates pass being NULL, Strlen2() does not. */
|
||||||
user->x.x.access = axs;
|
user->x.x.access = axs;
|
||||||
user->next = current->userlist;
|
user->next = current->userlist;
|
||||||
current->userlist = user;
|
current->userlist = user;
|
||||||
@ -1266,7 +1266,7 @@ void do_user(COMMAND_ARGS)
|
|||||||
/*
|
/*
|
||||||
* convert and check nick/mask
|
* convert and check nick/mask
|
||||||
*/
|
*/
|
||||||
if ((mask = nick2uh(from,nick)) == NULL) // nick2uh uses nuh_buf
|
if ((mask = nick2uh(from,nick)) == NULL) /* nick2uh uses nuh_buf */
|
||||||
return;
|
return;
|
||||||
stringcpy(tmpmask,mask);
|
stringcpy(tmpmask,mask);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -1279,7 +1279,7 @@ void do_user(COMMAND_ARGS)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* NEWBIE */
|
#endif /* NEWBIE */
|
||||||
format_uh(tmpmask,FUH_USERHOST); // format_uh uses local temporary buffer but copies result back into tmpmask
|
format_uh(tmpmask,FUH_USERHOST); /* format_uh uses local temporary buffer but copies result back into tmpmask */
|
||||||
/*
|
/*
|
||||||
* dont duplicate users
|
* dont duplicate users
|
||||||
*/
|
*/
|
||||||
@ -1302,8 +1302,8 @@ void do_user(COMMAND_ARGS)
|
|||||||
* add_user() touches current->ul_save for us
|
* add_user() touches current->ul_save for us
|
||||||
*/
|
*/
|
||||||
user = add_user(handle,encpass,newaccess);
|
user = add_user(handle,encpass,newaccess);
|
||||||
addtouser(&user->mask,tmpmask,FALSE); // does not run rehash_chanusers(), does not clobber nuh_buf
|
addtouser(&user->mask,tmpmask,FALSE); /* does not run rehash_chanusers(), does not clobber nuh_buf */
|
||||||
addtouser(&user->chan,chan,TRUE); // clobbers nuh_buf
|
addtouser(&user->chan,chan,TRUE); /* clobbers nuh_buf */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(do_user) from %s, handle %s,\n\tmask %s, chan %s\n",from,handle,tmpmask,chan);
|
debug("(do_user) from %s, handle %s,\n\tmask %s, chan %s\n",from,handle,tmpmask,chan);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -1505,9 +1505,8 @@ usage:
|
|||||||
to_user(from,"Problem adding %s (global mask)",mask);
|
to_user(from,"Problem adding %s (global mask)",mask);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* With ipv6 and other funky crap, this is no longer suitable */
|
||||||
/*
|
/*
|
||||||
// With ipv6 and other funky crap, this is no longer suitable
|
|
||||||
|
|
||||||
if (matches("*@?*.?*",mask))
|
if (matches("*@?*.?*",mask))
|
||||||
{
|
{
|
||||||
to_user(from,"Problem adding %s (invalid mask)",mask);
|
to_user(from,"Problem adding %s (invalid mask)",mask);
|
||||||
|
|||||||
@ -404,7 +404,7 @@ second_pass:
|
|||||||
|
|
||||||
varval = (IsProc(i)) ? current->setting[i].proc_var : &univar[i];
|
varval = (IsProc(i)) ? current->setting[i].proc_var : &univar[i];
|
||||||
|
|
||||||
sz = Strlen2(tmp,VarName[i].name); // VarName[i].name is never NULL
|
sz = Strlen2(tmp,VarName[i].name); /* VarName[i].name is never NULL */
|
||||||
|
|
||||||
if (IsStr(i))
|
if (IsStr(i))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user