Merge pull request #4 from joonicks/dev

compiles clean using -std=c89
This commit is contained in:
joonicks 2018-04-24 18:28:45 +02:00 committed by GitHub
commit 9013dde1dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 294 additions and 259 deletions

View File

@ -1,5 +1,6 @@
3.1 -- WORK IN PROGRESS (~April, 2018)
* Fixed: Compiles clean with -std=c89
* Added: $guid to esay variables
* Added: New bigsay font: spider, use with .bigsay -spider cowabunga!
* Fixed: Error in printing pointers would make lots of debug output go missing

107
configure vendored
View File

@ -379,7 +379,11 @@ __EOT__
exit 0
;;
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"
@ -441,44 +445,13 @@ fi
echo $ac_t "$cf_SYSMACH"
#
#
#
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
CCshort=
has_musl=no
#
# if directed to use libmusl instead of (g)libc ...
#
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`
if [ -x "$mgcc" ]; then
CC="$mgcc"
@ -496,15 +469,47 @@ if [ ! "$try_libmusl" = no ]; then
CC=/opt/musl/bin/musl-gcc
fi
CCshort=$CC
echo $ac_t yes
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?
#
TESTC=config/cc.c
echo $ac_n "checking whether $CC works or not ... "$ac_c
$CC -o $TESTP $TESTC 1> /dev/null 2> /dev/null
WORK=no
@ -543,13 +548,23 @@ fi
#
# compiler flags
#
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
#
if [ -z "$cc_g_opt" ]; then
if [ -z "$cf_cflags" -a -z "$cc_g_opt" ]; then
cc_g_opt=no
if $CC -g -c -o $TESTO $TESTC 1> /dev/null 2> /dev/null && test -r $TESTO; then
cc_g_opt=yes
@ -557,10 +572,11 @@ if [ -z "$cc_g_opt" ]; then
echo $ac_n "-g "$ac_c
fi
fi
#
# GNU GCC
#
if [ -n "$cf_GNUCC" ]; then
if [ -z "$cf_cflags" -a -n "$cf_GNUCC" ]; then
#
# -Wall -Wshadow
#
@ -611,7 +627,7 @@ if [ -n "$cf_GNUCC" ]; then
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
cc_pipe_flag="-pipe"
echo $ac_n "-pipe "$ac_c
@ -623,7 +639,7 @@ if [ "$optitype" = size ]; then
oflag="-Os"
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
cc_optimize_flag="$oflag"
echo $ac_n "$oflag "$ac_c
@ -1413,6 +1429,10 @@ lflags="$cc_g_flag -o"
cprof="$cc_pg_flag $cc_pg_define"
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
sed "
s%@CC@%$CCshort%;
@ -1425,6 +1445,7 @@ s%@gdbflag@%$cc_g_flag%;
/@libflags@/ { s,@libflags@,$libflags,; };
/@W_FLAGS@/ { s/@W_FLAGS@/$W_FLAGS/; };
/@O_FLAGS@/ { s/@O_FLAGS@/$O_FLAGS/; };
/@CFLAGS@/ { s/@CFLAGS@/$cf_cflags/; };
/@I_PERL@/ { s,@I_PERL@,$I_PERL,; };
/@L_PERL@/ { s,@L_PERL@,$L_PERL,; };
/@PYINCLUDE@/ { s,@PYINCLUDE@,$incpython,; };
@ -1552,5 +1573,3 @@ $out 'Submit your bugreports at https://github.com/MadCamel/energymech/issues'
$out ''
$out 'You have read the README file I hope?'
$out ''

View File

@ -34,7 +34,7 @@ TCLINCLUDE = @TCLINCLUDE@
I_PERL = @I_PERL@
L_PERL = @L_PERL@
CFLAGS = $(PIPEFLAG) $(GDBFLAG) $(WARNFLAG) $(OPTIMIZE)
CFLAGS = @CFLAGS@
LFLAGS = $(PIPEFLAG) $(GDBFLAG)
CC = @CC@

View File

@ -53,7 +53,7 @@ int main(int argc, char **argv)
strcpy(CurrentNick,"noob");
if (format == NULL)
{
// testcases
/* testcases */
testcase("cmd","cmd");
testcase("cmd cmd","cmd cmd");
testcase("cmd $$","cmd $");
@ -132,7 +132,7 @@ void afmt(char *copy_to, const char *src, const char *input)
{
if (*argstart == ' ')
{
while(*argstart == ' ') // skip multiple spaces
while(*argstart == ' ') /* skip multiple spaces */
argstart++;
if (++spc >= startnum)
break;
@ -145,7 +145,7 @@ void afmt(char *copy_to, const char *src, const char *input)
{
if (++spc > endnum)
break;
while(*argend == ' ') // skip multiple spaces
while(*argend == ' ') /* skip multiple spaces */
argend++;
}
}

View File

@ -292,7 +292,7 @@ Ban *make_ban(Ban **banlist, char *from, char *banmask, time_t when)
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);
new = (Ban*)Calloc(sz);
@ -460,7 +460,7 @@ void channel_massmode(const Chan *chan, char *pattern, int filtmode, char mode,
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)
return;

View File

@ -268,6 +268,7 @@
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

View File

@ -45,7 +45,7 @@ LS const struct
} StructList[] =
{
{ "aME\t", sizeof(aME) }, // for memory allocation debugging
{ "aME\t", sizeof(aME) }, /* for memory allocation debugging */
{ "aMEA", sizeof(aMEA) },
#ifdef ALIAS
{ "Alias", sizeof(Alias) },
@ -524,7 +524,7 @@ void debug_settings(UniVar *setting, int type)
}
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)
{
n = n - 8;
@ -1250,12 +1250,12 @@ typedef struct
{
time_t last;
time_t next;
uint32_t second1; //:30;
uint32_t second2; //:30;
uint32_t minute1; //:30;
uint32_t minute2; //:30;
uint32_t hour; //:24;
uint32_t weekday; //:7;
uint32_t second1; /*:30;*/
uint32_t second2; /*:30;*/
uint32_t minute1; /*:30;*/
uint32_t minute2; /*:30;*/
uint32_t hour; /*:24;*/
uint32_t weekday; /*:7;*/
} HookTimer;
#endif /* 0 */

View File

@ -72,10 +72,10 @@
#define CU_KSWARN 0x1000
#define CU_CHANBAN 0x2000
#define SHIT_NOOP 0 // do nothing
#define SHIT_CHANOP 1 // not allowed to be chanop
#define SHIT_KB 2 // simple kick and ban
#define SHIT_PERMABAN 3 // permanent ban, re-ban if unbanned
#define SHIT_NOOP 0 /* do nothing */
#define SHIT_CHANOP 1 /* not allowed to be chanop */
#define SHIT_KB 2 /* simple kick and ban */
#define SHIT_PERMABAN 3 /* permanent ban, re-ban if unbanned */
#define SHIT_CHANBAN 4
#define MAXSHITLEVEL 4

View File

@ -155,7 +155,7 @@ int make_query(char *packet, const char *hostname)
memset(packet,0,12);
h = (dnsQuery*)packet;
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);
size = packet + 12;
dst = size + 1;
@ -244,7 +244,7 @@ void parse_query(int psz, dnsQuery *query)
n = ntohs(query->flags);
debug("(parse_query) %i: flags = %i { %s %i %s%s%s%s%s }\n",
sz,n,token,
(n&15), // result code
(n&15), /* result code */
(n&32768) ? "QR 1 (Answer) ":"QR 0 (Question) ",
(n&1024) ? "AA ":"",
(n&512) ? "TC ":"",
@ -879,8 +879,8 @@ void do_dns(COMMAND_ARGS)
if ((ip = inet_addr(host)) != INADDR_NONE)
{
/* flip an IP backwards to resolve hostname */
// a11.b22.c33.d44
// d44.c33.b22.a11.in-addr.arpa
/* a11.b22.c33.d44 */
/* d44.c33.b22.a11.in-addr.arpa */
dst = globaldata;
flipstep:
src = host;
@ -894,7 +894,7 @@ flipstep:
}
if (dot)
{
*dot++ = 0; // safe to modify buffer?
*dot++ = 0; /* safe to modify buffer? */
while(*dot)
*dst++ = *dot++;
*dst++ = '.';
@ -909,7 +909,7 @@ flipstep:
/* check if its in cache now */
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);
return;
}

View File

@ -126,7 +126,7 @@ void Free(char **mem)
{
debug("(Free) PANIC: Free(0x"mx_pfmt"); Unregistered memory block\n",(mx_ptr)src);
run_debug();
//exit(1); // overreacting. just ignore it and accept the leak.
/*exit(1); /* overreacting. just ignore it and accept the leak. */
return;
}
mp = mp->next;
@ -896,8 +896,8 @@ int is_safepath(const char *path, int filemustexist)
#ifdef TEST
memset(&st,0,sizeof(st));
#endif
if (*(src = path) == '/') // dont allow starting at root, only allow relative paths
return(-1);//(FALSE);
if (*(src = path) == '/') /* dont allow starting at root, only allow relative paths */
return(-1);
if (strlen(path) >= PATH_MAX)
return(-6);
@ -910,7 +910,7 @@ int is_safepath(const char *path, int filemustexist)
if (filemustexist == FILE_MUST_NOTEXIST && orr == 0)
return(-3);
mo = st.st_mode; // save mode for later
mo = st.st_mode; /* save mode for later */
dir_r = -1;
for(dst=tmp;*src;)
@ -920,9 +920,9 @@ int is_safepath(const char *path, int filemustexist)
*dst = 0;
if ((dir_r = lstat(tmp,&st)) == -1 && errno == ENOENT)
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);
if (st.st_ino == parent_inode) // disallow traversing below bots homedir
if (st.st_ino == parent_inode) /* disallow traversing below bots homedir */
return(-5);
}
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",
(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;
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);
if (argv[1] == NULL)

46
src/h.h
View File

@ -67,7 +67,7 @@
#define __att2(x,y,z) /* nothing */
#endif
// __x86_64__ automatically compiles for regparm optimization
/* __x86_64__ automatically compiles for regparm optimization */
#if !defined(__profiling__) && defined(__i386__)
# define __regparm(x) regparm(x)
#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_abrt(int) __page(RARE_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__);
#else
LS void sig_segv(int) __attr(RARE_SEG, __noreturn__);
#endif
LS void sig_term(int) __attr(RARE_SEG, __noreturn__); /* rare */
LS void doit(void);
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_unhook(PyObject *self, PyObject *args, PyObject *keywds);
#endif
//char *python_unicode2char(PyUnicodeObject *obj);
//PyObject *python_userlevel(PyObject *self, PyObject *args, PyObject *keywds);
//PyObject *python_to_server(PyObject *self, PyObject *args, PyObject *keywds);
//PyObject *python_to_file(PyObject *self, PyObject *args, PyObject *keywds);
//static PyObject *python_dcc_sendfile(PyObject *self, PyObject *args, PyObject *keywds);
//PyObject *python_debug(PyObject *self, PyObject *args);
//PyMODINIT_FUNC pythonInit(void);
/*
char *python_unicode2char(PyUnicodeObject *obj);
PyObject *python_userlevel(PyObject *self, PyObject *args, PyObject *keywds);
PyObject *python_to_server(PyObject *self, PyObject *args, PyObject *keywds);
PyObject *python_to_file(PyObject *self, PyObject *args, PyObject *keywds);
static PyObject *python_dcc_sendfile(PyObject *self, PyObject *args, PyObject *keywds);
PyObject *python_debug(PyObject *self, PyObject *args);
PyMODINIT_FUNC pythonInit(void);
*/
int python_parse_jump(char *, char *, Hook *);
int python_timer_jump(Hook *hook);
void python_dcc_complete(Client *client, int cps);
@ -649,22 +655,26 @@ LS void do_urlhist(COMMAND_ARGS) __page(CMD1_SEG);
/* tcl.c */
#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_parse_jump(char *from, char *rest, Hook *hook);
LS void tcl_dcc_complete(Client *client, int cps);
#if defined(DEBUG_C) || defined(MEGA_C)
LS int tcl_hook(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
#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_debug(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_to_file(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_dns_jump(char *host, char *resolved, Hook *hook);
//LS int tcl_dns(void *foo, Tcl_Interp *I, int objc, Tcl_Obj *CONST objv[]);
/*
LS int tcl_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_debug(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_to_file(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_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 do_tcl(COMMAND_ARGS) __page(CMD1_SEG);

View File

@ -38,7 +38,7 @@ char vmstk[32];
char vmexe[32];
char vmlib[32];
*/
char omni[224]; // 32*7
char omni[224]; /* 32*7 */
#define vmpeak &omni[0]
#define vmsize &omni[32]
#define vmrss &omni[64]
@ -47,7 +47,7 @@ char omni[224]; // 32*7
#define vmexe &omni[160]
#define vmlib &omni[192]
struct // statusvalues
struct /* statusvalues */
{
const char *key;
const int klen;
@ -138,7 +138,7 @@ int parse_proc_cpuinfo(char *line)
{
if (havemodel == 1)
return(FALSE);
*(dst++) = ' '; // prime with a leading space
*(dst++) = ' '; /* prime with a leading space */
while(*src && dst < end)
{
if (*src != ' ' || dst[-1] != ' ')
@ -179,7 +179,7 @@ int parse_proc_cpuinfo(char *line)
}
*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;
if ((fd = open(fn,O_RDONLY)) < 0)
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 ]",
vmsize,vmpeak,vmrss,vmexe,vmdata,vmlib,vmstk);
@ -248,11 +248,13 @@ void do_cpuinfo(COMMAND_ARGS)
else
stringcpy(bogostr,"/proc/cpuinfo");
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/mips1",O_RDONLY)) < 0)
// if ((fd = open("/home/git/cpuinfo/intel1",O_RDONLY)) < 0)
// if ((fd = open("/home/git/cpuinfo/cosmiccow",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/mips1",O_RDONLY)) < 0)
if ((fd = open("/home/git/cpuinfo/intel1",O_RDONLY)) < 0)
if ((fd = open("/home/git/cpuinfo/cosmiccow",O_RDONLY)) < 0)
*/
#endif
if ((fd = open("/proc/cpuinfo",O_RDONLY)) < 0)
#ifdef DEBUG
@ -267,7 +269,7 @@ void do_cpuinfo(COMMAND_ARGS)
global_from = from;
havemodel = bogo = siblings = procct = cpus = cores = physid = 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)
#ifdef DEBUG
@ -315,7 +317,7 @@ void do_cpuinfo(COMMAND_ARGS)
omni+1,bogostr,cpustr,a1,a2,a3);
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------------------------------------------------------*/
#ifdef DEBUG
@ -326,18 +328,18 @@ struct
} in2str[] =
{
{ 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_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_CREATE, "IN_CREATE" }, // File/directory created in 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_MODIFY, "IN_MODIFY" }, // File was modified
{ 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_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_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_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_CREATE, "IN_CREATE" }, /* File/directory created in 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_MODIFY, "IN_MODIFY" }, /* File was modified */
{ 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_TO, "IN_MOVED_TO" }, /* Generated for the directory containing the new filename when a file is renamed */
{ IN_OPEN, "IN_OPEN" }, /* File was opened */
{ 0, NULL }
};

View File

@ -37,7 +37,7 @@ void make_ireq(int t, const char *from, const char *nick)
char *pt;
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->when = now;

View File

@ -440,35 +440,51 @@ void sig_bus(int crap)
/*
* 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>
#endif
void sig_segv(int crap, siginfo_t *si, void *uap)
{
#ifdef __x86_64__
mcontext_t *mctx;
greg_t *rsp,*rip; // general registers
#endif /* __x86_64__ */
greg_t *rsp,*rip; /* general registers */
time(&now);
#ifdef DEBUG
debug("(sigsegv) trying to access "mx_pfmt"\n",(mx_ptr)si->si_addr);
#ifdef __x86_64__
mctx = &((ucontext_t *)uap)->uc_mcontext;
rsp = &mctx->gregs[15]; // RSP, 64-bit stack pointer
rip = &mctx->gregs[16]; // RIP, 64-bit instruction pointer
rsp = &mctx->gregs[15]; /* RSP, 64-bit stack 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) sig_segv() = "mx_pfmt"\n",(mx_ptr)sig_segv);
debug("(sigsegv) do_crash() = "mx_pfmt"\n",(mx_ptr)do_crash);
#endif /* __x86_64__ */
if (debug_on_exit)
{
run_debug();
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 */
respawn++;
@ -480,6 +496,8 @@ void sig_segv(int crap, siginfo_t *si, void *uap)
/* NOT REACHED */
}
#endif /* else defined(__linux__) && defined(__x86_64__) && defined(DEBUG) && !defined(__STRICT_ANSI__) */
/*
* SIGTERM
*/
@ -897,7 +915,7 @@ int main(int argc, char **argv, char **envp)
}
stat("..",&st);
parent_inode = st.st_ino; // used for is_safepath()
parent_inode = st.st_ino; /* used for is_safepath() */
srand(now+getpid());
@ -1018,13 +1036,13 @@ int main(int argc, char **argv, char **envp)
debug_on_exit = TRUE;
break;
#endif /* DEBUG */
case 'e': // run a single command before exiting
case 'e': /* run a single command before exiting */
startup = 3;
++argv;
if (*argv)
{
//void on_msg(char *from, char *to, char *rest)
//on_msg();
/*void on_msg(char *from, char *to, char *rest)
on_msg(); */
}
else
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 defined(__linux__) && defined(__x86_64__) && defined(DEBUG) && !defined(__STRICT_ANSI__)
struct sigaction s;
s.sa_flags = SA_SIGINFO;
sigemptyset(&s.sa_mask);
s.sa_sigaction = sig_segv;
if (sigaction(SIGSEGV, &s, NULL) < 0)
{
#ifdef DEBUG
debug("(main) binding SIGSEGV handler failed: %s\n",strerror(errno));
#endif
}
#else
signal(SIGSEGV,sig_segv);
#endif
#ifdef DEBUG
signal(SIGILL,sig_ill);
signal(SIGABRT,sig_abrt);

View File

@ -82,7 +82,7 @@ LS const LinkCmd basicProto[] =
{ "BQ", basicQuit, RELAY_NO },
{ "CO", netchanNeedop, RELAY_YES },
#ifdef SUPPRESS
{ "CS", netchanSuppress, RELAY_YES }, // experimental command supression
{ "CS", netchanSuppress, RELAY_YES }, /* experimental command supression */
#endif /* SUPPRESS */
{ "PA", partyAuth, RELAY_YES },
#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;
int uid;
@ -422,7 +422,7 @@ void basicAuth(BotNet *bn, char *rest)
#ifdef SHACRYPT
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" */
sprintf(temppass,"%s %s %i %i",linkpass,pass,bn->rsid,bn->lsid);
@ -441,7 +441,7 @@ void basicAuth(BotNet *bn, char *rest)
#ifdef MD5CRYPT
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" */
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)
{
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" */
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)
{
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" */
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);
// convert command to const command
/* convert command to const command */
for(i=0;mcmd[i].name;i++)
{
j = stringcasecmp(mcmd[i].name,cmd);
@ -886,7 +886,7 @@ void netchanSuppress(BotNet *source, char *rest)
crc = asc2int(rest);
// to all local bots
/* to all local bots */
for(backup=botlist;backup;backup=backup->next)
{
backup->supres_cmd = cmd;
@ -1193,7 +1193,7 @@ void ushareUser(BotNet *bn, char *rest)
if (user->guid == bn->guid && user->addsession)
{
user->addsession = 0;
mirror_user(user); // copy to other local bots
mirror_user(user); /* copy to other local bots */
}
bn->addsession = 0;
bn->tick++;
@ -1356,8 +1356,6 @@ void parse_botnet(BotNet *bn, char *rest)
basicBanner(bn,rest+2);
return;
}
//if (!stringcmp(rest,telnetprompt)) // another bot sent me its telnetprompt // dont assume identical prompts
// return;
#ifdef NETCFG
if (strncmp(rest,"netcfg ",7) == 0)
{
@ -1704,7 +1702,7 @@ usage:
goto usage;
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->port = iport;

View File

@ -553,7 +553,7 @@ recheck_alias:
#ifdef SUPPRESS
#ifdef BOTNET
// experimental command supression
/* experimental command supression */
if (CurrentCmd->name == current->supres_cmd)
{
int crc;
@ -561,7 +561,7 @@ recheck_alias:
crc = makecrc(rest);
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_crc = 0;
#ifdef DEBUG
@ -570,7 +570,7 @@ recheck_alias:
return;
}
}
//if command should be supressed ...
/*if command should be supressed ... */
if (mcmd[i].supres && CurrentChan)
{
send_suppress(CurrentCmd->name,rest);
@ -925,7 +925,7 @@ modeloop:
break;
/* 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;
if (i < SHIT_PERMABAN)
{
@ -1047,7 +1047,7 @@ void common_public(Chan *chan, char *from, char *spyformat, char *rest)
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;
while(rest[n])
{
@ -1056,7 +1056,7 @@ void common_public(Chan *chan, char *from, char *spyformat, char *rest)
n++;
}
// trigger caps flood action
/* trigger caps flood action */
if (upper >= n)
{
if (check_mass(chan,doer,INT_CKL))

View File

@ -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 ((src[4] == ':') || // "http:"
(tolowertab[src[4]] == 's' && src[5] == ':')) // "https:"
if ((src[4] == ':') || /* "http:" */
(tolowertab[src[4]] == 's' && src[5] == ':')) /* "https:" */
{
urlcapture(src);
}
@ -854,7 +854,7 @@ void parse_319(char *from, char *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 (current->reset)
@ -869,7 +869,7 @@ loop:
/*
* 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++;
sprintf(nuh,"%s!%s",current->nick,current->userhost);
#ifdef DEBUG
@ -890,7 +890,7 @@ loop:
*/
else
{
// check if all sendq is empty (text, kicks and modes)
/* check if all sendq is empty (text, kicks and modes) */
if (current->sendq)
{
#ifdef DEBUG
@ -898,7 +898,7 @@ loop:
#endif /* DEBUG */
return;
}
// CurrentChan is unset and can be used
/* CurrentChan is unset and can be used */
for(CurrentChan=current->chanlist;CurrentChan;CurrentChan=CurrentChan->next)
{
if (CurrentChan->kicklist || CurrentChan->modelist)
@ -910,11 +910,11 @@ loop:
#ifdef DEBUG
debug("(parse_319) Cb: checking %s\n",channel);
#endif /* DEBUG */
if (*channel == '@' || *channel == '+') // opped/voiced user, spin 1
if (*channel == '@' || *channel == '+') /* opped/voiced user, spin 1 */
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)
{
if (!matches(shit->mask,channel))
@ -1347,7 +1347,7 @@ void parse_005(char *from, char *rest)
#endif /* DEBUG */
while(*s)
{
//CHANMODES=beIR,k,l,imnpstaqr
/*CHANMODES=beIR,k,l,imnpstaqr */
if (*s == 'e')
{
current->ircx_flags |= IRCX_EMODE;
@ -1471,8 +1471,8 @@ void parseline(char *rest)
if (current->spy & SPYF_RAWIRC)
send_spy(SPYSTR_RAWIRC,FMT_PLAIN,rest);
//new undernet amusements
//(in) {5} NOTICE AUTH :*** You have identd disabled (or broken), to continue to connect you must type /QUOTE PASS 17071
/*new undernet amusements */
/*(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))
{
from = STREND(rest);
@ -1526,7 +1526,7 @@ void parseline(char *rest)
cmdhash = stringhash(command);
//debug("cmdhash = %08X\n",cmdhash);
/*debug("cmdhash = %08X\n",cmdhash); */
for(i=0;pFuncs[i].hash;i++)
{
if (cmdhash == pFuncs[i].hash)
@ -1539,21 +1539,5 @@ void parseline(char *rest)
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
*/

View File

@ -51,7 +51,7 @@ void send_kick(Chan *chan, const char *nick, const char *format, ...)
pp = &(*pp)->next;
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; */
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
*/
//case CHK_CAPS:
/*case CHK_CAPS: */
case INT_CKL:
num = INDEX_CAPS;
break;
//case CHK_PUB:
/*case CHK_PUB: */
case INT_FL:
num = INDEX_FLOOD;
break;
/*
* three things we dont want channel ops to do
*/
//case CHK_DEOP:
/*case CHK_DEOP: */
case INT_MDL:
num = INDEX_DEOP;
break;
//case CHK_BAN:
/*case CHK_BAN: */
case INT_MBL:
num = INDEX_BAN;
break;
@ -502,7 +502,7 @@ void process_chanbans(void)
#endif /* DEBUG */
continue;
}
if (current->sendq) // only do chanbans on empty queue
if (current->sendq) /* only do chanbans on empty queue */
{
#ifdef DEBUG
debug("(process_chanbans) skipping %s (%i), sendq not empty\n",current->nick,current->guid);
@ -513,7 +513,7 @@ void process_chanbans(void)
selcu = NULL;
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;
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;
char *nuh;
// the channel is shitted and the user is on it...
// 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
/* the channel is shitted and the user is on it...
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 */
// check all current channels
/* check all current channels */
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
debug("(chanban_action) skipping %s: bot is on channel\n",channel);
#endif /* DEBUG */
return;
}
// is the shit for this channel?
/* is the shit for this channel? */
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)
{
#ifdef DEBUG
@ -579,17 +579,17 @@ void chanban_action(char *nick, char *channel, Shit *shit)
#endif /* DEBUG */
cu = find_chanuser(CurrentChan,nick);
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
debug("(chanban_action) slapping %s on %s for being on %s (mask %s): %s\n",
nick,CurrentChan->name,channel,shit->mask,shit->reason);
#endif /* DEBUG */
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_kick(CurrentChan,nick,"%s (%s)",shit->reason,channel); // clobbers globaldata
send_kick(CurrentChan,nick,"%s (%s)",shit->reason,channel); /* clobbers globaldata */
}
}
}

View File

@ -48,7 +48,7 @@ char *recover_client(char *env)
if (env[8] != ':')
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]);
fd = getaxx(axx.num[1]);
@ -150,7 +150,7 @@ char *recover_debug(char *env)
/*
* 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);
if (fstat(debug_fd,&s) < 0)
@ -207,7 +207,7 @@ char *recover_server(char *env)
if (env[sz] != ' ' && env[sz] != 0)
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;
guid = getaxx(axx.num[0]);
fd = getaxx(axx.num[1]);
@ -247,8 +247,8 @@ char *recover_server(char *env)
break;
}
}
// 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 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 (fd != -1)
{
to_file(fd,"QUIT :I'm no longer wanted *cry*\n");
@ -257,8 +257,10 @@ char *recover_server(char *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)
{

View File

@ -258,7 +258,7 @@ int begin_redirect(char *from, char *args)
to_user(from,"Missing name for redirect.");
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.");
return(-1);
@ -606,9 +606,9 @@ guid_ok:
else
{
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;
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;
}
@ -619,7 +619,7 @@ guid_ok:
*/
if (*dest == '>')
{
// accept both ">file" and "> file"
/* accept both ">file" and "> file" */
dest++;
if (!*dest)
{

View File

@ -63,7 +63,7 @@ typedef struct OnMsg
lbuf:1,
cbang:1,
acchan:1,
supres:1; // -- 21 bits
supres:1; /* -- 21 bits */
const char *cmdarg;
} OnMsg;
@ -206,7 +206,6 @@ typedef struct Setting
char **strptr;
} v;
//void *setto; /* type-casted to whatever */
char *name;
int max;
void (*func)(const struct Setting *);
@ -711,7 +710,7 @@ typedef struct NetCfg
uint16_t guid;
uint16_t port;
uint16_t linked; //:1;
uint16_t linked; /*:1;*/
char *host;
char pass[2];
@ -748,12 +747,12 @@ typedef struct
{
time_t last;
time_t next;
uint32_t second1; //:30;
uint32_t second2; //:30;
uint32_t minute1; //:30;
uint32_t minute2; //:30;
uint32_t hour; //:24;
uint32_t weekday; //:7;
uint32_t second1; /*:30;*/
uint32_t second2; /*:30;*/
uint32_t minute1; /*:30;*/
uint32_t minute2; /*:30;*/
uint32_t hour; /*:24;*/
uint32_t weekday; /*:7;*/
} HookTimer;

View File

@ -473,7 +473,7 @@ char *random_question(char *triv_rand)
} 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);
stringcat(stringcpy(tmpname,"trivia/"),triv_qfile);
@ -727,11 +727,11 @@ void do_bigsay(COMMAND_ARGS)
{
temp = chop(&rest);
if (temp[1] == '-')
; // allow .bigsay -- -dash-
; /* allow .bigsay -- -dash- */
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

View File

@ -306,7 +306,7 @@ int read_userlist(char *filename)
debug("(read_userlist) filename is NULL\n");
return(FALSE);
}
if (*filename == '<') // read only userfile
if (*filename == '<') /* read only userfile */
filename++;
if ((r = is_safepath(filename,FILE_MAY_EXIST)) != FILE_IS_SAFE)
{
@ -335,7 +335,7 @@ int read_userlist(char *filename)
#endif /* NEWBIE */
return(FALSE);
}
if (*filename == '<') // read only userfile
if (*filename == '<') /* read only userfile */
filename++;
if (is_safepath(filename,FILE_MAY_EXIST) != FILE_IS_SAFE)
{
@ -410,7 +410,7 @@ int write_userlist(char *filename)
return(TRUE);
#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);
return(FALSE);
@ -421,7 +421,7 @@ int write_userlist(char *filename)
return(FALSE);
}
#else
if (*filename == '<') // we dont write to read only userfiles
if (*filename == '<') /* we dont write to read only userfiles */
return(FALSE);
if (is_safepath(filename,FILE_MAY_EXIST) != FILE_IS_SAFE)
return(FALSE);
@ -574,7 +574,7 @@ void mirror_user(User *user)
backup = current;
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;
for(olduser=anybot->userlist;olduser;olduser=olduser->next)
{
@ -604,10 +604,10 @@ void mirror_user(User *user)
notes = olduser->note;
olduser->note = NULL;
#endif /* NOTE */
remove_user(olduser); // uses current->userlist
// authlist/chanuserlist/dcclist is now a minefield
remove_user(olduser); /* uses current->userlist */
/* 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)
{
#ifdef NOTE
@ -616,26 +616,26 @@ void mirror_user(User *user)
#ifdef DEBUG
debug("(1)\n");
#endif /* DEBUG */
reset_userlink(olduser,newuser); // uses current->userlist
// authlist/chanuserlist/dcclist should now be safe again.
reset_userlink(olduser,newuser); /* uses current->userlist */
/* authlist/chanuserlist/dcclist should now be safe again. */
}
#ifdef DEBUG
debug("(2)\n");
#endif /* DEBUG */
dupe_strp(user->mask,&newuser->mask); // copy masks
dupe_strp(user->chan,&newuser->chan); // copy channels
// do not copy notes (creates spam)
dupe_strp(user->mask,&newuser->mask); /* copy masks */
dupe_strp(user->chan,&newuser->chan); /* copy channels */
/* do not copy notes (creates spam) */
#ifdef DEBUG
debug("(3)\n");
#endif /* DEBUG */
newuser->x.comboflags = user->x.comboflags;
#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->tick = user->tick; // is this proper???
newuser->tick = user->tick; /* is this proper??? */
#endif /* BOTNET */
}
current = backup; // assume my old identity
current = backup; /* assume my old identity */
#ifdef DEBUG
debug("(mirror_user) %s[%i] finished\n",user->name,user->x.x.access);
#endif /* DEBUG */
@ -772,7 +772,7 @@ User *add_user(char *handle, char *pass, int axs)
#endif /* DEBUG */
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->next = current->userlist;
current->userlist = user;
@ -1266,7 +1266,7 @@ void do_user(COMMAND_ARGS)
/*
* 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;
stringcpy(tmpmask,mask);
#ifdef DEBUG
@ -1279,7 +1279,7 @@ void do_user(COMMAND_ARGS)
return;
}
#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
*/
@ -1302,8 +1302,8 @@ void do_user(COMMAND_ARGS)
* add_user() touches current->ul_save for us
*/
user = add_user(handle,encpass,newaccess);
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->mask,tmpmask,FALSE); /* does not run rehash_chanusers(), does not clobber nuh_buf */
addtouser(&user->chan,chan,TRUE); /* clobbers nuh_buf */
#ifdef DEBUG
debug("(do_user) from %s, handle %s,\n\tmask %s, chan %s\n",from,handle,tmpmask,chan);
#endif /* DEBUG */
@ -1505,9 +1505,8 @@ usage:
to_user(from,"Problem adding %s (global mask)",mask);
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))
{
to_user(from,"Problem adding %s (invalid mask)",mask);

View File

@ -404,7 +404,7 @@ second_pass:
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))
{