Update libratbox.

This commit is contained in:
Valeriy Yatsko 2008-12-22 12:49:01 +03:00
parent 60b3d9e512
commit f030cae802
22 changed files with 4747 additions and 3486 deletions

View File

@ -1,3 +1,140 @@
androsyn 2008/12/13 03:36:00 UTC (20081213_1-26296)
Log:
fix a gnutls related double free
Modified:
libratbox/trunk/src/gnutls.c (File Modified)
androsyn 2008/12/13 03:01:19 UTC (20081213_0-26294)
Log:
shut up gcc warnings regarding can_do_timerd
Modified:
libratbox/trunk/src/epoll.c (File Modified)
androsyn 2008/12/10 23:28:53 UTC (20081210_10-26286)
Log:
make ports work properly
Modified:
libratbox/trunk/src/ports.c (File Modified)
androsyn 2008/12/10 20:33:21 UTC (20081210_9-26282)
Log:
tweak the ssl info output a bit
Modified:
libratbox/trunk/src/gnutls.c (File Modified)
libratbox/trunk/src/openssl.c (File Modified)
libratbox/trunk/src/ratbox_lib.c (File Modified)
androsyn 2008/12/10 20:25:29 UTC (20081210_8-26280)
Log:
report ssl info in the libratbox version
Modified:
libratbox/trunk/include/commio-ssl.h (File Modified)
libratbox/trunk/src/gnutls.c (File Modified)
libratbox/trunk/src/nossl.c (File Modified)
libratbox/trunk/src/openssl.c (File Modified)
libratbox/trunk/src/ratbox_lib.c (File Modified)
androsyn 2008/12/10 06:45:54 UTC (20081210_7-26276)
Log:
these rb_set_time calls aren't needed i don't think
Modified:
libratbox/trunk/src/epoll.c (File Modified)
androsyn 2008/12/10 06:24:47 UTC (20081210_6-26274)
Log:
fix signalfd stuff for ultrasparc linux....
Modified:
libratbox/trunk/src/epoll.c (File Modified)
androsyn 2008/12/10 05:55:10 UTC (20081210_5-26272)
Log:
fix some epoll related timer stuff
Modified:
libratbox/trunk/include/event-int.h (File Modified)
libratbox/trunk/src/epoll.c (File Modified)
libratbox/trunk/src/event.c (File Modified)
androsyn 2008/12/10 04:08:39 UTC (20081210_4-26260)
Log:
Rebuild configure and friends with autoconf 2.63
Modified:
libratbox/trunk/Makefile.in (File Modified)
libratbox/trunk/aclocal.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)
androsyn 2008/12/10 04:06:12 UTC (20081210_3-26258)
Log:
add a missing part of the ports timer commit
Modified:
libratbox/trunk/include/commio-int.h (File Modified)
androsyn 2008/12/10 04:05:26 UTC (20081210_2-26256)
Log:
remove a duplicate prototype
Modified:
libratbox/trunk/include/ratbox_lib.h (File Modified)
androsyn 2008/12/10 04:04:38 UTC (20081210_1-26254)
Log:
fix ports and devpoll and add timer support to ports
Modified:
libratbox/trunk/src/commio.c (File Modified)
libratbox/trunk/src/devpoll.c (File Modified)
libratbox/trunk/src/ports.c (File Modified)
androsyn 2008/12/10 04:03:09 UTC (20081210_0-26252)
Log:
change SSL_CTX_use_certificate_file to SSL_CTX_use_certificate_chain_file
Modified:
libratbox/trunk/src/openssl.c (File Modified)
androsyn 2008/11/23 17:13:19 UTC (20081123_1-26240)
Log:
revert that last change
Modified:
libratbox/trunk/src/epoll.c (File Modified)
androsyn 2008/11/23 17:04:29 UTC (20081123_0-26238)
Log:
ifdef can_do_timerfd to avoid a compile time warning
Modified:
libratbox/trunk/src/epoll.c (File Modified)
androsyn 2008/11/11 00:00:12 UTC (20081111_0-26180)
Log:
fix build errors on os x leopard

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -13,7 +13,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -34,8 +33,7 @@ build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/libratbox.pc.in \
$(top_srcdir)/configure \
$(srcdir)/Makefile.in $(top_srcdir)/configure \
$(top_srcdir)/include/libratbox_config.h.in COPYING ChangeLog \
INSTALL TODO config.guess config.sub depcomp install-sh \
ltmain.sh missing
@ -48,7 +46,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/libratbox_config.h
CONFIG_CLEAN_FILES = libratbox.pc
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@ -58,15 +56,6 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
pkgconfigDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
@ -206,12 +195,11 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libratbox.pc
all: all-recursive
.SUFFIXES:
@ -265,8 +253,6 @@ $(top_srcdir)/include/libratbox_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__config
distclean-hdr:
-rm -f include/libratbox_config.h include/stamp-h1
libratbox.pc: $(top_builddir)/config.status $(srcdir)/libratbox.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
@ -275,24 +261,7 @@ clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
$(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@ -369,7 +338,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
@ -574,12 +543,9 @@ distcleancheck: distclean
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA)
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
@ -624,7 +590,7 @@ info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-data-am:
install-dvi: install-dvi-recursive
@ -660,7 +626,7 @@ ps: ps-recursive
ps-am:
uninstall-am: uninstall-pkgconfigDATA
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
@ -675,12 +641,11 @@ uninstall-am: uninstall-pkgconfigDATA
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-pkgconfigDATA
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am
# 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.

37
libratbox/aclocal.m4 vendored
View File

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
# generated automatically by aclocal 1.10.2 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(AC_AUTOCONF_VERSION, [2.61],,
[m4_warning([this file was generated for autoconf 2.61.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
[m4_warning([this file was generated for autoconf 2.63.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
@ -6829,7 +6829,7 @@ else
fi[]dnl
])# PKG_CHECK_MODULES
# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -6844,7 +6844,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10.1], [],
m4_if([$1], [1.10.2], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -6858,12 +6858,12 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.10.1])dnl
[AM_AUTOMAKE_VERSION([1.10.2])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
@ -7113,19 +7113,28 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
#serial 4
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
[# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
shift
for mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
@ -7498,13 +7507,13 @@ esac
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# serial 4
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@ -7521,7 +7530,7 @@ AC_DEFUN([_AM_SET_OPTION],
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------

7567
libratbox/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
dnl $Id: configure.ac 26168 2008-10-26 20:58:40Z androsyn $
dnl $Id: configure.ac 26260 2008-12-10 04:08:39Z 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.61)
AC_PREREQ(2.63)
AUTOMAKE_OPTIONS = 1.10
dnl Sneaky way to get an Id tag into the configure script
AC_COPYRIGHT([$Id: configure.ac 26168 2008-10-26 20:58:40Z androsyn $])
AC_COPYRIGHT([$Id: configure.ac 26260 2008-12-10 04:08:39Z androsyn $])
AC_INIT([libratbox],[devel])
AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, -)
@ -75,8 +75,8 @@ case "$host_os" in
*interix*)
CPPFLAGS="$CFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500"
;;
*solaris*|*sunos*)
CPPFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2 -D__EXTENSIONS__"
*solaris*)
CPPFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2"
;;
*)
;;
@ -126,13 +126,13 @@ member.])],,[[
#endif
]])
AC_CHECK_TYPE([socklen_t], rb_socklen_t=socklen_t,[
AC_CHECK_TYPE([socklen_t], rb_cv_socklen_t=socklen_t,[
AC_MSG_CHECKING([for socklen_t equivalent])
AC_CACHE_VAL([rb_socklen_t],
AC_CACHE_VAL([rb_cv_socklen_t],
[
# Systems have either "struct sockaddr *" or
# "void *" as the second argument to getpeername
rb_socklen_t=
rb_cv_socklen_t=
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
@ -150,21 +150,23 @@ int getpeername (int, $arg2 *, $t *);
$t len;
getpeername(0,0,&len);
],[
rb_socklen_t="$t"
rb_cv_socklen_t="$t"
break
])
done
done
if test "x$rb_socklen_t" = x; then
if test "x$rb_cv_socklen_t" = x; then
AC_MSG_WARN([Cannot find a type to use in place of socklen_t using int])
rb_socklen_t=int
rb_cv_socklen_t=int
fi
])
AC_MSG_RESULT($rb_socklen_t)],
AC_MSG_RESULT($rb_cv_socklen_t)],
[#include <sys/types.h>
#include <sys/socket.h>])
rb_socklen_t=$rb_cv_socklen_t
@ -659,7 +661,7 @@ fi
AC_CONFIG_FILES( \
src/Makefile \
Makefile \
libratbox.pc \
libratbox.pc
)
AC_OUTPUT

View File

@ -24,6 +24,8 @@
* $Id: commio.h 24059 2007-07-24 17:25:41Z androsyn $
*/
#ifndef _COMMIO_INT_H
#define _COMMIO_INT_H 1
#define RB_FD_HASH_BITS 12
#define RB_FD_HASH_SIZE (1UL << RB_FD_HASH_BITS)
@ -208,6 +210,12 @@ int rb_init_netio_ports(void);
int rb_select_ports(long);
int rb_setup_fd_ports(rb_fde_t *F);
void rb_ports_init_event(void);
int rb_ports_sched_event(struct ev_entry *event, int when);
void rb_ports_unsched_event(struct ev_entry *event);
int rb_ports_supports_event(void);
/* kqueue versions */
void rb_setselect_kqueue(rb_fde_t *F, unsigned int type, PF * handler, void *client_data);
int rb_init_netio_kqueue(void);
@ -231,3 +239,5 @@ 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);
#endif

View File

@ -1,3 +1,30 @@
/*
* ircd-ratbox: A slightly useful ircd.
* commio-ssl.h: A header for the ssl code
*
* Copyright (C) 2008 ircd-ratbox development team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: commio-ssl.h 26280 2008-12-10 20:25:29Z androsyn $
*/
#ifndef _COMMIO_SSL_H
#define _COMMIO_SSL_H
int rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile);
int rb_init_ssl(void);
@ -14,3 +41,6 @@ void rb_ssl_accept_setup(rb_fde_t *F, rb_fde_t *new_F, struct sockaddr *st, int
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);
void rb_get_ssl_info(char *buf, size_t length);
#endif

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: event-int.h 25992 2008-09-03 00:20:22Z androsyn $
* $Id: event-int.h 26272 2008-12-10 05:55:10Z androsyn $
*/
struct ev_entry
@ -31,6 +31,7 @@ struct ev_entry
char *name;
time_t frequency;
time_t when;
time_t next;
void *data;
void *comm_ptr;
};

View File

@ -269,6 +269,28 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...) */
#undef USE_TIMERFD_CREATE
@ -278,10 +300,15 @@
/* This is a Windows system */
#undef WINDOWS
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const

View File

@ -1,5 +1,5 @@
/*
* $Id: ratbox_lib.h 26052 2008-09-09 16:47:03Z androsyn $
* $Id: ratbox_lib.h 26256 2008-12-10 04:05:26Z androsyn $
*/
#ifndef RB_LIB_H
@ -206,6 +206,7 @@ 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>
#include <rb_commio.h>

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@ -203,6 +203,7 @@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
@ -248,8 +249,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@ -368,7 +369,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS

View File

@ -93,6 +93,9 @@ arc4_stir(struct arc4_stream *as)
struct timeval tv;
pid_t pid;
int n;
#ifdef _WIN32
HMODULE lib;
#endif
/* XXX this doesn't support egd sources or similiar */
pid = getpid();
@ -133,7 +136,7 @@ arc4_stir(struct arc4_stream *as)
{
arc4_addrandom(as, (void *)&performanceCount, sizeof(performanceCount));
}
HMODULE lib = LoadLibrary("ADVAPI32.DLL");
lib = LoadLibrary("ADVAPI32.DLL");
if(lib)
{
uint8_t rnd[128];

View File

@ -21,7 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: commio.c 26096 2008-09-20 01:05:42Z androsyn $
* $Id: commio.c 26254 2008-12-10 04:04:38Z androsyn $
*/
#include <libratbox_config.h>
#include <ratbox_lib.h>
@ -1610,6 +1610,12 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
unsigned int fd[2];
int i, got;
unsigned short port;
struct timeval wait = { 0, 100000 };
int max;
fd_set rset;
struct sockaddr_in readfrom;
unsigned short buf[2];
int o_errno;
memset(&addr, 0, sizeof(addr));
@ -1648,11 +1654,7 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
}
}
struct timeval wait = { 0, 100000 };
int max = fd[1] > fd[0] ? fd[1] : fd[0];
fd_set rset;
max = fd[1] > fd[0] ? fd[1] : fd[0];
FD_ZERO(&rset);
FD_SET(fd[0], &rset);
FD_SET(fd[1], &rset);
@ -1664,8 +1666,6 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
goto abort_failed;
}
struct sockaddr_in readfrom;
unsigned short buf[2];
for(i = 0; i < 2; i++)
{
#ifdef MSG_DONTWAIT
@ -1700,7 +1700,7 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2)
failed:
if(errno != ECONNABORTED)
rb_get_errno();
int o_errno = errno;
o_errno = errno;
if(F[0] != NULL)
rb_close(F[0]);
if(F[1] != NULL)
@ -1862,10 +1862,10 @@ try_ports(void)
setselect_handler = rb_setselect_ports;
select_handler = rb_select_ports;
setup_fd_handler = rb_setup_fd_ports;
io_sched_event = NULL;
io_unsched_event = NULL;
io_init_event = NULL;
io_supports_event = rb_unsupported_event;
io_sched_event = rb_ports_sched_event;
io_unsched_event = rb_ports_unsched_event;
io_init_event = rb_ports_init_event;
io_supports_event = rb_ports_supports_event;
rb_strlcpy(iotype, "ports", sizeof(iotype));
return 0;
}

View File

@ -22,22 +22,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: devpoll.c 26092 2008-09-19 15:13:52Z androsyn $
* $Id: devpoll.c 26254 2008-12-10 04:04:38Z androsyn $
*/
#include <libratbox_config.h>
#include <ratbox_lib.h>
#include <commio-int.h>
#include <fcntl.h>
#if defined(HAVE_DEVPOLL) && (HAVE_DEVPOLL_H)
#if defined(HAVE_DEVPOLL) && (HAVE_SYS_DEVPOLL_H)
#include <sys/devpoll.h>
static void devpoll_update_events(int, short, PF *);
static int dpfd;
static int maxfd;
static short *fdmask;
static void devpoll_update_events(int, short, PF *);
static void devpoll_update_events(rb_fde_t *, short, PF *);
static void devpoll_write_update(int, int);
@ -74,12 +72,12 @@ devpoll_write_update(int fd, int events)
}
static void
devpoll_update_events(int fd, short filter, PF * handler)
devpoll_update_events(rb_fde_t *F, short filter, PF * handler)
{
int update_required = 0;
int fd = rb_get_fd(F);
int cur_mask = fdmask[fd];
PF *cur_handler;
fdmask[fd] = 0;
switch (filter)
{
@ -154,6 +152,7 @@ rb_init_netio_devpoll(void)
maxfd = getdtablesize() - 2; /* This makes more sense than HARD_FDLIMIT */
fdmask = rb_malloc(sizeof(fdmask) * maxfd + 1);
rb_open(dpfd, RB_FD_UNKNOWN, "/dev/poll file descriptor");
return 0;
}
/*
@ -169,13 +168,13 @@ rb_setselect_devpoll(rb_fde_t *F, unsigned int type, PF * handler, void *client_
if(type & RB_SELECT_READ)
{
devpoll_update_events(fd, RB_SELECT_READ, handler);
devpoll_update_events(F, RB_SELECT_READ, handler);
F->read_handler = handler;
F->read_data = client_data;
}
if(type & RB_SELECT_WRITE)
{
devpoll_update_events(fd, RB_SELECT_WRITE, handler);
devpoll_update_events(F, RB_SELECT_WRITE, handler);
F->write_handler = handler;
F->write_data = client_data;
}
@ -242,7 +241,7 @@ 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(F, RB_SELECT_READ, F->read_handler);
}
}
@ -257,7 +256,7 @@ rb_select_devpoll(long delay)
F->write_handler = NULL;
hdl(F, F->write_data);
/* See above similar code in the read case */
devpoll_update_events(fd,
devpoll_update_events(F,
RB_SELECT_WRITE, F->write_handler);
}

View File

@ -23,7 +23,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: epoll.c 26092 2008-09-19 15:13:52Z androsyn $
* $Id: epoll.c 26294 2008-12-13 03:01:19Z androsyn $
*/
#define _GNU_SOURCE 1
@ -69,6 +69,7 @@ int
rb_init_netio_epoll(void)
{
can_do_event = 0; /* shut up gcc */
can_do_timerfd = 0;
ep_info = rb_malloc(sizeof(struct epoll_info));
ep_info->pfd_size = getdtablesize();
ep_info->ep = epoll_create(ep_info->pfd_size);
@ -267,7 +268,7 @@ rb_epoll_supports_event(void)
close(fd);
can_do_event = 1;
can_do_timerfd = 1;
return 0;
return 1;
}
#endif
@ -333,6 +334,7 @@ signalfd_handler(rb_fde_t *F, void *data)
while(1)
{
ret = readv(rb_get_fd(F), iov, SIGFDIOV_COUNT);
if(ret == 0 || (ret < 0 && !rb_ignore_errno(errno)))
{
rb_close(F);
@ -347,7 +349,13 @@ signalfd_handler(rb_fde_t *F, void *data)
}
for(x = 0; x < ret / (int)sizeof(struct our_signalfd_siginfo); x++)
{
ev = (struct ev_entry *)((uintptr_t)fdsig[x].svptr);
#if __WORDSIZE == 32 && defined(__sparc__)
uint32_t *q = (uint32_t *)&fdsig[x].svptr;
ev = (struct ev_entry *)q[0];
#else
ev = (struct ev_entry *)(uintptr_t)(fdsig[x].svptr);
#endif
if(ev == NULL)
continue;
rb_run_event(ev);
@ -430,6 +438,7 @@ rb_read_timerfd(rb_fde_t *F, void *data)
}
retlen = rb_read(F, &count, sizeof(count));
if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno)))
{
rb_close(F);

View File

@ -39,7 +39,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: event.c 26092 2008-09-19 15:13:52Z androsyn $
* $Id: event.c 26272 2008-12-10 05:55:10Z androsyn $
*/
#include <libratbox_config.h>
@ -94,6 +94,7 @@ rb_event_add(const char *name, EVH * func, void *arg, time_t when)
ev->name = rb_strndup(name, EV_NAME_LEN);
ev->arg = arg;
ev->when = rb_current_time() + when;
ev->next = when;
ev->frequency = when;
if((ev->when < event_time_min) || (event_time_min == -1))
@ -114,6 +115,7 @@ rb_event_addonce(const char *name, EVH * func, void *arg, time_t when)
ev->name = rb_strndup(name, EV_NAME_LEN);
ev->arg = arg;
ev->when = rb_current_time() + when;
ev->next = when;
ev->frequency = 0;
if((ev->when < event_time_min) || (event_time_min == -1))
@ -250,15 +252,14 @@ rb_event_io_register_all(void)
{
rb_dlink_node *ptr;
struct ev_entry *ev;
int when;
if(!rb_io_supports_event())
return;
RB_DLINK_FOREACH(ptr, event_list.head)
{
ev = ptr->data;
when = ev->when - rb_current_time();
rb_io_sched_event(ev, when);
rb_io_sched_event(ev, ev->next);
}
}

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: gnutls.c 26092 2008-09-19 15:13:52Z androsyn $
* $Id: gnutls.c 26296 2008-12-13 03:36:00Z androsyn $
*/
#include <libratbox_config.h>
@ -108,27 +108,21 @@ rb_ssl_tryaccept(rb_fde_t *F, void *data)
ret = do_ssl_handshake(F, rb_ssl_tryaccept);
switch (ret)
{
case -1:
F->accept->callback(F, RB_ERROR_SSL, NULL, 0, F->accept->data);
break;
case 0:
/* do_ssl_handshake does the rb_setselect stuff */
/* do_ssl_handshake does the rb_setselect */
if(ret == 0)
return;
default:
break;
}
rb_settimeout(F, 0, NULL, NULL);
rb_setselect(F, RB_SELECT_READ | RB_SELECT_WRITE, NULL, NULL);
ad = F->accept;
F->accept = NULL;
ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
rb_free(ad);
rb_settimeout(F, 0, NULL, NULL);
rb_setselect(F, RB_SELECT_READ | RB_SELECT_WRITE, NULL, NULL);
if(ret > 0)
ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
else
ad->callback(F, RB_ERROR_SSL, NULL, 0, ad->data);
rb_free(ad);
}
void
@ -508,4 +502,12 @@ rb_supports_ssl(void)
return 1;
}
void
rb_get_ssl_info(char *buf, size_t len)
{
rb_snprintf(buf, len, "GNUTLS: compiled (%s), library(%s)",
LIBGNUTLS_VERSION, gnutls_check_version(NULL));
}
#endif /* HAVE_GNUTLS */

View File

@ -163,4 +163,10 @@ rb_ssl_clear_handshake_count(rb_fde_t *F)
return;
}
void
rb_get_ssl_info(char *buf, size_t len)
{
rb_snprintf(buf, len, "Not compiled with SSL support");
}
#endif /* !HAVE_OPENSSL */

View File

@ -321,7 +321,7 @@ rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile)
rb_lib_log("rb_setup_ssl_server: No certificate file");
return 0;
}
if(!SSL_CTX_use_certificate_file(ssl_server_ctx, cert, SSL_FILETYPE_PEM))
if(!SSL_CTX_use_certificate_chain_file(ssl_server_ctx, cert))
{
err = ERR_get_error();
rb_lib_log("rb_setup_ssl_server: Error loading certificate file [%s]: %s", cert,
@ -611,4 +611,12 @@ rb_supports_ssl(void)
return 1;
}
void
rb_get_ssl_info(char *buf, size_t len)
{
rb_snprintf(buf, len, "Using SSL: %s compiled: 0x%lx, library 0x%lx",
SSLeay_version(SSLEAY_VERSION), OPENSSL_VERSION_NUMBER, SSLeay());
}
#endif /* HAVE_OPESSL */

View File

@ -5,7 +5,7 @@
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
* Copyright (C) 1996-2002 Hybrid Development Team
* Copyright (C) 2001 Adrian Chadd <adrian@creative.net.au>
* Copyright (C) 2002-2004 ircd-ratbox development team
* Copyright (C) 2002-2004,2008 ircd-ratbox development team
* Copyright (C) 2005 Edward Brocklesby.
*
* This program is free software; you can redistribute it and/or modify
@ -23,21 +23,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: ports.c 26092 2008-09-19 15:13:52Z androsyn $
* $Id: ports.c 26286 2008-12-10 23:28:53Z androsyn $
*/
#include <libratbox_config.h>
#include <ratbox_lib.h>
#include <commio-int.h>
#include <event-int.h>
#if defined(HAVE_PORT_H) && (HAVE_PORT_CREATE)
#include <port.h>
#define PE_LENGTH 128
static void pe_update_events(rb_fde_t *, short, PF *);
static int pe;
static struct timespec zero_timespec;
@ -45,38 +43,18 @@ static port_event_t *pelst; /* port buffer */
static int pemax; /* max structs to buffer */
int
rb_setup_fd_ports(int fd)
rb_setup_fd_ports(rb_fde_t *F)
{
return 0;
}
static void
pe_update_events(rb_fde_t *F, short filter, PF * handler)
{
PF *cur_handler = NULL;
if(filter == POLLRDNORM)
cur_handler = F->read_handler;
else if(filter == POLLWRNORM)
cur_handler = F->write_handler;
if(!cur_handler && handler)
port_associate(pe, PORT_SOURCE_FD, F->fd, filter, F);
else if(cur_handler && !handler)
port_dissociate(pe, PORT_SOURCE_FD, F->fd);
}
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
/* Public functions */
/*
* rb_init_netio
*
* This is a needed exported function which will be called to initialise
* the network loop code.
*/
int
rb_init_netio_ports(void)
{
@ -88,6 +66,8 @@ rb_init_netio_ports(void)
pelst = rb_malloc(sizeof(port_event_t) * pemax);
zero_timespec.tv_sec = 0;
zero_timespec.tv_nsec = 0;
rb_set_time();
return 0;
}
/*
@ -100,20 +80,35 @@ void
rb_setselect_ports(rb_fde_t *F, unsigned int type, PF * handler, void *client_data)
{
lrb_assert(IsFDOpen(F));
int old_flags = F->pflags;
/* Update the list, even though we're not using it .. */
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)
{
pe_update_events(F, POLLWRNORM, handler);
F->write_handler = handler;
F->write_data = client_data;
}
F->pflags = 0;
if(F->read_handler != NULL)
F->pflags = POLLIN;
if(F->write_handler != NULL)
F->pflags |= POLLOUT;
if(old_flags == 0 && F->pflags == 0)
return;
else if(F->pflags <= 0)
{
port_dissociate(pe, PORT_SOURCE_FD, F->fd);
return;
}
port_associate(pe, PORT_SOURCE_FD, F->fd, F->pflags, F);
}
/*
@ -129,14 +124,20 @@ int
rb_select_ports(long delay)
{
int i, fd;
uint nget = 1;
int nget = 1;
struct timespec poll_time;
struct timer_data *tdata;
struct timespec *p = NULL;
struct ev_entry *ev;
poll_time.tv_sec = delay / 1000;
poll_time.tv_nsec = (delay % 1000) * 1000000;
if(delay >= 0)
{
poll_time.tv_sec = delay / 1000;
poll_time.tv_nsec = (delay % 1000) * 1000000;
p = &poll_time;
}
i = port_getn(pe, pelst, pemax, &nget, &poll_time);
i = port_getn(pe, pelst, pemax, &nget, p);
rb_set_time();
if(i == -1)
@ -144,30 +145,116 @@ rb_select_ports(long delay)
for(i = 0; i < nget; i++)
{
switch (pelst[i].portev_source)
if(pelst[i].portev_source == PORT_SOURCE_FD)
{
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))
rb_fde_t *F = pelst[i].portev_user;
if((pelst[i].portev_events & (POLLIN | POLLHUP | POLLERR)) && (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 & (POLLOUT | POLLHUP | POLLERR)) && (hdl = F->write_handler))
{
F->write_handler = NULL;
hdl(F, F->write_data);
}
break;
} else if(pelst[i].portev_source == PORT_SOURCE_TIMER)
{
ev = (struct ev_entry *)pelst[i].portev_user;
rb_run_event(ev);
}
}
return RB_OK;
}
int
rb_ports_supports_event(void)
{
return 1;
};
void
rb_ports_init_event(void)
{
return;
}
int
rb_ports_sched_event(struct ev_entry *event, int when)
{
timer_t *id;
struct sigevent ev;
port_notify_t not;
struct itimerspec ts;
event->comm_ptr = rb_malloc(sizeof(timer_t));
id = event->comm_ptr;
memset(&ev, 0, sizeof(ev));
ev.sigev_notify = SIGEV_PORT;
ev.sigev_value.sival_ptr = &not;
memset(&not, 0, sizeof(not));
not.portnfy_port = pe;
not.portnfy_user = event;
if(timer_create(CLOCK_REALTIME, &ev, id) < 0)
{
rb_lib_log("timer_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(timer_settime(*id, 0, &ts, NULL) < 0)
{
rb_lib_log("timer_settime: %s\n", strerror(errno));
return 0;
}
return 1;
}
void
rb_ports_unsched_event(struct ev_entry *event)
{
timer_delete(*((timer_t *) event->comm_ptr));
rb_free(event->comm_ptr);
event->comm_ptr = NULL;
}
#else /* ports not supported */
int
rb_ports_supports_event(void)
{
errno = ENOSYS;
return 0;
}
void
rb_ports_init_event(void)
{
return;
}
int
rb_ports_sched_event(struct ev_entry *event, int when)
{
errno = ENOSYS;
return -1;
}
void
rb_ports_unsched_event(struct ev_entry *event)
{
return;
}
int
rb_init_netio_ports(void)
{

View File

@ -20,12 +20,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* $Id: ratbox_lib.c 26092 2008-09-19 15:13:52Z androsyn $
* $Id: ratbox_lib.c 26282 2008-12-10 20:33:21Z androsyn $
*/
#include <libratbox_config.h>
#include <ratbox_lib.h>
#include <commio-int.h>
#include <commio-ssl.h>
static log_cb *rb_log;
static restart_cb *rb_restart;
@ -187,7 +188,11 @@ extern const char *libratbox_serno;
const char *
rb_lib_version(void)
{
return libratbox_serno;
static char version_info[512];
char ssl_info[512];
rb_get_ssl_info(ssl_info, sizeof(ssl_info));
rb_snprintf(version_info, sizeof(version_info), "libratbox version: %s - %s", libratbox_serno, ssl_info);
return version_info;
}
void

View File

@ -155,8 +155,9 @@ int
rb_kill(int pid, int sig)
{
HANDLE hProcess;
hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid);
int ret = -1;
hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid);
if(hProcess)
{
switch (sig)