Branch merge.
This commit is contained in:
commit
c7c9aa764d
|
@ -1,3 +1,488 @@
|
|||
androsyn 2008/11/11 00:00:12 UTC (20081111_0-26180)
|
||||
Log:
|
||||
fix build errors on os x leopard
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/11/07 02:10:19 UTC (20081107_0-26178)
|
||||
Log:
|
||||
untested fix for building on os x -- environ is not accessible to shared libraries...
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/10/26 20:59:07 UTC (20081026_2-26170)
|
||||
Log:
|
||||
add rb_basename and rb_dirname
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/include/rb_tools.h (File Modified)
|
||||
libratbox/trunk/src/export-syms.txt (File Modified)
|
||||
libratbox/trunk/src/tools.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/10/26 20:58:40 UTC (20081026_1-26168)
|
||||
Log:
|
||||
remove -O0 from configure.ac and configure
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/configure (File Modified)
|
||||
libratbox/trunk/configure.ac (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/10/26 20:48:56 UTC (20081026_0-26166)
|
||||
Log:
|
||||
do an ERR_get_error() if opening the dhparams file fails
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/openssl.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/10/03 18:02:13 UTC (20081003_0-26126)
|
||||
Log:
|
||||
fix up the timerfd autoconf stuff a bit better
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/acinclude.m4 (File Modified)
|
||||
libratbox/trunk/configure (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/29 22:58:42 UTC (20080929_0-26122)
|
||||
Log:
|
||||
fix the timerfd_create check
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/acinclude.m4 (File Modified)
|
||||
libratbox/trunk/configure (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/20 01:27:19 UTC (20080920_1-26100)
|
||||
Log:
|
||||
properly cast a few things when doing pointer math and the like
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/balloc.c (File Modified)
|
||||
libratbox/trunk/src/openssl.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/20 01:05:42 UTC (20080920_0-26096)
|
||||
Log:
|
||||
make rb_close_all be a no-op on win32, its not too useful there either as windows doesn't inherit sockets/files by default
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/19 15:13:52 UTC (20080919_0-26092)
|
||||
Log:
|
||||
update indent.pro and rerun through indent
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/.indent.pro (File Modified)
|
||||
libratbox/trunk/include/arc4random.h (File Modified)
|
||||
libratbox/trunk/include/commio-int.h (File Modified)
|
||||
libratbox/trunk/include/commio-ssl.h (File Modified)
|
||||
libratbox/trunk/include/rb_balloc.h (File Modified)
|
||||
libratbox/trunk/include/rb_commio.h (File Modified)
|
||||
libratbox/trunk/include/rb_event.h (File Modified)
|
||||
libratbox/trunk/include/rb_helper.h (File Modified)
|
||||
libratbox/trunk/include/rb_linebuf.h (File Modified)
|
||||
libratbox/trunk/include/rb_memory.h (File Modified)
|
||||
libratbox/trunk/include/rb_patricia.h (File Modified)
|
||||
libratbox/trunk/include/rb_rawbuf.h (File Modified)
|
||||
libratbox/trunk/include/rb_snprintf.h (File Modified)
|
||||
libratbox/trunk/include/rb_tools.h (File Modified)
|
||||
libratbox/trunk/src/arc4random.c (File Modified)
|
||||
libratbox/trunk/src/balloc.c (File Modified)
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
libratbox/trunk/src/crypt.c (File Modified)
|
||||
libratbox/trunk/src/devpoll.c (File Modified)
|
||||
libratbox/trunk/src/epoll.c (File Modified)
|
||||
libratbox/trunk/src/event.c (File Modified)
|
||||
libratbox/trunk/src/gnutls.c (File Modified)
|
||||
libratbox/trunk/src/helper.c (File Modified)
|
||||
libratbox/trunk/src/kqueue.c (File Modified)
|
||||
libratbox/trunk/src/linebuf.c (File Modified)
|
||||
libratbox/trunk/src/nossl.c (File Modified)
|
||||
libratbox/trunk/src/openssl.c (File Modified)
|
||||
libratbox/trunk/src/patricia.c (File Modified)
|
||||
libratbox/trunk/src/poll.c (File Modified)
|
||||
libratbox/trunk/src/ports.c (File Modified)
|
||||
libratbox/trunk/src/ratbox_lib.c (File Modified)
|
||||
libratbox/trunk/src/rawbuf.c (File Modified)
|
||||
libratbox/trunk/src/rb_memory.c (File Modified)
|
||||
libratbox/trunk/src/select.c (File Modified)
|
||||
libratbox/trunk/src/sigio.c (File Modified)
|
||||
libratbox/trunk/src/snprintf.c (File Modified)
|
||||
libratbox/trunk/src/tools.c (File Modified)
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
libratbox/trunk/src/win32.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/18 18:56:55 UTC (20080918_1-26088)
|
||||
Log:
|
||||
on win32 add randomness from RtlGenRandom if its available
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/arc4random.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/18 18:41:19 UTC (20080918_0-26086)
|
||||
Log:
|
||||
add timerfd_create support on linux with glibc 2.8
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/acinclude.m4 (File Modified)
|
||||
libratbox/trunk/configure (File Modified)
|
||||
libratbox/trunk/configure.ac (File Modified)
|
||||
libratbox/trunk/include/libratbox_config.h.in (File Modified)
|
||||
libratbox/trunk/src/Makefile.in (File Modified)
|
||||
libratbox/trunk/src/epoll.c (File Modified)
|
||||
libratbox/trunk/src/version.c.SH (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/15 15:47:42 UTC (20080915_0-26082)
|
||||
Log:
|
||||
cast svptr a bit harder to deal with 32bit systems. Also use sizeof our_signalfd_siginfo.
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/epoll.c (File Modified)
|
||||
|
||||
|
||||
jilles 2008/09/14 22:24:27 UTC (20080914_0-26078)
|
||||
Log:
|
||||
Fix infinite recursion crash on non-win32.
|
||||
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/10 01:45:22 UTC (20080910_1-26072)
|
||||
Log:
|
||||
fix a typo
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/select.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/10 00:23:41 UTC (20080910_0-26068)
|
||||
Log:
|
||||
attempt to override FD_SETSIZE for select and if rb_maxconnections is greater than FD_SETSIZE, lower rb_maxconnections. Also prefer select to win32
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
libratbox/trunk/src/select.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 22:58:11 UTC (20080909_8-26066)
|
||||
Log:
|
||||
actually make that use BIO_new_file
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/openssl.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 22:19:14 UTC (20080909_7-26064)
|
||||
Log:
|
||||
avoid using FILE with openssl as this causes openssl to need OPENSSL_applink on some platforms which is annoying
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/openssl.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 17:08:10 UTC (20080909_6-26060)
|
||||
Log:
|
||||
those symbols don't exist..oops
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/export-syms.txt (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 17:05:19 UTC (20080909_5-26058)
|
||||
Log:
|
||||
move that down a little
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 16:47:03 UTC (20080909_4-26052)
|
||||
Log:
|
||||
change ifdef WIN32 to _WIN32
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/include/commio-int.h (File Modified)
|
||||
libratbox/trunk/include/ratbox_lib.h (File Modified)
|
||||
libratbox/trunk/include/rb_commio.h (File Modified)
|
||||
libratbox/trunk/src/balloc.c (File Modified)
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
libratbox/trunk/src/helper.c (File Modified)
|
||||
libratbox/trunk/src/openssl.c (File Modified)
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
libratbox/trunk/src/win32.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 16:40:19 UTC (20080909_3-26048)
|
||||
Log:
|
||||
- Implement fd passing for win32 so that ssld will work on there.
|
||||
- Add a few symbols to the library for portability issues
|
||||
Note that this commit changes the API for rb_send_fd_buf as it now
|
||||
also takes a pid option as this is needed on windows. This process
|
||||
id should be the target process. Note that unix will just ignore
|
||||
this.
|
||||
|
||||
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/Makefile.in (File Modified)
|
||||
libratbox/trunk/include/ratbox_lib.h (File Modified)
|
||||
libratbox/trunk/include/rb_commio.h (File Modified)
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
libratbox/trunk/src/export-syms.txt (File Modified)
|
||||
libratbox/trunk/src/helper.c (File Modified)
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
libratbox/trunk/src/win32.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 16:37:30 UTC (20080909_2-26046)
|
||||
Log:
|
||||
pass libraries to LDFLAGS as well
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/Makefile.am (File Modified)
|
||||
libratbox/trunk/src/Makefile.in (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 16:36:15 UTC (20080909_1-26044)
|
||||
Log:
|
||||
make SSL_LIBS actually pass the path to the openssl libraries
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/configure (File Modified)
|
||||
libratbox/trunk/configure.ac (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/09 14:40:41 UTC (20080909_0-26036)
|
||||
Log:
|
||||
make that an ifdef
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/08 16:54:58 UTC (20080908_1-26034)
|
||||
Log:
|
||||
add a datagram socketpair for platforms that don't have it..mostly based on what is in perl for this
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/08 16:53:53 UTC (20080908_0-26032)
|
||||
Log:
|
||||
make rb_strerror be char instead of const char
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/include/ratbox_lib.h (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/05 23:44:06 UTC (20080905_1-26022)
|
||||
Log:
|
||||
fix the define of the fake rb_sockaddr_storage so that m4 does not eat up our [ ]
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/configure (File Modified)
|
||||
libratbox/trunk/configure.ac (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/05 18:19:25 UTC (20080905_0-26012)
|
||||
Log:
|
||||
revert part of r25994
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/configure (File Modified)
|
||||
libratbox/trunk/configure.ac (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/04 21:43:03 UTC (20080904_3-26008)
|
||||
Log:
|
||||
change hard asserts to call both the soft assert code and the C library assert so that it gets in the ircd log files as well
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/include/ratbox_lib.h (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/04 19:32:55 UTC (20080904_2-26000)
|
||||
Log:
|
||||
If somebody really wants to do profiling work..they can change rb_close_all the hard way. Also stop doing the weird stderr.log hack in libratbox let callers deal with stderr on their own
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/04 16:08:27 UTC (20080904_1-25998)
|
||||
Log:
|
||||
add missing rb_strerror prototypes
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/include/ratbox_lib.h (File Modified)
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
libratbox/trunk/src/win32.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/04 15:06:21 UTC (20080904_0-25994)
|
||||
Log:
|
||||
some portability cleanups
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/aclocal.m4 (File Modified)
|
||||
libratbox/trunk/config.guess (File Modified)
|
||||
libratbox/trunk/config.sub (File Modified)
|
||||
libratbox/trunk/configure (File Modified)
|
||||
libratbox/trunk/configure.ac (File Modified)
|
||||
libratbox/trunk/include/arc4random.h (File Modified)
|
||||
libratbox/trunk/include/libratbox_config.h.in (File Modified)
|
||||
libratbox/trunk/include/ratbox_lib.h (File Modified)
|
||||
libratbox/trunk/ltmain.sh (File Modified)
|
||||
libratbox/trunk/src/Makefile.in (File Modified)
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
libratbox/trunk/src/export-syms.txt (File Modified)
|
||||
libratbox/trunk/src/helper.c (File Modified)
|
||||
libratbox/trunk/src/nossl.c (File Modified)
|
||||
libratbox/trunk/src/unix.c (File Modified)
|
||||
libratbox/trunk/src/win32.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/03 00:20:22 UTC (20080903_0-25992)
|
||||
Log:
|
||||
change the event stuff to just strndup the event name
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/include/event-int.h (File Modified)
|
||||
libratbox/trunk/src/event.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/02 21:40:49 UTC (20080902_0-25990)
|
||||
Log:
|
||||
fix makefile on bsd make
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/Makefile.am (File Modified)
|
||||
libratbox/trunk/src/Makefile.in (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/01 05:00:31 UTC (20080901_3-25984)
|
||||
Log:
|
||||
make extern not nested
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/ratbox_lib.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/01 04:59:19 UTC (20080901_2-25982)
|
||||
Log:
|
||||
and add version.c.SH too
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/version.c.SH (File Added)
|
||||
|
||||
|
||||
androsyn 2008/09/01 04:58:51 UTC (20080901_1-25980)
|
||||
Log:
|
||||
fix up version output stuff
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/Makefile.am (File Modified)
|
||||
libratbox/trunk/src/Makefile.in (File Modified)
|
||||
libratbox/trunk/src/ratbox_lib.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/01 04:50:17 UTC (20080901_0-25978)
|
||||
Log:
|
||||
test commit
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/README (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/01 03:18:34 UTC (25975)
|
||||
Log:
|
||||
remove NOBALLOC code from linebuf.c and fill in the rb_bh_usage stuff for NOBALLOC
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/balloc.c (File Modified)
|
||||
libratbox/trunk/src/linebuf.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/01 03:12:32 UTC (25973)
|
||||
Log:
|
||||
remove an #if 0
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/event.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/09/01 03:07:46 UTC (25971)
|
||||
Log:
|
||||
change u_char to uint8_t
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/crypt.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/08/27 19:28:26 UTC (25963)
|
||||
Log:
|
||||
deal with rb_vsnprintf_append having a string passed to it that is longer than len, in such case we truncate the string..
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/snprintf.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/08/27 14:59:09 UTC (25961)
|
||||
Log:
|
||||
the way ev->name was assigned was pretty bogus and pretty much only worked because we always used strings that always were statically allocated in the executable. fix this and do it correctly
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/include/event-int.h (File Modified)
|
||||
libratbox/trunk/src/event.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/08/25 19:19:35 UTC (25955)
|
||||
Log:
|
||||
make that a %s instead of a %d
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/commio.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/08/15 16:29:35 UTC (25897)
|
||||
Log:
|
||||
order of operations in C can be a real bitch sometimes
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/balloc.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/08/14 18:23:23 UTC (25885)
|
||||
Log:
|
||||
fix block heap garbage collection properly
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/balloc.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/08/12 15:43:58 UTC (25871)
|
||||
Log:
|
||||
fix a crash in the rb_bh_gc code
|
||||
|
||||
Modified:
|
||||
libratbox/trunk/src/balloc.c (File Modified)
|
||||
|
||||
|
||||
androsyn 2008/08/06 19:51:44 UTC (25861)
|
||||
Log:
|
||||
put back in the pad to even pointer boundaries stuff
|
||||
|
|
|
@ -123,7 +123,6 @@ INSTALL_DATA = @INSTALL_DATA@
|
|||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
|
@ -205,7 +204,6 @@ psdir = @psdir@
|
|||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
subdirs = @subdirs@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
|
|
|
@ -8,4 +8,3 @@ This is libircd from ircd-ratbox. A few notes about this library:
|
|||
ircd stuff its fine.
|
||||
3. The helper code when transmitting data between helpers, the same 512 byte
|
||||
limit applies there as we recycle the linebuf code for this.
|
||||
|
||||
|
|
|
@ -111,3 +111,42 @@ case $rb__cv_timer_create_works in
|
|||
esac
|
||||
])
|
||||
|
||||
|
||||
|
||||
AC_DEFUN([RB_CHECK_TIMERFD_CREATE],
|
||||
[AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)],
|
||||
[rb__cv_timerfd_create_works],
|
||||
[AC_TRY_RUN([
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIMERFD_H
|
||||
#include <sys/timerfd.h>
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H)
|
||||
if (timerfd_create(CLOCK_REALTIME, 0) < 0) {
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
],
|
||||
[rb__cv_timerfd_create_works=yes],
|
||||
[rb__cv_timerfd_create_works=no])
|
||||
])
|
||||
case $rb__cv_timerfd_create_works in
|
||||
yes) AC_DEFINE([USE_TIMERFD_CREATE], 1,
|
||||
[Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);;
|
||||
esac
|
||||
])
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
||||
# Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2007-07-22'
|
||||
timestamp='2008-01-23'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -56,8 +56,8 @@ version="\
|
|||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -532,7 +532,7 @@ EOF
|
|||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit ;;
|
||||
*:AIX:*:[45])
|
||||
*:AIX:*:[456])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
|
@ -799,6 +799,9 @@ EOF
|
|||
EM64T | authenticamd)
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
IA64)
|
||||
echo ia64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
esac ;;
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
|
@ -833,7 +836,14 @@ EOF
|
|||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
|
@ -954,8 +964,8 @@ EOF
|
|||
x86_64:Linux:*:*)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
exit ;;
|
||||
xtensa:Linux:*:*)
|
||||
echo xtensa-unknown-linux-gnu
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
|
@ -1474,9 +1484,9 @@ This script, last modified $timestamp, has failed to recognize
|
|||
the operating system you are using. It is advised that you
|
||||
download the most up to date version of the config scripts from
|
||||
|
||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
and
|
||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
If the version you run ($0) is already up to date, please
|
||||
send the following data and any information you think might be
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
|
||||
# Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2007-06-28'
|
||||
timestamp='2008-01-16'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
|
@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
|
|||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
@ -369,10 +369,14 @@ case $basic_machine in
|
|||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
# Recognize the basic CPU types without company name, with glob match.
|
||||
xtensa*)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
386bsd)
|
||||
|
@ -443,6 +447,14 @@ case $basic_machine in
|
|||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
blackfin)
|
||||
basic_machine=bfin-unknown
|
||||
os=-linux
|
||||
;;
|
||||
blackfin-*)
|
||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
|
@ -668,6 +680,14 @@ case $basic_machine in
|
|||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
;;
|
||||
m68knommu-*)
|
||||
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
|
@ -813,6 +833,14 @@ case $basic_machine in
|
|||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
parisc)
|
||||
basic_machine=hppa-unknown
|
||||
os=-linux
|
||||
;;
|
||||
parisc-*)
|
||||
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
|
@ -1021,6 +1049,10 @@ case $basic_machine in
|
|||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=tile-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.61 for libratbox devel.
|
||||
#
|
||||
# $Id: configure.ac 25689 2008-07-10 17:13:27Z androsyn $
|
||||
# $Id: configure.ac 26168 2008-10-26 20:58:40Z androsyn $
|
||||
#
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
@ -855,9 +855,6 @@ RM
|
|||
CP
|
||||
MV
|
||||
LN
|
||||
AR
|
||||
LD
|
||||
RANLIB
|
||||
TOUCH
|
||||
build
|
||||
build_cpu
|
||||
|
@ -869,6 +866,8 @@ host_vendor
|
|||
host_os
|
||||
LN_S
|
||||
ECHO
|
||||
AR
|
||||
RANLIB
|
||||
DSYMUTIL
|
||||
NMEDIT
|
||||
CPP
|
||||
|
@ -883,7 +882,6 @@ F77
|
|||
FFLAGS
|
||||
ac_ct_F77
|
||||
LIBTOOL
|
||||
subdirs
|
||||
MINGW_TRUE
|
||||
MINGW_FALSE
|
||||
NEED_CRYPT_TRUE
|
||||
|
@ -919,7 +917,7 @@ FFLAGS
|
|||
PKG_CONFIG
|
||||
GNUTLS_CFLAGS
|
||||
GNUTLS_LIBS'
|
||||
ac_subdirs_all='libltdl'
|
||||
|
||||
|
||||
# Initialize some variables set by options.
|
||||
ac_init_help=
|
||||
|
@ -1616,7 +1614,7 @@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
|||
This configure script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
$Id: configure.ac 25689 2008-07-10 17:13:27Z androsyn $
|
||||
$Id: configure.ac 26168 2008-10-26 20:58:40Z androsyn $
|
||||
_ACEOF
|
||||
exit
|
||||
fi
|
||||
|
@ -4853,126 +4851,6 @@ echo "${ECHO_T}no" >&6; }
|
|||
fi
|
||||
|
||||
|
||||
# Extract the first word of "ar", so it can be a program name with args.
|
||||
set dummy ar; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_path_AR+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
case $AR in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_AR="$AR" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AR=$ac_cv_path_AR
|
||||
if test -n "$AR"; then
|
||||
{ echo "$as_me:$LINENO: result: $AR" >&5
|
||||
echo "${ECHO_T}$AR" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Extract the first word of "ld", so it can be a program name with args.
|
||||
set dummy ld; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_path_LD+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
case $LD in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_LD="$as_dir/$ac_word$ac_exec_ext"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
LD=$ac_cv_path_LD
|
||||
if test -n "$LD"; then
|
||||
{ echo "$as_me:$LINENO: result: $LD" >&5
|
||||
echo "${ECHO_T}$LD" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Extract the first word of "ranlib", so it can be a program name with args.
|
||||
set dummy ranlib; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_path_RANLIB+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
case $RANLIB in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
|
||||
ac_cv_path_RANLIB="$as_dir/$ac_word$ac_exec_ext"
|
||||
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
RANLIB=$ac_cv_path_RANLIB
|
||||
if test -n "$RANLIB"; then
|
||||
{ echo "$as_me:$LINENO: result: $RANLIB" >&5
|
||||
echo "${ECHO_T}$RANLIB" >&6; }
|
||||
else
|
||||
{ echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Extract the first word of "touch", so it can be a program name with args.
|
||||
set dummy touch; ac_word=$2
|
||||
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
|
@ -5617,7 +5495,7 @@ ia64-*-hpux*)
|
|||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 5620 "configure"' > conftest.$ac_ext
|
||||
echo '#line 5498 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
|
@ -8669,11 +8547,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8672: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8550: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8676: \$? = $ac_status" >&5
|
||||
echo "$as_me:8554: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -8959,11 +8837,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8962: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8840: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8966: \$? = $ac_status" >&5
|
||||
echo "$as_me:8844: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -9063,11 +8941,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:9066: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8944: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:9070: \$? = $ac_status" >&5
|
||||
echo "$as_me:8948: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -11440,7 +11318,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 11443 "configure"
|
||||
#line 11321 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -11540,7 +11418,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 11543 "configure"
|
||||
#line 11421 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -13941,11 +13819,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13944: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13822: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:13948: \$? = $ac_status" >&5
|
||||
echo "$as_me:13826: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -14045,11 +13923,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:14048: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13926: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:14052: \$? = $ac_status" >&5
|
||||
echo "$as_me:13930: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -15643,11 +15521,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15646: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15524: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:15650: \$? = $ac_status" >&5
|
||||
echo "$as_me:15528: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -15747,11 +15625,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15750: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15628: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:15754: \$? = $ac_status" >&5
|
||||
echo "$as_me:15632: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -17967,11 +17845,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:17970: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:17848: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:17974: \$? = $ac_status" >&5
|
||||
echo "$as_me:17852: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -18257,11 +18135,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:18260: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:18138: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:18264: \$? = $ac_status" >&5
|
||||
echo "$as_me:18142: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -18361,11 +18239,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:18364: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:18242: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:18368: \$? = $ac_status" >&5
|
||||
echo "$as_me:18246: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -21054,10 +20932,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
|||
|
||||
LIBTOOL="$LIBTOOL --silent"
|
||||
|
||||
subdirs="$subdirs libltdl"
|
||||
|
||||
|
||||
|
||||
case "$host_os" in
|
||||
*cygwin*)
|
||||
|
||||
|
@ -21350,6 +21224,16 @@ echo "$as_me: error: ** MinGW and no winsock2.h. I give up." >&2;}
|
|||
fi
|
||||
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_WINSOCK2_H 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_WINSOCK_H 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="$LIBS -lws2_32 -liphlpapi"
|
||||
is_mingw="yes"
|
||||
;;
|
||||
|
@ -21374,7 +21258,7 @@ fi
|
|||
|
||||
|
||||
# backwards support for IRC_CFLAGS
|
||||
CFLAGS="$IRC_CFLAGS $CFLAGS -O0 -Wall"
|
||||
CFLAGS="$IRC_CFLAGS $CFLAGS -Wall"
|
||||
|
||||
if test "$libexecdir" = '${exec_prefix}/libexec' &&
|
||||
test "$localstatedir" = '${prefix}/var'; then
|
||||
|
@ -21805,7 +21689,8 @@ fi
|
|||
|
||||
|
||||
|
||||
for ac_header in crypt.h unistd.h sys/socket.h sys/stat.h sys/time.h time.h netinet/in.h arpa/inet.h errno.h sys/uio.h spawn.h sys/poll.h sys/epoll.h sys/select.h sys/devpoll.h sys/event.h port.h signal.h sys/signalfd.h
|
||||
|
||||
for ac_header in crypt.h unistd.h sys/socket.h sys/stat.h sys/time.h time.h netinet/in.h arpa/inet.h errno.h sys/uio.h spawn.h sys/poll.h sys/epoll.h sys/select.h sys/devpoll.h sys/event.h port.h signal.h sys/signalfd.h sys/timerfd.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
|
@ -22293,9 +22178,15 @@ cat confdefs.h >>conftest.$ac_ext
|
|||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
int getpeername (int, $arg2 *, $t *);
|
||||
|
||||
int
|
||||
|
@ -22342,9 +22233,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|||
done
|
||||
|
||||
if test "x$rb_socklen_t" = x; then
|
||||
{ { echo "$as_me:$LINENO: error: Cannot find a type to use in place of socklen_t" >&5
|
||||
echo "$as_me: error: Cannot find a type to use in place of socklen_t" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
{ echo "$as_me:$LINENO: WARNING: Cannot find a type to use in place of socklen_t using int" >&5
|
||||
echo "$as_me: WARNING: Cannot find a type to use in place of socklen_t using int" >&2;}
|
||||
rb_socklen_t=int
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -22936,7 +22827,8 @@ fi
|
|||
|
||||
|
||||
|
||||
for ac_func in socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage
|
||||
|
||||
for ac_func in socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
|
@ -23294,6 +23186,95 @@ _ACEOF
|
|||
;;
|
||||
esac
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for a working timerfd_create(CLOCK_REALTIME)" >&5
|
||||
echo $ECHO_N "checking for a working timerfd_create(CLOCK_REALTIME)... $ECHO_C" >&6; }
|
||||
if test "${rb__cv_timerfd_create_works+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then
|
||||
{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
|
||||
See \`config.log' for more details." >&5
|
||||
echo "$as_me: error: cannot run test program while cross compiling
|
||||
See \`config.log' for more details." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIMERFD_H
|
||||
#include <sys/timerfd.h>
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H)
|
||||
if (timerfd_create(CLOCK_REALTIME, 0) < 0) {
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
rm -f conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
|
||||
{ (case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_try") 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
rb__cv_timerfd_create_works=yes
|
||||
else
|
||||
echo "$as_me: program exited with status $ac_status" >&5
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
rb__cv_timerfd_create_works=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $rb__cv_timerfd_create_works" >&5
|
||||
echo "${ECHO_T}$rb__cv_timerfd_create_works" >&6; }
|
||||
case $rb__cv_timerfd_create_works in
|
||||
yes)
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define USE_TIMERFD_CREATE 1
|
||||
_ACEOF
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
|
||||
# for constant arguments. Useless!
|
||||
|
@ -24783,7 +24764,6 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
|
||||
if test "$cf_enable_openssl" != no; then
|
||||
CPPFLAGS="$CPPFLAGS $SSL_LIBS"
|
||||
{ echo "$as_me:$LINENO: checking for SSL_read in -lssl" >&5
|
||||
|
@ -24848,7 +24828,7 @@ fi
|
|||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_read" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_ssl_SSL_read" >&6; }
|
||||
if test $ac_cv_lib_ssl_SSL_read = yes; then
|
||||
SSL_LIBS="-lssl -lcrypto"
|
||||
SSL_LIBS="$SSL_LIBS -lssl -lcrypto"
|
||||
else
|
||||
cf_enable_openssl=no
|
||||
fi
|
||||
|
@ -26054,9 +26034,6 @@ RM!$RM$ac_delim
|
|||
CP!$CP$ac_delim
|
||||
MV!$MV$ac_delim
|
||||
LN!$LN$ac_delim
|
||||
AR!$AR$ac_delim
|
||||
LD!$LD$ac_delim
|
||||
RANLIB!$RANLIB$ac_delim
|
||||
TOUCH!$TOUCH$ac_delim
|
||||
build!$build$ac_delim
|
||||
build_cpu!$build_cpu$ac_delim
|
||||
|
@ -26065,6 +26042,9 @@ build_os!$build_os$ac_delim
|
|||
host!$host$ac_delim
|
||||
host_cpu!$host_cpu$ac_delim
|
||||
host_vendor!$host_vendor$ac_delim
|
||||
host_os!$host_os$ac_delim
|
||||
LN_S!$LN_S$ac_delim
|
||||
ECHO!$ECHO$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
|
@ -26106,9 +26086,8 @@ _ACEOF
|
|||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
host_os!$host_os$ac_delim
|
||||
LN_S!$LN_S$ac_delim
|
||||
ECHO!$ECHO$ac_delim
|
||||
AR!$AR$ac_delim
|
||||
RANLIB!$RANLIB$ac_delim
|
||||
DSYMUTIL!$DSYMUTIL$ac_delim
|
||||
NMEDIT!$NMEDIT$ac_delim
|
||||
CPP!$CPP$ac_delim
|
||||
|
@ -26123,7 +26102,6 @@ F77!$F77$ac_delim
|
|||
FFLAGS!$FFLAGS$ac_delim
|
||||
ac_ct_F77!$ac_ct_F77$ac_delim
|
||||
LIBTOOL!$LIBTOOL$ac_delim
|
||||
subdirs!$subdirs$ac_delim
|
||||
MINGW_TRUE!$MINGW_TRUE$ac_delim
|
||||
MINGW_FALSE!$MINGW_FALSE$ac_delim
|
||||
NEED_CRYPT_TRUE!$NEED_CRYPT_TRUE$ac_delim
|
||||
|
@ -26142,7 +26120,7 @@ LIBOBJS!$LIBOBJS$ac_delim
|
|||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 34; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 32; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
@ -26802,7 +26780,7 @@ fi
|
|||
if test "x$rb_sockaddr_storage" = "xyes"; then
|
||||
echo '#define rb_sockaddr_storage sockaddr_storage' >> $outfile
|
||||
else
|
||||
echo 'struct rb_sockaddr_storage { uint8_t _padding128; };' >> $outfile
|
||||
echo 'struct rb_sockaddr_storage { uint8_t _padding[128]; };' >> $outfile
|
||||
fi
|
||||
|
||||
cat >> $outfile <<\_______EOF
|
||||
|
@ -26850,186 +26828,6 @@ if test "$no_create" != yes; then
|
|||
$ac_cs_success || { (exit 1); exit 1; }
|
||||
fi
|
||||
|
||||
#
|
||||
# CONFIG_SUBDIRS section.
|
||||
#
|
||||
if test "$no_recursion" != yes; then
|
||||
|
||||
# Remove --cache-file and --srcdir arguments so they do not pile up.
|
||||
ac_sub_configure_args=
|
||||
ac_prev=
|
||||
eval "set x $ac_configure_args"
|
||||
shift
|
||||
for ac_arg
|
||||
do
|
||||
if test -n "$ac_prev"; then
|
||||
ac_prev=
|
||||
continue
|
||||
fi
|
||||
case $ac_arg in
|
||||
-cache-file | --cache-file | --cache-fil | --cache-fi \
|
||||
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
|
||||
ac_prev=cache_file ;;
|
||||
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
|
||||
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
|
||||
| --c=*)
|
||||
;;
|
||||
--config-cache | -C)
|
||||
;;
|
||||
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
|
||||
ac_prev=srcdir ;;
|
||||
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
|
||||
;;
|
||||
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
|
||||
ac_prev=prefix ;;
|
||||
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
|
||||
;;
|
||||
*)
|
||||
case $ac_arg in
|
||||
*\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
|
||||
esac
|
||||
ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Always prepend --prefix to ensure using the same prefix
|
||||
# in subdir configurations.
|
||||
ac_arg="--prefix=$prefix"
|
||||
case $ac_arg in
|
||||
*\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
|
||||
esac
|
||||
ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
|
||||
|
||||
# Pass --silent
|
||||
if test "$silent" = yes; then
|
||||
ac_sub_configure_args="--silent $ac_sub_configure_args"
|
||||
fi
|
||||
|
||||
ac_popdir=`pwd`
|
||||
for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
|
||||
|
||||
# Do not complain, so a configure script can configure whichever
|
||||
# parts of a large source tree are present.
|
||||
test -d "$srcdir/$ac_dir" || continue
|
||||
|
||||
ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
|
||||
echo "$as_me:$LINENO: $ac_msg" >&5
|
||||
echo "$ac_msg" >&6
|
||||
{ as_dir="$ac_dir"
|
||||
case $as_dir in #(
|
||||
-*) as_dir=./$as_dir;;
|
||||
esac
|
||||
test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
|
||||
as_dirs=
|
||||
while :; do
|
||||
case $as_dir in #(
|
||||
*\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
|
||||
*) as_qdir=$as_dir;;
|
||||
esac
|
||||
as_dirs="'$as_qdir' $as_dirs"
|
||||
as_dir=`$as_dirname -- "$as_dir" ||
|
||||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$as_dir" : 'X\(//\)[^/]' \| \
|
||||
X"$as_dir" : 'X\(//\)$' \| \
|
||||
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$as_dir" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'`
|
||||
test -d "$as_dir" && break
|
||||
done
|
||||
test -z "$as_dirs" || eval "mkdir $as_dirs"
|
||||
} || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
|
||||
echo "$as_me: error: cannot create directory $as_dir" >&2;}
|
||||
{ (exit 1); exit 1; }; }; }
|
||||
ac_builddir=.
|
||||
|
||||
case "$ac_dir" in
|
||||
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
|
||||
*)
|
||||
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
|
||||
# A ".." for each directory in $ac_dir_suffix.
|
||||
ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
|
||||
case $ac_top_builddir_sub in
|
||||
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
|
||||
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
|
||||
esac ;;
|
||||
esac
|
||||
ac_abs_top_builddir=$ac_pwd
|
||||
ac_abs_builddir=$ac_pwd$ac_dir_suffix
|
||||
# for backward compatibility:
|
||||
ac_top_builddir=$ac_top_build_prefix
|
||||
|
||||
case $srcdir in
|
||||
.) # We are building in place.
|
||||
ac_srcdir=.
|
||||
ac_top_srcdir=$ac_top_builddir_sub
|
||||
ac_abs_top_srcdir=$ac_pwd ;;
|
||||
[\\/]* | ?:[\\/]* ) # Absolute name.
|
||||
ac_srcdir=$srcdir$ac_dir_suffix;
|
||||
ac_top_srcdir=$srcdir
|
||||
ac_abs_top_srcdir=$srcdir ;;
|
||||
*) # Relative name.
|
||||
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
|
||||
ac_top_srcdir=$ac_top_build_prefix$srcdir
|
||||
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
|
||||
esac
|
||||
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
|
||||
|
||||
|
||||
cd "$ac_dir"
|
||||
|
||||
# Check for guested configure; otherwise get Cygnus style configure.
|
||||
if test -f "$ac_srcdir/configure.gnu"; then
|
||||
ac_sub_configure=$ac_srcdir/configure.gnu
|
||||
elif test -f "$ac_srcdir/configure"; then
|
||||
ac_sub_configure=$ac_srcdir/configure
|
||||
elif test -f "$ac_srcdir/configure.in"; then
|
||||
# This should be Cygnus configure.
|
||||
ac_sub_configure=$ac_aux_dir/configure
|
||||
else
|
||||
{ echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
|
||||
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
|
||||
ac_sub_configure=
|
||||
fi
|
||||
|
||||
# The recursion is here.
|
||||
if test -n "$ac_sub_configure"; then
|
||||
# Make the cache file name correct relative to the subdirectory.
|
||||
case $cache_file in
|
||||
[\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
|
||||
*) # Relative name.
|
||||
ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
|
||||
esac
|
||||
|
||||
{ echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
|
||||
echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
|
||||
# The eval makes quoting arguments work.
|
||||
eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
|
||||
--cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
|
||||
{ { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
|
||||
echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
cd "$ac_popdir"
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
dnl $Id: configure.ac 25689 2008-07-10 17:13:27Z androsyn $
|
||||
dnl $Id: configure.ac 26168 2008-10-26 20:58:40Z androsyn $
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
dnl TODO: clean up all the OpenSSL and shared module checking stuff;
|
||||
dnl the most major changes have already been made and it looks like
|
||||
dnl said functions need to be just about as complex as they already are.
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
AC_PREREQ(2.61)
|
||||
AUTOMAKE_OPTIONS = 1.10
|
||||
dnl Sneaky way to get an Id tag into the configure script
|
||||
AC_COPYRIGHT([$Id: configure.ac 25689 2008-07-10 17:13:27Z androsyn $])
|
||||
AC_COPYRIGHT([$Id: configure.ac 26168 2008-10-26 20:58:40Z androsyn $])
|
||||
AC_INIT([libratbox],[devel])
|
||||
AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, -)
|
||||
|
||||
|
@ -50,9 +50,6 @@ AC_PATH_PROG(RM, rm)
|
|||
AC_PATH_PROG(CP, cp)
|
||||
AC_PATH_PROG(MV, mv)
|
||||
AC_PATH_PROG(LN, ln)
|
||||
AC_PATH_PROG(AR, ar)
|
||||
AC_PATH_PROG(LD, ld)
|
||||
AC_PATH_PROG(RANLIB, ranlib)
|
||||
AC_PATH_PROG(TOUCH, touch)
|
||||
AC_LANG(C)
|
||||
|
||||
|
@ -60,9 +57,6 @@ AC_PROG_LIBTOOL
|
|||
|
||||
LIBTOOL="$LIBTOOL --silent"
|
||||
|
||||
AC_CONFIG_SUBDIRS(libltdl)
|
||||
|
||||
|
||||
case "$host_os" in
|
||||
*cygwin*)
|
||||
AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system])
|
||||
|
@ -73,6 +67,8 @@ case "$host_os" in
|
|||
AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system])
|
||||
AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])])
|
||||
AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])])
|
||||
AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, [Have WINSOCK2_H])
|
||||
AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, [Have WINSOCK_H])
|
||||
LIBS="$LIBS -lws2_32 -liphlpapi"
|
||||
is_mingw="yes"
|
||||
;;
|
||||
|
@ -90,7 +86,7 @@ AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"])
|
|||
|
||||
|
||||
# backwards support for IRC_CFLAGS
|
||||
CFLAGS="$IRC_CFLAGS $CFLAGS -O0 -Wall"
|
||||
CFLAGS="$IRC_CFLAGS $CFLAGS -Wall"
|
||||
|
||||
dnl use directory structure of cached as default (hack)
|
||||
if test "$libexecdir" = '${exec_prefix}/libexec' &&
|
||||
|
@ -108,7 +104,7 @@ AC_TYPE_UID_T
|
|||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
AC_CHECK_HEADERS([crypt.h unistd.h sys/socket.h sys/stat.h sys/time.h time.h netinet/in.h arpa/inet.h errno.h sys/uio.h spawn.h sys/poll.h sys/epoll.h sys/select.h sys/devpoll.h sys/event.h port.h signal.h sys/signalfd.h])
|
||||
AC_CHECK_HEADERS([crypt.h unistd.h sys/socket.h sys/stat.h sys/time.h time.h netinet/in.h arpa/inet.h errno.h sys/uio.h spawn.h sys/poll.h sys/epoll.h sys/select.h sys/devpoll.h sys/event.h port.h signal.h sys/signalfd.h sys/timerfd.h])
|
||||
AC_HEADER_TIME
|
||||
|
||||
dnl Networking Functions
|
||||
|
@ -140,9 +136,15 @@ AC_CHECK_TYPE([socklen_t], rb_socklen_t=socklen_t,[
|
|||
for arg2 in "struct sockaddr" void; do
|
||||
for t in int size_t unsigned long "unsigned long"; do
|
||||
AC_TRY_COMPILE([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
int getpeername (int, $arg2 *, $t *);
|
||||
],[
|
||||
$t len;
|
||||
|
@ -155,7 +157,8 @@ getpeername(0,0,&len);
|
|||
done
|
||||
|
||||
if test "x$rb_socklen_t" = x; then
|
||||
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
|
||||
AC_MSG_WARN([Cannot find a type to use in place of socklen_t using int])
|
||||
rb_socklen_t=int
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT($rb_socklen_t)],
|
||||
|
@ -224,11 +227,12 @@ AC_CHECK_TYPE([sa_family_t], [],
|
|||
|
||||
|
||||
dnl check for various functions...
|
||||
AC_CHECK_FUNCS([socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage])
|
||||
AC_CHECK_FUNCS([socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create])
|
||||
|
||||
AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep]))
|
||||
AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create]))
|
||||
RB_CHECK_TIMER_CREATE
|
||||
RB_CHECK_TIMERFD_CREATE
|
||||
|
||||
AC_FUNC_ALLOCA
|
||||
AC_FUNC_VFORK
|
||||
|
@ -343,11 +347,10 @@ if test "$cf_enable_openssl" != no; then
|
|||
[cf_enable_openssl=no])
|
||||
fi
|
||||
|
||||
|
||||
if test "$cf_enable_openssl" != no; then
|
||||
CPPFLAGS="$CPPFLAGS $SSL_LIBS"
|
||||
AC_CHECK_LIB(ssl, SSL_read,
|
||||
[SSL_LIBS="-lssl -lcrypto"],
|
||||
[SSL_LIBS="$SSL_LIBS -lssl -lcrypto"],
|
||||
[cf_enable_openssl=no], [-lcrypto])
|
||||
fi
|
||||
|
||||
|
@ -557,7 +560,7 @@ fi
|
|||
if test "x$rb_sockaddr_storage" = "xyes"; then
|
||||
echo '#define rb_sockaddr_storage sockaddr_storage' >> $outfile
|
||||
else
|
||||
echo 'struct rb_sockaddr_storage { uint8_t _padding[128]; };' >> $outfile
|
||||
echo 'struct rb_sockaddr_storage { uint8_t _padding[[128]]; };' >> $outfile
|
||||
fi
|
||||
|
||||
cat >> $outfile <<\_______EOF
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define FD_DESC_SZ 128 /* hostlen + comment */
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0)
|
||||
#else
|
||||
#define rb_get_errno()
|
||||
|
@ -122,7 +122,8 @@ struct _fde
|
|||
typedef void (*comm_event_cb_t) (void *);
|
||||
|
||||
#ifdef USE_TIMER_CREATE
|
||||
typedef struct timer_data {
|
||||
typedef struct timer_data
|
||||
{
|
||||
timer_t td_timer_id;
|
||||
comm_event_cb_t td_cb;
|
||||
void *td_udata;
|
||||
|
@ -230,4 +231,3 @@ void rb_setselect_win32(rb_fde_t *F, unsigned int type, PF * handler, void *clie
|
|||
int rb_init_netio_win32(void);
|
||||
int rb_select_win32(long);
|
||||
int rb_setup_fd_win32(rb_fde_t *F);
|
||||
|
||||
|
|
|
@ -8,10 +8,9 @@ int rb_get_random(void *buf, size_t length);
|
|||
const char *rb_get_ssl_strerror(rb_fde_t *F);
|
||||
void rb_ssl_start_accepted(rb_fde_t *new_F, ACCB * cb, void *data, int timeout);
|
||||
void rb_ssl_start_connected(rb_fde_t *F, CNCB * callback, void *data, int timeout);
|
||||
void rb_connect_tcp_ssl(rb_fde_t *F, struct sockaddr *dest, struct sockaddr *clocal, int socklen, CNCB *callback, void *data, int timeout);
|
||||
void rb_connect_tcp_ssl(rb_fde_t *F, struct sockaddr *dest, struct sockaddr *clocal, int socklen,
|
||||
CNCB * callback, void *data, int timeout);
|
||||
void rb_ssl_accept_setup(rb_fde_t *F, rb_fde_t *new_F, struct sockaddr *st, int addrlen);
|
||||
void rb_ssl_shutdown(rb_fde_t *F);
|
||||
ssize_t rb_ssl_read(rb_fde_t *F, void *buf, size_t count);
|
||||
ssize_t rb_ssl_write(rb_fde_t *F, const void *buf, size_t count);
|
||||
|
||||
|
||||
|
|
|
@ -20,16 +20,15 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: event-int.h 24840 2008-01-03 19:42:17Z androsyn $
|
||||
* $Id: event-int.h 25992 2008-09-03 00:20:22Z androsyn $
|
||||
*/
|
||||
|
||||
|
||||
struct ev_entry
|
||||
{
|
||||
rb_dlink_node node;
|
||||
EVH *func;
|
||||
void *arg;
|
||||
const char *name;
|
||||
char *name;
|
||||
time_t frequency;
|
||||
time_t when;
|
||||
void *data;
|
||||
|
|
|
@ -165,6 +165,9 @@
|
|||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/timerfd.h> header file. */
|
||||
#undef HAVE_SYS_TIMERFD_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
|
@ -174,6 +177,9 @@
|
|||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
#undef HAVE_SYS_UIO_H
|
||||
|
||||
/* Define to 1 if you have the `timerfd_create' function. */
|
||||
#undef HAVE_TIMERFD_CREATE
|
||||
|
||||
/* Define if you have timer_create */
|
||||
#undef HAVE_TIMER_CREATE
|
||||
|
||||
|
@ -195,6 +201,12 @@
|
|||
/* Define to 1 if you are on windows */
|
||||
#undef HAVE_WIN32
|
||||
|
||||
/* Have WINSOCK2_H */
|
||||
#undef HAVE_WINSOCK2_H
|
||||
|
||||
/* Have WINSOCK_H */
|
||||
#undef HAVE_WINSOCK_H
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#undef HAVE_WORKING_FORK
|
||||
|
||||
|
@ -257,6 +269,9 @@
|
|||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...) */
|
||||
#undef USE_TIMERFD_CREATE
|
||||
|
||||
/* Define to 1 if we can use timer_create(CLOCK_REALTIME,...) */
|
||||
#undef USE_TIMER_CREATE
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: ratbox_lib.h 25375 2008-05-16 15:19:51Z androsyn $
|
||||
* $Id: ratbox_lib.h 26052 2008-09-09 16:47:03Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
@ -68,20 +68,19 @@ char *alloca();
|
|||
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <process.h>
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 128
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef strerror
|
||||
#undef strerror
|
||||
#endif
|
||||
|
||||
#define strerror(x) wsock_strerror(x)
|
||||
const char *wsock_strerror(int error);
|
||||
#define strerror(x) rb_strerror(x)
|
||||
char *rb_strerror(int error);
|
||||
|
||||
|
||||
#define ENOBUFS WSAENOBUFS
|
||||
|
@ -96,18 +95,13 @@ const char *wsock_strerror(int error);
|
|||
#define pipe(x) _pipe(x, 1024, O_BINARY)
|
||||
#define ioctl(x,y,z) ioctlsocket(x,y, (u_long *)z)
|
||||
|
||||
int setenv(const char *, const char *, int);
|
||||
int kill(int pid, int sig);
|
||||
#define WNOHANG 1
|
||||
pid_t waitpid(pid_t pid, int *status, int options);
|
||||
pid_t getpid(void);
|
||||
unsigned int geteuid(void);
|
||||
|
||||
#ifndef SIGKILL
|
||||
#define SIGKILL SIGTERM
|
||||
#endif
|
||||
|
||||
#endif /* WIN32 */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
||||
|
@ -115,9 +109,8 @@ unsigned int geteuid(void);
|
|||
#define HOSTIPLEN 53
|
||||
#endif
|
||||
|
||||
#ifdef SOFT_ASSERT
|
||||
#ifdef __GNUC__
|
||||
#define lrb_assert(expr) do \
|
||||
#define slrb_assert(expr) do \
|
||||
if(rb_unlikely(!(expr))) { \
|
||||
rb_lib_log( \
|
||||
"file: %s line: %d (%s): Assertion failed: (%s)", \
|
||||
|
@ -125,7 +118,7 @@ unsigned int geteuid(void);
|
|||
} \
|
||||
while(0)
|
||||
#else
|
||||
#define lrb_assert(expr) do \
|
||||
#define slrb_assert(expr) do \
|
||||
if(rb_unlikely(!(expr))) { \
|
||||
rb_lib_log(L_MAIN, \
|
||||
"file: %s line: %d: Assertion failed: (%s)", \
|
||||
|
@ -133,16 +126,19 @@ unsigned int geteuid(void);
|
|||
} \
|
||||
while(0)
|
||||
#endif
|
||||
|
||||
#ifdef SOFT_ASSERT
|
||||
#define lrb_assert(expr) slrb_assert(expr)
|
||||
#else
|
||||
#define lrb_assert(expr) assert(expr)
|
||||
#define lrb_assert(expr) do { slrb_assert(expr); assert(expr); } while(0)
|
||||
#endif
|
||||
|
||||
#ifdef RB_SOCKADDR_HAS_SA_LEN
|
||||
#define ss_len sa_len
|
||||
#endif
|
||||
|
||||
#define GET_SS_FAMILY(x) (((struct sockaddr *)(x))->sa_family)
|
||||
|
||||
#define GET_SS_FAMILY(x) (((const struct sockaddr *)(x))->sa_family)
|
||||
#define SET_SS_FAMILY(x, y) ((((struct sockaddr *)(x))->sa_family) = y)
|
||||
#ifdef RB_SOCKADDR_HAS_SA_LEN
|
||||
#define SET_SS_LEN(x, y) do { \
|
||||
struct sockaddr *storage; \
|
||||
|
@ -201,8 +197,15 @@ char *rb_crypt(const char *, const char *);
|
|||
|
||||
unsigned char *rb_base64_encode(const unsigned char *str, int length);
|
||||
unsigned char *rb_base64_decode(const unsigned char *str, int length, int *ret);
|
||||
int rb_kill(pid_t, int);
|
||||
char *rb_strerror(int);
|
||||
|
||||
int rb_setenv(const char *, const char *, int);
|
||||
int rb_kill(int pid, int sig);
|
||||
|
||||
pid_t rb_waitpid(pid_t pid, int *status, int options);
|
||||
pid_t rb_getpid(void);
|
||||
//unsigned int rb_geteuid(void);
|
||||
|
||||
#include <rb_tools.h>
|
||||
#include <rb_memory.h>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_balloc.h 24324 2007-08-31 22:05:45Z androsyn $
|
||||
* $Id: rb_balloc.h 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
@ -34,7 +34,8 @@
|
|||
|
||||
struct rb_bh;
|
||||
typedef struct rb_bh rb_bh;
|
||||
typedef void rb_bh_usage_cb(size_t bused, size_t bfree, size_t bmemusage, size_t heapalloc, const char *desc, void *data);
|
||||
typedef void rb_bh_usage_cb (size_t bused, size_t bfree, size_t bmemusage, size_t heapalloc,
|
||||
const char *desc, void *data);
|
||||
|
||||
|
||||
int rb_bh_free(rb_bh *, void *);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_commio.h 25693 2008-07-10 18:27:23Z androsyn $
|
||||
* $Id: rb_commio.h 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
@ -64,7 +64,7 @@ enum
|
|||
#define RB_FD_NONE 0x01
|
||||
#define RB_FD_FILE 0x02
|
||||
#define RB_FD_SOCKET 0x04
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
#define RB_FD_PIPE 0x08
|
||||
#else
|
||||
#define RB_FD_PIPE RB_FD_SOCKET
|
||||
|
@ -107,15 +107,14 @@ int rb_get_sockerr(rb_fde_t *);
|
|||
|
||||
void rb_settimeout(rb_fde_t *, time_t, PF *, void *);
|
||||
void rb_checktimeouts(void *);
|
||||
void rb_connect_tcp(rb_fde_t *, struct sockaddr *,
|
||||
struct sockaddr *, int, CNCB *, void *, int);
|
||||
void rb_connect_tcp_ssl(rb_fde_t *, struct sockaddr *,
|
||||
struct sockaddr *, int, CNCB *, void *, int);
|
||||
void rb_connect_tcp(rb_fde_t *, struct sockaddr *, struct sockaddr *, int, CNCB *, void *, int);
|
||||
void rb_connect_tcp_ssl(rb_fde_t *, struct sockaddr *, struct sockaddr *, int, CNCB *, void *, int);
|
||||
int rb_connect_sockaddr(rb_fde_t *, struct sockaddr *addr, int len);
|
||||
|
||||
const char *rb_errstr(int status);
|
||||
rb_fde_t *rb_socket(int family, int sock_type, int proto, const char *note);
|
||||
int rb_socketpair(int family, int sock_type, int proto, rb_fde_t **F1, rb_fde_t **F2, const char *note);
|
||||
int rb_socketpair(int family, int sock_type, int proto, rb_fde_t **F1, rb_fde_t **F2,
|
||||
const char *note);
|
||||
|
||||
void rb_accept_tcp(rb_fde_t *, ACPRE * precb, ACCB * callback, void *data);
|
||||
ssize_t rb_write(rb_fde_t *, const void *buf, int count);
|
||||
|
@ -145,7 +144,7 @@ const char *rb_get_ssl_strerror(rb_fde_t *F);
|
|||
|
||||
rb_fde_t *rb_get_fde(int fd);
|
||||
|
||||
int rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize);
|
||||
int rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid);
|
||||
int rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int count);
|
||||
|
||||
void rb_set_type(rb_fde_t *F, uint8_t type);
|
||||
|
@ -153,10 +152,11 @@ uint8_t rb_get_type(rb_fde_t *F);
|
|||
|
||||
const char *rb_get_iotype(void);
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
RB_PRNG_EGD,
|
||||
RB_PRNG_FILE,
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
RB_PRNGWIN32,
|
||||
#endif
|
||||
RB_PRNG_DEFAULT,
|
||||
|
@ -172,4 +172,8 @@ int rb_supports_ssl(void);
|
|||
unsigned int rb_ssl_handshake_count(rb_fde_t *F);
|
||||
void rb_ssl_clear_handshake_count(rb_fde_t *F);
|
||||
|
||||
|
||||
int rb_pass_fd_to_process(rb_fde_t *, pid_t, rb_fde_t *);
|
||||
rb_fde_t *rb_recv_fd(rb_fde_t *);
|
||||
|
||||
#endif /* INCLUDED_commio_h */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_event.h 25151 2008-03-28 17:19:12Z androsyn $
|
||||
* $Id: rb_event.h 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_helper.h 24936 2008-01-14 20:43:23Z androsyn $
|
||||
* $Id: rb_helper.h 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
@ -36,7 +36,8 @@ typedef void rb_helper_cb(rb_helper *);
|
|||
|
||||
|
||||
|
||||
rb_helper *rb_helper_start(const char *name, const char *fullpath, rb_helper_cb *read_cb, rb_helper_cb *error_cb);
|
||||
rb_helper *rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb,
|
||||
rb_helper_cb * error_cb);
|
||||
|
||||
rb_helper *rb_helper_child(rb_helper_cb * read_cb, rb_helper_cb * error_cb,
|
||||
log_cb * ilog, restart_cb * irestart, die_cb * idie,
|
||||
|
@ -44,8 +45,11 @@ rb_helper *rb_helper_child(rb_helper_cb *read_cb, rb_helper_cb *error_cb,
|
|||
|
||||
void rb_helper_restart(rb_helper *helper);
|
||||
#ifdef __GNUC__
|
||||
void rb_helper_write(rb_helper *helper, const char *format, ...) __attribute((format(printf, 2, 3)));
|
||||
void rb_helper_write_queue(rb_helper *helper, const char *format, ...) __attribute((format(printf, 2, 3)));
|
||||
void
|
||||
rb_helper_write(rb_helper *helper, const char *format, ...)
|
||||
__attribute((format(printf, 2, 3)));
|
||||
void rb_helper_write_queue(rb_helper *helper, const char *format, ...)
|
||||
__attribute((format(printf, 2, 3)));
|
||||
#else
|
||||
void rb_helper_write(rb_helper *helper, const char *format, ...);
|
||||
void rb_helper_write_queue(rb_helper *helper, const char *format, ...);
|
||||
|
@ -57,4 +61,3 @@ void rb_helper_close(rb_helper *helper);
|
|||
int rb_helper_read(rb_helper *helper, void *buf, size_t bufsize);
|
||||
void rb_helper_loop(rb_helper *helper, long delay);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_linebuf.h 25675 2008-07-06 04:13:05Z androsyn $
|
||||
* $Id: rb_linebuf.h 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_memory.h 25375 2008-05-16 15:19:51Z androsyn $
|
||||
* $Id: rb_memory.h 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
@ -84,4 +84,3 @@ rb_free(void *ptr)
|
|||
}
|
||||
|
||||
#endif /* _I_MEMORY_H */
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ rb_patricia_tree_t;
|
|||
|
||||
|
||||
rb_patricia_node_t *rb_match_ip(rb_patricia_tree_t *tree, struct sockaddr *ip);
|
||||
rb_patricia_node_t *rb_match_ip_exact(rb_patricia_tree_t * tree, struct sockaddr *ip, unsigned int len);
|
||||
rb_patricia_node_t *rb_match_ip_exact(rb_patricia_tree_t *tree, struct sockaddr *ip,
|
||||
unsigned int len);
|
||||
rb_patricia_node_t *rb_match_string(rb_patricia_tree_t *tree, const char *string);
|
||||
rb_patricia_node_t *rb_match_exact_string(rb_patricia_tree_t *tree, const char *string);
|
||||
rb_patricia_node_t *rb_patricia_search_exact(rb_patricia_tree_t *patricia, rb_prefix_t *prefix);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_snprintf.h 24324 2007-08-31 22:05:45Z androsyn $
|
||||
* $Id: rb_snprintf.h 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
@ -40,10 +40,14 @@
|
|||
* rb_sprintf - optimized sprintf
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
int rb_sprintf(char *str, const char *fmt, ...) __attribute((format(printf, 2, 3)));
|
||||
int rb_snprintf(char *str, const size_t size, const char *, ...) __attribute__ ((format(printf, 3, 4)));
|
||||
int
|
||||
rb_sprintf(char *str, const char *fmt, ...)
|
||||
__attribute((format(printf, 2, 3)));
|
||||
int rb_snprintf(char *str, const size_t size, const char *, ...)
|
||||
__attribute__ ((format(printf, 3, 4)));
|
||||
int rb_sprintf_append(char *str, const char *format, ...) __attribute((format(printf, 2, 3)));
|
||||
int rb_snprintf_append(char *str, size_t len, const char *format, ...) __attribute__ ((format(printf, 3, 4)));
|
||||
int rb_snprintf_append(char *str, size_t len, const char *format, ...)
|
||||
__attribute__ ((format(printf, 3, 4)));
|
||||
#else
|
||||
int rb_sprintf(char *str, const char *format, ...);
|
||||
int rb_snprintf(char *str, const size_t size, const char *, ...);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_tools.h 25042 2008-01-23 16:14:08Z androsyn $
|
||||
* $Id: rb_tools.h 26170 2008-10-26 20:59:07Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef RB_LIB_H
|
||||
|
@ -34,6 +34,8 @@
|
|||
size_t rb_strlcpy(char *dst, const char *src, size_t siz);
|
||||
size_t rb_strlcat(char *dst, const char *src, size_t siz);
|
||||
size_t rb_strnlen(const char *s, size_t count);
|
||||
char *rb_basename(const char *);
|
||||
char *rb_dirname(const char *);
|
||||
|
||||
int rb_string_to_array(char *string, char **parv, int maxpara);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# NOTE: Changing this file will not affect anything until you rerun configure.
|
||||
#
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
|
||||
# 2007 Free Software Foundation, Inc.
|
||||
# 2007, 2008 Free Software Foundation, Inc.
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -43,8 +43,8 @@ EXIT_FAILURE=1
|
|||
|
||||
PROGRAM=ltmain.sh
|
||||
PACKAGE=libtool
|
||||
VERSION="1.5.24 Debian 1.5.24-1"
|
||||
TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
|
||||
VERSION="1.5.26 Debian 1.5.26-4"
|
||||
TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
|
||||
|
||||
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
|
@ -113,15 +113,21 @@ esac
|
|||
# These must not be set unconditionally because not all systems understand
|
||||
# e.g. LANG=C (notably SCO).
|
||||
# We save the old values to restore during execute mode.
|
||||
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
lt_env=
|
||||
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${$lt_var+set}\" = set; then
|
||||
save_$lt_var=\$$lt_var
|
||||
lt_env=\"$lt_var=\$$lt_var \$lt_env\"
|
||||
$lt_var=C
|
||||
export $lt_var
|
||||
fi"
|
||||
done
|
||||
|
||||
if test -n "$lt_env"; then
|
||||
lt_env="env $lt_env"
|
||||
fi
|
||||
|
||||
# Make sure IFS has a sensible default
|
||||
lt_nl='
|
||||
'
|
||||
|
@ -485,7 +491,7 @@ do
|
|||
echo "\
|
||||
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
exit $?
|
||||
|
@ -788,6 +794,7 @@ if test -z "$show_help"; then
|
|||
*.for) xform=for ;;
|
||||
*.java) xform=java ;;
|
||||
*.obj) xform=obj ;;
|
||||
*.sx) xform=sx ;;
|
||||
esac
|
||||
|
||||
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
|
||||
|
@ -956,7 +963,7 @@ EOF
|
|||
$run $rm "$lobj" "$output_obj"
|
||||
|
||||
$show "$command"
|
||||
if $run eval "$command"; then :
|
||||
if $run eval $lt_env "$command"; then :
|
||||
else
|
||||
test -n "$output_obj" && $run $rm $removelist
|
||||
exit $EXIT_FAILURE
|
||||
|
@ -1028,7 +1035,7 @@ EOF
|
|||
command="$command$suppress_output"
|
||||
$run $rm "$obj" "$output_obj"
|
||||
$show "$command"
|
||||
if $run eval "$command"; then :
|
||||
if $run eval $lt_env "$command"; then :
|
||||
else
|
||||
$run $rm $removelist
|
||||
exit $EXIT_FAILURE
|
||||
|
@ -1161,6 +1168,7 @@ EOF
|
|||
thread_safe=no
|
||||
vinfo=
|
||||
vinfo_number=no
|
||||
single_module="${wl}-single_module"
|
||||
|
||||
func_infer_tag $base_compile
|
||||
|
||||
|
@ -1646,6 +1654,11 @@ EOF
|
|||
continue
|
||||
;;
|
||||
|
||||
-multi_module)
|
||||
single_module="${wl}-multi_module"
|
||||
continue
|
||||
;;
|
||||
|
||||
-module)
|
||||
module=yes
|
||||
continue
|
||||
|
@ -2152,7 +2165,12 @@ EOF
|
|||
continue
|
||||
fi
|
||||
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
|
||||
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
|
||||
if test "$linkmode" = lib; then
|
||||
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
|
||||
else
|
||||
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
|
||||
fi
|
||||
for searchdir in $searchdirs; do
|
||||
for search_ext in .la $std_shrext .so .a; do
|
||||
# Search the libtool library
|
||||
lib="$searchdir/lib${name}${search_ext}"
|
||||
|
@ -2948,12 +2966,18 @@ EOF
|
|||
# we do not want to link against static libs,
|
||||
# but need to link against shared
|
||||
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
|
||||
eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
|
||||
if test -n "$deplibrary_names" ; then
|
||||
for tmp in $deplibrary_names ; do
|
||||
depdepl=$tmp
|
||||
done
|
||||
if test -f "$path/$depdepl" ; then
|
||||
if test -f "$deplibdir/$depdepl" ; then
|
||||
depdepl="$deplibdir/$depdepl"
|
||||
elif test -f "$path/$depdepl" ; then
|
||||
depdepl="$path/$depdepl"
|
||||
else
|
||||
# Can't find it, oh well...
|
||||
depdepl=
|
||||
fi
|
||||
# do not add paths which are already there
|
||||
case " $newlib_search_path " in
|
||||
|
@ -3101,9 +3125,10 @@ EOF
|
|||
|
||||
case $linkmode in
|
||||
oldlib)
|
||||
if test -n "$deplibs"; then
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
|
||||
fi
|
||||
case " $deplibs" in
|
||||
*\ -l* | *\ -L*)
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
|
||||
esac
|
||||
|
||||
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
||||
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
|
||||
|
@ -4245,9 +4270,10 @@ EOF
|
|||
;;
|
||||
|
||||
obj)
|
||||
if test -n "$deplibs"; then
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
|
||||
fi
|
||||
case " $deplibs" in
|
||||
*\ -l* | *\ -L*)
|
||||
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
|
||||
esac
|
||||
|
||||
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
|
||||
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
|
||||
|
@ -6486,7 +6512,7 @@ relink_command=\"$relink_command\""
|
|||
fi
|
||||
|
||||
# Restore saved environment variables
|
||||
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
|
||||
do
|
||||
eval "if test \"\${save_$lt_var+set}\" = set; then
|
||||
$lt_var=\$save_$lt_var; export $lt_var
|
||||
|
|
|
@ -1,9 +1,18 @@
|
|||
# $Id: Makefile.am 25689 2008-07-10 17:13:27Z androsyn $
|
||||
# $Id: Makefile.am 26046 2008-09-09 16:37:30Z androsyn $
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
INCLUDES = -I. -I../include @SSL_CFLAGS@ @GNUTLS_CFLAGS@
|
||||
|
||||
BUILT_SOURCES = version.c
|
||||
|
||||
version.c: version.c.SH ../CREDITS
|
||||
$(SHELL) ./version.c.SH
|
||||
$(CP) version.c version.c.last
|
||||
|
||||
version.lo: version.c ../include/serno.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||
|
||||
libratbox_la_SOURCES = \
|
||||
unix.c \
|
||||
win32.c \
|
||||
|
@ -29,10 +38,11 @@ libratbox_la_SOURCES = \
|
|||
kqueue.c \
|
||||
rawbuf.c \
|
||||
patricia.c \
|
||||
arc4random.c
|
||||
arc4random.c \
|
||||
version.c
|
||||
|
||||
|
||||
libratbox_la_LDFLAGS = -avoid-version -no-undefined -export-symbols export-syms.txt
|
||||
libratbox_la_LDFLAGS = @CRYPT_LIB@ @SSL_LIBS@ @GNUTLS_LIBS@ -avoid-version -no-undefined -export-symbols export-syms.txt
|
||||
libratbox_la_LIBADD = @CRYPT_LIB@ @SSL_LIBS@ @GNUTLS_LIBS@
|
||||
lib_LTLIBRARIES = libratbox.la
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
@SET_MAKE@
|
||||
|
||||
# $Id: Makefile.am 25689 2008-07-10 17:13:27Z androsyn $
|
||||
# $Id: Makefile.am 26046 2008-09-09 16:37:30Z androsyn $
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
|
@ -58,7 +58,7 @@ am_libratbox_la_OBJECTS = unix.lo win32.lo crypt.lo balloc.lo \
|
|||
commio.lo openssl.lo gnutls.lo nossl.lo event.lo ratbox_lib.lo \
|
||||
rb_memory.lo linebuf.lo snprintf.lo tools.lo helper.lo \
|
||||
devpoll.lo epoll.lo poll.lo ports.lo sigio.lo select.lo \
|
||||
kqueue.lo rawbuf.lo patricia.lo arc4random.lo
|
||||
kqueue.lo rawbuf.lo patricia.lo arc4random.lo version.lo
|
||||
libratbox_la_OBJECTS = $(am_libratbox_la_OBJECTS)
|
||||
libratbox_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
|
@ -120,7 +120,6 @@ INSTALL_DATA = @INSTALL_DATA@
|
|||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
|
@ -202,13 +201,13 @@ psdir = @psdir@
|
|||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
subdirs = @subdirs@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
INCLUDES = -I. -I../include @SSL_CFLAGS@ @GNUTLS_CFLAGS@
|
||||
BUILT_SOURCES = version.c
|
||||
libratbox_la_SOURCES = \
|
||||
unix.c \
|
||||
win32.c \
|
||||
|
@ -234,12 +233,14 @@ libratbox_la_SOURCES = \
|
|||
kqueue.c \
|
||||
rawbuf.c \
|
||||
patricia.c \
|
||||
arc4random.c
|
||||
arc4random.c \
|
||||
version.c
|
||||
|
||||
libratbox_la_LDFLAGS = -avoid-version -no-undefined -export-symbols export-syms.txt
|
||||
libratbox_la_LDFLAGS = @CRYPT_LIB@ @SSL_LIBS@ @GNUTLS_LIBS@ -avoid-version -no-undefined -export-symbols export-syms.txt
|
||||
libratbox_la_LIBADD = @CRYPT_LIB@ @SSL_LIBS@ @GNUTLS_LIBS@
|
||||
lib_LTLIBRARIES = libratbox.la
|
||||
all: all-am
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
|
@ -332,6 +333,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tools.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
|
@ -435,13 +437,15 @@ distdir: $(DISTFILES)
|
|||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
@ -465,6 +469,7 @@ distclean-generic:
|
|||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
|
@ -540,6 +545,13 @@ uninstall-am: uninstall-libLTLIBRARIES
|
|||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
|
||||
version.c: version.c.SH ../CREDITS
|
||||
$(SHELL) ./version.c.SH
|
||||
$(CP) version.c version.c.last
|
||||
|
||||
version.lo: version.c ../include/serno.h
|
||||
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: arc4random.c 25705 2008-07-11 18:21:57Z androsyn $ */
|
||||
/* $Id: arc4random.c 26092 2008-09-19 15:13:52Z androsyn $ */
|
||||
/* $$$: arc4random.c 2005/02/08 robert */
|
||||
/* $NetBSD: arc4random.c,v 1.5.2.1 2004/03/26 22:52:50 jmc Exp $ */
|
||||
/* $OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $ */
|
||||
|
@ -41,7 +41,8 @@
|
|||
|
||||
|
||||
|
||||
struct arc4_stream {
|
||||
struct arc4_stream
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t j;
|
||||
uint8_t s[256];
|
||||
|
@ -75,7 +76,8 @@ arc4_addrandom(struct arc4_stream *as, uint8_t *dat, int datlen)
|
|||
uint8_t si;
|
||||
|
||||
as->i--;
|
||||
for (n = 0; n < 256; n++) {
|
||||
for(n = 0; n < 256; n++)
|
||||
{
|
||||
as->i = (as->i + 1);
|
||||
si = as->s[as->i];
|
||||
as->j = (as->j + si + dat[n % datlen]);
|
||||
|
@ -107,11 +109,10 @@ arc4_stir(struct arc4_stream *as)
|
|||
struct rusage buf;
|
||||
getrusage(RUSAGE_SELF, &buf);
|
||||
arc4_addrandom(as, (void *)&buf, sizeof(buf));
|
||||
memset(&buf, 0, sizeof(buf))
|
||||
}
|
||||
memset(&buf, 0, sizeof(buf))}
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !defined(_WIN32)
|
||||
{
|
||||
uint8_t rnd[128];
|
||||
int fd;
|
||||
|
@ -121,7 +122,9 @@ arc4_stir(struct arc4_stream *as)
|
|||
read(fd, rnd, sizeof(rnd));
|
||||
close(fd);
|
||||
arc4_addrandom(as, (void *)rnd, sizeof(rnd));
|
||||
memset(&rnd, 0, sizeof(rnd));
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
{
|
||||
|
@ -130,6 +133,20 @@ arc4_stir(struct arc4_stream *as)
|
|||
{
|
||||
arc4_addrandom(as, (void *)&performanceCount, sizeof(performanceCount));
|
||||
}
|
||||
HMODULE lib = LoadLibrary("ADVAPI32.DLL");
|
||||
if(lib)
|
||||
{
|
||||
uint8_t rnd[128];
|
||||
BOOLEAN(APIENTRY * pfn) (void *, ULONG) =
|
||||
(BOOLEAN(APIENTRY *) (void *, ULONG))GetProcAddress(lib,
|
||||
"SystemFunction036");
|
||||
if(pfn)
|
||||
{
|
||||
if(pfn(rnd, sizeof(rnd)) == TRUE)
|
||||
arc4_addrandom(as, (void *)rnd, sizeof(rnd));
|
||||
memset(&rnd, 0, sizeof(rnd));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -173,7 +190,8 @@ arc4_getword(struct arc4_stream *as)
|
|||
void
|
||||
arc4random_stir(void)
|
||||
{
|
||||
if (!rs_initialized) {
|
||||
if(!rs_initialized)
|
||||
{
|
||||
arc4_init(&rs);
|
||||
rs_initialized = 1;
|
||||
}
|
||||
|
@ -197,4 +215,3 @@ arc4random(void)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: balloc.c 25861 2008-08-06 19:51:44Z androsyn $
|
||||
* $Id: balloc.c 26100 2008-09-20 01:27:19Z androsyn $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -59,6 +59,7 @@
|
|||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
||||
#ifndef NOBALLOC
|
||||
#ifdef HAVE_MMAP /* We've got mmap() that is good */
|
||||
#include <sys/mman.h>
|
||||
/* HP-UX sucks */
|
||||
|
@ -68,6 +69,7 @@
|
|||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static uintptr_t offset_pad;
|
||||
|
||||
|
@ -125,7 +127,7 @@ free_block(void *ptr, size_t size)
|
|||
#ifdef HAVE_MMAP
|
||||
munmap(ptr, size);
|
||||
#else
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
HeapFree(block_heap, 0, ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
|
@ -159,7 +161,7 @@ rb_init_bh(void)
|
|||
#endif
|
||||
|
||||
#ifndef NOBALLOC
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
block_heap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
|
||||
#endif
|
||||
rb_event_addish("rb_bh_gc_event", rb_bh_gc_event, NULL, 300);
|
||||
|
@ -192,7 +194,7 @@ get_block(size_t size)
|
|||
if(ptr == MAP_FAILED)
|
||||
ptr = NULL;
|
||||
#else
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
ptr = HeapAlloc(block_heap, 0, size);
|
||||
#else
|
||||
ptr = malloc(size);
|
||||
|
@ -338,7 +340,7 @@ rb_bh_alloc(rb_bh * bh)
|
|||
{
|
||||
#ifndef NOBALLOC
|
||||
rb_dlink_node *new_node;
|
||||
rb_heap_block *block;
|
||||
rb_heap_block **block;
|
||||
void *ptr;
|
||||
#endif
|
||||
lrb_assert(bh != NULL);
|
||||
|
@ -368,9 +370,10 @@ rb_bh_alloc(rb_bh * bh)
|
|||
}
|
||||
|
||||
new_node = bh->free_list.head;
|
||||
block = new_node->data;
|
||||
ptr = new_node->data + offset_pad;
|
||||
block = (rb_heap_block **) new_node->data;
|
||||
ptr = (void *)((uintptr_t)new_node->data + (uintptr_t)offset_pad);
|
||||
rb_dlinkDelete(new_node, &bh->free_list);
|
||||
(*block)->free_count--;
|
||||
memset(ptr, 0, bh->elemSize - offset_pad);
|
||||
return (ptr);
|
||||
#endif
|
||||
|
@ -413,14 +416,17 @@ rb_bh_free(rb_bh * bh, void *ptr)
|
|||
#ifdef NOBALLOC
|
||||
rb_free(ptr);
|
||||
#else
|
||||
data = (void *)(ptr - offset_pad);
|
||||
data = (void *)((uintptr_t)ptr - (uintptr_t)offset_pad);
|
||||
block = *(rb_heap_block **) data;
|
||||
/* XXX */
|
||||
if(rb_unlikely(!((uintptr_t)ptr >= (uintptr_t)block->elems && (uintptr_t)ptr < (uintptr_t)block->elems + (uintptr_t)block->alloc_size)))
|
||||
if(rb_unlikely
|
||||
(!((uintptr_t)ptr >= (uintptr_t)block->elems
|
||||
&& (uintptr_t)ptr < (uintptr_t)block->elems + (uintptr_t)block->alloc_size)))
|
||||
{
|
||||
rb_bh_fail("rb_bh_free() bogus pointer");
|
||||
}
|
||||
block->free_count++;
|
||||
|
||||
rb_dlinkAdd(data, (rb_dlink_node *)ptr, &bh->free_list);
|
||||
#endif /* !NOBALLOC */
|
||||
return (0);
|
||||
|
@ -466,6 +472,7 @@ rb_bh_destroy(rb_bh * bh)
|
|||
void
|
||||
rb_bh_usage(rb_bh *bh, size_t *bused, size_t *bfree, size_t *bmemusage, const char **desc)
|
||||
{
|
||||
#ifndef NOBALLOC
|
||||
size_t used, freem, memusage;
|
||||
|
||||
if(bh == NULL)
|
||||
|
@ -484,9 +491,17 @@ rb_bh_usage(rb_bh * bh, size_t * bused, size_t * bfree, size_t * bmemusage, cons
|
|||
*bmemusage = memusage;
|
||||
if(desc != NULL)
|
||||
*desc = bh->desc;
|
||||
#else
|
||||
static char *noballoc = "no blockheap";
|
||||
*bused = 0;
|
||||
*bfree = 0;
|
||||
*bmemusage = 0;
|
||||
*desc = noballoc;
|
||||
#endif
|
||||
}
|
||||
|
||||
void rb_bh_usage_all(rb_bh_usage_cb *cb, void *data)
|
||||
void
|
||||
rb_bh_usage_all(rb_bh_usage_cb *cb, void *data)
|
||||
{
|
||||
rb_dlink_node *ptr;
|
||||
rb_bh *bh;
|
||||
|
@ -548,7 +563,8 @@ rb_bh_gc(rb_bh * bh)
|
|||
return (1);
|
||||
}
|
||||
|
||||
if((rb_dlink_list_length(&bh->free_list) < bh->elemsPerBlock) || rb_dlink_list_length(&bh->block_list) == 1)
|
||||
if((rb_dlink_list_length(&bh->free_list) < bh->elemsPerBlock)
|
||||
|| rb_dlink_list_length(&bh->block_list) == 1)
|
||||
{
|
||||
/* There couldn't possibly be an entire free block. Return. */
|
||||
return (0);
|
||||
|
@ -567,7 +583,8 @@ rb_bh_gc(rb_bh * bh)
|
|||
offset = (uintptr_t)b->elems;
|
||||
for(i = 0; i < bh->elemsPerBlock; i++, offset += (uintptr_t)bh->elemSize)
|
||||
{
|
||||
rb_dlinkDelete(((rb_dlink_node *)offset), &bh->free_list);
|
||||
rb_dlinkDelete((rb_dlink_node *)(offset + offset_pad),
|
||||
&bh->free_list);
|
||||
}
|
||||
rb_dlinkDelete(&b->node, &bh->block_list);
|
||||
free_block(b->elems, b->alloc_size);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: commio.c 25795 2008-07-29 15:26:55Z androsyn $
|
||||
* $Id: commio.c 26096 2008-09-20 01:05:42Z androsyn $
|
||||
*/
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
@ -64,7 +64,7 @@ static const char *rb_err_str[] = { "Comm OK", "Error during bind()",
|
|||
|
||||
/* Highest FD and number of open FDs .. */
|
||||
static int number_fd = 0;
|
||||
static int rb_maxconnections = 0;
|
||||
int rb_maxconnections = 0;
|
||||
|
||||
static PF rb_connect_timeout;
|
||||
static PF rb_connect_tryconnect;
|
||||
|
@ -74,6 +74,7 @@ static void mangle_mapped_sockaddr(struct sockaddr *in);
|
|||
|
||||
#ifndef HAVE_SOCKETPAIR
|
||||
static int rb_inet_socketpair(int d, int type, int protocol, int sv[2]);
|
||||
static int rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2);
|
||||
#endif
|
||||
|
||||
static inline rb_fde_t *
|
||||
|
@ -142,28 +143,15 @@ rb_fd_hack(int *fd)
|
|||
static void
|
||||
rb_close_all(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
int i;
|
||||
#ifndef NDEBUG
|
||||
int fd;
|
||||
#endif
|
||||
|
||||
/* XXX someone tell me why we care about 4 fd's ? */
|
||||
/* XXX btw, fd 3 is used for profiler ! */
|
||||
for (i = 4; i < rb_maxconnections; ++i)
|
||||
for(i = 3; i < rb_maxconnections; ++i)
|
||||
{
|
||||
close(i);
|
||||
}
|
||||
|
||||
/* XXX should his hack be done in all cases? */
|
||||
#ifndef NDEBUG
|
||||
/* fugly hack to reserve fd == 2 */
|
||||
(void) close(2);
|
||||
fd = open("stderr.log", O_WRONLY | O_CREAT | O_APPEND, 0644);
|
||||
if(fd >= 0)
|
||||
{
|
||||
dup2(fd, 2);
|
||||
close(fd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -188,7 +176,8 @@ rb_get_sockerr(rb_fde_t *F)
|
|||
errtmp = errno;
|
||||
|
||||
#ifdef SO_ERROR
|
||||
if(F != NULL && !getsockopt(rb_get_fd(F), SOL_SOCKET, SO_ERROR, (char *) &err, (rb_socklen_t *) & len))
|
||||
if(F != NULL
|
||||
&& !getsockopt(rb_get_fd(F), SOL_SOCKET, SO_ERROR, (char *)&err, (rb_socklen_t *) & len))
|
||||
{
|
||||
if(err)
|
||||
errtmp = err;
|
||||
|
@ -365,7 +354,9 @@ rb_accept_tryaccept(rb_fde_t *F, void *data)
|
|||
|
||||
if(new_F == NULL)
|
||||
{
|
||||
rb_lib_log("rb_accept: new_F == NULL on incoming connection. Closing new_fd == %d\n", new_fd);
|
||||
rb_lib_log
|
||||
("rb_accept: new_F == NULL on incoming connection. Closing new_fd == %d\n",
|
||||
new_fd);
|
||||
close(new_fd);
|
||||
continue;
|
||||
}
|
||||
|
@ -394,7 +385,8 @@ rb_accept_tryaccept(rb_fde_t *F, void *data)
|
|||
else
|
||||
#endif /* HAVE_SSL */
|
||||
{
|
||||
F->accept->callback(new_F, RB_OK, (struct sockaddr *)&st, addrlen, F->accept->data);
|
||||
F->accept->callback(new_F, RB_OK, (struct sockaddr *)&st, addrlen,
|
||||
F->accept->data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -520,7 +512,8 @@ rb_connect_tryconnect(rb_fde_t *F, void *notused)
|
|||
return;
|
||||
/* Try the connect() */
|
||||
retval = connect(F->fd,
|
||||
(struct sockaddr *) &F->connect->hostaddr, GET_SS_LEN(&F->connect->hostaddr));
|
||||
(struct sockaddr *)&F->connect->hostaddr,
|
||||
GET_SS_LEN(&F->connect->hostaddr));
|
||||
/* Error? */
|
||||
if(retval < 0)
|
||||
{
|
||||
|
@ -534,8 +527,7 @@ rb_connect_tryconnect(rb_fde_t *F, void *notused)
|
|||
rb_connect_callback(F, RB_OK);
|
||||
else if(rb_ignore_errno(errno))
|
||||
/* Ignore error? Reschedule */
|
||||
rb_setselect(F, RB_SELECT_CONNECT,
|
||||
rb_connect_tryconnect, NULL);
|
||||
rb_setselect(F, RB_SELECT_CONNECT, rb_connect_tryconnect, NULL);
|
||||
else
|
||||
/* Error? Fail with RB_ERR_CONNECT */
|
||||
rb_connect_callback(F, RB_ERR_CONNECT);
|
||||
|
@ -578,10 +570,15 @@ rb_socketpair(int family, int sock_type, int proto, rb_fde_t **F1, rb_fde_t **F2
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
if(socketpair(family, sock_type, proto, nfd))
|
||||
#else
|
||||
if(rb_inet_socketpair(AF_INET, SOCK_STREAM, proto, nfd))
|
||||
if(sock_type == SOCK_DGRAM)
|
||||
{
|
||||
return rb_inet_socketpair_udp(F1, F2);
|
||||
}
|
||||
|
||||
if(rb_inet_socketpair(AF_INET, sock_type, proto, nfd))
|
||||
#endif
|
||||
return -1;
|
||||
|
||||
|
@ -628,7 +625,7 @@ rb_socketpair(int family, int sock_type, int proto, rb_fde_t **F1, rb_fde_t **F2
|
|||
int
|
||||
rb_pipe(rb_fde_t **F1, rb_fde_t **F2, const char *desc)
|
||||
{
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
int fd[2];
|
||||
if(number_fd >= rb_maxconnections)
|
||||
{
|
||||
|
@ -718,7 +715,8 @@ rb_socket(int family, int sock_type, int proto, const char *note)
|
|||
F = rb_open(fd, RB_FD_SOCKET, note);
|
||||
if(F == NULL)
|
||||
{
|
||||
rb_lib_log("rb_socket: rb_open returns NULL on FD %d: %s, closing fd", fd, strerror(errno));
|
||||
rb_lib_log("rb_socket: rb_open returns NULL on FD %d: %s, closing fd", fd,
|
||||
strerror(errno));
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -774,7 +772,7 @@ void
|
|||
rb_fdlist_init(int closeall, int maxfds, size_t heapsize)
|
||||
{
|
||||
static int initialized = 0;
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
int vers = MAKEWORD(2, 0);
|
||||
|
@ -816,7 +814,7 @@ rb_open(int fd, uint8_t type, const char *desc)
|
|||
fdesc = F->desc;
|
||||
else
|
||||
fdesc = "NULL";
|
||||
rb_lib_log("Trying to rb_open an already open FD: %d desc: %d", fd, fdesc);
|
||||
rb_lib_log("Trying to rb_open an already open FD: %d desc: %s", fd, fdesc);
|
||||
return NULL;
|
||||
}
|
||||
F->fd = fd;
|
||||
|
@ -868,12 +866,13 @@ rb_close(rb_fde_t *F)
|
|||
|
||||
number_fd--;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if(type & (RB_FD_SOCKET | RB_FD_PIPE))
|
||||
{
|
||||
closesocket(fd);
|
||||
return;
|
||||
} else
|
||||
}
|
||||
else
|
||||
#endif
|
||||
close(fd);
|
||||
}
|
||||
|
@ -1011,7 +1010,8 @@ rb_write(rb_fde_t *F, const void *buf, int count)
|
|||
if(F->type & RB_FD_SOCKET)
|
||||
{
|
||||
ret = send(F->fd, buf, count, MSG_NOSIGNAL);
|
||||
if(ret < 0) {
|
||||
if(ret < 0)
|
||||
{
|
||||
rb_get_errno();
|
||||
}
|
||||
return ret;
|
||||
|
@ -1055,7 +1055,8 @@ rb_writev(rb_fde_t *F, struct rb_iovec *vecount, int count)
|
|||
ssize_t
|
||||
rb_writev(rb_fde_t *F, struct rb_iovec * vector, int count)
|
||||
{
|
||||
if(F == NULL) {
|
||||
if(F == NULL)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1345,7 +1346,8 @@ rb_inet_ntop_sock(struct sockaddr *src, char *dst, unsigned int size)
|
|||
break;
|
||||
#ifdef RB_IPV6
|
||||
case AF_INET6:
|
||||
return (rb_inet_ntop(AF_INET6, &((struct sockaddr_in6 *) src)->sin6_addr, dst, size));
|
||||
return (rb_inet_ntop
|
||||
(AF_INET6, &((struct sockaddr_in6 *)src)->sin6_addr, dst, size));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -1374,8 +1376,8 @@ rb_inet_ntop(int af, const void *src, char *dst, unsigned int size)
|
|||
if(IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src) ||
|
||||
IN6_IS_ADDR_V4COMPAT((const struct in6_addr *)src))
|
||||
return (inet_ntop4
|
||||
((const unsigned char *)
|
||||
&((const struct in6_addr *) src)->s6_addr[12], dst, size));
|
||||
((const unsigned char *)&((const struct in6_addr *)src)->
|
||||
s6_addr[12], dst, size));
|
||||
else
|
||||
return (inet_ntop6(src, dst, size));
|
||||
|
||||
|
@ -1597,6 +1599,117 @@ rb_inet_pton(int af, const char *src, void *dst)
|
|||
|
||||
|
||||
#ifndef HAVE_SOCKETPAIR
|
||||
|
||||
/* mostly based on perl's emulation of socketpair udp */
|
||||
static int
|
||||
rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
|
||||
{
|
||||
struct sockaddr_in addr[2];
|
||||
rb_socklen_t size = sizeof(struct sockaddr_in);
|
||||
rb_fde_t *F[2];
|
||||
unsigned int fd[2];
|
||||
int i, got;
|
||||
unsigned short port;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
|
||||
for(i = 0; i < 2; i++)
|
||||
{
|
||||
F[i] = rb_socket(AF_INET, SOCK_DGRAM, 0, "udp socketpair");
|
||||
if(F[i] == NULL)
|
||||
goto failed;
|
||||
addr[i].sin_family = AF_INET;
|
||||
addr[i].sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
addr[i].sin_port = 0;
|
||||
if(bind(rb_get_fd(F[i]), (struct sockaddr *)&addr[i], sizeof(struct sockaddr_in)))
|
||||
goto failed;
|
||||
fd[i] = rb_get_fd(F[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < 2; i++)
|
||||
{
|
||||
if(getsockname(fd[i], (struct sockaddr *)&addr[i], &size))
|
||||
goto failed;
|
||||
if(size != sizeof(struct sockaddr_in))
|
||||
goto failed;
|
||||
if(connect(fd[!i], (struct sockaddr *)&addr[i], sizeof(struct sockaddr_in)) == -1)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
for(i = 0; i < 2; i++)
|
||||
{
|
||||
port = addr[i].sin_port;
|
||||
got = rb_write(F[i], &port, sizeof(port));
|
||||
if(got != sizeof(port))
|
||||
{
|
||||
if(got == -1)
|
||||
goto failed;
|
||||
goto abort_failed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct timeval wait = { 0, 100000 };
|
||||
|
||||
int max = fd[1] > fd[0] ? fd[1] : fd[0];
|
||||
fd_set rset;
|
||||
FD_ZERO(&rset);
|
||||
FD_SET(fd[0], &rset);
|
||||
FD_SET(fd[1], &rset);
|
||||
got = select(max + 1, &rset, NULL, NULL, &wait);
|
||||
if(got != 2 || !FD_ISSET(fd[0], &rset) || !FD_ISSET(fd[1], &rset))
|
||||
{
|
||||
if(got == -1)
|
||||
goto failed;
|
||||
goto abort_failed;
|
||||
}
|
||||
|
||||
struct sockaddr_in readfrom;
|
||||
unsigned short buf[2];
|
||||
for(i = 0; i < 2; i++)
|
||||
{
|
||||
#ifdef MSG_DONTWAIT
|
||||
int flag = MSG_DONTWAIT
|
||||
#else
|
||||
int flag = 0;
|
||||
#endif
|
||||
got = recvfrom(rb_get_fd(F[i]), (char *)&buf, sizeof(buf), flag,
|
||||
(struct sockaddr *)&readfrom, &size);
|
||||
if(got == -1)
|
||||
goto failed;
|
||||
if(got != sizeof(port)
|
||||
|| size != sizeof(struct sockaddr_in)
|
||||
|| buf[0] != (unsigned short)addr[!i].sin_port
|
||||
|| readfrom.sin_family != addr[!i].sin_family
|
||||
|| readfrom.sin_addr.s_addr != addr[!i].sin_addr.s_addr
|
||||
|| readfrom.sin_port != addr[!i].sin_port)
|
||||
goto abort_failed;
|
||||
}
|
||||
|
||||
*newF1 = F[0];
|
||||
*newF2 = F[1];
|
||||
return 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
#define ECONNABORTED WSAECONNABORTED
|
||||
#endif
|
||||
|
||||
abort_failed:
|
||||
rb_get_errno();
|
||||
errno = ECONNABORTED;
|
||||
failed:
|
||||
if(errno != ECONNABORTED)
|
||||
rb_get_errno();
|
||||
int o_errno = errno;
|
||||
if(F[0] != NULL)
|
||||
rb_close(F[0]);
|
||||
if(F[1] != NULL)
|
||||
rb_close(F[1]);
|
||||
errno = o_errno;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rb_inet_socketpair(int family, int type, int protocol, int fd[2])
|
||||
{
|
||||
|
@ -1605,7 +1718,7 @@ rb_inet_socketpair(int family, int type, int protocol, int fd[2])
|
|||
int acceptor = -1;
|
||||
struct sockaddr_in listen_addr;
|
||||
struct sockaddr_in connect_addr;
|
||||
size_t size;
|
||||
rb_socklen_t size;
|
||||
|
||||
if(protocol || family != AF_INET)
|
||||
{
|
||||
|
@ -1854,7 +1967,8 @@ try_select(void)
|
|||
int
|
||||
rb_io_sched_event(struct ev_entry *ev, int when)
|
||||
{
|
||||
if(ev == NULL || io_supports_event == NULL || io_sched_event == NULL || !io_supports_event())
|
||||
if(ev == NULL || io_supports_event == NULL || io_sched_event == NULL
|
||||
|| !io_supports_event())
|
||||
return 0;
|
||||
return io_sched_event(ev, when);
|
||||
}
|
||||
|
@ -1862,10 +1976,12 @@ rb_io_sched_event(struct ev_entry *ev, int when)
|
|||
void
|
||||
rb_io_unsched_event(struct ev_entry *ev)
|
||||
{
|
||||
if(ev == NULL || io_supports_event == NULL || io_unsched_event == NULL || !io_supports_event())
|
||||
if(ev == NULL || io_supports_event == NULL || io_unsched_event == NULL
|
||||
|| !io_supports_event())
|
||||
return;
|
||||
io_unsched_event(ev);
|
||||
}
|
||||
|
||||
int
|
||||
rb_io_supports_event(void)
|
||||
{
|
||||
|
@ -1894,42 +2010,42 @@ rb_init_netio(void)
|
|||
{
|
||||
if(!try_epoll())
|
||||
return;
|
||||
} else
|
||||
if(!strcmp("kqueue", ioenv))
|
||||
}
|
||||
else if(!strcmp("kqueue", ioenv))
|
||||
{
|
||||
if(!try_kqueue())
|
||||
return;
|
||||
} else
|
||||
if(!strcmp("ports", ioenv))
|
||||
}
|
||||
else if(!strcmp("ports", ioenv))
|
||||
{
|
||||
if(!try_ports())
|
||||
return;
|
||||
} else
|
||||
if(!strcmp("poll", ioenv))
|
||||
}
|
||||
else if(!strcmp("poll", ioenv))
|
||||
{
|
||||
if(!try_poll())
|
||||
return;
|
||||
} else
|
||||
if(!strcmp("devpoll", ioenv))
|
||||
}
|
||||
else if(!strcmp("devpoll", ioenv))
|
||||
{
|
||||
if(!try_devpoll())
|
||||
return;
|
||||
} else
|
||||
if(!strcmp("sigio", ioenv))
|
||||
}
|
||||
else if(!strcmp("sigio", ioenv))
|
||||
{
|
||||
if(!try_sigio())
|
||||
return;
|
||||
} else
|
||||
}
|
||||
else if(!strcmp("select", ioenv))
|
||||
{
|
||||
if(!try_select())
|
||||
return;
|
||||
}
|
||||
if(!strcmp("win32", ioenv))
|
||||
{
|
||||
if(!try_win32())
|
||||
return;
|
||||
}
|
||||
if(!strcmp("select", ioenv))
|
||||
{
|
||||
if(!try_select())
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -2008,6 +2124,7 @@ rb_ignore_errno(int error)
|
|||
}
|
||||
|
||||
|
||||
#if defined(HAVE_SENDMSG) && !defined(WIN32)
|
||||
int
|
||||
rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds)
|
||||
{
|
||||
|
@ -2036,7 +2153,8 @@ rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds
|
|||
if((len = recvmsg(rb_get_fd(F), &msg, 0)) <= 0)
|
||||
return len;
|
||||
|
||||
if(msg.msg_controllen > 0 && msg.msg_control != NULL && (cmsg = CMSG_FIRSTHDR(&msg)) != NULL)
|
||||
if(msg.msg_controllen > 0 && msg.msg_control != NULL
|
||||
&& (cmsg = CMSG_FIRSTHDR(&msg)) != NULL)
|
||||
{
|
||||
rfds = (msg.msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
|
||||
|
||||
|
@ -2065,14 +2183,15 @@ rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds
|
|||
}
|
||||
xF[x] = rb_open(fd, stype, desc);
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
*xF = NULL;
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize)
|
||||
rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid)
|
||||
{
|
||||
int n;
|
||||
struct msghdr msg;
|
||||
|
@ -2086,7 +2205,9 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz
|
|||
{
|
||||
iov[0].iov_base = ∅
|
||||
iov[0].iov_len = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
iov[0].iov_base = data;
|
||||
iov[0].iov_len = datasize;
|
||||
}
|
||||
|
@ -2120,4 +2241,20 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz
|
|||
n = sendmsg(rb_get_fd(xF), &msg, MSG_NOSIGNAL);
|
||||
return n;
|
||||
}
|
||||
#else
|
||||
#ifndef _WIN32
|
||||
int
|
||||
rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -117,10 +117,10 @@ rb_crypt(const char *key, const char *salt)
|
|||
|
||||
/* Re-entrantify me -- all this junk needs to be in
|
||||
* struct crypt_data to make this really reentrant... */
|
||||
static u_char inv_key_perm[64];
|
||||
static u_char inv_comp_perm[56];
|
||||
static u_char u_sbox[8][64];
|
||||
static u_char un_pbox[32];
|
||||
static uint8_t inv_key_perm[64];
|
||||
static uint8_t inv_comp_perm[56];
|
||||
static uint8_t u_sbox[8][64];
|
||||
static uint8_t un_pbox[32];
|
||||
static uint32_t en_keysl[16], en_keysr[16];
|
||||
static uint32_t de_keysl[16], de_keysr[16];
|
||||
static uint32_t ip_maskl[8][256], ip_maskr[8][256];
|
||||
|
@ -135,35 +135,35 @@ static uint32_t old_rawkey0, old_rawkey1;
|
|||
/* Static stuff that stays resident and doesn't change after
|
||||
* being initialized, and therefore doesn't need to be made
|
||||
* reentrant. */
|
||||
static u_char init_perm[64], final_perm[64];
|
||||
static u_char m_sbox[4][4096];
|
||||
static uint8_t init_perm[64], final_perm[64];
|
||||
static uint8_t m_sbox[4][4096];
|
||||
static uint32_t psbox[4][256];
|
||||
|
||||
|
||||
|
||||
|
||||
/* A pile of data */
|
||||
static const u_char ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
static const uint8_t ascii64[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
static const u_char IP[64] = {
|
||||
static const uint8_t IP[64] = {
|
||||
58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
|
||||
62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
|
||||
57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
|
||||
61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
|
||||
};
|
||||
|
||||
static const u_char key_perm[56] = {
|
||||
static const uint8_t key_perm[56] = {
|
||||
57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
|
||||
10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
|
||||
63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
|
||||
14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
|
||||
};
|
||||
|
||||
static const u_char key_shifts[16] = {
|
||||
static const uint8_t key_shifts[16] = {
|
||||
1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
|
||||
};
|
||||
|
||||
static const u_char comp_perm[48] = {
|
||||
static const uint8_t comp_perm[48] = {
|
||||
14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
|
||||
23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
|
||||
41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
|
||||
|
@ -174,64 +174,55 @@ static const u_char comp_perm[48] = {
|
|||
* No E box is used, as it's replaced by some ANDs, shifts, and ORs.
|
||||
*/
|
||||
|
||||
static const u_char sbox[8][64] = {
|
||||
static const uint8_t sbox[8][64] = {
|
||||
{
|
||||
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
|
||||
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
|
||||
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
|
||||
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
|
||||
},
|
||||
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13},
|
||||
{
|
||||
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
|
||||
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
|
||||
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
|
||||
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
|
||||
},
|
||||
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9},
|
||||
{
|
||||
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
|
||||
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
|
||||
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
|
||||
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
|
||||
},
|
||||
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12},
|
||||
{
|
||||
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
|
||||
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
|
||||
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
|
||||
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
|
||||
},
|
||||
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14},
|
||||
{
|
||||
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
|
||||
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
|
||||
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
|
||||
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
|
||||
},
|
||||
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3},
|
||||
{
|
||||
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
|
||||
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
|
||||
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
|
||||
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
|
||||
},
|
||||
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13},
|
||||
{
|
||||
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
|
||||
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
|
||||
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
|
||||
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
|
||||
},
|
||||
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12},
|
||||
{
|
||||
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
|
||||
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
|
||||
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
|
||||
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
|
||||
}
|
||||
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}
|
||||
};
|
||||
|
||||
static const u_char pbox[32] = {
|
||||
static const uint8_t pbox[32] = {
|
||||
16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
|
||||
2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
|
||||
};
|
||||
|
||||
static const uint32_t bits32[32] =
|
||||
{
|
||||
static const uint32_t bits32[32] = {
|
||||
0x80000000, 0x40000000, 0x20000000, 0x10000000,
|
||||
0x08000000, 0x04000000, 0x02000000, 0x01000000,
|
||||
0x00800000, 0x00400000, 0x00200000, 0x00100000,
|
||||
|
@ -242,7 +233,8 @@ static const uint32_t bits32[32] =
|
|||
0x00000008, 0x00000004, 0x00000002, 0x00000001
|
||||
};
|
||||
|
||||
static const u_char bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
|
||||
static const uint8_t bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
|
||||
|
||||
static const uint32_t *bits28, *bits24;
|
||||
|
||||
|
||||
|
@ -283,7 +275,8 @@ des_init(void)
|
|||
* Invert the S-boxes, reordering the input bits.
|
||||
*/
|
||||
for(i = 0; i < 8; i++)
|
||||
for (j = 0; j < 64; j++) {
|
||||
for(j = 0; j < 64; j++)
|
||||
{
|
||||
b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
|
||||
u_sbox[i][j] = sbox[i][b];
|
||||
}
|
||||
|
@ -296,15 +289,16 @@ des_init(void)
|
|||
for(i = 0; i < 64; i++)
|
||||
for(j = 0; j < 64; j++)
|
||||
m_sbox[b][(i << 6) | j] =
|
||||
(u_char)((u_sbox[(b << 1)][i] << 4) |
|
||||
(uint8_t)((u_sbox[(b << 1)][i] << 4) |
|
||||
u_sbox[(b << 1) + 1][j]);
|
||||
|
||||
/*
|
||||
* Set up the initial & final permutations into a useful form, and
|
||||
* initialise the inverted key permutation.
|
||||
*/
|
||||
for (i = 0; i < 64; i++) {
|
||||
init_perm[final_perm[i] = IP[i] - 1] = (u_char)i;
|
||||
for(i = 0; i < 64; i++)
|
||||
{
|
||||
init_perm[final_perm[i] = IP[i] - 1] = (uint8_t)i;
|
||||
inv_key_perm[i] = 255;
|
||||
}
|
||||
|
||||
|
@ -312,31 +306,37 @@ des_init(void)
|
|||
* Invert the key permutation and initialise the inverted key
|
||||
* compression permutation.
|
||||
*/
|
||||
for (i = 0; i < 56; i++) {
|
||||
inv_key_perm[key_perm[i] - 1] = (u_char)i;
|
||||
for(i = 0; i < 56; i++)
|
||||
{
|
||||
inv_key_perm[key_perm[i] - 1] = (uint8_t)i;
|
||||
inv_comp_perm[i] = 255;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invert the key compression permutation.
|
||||
*/
|
||||
for (i = 0; i < 48; i++) {
|
||||
inv_comp_perm[comp_perm[i] - 1] = (u_char)i;
|
||||
for(i = 0; i < 48; i++)
|
||||
{
|
||||
inv_comp_perm[comp_perm[i] - 1] = (uint8_t)i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the OR-mask arrays for the initial and final permutations,
|
||||
* and for the key initial and compression permutations.
|
||||
*/
|
||||
for (k = 0; k < 8; k++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
for(k = 0; k < 8; k++)
|
||||
{
|
||||
for(i = 0; i < 256; i++)
|
||||
{
|
||||
*(il = &ip_maskl[k][i]) = 0L;
|
||||
*(ir = &ip_maskr[k][i]) = 0L;
|
||||
*(fl = &fp_maskl[k][i]) = 0L;
|
||||
*(fr = &fp_maskr[k][i]) = 0L;
|
||||
for (j = 0; j < 8; j++) {
|
||||
for(j = 0; j < 8; j++)
|
||||
{
|
||||
inbit = 8 * k + j;
|
||||
if (i & bits8[j]) {
|
||||
if(i & bits8[j])
|
||||
{
|
||||
if((obit = init_perm[inbit]) < 32)
|
||||
*il |= bits32[obit];
|
||||
else
|
||||
|
@ -348,12 +348,15 @@ des_init(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 128; i++) {
|
||||
for(i = 0; i < 128; i++)
|
||||
{
|
||||
*(il = &key_perm_maskl[k][i]) = 0L;
|
||||
*(ir = &key_perm_maskr[k][i]) = 0L;
|
||||
for (j = 0; j < 7; j++) {
|
||||
for(j = 0; j < 7; j++)
|
||||
{
|
||||
inbit = 8 * k + j;
|
||||
if (i & bits8[j + 1]) {
|
||||
if(i & bits8[j + 1])
|
||||
{
|
||||
if((obit = inv_key_perm[inbit]) == 255)
|
||||
continue;
|
||||
if(obit < 28)
|
||||
|
@ -364,9 +367,11 @@ des_init(void)
|
|||
}
|
||||
*(il = &comp_maskl[k][i]) = 0L;
|
||||
*(ir = &comp_maskr[k][i]) = 0L;
|
||||
for (j = 0; j < 7; j++) {
|
||||
for(j = 0; j < 7; j++)
|
||||
{
|
||||
inbit = 7 * k + j;
|
||||
if (i & bits8[j + 1]) {
|
||||
if(i & bits8[j + 1])
|
||||
{
|
||||
if((obit = inv_comp_perm[inbit]) == 255)
|
||||
continue;
|
||||
if(obit < 24)
|
||||
|
@ -383,12 +388,14 @@ des_init(void)
|
|||
* handling the output of the S-box arrays setup above.
|
||||
*/
|
||||
for(i = 0; i < 32; i++)
|
||||
un_pbox[pbox[i] - 1] = (u_char)i;
|
||||
un_pbox[pbox[i] - 1] = (uint8_t)i;
|
||||
|
||||
for(b = 0; b < 4; b++)
|
||||
for (i = 0; i < 256; i++) {
|
||||
for(i = 0; i < 256; i++)
|
||||
{
|
||||
*(p = &psbox[b][i]) = 0L;
|
||||
for (j = 0; j < 8; j++) {
|
||||
for(j = 0; j < 8; j++)
|
||||
{
|
||||
if(i & bits8[j])
|
||||
*p |= bits32[un_pbox[8 * b + j]];
|
||||
}
|
||||
|
@ -411,7 +418,8 @@ setup_salt(long salt)
|
|||
saltbits = 0L;
|
||||
saltbit = 1;
|
||||
obit = 0x800000;
|
||||
for (i = 0; i < 24; i++) {
|
||||
for(i = 0; i < 24; i++)
|
||||
{
|
||||
if(salt & saltbit)
|
||||
saltbits |= obit;
|
||||
saltbit <<= 1;
|
||||
|
@ -431,9 +439,8 @@ des_setkey(const char *key)
|
|||
rawkey0 = ntohl(*(const uint32_t *)key);
|
||||
rawkey1 = ntohl(*(const uint32_t *)(key + 4));
|
||||
|
||||
if ((rawkey0 | rawkey1)
|
||||
&& rawkey0 == old_rawkey0
|
||||
&& rawkey1 == old_rawkey1) {
|
||||
if((rawkey0 | rawkey1) && rawkey0 == old_rawkey0 && rawkey1 == old_rawkey1)
|
||||
{
|
||||
/*
|
||||
* Already setup for this key.
|
||||
* This optimisation fails on a zero key (which is weak and
|
||||
|
@ -468,7 +475,8 @@ des_setkey(const char *key)
|
|||
* Rotate subkeys and do compression permutation.
|
||||
*/
|
||||
shifts = 0;
|
||||
for (round = 0; round < 16; round++) {
|
||||
for(round = 0; round < 16; round++)
|
||||
{
|
||||
uint32_t t0, t1;
|
||||
|
||||
shifts += key_shifts[round];
|
||||
|
@ -483,8 +491,7 @@ des_setkey(const char *key)
|
|||
| comp_maskl[3][t0 & 0x7f]
|
||||
| comp_maskl[4][(t1 >> 21) & 0x7f]
|
||||
| comp_maskl[5][(t1 >> 14) & 0x7f]
|
||||
| comp_maskl[6][(t1 >> 7) & 0x7f]
|
||||
| comp_maskl[7][t1 & 0x7f];
|
||||
| comp_maskl[6][(t1 >> 7) & 0x7f] | comp_maskl[7][t1 & 0x7f];
|
||||
|
||||
de_keysr[15 - round] =
|
||||
en_keysr[round] = comp_maskr[0][(t0 >> 21) & 0x7f]
|
||||
|
@ -493,8 +500,7 @@ des_setkey(const char *key)
|
|||
| comp_maskr[3][t0 & 0x7f]
|
||||
| comp_maskr[4][(t1 >> 21) & 0x7f]
|
||||
| comp_maskr[5][(t1 >> 14) & 0x7f]
|
||||
| comp_maskr[6][(t1 >> 7) & 0x7f]
|
||||
| comp_maskr[7][t1 & 0x7f];
|
||||
| comp_maskr[6][(t1 >> 7) & 0x7f] | comp_maskr[7][t1 & 0x7f];
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
@ -510,15 +516,20 @@ do_des( uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out, int coun
|
|||
uint32_t f, r48l, r48r;
|
||||
int round;
|
||||
|
||||
if (count == 0) {
|
||||
if(count == 0)
|
||||
{
|
||||
return (1);
|
||||
} else if (count > 0) {
|
||||
}
|
||||
else if(count > 0)
|
||||
{
|
||||
/*
|
||||
* Encrypting
|
||||
*/
|
||||
kl1 = en_keysl;
|
||||
kr1 = en_keysr;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Decrypting
|
||||
*/
|
||||
|
@ -536,39 +547,37 @@ do_des( uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out, int coun
|
|||
| ip_maskl[3][l_in & 0xff]
|
||||
| ip_maskl[4][r_in >> 24]
|
||||
| ip_maskl[5][(r_in >> 16) & 0xff]
|
||||
| ip_maskl[6][(r_in >> 8) & 0xff]
|
||||
| ip_maskl[7][r_in & 0xff];
|
||||
| ip_maskl[6][(r_in >> 8) & 0xff] | ip_maskl[7][r_in & 0xff];
|
||||
r = ip_maskr[0][l_in >> 24]
|
||||
| ip_maskr[1][(l_in >> 16) & 0xff]
|
||||
| ip_maskr[2][(l_in >> 8) & 0xff]
|
||||
| ip_maskr[3][l_in & 0xff]
|
||||
| ip_maskr[4][r_in >> 24]
|
||||
| ip_maskr[5][(r_in >> 16) & 0xff]
|
||||
| ip_maskr[6][(r_in >> 8) & 0xff]
|
||||
| ip_maskr[7][r_in & 0xff];
|
||||
| ip_maskr[6][(r_in >> 8) & 0xff] | ip_maskr[7][r_in & 0xff];
|
||||
|
||||
while (count--) {
|
||||
while(count--)
|
||||
{
|
||||
/*
|
||||
* Do each round.
|
||||
*/
|
||||
kl = kl1;
|
||||
kr = kr1;
|
||||
round = 16;
|
||||
while (round--) {
|
||||
while(round--)
|
||||
{
|
||||
/*
|
||||
* Expand R to 48 bits (simulate the E-box).
|
||||
*/
|
||||
r48l = ((r & 0x00000001) << 23)
|
||||
| ((r & 0xf8000000) >> 9)
|
||||
| ((r & 0x1f800000) >> 11)
|
||||
| ((r & 0x01f80000) >> 13)
|
||||
| ((r & 0x001f8000) >> 15);
|
||||
| ((r & 0x01f80000) >> 13) | ((r & 0x001f8000) >> 15);
|
||||
|
||||
r48r = ((r & 0x0001f800) << 7)
|
||||
| ((r & 0x00001f80) << 5)
|
||||
| ((r & 0x000001f8) << 3)
|
||||
| ((r & 0x0000001f) << 1)
|
||||
| ((r & 0x80000000) >> 31);
|
||||
| ((r & 0x0000001f) << 1) | ((r & 0x80000000) >> 31);
|
||||
/*
|
||||
* Do salting for crypt() and friends, and
|
||||
* XOR with the permuted key.
|
||||
|
@ -603,16 +612,14 @@ do_des( uint32_t l_in, uint32_t r_in, uint32_t *l_out, uint32_t *r_out, int coun
|
|||
| fp_maskl[3][l & 0xff]
|
||||
| fp_maskl[4][r >> 24]
|
||||
| fp_maskl[5][(r >> 16) & 0xff]
|
||||
| fp_maskl[6][(r >> 8) & 0xff]
|
||||
| fp_maskl[7][r & 0xff];
|
||||
| fp_maskl[6][(r >> 8) & 0xff] | fp_maskl[7][r & 0xff];
|
||||
*r_out = fp_maskr[0][l >> 24]
|
||||
| fp_maskr[1][(l >> 16) & 0xff]
|
||||
| fp_maskr[2][(l >> 8) & 0xff]
|
||||
| fp_maskr[3][l & 0xff]
|
||||
| fp_maskr[4][r >> 24]
|
||||
| fp_maskr[5][(r >> 16) & 0xff]
|
||||
| fp_maskr[6][(r >> 8) & 0xff]
|
||||
| fp_maskr[7][r & 0xff];
|
||||
| fp_maskr[6][(r >> 8) & 0xff] | fp_maskr[7][r & 0xff];
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -623,7 +630,8 @@ des_cipher(const char *in, char *out, uint32_t salt, int count)
|
|||
{
|
||||
uint32_t l_out, r_out, rawl, rawr;
|
||||
int retval;
|
||||
union {
|
||||
union
|
||||
{
|
||||
uint32_t *ui32;
|
||||
const char *c;
|
||||
} trans;
|
||||
|
@ -651,11 +659,12 @@ setkey(const char *key)
|
|||
{
|
||||
int i, j;
|
||||
uint32_t packed_keys[2];
|
||||
u_char *p;
|
||||
uint8_t *p;
|
||||
|
||||
p = (u_char *) packed_keys;
|
||||
p = (uint8_t *)packed_keys;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
p[i] = 0;
|
||||
for(j = 0; j < 8; j++)
|
||||
if(*key++ & 1)
|
||||
|
@ -669,14 +678,15 @@ void
|
|||
encrypt(char *block, int flag)
|
||||
{
|
||||
uint32_t io[2];
|
||||
u_char *p;
|
||||
uint8_t *p;
|
||||
int i, j;
|
||||
|
||||
des_init();
|
||||
|
||||
setup_salt(0L);
|
||||
p = (u_char*)block;
|
||||
for (i = 0; i < 2; i++) {
|
||||
p = (uint8_t *)block;
|
||||
for(i = 0; i < 2; i++)
|
||||
{
|
||||
io[i] = 0L;
|
||||
for(j = 0; j < 32; j++)
|
||||
if(*p++ & 1)
|
||||
|
@ -693,7 +703,7 @@ static char *
|
|||
__des_crypt(const char *key, const char *setting)
|
||||
{
|
||||
uint32_t count, salt, l, r0, r1, keybuf[2];
|
||||
u_char *p, *q;
|
||||
uint8_t *p, *q;
|
||||
static char output[21];
|
||||
|
||||
des_init();
|
||||
|
@ -702,8 +712,9 @@ __des_crypt(const char *key, const char *setting)
|
|||
* Copy the key, shifting each character up by one bit
|
||||
* and padding with zeros.
|
||||
*/
|
||||
q = (u_char *)keybuf;
|
||||
while (q - (u_char *)keybuf - 8) {
|
||||
q = (uint8_t *)keybuf;
|
||||
while(q - (uint8_t *)keybuf - 8)
|
||||
{
|
||||
*q++ = *key << 1;
|
||||
if(*(q - 1))
|
||||
key++;
|
||||
|
@ -712,7 +723,8 @@ __des_crypt(const char *key, const char *setting)
|
|||
return (NULL);
|
||||
|
||||
#if 0
|
||||
if (*setting == _PASSWORD_EFMT1) {
|
||||
if(*setting == _PASSWORD_EFMT1)
|
||||
{
|
||||
int i;
|
||||
/*
|
||||
* "new"-style:
|
||||
|
@ -725,7 +737,8 @@ __des_crypt(const char *key, const char *setting)
|
|||
for(i = 5, salt = 0L; i < 9; i++)
|
||||
salt |= ascii_to_bin(setting[i]) << ((i - 5) * 6);
|
||||
|
||||
while (*key) {
|
||||
while(*key)
|
||||
{
|
||||
/*
|
||||
* Encrypt the key with itself.
|
||||
*/
|
||||
|
@ -734,8 +747,8 @@ __des_crypt(const char *key, const char *setting)
|
|||
/*
|
||||
* And XOR with the next 8 characters of the key.
|
||||
*/
|
||||
q = (u_char *)keybuf;
|
||||
while (q - (u_char *)keybuf - 8 && *key)
|
||||
q = (uint8_t *)keybuf;
|
||||
while(q - (uint8_t *)keybuf - 8 && *key)
|
||||
*q++ ^= *key++ << 1;
|
||||
|
||||
if(des_setkey((char *)keybuf))
|
||||
|
@ -751,8 +764,9 @@ __des_crypt(const char *key, const char *setting)
|
|||
* NUL in it.
|
||||
*/
|
||||
output[9] = '\0';
|
||||
p = (u_char *)output + strlen(output);
|
||||
} else
|
||||
p = (uint8_t *)output + strlen(output);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
|
@ -762,8 +776,7 @@ __des_crypt(const char *key, const char *setting)
|
|||
*/
|
||||
count = 25;
|
||||
|
||||
salt = (ascii_to_bin(setting[1]) << 6)
|
||||
| ascii_to_bin(setting[0]);
|
||||
salt = (ascii_to_bin(setting[1]) << 6) | ascii_to_bin(setting[0]);
|
||||
|
||||
output[0] = setting[0];
|
||||
/*
|
||||
|
@ -774,7 +787,7 @@ __des_crypt(const char *key, const char *setting)
|
|||
*/
|
||||
output[1] = setting[1] ? setting[1] : output[0];
|
||||
|
||||
p = (u_char *)output + 2;
|
||||
p = (uint8_t *)output + 2;
|
||||
}
|
||||
setup_salt(salt);
|
||||
/*
|
||||
|
@ -884,7 +897,8 @@ __des_crypt(const char *key, const char *setting)
|
|||
/**********************************************************************/
|
||||
|
||||
/* MD5 context. */
|
||||
struct MD5Context {
|
||||
struct MD5Context
|
||||
{
|
||||
uint32_t state[4]; /* state (ABCD) */
|
||||
uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
|
@ -919,7 +933,8 @@ __md5_Encode (unsigned char *output, uint32_t *input, unsigned int len)
|
|||
{
|
||||
unsigned int i, j;
|
||||
|
||||
for (i = 0, j = 0; j < len; i++, j += 4) {
|
||||
for(i = 0, j = 0; j < len; i++, j += 4)
|
||||
{
|
||||
output[j] = (unsigned char)(input[i] & 0xff);
|
||||
output[j + 1] = (unsigned char)((input[i] >> 8) & 0xff);
|
||||
output[j + 2] = (unsigned char)((input[i] >> 16) & 0xff);
|
||||
|
@ -979,7 +994,8 @@ __md5_Decode (uint32_t *output, const unsigned char *input, unsigned int len)
|
|||
|
||||
/* MD5 initialization. Begins an MD5 operation, writing a new context. */
|
||||
|
||||
static void __md5_Init (struct MD5Context *context)
|
||||
static void
|
||||
__md5_Init(struct MD5Context *context)
|
||||
{
|
||||
context->count[0] = context->count[1] = 0;
|
||||
|
||||
|
@ -996,7 +1012,8 @@ static void __md5_Init (struct MD5Context *context)
|
|||
* context.
|
||||
*/
|
||||
|
||||
static void __md5_Update ( struct MD5Context *context, const char *xinput, unsigned int inputLen)
|
||||
static void
|
||||
__md5_Update(struct MD5Context *context, const char *xinput, unsigned int inputLen)
|
||||
{
|
||||
unsigned int i, lindex, partLen;
|
||||
const unsigned char *input = (const unsigned char *)xinput; /* i hate gcc */
|
||||
|
@ -1004,17 +1021,16 @@ static void __md5_Update ( struct MD5Context *context, const char *xinput, unsig
|
|||
lindex = (unsigned int)((context->count[0] >> 3) & 0x3F);
|
||||
|
||||
/* Update number of bits */
|
||||
if ((context->count[0] += ((uint32_t)inputLen << 3))
|
||||
< ((uint32_t)inputLen << 3))
|
||||
if((context->count[0] += ((uint32_t)inputLen << 3)) < ((uint32_t)inputLen << 3))
|
||||
context->count[1]++;
|
||||
context->count[1] += ((uint32_t)inputLen >> 29);
|
||||
|
||||
partLen = 64 - lindex;
|
||||
|
||||
/* Transform as many times as possible. */
|
||||
if (inputLen >= partLen) {
|
||||
memcpy(&context->buffer[lindex], input,
|
||||
partLen);
|
||||
if(inputLen >= partLen)
|
||||
{
|
||||
memcpy(&context->buffer[lindex], input, partLen);
|
||||
__md5_Transform(context->state, context->buffer);
|
||||
|
||||
for(i = partLen; i + 63 < inputLen; i += 64)
|
||||
|
@ -1026,15 +1042,15 @@ static void __md5_Update ( struct MD5Context *context, const char *xinput, unsig
|
|||
i = 0;
|
||||
|
||||
/* Buffer remaining input */
|
||||
memcpy (&context->buffer[lindex], &input[i],
|
||||
inputLen-i);
|
||||
memcpy(&context->buffer[lindex], &input[i], inputLen - i);
|
||||
}
|
||||
|
||||
/*
|
||||
* MD5 padding. Adds padding followed by original length.
|
||||
*/
|
||||
|
||||
static void __md5_Pad ( struct MD5Context *context)
|
||||
static void
|
||||
__md5_Pad(struct MD5Context *context)
|
||||
{
|
||||
char bits[8];
|
||||
unsigned int lindex, padLen;
|
||||
|
@ -1060,7 +1076,8 @@ static void __md5_Pad ( struct MD5Context *context)
|
|||
* the message digest and zeroizing the context.
|
||||
*/
|
||||
|
||||
static void __md5_Final ( char xdigest[16], struct MD5Context *context)
|
||||
static void
|
||||
__md5_Final(char xdigest[16], struct MD5Context *context)
|
||||
{
|
||||
unsigned char *digest = (unsigned char *)xdigest;
|
||||
/* Do padding. */
|
||||
|
@ -1133,15 +1150,23 @@ __md5_Transform (state, block)
|
|||
|
||||
__md5_Decode(x, block, 64);
|
||||
|
||||
a = state[0]; b = state[1]; c = state[2]; d = state[3];
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
|
||||
#if MD5_SIZE_OVER_SPEED > 2
|
||||
pc = C; pp = P; ps = S - 4;
|
||||
pc = C;
|
||||
pp = P;
|
||||
ps = S - 4;
|
||||
|
||||
for ( i = 0 ; i < 64 ; i++ ) {
|
||||
if ((i&0x0f) == 0) ps += 4;
|
||||
for(i = 0; i < 64; i++)
|
||||
{
|
||||
if((i & 0x0f) == 0)
|
||||
ps += 4;
|
||||
temp = a;
|
||||
switch (i>>4) {
|
||||
switch (i >> 4)
|
||||
{
|
||||
case 0:
|
||||
temp += F(b, c, d);
|
||||
break;
|
||||
|
@ -1158,41 +1183,68 @@ __md5_Transform (state, block)
|
|||
temp += x[(int)(*pp++)] + *pc++;
|
||||
temp = ROTATE_LEFT(temp, ps[i & 3]);
|
||||
temp += b;
|
||||
a = d; d = c; c = b; b = temp;
|
||||
a = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b = temp;
|
||||
}
|
||||
#elif MD5_SIZE_OVER_SPEED > 1
|
||||
pc = C; pp = P; ps = S;
|
||||
pc = C;
|
||||
pp = P;
|
||||
ps = S;
|
||||
|
||||
/* Round 1 */
|
||||
for ( i = 0 ; i < 16 ; i++ ) {
|
||||
for(i = 0; i < 16; i++)
|
||||
{
|
||||
FF(a, b, c, d, x[(int)(*pp++)], ps[i & 0x3], *pc++);
|
||||
temp = d; d = c; c = b; b = a; a = temp;
|
||||
temp = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = temp;
|
||||
}
|
||||
|
||||
/* Round 2 */
|
||||
ps += 4;
|
||||
for ( ; i < 32 ; i++ ) {
|
||||
for(; i < 32; i++)
|
||||
{
|
||||
GG(a, b, c, d, x[(int)(*pp++)], ps[i & 0x3], *pc++);
|
||||
temp = d; d = c; c = b; b = a; a = temp;
|
||||
temp = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = temp;
|
||||
}
|
||||
/* Round 3 */
|
||||
ps += 4;
|
||||
for ( ; i < 48 ; i++ ) {
|
||||
for(; i < 48; i++)
|
||||
{
|
||||
HH(a, b, c, d, x[(int)(*pp++)], ps[i & 0x3], *pc++);
|
||||
temp = d; d = c; c = b; b = a; a = temp;
|
||||
temp = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = temp;
|
||||
}
|
||||
|
||||
/* Round 4 */
|
||||
ps += 4;
|
||||
for ( ; i < 64 ; i++ ) {
|
||||
for(; i < 64; i++)
|
||||
{
|
||||
II(a, b, c, d, x[(int)(*pp++)], ps[i & 0x3], *pc++);
|
||||
temp = d; d = c; c = b; b = a; a = temp;
|
||||
temp = d;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = temp;
|
||||
}
|
||||
#elif MD5_SIZE_OVER_SPEED > 0
|
||||
pc = C; pp = P;
|
||||
pc = C;
|
||||
pp = P;
|
||||
|
||||
/* Round 1 */
|
||||
for ( i = 0 ; i < 4 ; i++ ) {
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
FF(a, b, c, d, x[(int)(*pp++)], 7, *pc++);
|
||||
FF(d, a, b, c, x[(int)(*pp++)], 12, *pc++);
|
||||
FF(c, d, a, b, x[(int)(*pp++)], 17, *pc++);
|
||||
|
@ -1200,14 +1252,16 @@ __md5_Transform (state, block)
|
|||
}
|
||||
|
||||
/* Round 2 */
|
||||
for ( i = 0 ; i < 4 ; i++ ) {
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
GG(a, b, c, d, x[(int)(*pp++)], 5, *pc++);
|
||||
GG(d, a, b, c, x[(int)(*pp++)], 9, *pc++);
|
||||
GG(c, d, a, b, x[(int)(*pp++)], 14, *pc++);
|
||||
GG(b, c, d, a, x[(int)(*pp++)], 20, *pc++);
|
||||
}
|
||||
/* Round 3 */
|
||||
for ( i = 0 ; i < 4 ; i++ ) {
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
HH(a, b, c, d, x[(int)(*pp++)], 4, *pc++);
|
||||
HH(d, a, b, c, x[(int)(*pp++)], 11, *pc++);
|
||||
HH(c, d, a, b, x[(int)(*pp++)], 16, *pc++);
|
||||
|
@ -1215,7 +1269,8 @@ __md5_Transform (state, block)
|
|||
}
|
||||
|
||||
/* Round 4 */
|
||||
for ( i = 0 ; i < 4 ; i++ ) {
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
II(a, b, c, d, x[(int)(*pp++)], 6, *pc++);
|
||||
II(d, a, b, c, x[(int)(*pp++)], 10, *pc++);
|
||||
II(c, d, a, b, x[(int)(*pp++)], 15, *pc++);
|
||||
|
@ -1321,9 +1376,11 @@ __md5_Transform (state, block)
|
|||
}
|
||||
|
||||
|
||||
static void __md5_to64( char *s, unsigned long v, int n)
|
||||
static void
|
||||
__md5_to64(char *s, unsigned long v, int n)
|
||||
{
|
||||
while(--n >= 0)
|
||||
{
|
||||
while (--n >= 0) {
|
||||
*s++ = __md5_itoa64[v & 0x3f];
|
||||
v >>= 6;
|
||||
}
|
||||
|
@ -1335,7 +1392,8 @@ static void __md5_to64( char *s, unsigned long v, int n)
|
|||
* Use MD5 for what it is best at...
|
||||
*/
|
||||
|
||||
static char * __md5_crypt( const char *pw, const char *salt)
|
||||
static char *
|
||||
__md5_crypt(const char *pw, const char *salt)
|
||||
{
|
||||
/* Static stuff */
|
||||
static const char *sp, *ep;
|
||||
|
@ -1386,7 +1444,8 @@ static char * __md5_crypt( const char *pw, const char *salt)
|
|||
memset(final, 0, sizeof final);
|
||||
|
||||
/* Then something really weird... */
|
||||
for (i = pw_len; i ; i >>= 1) {
|
||||
for(i = pw_len; i; i >>= 1)
|
||||
{
|
||||
__md5_Update(&ctx, ((i & 1) ? final : pw), 1);
|
||||
}
|
||||
|
||||
|
@ -1402,7 +1461,8 @@ static char * __md5_crypt( const char *pw, const char *salt)
|
|||
* On a 60 Mhz Pentium this takes 34 msec, so you would
|
||||
* need 30 seconds to build a 1000 entry dictionary...
|
||||
*/
|
||||
for(i=0;i<1000;i++) {
|
||||
for(i = 0; i < 1000; i++)
|
||||
{
|
||||
__md5_Init(&ctx1);
|
||||
if(i & 1)
|
||||
__md5_Update(&ctx1, pw, pw_len);
|
||||
|
@ -1425,12 +1485,15 @@ static char * __md5_crypt( const char *pw, const char *salt)
|
|||
p = passwd + strlen(passwd);
|
||||
|
||||
final[16] = final[5];
|
||||
for ( i=0 ; i < 5 ; i++ ) {
|
||||
for(i = 0; i < 5; i++)
|
||||
{
|
||||
l = (final[i] << 16) | (final[i + 6] << 8) | final[i + 12];
|
||||
__md5_to64(p,l,4); p += 4;
|
||||
__md5_to64(p, l, 4);
|
||||
p += 4;
|
||||
}
|
||||
l = final[11];
|
||||
__md5_to64(p,l,2); p += 2;
|
||||
__md5_to64(p, l, 2);
|
||||
p += 2;
|
||||
*p = '\0';
|
||||
|
||||
/* Don't leave anything around in vm they could use. */
|
||||
|
@ -1440,4 +1503,3 @@ static char * __md5_crypt( const char *pw, const char *salt)
|
|||
}
|
||||
|
||||
#endif /* NEED_CRYPT */
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: devpoll.c 25038 2008-01-23 16:03:08Z androsyn $
|
||||
* $Id: devpoll.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
@ -68,7 +68,8 @@ devpoll_write_update(int fd, int events)
|
|||
/* Write the thing to our poll fd */
|
||||
retval = write(dpfd, &pollfds[0], sizeof(struct pollfd));
|
||||
if(retval != sizeof(struct pollfd))
|
||||
rb_lib_log("devpoll_write_update: dpfd write failed %d: %s", errno, strerror(errno));
|
||||
rb_lib_log("devpoll_write_update: dpfd write failed %d: %s", errno,
|
||||
strerror(errno));
|
||||
/* Done! */
|
||||
}
|
||||
|
||||
|
@ -162,8 +163,7 @@ rb_init_netio_devpoll(void)
|
|||
* and deregister interest in a pending IO state for a given FD.
|
||||
*/
|
||||
void
|
||||
rb_setselect_devpoll(rb_fde_t *F, unsigned int type, PF * handler,
|
||||
void *client_data)
|
||||
rb_setselect_devpoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_data)
|
||||
{
|
||||
lrb_assert(IsFDOpen(F));
|
||||
|
||||
|
@ -228,8 +228,7 @@ rb_select_devpoll(long delay)
|
|||
int fd = dopoll.dp_fds[i].fd;
|
||||
PF *hdl = NULL;
|
||||
rb_fde_t *F = rb_find_fd(fd);
|
||||
if((dopoll.dp_fds[i].
|
||||
revents & (POLLRDNORM | POLLIN | POLLHUP |
|
||||
if((dopoll.dp_fds[i].revents & (POLLRDNORM | POLLIN | POLLHUP |
|
||||
POLLERR))
|
||||
&& (dopoll.dp_fds[i].events & (POLLRDNORM | POLLIN)))
|
||||
{
|
||||
|
@ -243,15 +242,13 @@ rb_select_devpoll(long delay)
|
|||
* poll set *if* the handler changes state (active ->
|
||||
* NULL or vice versa.)
|
||||
*/
|
||||
devpoll_update_events(fd,
|
||||
RB_SELECT_READ, F->read_handler);
|
||||
devpoll_update_events(fd, RB_SELECT_READ, F->read_handler);
|
||||
}
|
||||
}
|
||||
|
||||
if(!IsFDOpen(F))
|
||||
continue; /* Read handler closed us..go on to do something more useful */
|
||||
if((dopoll.dp_fds[i].
|
||||
revents & (POLLWRNORM | POLLOUT | POLLHUP |
|
||||
if((dopoll.dp_fds[i].revents & (POLLWRNORM | POLLOUT | POLLHUP |
|
||||
POLLERR))
|
||||
&& (dopoll.dp_fds[i].events & (POLLWRNORM | POLLOUT)))
|
||||
{
|
||||
|
@ -301,4 +298,3 @@ rb_setup_fd_devpoll(rb_fde_t *F)
|
|||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: epoll.c 25675 2008-07-06 04:13:05Z androsyn $
|
||||
* $Id: epoll.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include <ratbox_lib.h>
|
||||
#include <commio-int.h>
|
||||
#include <event-int.h>
|
||||
|
||||
#if defined(HAVE_EPOLL_CTL) && (HAVE_SYS_EPOLL_H)
|
||||
#define USING_EPOLL
|
||||
#include <fcntl.h>
|
||||
|
@ -44,6 +43,10 @@
|
|||
#define EPOLL_SCHED_EVENT 1
|
||||
#endif
|
||||
|
||||
#if defined(USE_TIMERFD_CREATE)
|
||||
#include <sys/timerfd.h>
|
||||
#endif
|
||||
|
||||
#define RTSIGNAL SIGRTMIN
|
||||
struct epoll_info
|
||||
{
|
||||
|
@ -54,8 +57,7 @@ struct epoll_info
|
|||
|
||||
static struct epoll_info *ep_info;
|
||||
static int can_do_event;
|
||||
|
||||
//static void setup_signalfd(void);
|
||||
static int can_do_timerfd;
|
||||
|
||||
/*
|
||||
* rb_init_netio
|
||||
|
@ -259,6 +261,16 @@ rb_epoll_supports_event(void)
|
|||
if(can_do_event == -1)
|
||||
return 0;
|
||||
|
||||
#ifdef USE_TIMERFD_CREATE
|
||||
if((fd = timerfd_create(CLOCK_REALTIME, 0)) >= 0)
|
||||
{
|
||||
close(fd);
|
||||
can_do_event = 1;
|
||||
can_do_timerfd = 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
ev.sigev_signo = SIGVTALRM;
|
||||
ev.sigev_notify = SIGEV_SIGNAL;
|
||||
if(timer_create(CLOCK_REALTIME, &ev, &timer) != 0)
|
||||
|
@ -281,7 +293,8 @@ rb_epoll_supports_event(void)
|
|||
|
||||
|
||||
/* bleh..work around a glibc header bug on 32bit systems */
|
||||
struct our_signalfd_siginfo {
|
||||
struct our_signalfd_siginfo
|
||||
{
|
||||
uint32_t signo;
|
||||
int32_t err;
|
||||
int32_t code;
|
||||
|
@ -332,9 +345,9 @@ signalfd_handler(rb_fde_t *F, void *data)
|
|||
rb_setselect(F, RB_SELECT_READ, signalfd_handler, NULL);
|
||||
return;
|
||||
}
|
||||
for(x = 0; x < ret / (int)sizeof(struct signalfd_siginfo); x++)
|
||||
for(x = 0; x < ret / (int)sizeof(struct our_signalfd_siginfo); x++)
|
||||
{
|
||||
ev = (struct ev_entry *)fdsig[x].svptr;
|
||||
ev = (struct ev_entry *)((uintptr_t)fdsig[x].svptr);
|
||||
if(ev == NULL)
|
||||
continue;
|
||||
rb_run_event(ev);
|
||||
|
@ -345,16 +358,21 @@ signalfd_handler(rb_fde_t *F, void *data)
|
|||
void
|
||||
rb_epoll_init_event(void)
|
||||
{
|
||||
|
||||
sigset_t ss;
|
||||
rb_fde_t *F;
|
||||
int sfd;
|
||||
rb_epoll_supports_event();
|
||||
if(!can_do_timerfd)
|
||||
{
|
||||
sigemptyset(&ss);
|
||||
sigaddset(&ss, RTSIGNAL);
|
||||
sigprocmask(SIG_BLOCK, &ss, 0);
|
||||
sigemptyset(&ss);
|
||||
sigaddset(&ss, RTSIGNAL);
|
||||
sfd = signalfd(-1, &ss, 0);
|
||||
if(sfd == -1) {
|
||||
if(sfd == -1)
|
||||
{
|
||||
can_do_event = -1;
|
||||
return;
|
||||
}
|
||||
|
@ -362,9 +380,10 @@ rb_epoll_init_event(void)
|
|||
rb_set_nb(F);
|
||||
signalfd_handler(F, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
rb_epoll_sched_event(struct ev_entry *event, int when)
|
||||
static int
|
||||
rb_epoll_sched_event_signalfd(struct ev_entry *event, int when)
|
||||
{
|
||||
timer_t *id;
|
||||
struct sigevent ev;
|
||||
|
@ -396,9 +415,93 @@ rb_epoll_sched_event(struct ev_entry *event, int when)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef USE_TIMERFD_CREATE
|
||||
static void
|
||||
rb_read_timerfd(rb_fde_t *F, void *data)
|
||||
{
|
||||
struct ev_entry *event = (struct ev_entry *)data;
|
||||
int retlen;
|
||||
uint64_t count;
|
||||
|
||||
if(event == NULL)
|
||||
{
|
||||
rb_close(F);
|
||||
return;
|
||||
}
|
||||
|
||||
retlen = rb_read(F, &count, sizeof(count));
|
||||
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno)))
|
||||
{
|
||||
rb_close(F);
|
||||
rb_lib_log("rb_read_timerfd: timerfd[%s] closed on error: %s", event->name,
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
rb_setselect(F, RB_SELECT_READ, rb_read_timerfd, event);
|
||||
rb_run_event(event);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
rb_epoll_sched_event_timerfd(struct ev_entry *event, int when)
|
||||
{
|
||||
struct itimerspec ts;
|
||||
static char buf[FD_DESC_SZ + 8];
|
||||
int fd;
|
||||
rb_fde_t *F;
|
||||
|
||||
if((fd = timerfd_create(CLOCK_REALTIME, 0)) < 0)
|
||||
{
|
||||
rb_lib_log("timerfd_create: %s\n", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&ts, 0, sizeof(ts));
|
||||
ts.it_value.tv_sec = when;
|
||||
ts.it_value.tv_nsec = 0;
|
||||
if(event->frequency != 0)
|
||||
ts.it_interval = ts.it_value;
|
||||
|
||||
if(timerfd_settime(fd, 0, &ts, NULL) < 0)
|
||||
{
|
||||
rb_lib_log("timerfd_settime: %s\n", strerror(errno));
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
rb_snprintf(buf, sizeof(buf), "timerfd: %s", event->name);
|
||||
F = rb_open(fd, RB_FD_UNKNOWN, buf);
|
||||
rb_set_nb(F);
|
||||
event->comm_ptr = F;
|
||||
rb_setselect(F, RB_SELECT_READ, rb_read_timerfd, event);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int
|
||||
rb_epoll_sched_event(struct ev_entry *event, int when)
|
||||
{
|
||||
#ifdef USE_TIMERFD_CREATE
|
||||
if(can_do_timerfd)
|
||||
{
|
||||
return rb_epoll_sched_event_timerfd(event, when);
|
||||
}
|
||||
#endif
|
||||
return rb_epoll_sched_event_signalfd(event, when);
|
||||
}
|
||||
|
||||
void
|
||||
rb_epoll_unsched_event(struct ev_entry *event)
|
||||
{
|
||||
#ifdef USE_TIMERFD_CREATE
|
||||
if(can_do_timerfd)
|
||||
{
|
||||
rb_close((rb_fde_t *)event->comm_ptr);
|
||||
event->comm_ptr = NULL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
timer_delete(*((timer_t *) event->comm_ptr));
|
||||
rb_free(event->comm_ptr);
|
||||
event->comm_ptr = NULL;
|
||||
|
@ -437,7 +540,8 @@ rb_setup_fd_epoll(rb_fde_t * F)
|
|||
#endif
|
||||
|
||||
#if !defined(USING_EPOLL) || !defined(EPOLL_SCHED_EVENT)
|
||||
void rb_epoll_init_event(void)
|
||||
void
|
||||
rb_epoll_init_event(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: event.c 25147 2008-03-28 17:15:47Z androsyn $
|
||||
* $Id: event.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#include <libratbox_config.h>
|
||||
|
@ -47,24 +47,11 @@
|
|||
#include <commio-int.h>
|
||||
#include <event-int.h>
|
||||
|
||||
static const char *last_event_ran = NULL;
|
||||
#define EV_NAME_LEN 33
|
||||
static char last_event_ran[EV_NAME_LEN];
|
||||
static rb_dlink_list event_list;
|
||||
|
||||
static time_t event_time_min = -1;
|
||||
/* The list of event processes */
|
||||
|
||||
#if 0
|
||||
struct ev_entry
|
||||
{
|
||||
rb_dlink_node node;
|
||||
EVH *func;
|
||||
void *arg;
|
||||
const char *name;
|
||||
time_t frequency;
|
||||
time_t when;
|
||||
void *data;
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* struct ev_entry *
|
||||
|
@ -104,7 +91,7 @@ rb_event_add(const char *name, EVH * func, void *arg, time_t when)
|
|||
struct ev_entry *ev;
|
||||
ev = rb_malloc(sizeof(struct ev_entry));
|
||||
ev->func = func;
|
||||
ev->name = name;
|
||||
ev->name = rb_strndup(name, EV_NAME_LEN);
|
||||
ev->arg = arg;
|
||||
ev->when = rb_current_time() + when;
|
||||
ev->frequency = when;
|
||||
|
@ -117,13 +104,14 @@ rb_event_add(const char *name, EVH * func, void *arg, time_t when)
|
|||
rb_io_sched_event(ev, when);
|
||||
return ev;
|
||||
}
|
||||
|
||||
struct ev_entry *
|
||||
rb_event_addonce(const char *name, EVH * func, void *arg, time_t when)
|
||||
{
|
||||
struct ev_entry *ev;
|
||||
ev = rb_malloc(sizeof(struct ev_entry));
|
||||
ev->func = func;
|
||||
ev->name = name;
|
||||
ev->name = rb_strndup(name, EV_NAME_LEN);
|
||||
ev->arg = arg;
|
||||
ev->when = rb_current_time() + when;
|
||||
ev->frequency = 0;
|
||||
|
@ -151,6 +139,7 @@ rb_event_delete(struct ev_entry *ev)
|
|||
|
||||
rb_dlinkDelete(&ev->node, &event_list);
|
||||
rb_io_unsched_event(ev);
|
||||
rb_free(ev->name);
|
||||
rb_free(ev);
|
||||
}
|
||||
|
||||
|
@ -196,7 +185,7 @@ rb_event_addish(const char *name, EVH * func, void *arg, time_t delta_ish)
|
|||
void
|
||||
rb_run_event(struct ev_entry *ev)
|
||||
{
|
||||
last_event_ran = ev->name;
|
||||
rb_strlcpy(last_event_ran, ev->name, sizeof(last_event_ran));
|
||||
ev->func(ev->arg);
|
||||
if(!ev->frequency)
|
||||
{
|
||||
|
@ -232,7 +221,7 @@ rb_event_run(void)
|
|||
ev = ptr->data;
|
||||
if(ev->when <= rb_current_time())
|
||||
{
|
||||
last_event_ran = ev->name;
|
||||
rb_strlcpy(last_event_ran, ev->name, sizeof(last_event_ran));
|
||||
ev->func(ev->arg);
|
||||
|
||||
/* event is scheduled more than once */
|
||||
|
@ -247,7 +236,9 @@ rb_event_run(void)
|
|||
rb_dlinkDelete(&ev->node, &event_list);
|
||||
rb_free(ev);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if((ev->when < event_time_min) || (event_time_min == -1))
|
||||
event_time_min = ev->when;
|
||||
}
|
||||
|
@ -270,6 +261,7 @@ rb_event_io_register_all(void)
|
|||
rb_io_sched_event(ev, when);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* void rb_event_init(void)
|
||||
*
|
||||
|
@ -280,7 +272,7 @@ rb_event_io_register_all(void)
|
|||
void
|
||||
rb_event_init(void)
|
||||
{
|
||||
last_event_ran = NULL;
|
||||
rb_strlcpy(last_event_ran, "NONE", sizeof(last_event_ran));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -291,11 +283,10 @@ rb_dump_events(void (*func) (char *, void *), void *ptr)
|
|||
rb_dlink_node *dptr;
|
||||
struct ev_entry *ev;
|
||||
len = sizeof(buf);
|
||||
if(last_event_ran)
|
||||
{
|
||||
|
||||
rb_snprintf(buf, len, "Last event to run: %s", last_event_ran);
|
||||
func(buf, ptr);
|
||||
}
|
||||
|
||||
rb_strlcpy(buf, "Operation Next Execution", len);
|
||||
func(buf, ptr);
|
||||
|
||||
|
|
|
@ -146,3 +146,10 @@ rb_supports_ssl
|
|||
rb_ssl_handshake_count
|
||||
rb_ssl_clear_handshake_count
|
||||
rb_get_pseudo_random
|
||||
rb_strerror
|
||||
rb_kill
|
||||
rb_setenv
|
||||
rb_getpid
|
||||
rb_waitpid
|
||||
rb_basename
|
||||
rb_dirname
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: gnutls.c 25793 2008-07-29 14:47:48Z androsyn $
|
||||
* $Id: gnutls.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#include <libratbox_config.h>
|
||||
|
@ -74,7 +74,8 @@ rb_ssl_timeout(rb_fde_t * F, void *notused)
|
|||
}
|
||||
|
||||
|
||||
static int do_ssl_handshake(rb_fde_t *F, PF *callback)
|
||||
static int
|
||||
do_ssl_handshake(rb_fde_t *F, PF * callback)
|
||||
{
|
||||
int ret;
|
||||
int flags;
|
||||
|
@ -125,8 +126,7 @@ rb_ssl_tryaccept(rb_fde_t * F, void *data)
|
|||
|
||||
ad = F->accept;
|
||||
F->accept = NULL;
|
||||
ad->callback(F, RB_OK, (struct sockaddr *) &ad->S, ad->addrlen,
|
||||
ad->data);
|
||||
ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
|
||||
rb_free(ad);
|
||||
|
||||
}
|
||||
|
@ -314,9 +314,12 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile)
|
|||
}
|
||||
|
||||
|
||||
if((ret = gnutls_certificate_set_x509_key_mem(x509, d_cert, d_key, GNUTLS_X509_FMT_PEM)) != GNUTLS_E_SUCCESS)
|
||||
if((ret =
|
||||
gnutls_certificate_set_x509_key_mem(x509, d_cert, d_key,
|
||||
GNUTLS_X509_FMT_PEM)) != GNUTLS_E_SUCCESS)
|
||||
{
|
||||
rb_lib_log("rb_setup_ssl_server: Error loading certificate or key file: %s", gnutls_strerror(ret));
|
||||
rb_lib_log("rb_setup_ssl_server: Error loading certificate or key file: %s",
|
||||
gnutls_strerror(ret));
|
||||
return 0;
|
||||
}
|
||||
rb_free_datum_t(d_cert);
|
||||
|
@ -331,13 +334,17 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile)
|
|||
data = rb_load_file_into_datum_t(dhfile);
|
||||
if(data != NULL)
|
||||
{
|
||||
xret = gnutls_dh_params_import_pkcs3(dh_params, data, GNUTLS_X509_FMT_PEM);
|
||||
xret = gnutls_dh_params_import_pkcs3(dh_params, data,
|
||||
GNUTLS_X509_FMT_PEM);
|
||||
if(xret < 0)
|
||||
rb_lib_log("rb_setup_ssl_server: Error parsing DH file: %s\n", gnutls_strerror(xret));
|
||||
rb_lib_log
|
||||
("rb_setup_ssl_server: Error parsing DH file: %s\n",
|
||||
gnutls_strerror(xret));
|
||||
rb_free_datum_t(data);
|
||||
}
|
||||
gnutls_certificate_set_dh_params(x509, dh_params);
|
||||
} else
|
||||
}
|
||||
else
|
||||
rb_lib_log("rb_setup_ssl_server: Unable to setup DH parameters");
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: helper.c 25245 2008-04-21 18:38:23Z androsyn $
|
||||
* $Id: helper.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
@ -41,8 +41,9 @@ struct _rb_helper
|
|||
|
||||
/* setup all the stuff a new child needs */
|
||||
rb_helper *
|
||||
rb_helper_child(rb_helper_cb *read_cb, rb_helper_cb *error_cb, log_cb *ilog, restart_cb *irestart, die_cb *idie,
|
||||
int maxcon, size_t lb_heap_size, size_t dh_size, size_t fd_heap_size)
|
||||
rb_helper_child(rb_helper_cb * read_cb, rb_helper_cb * error_cb, log_cb * ilog,
|
||||
restart_cb * irestart, die_cb * idie, int maxcon, size_t lb_heap_size,
|
||||
size_t dh_size, size_t fd_heap_size)
|
||||
{
|
||||
rb_helper *helper;
|
||||
int maxfd, x = 0;
|
||||
|
@ -61,7 +62,7 @@ rb_helper_child(rb_helper_cb *read_cb, rb_helper_cb *error_cb, log_cb *ilog, res
|
|||
ofd = (int)strtol(tofd, NULL, 10);
|
||||
maxfd = (int)strtol(tmaxfd, NULL, 10);
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
for(x = 0; x < maxfd; x++)
|
||||
{
|
||||
if(x != ifd && x != ofd)
|
||||
|
@ -102,7 +103,8 @@ rb_helper_child(rb_helper_cb *read_cb, rb_helper_cb *error_cb, log_cb *ilog, res
|
|||
*/
|
||||
|
||||
rb_helper *
|
||||
rb_helper_start(const char *name, const char *fullpath, rb_helper_cb *read_cb, rb_helper_cb *error_cb)
|
||||
rb_helper_start(const char *name, const char *fullpath, rb_helper_cb * read_cb,
|
||||
rb_helper_cb * error_cb)
|
||||
{
|
||||
rb_helper *helper;
|
||||
const char *parv[2];
|
||||
|
@ -138,15 +140,15 @@ rb_helper_start(const char *name, const char *fullpath, rb_helper_cb *read_cb, r
|
|||
rb_set_nb(out_f[0]);
|
||||
rb_set_nb(out_f[1]);
|
||||
|
||||
setenv("IFD", fy, 1);
|
||||
setenv("OFD", fx, 1);
|
||||
setenv("MAXFD", "256", 1);
|
||||
rb_setenv("IFD", fy, 1);
|
||||
rb_setenv("OFD", fx, 1);
|
||||
rb_setenv("MAXFD", "256", 1);
|
||||
|
||||
rb_snprintf(buf, sizeof(buf), "-ircd %s daemon", name);
|
||||
parv[0] = buf;
|
||||
parv[1] = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
SetHandleInformation((HANDLE) rb_get_fd(in_f[1]), HANDLE_FLAG_INHERIT, 1);
|
||||
SetHandleInformation((HANDLE) rb_get_fd(out_f[0]), HANDLE_FLAG_INHERIT, 1);
|
||||
#endif
|
||||
|
@ -197,7 +199,8 @@ rb_helper_write_sendq(rb_fde_t *F, void *helper_ptr)
|
|||
{
|
||||
while((retlen = rb_linebuf_flush(F, &helper->sendq)) > 0)
|
||||
;;
|
||||
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) {
|
||||
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno)))
|
||||
{
|
||||
rb_helper_restart(helper);
|
||||
return;
|
||||
}
|
||||
|
@ -271,7 +274,7 @@ rb_helper_close(rb_helper *helper)
|
|||
{
|
||||
if(helper == NULL)
|
||||
return;
|
||||
kill(helper->pid, SIGKILL);
|
||||
rb_kill(helper->pid, SIGKILL);
|
||||
rb_close(helper->ifd);
|
||||
rb_close(helper->ofd);
|
||||
rb_free(helper);
|
||||
|
@ -292,4 +295,3 @@ rb_helper_loop(rb_helper *helper, long delay)
|
|||
rb_lib_loop(delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: kqueue.c 25364 2008-05-14 17:55:22Z jilles $
|
||||
* $Id: kqueue.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#include <libratbox_config.h>
|
||||
|
@ -123,7 +123,8 @@ kq_update_events(rb_fde_t * F, short filter, PF * handler)
|
|||
/* jdc -- someone needs to do error checking... */
|
||||
/* EBADF is normal here -- jilles */
|
||||
if(ret == -1 && errno != EBADF)
|
||||
rb_lib_log("kq_update_events(): kevent(): %s", strerror(errno));
|
||||
rb_lib_log("kq_update_events(): kevent(): %s",
|
||||
strerror(errno));
|
||||
}
|
||||
kqoff = 0;
|
||||
}
|
||||
|
@ -209,10 +210,12 @@ rb_select_kqueue(long delay)
|
|||
rb_fde_t *F;
|
||||
|
||||
|
||||
if(delay < 0) {
|
||||
if(delay < 0)
|
||||
{
|
||||
pt = NULL;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
pt = &poll_time;
|
||||
poll_time.tv_sec = delay / 1000;
|
||||
poll_time.tv_nsec = (delay % 1000) * 1000000;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: linebuf.c 25375 2008-05-16 15:19:51Z androsyn $
|
||||
* $Id: linebuf.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#include <libratbox_config.h>
|
||||
|
@ -47,20 +47,14 @@ static int bufline_count = 0;
|
|||
void
|
||||
rb_linebuf_init(size_t heap_size)
|
||||
{
|
||||
#ifndef NOBALLOC
|
||||
rb_linebuf_heap = rb_bh_create(sizeof(buf_line_t), heap_size, "librb_linebuf_heap");
|
||||
#endif
|
||||
}
|
||||
|
||||
static buf_line_t *
|
||||
rb_linebuf_allocate(void)
|
||||
{
|
||||
buf_line_t *t;
|
||||
#ifndef NOBALLOC
|
||||
t = rb_bh_alloc(rb_linebuf_heap);
|
||||
#else
|
||||
t = rb_malloc(sizeof(buf_line_t));
|
||||
#endif
|
||||
return (t);
|
||||
|
||||
}
|
||||
|
@ -68,11 +62,7 @@ rb_linebuf_allocate(void)
|
|||
static void
|
||||
rb_linebuf_free(buf_line_t * p)
|
||||
{
|
||||
#ifndef NOBALLOC
|
||||
rb_bh_free(rb_linebuf_heap, p);
|
||||
#else
|
||||
rb_free(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -188,7 +178,8 @@ rb_linebuf_donebuf(buf_head_t * bufhead)
|
|||
{
|
||||
while(bufhead->list.head != NULL)
|
||||
{
|
||||
rb_linebuf_done_line(bufhead, (buf_line_t *) bufhead->list.head->data, bufhead->list.head);
|
||||
rb_linebuf_done_line(bufhead, (buf_line_t *) bufhead->list.head->data,
|
||||
bufhead->list.head);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,7 +506,8 @@ rb_linebuf_attach(buf_head_t * bufhead, buf_head_t * new)
|
|||
* Then format/va_args is appended to the buffer.
|
||||
*/
|
||||
void
|
||||
rb_linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args, const char *prefixfmt, ...)
|
||||
rb_linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args,
|
||||
const char *prefixfmt, ...)
|
||||
{
|
||||
buf_line_t *bufline;
|
||||
int len = 0;
|
||||
|
@ -562,7 +554,8 @@ rb_linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args, c
|
|||
else
|
||||
{
|
||||
/* Chop trailing CRLF's .. */
|
||||
while((bufline->buf[len] == '\r') || (bufline->buf[len] == '\n') || (bufline->buf[len] == '\0'))
|
||||
while((bufline->buf[len] == '\r') || (bufline->buf[len] == '\n')
|
||||
|| (bufline->buf[len] == '\0'))
|
||||
{
|
||||
len--;
|
||||
}
|
||||
|
@ -614,7 +607,8 @@ rb_linebuf_putbuf(buf_head_t *bufhead, const char *buffer)
|
|||
else
|
||||
{
|
||||
/* Chop trailing CRLF's .. */
|
||||
while((bufline->buf[len] == '\r') || (bufline->buf[len] == '\n') || (bufline->buf[len] == '\0'))
|
||||
while((bufline->buf[len] == '\r') || (bufline->buf[len] == '\n')
|
||||
|| (bufline->buf[len] == '\0'))
|
||||
{
|
||||
len--;
|
||||
}
|
||||
|
@ -673,7 +667,8 @@ rb_linebuf_put(buf_head_t * bufhead, const char *format, ...)
|
|||
else
|
||||
{
|
||||
/* Chop trailing CRLF's .. */
|
||||
while((bufline->buf[len] == '\r') || (bufline->buf[len] == '\n') || (bufline->buf[len] == '\0'))
|
||||
while((bufline->buf[len] == '\r') || (bufline->buf[len] == '\n')
|
||||
|| (bufline->buf[len] == '\0'))
|
||||
{
|
||||
len--;
|
||||
}
|
||||
|
@ -755,7 +750,8 @@ rb_linebuf_flush(rb_fde_t *F, buf_head_t * bufhead)
|
|||
vec[x].iov_len = bufline->len;
|
||||
ptr = ptr->next;
|
||||
|
||||
} while(++x < RB_UIO_MAXIOV);
|
||||
}
|
||||
while(++x < RB_UIO_MAXIOV);
|
||||
|
||||
if(x == 0)
|
||||
{
|
||||
|
@ -841,10 +837,5 @@ rb_linebuf_flush(rb_fde_t *F, buf_head_t * bufhead)
|
|||
void
|
||||
rb_count_rb_linebuf_memory(size_t *count, size_t *rb_linebuf_memory_used)
|
||||
{
|
||||
#ifndef NOBALLOC
|
||||
rb_bh_usage(rb_linebuf_heap, count, NULL, rb_linebuf_memory_used, NULL);
|
||||
#else
|
||||
*count = 0;
|
||||
*rb_linebuf_memory_used = 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -62,7 +62,8 @@ rb_stir_arc4random(void *unused)
|
|||
}
|
||||
|
||||
|
||||
int rb_init_prng(const char *path, prng_seed_t seed_type)
|
||||
int
|
||||
rb_init_prng(const char *path, prng_seed_t seed_type)
|
||||
{
|
||||
/* xxx this ignores the parameters above */
|
||||
arc4random_stir();
|
||||
|
@ -75,7 +76,7 @@ rb_get_random(void *buf, size_t length)
|
|||
{
|
||||
uint32_t rnd = 0, i;
|
||||
uint8_t *xbuf = buf;
|
||||
for (i = 0; i < sizeof(length); i++)
|
||||
for(i = 0; i < length; i++)
|
||||
{
|
||||
if(i % 4 == 0)
|
||||
rnd = arc4random();
|
||||
|
@ -163,4 +164,3 @@ rb_ssl_clear_handshake_count(rb_fde_t *F)
|
|||
}
|
||||
|
||||
#endif /* !HAVE_OPENSSL */
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ static SSL_CTX *ssl_server_ctx;
|
|||
static SSL_CTX *ssl_client_ctx;
|
||||
static int libratbox_index = -1;
|
||||
|
||||
static unsigned long get_last_err(void)
|
||||
static unsigned long
|
||||
get_last_err(void)
|
||||
{
|
||||
unsigned long t_err, err = 0;
|
||||
err = ERR_get_error();
|
||||
|
@ -89,7 +90,8 @@ rb_ssl_timeout(rb_fde_t * F, void *notused)
|
|||
}
|
||||
|
||||
|
||||
static void rb_ssl_info_callback(SSL *ssl, int where, int ret)
|
||||
static void
|
||||
rb_ssl_info_callback(SSL * ssl, int where, int ret)
|
||||
{
|
||||
if(where & SSL_CB_HANDSHAKE_START)
|
||||
{
|
||||
|
@ -104,7 +106,7 @@ static void
|
|||
rb_setup_ssl_cb(rb_fde_t *F)
|
||||
{
|
||||
SSL_set_ex_data(F->ssl, libratbox_index, (char *)F);
|
||||
SSL_set_info_callback((SSL *)F->ssl, (void *)rb_ssl_info_callback);
|
||||
SSL_set_info_callback((SSL *) F->ssl, (void (*)(const SSL *,int,int))rb_ssl_info_callback);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -146,8 +148,7 @@ rb_ssl_tryaccept(rb_fde_t * F, void *data)
|
|||
|
||||
ad = F->accept;
|
||||
F->accept = NULL;
|
||||
ad->callback(F, RB_OK, (struct sockaddr *) &ad->S, ad->addrlen,
|
||||
ad->data);
|
||||
ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
|
||||
rb_free(ad);
|
||||
|
||||
}
|
||||
|
@ -313,7 +314,6 @@ rb_init_ssl(void)
|
|||
int
|
||||
rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile)
|
||||
{
|
||||
FILE *param;
|
||||
DH *dh;
|
||||
unsigned long err;
|
||||
if(cert == NULL)
|
||||
|
@ -347,21 +347,27 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile)
|
|||
if(dhfile != NULL)
|
||||
{
|
||||
/* DH parameters aren't necessary, but they are nice..if they didn't pass one..that is their problem */
|
||||
param = fopen(dhfile, "r");
|
||||
if(param != NULL)
|
||||
BIO *bio = BIO_new_file(dhfile, "r");
|
||||
if(bio != NULL)
|
||||
{
|
||||
dh = PEM_read_DHparams(param, NULL, NULL, NULL);
|
||||
dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
|
||||
if(dh == NULL)
|
||||
{
|
||||
err = ERR_get_error();
|
||||
rb_lib_log
|
||||
("rb_setup_ssl_server: Error loading DH params file [%s]: %s",
|
||||
param, ERR_error_string(err, NULL));
|
||||
fclose(param);
|
||||
dhfile, ERR_error_string(err, NULL));
|
||||
BIO_free(bio);
|
||||
return 0;
|
||||
}
|
||||
BIO_free(bio);
|
||||
SSL_CTX_set_tmp_dh(ssl_server_ctx, dh);
|
||||
fclose(param);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = ERR_get_error();
|
||||
rb_lib_log("rb_setup_ssl_server: Error loading DH params file [%s]: %s",
|
||||
dhfile, ERR_error_string(err, NULL));
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -540,7 +546,7 @@ rb_init_prng(const char *path, prng_seed_t seed_type)
|
|||
{
|
||||
if(seed_type == RB_PRNG_DEFAULT)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
RAND_screen();
|
||||
#endif
|
||||
return RAND_status();
|
||||
|
@ -558,7 +564,7 @@ rb_init_prng(const char *path, prng_seed_t seed_type)
|
|||
if(RAND_load_file(path, -1) == -1)
|
||||
return -1;
|
||||
break;
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
case RB_PRNGWIN32:
|
||||
RAND_screen();
|
||||
break;
|
||||
|
|
|
@ -64,6 +64,7 @@ comp_with_mask(void *addr, void *dest, unsigned int mask)
|
|||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef NOTYET
|
||||
static char *
|
||||
prefix_toa2x(rb_prefix_t *prefix, char *buf, int buf_len, int with_len)
|
||||
|
@ -92,6 +93,7 @@ prefix_toa2(rb_prefix_t * prefix, char *buff, int buf_len)
|
|||
{
|
||||
return (prefix_toa2x(prefix, buff, buf_len, 0));
|
||||
}
|
||||
|
||||
static char *
|
||||
prefix_toa(rb_prefix_t *prefix)
|
||||
{
|
||||
|
@ -1018,7 +1020,9 @@ rb_match_ip(rb_patricia_tree_t * tree, struct sockaddr *ip)
|
|||
len = 128;
|
||||
family = AF_INET6;
|
||||
ipptr = &((struct sockaddr_in6 *)ip)->sin6_addr;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 32;
|
||||
family = AF_INET;
|
||||
ipptr = &((struct sockaddr_in *)ip)->sin_addr;
|
||||
|
@ -1054,7 +1058,9 @@ rb_match_ip_exact(rb_patricia_tree_t * tree, struct sockaddr *ip, unsigned int l
|
|||
len = 128;
|
||||
family = AF_INET6;
|
||||
ipptr = &((struct sockaddr_in6 *)ip)->sin6_addr;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if(len > 32)
|
||||
len = 32;
|
||||
family = AF_INET;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: poll.c 25375 2008-05-16 15:19:51Z androsyn $
|
||||
* $Id: poll.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: ports.c 25038 2008-01-23 16:03:08Z androsyn $
|
||||
* $Id: ports.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#include <libratbox_config.h>
|
||||
|
@ -45,7 +45,7 @@ static port_event_t *pelst; /* port buffer */
|
|||
static int pemax; /* max structs to buffer */
|
||||
|
||||
int
|
||||
rb_setup_fd_ports(rb_fde_t *F)
|
||||
rb_setup_fd_ports(int fd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -80,7 +80,8 @@ pe_update_events(rb_fde_t * F, short filter, PF * handler)
|
|||
int
|
||||
rb_init_netio_ports(void)
|
||||
{
|
||||
if((pe = port_create()) < 0) {
|
||||
if((pe = port_create()) < 0)
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
pemax = getdtablesize();
|
||||
|
@ -96,18 +97,19 @@ rb_init_netio_ports(void)
|
|||
* and deregister interest in a pending IO state for a given FD.
|
||||
*/
|
||||
void
|
||||
rb_setselect_ports(rb_fde_t *F, unsigned int type, PF * handler,
|
||||
void *client_data)
|
||||
rb_setselect_ports(rb_fde_t *F, unsigned int type, PF * handler, void *client_data)
|
||||
{
|
||||
lrb_assert(IsFDOpen(F));
|
||||
|
||||
/* Update the list, even though we're not using it .. */
|
||||
if(type & RB_SELECT_READ) {
|
||||
if(type & RB_SELECT_READ)
|
||||
{
|
||||
pe_update_events(F, POLLRDNORM, handler);
|
||||
F->read_handler = handler;
|
||||
F->read_data = client_data;
|
||||
}
|
||||
if(type & RB_SELECT_WRITE) {
|
||||
if(type & RB_SELECT_WRITE)
|
||||
{
|
||||
pe_update_events(F, POLLWRNORM, handler);
|
||||
F->write_handler = handler;
|
||||
F->write_data = client_data;
|
||||
|
@ -140,18 +142,22 @@ struct timer_data *tdata;
|
|||
if(i == -1)
|
||||
return RB_OK;
|
||||
|
||||
for (i = 0; i < nget; i++) {
|
||||
switch(pelst[i].portev_source) {
|
||||
for(i = 0; i < nget; i++)
|
||||
{
|
||||
switch (pelst[i].portev_source)
|
||||
{
|
||||
case PORT_SOURCE_FD:
|
||||
fd = pelst[i].portev_object;
|
||||
PF *hdl = NULL;
|
||||
rb_fde_t *F = rb_find_fd(fd);
|
||||
|
||||
if ((pelst[i].portev_events & POLLRDNORM) && (hdl = F->read_handler)) {
|
||||
if((pelst[i].portev_events & POLLRDNORM) && (hdl = F->read_handler))
|
||||
{
|
||||
F->read_handler = NULL;
|
||||
hdl(F, F->read_data);
|
||||
}
|
||||
if ((pelst[i].portev_events & POLLWRNORM) && (hdl = F->write_handler)) {
|
||||
if((pelst[i].portev_events & POLLWRNORM) && (hdl = F->write_handler))
|
||||
{
|
||||
F->write_handler = NULL;
|
||||
hdl(F, F->write_data);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: ratbox_lib.c 25375 2008-05-16 15:19:51Z androsyn $
|
||||
* $Id: ratbox_lib.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#include <libratbox_config.h>
|
||||
|
@ -79,15 +79,16 @@ rb_ctime(const time_t t, char *buf, size_t len)
|
|||
{
|
||||
p = timex;
|
||||
tlen = sizeof(timex);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
p = buf;
|
||||
tlen = len;
|
||||
}
|
||||
|
||||
rb_snprintf(p, tlen, "%s %s %d %02u:%02u:%02u %d",
|
||||
s_weekdays[tp->tm_wday], s_month[tp->tm_mon],
|
||||
tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec,
|
||||
tp->tm_year + 1900);
|
||||
tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec, tp->tm_year + 1900);
|
||||
return (p);
|
||||
}
|
||||
|
||||
|
@ -181,15 +182,17 @@ rb_set_time(void)
|
|||
memcpy(&rb_time, &newtime, sizeof(struct timeval));
|
||||
}
|
||||
|
||||
extern const char *libratbox_serno;
|
||||
|
||||
const char *
|
||||
rb_lib_version(void)
|
||||
{
|
||||
static const char *id = "$Rev: 25375 $";
|
||||
return id;
|
||||
return libratbox_serno;
|
||||
}
|
||||
|
||||
void
|
||||
rb_lib_init(log_cb *ilog, restart_cb *irestart, die_cb *idie, int closeall, int maxcon, size_t dh_size, size_t fd_heap_size)
|
||||
rb_lib_init(log_cb * ilog, restart_cb * irestart, die_cb * idie, int closeall, int maxcon,
|
||||
size_t dh_size, size_t fd_heap_size)
|
||||
{
|
||||
rb_set_time();
|
||||
rb_log = ilog;
|
||||
|
@ -236,7 +239,8 @@ rb_lib_loop(long delay)
|
|||
else
|
||||
next = -1;
|
||||
rb_select(next);
|
||||
} else
|
||||
}
|
||||
else
|
||||
rb_select(delay);
|
||||
rb_event_run();
|
||||
}
|
||||
|
@ -273,8 +277,8 @@ rb_strtok_r (char *s, const char *delim, char **save)
|
|||
return token;
|
||||
}
|
||||
#else
|
||||
char
|
||||
*rb_strtok_r(char *s, const char *delim, char **save)
|
||||
char *
|
||||
rb_strtok_r(char *s, const char *delim, char **save)
|
||||
{
|
||||
return strtok_r(s, delim, save);
|
||||
}
|
||||
|
@ -317,7 +321,8 @@ rb_base64_encode(const unsigned char *str, int length)
|
|||
unsigned char *p;
|
||||
unsigned char *result;
|
||||
|
||||
if ((length + 2) < 0 || ((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2))) {
|
||||
if((length + 2) < 0 || ((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -335,13 +340,17 @@ rb_base64_encode(const unsigned char *str, int length)
|
|||
length -= 3;
|
||||
}
|
||||
|
||||
if (length != 0) {
|
||||
if(length != 0)
|
||||
{
|
||||
*p++ = base64_table[current[0] >> 2];
|
||||
if (length > 1) {
|
||||
if(length > 1)
|
||||
{
|
||||
*p++ = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)];
|
||||
*p++ = base64_table[(current[1] & 0x0f) << 2];
|
||||
*p++ = base64_pad;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
*p++ = base64_table[(current[0] & 0x03) << 4];
|
||||
*p++ = base64_pad;
|
||||
*p++ = base64_pad;
|
||||
|
@ -360,13 +369,17 @@ rb_base64_decode(const unsigned char *str, int length, int *ret)
|
|||
|
||||
result = rb_malloc(length + 1);
|
||||
|
||||
while ((ch = *current++) != '\0' && length-- > 0) {
|
||||
if (ch == base64_pad) break;
|
||||
while((ch = *current++) != '\0' && length-- > 0)
|
||||
{
|
||||
if(ch == base64_pad)
|
||||
break;
|
||||
|
||||
ch = base64_reverse_table[ch];
|
||||
if (ch < 0) continue;
|
||||
if(ch < 0)
|
||||
continue;
|
||||
|
||||
switch(i % 4) {
|
||||
switch (i % 4)
|
||||
{
|
||||
case 0:
|
||||
result[j] = ch << 2;
|
||||
break;
|
||||
|
@ -387,8 +400,10 @@ rb_base64_decode(const unsigned char *str, int length, int *ret)
|
|||
|
||||
k = j;
|
||||
|
||||
if (ch == base64_pad) {
|
||||
switch(i % 4) {
|
||||
if(ch == base64_pad)
|
||||
{
|
||||
switch (i % 4)
|
||||
{
|
||||
case 1:
|
||||
free(result);
|
||||
return NULL;
|
||||
|
@ -402,5 +417,3 @@ rb_base64_decode(const unsigned char *str, int length, int *ret)
|
|||
*ret = j;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: rb_memory.c 25038 2008-01-23 16:03:08Z androsyn $
|
||||
* $Id: rb_memory.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
@ -39,4 +39,3 @@ rb_outofmemory(void)
|
|||
rb_lib_log("Out of memory: restarting server...");
|
||||
rb_lib_restart("Out of Memory");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,13 +22,22 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: select.c 25038 2008-01-23 16:03:08Z androsyn $
|
||||
* $Id: select.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
#define FD_SETSIZE 65535
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
#include <commio-int.h>
|
||||
|
||||
#if defined(HAVE_SELECT)
|
||||
#if defined(HAVE_SELECT) || defined(_WIN32)
|
||||
|
||||
#ifdef _WIN32
|
||||
#define MY_FD_SET(x, y) FD_SET((SOCKET)x, y)
|
||||
#define MY_FD_CLR(x, y) FD_CLR((SOCKET)x, y)
|
||||
#else
|
||||
#define MY_FD_SET(x, y) FD_SET(x, y)
|
||||
#define MY_FD_CLR(x, y) FD_CLR(x, y)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
|
@ -67,12 +76,12 @@ select_update_selectfds(rb_fde_t *F, short event, PF * handler)
|
|||
{
|
||||
if(handler)
|
||||
{
|
||||
FD_SET(F->fd, &select_readfds);
|
||||
MY_FD_SET(F->fd, &select_readfds);
|
||||
F->pflags |= RB_SELECT_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
FD_CLR(F->fd, &select_readfds);
|
||||
MY_FD_CLR(F->fd, &select_readfds);
|
||||
F->pflags &= ~RB_SELECT_READ;
|
||||
}
|
||||
}
|
||||
|
@ -81,12 +90,12 @@ select_update_selectfds(rb_fde_t *F, short event, PF * handler)
|
|||
{
|
||||
if(handler)
|
||||
{
|
||||
FD_SET(F->fd, &select_writefds);
|
||||
MY_FD_SET(F->fd, &select_writefds);
|
||||
F->pflags |= RB_SELECT_WRITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
FD_CLR(F->fd, &select_writefds);
|
||||
MY_FD_CLR(F->fd, &select_writefds);
|
||||
F->pflags &= ~RB_SELECT_WRITE;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +109,8 @@ select_update_selectfds(rb_fde_t *F, short event, PF * handler)
|
|||
}
|
||||
else if(F->fd <= rb_maxfd)
|
||||
{
|
||||
while(rb_maxfd >= 0 && !FD_ISSET(rb_maxfd, &select_readfds) && !FD_ISSET(rb_maxfd, &select_writefds))
|
||||
while(rb_maxfd >= 0 && !FD_ISSET(rb_maxfd, &select_readfds)
|
||||
&& !FD_ISSET(rb_maxfd, &select_writefds))
|
||||
rb_maxfd--;
|
||||
}
|
||||
}
|
||||
|
@ -122,9 +132,12 @@ rb_setup_fd_select(rb_fde_t *F)
|
|||
* This is a needed exported function which will be called to initialise
|
||||
* the network loop code.
|
||||
*/
|
||||
extern int rb_maxconnections;
|
||||
int
|
||||
rb_init_netio_select(void)
|
||||
{
|
||||
if(rb_maxconnections > FD_SETSIZE)
|
||||
rb_maxconnections = FD_SETSIZE; /* override this */
|
||||
FD_ZERO(&select_readfds);
|
||||
FD_ZERO(&select_writefds);
|
||||
return 0;
|
||||
|
@ -137,8 +150,7 @@ rb_init_netio_select(void)
|
|||
* and deregister interest in a pending IO state for a given FD.
|
||||
*/
|
||||
void
|
||||
rb_setselect_select(rb_fde_t *F, unsigned int type, PF * handler,
|
||||
void *client_data)
|
||||
rb_setselect_select(rb_fde_t *F, unsigned int type, PF * handler, void *client_data)
|
||||
{
|
||||
lrb_assert(IsFDOpen(F));
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: sigio.c 25375 2008-05-16 15:19:51Z androsyn $
|
||||
* $Id: sigio.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* The original headers are below..
|
||||
* Note that this implementation does not process floating point numbers so
|
||||
* you will likely need to fall back to using sprintf yourself to do those...
|
||||
* $Id: snprintf.c 25375 2008-05-16 15:19:51Z androsyn $
|
||||
* $Id: snprintf.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -27,7 +27,8 @@
|
|||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
||||
static int skip_atoi(const char **s)
|
||||
static int
|
||||
skip_atoi(const char **s)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
|
@ -46,7 +47,8 @@ static int skip_atoi(const char **s)
|
|||
/* Formats correctly any integer in [0,99999].
|
||||
* Outputs from one to five digits depending on input.
|
||||
* On i386 gcc 4.1.2 -O2: ~250 bytes of code. */
|
||||
static char* put_dec_trunc(char *buf, unsigned q)
|
||||
static char *
|
||||
put_dec_trunc(char *buf, unsigned q)
|
||||
{
|
||||
unsigned d3, d2, d1, d0;
|
||||
d1 = (q >> 4) & 0xf;
|
||||
|
@ -58,19 +60,22 @@ static char* put_dec_trunc(char *buf, unsigned q)
|
|||
d0 = d0 - 10 * q;
|
||||
*buf++ = d0 + '0'; /* least significant digit */
|
||||
d1 = q + 9 * d3 + 5 * d2 + d1;
|
||||
if (d1 != 0) {
|
||||
if(d1 != 0)
|
||||
{
|
||||
q = (d1 * 0xcd) >> 11;
|
||||
d1 = d1 - 10 * q;
|
||||
*buf++ = d1 + '0'; /* next digit */
|
||||
|
||||
d2 = q + 2 * d2;
|
||||
if ((d2 != 0) || (d3 != 0)) {
|
||||
if((d2 != 0) || (d3 != 0))
|
||||
{
|
||||
q = (d2 * 0xd) >> 7;
|
||||
d2 = d2 - 10 * q;
|
||||
*buf++ = d2 + '0'; /* next digit */
|
||||
|
||||
d3 = q + 4 * d3;
|
||||
if (d3 != 0) {
|
||||
if(d3 != 0)
|
||||
{
|
||||
q = (d3 * 0xcd) >> 11;
|
||||
d3 = d3 - 10 * q;
|
||||
*buf++ = d3 + '0'; /* next digit */
|
||||
|
@ -81,8 +86,10 @@ static char* put_dec_trunc(char *buf, unsigned q)
|
|||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Same with if's removed. Always emits five digits */
|
||||
static char* put_dec_full(char *buf, unsigned q)
|
||||
static char *
|
||||
put_dec_full(char *buf, unsigned q)
|
||||
{
|
||||
/* BTW, if q is in [0,9999], 8-bit ints will be enough, */
|
||||
/* but anyway, gcc produces better code with full-sized ints */
|
||||
|
@ -122,9 +129,11 @@ static char* put_dec_full(char *buf, unsigned q)
|
|||
return buf;
|
||||
}
|
||||
|
||||
static char* put_dec(char *buf, unsigned long long int num)
|
||||
static char *
|
||||
put_dec(char *buf, unsigned long long int num)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
while (1) {
|
||||
unsigned rem;
|
||||
if(num < 100000)
|
||||
return put_dec_trunc(buf, num);
|
||||
|
@ -142,7 +151,9 @@ static char* put_dec(char *buf, unsigned long long int num)
|
|||
#define SPECIAL 32 /* 0x */
|
||||
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
|
||||
|
||||
static char *number(char *buf, char *end, unsigned long long int num, int base, int size, int precision, int type)
|
||||
static char *
|
||||
number(char *buf, char *end, unsigned long long int num, int base, int size, int precision,
|
||||
int type)
|
||||
{
|
||||
char sign, tmp[66];
|
||||
const char *digits;
|
||||
|
@ -158,20 +169,27 @@ static char *number(char *buf, char *end, unsigned long long int num, int base,
|
|||
if(base < 2 || base > 36)
|
||||
return NULL;
|
||||
sign = 0;
|
||||
if (type & SIGN) {
|
||||
if ((signed long long int) num < 0) {
|
||||
if(type & SIGN)
|
||||
{
|
||||
if((signed long long int)num < 0)
|
||||
{
|
||||
sign = '-';
|
||||
num = -(signed long long int)num;
|
||||
size--;
|
||||
} else if (type & PLUS) {
|
||||
}
|
||||
else if(type & PLUS)
|
||||
{
|
||||
sign = '+';
|
||||
size--;
|
||||
} else if (type & SPACE) {
|
||||
}
|
||||
else if(type & SPACE)
|
||||
{
|
||||
sign = ' ';
|
||||
size--;
|
||||
}
|
||||
}
|
||||
if (need_pfx) {
|
||||
if(need_pfx)
|
||||
{
|
||||
size--;
|
||||
if(base == 16)
|
||||
size--;
|
||||
|
@ -186,15 +204,21 @@ static char *number(char *buf, char *end, unsigned long long int num, int base,
|
|||
tmp[i++] = digits[do_div(num,base)];
|
||||
} while (num != 0);
|
||||
*/
|
||||
else if (base != 10) { /* 8 or 16 */
|
||||
else if(base != 10)
|
||||
{ /* 8 or 16 */
|
||||
int mask = base - 1;
|
||||
int shift = 3;
|
||||
if (base == 16) shift = 4;
|
||||
do {
|
||||
if(base == 16)
|
||||
shift = 4;
|
||||
do
|
||||
{
|
||||
tmp[i++] = digits[((unsigned char)num) & mask];
|
||||
num >>= shift;
|
||||
} while (num);
|
||||
} else { /* base 10 */
|
||||
}
|
||||
while(num);
|
||||
}
|
||||
else
|
||||
{ /* base 10 */
|
||||
i = put_dec(tmp, num) - tmp;
|
||||
}
|
||||
|
||||
|
@ -203,53 +227,63 @@ static char *number(char *buf, char *end, unsigned long long int num, int base,
|
|||
precision = i;
|
||||
/* leading space padding */
|
||||
size -= precision;
|
||||
if (!(type & (ZEROPAD+LEFT))) {
|
||||
while(--size >= 0) {
|
||||
if(!(type & (ZEROPAD + LEFT)))
|
||||
{
|
||||
while(--size >= 0)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = ' ';
|
||||
++buf;
|
||||
}
|
||||
}
|
||||
/* sign */
|
||||
if (sign) {
|
||||
if(sign)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = sign;
|
||||
++buf;
|
||||
}
|
||||
/* "0x" / "0" prefix */
|
||||
if (need_pfx) {
|
||||
if(need_pfx)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = '0';
|
||||
++buf;
|
||||
if (base == 16) {
|
||||
if(base == 16)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = digits[16]; /* for arbitrary base: digits[33]; */
|
||||
++buf;
|
||||
}
|
||||
}
|
||||
/* zero or space padding */
|
||||
if (!(type & LEFT)) {
|
||||
if(!(type & LEFT))
|
||||
{
|
||||
char c = (type & ZEROPAD) ? '0' : ' ';
|
||||
while (--size >= 0) {
|
||||
while(--size >= 0)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = c;
|
||||
++buf;
|
||||
}
|
||||
}
|
||||
/* hmm even more zero padding? */
|
||||
while (i <= --precision) {
|
||||
while(i <= --precision)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = '0';
|
||||
++buf;
|
||||
}
|
||||
/* actual digits of result */
|
||||
while (--i >= 0) {
|
||||
while(--i >= 0)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = tmp[i];
|
||||
++buf;
|
||||
}
|
||||
/* trailing space padding */
|
||||
while (--size >= 0) {
|
||||
while(--size >= 0)
|
||||
{
|
||||
if(buf < end)
|
||||
*buf = ' ';
|
||||
++buf;
|
||||
|
@ -275,7 +309,8 @@ static char *number(char *buf, char *end, unsigned long long int num, int base,
|
|||
* Call this function if you are already dealing with a va_list.
|
||||
* You probably want snprintf() instead.
|
||||
*/
|
||||
int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
||||
int
|
||||
rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
||||
{
|
||||
int len;
|
||||
unsigned long long int num;
|
||||
|
@ -295,7 +330,8 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
|
||||
/* Reject out-of-range values early. Large positive sizes are
|
||||
used for unknown buffer sizes. */
|
||||
if (rb_unlikely((int) size < 0)) {
|
||||
if(rb_unlikely((int)size < 0))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -303,13 +339,16 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
end = buf + size;
|
||||
|
||||
/* Make sure end is always >= buf */
|
||||
if (end < buf) {
|
||||
if(end < buf)
|
||||
{
|
||||
end = ((void *)-1);
|
||||
size = end - buf;
|
||||
}
|
||||
|
||||
for (; *fmt ; ++fmt) {
|
||||
if (*fmt != '%') {
|
||||
for(; *fmt; ++fmt)
|
||||
{
|
||||
if(*fmt != '%')
|
||||
{
|
||||
if(str < end)
|
||||
*str = *fmt;
|
||||
++str;
|
||||
|
@ -320,23 +359,36 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
flags = 0;
|
||||
repeat:
|
||||
++fmt; /* this also skips first '%' */
|
||||
switch (*fmt) {
|
||||
case '-': flags |= LEFT; goto repeat;
|
||||
case '+': flags |= PLUS; goto repeat;
|
||||
case ' ': flags |= SPACE; goto repeat;
|
||||
case '#': flags |= SPECIAL; goto repeat;
|
||||
case '0': flags |= ZEROPAD; goto repeat;
|
||||
switch (*fmt)
|
||||
{
|
||||
case '-':
|
||||
flags |= LEFT;
|
||||
goto repeat;
|
||||
case '+':
|
||||
flags |= PLUS;
|
||||
goto repeat;
|
||||
case ' ':
|
||||
flags |= SPACE;
|
||||
goto repeat;
|
||||
case '#':
|
||||
flags |= SPECIAL;
|
||||
goto repeat;
|
||||
case '0':
|
||||
flags |= ZEROPAD;
|
||||
goto repeat;
|
||||
}
|
||||
|
||||
/* get field width */
|
||||
field_width = -1;
|
||||
if(isdigit(*fmt))
|
||||
field_width = skip_atoi(&fmt);
|
||||
else if (*fmt == '*') {
|
||||
else if(*fmt == '*')
|
||||
{
|
||||
++fmt;
|
||||
/* it's the next argument */
|
||||
field_width = va_arg(args, int);
|
||||
if (field_width < 0) {
|
||||
if(field_width < 0)
|
||||
{
|
||||
field_width = -field_width;
|
||||
flags |= LEFT;
|
||||
}
|
||||
|
@ -344,11 +396,13 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
|
||||
/* get the precision */
|
||||
precision = -1;
|
||||
if (*fmt == '.') {
|
||||
if(*fmt == '.')
|
||||
{
|
||||
++fmt;
|
||||
if(isdigit(*fmt))
|
||||
precision = skip_atoi(&fmt);
|
||||
else if (*fmt == '*') {
|
||||
else if(*fmt == '*')
|
||||
{
|
||||
++fmt;
|
||||
/* it's the next argument */
|
||||
precision = va_arg(args, int);
|
||||
|
@ -360,10 +414,12 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
/* get the conversion qualifier */
|
||||
qualifier = -1;
|
||||
if(*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
|
||||
*fmt =='Z' || *fmt == 'z' || *fmt == 't') {
|
||||
*fmt == 'Z' || *fmt == 'z' || *fmt == 't')
|
||||
{
|
||||
qualifier = *fmt;
|
||||
++fmt;
|
||||
if (qualifier == 'l' && *fmt == 'l') {
|
||||
if(qualifier == 'l' && *fmt == 'l')
|
||||
{
|
||||
qualifier = 'L';
|
||||
++fmt;
|
||||
}
|
||||
|
@ -372,10 +428,13 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
/* default base */
|
||||
base = 10;
|
||||
|
||||
switch (*fmt) {
|
||||
switch (*fmt)
|
||||
{
|
||||
case 'c':
|
||||
if (!(flags & LEFT)) {
|
||||
while (--field_width > 0) {
|
||||
if(!(flags & LEFT))
|
||||
{
|
||||
while(--field_width > 0)
|
||||
{
|
||||
if(str < end)
|
||||
*str = ' ';
|
||||
++str;
|
||||
|
@ -385,7 +444,8 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
if(str < end)
|
||||
*str = c;
|
||||
++str;
|
||||
while (--field_width > 0) {
|
||||
while(--field_width > 0)
|
||||
{
|
||||
if(str < end)
|
||||
*str = ' ';
|
||||
++str;
|
||||
|
@ -394,24 +454,30 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
|
||||
case 's':
|
||||
s = va_arg(args, char *);
|
||||
if (s == NULL) {
|
||||
if(s == NULL)
|
||||
{
|
||||
abort(); /* prefer blowing up vs corrupt data */
|
||||
}
|
||||
len = rb_strnlen(s, precision);
|
||||
|
||||
if (!(flags & LEFT)) {
|
||||
while (len < field_width--) {
|
||||
if(!(flags & LEFT))
|
||||
{
|
||||
while(len < field_width--)
|
||||
{
|
||||
if(str < end)
|
||||
*str = ' ';
|
||||
++str;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < len; ++i) {
|
||||
for(i = 0; i < len; ++i)
|
||||
{
|
||||
if(str < end)
|
||||
*str = *s;
|
||||
++str; ++s;
|
||||
++str;
|
||||
++s;
|
||||
}
|
||||
while (len < field_width--) {
|
||||
while(len < field_width--)
|
||||
{
|
||||
if(str < end)
|
||||
*str = ' ';
|
||||
++str;
|
||||
|
@ -419,7 +485,8 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
continue;
|
||||
|
||||
case 'p':
|
||||
if (field_width == -1) {
|
||||
if(field_width == -1)
|
||||
{
|
||||
field_width = 2 * sizeof(void *);
|
||||
flags |= ZEROPAD;
|
||||
}
|
||||
|
@ -432,13 +499,18 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
case 'n':
|
||||
/* FIXME:
|
||||
* What does C99 say about the overflow case here? */
|
||||
if (qualifier == 'l') {
|
||||
if(qualifier == 'l')
|
||||
{
|
||||
long *ip = va_arg(args, long *);
|
||||
*ip = (str - buf);
|
||||
} else if (qualifier == 'Z' || qualifier == 'z') {
|
||||
}
|
||||
else if(qualifier == 'Z' || qualifier == 'z')
|
||||
{
|
||||
size_t *ip = va_arg(args, size_t *);
|
||||
*ip = (str - buf);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
int *ip = va_arg(args, int *);
|
||||
*ip = (str - buf);
|
||||
}
|
||||
|
@ -471,38 +543,50 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
if(str < end)
|
||||
*str = '%';
|
||||
++str;
|
||||
if (*fmt) {
|
||||
if(*fmt)
|
||||
{
|
||||
if(str < end)
|
||||
*str = *fmt;
|
||||
++str;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
--fmt;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(qualifier == 'L')
|
||||
num = va_arg(args, long long int);
|
||||
else if (qualifier == 'l') {
|
||||
else if(qualifier == 'l')
|
||||
{
|
||||
num = va_arg(args, unsigned long);
|
||||
if(flags & SIGN)
|
||||
num = (signed long)num;
|
||||
} else if (qualifier == 'Z' || qualifier == 'z') {
|
||||
}
|
||||
else if(qualifier == 'Z' || qualifier == 'z')
|
||||
{
|
||||
num = va_arg(args, size_t);
|
||||
} else if (qualifier == 't') {
|
||||
}
|
||||
else if(qualifier == 't')
|
||||
{
|
||||
num = va_arg(args, ptrdiff_t);
|
||||
} else if (qualifier == 'h') {
|
||||
}
|
||||
else if(qualifier == 'h')
|
||||
{
|
||||
num = (unsigned short)va_arg(args, int);
|
||||
if(flags & SIGN)
|
||||
num = (signed short)num;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
num = va_arg(args, unsigned int);
|
||||
if(flags & SIGN)
|
||||
num = (signed int)num;
|
||||
}
|
||||
str = number(str, end, num, base,
|
||||
field_width, precision, flags);
|
||||
str = number(str, end, num, base, field_width, precision, flags);
|
||||
}
|
||||
if (size > 0) {
|
||||
if(size > 0)
|
||||
{
|
||||
if(str < end)
|
||||
*str = '\0';
|
||||
else
|
||||
|
@ -524,7 +608,8 @@ int rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
|||
* as per ISO C99. If the return is greater than or equal to
|
||||
* @size, the resulting string is truncated.
|
||||
*/
|
||||
int rb_snprintf(char * buf, size_t size, const char *fmt, ...)
|
||||
int
|
||||
rb_snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
int i;
|
||||
|
@ -548,7 +633,8 @@ int rb_snprintf(char * buf, size_t size, const char *fmt, ...)
|
|||
* Call this function if you are already dealing with a va_list.
|
||||
* You probably want sprintf() instead.
|
||||
*/
|
||||
int rb_vsprintf(char *buf, const char *fmt, va_list args)
|
||||
int
|
||||
rb_vsprintf(char *buf, const char *fmt, va_list args)
|
||||
{
|
||||
return rb_vsnprintf(buf, INT_MAX, fmt, args);
|
||||
}
|
||||
|
@ -563,7 +649,8 @@ int rb_vsprintf(char *buf, const char *fmt, va_list args)
|
|||
* into @buf. Use snprintf() or scnprintf() in order to avoid
|
||||
* buffer overflows.
|
||||
*/
|
||||
int rb_sprintf(char * buf, const char *fmt, ...)
|
||||
int
|
||||
rb_sprintf(char *buf, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
int i;
|
||||
|
@ -610,7 +697,16 @@ rb_sprintf_append(char *str, const char *format, ...)
|
|||
int
|
||||
rb_vsnprintf_append(char *str, size_t len, const char *format, va_list ap)
|
||||
{
|
||||
size_t x = strlen(str);
|
||||
size_t x;
|
||||
if(len == 0)
|
||||
return 0;
|
||||
x = strlen(str);
|
||||
|
||||
if(len < x)
|
||||
{
|
||||
str[len - 1] = '\0';
|
||||
return len - 1;
|
||||
}
|
||||
return (rb_vsnprintf(str + x, len - x, format, ap) + x);
|
||||
}
|
||||
|
||||
|
@ -630,4 +726,3 @@ rb_snprintf_append(char *str, size_t len, const char *format, ...)
|
|||
va_end(ap);
|
||||
return (x);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: tools.c 25040 2008-01-23 16:11:34Z androsyn $
|
||||
* $Id: tools.c 26170 2008-10-26 20:59:07Z androsyn $
|
||||
*
|
||||
* Here is the original header:
|
||||
*
|
||||
|
@ -168,7 +168,8 @@ rb_strlcpy(char *dest, const char *src, size_t size)
|
|||
{
|
||||
size_t ret = strlen(src);
|
||||
|
||||
if (size) {
|
||||
if(size)
|
||||
{
|
||||
size_t len = (ret >= size) ? size - 1 : ret;
|
||||
memcpy(dest, src, len);
|
||||
dest[len] = '\0';
|
||||
|
@ -201,3 +202,42 @@ rb_strnlen(const char *s, size_t count)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* rb_basename
|
||||
*
|
||||
* input -
|
||||
* output -
|
||||
* side effects -
|
||||
*/
|
||||
char *
|
||||
rb_basename(const char *path)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
if(!(s = strrchr(path, '/')))
|
||||
s = path;
|
||||
else
|
||||
s++;
|
||||
return rb_strdup(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* rb_dirname
|
||||
*/
|
||||
|
||||
char *
|
||||
rb_dirname (const char *path)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = strrchr(path, '/');
|
||||
if(s == NULL)
|
||||
{
|
||||
return rb_strdup(".");
|
||||
}
|
||||
|
||||
/* remove extra slashes */
|
||||
while(s > path && *s == '/')
|
||||
--s;
|
||||
|
||||
return rb_strndup(path, ((uintptr_t)s - (uintptr_t)path) + 2);
|
||||
}
|
||||
|
|
|
@ -21,26 +21,44 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: unix.c 25038 2008-01-23 16:03:08Z androsyn $
|
||||
* $Id: unix.c 26180 2008-11-11 00:00:12Z androsyn $
|
||||
*/
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
|
||||
#ifndef WINDOWS
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
||||
#if defined(HAVE_SPAWN_H) && defined(HAVE_POSIX_SPAWN)
|
||||
#include <spawn.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <crt_externs.h>
|
||||
#endif
|
||||
|
||||
#ifndef __APPLE__
|
||||
extern char **environ;
|
||||
#endif
|
||||
pid_t
|
||||
rb_spawn_process(const char *path, const char **argv)
|
||||
{
|
||||
pid_t pid;
|
||||
const void *arghack = argv;
|
||||
char **myenviron;
|
||||
posix_spawnattr_t spattr;
|
||||
posix_spawnattr_init(&spattr);
|
||||
#ifdef POSIX_SPAWN_USEVFORK
|
||||
posix_spawnattr_setflags(&spattr, POSIX_SPAWN_USEVFORK);
|
||||
#endif
|
||||
if(posix_spawn(&pid, path, NULL, &spattr, arghack, environ))
|
||||
#ifdef __APPLE__
|
||||
myenviron = *_NSGetEnviron(); /* apple needs to go fuck themselves for this */
|
||||
#else
|
||||
myenviron = environ;
|
||||
#endif
|
||||
if(posix_spawn(&pid, path, NULL, &spattr, arghack, myenviron))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -97,6 +115,37 @@ rb_sleep(unsigned int seconds, unsigned int useconds)
|
|||
select(0, NULL, NULL, NULL, &tv);
|
||||
#endif
|
||||
}
|
||||
#endif /* !WINDOWS */
|
||||
|
||||
/* this is to keep some linkers from bitching about exporting a non-existant symbol..bleh */
|
||||
char *
|
||||
rb_strerror(int error)
|
||||
{
|
||||
return strerror(error);
|
||||
}
|
||||
|
||||
int
|
||||
rb_kill(pid_t pid, int sig)
|
||||
{
|
||||
return kill(pid, sig);
|
||||
}
|
||||
|
||||
int
|
||||
rb_setenv(const char *name, const char *value, int overwrite)
|
||||
{
|
||||
return setenv(name, value, overwrite);
|
||||
}
|
||||
|
||||
pid_t
|
||||
rb_waitpid(pid_t pid, int *status, int options)
|
||||
{
|
||||
return waitpid(pid, status, options);
|
||||
}
|
||||
|
||||
pid_t
|
||||
rb_getpid(void)
|
||||
{
|
||||
return getpid();
|
||||
}
|
||||
|
||||
|
||||
#endif /* !WIN32 */
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: win32.c 25038 2008-01-23 16:03:08Z androsyn $
|
||||
* $Id: win32.c 26092 2008-09-19 15:13:52Z androsyn $
|
||||
*/
|
||||
|
||||
#include <libratbox_config.h>
|
||||
#include <ratbox_lib.h>
|
||||
#include <commio-int.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
static HWND hwnd;
|
||||
|
||||
|
@ -54,7 +54,7 @@ typedef union
|
|||
#define EPOCH_BIAS Const64(116444736000000000)
|
||||
|
||||
pid_t
|
||||
getpid()
|
||||
rb_getpid()
|
||||
{
|
||||
return GetCurrentProcessId();
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ rb_spawn_process(const char *path, const char **argv)
|
|||
}
|
||||
|
||||
pid_t
|
||||
waitpid(int pid, int *status, int flags)
|
||||
rb_waitpid(int pid, int *status, int flags)
|
||||
{
|
||||
DWORD timeout = (flags & WNOHANG) ? 0 : INFINITE;
|
||||
HANDLE hProcess;
|
||||
|
@ -127,7 +127,7 @@ waitpid(int pid, int *status, int flags)
|
|||
}
|
||||
|
||||
int
|
||||
setenv(const char *name, const char *value, int overwrite)
|
||||
rb_setenv(const char *name, const char *value, int overwrite)
|
||||
{
|
||||
char *buf;
|
||||
int len;
|
||||
|
@ -152,7 +152,7 @@ setenv(const char *name, const char *value, int overwrite)
|
|||
}
|
||||
|
||||
int
|
||||
kill(int pid, int sig)
|
||||
rb_kill(int pid, int sig)
|
||||
{
|
||||
HANDLE hProcess;
|
||||
hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid);
|
||||
|
@ -180,15 +180,134 @@ kill(int pid, int sig)
|
|||
|
||||
}
|
||||
|
||||
int
|
||||
rb_pass_fd_to_process(int fd, pid_t process, rb_fde_t *F)
|
||||
/*
|
||||
* packet format is
|
||||
uint32_t magic
|
||||
uint8_t protocol count
|
||||
WSAPROTOCOL_INFO * count
|
||||
size_t datasize
|
||||
data
|
||||
|
||||
*/
|
||||
|
||||
static int
|
||||
make_wsaprotocol_info(pid_t process, rb_fde_t *F, WSAPROTOCOL_INFO * inf)
|
||||
{
|
||||
WSAPROTOCOL_INFO info;
|
||||
WSADuplicateSocket((SOCKET)fd, process, &info);
|
||||
rb_write(F, &info, sizeof(info));
|
||||
if(!WSADuplicateSocket((SOCKET) rb_get_fd(F), process, &info))
|
||||
{
|
||||
memcpy(inf, &info, sizeof(WSAPROTOCOL_INFO));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static rb_fde_t *
|
||||
make_fde_from_wsaprotocol_info(void *data)
|
||||
{
|
||||
WSAPROTOCOL_INFO *info = data;
|
||||
SOCKET t;
|
||||
t = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, info, 0, 0);
|
||||
if(t == INVALID_SOCKET)
|
||||
{
|
||||
rb_get_errno();
|
||||
return NULL;
|
||||
}
|
||||
return rb_open(t, RB_FD_SOCKET, "remote_socket");
|
||||
}
|
||||
|
||||
static uint8_t fd_buf[16384];
|
||||
#define MAGIC_CONTROL 0xFF0ACAFE
|
||||
|
||||
int
|
||||
rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid)
|
||||
{
|
||||
size_t bufsize =
|
||||
sizeof(uint32_t) + sizeof(uint8_t) + (sizeof(WSAPROTOCOL_INFO) * (size_t)count) +
|
||||
sizeof(size_t) + datasize;
|
||||
int i;
|
||||
uint32_t magic = MAGIC_CONTROL;
|
||||
void *ptr;
|
||||
if(count > 4)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if(bufsize > sizeof(fd_buf))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
memset(fd_buf, 0, sizeof(fd_buf));
|
||||
|
||||
ptr = fd_buf;
|
||||
memcpy(ptr, &magic, sizeof(magic));
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(magic));
|
||||
*((uint8_t *)ptr) = count;
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(uint8_t));
|
||||
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
make_wsaprotocol_info(pid, F[i], (WSAPROTOCOL_INFO *) ptr);
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(WSAPROTOCOL_INFO));
|
||||
}
|
||||
memcpy(ptr, &datasize, sizeof(size_t));
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(size_t));
|
||||
memcpy(ptr, data, datasize);
|
||||
return rb_write(xF, fd_buf, bufsize);
|
||||
}
|
||||
|
||||
#ifdef MYMIN
|
||||
#undef MYMIN
|
||||
#endif
|
||||
#define MYMIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
int
|
||||
rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds)
|
||||
{
|
||||
size_t minsize = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(size_t);
|
||||
size_t datalen;
|
||||
ssize_t retlen;
|
||||
uint32_t magic;
|
||||
uint8_t count;
|
||||
unsigned int i;
|
||||
void *ptr;
|
||||
ssize_t ret;
|
||||
memset(fd_buf, 0, sizeof(fd_buf)); /* some paranoia here... */
|
||||
ret = rb_read(F, fd_buf, sizeof(fd_buf));
|
||||
if(ret <= 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
if(ret < (ssize_t) minsize)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
ptr = fd_buf;
|
||||
memcpy(&magic, ptr, sizeof(uint32_t));
|
||||
if(magic != MAGIC_CONTROL)
|
||||
{
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(uint32_t));
|
||||
memcpy(&count, ptr, sizeof(uint8_t));
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(uint8_t));
|
||||
for(i = 0; i < count && i < (unsigned int)nfds; i++)
|
||||
{
|
||||
rb_fde_t *tF = make_fde_from_wsaprotocol_info(ptr);
|
||||
if(tF == NULL)
|
||||
return -1;
|
||||
xF[i] = tF;
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(WSAPROTOCOL_INFO));
|
||||
}
|
||||
memcpy(&datalen, ptr, sizeof(size_t));
|
||||
ptr = (void *)((uintptr_t)ptr + (uintptr_t)sizeof(size_t));
|
||||
retlen = MYMIN(datalen, datasize);
|
||||
memcpy(data, ptr, datalen);
|
||||
return retlen;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
rb_process_events(HWND nhwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
|
||||
|
@ -280,10 +399,8 @@ rb_init_netio_win32(void)
|
|||
void
|
||||
rb_sleep(unsigned int seconds, unsigned int useconds)
|
||||
{
|
||||
struct timeval tv;
|
||||
tv.tv_sec = seconds;
|
||||
tv.tv_usec = useconds;
|
||||
select(0, NULL, NULL, NULL, &tv);
|
||||
DWORD msec = seconds * 1000;;
|
||||
Sleep(msec);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -379,8 +496,8 @@ rb_select_win32(long delay)
|
|||
#undef strerror
|
||||
#endif
|
||||
|
||||
const char *
|
||||
wsock_strerror(int error)
|
||||
static const char *
|
||||
_rb_strerror(int error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
|
@ -488,6 +605,14 @@ wsock_strerror(int error)
|
|||
return strerror(error);
|
||||
}
|
||||
};
|
||||
|
||||
char *
|
||||
rb_strerror(int error)
|
||||
{
|
||||
static char buf[128];
|
||||
rb_strlcpy(buf, _rb_strerror(error), sizeof(buf));
|
||||
return buf;
|
||||
}
|
||||
#else /* win32 not supported */
|
||||
int
|
||||
rb_init_netio_win32(void)
|
||||
|
@ -516,4 +641,4 @@ rb_setup_fd_win32(rb_fde_t * F)
|
|||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
#endif /* _WIN32 */
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: sslproc.c 25677 2008-07-06 04:21:42Z androsyn $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <ratbox_lib.h>
|
||||
#include "stdinc.h"
|
||||
|
||||
|
||||
#include "s_conf.h"
|
||||
#include "logger.h"
|
||||
#include "listener.h"
|
||||
|
@ -67,34 +69,39 @@ struct _ssl_ctl
|
|||
uint8_t dead;
|
||||
};
|
||||
|
||||
static void send_new_ssl_certs_one(ssl_ctl_t *ctl, const char *ssl_cert, const char *ssl_private_key, const char *ssl_dh_params);
|
||||
static void send_new_ssl_certs_one(ssl_ctl_t * ctl, const char *ssl_cert,
|
||||
const char *ssl_private_key, const char *ssl_dh_params);
|
||||
static void send_init_prng(ssl_ctl_t * ctl, prng_seed_t seedtype, const char *path);
|
||||
|
||||
|
||||
static rb_dlink_list ssl_daemons;
|
||||
|
||||
static inline int32_t buf_to_int32(char *buf)
|
||||
static inline int32_t
|
||||
buf_to_int32(char *buf)
|
||||
{
|
||||
int32_t x;
|
||||
memcpy(&x, buf, sizeof(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline void int32_to_buf(char *buf, int32_t x)
|
||||
static inline void
|
||||
int32_to_buf(char *buf, int32_t x)
|
||||
{
|
||||
memcpy(buf, &x, sizeof(x));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static inline uint16_t buf_to_uint16(char *buf)
|
||||
static inline uint16_t
|
||||
buf_to_uint16(char *buf)
|
||||
{
|
||||
uint16_t x;
|
||||
memcpy(&x, buf, sizeof(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline void uint16_to_buf(char *buf, uint16_t x)
|
||||
static inline void
|
||||
uint16_to_buf(char *buf, uint16_t x)
|
||||
{
|
||||
memcpy(buf, &x, sizeof(x));
|
||||
return;
|
||||
|
@ -170,7 +177,7 @@ ssl_killall(void)
|
|||
continue;
|
||||
ctl->dead = 1;
|
||||
ssld_count--;
|
||||
kill(ctl->pid, SIGKILL);
|
||||
rb_kill(ctl->pid, SIGKILL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +189,7 @@ ssl_dead(ssl_ctl_t *ctl)
|
|||
|
||||
ctl->dead = 1;
|
||||
ssld_count--;
|
||||
kill(ctl->pid, SIGKILL); /* make sure the process is really gone */
|
||||
rb_kill(ctl->pid, SIGKILL); /* make sure the process is really gone */
|
||||
ilog(L_MAIN, "ssld helper died - attempting to restart");
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, "ssld helper died - attempting to restart");
|
||||
start_ssldaemon(1, ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params);
|
||||
|
@ -222,10 +229,17 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
|
|||
{
|
||||
rb_fde_t *F1, *F2;
|
||||
rb_fde_t *P1, *P2;
|
||||
#ifdef _WIN32
|
||||
const char *suffix = ".exe";
|
||||
#else
|
||||
const char *suffix = "";
|
||||
#endif
|
||||
|
||||
char fullpath[PATH_MAX + 1];
|
||||
char fdarg[6];
|
||||
const char *parv[2];
|
||||
char buf[128];
|
||||
char s_pid[10];
|
||||
pid_t pid;
|
||||
int started = 0, i;
|
||||
|
||||
|
@ -235,7 +249,8 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
|
|||
if(ssld_spin_count > 20 && (rb_current_time() - last_spin < 5))
|
||||
{
|
||||
ilog(L_MAIN, "ssld helper is spinning - will attempt to restart in 1 minute");
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, "ssld helper is spinning - will attempt to restart in 1 minute");
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"ssld helper is spinning - will attempt to restart in 1 minute");
|
||||
rb_event_add("restart_ssld_event", restart_ssld_event, NULL, 60);
|
||||
ssld_wait = 1;
|
||||
return 0;
|
||||
|
@ -243,22 +258,25 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
|
|||
|
||||
ssld_spin_count++;
|
||||
last_spin = rb_current_time();
|
||||
|
||||
if(ssld_path == NULL)
|
||||
{
|
||||
rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld", BINPATH);
|
||||
rb_snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", BINPATH, suffix);
|
||||
|
||||
if(access(fullpath, X_OK) == -1)
|
||||
{
|
||||
rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld", ConfigFileEntry.dpath);
|
||||
rb_snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s",
|
||||
ConfigFileEntry.dpath, suffix);
|
||||
if(access(fullpath, X_OK) == -1)
|
||||
{
|
||||
ilog(L_MAIN, "Unable to execute ssld in %s/bin or %s", ConfigFileEntry.dpath, BINPATH);
|
||||
ilog(L_MAIN,
|
||||
"Unable to execute ssld%s in %s/bin or %s",
|
||||
ConfigFileEntry.dpath, suffix, BINPATH);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
ssld_path = rb_strdup(fullpath);
|
||||
}
|
||||
|
||||
rb_strlcpy(buf, "-ircd ssld daemon helper", sizeof(buf));
|
||||
parv[0] = buf;
|
||||
parv[1] = NULL;
|
||||
|
@ -270,10 +288,16 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
|
|||
rb_set_buffers(F1, READBUF_SIZE);
|
||||
rb_set_buffers(F2, READBUF_SIZE);
|
||||
rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(F2));
|
||||
setenv("CTL_FD", fdarg, 1);
|
||||
rb_setenv("CTL_FD", fdarg, 1);
|
||||
rb_pipe(&P1, &P2, "SSL/TLS pipe");
|
||||
rb_snprintf(fdarg, sizeof(fdarg), "%d", rb_get_fd(P1));
|
||||
setenv("CTL_PIPE", fdarg, 1);
|
||||
rb_setenv("CTL_PIPE", fdarg, 1);
|
||||
rb_snprintf(s_pid, sizeof(s_pid), "%d", getpid());
|
||||
rb_setenv("CTL_PPID", s_pid, 1);
|
||||
#ifdef _WIN32
|
||||
SetHandleInformation((HANDLE) rb_get_fd(F2), HANDLE_FLAG_INHERIT, 1);
|
||||
SetHandleInformation((HANDLE) rb_get_fd(P1), HANDLE_FLAG_INHERIT, 1);
|
||||
#endif
|
||||
|
||||
pid = rb_spawn_process(ssld_path, (const char **) parv);
|
||||
if(pid == -1)
|
||||
|
@ -297,9 +321,11 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co
|
|||
send_init_prng(ctl, RB_PRNG_DEFAULT, NULL);
|
||||
}
|
||||
if(ssl_ok && ssl_cert != NULL && ssl_private_key != NULL)
|
||||
send_new_ssl_certs_one(ctl, ssl_cert, ssl_private_key, ssl_dh_params != NULL ? ssl_dh_params : "");
|
||||
send_new_ssl_certs_one(ctl, ssl_cert, ssl_private_key,
|
||||
ssl_dh_params != NULL ? ssl_dh_params : "");
|
||||
ssl_read_ctl(ctl->F, ctl);
|
||||
ssl_do_pipe(P2, ctl);
|
||||
|
||||
}
|
||||
return started;
|
||||
}
|
||||
|
@ -353,7 +379,7 @@ ssl_process_dead_fd(ssl_ctl_t *ctl, ssl_ctl_buf_t *ctl_buf)
|
|||
return;
|
||||
if(IsAnyServer(client_p))
|
||||
{
|
||||
sendto_realops_snomask(SNO_GENERAL, is_remote_connect(client_p) && !IsServer(client_p) ? L_NETWIDE : L_ALL, "ssld error for %s: %s", client_p->name, reason);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, "ssld error for %s: %s", client_p->name, reason);
|
||||
ilog(L_SERVER, "ssld error for %s: %s", log_client_name(client_p, SHOW_IP), reason);
|
||||
}
|
||||
exit_client(client_p, client_p, &me, reason);
|
||||
|
@ -450,13 +476,15 @@ ssl_read_ctl(rb_fde_t *F, void *data)
|
|||
ctl_buf->buf = rb_malloc(READSIZE);
|
||||
retlen = rb_recv_fd_buf(ctl->F, ctl_buf->buf, READSIZE, ctl_buf->F, 4);
|
||||
ctl_buf->buflen = retlen;
|
||||
if(retlen <= 0) {
|
||||
if(retlen <= 0)
|
||||
{
|
||||
rb_free(ctl_buf->buf);
|
||||
rb_free(ctl_buf);
|
||||
}
|
||||
else
|
||||
rb_dlinkAddTail(ctl_buf, &ctl_buf->node, &ctl->readq);
|
||||
} while(retlen > 0);
|
||||
}
|
||||
while(retlen > 0);
|
||||
|
||||
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno)))
|
||||
{
|
||||
|
@ -478,7 +506,8 @@ which_ssld(void)
|
|||
ctl = ptr->data;
|
||||
if(ctl->dead)
|
||||
continue;
|
||||
if(lowest == NULL) {
|
||||
if(lowest == NULL)
|
||||
{
|
||||
lowest = ctl;
|
||||
continue;
|
||||
}
|
||||
|
@ -503,7 +532,7 @@ ssl_write_ctl(rb_fde_t *F, void *data)
|
|||
{
|
||||
ctl_buf = ptr->data;
|
||||
/* in theory unix sock_dgram shouldn't ever short write this.. */
|
||||
retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, ctl_buf->buflen);
|
||||
retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, ctl_buf->buflen, ctl->pid);
|
||||
if(retlen > 0)
|
||||
{
|
||||
rb_dlinkDelete(ptr, &ctl->writeq);
|
||||
|
@ -517,7 +546,9 @@ ssl_write_ctl(rb_fde_t *F, void *data)
|
|||
{
|
||||
ssl_dead(ctl);
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
rb_setselect(ctl->F, RB_SELECT_WRITE, ssl_write_ctl, ctl);
|
||||
}
|
||||
}
|
||||
|
@ -559,11 +590,13 @@ send_new_ssl_certs_one(ssl_ctl_t *ctl, const char *ssl_cert, const char *ssl_pri
|
|||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"Parameters for send_new_ssl_certs_one too long (%zu > %zu) to pass to ssld, not sending...",
|
||||
len, sizeof(tmpbuf));
|
||||
ilog(L_MAIN, "Parameters for send_new_ssl_certs_one too long (%zu > %zu) to pass to ssld, not sending...",
|
||||
ilog(L_MAIN,
|
||||
"Parameters for send_new_ssl_certs_one too long (%zu > %zu) to pass to ssld, not sending...",
|
||||
len, sizeof(tmpbuf));
|
||||
return;
|
||||
}
|
||||
len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c", nul, ssl_cert, nul, ssl_private_key, nul, ssl_dh_params, nul);
|
||||
len = rb_snprintf(tmpbuf, sizeof(tmpbuf), "K%c%s%c%s%c%s%c", nul, ssl_cert, nul,
|
||||
ssl_private_key, nul, ssl_dh_params, nul);
|
||||
ssl_cmd_write_queue(ctl, NULL, 0, tmpbuf, len);
|
||||
}
|
||||
|
||||
|
@ -585,7 +618,8 @@ send_init_prng(ssl_ctl_t *ctl, prng_seed_t seedtype, const char *path)
|
|||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"Parameters for send_init_prng too long (%zd > %zd) to pass to ssld, not sending...",
|
||||
len, sizeof(tmpbuf));
|
||||
ilog(L_MAIN, "Parameters for send_init_prng too long (%zd > %zd) to pass to ssld, not sending...",
|
||||
ilog(L_MAIN,
|
||||
"Parameters for send_init_prng too long (%zd > %zd) to pass to ssld, not sending...",
|
||||
len, sizeof(tmpbuf));
|
||||
return;
|
||||
|
||||
|
@ -693,8 +727,9 @@ start_zlib_session(void *data)
|
|||
|
||||
if(len > READBUF_SIZE)
|
||||
{
|
||||
rb_free(buf);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, "ssld - attempted to pass message of %zd len, max len %d, giving up", len, READBUF_SIZE);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"ssld - attempted to pass message of %zd len, max len %d, giving up",
|
||||
len, READBUF_SIZE);
|
||||
ilog(L_MAIN, "ssld - attempted to pass message of %zd len, max len %d, giving up", len, READBUF_SIZE);
|
||||
exit_client(server, server, server, "ssld readbuf exceeded");
|
||||
return;
|
||||
|
@ -716,8 +751,9 @@ start_zlib_session(void *data)
|
|||
{
|
||||
cpylen = rb_linebuf_get(&server->localClient->buf_recvq, xbuf, left, LINEBUF_PARTIAL, LINEBUF_RAW);
|
||||
left -= cpylen;
|
||||
xbuf += cpylen;
|
||||
} while(cpylen > 0);
|
||||
xbuf = (void *) (((uintptr_t) xbuf) + cpylen);
|
||||
}
|
||||
while(cpylen > 0);
|
||||
|
||||
/* Pass the socket to ssld. */
|
||||
*buf = 'Z';
|
||||
|
@ -786,9 +822,9 @@ get_ssld_count(void)
|
|||
return ssld_count;
|
||||
}
|
||||
|
||||
void init_ssld(void)
|
||||
void
|
||||
init_ssld(void)
|
||||
{
|
||||
rb_event_addish("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME);
|
||||
rb_event_addish("cleanup_dead_ssld", cleanup_dead_ssl, NULL, 1200);
|
||||
}
|
||||
|
||||
|
|
52
ssld/ssld.c
52
ssld/ssld.c
|
@ -18,7 +18,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*
|
||||
* $Id: ssld.c 25677 2008-07-06 04:21:42Z androsyn $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
@ -34,28 +34,33 @@
|
|||
#endif
|
||||
|
||||
static void setup_signals(void);
|
||||
static pid_t ppid;
|
||||
|
||||
static inline int32_t buf_to_int32(char *buf)
|
||||
static inline int32_t
|
||||
buf_to_int32(char *buf)
|
||||
{
|
||||
int32_t x;
|
||||
memcpy(&x, buf, sizeof(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline void int32_to_buf(char *buf, int32_t x)
|
||||
static inline void
|
||||
int32_to_buf(char *buf, int32_t x)
|
||||
{
|
||||
memcpy(buf, &x, sizeof(x));
|
||||
return;
|
||||
}
|
||||
|
||||
static inline uint16_t buf_to_uint16(char *buf)
|
||||
static inline uint16_t
|
||||
buf_to_uint16(char *buf)
|
||||
{
|
||||
uint16_t x;
|
||||
memcpy(&x, buf, sizeof(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline void uint16_to_buf(char *buf, uint16_t x)
|
||||
static inline void
|
||||
uint16_to_buf(char *buf, uint16_t x)
|
||||
{
|
||||
memcpy(buf, &x, sizeof(x));
|
||||
return;
|
||||
|
@ -310,9 +315,7 @@ check_handshake_flood(void *unused)
|
|||
else
|
||||
rb_ssl_clear_handshake_count(conn->mod_fd);
|
||||
}
|
||||
HASH_WALK_END
|
||||
|
||||
}
|
||||
HASH_WALK_END}
|
||||
|
||||
static void
|
||||
conn_mod_write_sendq(rb_fde_t *fd, void *data)
|
||||
|
@ -433,7 +436,7 @@ common_zlib_deflate(conn_t * conn, void *buf, size_t len)
|
|||
static void
|
||||
common_zlib_inflate(conn_t * conn, void *buf, size_t len)
|
||||
{
|
||||
int ret, have;
|
||||
int ret, have = 0;
|
||||
((zlib_stream_t *) conn->stream)->instream.next_in = buf;
|
||||
((zlib_stream_t *) conn->stream)->instream.avail_in = len;
|
||||
((zlib_stream_t *) conn->stream)->instream.next_out = (Bytef *) outbuf;
|
||||
|
@ -562,7 +565,8 @@ conn_mod_read_cb(rb_fde_t * fd, void *data)
|
|||
|
||||
if(length == 0 || (length < 0 && !rb_ignore_errno(errno)))
|
||||
{
|
||||
if(length == 0) {
|
||||
if(length == 0)
|
||||
{
|
||||
close_conn(conn, WAIT_PLAIN, "%s", remote_closed);
|
||||
return;
|
||||
}
|
||||
|
@ -1018,7 +1022,7 @@ mod_write_ctl(rb_fde_t * F, void *data)
|
|||
{
|
||||
ctl_buf = ptr->data;
|
||||
retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf,
|
||||
ctl_buf->buflen);
|
||||
ctl_buf->buflen, ppid);
|
||||
if(retlen > 0)
|
||||
{
|
||||
rb_dlinkDelete(ptr, &ctl->writeq);
|
||||
|
@ -1053,29 +1057,34 @@ read_pipe_ctl(rb_fde_t * F, void *data)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
const char *s_ctlfd, *s_pipe;
|
||||
const char *s_ctlfd, *s_pipe, *s_pid;
|
||||
int ctlfd, pipefd, x, maxfd;
|
||||
maxfd = maxconn();
|
||||
|
||||
s_ctlfd = getenv("CTL_FD");
|
||||
s_pipe = getenv("CTL_PIPE");
|
||||
s_pid = getenv("CTL_PPID");
|
||||
|
||||
if(s_ctlfd == NULL || s_pipe == NULL)
|
||||
if(s_ctlfd == NULL || s_pipe == NULL || s_pid == NULL)
|
||||
{
|
||||
fprintf(stderr, "This is ircd-ratbox ssld. You know you aren't supposed to run me directly?\n");
|
||||
fprintf(stderr, "You get an Id tag for this: $Id: ssld.c 25677 2008-07-06 04:21:42Z androsyn $\n");
|
||||
fprintf(stderr,
|
||||
"This is ircd-ratbox ssld. You know you aren't supposed to run me directly?\n");
|
||||
fprintf(stderr,
|
||||
"You get an Id tag for this: $Id$\n");
|
||||
fprintf(stderr, "Have a nice life\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ctlfd = atoi(s_ctlfd);
|
||||
pipefd = atoi(s_pipe);
|
||||
|
||||
ppid = atoi(s_pid);
|
||||
x = 0;
|
||||
#ifndef _WIN32
|
||||
for(x = 0; x < maxfd; x++)
|
||||
{
|
||||
if(x != ctlfd && x != pipefd && x > 2)
|
||||
close(x);
|
||||
}
|
||||
|
||||
x = open("/dev/null", O_RDWR);
|
||||
if(x >= 0)
|
||||
{
|
||||
|
@ -1088,12 +1097,11 @@ main(int argc, char **argv)
|
|||
if(x > 2)
|
||||
close(x);
|
||||
}
|
||||
|
||||
#endif
|
||||
setup_signals();
|
||||
rb_lib_init(NULL, NULL, NULL, 0, maxfd, 1024, 4096);
|
||||
rb_init_rawbuffers(1024);
|
||||
ssl_ok = rb_supports_ssl();
|
||||
|
||||
mod_ctl = rb_malloc(sizeof(mod_ctl_t));
|
||||
mod_ctl->F = rb_open(ctlfd, RB_FD_SOCKET, "ircd control socket");
|
||||
mod_ctl->F_pipe = rb_open(pipefd, RB_FD_PIPE, "ircd pipe");
|
||||
|
@ -1121,16 +1129,18 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
static void
|
||||
dummy_handler(int sig)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
setup_signals()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
struct sigaction act;
|
||||
|
||||
act.sa_flags = 0;
|
||||
|
@ -1153,5 +1163,5 @@ setup_signals()
|
|||
|
||||
act.sa_handler = dummy_handler;
|
||||
sigaction(SIGALRM, &act, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue