lots of fixes

This commit is contained in:
fishwaldo 2002-10-23 03:53:22 +00:00
parent cc43279c69
commit 3cf7d891bb
9 changed files with 152 additions and 34 deletions

View file

@ -13,6 +13,8 @@ Symbols are:
(F) - Fixed up Hidden Servers to work correctly... (/map /links /whois etc)
(F) - Fixed Usermode problems.
(F) - Fixed a problem with userhost cloaking (Hopefully)
(F) - segv handling code added
(F) - Fixed up compile warnings
* NeoIRCd Version 0.9.4 - 24th Sept, 2002 - Fish
(F) - Changed HiddenHost System to Use Ultimates version instead...

View file

@ -1,4 +1,4 @@
dnl $Id: configure.in,v 1.5 2002/09/20 09:05:18 fishwaldo Exp $
dnl $Id: configure.in,v 1.6 2002/10/23 03:53:21 fishwaldo Exp $
dnl Process this file with autoconf to produce a configure script.
dnl AC_INIT(include/class.h) <- what is this ? -TimeMr14C
@ -181,7 +181,7 @@ dnl AC_CHECK_LIB(nsl, main)
dnl AC_CHECK_LIB(bottle, beer, , AC_MSG_WARN(I have no more beer))
AC_CHECK_FUNC(crypt,, AC_CHECK_LIB(descrypt, crypt,,AC_CHECK_LIB(crypt, crypt,,)))
AC_CHECK_FUNC(backtrace, AC_DEFINE(HAVE_BACKTRACE, 1, 'backtrace function available'))
dnl check for gettext in base system or /usr/[local/]lib/libintl.a
AC_SEARCH_LIBS(gettext, intl,,,)
if test "X$ac_cv_search_gettext" = "Xno"; then

71
configure vendored
View file

@ -3464,6 +3464,77 @@ fi
fi
echo "$as_me:$LINENO: checking for backtrace" >&5
echo $ECHO_N "checking for backtrace... $ECHO_C" >&6
if test "${ac_cv_func_backtrace+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char backtrace (); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char backtrace ();
char (*f) ();
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_backtrace) || defined (__stub___backtrace)
choke me
#else
f = backtrace;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_func_backtrace=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_func_backtrace=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_backtrace" >&5
echo "${ECHO_T}$ac_cv_func_backtrace" >&6
if test $ac_cv_func_backtrace = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_BACKTRACE 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for library containing gettext" >&5
echo $ECHO_N "checking for library containing gettext... $ECHO_C" >&6

View file

@ -193,3 +193,6 @@
/* Define if you have the z library (-lz). */
#undef HAVE_LIBZ
/* Define if you have the backtrace call */
#undef HAVE_BACKTRACE

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_message.c,v 1.10 2002/10/15 02:44:33 fishwaldo Exp $
* $Id: m_message.c,v 1.11 2002/10/23 03:53:22 fishwaldo Exp $
*/
#include "stdinc.h"
@ -122,7 +122,7 @@ _moddeinit(void)
mod_del_cmd(&notice_msgtab);
}
const char *_version = "$Revision: 1.10 $";
const char *_version = "$Revision: 1.11 $";
#endif
/*
@ -794,7 +794,6 @@ handle_opers(int p_or_n, char *command, struct Client *client_p,
struct Client *target_p;
char *host;
char *server;
char *s;
int count;
/*

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_nick.c,v 1.18 2002/09/26 12:34:45 fishwaldo Exp $
* $Id: m_nick.c,v 1.19 2002/10/23 03:53:22 fishwaldo Exp $
*/
#include "stdinc.h"
@ -97,7 +97,7 @@ _moddeinit(void)
mod_del_cmd(&client_msgtab);
}
const char *_version = "$Revision: 1.18 $";
const char *_version = "$Revision: 1.19 $";
#endif
/*
@ -731,8 +731,11 @@ nick_from_server(struct Client *client_p, struct Client *source_p, int parc,
if(!(source_p->umodes & FLAGS_HIDDEN) && (flag & FLAGS_HIDDEN)) {
if (parv[7][0] != '*')
strncpy(source_p->vhost, parv[7], HOSTLEN +1);
else
make_virthost(source_p->host, source_p->vhost, 1);
else {
/* THIS SHOULD NEVER HAPPEN */
sendto_realops_flags(FLAGS_DEBUG|FLAGS_REMOTE, L_ALL, "Warning, Server %s sent a Invalid Vhost in nick_from_server", source_p->from->name);
strncpy(source_p->vhost, source_p->host, HOSTLEN +1);
}
}
/* we only allow Ulined Servers to set +s */
@ -829,8 +832,10 @@ client_from_server(struct Client *client_p, struct Client *source_p, int parc,
if(!(source_p->umodes & FLAGS_HIDDEN) && (flag & FLAGS_HIDDEN)) {
if (parv[7][0] != '*')
strncpy(source_p->vhost, parv[7], HOSTLEN +1);
else
make_virthost(source_p->host, source_p->vhost, 1);
else {
sendto_realops_flags(FLAGS_DEBUG|FLAGS_REMOTE, L_ALL, "Warning %s sent a Invalid Hidden Host command in client_from_server", source_p->from->name);
strncpy(source_p->vhost, source_p->host, HOSTLEN +1);
}
}
/* we only allow Ulined Servers to set +s */

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_kline.c,v 1.11 2002/10/16 03:52:47 fishwaldo Exp $
* $Id: m_kline.c,v 1.12 2002/10/23 03:53:21 fishwaldo Exp $
*/
#include "stdinc.h"
@ -86,7 +86,7 @@ _moddeinit(void)
mod_del_cmd(&dline_msgtab[0]);
mod_del_cmd(&dline_msgtab[1]);
}
const char *_version = "$Revision: 1.11 $";
const char *_version = "$Revision: 1.12 $";
#endif
/* Local function prototypes */
@ -1023,7 +1023,7 @@ static int remove_tkline_match(char *,char *);
static void mo_unkline (struct Client *client_p,struct Client *source_p,
int parc,char *parv[])
{
char *user, *host;
char *kuser, *khost;
if (!IsOperUnkline(source_p))
{
@ -1037,19 +1037,19 @@ static void mo_unkline (struct Client *client_p,struct Client *source_p,
return;
}
if ((host = strchr(parv[1], '@')) || *parv[1] == '*')
if ((khost = strchr(parv[1], '@')) || *parv[1] == '*')
{
/* Explicit user@host mask given */
if(host) /* Found user@host */
if(khost) /* Found user@host */
{
user = parv[1]; /* here is user part */
*(host++) = '\0'; /* and now here is host */
kuser = parv[1]; /* here is user part */
*(khost++) = '\0'; /* and now here is host */
}
else
{
user = "*"; /* no @ found, assume its *@somehost */
host = parv[1];
kuser = "*"; /* no @ found, assume its *@somehost */
khost = parv[1];
}
}
else
@ -1059,22 +1059,22 @@ static void mo_unkline (struct Client *client_p,struct Client *source_p,
return;
}
if (remove_tkline_match(host, user))
if (remove_tkline_match(khost, kuser))
{
sendto_one(source_p,
":%s NOTICE %s :Un-klined [%s@%s] from temporary k-lines",
me.name, parv[0],user, host);
me.name, parv[0],kuser, khost);
sendto_realops_flags(FLAGS_ALL, L_ALL,
"%s has removed the temporary K-Line for: [%s@%s]",
get_oper_name(source_p), user, host);
ilog(L_NOTICE, "%s removed temporary K-Line for [%s@%s]", parv[0], user,
host);
get_oper_name(source_p), kuser, khost);
ilog(L_NOTICE, "%s removed temporary K-Line for [%s@%s]", parv[0], kuser,
khost);
return;
}
else
{
sendto_one(source_p, ":%s NOTICE %s :No K-Line for %s@%s",
me.name, source_p->name,user,host);
me.name, source_p->name,kuser,khost);
return;
}
return;
@ -1086,21 +1086,21 @@ static void mo_unkline (struct Client *client_p,struct Client *source_p,
* Side effects: Any matching tklines are removed.
*/
static int
remove_tkline_match(char *host, char *user)
remove_tkline_match(char *khost, char *kuser)
{
struct ConfItem *tk_c;
dlink_node *tk_n;
struct irc_inaddr addr, caddr;
int nm_t, cnm_t, bits, cbits;
nm_t = parse_netmask(host, &addr, &bits);
nm_t = parse_netmask(khost, &addr, &bits);
for (tk_n=temporary_klines.head; tk_n; tk_n=tk_n->next)
{
tk_c = (struct ConfItem*)tk_n->data;
cnm_t = parse_netmask(tk_c->host, &caddr, &cbits);
if (cnm_t != nm_t || irccmp(user, tk_c->user))
if (cnm_t != nm_t || irccmp(kuser, tk_c->user))
continue;
if ((nm_t==HM_HOST && !irccmp(tk_c->host, host)) ||
if ((nm_t==HM_HOST && !irccmp(tk_c->host, khost)) ||
(nm_t==HM_IPV4 && bits==cbits && match_ipv4(&addr, &caddr, bits))
#ifdef IPV6
|| (nm_t==HM_IPV6 && bits==cbits && match_ipv6(&addr, &caddr, bits))

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: cloak.c,v 1.7 2002/10/20 03:57:03 fishwaldo Exp $
* $Id: cloak.c,v 1.8 2002/10/23 03:53:22 fishwaldo Exp $
*/
/*
**
@ -231,11 +231,11 @@ make_virthost (char *curr, char *host, char *new)
hash[1] >>= 2;
/* Check if host could be IPv4 */
if (parc2 == 4)
if (parc2 == 4 || parc2 < 2)
{
len = strlen (parv2[3]);
/* Check if its an IPv4 for sure */
if (strchr ("0123456789", parv2[3][len - 1]))
if (strchr ("0123456789", parv2[3][len - 1]) || parc2 < 2)
{
hash[2] = ((crc32 (parv[1], strlen (parv[1])) + KEY2) ^ KEY) ^ KEY3;
hash[3] = ((crc32 (parv[0], strlen (parv[0])) + KEY2) ^ KEY) ^ KEY3;

View file

@ -17,16 +17,21 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: ircd_signal.c,v 1.3 2002/09/13 06:56:45 fishwaldo Exp $
* $Id: ircd_signal.c,v 1.4 2002/10/23 03:53:22 fishwaldo Exp $
*/
#include "stdinc.h"
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
#endif
#include "ircd_signal.h"
#include "ircd.h" /* dorehash */
#include "restart.h" /* server_reboot */
#include "s_log.h"
#include "memory.h"
#include "s_bsd.h"
#include "send.h"
#include "client.h"
/*
* dummy_handler - don't know if this is really needed but if alarm is still
@ -85,6 +90,36 @@ sigint_handler(int sig)
}
}
static void
sigsegv_handler(int sig)
{
#ifdef HAVE_BACKTRACE
void *array[50];
size_t size;
char **strings;
size_t i;
/* thanks to gnulibc libary for letting me find this usefull function */
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
#endif
ilog(L_ERROR, "Damn It, Server is cracking a Woobly... Crashing... ");
#ifdef HAVE_BACKTRACE
for (i = size; i == 0; i--) {
ilog(L_ERROR, "BackTrace(%d): %s", i-1, strings[i]);
}
#endif
ilog(L_ERROR, "Attempting To Restart");
sendto_realops_flags(FLAGS_ALL|FLAGS_REMOTE, L_ALL, "Damn It, Server is Cracking a Woobly... Crashing...");
#ifdef HAVE_BACKTRACE
sendto_realops_flags(FLAGS_ALL|FLAGS_REMOTE, L_ALL, "Location *Could* be: %s", strings[size-1]);
sendto_realops_flags(FLAGS_ALL|FLAGS_REMOTE, L_ALL, "Check LogFile for More Details");
MyFree(strings);
#endif
server_reboot();
}
/*
* setup_signals - initialize signal handlers for server
*/
@ -123,6 +158,9 @@ setup_signals()
sigaddset(&act.sa_mask, SIGTERM);
sigaction(SIGTERM, &act, 0);
act.sa_handler = sigsegv_handler;
sigaddset(&act.sa_mask, SIGSEGV);
sigaction(SIGSEGV, &act, 0);
}