Mercurial > ~mikael > mcabber > hg
changeset 1598:a087125d8fc8
Replace libjabber with loudmouth
author | franky |
---|---|
date | Sun, 11 Oct 2009 15:38:32 +0200 |
parents | 4f59a414217e |
children | dcd5d4c75199 |
files | mcabber/Makefile.am mcabber/configure.ac mcabber/connwrap/Makefile.am mcabber/connwrap/aclocal.m4 mcabber/connwrap/configure mcabber/connwrap/configure.in mcabber/connwrap/connwrap.c mcabber/connwrap/connwrap.h mcabber/connwrap/connwrap.spec mcabber/connwrap/md5.c mcabber/connwrap/md5.h mcabber/libjabber/Makefile.am mcabber/libjabber/aclocal.m4 mcabber/libjabber/asciitab.h mcabber/libjabber/config.h.in mcabber/libjabber/configure mcabber/libjabber/configure.in mcabber/libjabber/expat.c mcabber/libjabber/genhash.c mcabber/libjabber/hashtable.c mcabber/libjabber/hashtable.h mcabber/libjabber/iasciitab.h mcabber/libjabber/jabber.h mcabber/libjabber/jconn.c mcabber/libjabber/jid.c mcabber/libjabber/jpacket.c mcabber/libjabber/jutil.c mcabber/libjabber/latin1tab.h mcabber/libjabber/libxode.h mcabber/libjabber/log.c mcabber/libjabber/log.h mcabber/libjabber/nametab.h mcabber/libjabber/pool.c mcabber/libjabber/pproxy.c mcabber/libjabber/rate.c mcabber/libjabber/sha.c mcabber/libjabber/snprintf.c mcabber/libjabber/socket.c mcabber/libjabber/str.c mcabber/libjabber/utf8tab.h mcabber/libjabber/xmldef.h mcabber/libjabber/xmlnode.c mcabber/libjabber/xmlparse.c mcabber/libjabber/xmlparse.h mcabber/libjabber/xmlrole.c mcabber/libjabber/xmlrole.h mcabber/libjabber/xmltok.c mcabber/libjabber/xmltok.h mcabber/libjabber/xmltok_impl.h mcabber/libjabber/xmltok_impl_c.h mcabber/libjabber/xmltok_ns_c.h mcabber/libjabber/xstream.c mcabber/mcabberrc.example mcabber/src/Makefile.am mcabber/src/commands.c mcabber/src/commands.h mcabber/src/events.c mcabber/src/events.h mcabber/src/fifo.c mcabber/src/histolog.c mcabber/src/histolog.h mcabber/src/hooks.c mcabber/src/hooks.h mcabber/src/jab_iq.c mcabber/src/jab_priv.h mcabber/src/jabglue.c mcabber/src/jabglue.h mcabber/src/main.c mcabber/src/otr.c mcabber/src/pgp.c mcabber/src/screen.c mcabber/src/screen.h mcabber/src/settings.c mcabber/src/settings.h mcabber/src/utils.c mcabber/src/utils.h mcabber/src/xmpp.c mcabber/src/xmpp.h mcabber/src/xmpp_defines.h mcabber/src/xmpp_helper.c mcabber/src/xmpp_helper.h mcabber/src/xmpp_iq.c mcabber/src/xmpp_iqrequest.c mcabber/src/xmpp_muc.c mcabber/src/xmpp_s10n.c |
diffstat | 85 files changed, 5141 insertions(+), 27389 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/Makefile.am Thu Oct 08 19:40:23 2009 +0200 +++ b/mcabber/Makefile.am Sun Oct 11 15:38:32 2009 +0200 @@ -1,2 +1,2 @@ -SUBDIRS = connwrap libjabber src doc +SUBDIRS = src doc ACLOCAL_AMFLAGS = -I macros
--- a/mcabber/configure.ac Thu Oct 08 19:40:23 2009 +0200 +++ b/mcabber/configure.ac Sun Oct 11 15:38:32 2009 +0200 @@ -138,6 +138,12 @@ [g_list_append])], [g_regex_new]) +dnl AC_CHECK_LIB([loudmouth1],[lm_session_is_open],,AC_MSG_ERROR([ERROR! loudmouth1 not found...])) +LOUDMOUTH_CFLAGS=`pkg-config --cflags loudmouth-1.0` +LOUDMOUTH_LIBS=`pkg-config --libs loudmouth-1.0` +AC_SUBST(LOUDMOUTH_CFLAGS) +AC_SUBST(LOUDMOUTH_LIBS) + # Check for gpgme AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--disable-gpgme], [disable GPGME support]), [ if test x"$enableval" = x"no"; then @@ -162,48 +168,6 @@ ) fi -AC_ARG_WITH(ssl, [ --with-ssl enable SSL secured connections using either OpenSSL - or GnuTLS], - [with_ssl=$withval]) - -if test "$with_ssl" != "no"; then - AC_ARG_WITH(openssl, - [ --with-openssl=[DIR] enable SSL secured connections using the OpenSSL - library in DIR (optional)], - [with_openssl=$withval]) - - if test -z "$with_openssl"; then - for ac_dir in /usr/local /usr; do - if test -f "$ac_dir/include/openssl/ssl.h"; then - with_openssl=$ac_dir - break; - fi - done - fi - - AC_MSG_CHECKING(for OpenSSL) - - if test -n "$with_openssl" -a "$with_openssl" != "no"; then - if test "$with_openssl" = "yes"; then with_openssl="/usr"; fi - CFLAGS="$CFLAGS -I${with_openssl}" - AC_DEFINE([HAVE_OPENSSL], [], [OpenSSL]) - AC_MSG_RESULT([found in $with_openssl]) - AC_CHECK_LIB(crypto, main) - AC_CHECK_LIB(ssl, main) - else - AC_MSG_RESULT([not found or disabled]) - - PKG_PROG_PKG_CONFIG - PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.0.0], - have_gnutls=yes, have_gnutls=no) - if test "$have_gnutls" = "yes"; then - AC_DEFINE([HAVE_GNUTLS], 1, [GNU TLS]) - CXXFLAGS="$CXXFLAGS $LIBGNUTLS_CFLAGS" - LIBS="$LIBS $LIBGNUTLS_LIBS" - fi - fi -fi - # Check for Enchant stuff AC_ARG_ENABLE(enchant, [ --enable-enchant enable enchant support], enable_enchant=$enableval, enchant="") @@ -270,9 +234,7 @@ # We need _GNU_SOURCE for strptime() and strcasestr() CFLAGS="$CFLAGS -D_GNU_SOURCE" -AC_CONFIG_FILES([connwrap/Makefile - libjabber/Makefile - src/Makefile +AC_CONFIG_FILES([src/Makefile doc/Makefile doc/guide/Makefile doc/help/Makefile
--- a/mcabber/connwrap/Makefile.am Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXTRA_DIST = connwrap.c md5.c connwrap.h md5.h connwrap.spec -SUBDIRS = -INCLUDES = -CPPFLAGS = -noinst_LIBRARIES = libconnwrap.a -libconnwrap_a_SOURCES = connwrap.c md5.c -AUTOMAKE_OPTIONS = foreign
--- a/mcabber/connwrap/aclocal.m4 Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p6 - -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# Copyright 2002 Free Software Foundation, Inc. - -# 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, 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., 59 Temple Place - Suite 330, Boston, MA - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.4-p6])]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN([AM_MISSING_PROG], -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - -dnl Autoconf macros for libgnutls-extra -dnl $id$ - -# Modified for LIBGNUTLS_EXTRA -- nmav -# Configure paths for LIBGCRYPT -# Shamelessly stolen from the one of XDELTA by Owen Taylor -# Werner Koch 99-12-09 - -dnl AM_PATH_LIBGNUTLS_EXTRA([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) -dnl Test for libgnutls-extra, and define LIBGNUTLS_EXTRA_CFLAGS and LIBGNUTLS_EXTRA_LIBS -dnl -AC_DEFUN(AM_PATH_LIBGNUTLS_EXTRA, -[dnl -dnl Get the cflags and libraries from the libgnutls-extra-config script -dnl -AC_ARG_WITH(libgnutls-extra-prefix, - [ --with-libgnutls-extra-prefix=PFX Prefix where libgnutls-extra is installed (optional)], - libgnutls_extra_config_prefix="$withval", libgnutls_extra_config_prefix="") - - if test x$libgnutls_extra_config_prefix != x ; then - libgnutls_extra_config_args="$libgnutls_extra_config_args --prefix=$libgnutls_extra_config_prefix" - if test x${LIBGNUTLS_EXTRA_CONFIG+set} != xset ; then - LIBGNUTLS_EXTRA_CONFIG=$libgnutls_extra_config_prefix/bin/libgnutls-extra-config - fi - fi - - AC_PATH_PROG(LIBGNUTLS_EXTRA_CONFIG, libgnutls-extra-config, no) - min_libgnutls_version=ifelse([$1], ,0.1.0,$1) - AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version) - no_libgnutls="" - if test "$LIBGNUTLS_EXTRA_CONFIG" = "no" ; then - no_libgnutls=yes - else - LIBGNUTLS_EXTRA_CFLAGS=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --cflags` - LIBGNUTLS_EXTRA_LIBS=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --libs` - libgnutls_extra_config_version=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --version` - - - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $LIBGNUTLS_EXTRA_CFLAGS" - LIBS="$LIBS $LIBGNUTLS_EXTRA_LIBS" -dnl -dnl Now check if the installed libgnutls is sufficiently new. Also sanity -dnl checks the results of libgnutls-extra-config to some extent -dnl - rm -f conf.libgnutlstest - AC_TRY_RUN([ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gnutls/extra.h> - -int -main () -{ - system ("touch conf.libgnutlstest"); - - if( strcmp( gnutls_extra_check_version(NULL), "$libgnutls_extra_config_version" ) ) - { - printf("\n*** 'libgnutls-extra-config --version' returned %s, but LIBGNUTLS_EXTRA (%s)\n", - "$libgnutls_extra_config_version", gnutls_extra_check_version(NULL) ); - printf("*** was found! If libgnutls-extra-config was correct, then it is best\n"); - printf("*** to remove the old version of LIBGNUTLS_EXTRA. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If libgnutls-extra-config was wrong, set the environment variable LIBGNUTLS_EXTRA_CONFIG\n"); - printf("*** to point to the correct copy of libgnutls-extra-config, and remove the file config.cache\n"); - printf("*** before re-running configure\n"); - } - else if ( strcmp(gnutls_extra_check_version(NULL), LIBGNUTLS_EXTRA_VERSION ) ) - { - printf("\n*** LIBGNUTLS_EXTRA header file (version %s) does not match\n", LIBGNUTLS_EXTRA_VERSION); - printf("*** library (version %s). This is may be due to a different version of gnutls\n", gnutls_extra_check_version(NULL) ); - printf("*** and gnutls-extra.\n"); - } - else - { - if ( gnutls_extra_check_version( "$min_libgnutls_version" ) ) - { - return 0; - } - else - { - printf("no\n*** An old version of LIBGNUTLS_EXTRA (%s) was found.\n", - gnutls_extra_check_version(NULL) ); - printf("*** You need a version of LIBGNUTLS_EXTRA newer than %s. The latest version of\n", - "$min_libgnutls_version" ); - printf("*** LIBGNUTLS_EXTRA is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n"); - printf("*** \n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the libgnutls-extra-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of LIBGNUTLS_EXTRA, but you can also set the LIBGNUTLS_EXTRA_CONFIG environment to point to the\n"); - printf("*** correct copy of libgnutls-extra-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - - if test "x$no_libgnutls" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - if test -f conf.libgnutlstest ; then - : - else - AC_MSG_RESULT(no) - fi - if test "$LIBGNUTLS_EXTRA_CONFIG" = "no" ; then - echo "*** The libgnutls-extra-config script installed by LIBGNUTLS_EXTRA could not be found" - echo "*** If LIBGNUTLS_EXTRA was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the LIBGNUTLS_EXTRA_CONFIG environment variable to the" - echo "*** full path to libgnutls-extra-config." - else - if test -f conf.libgnutlstest ; then - : - else - echo "*** Could not run libgnutls test program, checking why..." - CFLAGS="$CFLAGS $LIBGNUTLS_EXTRA_CFLAGS" - LIBS="$LIBS $LIBGNUTLS_EXTRA_LIBS" - AC_TRY_LINK([ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gnutls/extra.h> -], [ return !!gnutls_extra_check_version(NULL); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding LIBGNUTLS_EXTRA or finding the wrong" - echo "*** version of LIBGNUTLS_EXTRA. If it is not finding LIBGNUTLS_EXTRA, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" - echo "***" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means LIBGNUTLS_EXTRA was incorrectly installed" - echo "*** or that you have moved LIBGNUTLS_EXTRA since it was installed. In the latter case, you" - echo "*** may want to edit the libgnutls-extra-config script: $LIBGNUTLS_EXTRA_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - LIBGNUTLS_EXTRA_CFLAGS="" - LIBGNUTLS_EXTRA_LIBS="" - ifelse([$3], , :, [$3]) - fi - rm -f conf.libgnutlstest - AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS) - AC_SUBST(LIBGNUTLS_EXTRA_LIBS) -]) - -dnl *-*wedit:notab*-* Please keep this as the last line. -
--- a/mcabber/connwrap/configure Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1893 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-ssl enable SSL secured connections using either OpenSSL - or GnuTLS" -ac_help="$ac_help - --with-openssl=[DIR] enable SSL secured connections using the OpenSSL - library in DIR (optional)" -ac_help="$ac_help - --with-libgnutls-extra-prefix=PFX Prefix where libgnutls-extra is installed (optional)" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -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=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=aclocal.m4 - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -am__api_version="1.4" -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:565: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:618: checking whether build environment is sane" >&5 -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } - fi - - test "$2" = conftestfile - ) -then - # Ok. - : -else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:675: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - - -PACKAGE=connwrap - -VERSION=0.1 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <<EOF -#define PACKAGE "$PACKAGE" -EOF - -cat >> confdefs.h <<EOF -#define VERSION "$VERSION" -EOF - - - -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6 -echo "configure:721: checking for working aclocal-${am__api_version}" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal-${am__api_version} - echo "$ac_t""found" 1>&6 -else - ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:734: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 -else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6 -echo "configure:747: checking for working automake-${am__api_version}" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake-${am__api_version} - echo "$ac_t""found" 1>&6 -else - AUTOMAKE="$missing_dir/missing automake-${am__api_version}" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:760: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 -else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:773: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 -fi - - - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:790: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:821: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:851: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:902: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:934: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 945 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:976: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:981: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1009: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1045: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1077: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 1088 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:1093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1119: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1124: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1133: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1152: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi - - -### -### SSL libs -### - -# Check whether --with-ssl or --without-ssl was given. -if test "${with_ssl+set}" = set; then - withval="$with_ssl" - with_ssl=$withval -fi - - -if test "$with_ssl" != "no"; then - # Check whether --with-openssl or --without-openssl was given. -if test "${with_openssl+set}" = set; then - withval="$with_openssl" - with_openssl=$withval -fi - - - if test -z "$with_openssl"; then - for ac_dir in /usr/local /usr; do - if test -f "$ac_dir/include/openssl/ssl.h"; then - with_openssl=$ac_dir - break; - fi - done - fi - - echo $ac_n "checking for OpenSSL""... $ac_c" 1>&6 -echo "configure:1213: checking for OpenSSL" >&5 - - if test -n "$with_openssl" -a "$with_openssl" != "no"; then - if test "$with_openssl" = "yes"; then with_openssl="/usr"; fi - CFLAGS="$CFLAGS -I${with_openssl}" - cat >> confdefs.h <<\EOF -#define HAVE_OPENSSL 1 -EOF - - echo "$ac_t""found in $with_openssl" 1>&6 - echo $ac_n "checking for main in -lcrypto""... $ac_c" 1>&6 -echo "configure:1224: checking for main in -lcrypto" >&5 -ac_lib_var=`echo crypto'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lcrypto $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1232 "configure" -#include "confdefs.h" - -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - - echo $ac_n "checking for SSLeay_add_all_algorithms in -lcrypto""... $ac_c" 1>&6 -echo "configure:1256: checking for SSLeay_add_all_algorithms in -lcrypto" >&5 -ac_lib_var=`echo crypto'_'SSLeay_add_all_algorithms | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lcrypto $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1264 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char SSLeay_add_all_algorithms(); - -int main() { -SSLeay_add_all_algorithms() -; return 0; } -EOF -if { (eval echo configure:1275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - - cat >> confdefs.h <<\EOF -#define HAVE_SSLEAY 1 -EOF - - -else - echo "$ac_t""no" 1>&6 -fi - - -else - echo "$ac_t""no" 1>&6 -fi - - echo $ac_n "checking for main in -lssl""... $ac_c" 1>&6 -echo "configure:1306: checking for main in -lssl" >&5 -ac_lib_var=`echo ssl'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lssl $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1314 "configure" -#include "confdefs.h" - -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:1321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo ssl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - - LIBS="-lssl $LIBS" - -else - echo "$ac_t""no" 1>&6 -fi - - else - echo "$ac_t""not found or disabled" 1>&6 - - # Check whether --with-libgnutls-extra-prefix or --without-libgnutls-extra-prefix was given. -if test "${with_libgnutls_extra_prefix+set}" = set; then - withval="$with_libgnutls_extra_prefix" - libgnutls_extra_config_prefix="$withval" -else - libgnutls_extra_config_prefix="" -fi - - - if test x$libgnutls_extra_config_prefix != x ; then - libgnutls_extra_config_args="$libgnutls_extra_config_args --prefix=$libgnutls_extra_config_prefix" - if test x${LIBGNUTLS_EXTRA_CONFIG+set} != xset ; then - LIBGNUTLS_EXTRA_CONFIG=$libgnutls_extra_config_prefix/bin/libgnutls-extra-config - fi - fi - - # Extract the first word of "libgnutls-extra-config", so it can be a program name with args. -set dummy libgnutls-extra-config; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1370: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_LIBGNUTLS_EXTRA_CONFIG'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$LIBGNUTLS_EXTRA_CONFIG" in - /*) - ac_cv_path_LIBGNUTLS_EXTRA_CONFIG="$LIBGNUTLS_EXTRA_CONFIG" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_LIBGNUTLS_EXTRA_CONFIG="$LIBGNUTLS_EXTRA_CONFIG" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_LIBGNUTLS_EXTRA_CONFIG="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_LIBGNUTLS_EXTRA_CONFIG" && ac_cv_path_LIBGNUTLS_EXTRA_CONFIG="no" - ;; -esac -fi -LIBGNUTLS_EXTRA_CONFIG="$ac_cv_path_LIBGNUTLS_EXTRA_CONFIG" -if test -n "$LIBGNUTLS_EXTRA_CONFIG"; then - echo "$ac_t""$LIBGNUTLS_EXTRA_CONFIG" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - min_libgnutls_version=0.0.1 - echo $ac_n "checking for libgnutls - version >= $min_libgnutls_version""... $ac_c" 1>&6 -echo "configure:1405: checking for libgnutls - version >= $min_libgnutls_version" >&5 - no_libgnutls="" - if test "$LIBGNUTLS_EXTRA_CONFIG" = "no" ; then - no_libgnutls=yes - else - LIBGNUTLS_EXTRA_CFLAGS=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --cflags` - LIBGNUTLS_EXTRA_LIBS=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --libs` - libgnutls_extra_config_version=`$LIBGNUTLS_EXTRA_CONFIG $libgnutls_extra_config_args --version` - - - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $LIBGNUTLS_EXTRA_CFLAGS" - LIBS="$LIBS $LIBGNUTLS_EXTRA_LIBS" - rm -f conf.libgnutlstest - if test "$cross_compiling" = yes; then - echo $ac_n "cross compiling; assumed OK... $ac_c" -else - cat > conftest.$ac_ext <<EOF -#line 1424 "configure" -#include "confdefs.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gnutls/extra.h> - -int -main () -{ - system ("touch conf.libgnutlstest"); - - if( strcmp( gnutls_extra_check_version(NULL), "$libgnutls_extra_config_version" ) ) - { - printf("\n*** 'libgnutls-extra-config --version' returned %s, but LIBGNUTLS_EXTRA (%s)\n", - "$libgnutls_extra_config_version", gnutls_extra_check_version(NULL) ); - printf("*** was found! If libgnutls-extra-config was correct, then it is best\n"); - printf("*** to remove the old version of LIBGNUTLS_EXTRA. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If libgnutls-extra-config was wrong, set the environment variable LIBGNUTLS_EXTRA_CONFIG\n"); - printf("*** to point to the correct copy of libgnutls-extra-config, and remove the file config.cache\n"); - printf("*** before re-running configure\n"); - } - else if ( strcmp(gnutls_extra_check_version(NULL), LIBGNUTLS_EXTRA_VERSION ) ) - { - printf("\n*** LIBGNUTLS_EXTRA header file (version %s) does not match\n", LIBGNUTLS_EXTRA_VERSION); - printf("*** library (version %s). This is may be due to a different version of gnutls\n", gnutls_extra_check_version(NULL) ); - printf("*** and gnutls-extra.\n"); - } - else - { - if ( gnutls_extra_check_version( "$min_libgnutls_version" ) ) - { - return 0; - } - else - { - printf("no\n*** An old version of LIBGNUTLS_EXTRA (%s) was found.\n", - gnutls_extra_check_version(NULL) ); - printf("*** You need a version of LIBGNUTLS_EXTRA newer than %s. The latest version of\n", - "$min_libgnutls_version" ); - printf("*** LIBGNUTLS_EXTRA is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n"); - printf("*** \n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the libgnutls-extra-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of LIBGNUTLS_EXTRA, but you can also set the LIBGNUTLS_EXTRA_CONFIG environment to point to the\n"); - printf("*** correct copy of libgnutls-extra-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} - -EOF -if { (eval echo configure:1483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - no_libgnutls=yes -fi -rm -fr conftest* -fi - - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - - if test "x$no_libgnutls" = x ; then - echo "$ac_t""yes" 1>&6 - - CXXFLAGS="$CXXFLAGS $LIBGNUTLS_CFLAGS" - LIBS="$LIBS $LIBGNUTLS_LIBS -lgnutls-extra" - cat >> confdefs.h <<\EOF -#define HAVE_GNUTLS 1 -EOF - - - else - if test -f conf.libgnutlstest ; then - : - else - echo "$ac_t""no" 1>&6 - fi - if test "$LIBGNUTLS_EXTRA_CONFIG" = "no" ; then - echo "*** The libgnutls-extra-config script installed by LIBGNUTLS_EXTRA could not be found" - echo "*** If LIBGNUTLS_EXTRA was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the LIBGNUTLS_EXTRA_CONFIG environment variable to the" - echo "*** full path to libgnutls-extra-config." - else - if test -f conf.libgnutlstest ; then - : - else - echo "*** Could not run libgnutls test program, checking why..." - CFLAGS="$CFLAGS $LIBGNUTLS_EXTRA_CFLAGS" - LIBS="$LIBS $LIBGNUTLS_EXTRA_LIBS" - cat > conftest.$ac_ext <<EOF -#line 1528 "configure" -#include "confdefs.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gnutls/extra.h> - -int main() { - return !!gnutls_extra_check_version(NULL); -; return 0; } -EOF -if { (eval echo configure:1540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding LIBGNUTLS_EXTRA or finding the wrong" - echo "*** version of LIBGNUTLS_EXTRA. If it is not finding LIBGNUTLS_EXTRA, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" - echo "***" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means LIBGNUTLS_EXTRA was incorrectly installed" - echo "*** or that you have moved LIBGNUTLS_EXTRA since it was installed. In the latter case, you" - echo "*** may want to edit the libgnutls-extra-config script: $LIBGNUTLS_EXTRA_CONFIG" -fi -rm -f conftest* - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - LIBGNUTLS_EXTRA_CFLAGS="" - LIBGNUTLS_EXTRA_LIBS="" - : - fi - rm -f conf.libgnutlstest - - - - fi -fi - -echo $ac_n "checking for inet_aton() presence""... $ac_c" 1>&6 -echo "configure:1578: checking for inet_aton() presence" >&5 - -cat > conftest.$ac_ext <<EOF -#line 1581 "configure" -#include "confdefs.h" - - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - - -int main() { - - -struct in_addr inp; -inet_aton("address", &inp); - - -; return 0; } -EOF -if { (eval echo configure:1600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - have_aton=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - have_aton=no -fi -rm -f conftest* - -if test "$have_aton" = "yes"; then - cat >> confdefs.h <<\EOF -#define HAVE_INET_ATON 1 -EOF - - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@RANLIB@%$RANLIB%g -s%@CC@%$CC%g -s%@CXX@%$CXX%g -s%@LIBGNUTLS_EXTRA_CONFIG@%$LIBGNUTLS_EXTRA_CONFIG%g -s%@LIBGNUTLS_EXTRA_CFLAGS@%$LIBGNUTLS_EXTRA_CFLAGS%g -s%@LIBGNUTLS_EXTRA_LIBS@%$LIBGNUTLS_EXTRA_LIBS%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 -
--- a/mcabber/connwrap/configure.in Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -AC_INIT(aclocal.m4) -AM_INIT_AUTOMAKE(connwrap, 0.1) - -AC_PROG_RANLIB - -AC_PROG_CC -AC_PROG_CXX - -### -### SSL libs -### - -AC_ARG_WITH(ssl, [ --with-ssl enable SSL secured connections using either OpenSSL - or GnuTLS], - [with_ssl=$withval]) - -if test "$with_ssl" != "no"; then - AC_ARG_WITH(openssl, - [ --with-openssl=[DIR] enable SSL secured connections using the OpenSSL - library in DIR (optional)], - [with_openssl=$withval]) - - if test -z "$with_openssl"; then - for ac_dir in /usr/local /usr; do - if test -f "$ac_dir/include/openssl/ssl.h"; then - with_openssl=$ac_dir - break; - fi - done - fi - - AC_MSG_CHECKING(for OpenSSL) - - if test -n "$with_openssl" -a "$with_openssl" != "no"; then - if test "$with_openssl" = "yes"; then with_openssl="/usr"; fi - CFLAGS="$CFLAGS -I${with_openssl}" - AC_DEFINE(HAVE_OPENSSL) - AC_MSG_RESULT([found in $with_openssl]) - AC_CHECK_LIB(crypto, main, [ - AC_CHECK_LIB(crypto, SSLeay_add_all_algorithms, [ - AC_DEFINE(HAVE_SSLEAY) - ]) - ]) - AC_CHECK_LIB(ssl, main) - else - AC_MSG_RESULT([not found or disabled]) - - AM_PATH_LIBGNUTLS_EXTRA(0.0.1, [ - CXXFLAGS="$CXXFLAGS $LIBGNUTLS_CFLAGS" - LIBS="$LIBS $LIBGNUTLS_LIBS -lgnutls-extra" - AC_DEFINE(HAVE_GNUTLS) - ]) - fi -fi - -AC_MSG_CHECKING(for inet_aton() presence) - -AC_TRY_LINK([ - -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> - -], [ - -struct in_addr inp; -inet_aton("address", &inp); - -], have_aton=yes, have_aton=no) - -if test "$have_aton" = "yes"; then - AC_DEFINE(HAVE_INET_ATON) - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - -AC_OUTPUT(Makefile)
--- a/mcabber/connwrap/connwrap.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,641 +0,0 @@ -#include "connwrap.h" - -#include <stdio.h> -#include <stdlib.h> -#include <netdb.h> -#include <string.h> -#include <netinet/in.h> -#include <errno.h> -#include <arpa/inet.h> -#include <fcntl.h> -#include <sys/time.h> -#include <unistd.h> - -#define PROXY_TIMEOUT 10 - // HTTP proxy timeout in seconds (for the CONNECT method) - -#ifdef HAVE_OPENSSL -# define OPENSSL_NO_KRB5 1 -# include <openssl/ssl.h> -# include <openssl/err.h> -# define HAVE_SSL -# undef HAVE_GNUTLS // Can't use both... -#elif defined HAVE_GNUTLS -# include <gnutls/gnutls.h> -# define HAVE_SSL -#endif - -static int in_http_connect = 0; - -#ifdef HAVE_OPENSSL -static SSL_CTX *ctx = NULL; -typedef struct { int fd; SSL *ssl; } sslsock; -#elif defined HAVE_GNUTLS -typedef struct { int fd; gnutls_session_t session; } sslsock; -#endif - - -#ifdef HAVE_SSL - -/* verify > 0 indicates verify depth as well */ -static int verify = -1; -static const char *cafile = NULL; -static const char *capath = NULL; -static const char *cipherlist = NULL; -static const char *peer = NULL; -static const char *sslerror = NULL; - -#ifdef HAVE_OPENSSL -static int verify_cb(int preverify_ok, X509_STORE_CTX *cx) -{ - X509 *cert; - X509_NAME *nm; - int lastpos; - - if(!preverify_ok) { - long err = X509_STORE_CTX_get_error(cx); - - sslerror = X509_verify_cert_error_string(err); - return 0; - } - - if (peer == NULL) - return 1; - - if ((cert = X509_STORE_CTX_get_current_cert(cx)) == NULL) { - sslerror = "internal SSL error"; - return 0; - } - - /* We only want to look at the peername if we're working on the peer - * certificate. */ - if (cert != cx->cert) - return 1; - - if ((nm = X509_get_subject_name (cert)) == NULL) { - sslerror = "internal SSL error"; - return 0; - } - - for(lastpos = -1; ; ) { - X509_NAME_ENTRY *e; - ASN1_STRING *a; - ASN1_STRING *p; - int match; - - lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos); - if (lastpos == -1) - break; - if ((e = X509_NAME_get_entry(nm, lastpos)) == NULL) { - sslerror = "internal SSL error"; - return 0; - } - if ((a = X509_NAME_ENTRY_get_data(e)) == NULL) { - sslerror = "internal SSL error"; - return 0; - } - if ((p = ASN1_STRING_type_new(ASN1_STRING_type(a))) == NULL) { - sslerror = "internal SSL error"; - return 0; - } - (void) ASN1_STRING_set(p, peer, -1); - match = !ASN1_STRING_cmp(a, p); - ASN1_STRING_free(p); - if(match) - return 1; - } - - sslerror = "server certificate cn mismatch"; - return 0; -} -#endif - -static void init(int fd, sslsock *p) { -#ifdef HAVE_GNUTLS - gnutls_certificate_credentials_t xcred; -#endif - -#ifdef HAVE_OPENSSL - if(ctx) - return; - SSL_library_init(); - SSL_load_error_strings(); - -#ifdef HAVE_SSLEAY - SSLeay_add_all_algorithms(); -#else - OpenSSL_add_all_algorithms(); -#endif - - /* May need to use distinct SSLEAY bindings below... */ - - ctx = SSL_CTX_new(SSLv23_client_method()); - if(cipherlist) - (void)SSL_CTX_set_cipher_list(ctx, cipherlist); - if(cafile || capath) - (void)SSL_CTX_load_verify_locations(ctx, cafile, capath); - if(verify) { - SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, verify_cb); - if(verify > 0) - SSL_CTX_set_verify_depth(ctx, verify); - } else - SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL); - - p->ssl = SSL_new(ctx); - SSL_set_fd(p->ssl, p->fd = fd); - -#elif defined HAVE_GNUTLS - gnutls_global_init(); - gnutls_certificate_allocate_credentials(&xcred); - gnutls_init(&(p->session), GNUTLS_CLIENT); - gnutls_set_default_priority(p->session); - gnutls_credentials_set(p->session, GNUTLS_CRD_CERTIFICATE, xcred); - p->fd = fd; - gnutls_transport_set_ptr(p->session,(gnutls_transport_ptr_t)fd); -#endif -} - -static sslsock *socks = NULL; -static int sockcount = 0; - -static sslsock *getsock(int fd) { - int i; - - for(i = 0; i < sockcount; i++) - if(socks[i].fd == fd) - return &socks[i]; - - return NULL; -} - -static sslsock *addsock(int fd) { - sslsock *p; - - sockcount++; - - if (socks) - socks = (sslsock *) realloc(socks, sizeof(sslsock)*sockcount); - else - socks = (sslsock *) malloc(sizeof(sslsock)*sockcount); - - p = &socks[sockcount-1]; - - init(fd, p); - - sslerror = NULL; - - return p; -} - -static void delsock(int fd) { - int i, nsockcount; - sslsock *nsocks; - - nsockcount = 0; - - if (sockcount > 1) { - nsocks = (sslsock *) malloc(sizeof(sslsock)*(sockcount-1)); - - for(i = 0; i < sockcount; i++) { - if(socks[i].fd != fd) { - nsocks[nsockcount++] = socks[i]; - } else { -#ifdef HAVE_OPENSSL - SSL_free(socks[i].ssl); -#elif defined HAVE_GNUTLS - gnutls_bye(socks[i].session, GNUTLS_SHUT_WR); - gnutls_deinit(socks[i].session); -#endif - } - } - - } else { -#ifdef HAVE_OPENSSL - if (ctx) - SSL_CTX_free(ctx); - ctx = 0; -#endif - nsocks = NULL; - } - - if (socks) - free(socks); - socks = nsocks; - sockcount = nsockcount; -} - -void cw_set_ssl_options(int sslverify, - const char *sslcafile, const char *sslcapath, - const char *sslciphers, const char *sslpeer) { - verify = sslverify; - cafile = sslcafile; - capath = sslcapath; - cipherlist = sslciphers; - peer = sslpeer; -} - -const char *cw_get_ssl_error(void) { - return sslerror; -} - -#else // HAVE_SSL - -void cw_set_ssl_options(int sslverify, - const char *sslcafile, const char *sslcapath, - const char *sslciphers, const char *sslpeer) { } - -const char *cw_get_ssl_error(void) { - return NULL; -} - -#endif // HAVE_SSL - -static char *bindaddr = 0, *proxyhost = 0, *proxyuser = 0, *proxypass = 0; -static int proxyport = 3128; -static int proxy_ssl = 0; - -#define SOCKOUT(s) write(sockfd, s, strlen(s)) - -int cw_http_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen) { - int err, pos, fl; - struct hostent *server; - struct sockaddr_in paddr; - char buf[512]; - fd_set rfds; - - fl = 0; - err = 0; - in_http_connect = 1; - - if(!(server = gethostbyname(proxyhost))) { - errno = h_errno; - err = -1; - } - - if(!err) { - memset(&paddr, 0, sizeof(paddr)); - paddr.sin_family = AF_INET; - memcpy(&paddr.sin_addr.s_addr, *server->h_addr_list, server->h_length); - paddr.sin_port = htons(proxyport); - - fl = fcntl(sockfd, F_GETFL); - fcntl(sockfd, F_SETFL, fl & ~O_NONBLOCK); - - buf[0] = 0; - - err = cw_connect(sockfd, (struct sockaddr *) &paddr, sizeof(paddr), - proxy_ssl); - } - - errno = ECONNREFUSED; - - if(!err) { - struct sockaddr_in *sin = (struct sockaddr_in *) serv_addr; - char *ip = inet_ntoa(sin->sin_addr), c; - struct timeval tv; - - snprintf(buf, sizeof(buf), "%d", ntohs(sin->sin_port)); - SOCKOUT("CONNECT "); - SOCKOUT(ip); - SOCKOUT(":"); - SOCKOUT(buf); - SOCKOUT(" HTTP/1.0\r\n"); - - if(proxyuser) { - char *b; - SOCKOUT("Proxy-Authorization: Basic "); - - snprintf(buf, sizeof(buf), "%s:%s", proxyuser, proxypass); - b = cw_base64_encode(buf); - SOCKOUT(b); - free(b); - - SOCKOUT("\r\n"); - } - - SOCKOUT("\r\n"); - - buf[0] = 0; - - while(err != -1) { - FD_ZERO(&rfds); - FD_SET(sockfd, &rfds); - - tv.tv_sec = PROXY_TIMEOUT; - tv.tv_usec = 0; - - err = select(sockfd+1, &rfds, 0, 0, &tv); - - if(err < 1) err = -1; - - if(err != -1 && FD_ISSET(sockfd, &rfds)) { - err = read(sockfd, &c, 1); - if(!err) err = -1; - - if(err != -1) { - pos = strlen(buf); - buf[pos] = c; - buf[pos+1] = 0; - - if(strlen(buf) > 4) - if(!strcmp(buf+strlen(buf)-4, "\r\n\r\n")) - break; - } - } - } - } - - if(err != -1 && strlen(buf)) { - char *p = strstr(buf, " "); - - err = -1; - - if(p) - if(atoi(++p) == 200) - err = 0; - - fcntl(sockfd, F_SETFL, fl); - if(fl & O_NONBLOCK) { - errno = EINPROGRESS; - err = -1; - } - } - - in_http_connect = 0; - - return err; -} - -int cw_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, - int ssl) { - int rc; - struct sockaddr_in ba; - - if(bindaddr) - if(strlen(bindaddr)) { -#ifdef HAVE_INET_ATON - struct in_addr addr; - rc = inet_aton(bindaddr, &addr); - ba.sin_addr.s_addr = addr.s_addr; -#else - rc = inet_pton(AF_INET, bindaddr, &ba); -#endif - - if(rc) { - ba.sin_port = 0; - rc = bind(sockfd, (struct sockaddr *) &ba, sizeof(ba)); - } else { - rc = -1; - } - - if(rc) return rc; - } - - if(proxyhost && !in_http_connect) - rc = cw_http_connect(sockfd, serv_addr, addrlen); - else - rc = connect(sockfd, serv_addr, addrlen); - -#ifdef HAVE_OPENSSL - if(ssl && !rc) { - sslsock *p = addsock(sockfd); - if(SSL_connect(p->ssl) != 1) - return -1; // XXX "Can't connect to SSL" - } -#endif - - return rc; -} - -int cw_nb_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, - int ssl, int *state) { - int rc = 0; - struct sockaddr_in ba; - - if(bindaddr) - if(strlen(bindaddr)) { -#ifdef HAVE_INET_ATON - struct in_addr addr; - rc = inet_aton(bindaddr, &addr); - ba.sin_addr.s_addr = addr.s_addr; -#else - rc = inet_pton(AF_INET, bindaddr, &ba); -#endif - - if(rc) { - ba.sin_port = 0; - rc = bind(sockfd, (struct sockaddr *) &ba, sizeof(ba)); - } else { - rc = -1; - } - - if(rc) return rc; - } - -#ifdef HAVE_SSL - if(ssl) { - if ( !(*state & CW_CONNECT_WANT_SOMETHING)) { - rc = cw_connect(sockfd, serv_addr, addrlen, 0); - } else { /* check if the socket is connected correctly */ - int optlen = sizeof(int), optval; - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, - (socklen_t*)&optlen) || optval) - return -1; - } - - if(!rc) { -#ifdef HAVE_GNUTLS - int ret; -#endif - sslsock *p; - if (*state & CW_CONNECT_SSL) - p = getsock(sockfd); - else - p = addsock(sockfd); - -#ifdef HAVE_GNUTLS - do { - ret = gnutls_handshake(p->session); - } while ((ret == GNUTLS_E_AGAIN) || (ret == GNUTLS_E_INTERRUPTED)); - if (ret < 0) { - gnutls_deinit(p->session); - gnutls_perror(ret); - return -1; - } - else{ - *state = 1; - return 0; - } -#elif defined HAVE_OPENSSL - rc = SSL_connect(p->ssl); - switch(rc){ - case 1: - *state = 0; - return 0; - case 0: - return -1; - default: - switch (SSL_get_error(p->ssl, rc)){ - case SSL_ERROR_WANT_READ: - *state = CW_CONNECT_SSL | CW_CONNECT_WANT_READ; - return 0; - case SSL_ERROR_WANT_WRITE: - *state = CW_CONNECT_SSL | CW_CONNECT_WANT_WRITE; - return 0; - default: - return -1; - } - } -#endif - } else { /* catch EINPROGRESS error from the connect call */ - if (errno == EINPROGRESS){ - *state = CW_CONNECT_STARTED | CW_CONNECT_WANT_WRITE; - return 0; - } - } - - return rc; - } -#endif - if ( !(*state & CW_CONNECT_WANT_SOMETHING)) { - rc = cw_connect(sockfd, serv_addr, addrlen, 0); - } else { /* check if the socket is connected correctly */ - int optlen = sizeof(int), optval; - if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &optval, - (socklen_t*)&optlen) || optval) - return -1; - *state = 0; - return 0; - } - if (rc) - if (errno == EINPROGRESS){ - *state = CW_CONNECT_STARTED | CW_CONNECT_WANT_WRITE; - return 0; - } - return rc; -} - -int cw_accept(int s, struct sockaddr *addr, int *addrlen, int ssl) { -#ifdef HAVE_OPENSSL - int rc; - - if(ssl) { - rc = accept(s, addr, (socklen_t*)addrlen); - - if(!rc) { - sslsock *p = addsock(s); - if(SSL_accept(p->ssl) != 1) - return -1; - } - return rc; - } -#endif - return accept(s, addr, (socklen_t*)addrlen); -} - -int cw_write(int fd, const void *buf, int count, int ssl) { -#ifdef HAVE_SSL - sslsock *p; - - if(ssl) { -#ifdef HAVE_GNUTLS - p = getsock(fd); - if(p) { - int ret; - if((ret = gnutls_record_send( p->session, buf, count) < 0)) - fprintf(stderr, "Can't write to server"); - return ret; - } -#elif defined HAVE_OPENSSL - if((p = getsock(fd)) != NULL) - return SSL_write(p->ssl, buf, count); -#endif - } -#endif // HAVE_SSL - return write(fd, buf, count); -} - -int cw_read(int fd, void *buf, int count, int ssl) { -#ifdef HAVE_SSL - sslsock *p; - - if(ssl) { -#ifdef HAVE_GNUTLS - p = getsock(fd); - if(p) { - int ret; - do { - ret = gnutls_record_recv(p->session, buf, count); - } while (ret < 0 && - (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN)); - return ret; - } -#elif defined HAVE_OPENSSL - if((p = getsock(fd)) != NULL) - return SSL_read(p->ssl, buf, count); -#endif - } -#endif // HAVE_SSL - return read(fd, buf, count); -} - -void cw_close(int fd) { -#ifdef HAVE_SSL - delsock(fd); -#endif - close(fd); -} - -#define FREEVAR(v) if(v) free(v), v = 0; - -void cw_setbind(const char *abindaddr) { - FREEVAR(bindaddr); - bindaddr = strdup(abindaddr); -} - -void cw_setproxy(const char *aproxyhost, int aproxyport, - const char *aproxyuser, const char *aproxypass) { - FREEVAR(proxyhost); - FREEVAR(proxyuser); - FREEVAR(proxypass); - - if(aproxyhost && strlen(aproxyhost)) proxyhost = strdup(aproxyhost); - if(aproxyuser && strlen(aproxyuser)) proxyuser = strdup(aproxyuser); - if(aproxypass && strlen(aproxypass)) proxypass = strdup(aproxypass); - proxyport = aproxyport; -} - -char *cw_base64_encode(const char *in) { - static char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; - - int j = 0; - int inlen = strlen(in); - char *out = (char *) malloc(inlen*4+1), c; - - for(out[0] = 0; inlen >= 3; inlen -= 3) { - strncat(out, &base64digits[ in[j] >> 2 ], 1); - strncat(out, &base64digits[ ((in[j] << 4) & 0x30) | (in[j+1] >> 4) ], 1); - strncat(out, &base64digits[ ((in[j+1] << 2) & 0x3c) | (in[j+2] >> 6) ], 1); - strncat(out, &base64digits[ in[j+2] & 0x3f ], 1); - j += 3; - } - - if(inlen > 0) { - unsigned char fragment; - - strncat(out, &base64digits[in[j] >> 2], 1); - fragment = (in[j] << 4) & 0x30; - - if(inlen > 1) - fragment |= in[j+1] >> 4; - - strncat(out, &base64digits[fragment], 1); - - c = (inlen < 2) ? '-' : base64digits[ (in[j+1] << 2) & 0x3c ]; - strncat(out, &c, 1); - c = '-'; - strncat(out, &c, 1); - } - - return out; -}
--- a/mcabber/connwrap/connwrap.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#ifndef __CONNWRAP_H__ -#define __CONNWRAP_H__ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <sys/socket.h> - -int cw_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, int ssl); - -#define CW_CONNECT_STARTED 0x1 -#define CW_CONNECT_SSL 0x2 -#define CW_CONNECT_WANT_READ 0x4 -#define CW_CONNECT_WANT_WRITE 0x8 -#define CW_CONNECT_WANT_SOMETHING 0xC -#define CW_CONNECT_BLOCKING 0x10 - -/* non-blocking socket - state should be initialized with 0, subsequent calls should keep the - modified state (state is a bitwise OR between CW_CONNECT_XXX) - returns 0 for OK, or if it wants subsequent calls - -1 for a fatal error - */ -int cw_nb_connect(int sockfd, const struct sockaddr *serv_addr, int addrlen, int ssl, int *state); -int cw_accept(int s, struct sockaddr *addr, int *addrlen, int ssl); - -int cw_write(int fd, const void *buf, int count, int ssl); -int cw_read(int fd, void *buf, int count, int ssl); - -void cw_close(int fd); - -void cw_set_ssl_options(int sslverify, const char *sslcafile, const char *sslcapath, const char *sslciphers, const char *sslpeer); -const char *cw_get_ssl_error(void); -void cw_setproxy(const char *aproxyhost, int aproxyport, const char *aproxyuser, const char *aproxypass); -void cw_setbind(const char *abindaddr); - -char *cw_base64_encode(const char *in); - -#ifdef __cplusplus -} -#endif - -#endif
--- a/mcabber/connwrap/connwrap.spec Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -Summary: A static library made in motor IDE -Name: connwrap -Version: 0.1 -Release: 1 -Copyright: GPL -Group: Development/Libraries -URL: http://konst.org.ua/motor/ -Packager: Konstantin Klyagin -Source: %{name}-%{version}.tar.gz -BuildRoot: /var/tmp/%{name}-buildroot/ - -%description -Motor is a text mode based programming environment for Linux. It -consists of a powerful editor with syntax highlight feature, project -manager, makefile generator, gdb front-end, etc. Deep CVS integration is -also provided. - -%prep -%setup - -%build -./configure --prefix=/usr -make - -%install -rm -rf $RPM_BUILD_ROOT -make prefix=$RPM_BUILD_ROOT/usr sysconfdir=$RPM_BUILD_ROOT/etc install - -find $RPM_BUILD_ROOT/usr/ -type f -print | \ - grep -v '\/(README|COPYING|INSTALL|TODO|ChangeLog)$' | \ - sed "s@^$RPM_BUILD_ROOT@@g" | \ - sed 's/^\(.\+\/man.\+\)$/\1*/g' \ - > %{name}-%{version}-filelist - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -f %{name}-%{version}-filelist -%defattr(-, root, root) - -%doc README COPYING INSTALL TODO ChangeLog - -%changelog
--- a/mcabber/connwrap/md5.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,408 +0,0 @@ -/* - Copyright (C) 1999 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321. - It is derived directly from the text of the RFC and not from the - reference implementation. - - The original and principal author of md5.c is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). - 1999-05-03 lpd Original version. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include "md5.h" - -#if STDC_HEADERS -# include <string.h> -#else -# if !HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr (), *strrchr (); -# if !HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#ifdef TEST -/* - * Compile with -DTEST to create a self-contained executable test program. - * The test program should print out the same values as given in section - * A.5 of RFC 1321, reproduced below. - */ -main() -{ - static const char *const test[7] = { - "", /*d41d8cd98f00b204e9800998ecf8427e*/ - "945399884.61923487334tuvga", /*0cc175b9c0f1b6a831c399e269772661*/ - "abc", /*900150983cd24fb0d6963f7d28e17f72*/ - "message digest", /*f96b697d7cb7938d525a2f31aaf161d0*/ - "abcdefghijklmnopqrstuvwxyz", /*c3fcd3d76192e4007dfb496cca67e13b*/ - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - /*d174ab98d277d9f5a5611c2c9f419d9f*/ - "12345678901234567890123456789012345678901234567890123456789012345678901234567890" /*57edf4a22be3c955ac49da2e2107b67a*/ - }; - int i; - - for (i = 0; i < 7; ++i) { - md5_state_t state; - md5_byte_t digest[16]; - int di; - - md5_init(&state); - md5_append(&state, (const md5_byte_t *)test[i], strlen(test[i])); - md5_finish(&state, digest); - printf("MD5 (\"%s\") = ", test[i]); - for (di = 0; di < 16; ++di) - printf("%02x", digest[di]); - printf("\n"); - } - return 0; -} -#endif /* TEST */ - - -/* - * For reference, here is the program that computed the T values. - */ -#if 0 -#include <math.h> -main() -{ - int i; - for (i = 1; i <= 64; ++i) { - unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i))); - printf("#define T%d 0x%08lx\n", i, v); - } - return 0; -} -#endif -/* - * End of T computation program. - */ -#define T1 0xd76aa478 -#define T2 0xe8c7b756 -#define T3 0x242070db -#define T4 0xc1bdceee -#define T5 0xf57c0faf -#define T6 0x4787c62a -#define T7 0xa8304613 -#define T8 0xfd469501 -#define T9 0x698098d8 -#define T10 0x8b44f7af -#define T11 0xffff5bb1 -#define T12 0x895cd7be -#define T13 0x6b901122 -#define T14 0xfd987193 -#define T15 0xa679438e -#define T16 0x49b40821 -#define T17 0xf61e2562 -#define T18 0xc040b340 -#define T19 0x265e5a51 -#define T20 0xe9b6c7aa -#define T21 0xd62f105d -#define T22 0x02441453 -#define T23 0xd8a1e681 -#define T24 0xe7d3fbc8 -#define T25 0x21e1cde6 -#define T26 0xc33707d6 -#define T27 0xf4d50d87 -#define T28 0x455a14ed -#define T29 0xa9e3e905 -#define T30 0xfcefa3f8 -#define T31 0x676f02d9 -#define T32 0x8d2a4c8a -#define T33 0xfffa3942 -#define T34 0x8771f681 -#define T35 0x6d9d6122 -#define T36 0xfde5380c -#define T37 0xa4beea44 -#define T38 0x4bdecfa9 -#define T39 0xf6bb4b60 -#define T40 0xbebfbc70 -#define T41 0x289b7ec6 -#define T42 0xeaa127fa -#define T43 0xd4ef3085 -#define T44 0x04881d05 -#define T45 0xd9d4d039 -#define T46 0xe6db99e5 -#define T47 0x1fa27cf8 -#define T48 0xc4ac5665 -#define T49 0xf4292244 -#define T50 0x432aff97 -#define T51 0xab9423a7 -#define T52 0xfc93a039 -#define T53 0x655b59c3 -#define T54 0x8f0ccc92 -#define T55 0xffeff47d -#define T56 0x85845dd1 -#define T57 0x6fa87e4f -#define T58 0xfe2ce6e0 -#define T59 0xa3014314 -#define T60 0x4e0811a1 -#define T61 0xf7537e82 -#define T62 0xbd3af235 -#define T63 0x2ad7d2bb -#define T64 0xeb86d391 - -static void -md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) -{ - md5_word_t - a = pms->abcd[0], b = pms->abcd[1], - c = pms->abcd[2], d = pms->abcd[3]; - md5_word_t t; - -#ifndef ARCH_IS_BIG_ENDIAN -# define ARCH_IS_BIG_ENDIAN 1 /* slower, default implementation */ -#endif -#if ARCH_IS_BIG_ENDIAN - - /* - * On big-endian machines, we must arrange the bytes in the right - * order. (This also works on machines of unknown byte order.) - */ - md5_word_t X[16]; - const md5_byte_t *xp = data; - int i; - - for (i = 0; i < 16; ++i, xp += 4) - X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); - -#else /* !ARCH_IS_BIG_ENDIAN */ - - /* - * On little-endian machines, we can process properly aligned data - * without copying it. - */ - md5_word_t xbuf[16]; - const md5_word_t *X; - - if (!((data - (const md5_byte_t *)0) & 3)) { - /* data are properly aligned */ - X = (const md5_word_t *)data; - } else { - /* not aligned */ - memcpy(xbuf, data, 64); - X = xbuf; - } -#endif - -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) - - /* Round 1. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ -#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + F(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 7, T1); - SET(d, a, b, c, 1, 12, T2); - SET(c, d, a, b, 2, 17, T3); - SET(b, c, d, a, 3, 22, T4); - SET(a, b, c, d, 4, 7, T5); - SET(d, a, b, c, 5, 12, T6); - SET(c, d, a, b, 6, 17, T7); - SET(b, c, d, a, 7, 22, T8); - SET(a, b, c, d, 8, 7, T9); - SET(d, a, b, c, 9, 12, T10); - SET(c, d, a, b, 10, 17, T11); - SET(b, c, d, a, 11, 22, T12); - SET(a, b, c, d, 12, 7, T13); - SET(d, a, b, c, 13, 12, T14); - SET(c, d, a, b, 14, 17, T15); - SET(b, c, d, a, 15, 22, T16); -#undef SET - - /* Round 2. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ -#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + G(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 1, 5, T17); - SET(d, a, b, c, 6, 9, T18); - SET(c, d, a, b, 11, 14, T19); - SET(b, c, d, a, 0, 20, T20); - SET(a, b, c, d, 5, 5, T21); - SET(d, a, b, c, 10, 9, T22); - SET(c, d, a, b, 15, 14, T23); - SET(b, c, d, a, 4, 20, T24); - SET(a, b, c, d, 9, 5, T25); - SET(d, a, b, c, 14, 9, T26); - SET(c, d, a, b, 3, 14, T27); - SET(b, c, d, a, 8, 20, T28); - SET(a, b, c, d, 13, 5, T29); - SET(d, a, b, c, 2, 9, T30); - SET(c, d, a, b, 7, 14, T31); - SET(b, c, d, a, 12, 20, T32); -#undef SET - - /* Round 3. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + H(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 5, 4, T33); - SET(d, a, b, c, 8, 11, T34); - SET(c, d, a, b, 11, 16, T35); - SET(b, c, d, a, 14, 23, T36); - SET(a, b, c, d, 1, 4, T37); - SET(d, a, b, c, 4, 11, T38); - SET(c, d, a, b, 7, 16, T39); - SET(b, c, d, a, 10, 23, T40); - SET(a, b, c, d, 13, 4, T41); - SET(d, a, b, c, 0, 11, T42); - SET(c, d, a, b, 3, 16, T43); - SET(b, c, d, a, 6, 23, T44); - SET(a, b, c, d, 9, 4, T45); - SET(d, a, b, c, 12, 11, T46); - SET(c, d, a, b, 15, 16, T47); - SET(b, c, d, a, 2, 23, T48); -#undef SET - - /* Round 4. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ -#define I(x, y, z) ((y) ^ ((x) | ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + I(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 6, T49); - SET(d, a, b, c, 7, 10, T50); - SET(c, d, a, b, 14, 15, T51); - SET(b, c, d, a, 5, 21, T52); - SET(a, b, c, d, 12, 6, T53); - SET(d, a, b, c, 3, 10, T54); - SET(c, d, a, b, 10, 15, T55); - SET(b, c, d, a, 1, 21, T56); - SET(a, b, c, d, 8, 6, T57); - SET(d, a, b, c, 15, 10, T58); - SET(c, d, a, b, 6, 15, T59); - SET(b, c, d, a, 13, 21, T60); - SET(a, b, c, d, 4, 6, T61); - SET(d, a, b, c, 11, 10, T62); - SET(c, d, a, b, 2, 15, T63); - SET(b, c, d, a, 9, 21, T64); -#undef SET - - /* Then perform the following additions. (That is increment each - of the four registers by the value it had before this block - was started.) */ - pms->abcd[0] += a; - pms->abcd[1] += b; - pms->abcd[2] += c; - pms->abcd[3] += d; -} - -void -md5_init(md5_state_t *pms) -{ - pms->count[0] = pms->count[1] = 0; - pms->abcd[0] = 0x67452301; - pms->abcd[1] = 0xefcdab89; - pms->abcd[2] = 0x98badcfe; - pms->abcd[3] = 0x10325476; -} - -void -md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) -{ - const md5_byte_t *p = data; - int left = nbytes; - int offset = (pms->count[0] >> 3) & 63; - md5_word_t nbits = (md5_word_t)(nbytes << 3); - - if (nbytes <= 0) - return; - - /* Update the message length. */ - pms->count[1] += nbytes >> 29; - pms->count[0] += nbits; - if (pms->count[0] < nbits) - pms->count[1]++; - - /* Process an initial partial block. */ - if (offset) { - int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); - - memcpy(pms->buf + offset, p, copy); - if (offset + copy < 64) - return; - p += copy; - left -= copy; - md5_process(pms, pms->buf); - } - - /* Process full blocks. */ - for (; left >= 64; p += 64, left -= 64) - md5_process(pms, p); - - /* Process a final partial block. */ - if (left) - memcpy(pms->buf, p, left); -} - -void -md5_finish(md5_state_t *pms, md5_byte_t digest[16]) -{ - static const md5_byte_t pad[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - md5_byte_t data[8]; - int i; - - /* Save the length before padding. */ - for (i = 0; i < 8; ++i) - data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); - /* Pad to 56 bytes mod 64. */ - md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); - /* Append the length. */ - md5_append(pms, data, 8); - for (i = 0; i < 16; ++i) - digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); -}
--- a/mcabber/connwrap/md5.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - Copyright (C) 1999 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321. - It is derived directly from the text of the RFC and not from the - reference implementation. - - The original and principal author of md5.h is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke <purschke@bnl.gov>. - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This code has some adaptations for the Ghostscript environment, but it - * will compile and run correctly in any environment with 8-bit chars and - * 32-bit ints. Specifically, it assumes that if the following are - * defined, they have the same meaning as in Ghostscript: P1, P2, P3, - * ARCH_IS_BIG_ENDIAN. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -#ifdef P1 -void md5_init(P1(md5_state_t *pms)); -#else -void md5_init(md5_state_t *pms); -#endif - -/* Append a string to the message. */ -#ifdef P3 -void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); -#else -void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); -#endif - -/* Finish the message and return the digest. */ -#ifdef P2 -void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); -#else -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); -#endif - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */
--- a/mcabber/libjabber/Makefile.am Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -noinst_LIBRARIES = liblibjabber.a -EXTRA_DIST = jid.c log.c jutil.c str.c expat.c hashtable.c genhash.c pproxy.c pool.c rate.c xmlparse.c xstream.c xmltok.c xmlnode.c jconn.c xmlrole.c jpacket.c snprintf.c socket.c sha.c xmltok_impl_c.h latin1tab.h log.h asciitab.h libxode.h jabber.h hashtable.h xmlparse.h iasciitab.h xmldef.h xmltok.h utf8tab.h xmltok_impl.h xmlrole.h nametab.h xmltok_ns_c.h -AUTOMAKE_OPTIONS = foreign - -liblibjabber_a_SOURCES = jid.c log.c jutil.c str.c expat.c hashtable.c genhash.c pproxy.c pool.c rate.c xmlparse.c xstream.c xmltok.c xmlnode.c jconn.c xmlrole.c jpacket.c snprintf.c socket.c sha.c - -SUBDIRS = -INCLUDES = -I$(top_srcdir)/connwrap -CPPFLAGS =
--- a/mcabber/libjabber/aclocal.m4 Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p6 - -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# Copyright 2002 Free Software Foundation, Inc. - -# 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, 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., 59 Temple Place - Suite 330, Boston, MA - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.4-p6])]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN([AM_MISSING_PROG], -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - -# Define a conditional. - -AC_DEFUN([AM_CONDITIONAL], -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) -
--- a/mcabber/libjabber/asciitab.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (the "License"); you may not use this file except in -compliance with the License. You may obtain a copy of the License at -http://www.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is expat. - -The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998, 1999 -James Clark. All Rights Reserved. - -Contributor(s): - -Alternatively, the contents of this file may be used under the terms -of the GNU General Public License (the "GPL"), in which case the -provisions of the GPL are applicable instead of those above. If you -wish to allow use of your version of this file only under the terms of -the GPL and not to allow others to use your version of this file under -the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the -GPL. If you do not delete the provisions above, a recipient may use -your version of this file under either the MPL or the GPL. -*/ - -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
--- a/mcabber/libjabber/config.h.in Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* include/config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -#undef POOL_NO_HEAP -#undef HAVE_LIBSOCKET -#undef HAVE_SNPRINTF - -/* The number of bytes in a int. */ -#undef SIZEOF_INT - -/* The number of bytes in a short. */ -#undef SIZEOF_SHORT - -/* Define if you have the nsl library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION -
--- a/mcabber/libjabber/configure Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1469 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --disable-jabber Build without Jabber" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -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=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=aclocal.m4 - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -am__api_version="1.4" -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:559: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:612: checking whether build environment is sane" >&5 -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "$*" != "X $srcdir/configure conftestfile" \ - && test "$*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { echo "configure: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" 1>&2; exit 1; } - fi - - test "$2" = conftestfile - ) -then - # Ok. - : -else - { echo "configure: error: newly created file is older than distributed files! -Check your system clock" 1>&2; exit 1; } -fi -rm -f conftest* -echo "$ac_t""yes" 1>&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF_SED > conftestsed -s,\\,\\\\,g; s,\$,$$,g -EOF_SED - program_transform_name="`echo $program_transform_name|sed -f conftestsed`" - rm -f conftestsed -fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:669: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - - -PACKAGE=libjabber - -VERSION=0.1 - -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <<EOF -#define PACKAGE "$PACKAGE" -EOF - -cat >> confdefs.h <<EOF -#define VERSION "$VERSION" -EOF - - - -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal-${am__api_version}""... $ac_c" 1>&6 -echo "configure:715: checking for working aclocal-${am__api_version}" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then - ACLOCAL=aclocal-${am__api_version} - echo "$ac_t""found" 1>&6 -else - ACLOCAL="$missing_dir/missing aclocal-${am__api_version}" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:728: checking for working autoconf" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoconf --version) < /dev/null > /dev/null 2>&1; then - AUTOCONF=autoconf - echo "$ac_t""found" 1>&6 -else - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working automake-${am__api_version}""... $ac_c" 1>&6 -echo "configure:741: checking for working automake-${am__api_version}" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake-${am__api_version} - echo "$ac_t""found" 1>&6 -else - AUTOMAKE="$missing_dir/missing automake-${am__api_version}" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:754: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 -else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 -fi - -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:767: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 -fi - - - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:784: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:814: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:844: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:895: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:927: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 938 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:969: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:974: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:983: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1002: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - - -# Check whether --enable-jabber or --disable-jabber was given. -if test "${enable_jabber+set}" = set; then - enableval="$enable_jabber" - build_jabber="$enableval" -else - build_jabber="yes" -fi - - - -if test "x$build_jabber" = xyes; then - BUILD_JABBER_TRUE= - BUILD_JABBER_FALSE='#' -else - BUILD_JABBER_TRUE='#' - BUILD_JABBER_FALSE= -fi - -if test "$build_jabber" = "yes"; then - for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1058: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1090: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 1101 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:1106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1132: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1137: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1165: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi - -fi - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@PACKAGE@%$PACKAGE%g -s%@VERSION@%$VERSION%g -s%@ACLOCAL@%$ACLOCAL%g -s%@AUTOCONF@%$AUTOCONF%g -s%@AUTOMAKE@%$AUTOMAKE%g -s%@AUTOHEADER@%$AUTOHEADER%g -s%@MAKEINFO@%$MAKEINFO%g -s%@SET_MAKE@%$SET_MAKE%g -s%@RANLIB@%$RANLIB%g -s%@CC@%$CC%g -s%@BUILD_JABBER_TRUE@%$BUILD_JABBER_TRUE%g -s%@BUILD_JABBER_FALSE@%$BUILD_JABBER_FALSE%g -s%@CXX@%$CXX%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 -
--- a/mcabber/libjabber/configure.in Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -AC_INIT(aclocal.m4) -AM_INIT_AUTOMAKE(libjabber, 0.1) - -AC_PROG_RANLIB -AC_PROG_CC - -AC_ARG_ENABLE(jabber, [ --disable-jabber Build without Jabber], build_jabber="$enableval", build_jabber="yes") -AM_CONDITIONAL(BUILD_JABBER, test "x$build_jabber" = xyes) - -if test "$build_jabber" = "yes"; then - AC_PROG_CXX -fi - -AC_OUTPUT(Makefile)
--- a/mcabber/libjabber/expat.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Jabber - * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/ - */ - -#include <libxode.h> - -/** - * callback function used for start elements - * - * This function is used internally by expat.c as a callback function - * given to expat. It will create a new xmlnode and add it to the - * already created xmlnode tree. - * - * @param userdata pointer to the parent xmlnode instance (NULL if this function is called for the root note) - * @param name name of the starting element - * @param atts attributes that are contained in the start element - */ -void expat_startElement(void* userdata, const char* name, const char** atts) -{ - /* get the xmlnode pointed to by the userdata */ - xmlnode *x = userdata; - xmlnode current = *x; - - if (current == NULL) - { - /* allocate a base node */ - current = xmlnode_new_tag(name); - xmlnode_put_expat_attribs(current, atts); - *x = current; - } - else - { - *x = xmlnode_insert_tag(current, name); - xmlnode_put_expat_attribs(*x, atts); - } -} - -/** - * callback function used for end elements - * - * This function is used internally by expat.c as a callback function - * given to expat. It will complete an xmlnode and update the userdata pointer - * to point to the node that is parent of the next starting element. - * - * @param userdata pointer to the current xmlnode - * @param name name of the ending element (ignored by this function) - */ -void expat_endElement(void* userdata, const char* name) -{ - xmlnode *x = userdata; - xmlnode current = *x; - - current->complete = 1; - current = xmlnode_get_parent(current); - - /* if it's NULL we've hit the top folks, otherwise back up a level */ - if(current != NULL) - *x = current; -} - -/** - * callback function for CDATA nodes - * - * This function will insert CDATA in an xmlnode - * - * @param userdata pointer to the current xmlnode - * @param s pointer to the CDATA string (not zero terminated!) - * @param len length of the CDATA string - */ -void expat_charData(void* userdata, const char* s, int len) -{ - xmlnode *x = userdata; - xmlnode current = *x; - - xmlnode_insert_cdata(current, s, len); -} - -/** - * create an xmlnode instance (possibly including other xmlnode instances) by parsing a string - * - * This function will parse a string containing an XML document and create an xmlnode graph - * - * @param str the string containing the XML document (not necessarily zero terminated) - * @param len the length of the string (without the zero byte, if present) - * @return the graph of xmlnodes that represent the parsed document, NULL on failure - */ -xmlnode xmlnode_str(char *str, int len) -{ - XML_Parser p; - xmlnode *x, node; /* pointer to an xmlnode */ - - if(NULL == str) - return NULL; - - x = malloc(sizeof(void *)); - - *x = NULL; /* pointer to NULL */ - p = XML_ParserCreate(NULL); - XML_SetUserData(p, x); - XML_SetElementHandler(p, expat_startElement, expat_endElement); - XML_SetCharacterDataHandler(p, expat_charData); - if(!XML_Parse(p, str, len, 1)) - { - /* jdebug(ZONE,"xmlnode_str_error: %s",(char *)XML_ErrorString(XML_GetErrorCode(p)));*/ - xmlnode_free(*x); - *x = NULL; - } - node = *x; - free(x); - XML_ParserFree(p); - return node; /* return the xmlnode x points to */ -} - -/** - * create an xmlnode instance (possibly including other xmlnode instances) by parsing a file - * - * This function will parse a file containing an XML document and create an xmlnode graph - * - * @param file the filename - * @return the graph of xmlnodes that represent the parsed document, NULL on failure - */ -xmlnode xmlnode_file(char *file) -{ - XML_Parser p; - xmlnode *x, node; /* pointer to an xmlnode */ - char buf[BUFSIZ]; - int done, fd, len; - - if(NULL == file) - return NULL; - - fd = open(file,O_RDONLY); - if(fd < 0) - return NULL; - - x = malloc(sizeof(void *)); - - *x = NULL; /* pointer to NULL */ - p = XML_ParserCreate(NULL); - XML_SetUserData(p, x); - XML_SetElementHandler(p, expat_startElement, expat_endElement); - XML_SetCharacterDataHandler(p, expat_charData); - do{ - len = read(fd, buf, BUFSIZ); - done = len < BUFSIZ; - if(!XML_Parse(p, buf, len, done)) - { - /* jdebug(ZONE,"xmlnode_file_parseerror: %s",(char *)XML_ErrorString(XML_GetErrorCode(p)));*/ - xmlnode_free(*x); - *x = NULL; - done = 1; - } - }while(!done); - - node = *x; - XML_ParserFree(p); - free(x); - close(fd); - return node; /* return the xmlnode x points to */ -} - -/** - * write an xmlnode to a file (without a size limit) - * - * @param file the target file - * @param node the xmlnode that should be written - * @return 1 on success, -1 on failure - */ -int xmlnode2file(char *file, xmlnode node) -{ - return xmlnode2file_limited(file, node, 0); -} - -/** - * write an xmlnode to a file, limited by size - * - * @param file the target file - * @param node the xmlnode that should be written - * @param sizelimit the maximum length of the file to be written - * @return 1 on success, 0 if failed due to size limit, -1 on failure - */ -int xmlnode2file_limited(char *file, xmlnode node, size_t sizelimit) -{ - char *doc, *ftmp; - int fd, i; - size_t doclen; - - if(file == NULL || node == NULL) - return -1; - - ftmp = spools(xmlnode_pool(node),file,".t.m.p",xmlnode_pool(node)); - fd = open(ftmp, O_CREAT | O_WRONLY | O_TRUNC, 0600); - if(fd < 0) - return -1; - - doc = xmlnode2str(node); - doclen = strlen(doc); - - if (sizelimit > 0 && doclen > sizelimit) - { - close(fd); - return 0; - } - - i = write(fd,doc,doclen); - if(i < 0) - return -1; - - close(fd); - - if(rename(ftmp,file) < 0) - { - unlink(ftmp); - return -1; - } - return 1; -} - -/** - * append attributes in the expat format to an existing xmlnode - * - * @param owner where to add the attributes - * @param atts the attributes in expat format (even indexes are the attribute names, odd indexes the values) - */ -void xmlnode_put_expat_attribs(xmlnode owner, const char** atts) -{ - int i = 0; - if (atts == NULL) return; - while (atts[i] != '\0') - { - xmlnode_put_attrib(owner, atts[i], atts[i+1]); - i += 2; - } -}
--- a/mcabber/libjabber/genhash.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,501 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyrights - * - * Portions created by or assigned to Jabber.com, Inc. are - * Copyright (c) 1999-2002 Jabber.com, Inc. All Rights Reserved. Contact - * information for Jabber.com, Inc. is available at http://www.jabber.com/. - * - * Portions Copyright (c) 1998-1999 Jeremie Miller. - * - * Acknowledgements - * - * Special thanks to the Jabber Open Source Contributors for their - * suggestions and support of Jabber. - * - */ -#include <libxode.h> - -/***************************************************************************** - * Internal type definitions - */ - -typedef struct tagHNODE -{ - struct tagHNODE *next; /* next node in list */ - const void *key; /* key pointer */ - void *value; /* value pointer */ -} HNODE; - -#define SLAB_NUM_NODES 64 /* allocate this many nodes per slab */ - -typedef struct tagHSLAB -{ - struct tagHSLAB *next; /* next slab pointer */ - HNODE nodes[SLAB_NUM_NODES]; /* the actual nodes */ -} HSLAB; - -#define HASH_NUM_BUCKETS 509 /* should be a prime number; see Knuth */ - -typedef struct tagHASHTABLE_INTERNAL -{ - unsigned long sig1; /* first signature word */ - KEYHASHFUNC hash; /* hash function */ - KEYCOMPAREFUNC cmp; /* comparison function */ - int count; /* table entry count */ - int bcount; /* bucket count */ - HNODE **buckets; /* the hash buckets */ - unsigned long sig2; /* second signature word */ - -} HASHTABLE_INTERNAL; - -#define HASH_SIG1 0x68736148UL /* "Hash" */ -#define HASH_SIG2 0x6F627245UL /* "Erbo" */ - -#define do_hash(tb,key) ((*((tb)->hash))(key) % ((tb)->bcount)) - -static HNODE *s_free_nodes = NULL; /* free nodes list */ -static HSLAB *s_slabs = NULL; /* node slabs list */ - -/***************************************************************************** - * Internal functions - */ - -static HNODE *allocate_node( - const void *key, /* key pointer for this node */ - void *value) /* value pointer for this node */ -/* - allocate_node allocates a new hash node and fills it. Returns NULL if the - node could not be allocated. -*/ -{ - HNODE *rc; /* return from this function */ - - if (!s_free_nodes) - { /* allocate a new slabful of nodes and chain them to make a new free list */ - register int i; /* loop counter */ - HSLAB *slab = (HSLAB *)malloc(sizeof(HSLAB)); - if (!slab) - return NULL; - memset(slab,0,sizeof(HSLAB)); - slab->next = s_slabs; - for (i=0; i<(SLAB_NUM_NODES-1); i++) - slab->nodes[i].next = &(slab->nodes[i+1]); - s_free_nodes = &(slab->nodes[0]); - s_slabs = slab; - - } /* end if */ - - /* grab a node off the fron of the free list and fill it */ - rc = s_free_nodes; - s_free_nodes = rc->next; - rc->next = NULL; - rc->key = key; - rc->value = value; - return rc; - -} /* end allocate_node */ - -static void free_node( - HNODE *node) /* node to be freed */ -/* - free_node returns a hash node to the list. -*/ -{ - /* zap the node contents to avoid problems later */ - memset(node,0,sizeof(HNODE)); - - /* chain it onto the free list */ - node->next = s_free_nodes; - s_free_nodes = node; - -} /* end free_node */ - -static HNODE *find_node( - HASHTABLE_INTERNAL *tab, /* pointer to hash table */ - const void *key, /* key value to look up */ - int bucket) /* bucket number (-1 to have function compute it) */ -/* - find_node walks a hash bucket to find a node whose key matches the named key value. - Returns the node pointer, or NULL if it's not found. -*/ -{ - register HNODE *p; /* search pointer/return from this function */ - - if (bucket<0) /* compute hash value if we don't know it already */ - bucket = do_hash(tab,key); - - /* search through the bucket contents */ - for (p=tab->buckets[bucket]; p; p=p->next) - if ((*(tab->cmp))(key,p->key)==0) - return p; /* found! */ - - return NULL; /* not found */ - -} /* end find_node */ - -static HASHTABLE_INTERNAL *handle2ptr( - HASHTABLE tbl) /* hash table handle */ -/* - handle2ptr converts a hash table handle into a pointer and checks its signatures - to make sure someone's not trying to pull a whizzer on this module. -*/ -{ - register HASHTABLE_INTERNAL *rc = (HASHTABLE_INTERNAL *)tbl; - if ((rc->sig1==HASH_SIG1) && (rc->sig2==HASH_SIG2)) - return rc; /* signatures match */ - else - return NULL; /* yIkes! */ -} - -/***************************************************************************** - * External functions - */ - -HASHTABLE ghash_create(int buckets, KEYHASHFUNC hash, KEYCOMPAREFUNC cmp) -/* - Description: - Creates a new hash table. - - Input: - Parameters: - buckets - Number of buckets to allocate for the hash table; this value - should be a prime number for maximum efficiency. - hash - Key hash code function to use. - cmp - Key comparison function to use. - - Output: - Returns: - NULL - Table could not be allocated. - Other - Handle to the new hashtable. -*/ -{ - HASHTABLE_INTERNAL *tab; /* new table structure */ - char *allocated; - - if (!hash || !cmp) - return NULL; /* bogus! */ - - if (buckets<=0) - buckets = HASH_NUM_BUCKETS; - - /* allocate a hash table structure */ - allocated = malloc(sizeof(HASHTABLE_INTERNAL) + (buckets * sizeof(HNODE *))); - if (!allocated) - return NULL; /* memory error */ - - /* fill the fields of the hash table */ - tab = (HASHTABLE_INTERNAL *)allocated; - allocated += sizeof(HASHTABLE_INTERNAL); - memset(tab,0,sizeof(HASHTABLE_INTERNAL)); - memset(allocated,0,buckets * sizeof(HNODE *)); - tab->sig1 = HASH_SIG1; - tab->hash = hash; - tab->cmp = cmp; - tab->bcount = buckets; - tab->buckets = (HNODE **)allocated; - tab->sig2 = HASH_SIG2; - - return (HASHTABLE)tab; /* Qa'pla! */ - -} /* end ghash_create */ - -void ghash_destroy(HASHTABLE tbl) -/* - Description: - Destroys a hash table. - - Input: - Parameters: - tbl - Table to be destroyed. - - Output: - Returns: - Nothing. -*/ -{ - HASHTABLE_INTERNAL *tab; /* new table structure */ - int i; /* loop counter */ - HNODE *p, *p2; /* temporary pointers */ - - if (!tbl) - return; /* bogus! */ - - /* Convert the handle to a table pointer. */ - tab = handle2ptr(tbl); - if (!tab) - return; - - /* Nuke the nodes it contains. */ - for (i=0; i<tab->bcount; i++) - { /* free the contents of each bucket */ - p = tab->buckets[i]; - while (p) - { /* free each node in turn */ - p2 = p->next; - free_node(p); - p = p2; - - } /* end while */ - - } /* end for */ - - free(tab); /* bye bye now! */ - -} /* end ghash_destroy */ - -void *ghash_get(HASHTABLE tbl, const void *key) -/* - Description: - Retrieves a value stored in the hash table. - - Input: - Parameters: - tbl - The hash table to look in. - key - The key value to search on. - - Output: - Returns: - NULL - Value not found. - Other - Value corresponding to the specified key. -*/ -{ - HASHTABLE_INTERNAL *tab; /* internal table pointer */ - HNODE *node; /* hash node */ - void *rc = NULL; /* return from this function */ - - if (!tbl || !key) - return NULL; /* bogus! */ - - /* Convert the handle to a table pointer. */ - tab = handle2ptr(tbl); - if (!tab) - return NULL; /* error */ - - /* Attempt to find the node. */ - node = find_node(tab,key,-1); - if (node) - rc = node->value; /* found it! */ - - return rc; - -} /* end ghash_get */ - -int ghash_put(HASHTABLE tbl, const void *key, void *value) -/* - Description: - Associates a key with a value in this hash table. - - Input: - Parameters: - tbl - Hash table to add. - key - Key to use for the value in the table. - value - Value to add for this key. - - Output: - Returns: - 1 - Success. - 0 - Failure. - - Notes: - If the specified key is already in the hashtable, its value will be replaced. -*/ -{ - HASHTABLE_INTERNAL *tab; /* internal table pointer */ - int bucket; /* bucket value goes into */ - HNODE *node; /* hash node */ - int rc = 1; /* return from this function */ - - if (!tbl || !key || !value) - return 0; /* bogus! */ - - /* Convert the handle to a table pointer. */ - tab = handle2ptr(tbl); - if (!tab) - return 0; /* error */ - - - /* Compute the hash bucket and try to find an existing node. */ - bucket = do_hash(tab,key); - node = find_node(tab,key,bucket); - if (!node) - { /* OK, try to allocate a new node. */ - node = allocate_node(key,value); - if (node) - { /* Chain the new node into the hash table. */ - node->next = tab->buckets[bucket]; - tab->buckets[bucket] = node; - tab->count++; - - } /* end if */ - else /* allocation error */ - rc = 0; - - } /* end if */ - else /* already in table - just reassign value */ - node->value = value; - - return rc; - -} /* end ghash_put */ - -int ghash_remove(HASHTABLE tbl, const void *key) -/* - Description: - Removes an entry from a hash table, given its key. - - Input: - Parameters: - tbl - Hash table to remove from. - key - Key of value to remove. - - Output: - Returns: - 1 - Success. - 0 - Failure; key not present in hash table. -*/ -{ - HASHTABLE_INTERNAL *tab; /* internal table pointer */ - int bucket; /* bucket value goes into */ - HNODE *node; /* hash node */ - register HNODE *p; /* removal pointer */ - int rc = 1; /* return from this function */ - - if (!tbl || !key) - return 0; /* bogus! */ - - /* Convert the handle to a table pointer. */ - tab = handle2ptr(tbl); - if (!tab) - return 0; /* error */ - - - /* Compute the hash bucket and try to find an existing node. */ - bucket = do_hash(tab,key); - node = find_node(tab,key,bucket); - if (node) - { /* look to unchain it from the bucket it's in */ - if (node==tab->buckets[bucket]) - tab->buckets[bucket] = node->next; /* unchain at head */ - else - { /* unchain in middle of list */ - for (p=tab->buckets[bucket]; p->next!=node; p=p->next) ; - p->next = node->next; - - } /* end else */ - - free_node(node); /* bye bye now! */ - tab->count--; - - } /* end if */ - else /* node not found */ - rc = 0; - - return rc; - -} /* end ghash_remove */ - -int ghash_walk(HASHTABLE tbl, TABLEWALKFUNC func, void *user_data) -/* - Description: - "Walks" through a hash table, calling a callback function for each element - stored in it. - - Input: - Parameters: - tbl - Hash table to walk. - func - Function to be called for each node. It takes three parameters, - a user data pointer, a key value pointer, and a data value pointer. - It returns 0 to stop the enumeration or 1 to keep it going. - user_data - Value to use as the first parameter for the callback - function. - - Output: - Returns: - 0 - Error occurred. - Other - Number of nodes visited up to and including the one for which - the callback function returned 0, if it did; ranges from 1 - to the number of nodes in the hashtable. -*/ -{ - HASHTABLE_INTERNAL *tab; /* internal table pointer */ - int i; /* loop counter */ - int running = 1; /* we're still running */ - int count = 0; /* number of nodes visited before stop node */ - register HNODE *p, *p2; /* loop pointer */ - - if (!tbl || !func) - return -1; /* bogus values! */ - - /* Convert the handle to a table pointer. */ - tab = handle2ptr(tbl); - if (!tab) - return -1; /* error */ - - - for (i=0; running && (i<tab->bcount); i++) - { /* visit the contents of each bucket */ - p = tab->buckets[i]; - while (running && p) - { /* visit each node in turn */ - p2 = p->next; - count++; - running = (*func)(user_data,p->key,p->value); - p = p2; - - } /* end while */ - - } /* end for */ - - return count; - -} /* end ghash_walk */ - -int str_hash_code(const char *s) -/* - Description: - Generates a hash code for a string. This function uses the ELF hashing - algorithm as reprinted in Andrew Binstock, "Hashing Rehashed," _Dr. - Dobb's Journal_, April 1996. - - Input: - Parameters: - s - The string to be hashed. - - Output: - Returns: - A hash code for the string. -*/ -{ - /* ELF hash uses unsigned chars and unsigned arithmetic for portability */ - const unsigned char *name = (const unsigned char *)s; - unsigned long h = 0, g; - - if (!name) - return 0; /* anti-NULL guard not in the original */ - - while (*name) - { /* do some fancy bitwanking on the string */ - h = (h << 4) + (unsigned long)(*name++); - if ((g = (h & 0xF0000000UL))!=0) - h ^= (g >> 24); - h &= ~g; - - } /* end while */ - - return (int)h; - -}
--- a/mcabber/libjabber/hashtable.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (the "License"); you may not use this file except in -csompliance with the License. You may obtain a copy of the License at -http://www.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is expat. - -The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998, 1999 -James Clark. All Rights Reserved. - -Contributor(s): - -Alternatively, the contents of this file may be used under the terms -of the GNU General Public License (the "GPL"), in which case the -provisions of the GPL are applicable instead of those above. If you -wish to allow use of your version of this file only under the terms of -the GPL and not to allow others to use your version of this file under -the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the -GPL. If you do not delete the provisions above, a recipient may use -your version of this file under either the MPL or the GPL. -*/ - -#include "xmldef.h" - -#ifdef XML_UNICODE_WCHAR_T -#ifndef XML_UNICODE -#define XML_UNICODE -#endif -#endif - -#include "hashtable.h" - -#define INIT_SIZE 64 - -static -int keyeq(KEY s1, KEY s2) -{ - for (; *s1 == *s2; s1++, s2++) - if (*s1 == 0) - return 1; - return 0; -} - -static -unsigned long hash(KEY s) -{ - unsigned long h = 0; - while (*s) - h = (h << 5) + h + (unsigned char)*s++; - return h; -} - -NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize) -{ - size_t i; - if (table->size == 0) { - if (!createSize) - return 0; - table->v = calloc(INIT_SIZE, sizeof(NAMED *)); - if (!table->v) - return 0; - table->size = INIT_SIZE; - table->usedLim = INIT_SIZE / 2; - i = hash(name) & (table->size - 1); - } - else { - unsigned long h = hash(name); - for (i = h & (table->size - 1); - table->v[i]; - i == 0 ? i = table->size - 1 : --i) { - if (keyeq(name, table->v[i]->name)) - return table->v[i]; - } - if (!createSize) - return 0; - if (table->used == table->usedLim) { - /* check for overflow */ - size_t newSize = table->size * 2; - NAMED **newV = calloc(newSize, sizeof(NAMED *)); - if (!newV) - return 0; - for (i = 0; i < table->size; i++) - if (table->v[i]) { - size_t j; - for (j = hash(table->v[i]->name) & (newSize - 1); - newV[j]; - j == 0 ? j = newSize - 1 : --j) - ; - newV[j] = table->v[i]; - } - free(table->v); - table->v = newV; - table->size = newSize; - table->usedLim = newSize/2; - for (i = h & (table->size - 1); - table->v[i]; - i == 0 ? i = table->size - 1 : --i) - ; - } - } - table->v[i] = calloc(1, createSize); - if (!table->v[i]) - return 0; - table->v[i]->name = name; - (table->used)++; - return table->v[i]; -} - -void hashTableDestroy(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) { - NAMED *p = table->v[i]; - if (p) - free(p); - } - free(table->v); -} - -void hashTableInit(HASH_TABLE *p) -{ - p->size = 0; - p->usedLim = 0; - p->used = 0; - p->v = 0; -} - -void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) -{ - iter->p = table->v; - iter->end = iter->p + table->size; -} - -NAMED *hashTableIterNext(HASH_TABLE_ITER *iter) -{ - while (iter->p != iter->end) { - NAMED *tem = *(iter->p)++; - if (tem) - return tem; - } - return 0; -} -
--- a/mcabber/libjabber/hashtable.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (the "License"); you may not use this file except in -compliance with the License. You may obtain a copy of the License at -http://www.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is expat. - -The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998, 1999 -James Clark. All Rights Reserved. - -Contributor(s): - -Alternatively, the contents of this file may be used under the terms -of the GNU General Public License (the "GPL"), in which case the -provisions of the GPL are applicable instead of those above. If you -wish to allow use of your version of this file only under the terms of -the GPL and not to allow others to use your version of this file under -the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the -GPL. If you do not delete the provisions above, a recipient may use -your version of this file under either the MPL or the GPL. -*/ - - -#include <stddef.h> - -#ifdef XML_UNICODE - -#ifdef XML_UNICODE_WCHAR_T -typedef const wchar_t *KEY; -#else /* not XML_UNICODE_WCHAR_T */ -typedef const unsigned short *KEY; -#endif /* not XML_UNICODE_WCHAR_T */ - -#else /* not XML_UNICODE */ - -typedef const char *KEY; - -#endif /* not XML_UNICODE */ - -typedef struct { - KEY name; -} NAMED; - -typedef struct { - NAMED **v; - size_t size; - size_t used; - size_t usedLim; -} HASH_TABLE; - -NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize); -void hashTableInit(HASH_TABLE *); -void hashTableDestroy(HASH_TABLE *); - -typedef struct { - NAMED **p; - NAMED **end; -} HASH_TABLE_ITER; - -void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); -NAMED *hashTableIterNext(HASH_TABLE_ITER *);
--- a/mcabber/libjabber/iasciitab.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (the "License"); you may not use this file except in -compliance with the License. You may obtain a copy of the License at -http://www.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is expat. - -The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998, 1999 -James Clark. All Rights Reserved. - -Contributor(s): - -Alternatively, the contents of this file may be used under the terms -of the GNU General Public License (the "GPL"), in which case the -provisions of the GPL are applicable instead of those above. If you -wish to allow use of your version of this file only under the terms of -the GPL and not to allow others to use your version of this file under -the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the -GPL. If you do not delete the provisions above, a recipient may use -your version of this file under either the MPL or the GPL. -*/ - -/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
--- a/mcabber/libjabber/jabber.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,403 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Jabber - * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/ - */ - -#include <string.h> -#include <stdlib.h> -#include <sys/types.h> -#include <stdio.h> -#include <setjmp.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -#include <signal.h> -#include <stdarg.h> -#include <syslog.h> -#include <strings.h> -#include <unistd.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <arpa/inet.h> -#include <ctype.h> -#include <time.h> - -#include "libxode.h" -#include "../connwrap/connwrap.h" - -#ifndef INCL_JABBER_H -#define INCL_JABBER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* --------------------------------------------------------- */ -/* */ -/* JID structures & constants */ -/* */ -/* --------------------------------------------------------- */ -#define JID_RESOURCE 1 -#define JID_USER 2 -#define JID_SERVER 4 - -typedef struct jid_struct -{ - pool p; - char* resource; - char* user; - char* server; - char* full; - struct jid_struct *next; /* for lists of jids */ -} *jid; - -jid jid_new(pool p, char *idstr); /* Creates a jabber id from the idstr */ - -void jid_set(jid id, char *str, int item); /* Individually sets jid components */ -char* jid_full(jid id); /* Builds a string type=user/resource@server from the jid data */ -int jid_cmp(jid a, jid b); /* Compares two jid's, returns 0 for perfect match */ -int jid_cmpx(jid a, jid b, int parts); /* Compares just the parts specified as JID_|JID_ */ -jid jid_append(jid a, jid b); /* Appending b to a (list), no dups */ -xmlnode jid_xres(jid id); /* Returns xmlnode representation of the resource?query=string */ -xmlnode jid_nodescan(jid id, xmlnode x); /* Scans the children of the node for a matching jid attribute */ -jid jid_user(jid a); /* returns the same jid but just of the user@host part */ - - -/* --------------------------------------------------------- */ -/* */ -/* JPacket structures & constants */ -/* */ -/* --------------------------------------------------------- */ -#define JPACKET_UNKNOWN 0x00 -#define JPACKET_MESSAGE 0x01 -#define JPACKET_PRESENCE 0x02 -#define JPACKET_IQ 0x04 -#define JPACKET_S10N 0x08 - -#define JPACKET__UNKNOWN 0 -#define JPACKET__NONE 1 -#define JPACKET__ERROR 2 -#define JPACKET__CHAT 3 -#define JPACKET__GROUPCHAT 4 -#define JPACKET__GET 5 -#define JPACKET__SET 6 -#define JPACKET__RESULT 7 -#define JPACKET__SUBSCRIBE 8 -#define JPACKET__SUBSCRIBED 9 -#define JPACKET__UNSUBSCRIBE 10 -#define JPACKET__UNSUBSCRIBED 11 -#define JPACKET__AVAILABLE 12 -#define JPACKET__UNAVAILABLE 13 -#define JPACKET__PROBE 14 -#define JPACKET__HEADLINE 15 -#define JPACKET__INVISIBLE 16 - -typedef struct jpacket_struct -{ - unsigned char type; /**< stanza type (JPACKET_*) */ - int subtype; /**< subtype of a stanza */ - int flag; /**< used by the session manager to flag messages, that are read from offline storage */ - void* aux1; /**< pointer to data passed around with a jpacket, multiple use inside jsm */ - xmlnode x; /**< xmlnode containing the stanza inside the jpacket */ - jid to; /**< destination of the stanza */ - jid from; /**< source address for the stanza */ - char* iqns; /**< pointer to the namespace inside an IQ stanza */ - xmlnode iq; /**< "content" of an iq stanza, pointer to the element in its own namespace */ - pool p; /**< memory pool used for this stanza */ -} *jpacket, _jpacket; - -jpacket jpacket_new(xmlnode x); /* Creates a jabber packet from the xmlnode */ -jpacket jpacket_reset(jpacket p); /* Resets the jpacket values based on the xmlnode */ -int jpacket_subtype(jpacket p); /* Returns the subtype value (looks at xmlnode for it) */ - - -/* --------------------------------------------------------- */ -/* */ -/* Presence Proxy DB structures & constants */ -/* */ -/* --------------------------------------------------------- */ -typedef struct ppdb_struct -{ - jid id; /* entry data */ - int pri; - xmlnode x; - struct ppdb_struct* user; /* linked list for user@server */ - pool p; /* db-level data */ - struct ppdb_struct* next; -} _ppdb, *ppdb; - -ppdb ppdb_insert(ppdb db, jid id, xmlnode x); /* Inserts presence into the proxy */ -xmlnode ppdb_primary(ppdb db, jid id); /* Fetches the matching primary presence for the id */ -void ppdb_free(ppdb db); /* Frees the db and all entries */ -xmlnode ppdb_get(ppdb db, jid id); /* Called successively to return each presence xmlnode */ - /* for the id and children, returns NULL at the end */ - - -/* --------------------------------------------------------- */ -/* */ -/* Simple Jabber Rate limit functions */ -/* */ -/* --------------------------------------------------------- */ -typedef struct jlimit_struct -{ - char *key; - int start; - int points; - int maxt, maxp; - pool p; -} *jlimit, _jlimit; - -jlimit jlimit_new(int maxt, int maxp); -void jlimit_free(jlimit r); -int jlimit_check(jlimit r, char *key, int points); - - -/* --------------------------------------------------------- */ -/* */ -/* Error structures & constants */ -/* */ -/* --------------------------------------------------------- */ -typedef struct terror_struct -{ - int code; - char msg[64]; -} terror; - -#define TERROR_BAD (terror){400,"Bad Request"} -#define TERROR_AUTH (terror){401,"Unauthorized"} -#define TERROR_PAY (terror){402,"Payment Required"} -#define TERROR_FORBIDDEN (terror){403,"Forbidden"} -#define TERROR_NOTFOUND (terror){404,"Not Found"} -#define TERROR_NOTALLOWED (terror){405,"Not Allowed"} -#define TERROR_NOTACCEPTABLE (terror){406,"Not Acceptable"} -#define TERROR_REGISTER (terror){407,"Registration Required"} -#define TERROR_REQTIMEOUT (terror){408,"Request Timeout"} -#define TERROR_CONFLICT (terror){409,"Conflict"} - -#define TERROR_INTERNAL (terror){500,"Internal Server Error"} -#define TERROR_NOTIMPL (terror){501,"Not Implemented"} -#define TERROR_EXTERNAL (terror){502,"Remote Server Error"} -#define TERROR_UNAVAIL (terror){503,"Service Unavailable"} -#define TERROR_EXTTIMEOUT (terror){504,"Remote Server Timeout"} -#define TERROR_DISCONNECTED (terror){510,"Disconnected"} - -/* we define this to signal that we support xterror */ -#define HAS_XTERROR - -typedef struct xterror_struct -{ - int code; - char msg[256]; - char type[9]; - char condition[64]; -} xterror; - -#define XTERROR_BAD (xterror){400,"Bad Request","modify","bad-request"} -#define XTERROR_CONFLICT (xterror){409,"Conflict","cancel","conflict"} -#define XTERROR_NOTIMPL (xterror){501,"Not Implemented","cancel","feature-not-implemented"} -#define XTERROR_FORBIDDEN (xterror){403,"Forbidden","auth","forbidden"} -#define XTERROR_GONE (xterror){302,"Gone","modify","gone"} -#define XTERROR_INTERNAL (xterror){500,"Internal Server Error","wait","internal-server-error"} -#define XTERROR_NOTFOUND (xterror){404,"Not Found","cancel","item-not-found"} -#define XTERROR_JIDMALFORMED (xterror){400,"Bad Request","modify","jid-malformed"} -#define XTERROR_NOTACCEPTABLE (xterror){406,"Not Acceptable","modify","not-acceptable"} -#define XTERROR_NOTALLOWED (xterror){405,"Not Allowed","cancel","not-allowed"} -#define XTERROR_AUTH (xterror){401,"Unauthorized","auth","not-authorized"} -#define XTERROR_PAY (xterror){402,"Payment Required","auth","payment-required"} -#define XTERROR_RECIPIENTUNAVAIL (xterror){404,"Receipient Is Unavailable","wait","recipient-unavailable"} -#define XTERROR_REDIRECT (xterror){302,"Redirect","modify","redirect"} -#define XTERROR_REGISTER (xterror){407,"Registration Required","auth","registration-required"} -#define XTERROR_REMOTENOTFOUND (xterror){404,"Remote Server Not Found","cancel","remote-server-not-found"} -#define XTERROR_REMOTETIMEOUT (xterror){504,"Remote Server Timeout","wait","remote-server-timeout"} -#define XTERROR_RESCONSTRAINT (xterror){500,"Resource Constraint","wait","resource-constraint"} -#define XTERROR_UNAVAIL (xterror){503,"Service Unavailable","cancel","service-unavailable"} -#define XTERROR_SUBSCRIPTIONREQ (xterror){407,"Subscription Required","auth","subscription-required"} -#define XTERROR_UNDEF_CANCEL (xterror){500,NULL,"cancel","undefined-condition"} -#define XTERROR_UNDEF_CONTINUE (xterror){500,NULL,"continue","undefined-condition"} -#define XTERROR_UNDEF_MODIFY (xterror){500,NULL,"modify","undefined-condition"} -#define XTERROR_UNDEF_AUTH (xterror){500,NULL,"auth","undefined-condition"} -#define XTERROR_UNDEF_WAIT (xterror){500,NULL,"wait","undefined-condition"} -#define XTERROR_UNEXPECTED (xterror){400,"Unexpected Request","wait","unexpected-request"} - -#define XTERROR_REQTIMEOUT (xterror){408,"Request Timeout","wait","remote-server-timeout"} -#define XTERROR_EXTERNAL (xterror){502,"Remote Server Error","wait","service-unavailable"} -#define XTERROR_EXTTIMEOUT (xterror){504,"Remote Server Timeout","wait","remote-server-timeout"} -#define XTERROR_DISCONNECTED (xterror){510,"Disconnected","cancel","service-unavailable"} - -/* --------------------------------------------------------- */ -/* */ -/* Namespace constants */ -/* */ -/* --------------------------------------------------------- */ -#define NSCHECK(x,n) (j_strcmp(xmlnode_get_attrib(x,"xmlns"),n) == 0) - -#define NS_CLIENT "jabber:client" -#define NS_SERVER "jabber:server" -#define NS_DIALBACK "jabber:server:dialback" -#define NS_AUTH "jabber:iq:auth" -#define NS_AUTH_CRYPT "jabber:iq:auth:crypt" -#define NS_REGISTER "jabber:iq:register" -#define NS_ROSTER "jabber:iq:roster" -#define NS_OFFLINE "jabber:x:offline" -#define NS_AGENT "jabber:iq:agent" -#define NS_AGENTS "jabber:iq:agents" -#define NS_DELAY "jabber:x:delay" -#define NS_VERSION "jabber:iq:version" -#define NS_TIME "jabber:iq:time" -#define NS_VCARD "vcard-temp" -#define NS_PRIVATE "jabber:iq:private" -#define NS_SEARCH "jabber:iq:search" -#define NS_OOB "jabber:iq:oob" -#define NS_XOOB "jabber:x:oob" -#define NS_ADMIN "jabber:iq:admin" -#define NS_FILTER "jabber:iq:filter" -#define NS_AUTH_0K "jabber:iq:auth:0k" -#define NS_BROWSE "jabber:iq:browse" -#define NS_EVENT "jabber:x:event" -#define NS_CONFERENCE "jabber:iq:conference" -#define NS_SIGNED "jabber:x:signed" -#define NS_ENCRYPTED "jabber:x:encrypted" -#define NS_GATEWAY "jabber:iq:gateway" -#define NS_LAST "jabber:iq:last" -#define NS_ENVELOPE "jabber:x:envelope" -#define NS_EXPIRE "jabber:x:expire" -#define NS_XHTML "http://www.w3.org/1999/xhtml" -#define NS_DISCO_INFO "http://jabber.org/protocol/disco#info" -#define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items" -#define NS_IQ_AUTH "http://jabber.org/features/iq-auth" -#define NS_REGISTER_FEATURE "http://jabber.org/features/iq-register" - -#define NS_CAPS "http://jabber.org/protocol/caps" -#define NS_CHATSTATES "http://jabber.org/protocol/chatstates" -#define NS_COMMANDS "http://jabber.org/protocol/commands" -#define NS_MUC "http://jabber.org/protocol/muc" - -#define NS_XDBGINSERT "jabber:xdb:ginsert" -#define NS_XDBNSLIST "jabber:xdb:nslist" - -#define NS_XMPP_STANZAS "urn:ietf:params:xml:ns:xmpp-stanzas" -#define NS_XMPP_TLS "urn:ietf:params:xml:ns:xmpp-tls" -#define NS_XMPP_STREAMS "urn:ietf:params:xml:ns:xmpp-streams" - -#define NS_XMPP_DELAY "urn:xmpp:delay" -#define NS_XMPP_TIME "urn:xmpp:time" -#define NS_PING "urn:xmpp:ping" - -#define NS_JABBERD_STOREDPRESENCE "http://jabberd.org/ns/storedpresence" -#define NS_JABBERD_HISTORY "http://jabberd.org/ns/history" - -/* --------------------------------------------------------- */ -/* */ -/* Message Types */ -/* */ -/* --------------------------------------------------------- */ -#define TMSG_NORMAL "normal" -#define TMSG_ERROR "error" -#define TMSG_CHAT "chat" -#define TMSG_GROUPCHAT "groupchat" -#define TMSG_HEADLINE "headline" - - -/* --------------------------------------------------------- */ -/* */ -/* JUtil functions */ -/* */ -/* --------------------------------------------------------- */ -xmlnode jutil_presnew(int type, char *to, char *status); /* Create a skeleton presence packet */ -xmlnode jutil_iqnew(int type, char *ns); /* Create a skeleton iq packet */ -xmlnode jutil_msgnew(char *type, char *to, char *subj, char *body); - /* Create a skeleton message packet */ -xmlnode jutil_header(char* xmlns, char* server); /* Create a skeleton stream packet */ -int jutil_priority(xmlnode x); /* Determine priority of this packet */ -void jutil_tofrom(xmlnode x); /* Swaps to/from fields on a packet */ -xmlnode jutil_iqresult(xmlnode x); /* Generate a skeleton iq/result, given a iq/query */ -char* jutil_timestamp(void); /* Get stringified timestamp */ -void jutil_error(xmlnode x, terror E); /* Append an <error> node to x */ -void jutil_delay(xmlnode msg, char *reason); /* Append a delay packet to msg */ -char* jutil_regkey(char *key, char *seed); /* pass a seed to generate a key, pass the key again to validate (returns it) */ - - -/* --------------------------------------------------------- */ -/* */ -/* JConn structures & functions */ -/* */ -/* --------------------------------------------------------- */ -#define JCONN_STATE_OFF 0 -#define JCONN_STATE_CONNECTED 1 -#define JCONN_STATE_ON 2 -#define JCONN_STATE_AUTH 3 -#define JCONN_STATE_CONNECTING 4 - -typedef struct jconn_struct -{ - /* Core structure */ - pool p; /* Memory allocation pool */ - int state; /* Connection state flag */ - int cw_state; /* Low level connection state flag */ - int fd; /* Connection file descriptor */ - char *server; /* The server we'll connect too */ - int port; - int ssl; - jid user; /* User info */ - char *pass; /* User passwd */ - - /* Stream stuff */ - int id; /* id counter for jab_getid() function */ - char idbuf[9]; /* temporary storage for jab_getid() */ - char *sid; /* stream id from server, for digest auth */ - XML_Parser parser; /* Parser instance */ - xmlnode current; /* Current node in parsing instance.. */ - - /* Event callback ptrs */ - void (*on_state)(struct jconn_struct *j, int state); - void (*on_packet)(struct jconn_struct *j, jpacket p); - void (*logger)(struct jconn_struct *j, int inout, const char *p); - -} *jconn, jconn_struct; - -typedef void (*jconn_state_h)(jconn j, int state); -typedef void (*jconn_packet_h)(jconn j, jpacket p); -typedef void (*jconn_logger)(jconn j, int inout, const char *p); - -jconn jab_new(char *user, char *pass, char *server, int port, int ssl); -void jab_delete(jconn j); -void jab_state_handler(jconn j, jconn_state_h h); -void jab_packet_handler(jconn j, jconn_packet_h h); -void jab_logger(jconn j, jconn_logger h); -void jab_start(jconn j); -void jab_stop(jconn j); - -int jab_getfd(jconn j); -jid jab_getjid(jconn j); -char *jab_getsid(jconn j); -char *jab_getid(jconn j); - -void jab_send(jconn j, xmlnode x); -void jab_send_raw(jconn j, const char *str); -void jab_recv(jconn j); -void jab_poll(jconn j, int timeout); - -char *jab_auth(jconn j); -int jab_auth_mcabber(jconn j, xmlnode x); -char *jab_reg(jconn j); - -#ifdef __cplusplus -} -#endif - -#endif /* INCL_JABBER_H */
--- a/mcabber/libjabber/jconn.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,601 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Jabber - * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/ - */ - -#include "jabber.h" -#include "connwrap.h" - -#include "../src/logprint.h" /* For logging */ - -/* local macros for launching event handlers */ -#define STATE_EVT(arg) if(j->on_state) { (j->on_state)(j, (arg) ); } - -/* prototypes of the local functions */ -static void startElement(void *userdata, const char *name, const char **attribs); -static void endElement(void *userdata, const char *name); -static void charData(void *userdata, const char *s, int slen); - -/* - * jab_new -- initialize a new jabber connection - * - * parameters - * user -- jabber id of the user - * pass -- password of the user - * - * results - * a pointer to the connection structure - * or NULL if allocations failed - */ -jconn jab_new(char *user, char *pass, char *server, int port, int ssl) -{ - pool p; - jconn j; - - if(!user) return(NULL); - - p = pool_new(); - if(!p) return(NULL); - j = pmalloc_x(p, sizeof(jconn_struct), 0); - if(!j) return(NULL); - j->p = p; - - j->user = jid_new(p, user); - j->pass = pstrdup(p, pass); - j->port = port; - j->server = server; - - j->state = JCONN_STATE_OFF; - j->cw_state = 0; - j->id = 1; - j->fd = -1; - j->ssl = ssl; - - return j; -} - -/* - * jab_delete -- free a jabber connection - * - * parameters - * j -- connection - * - */ -void jab_delete(jconn j) -{ - if(!j) return; - - jab_stop(j); - pool_free(j->p); -} - -/* - * jab_state_handler -- set callback handler for state change - * - * parameters - * j -- connection - * h -- name of the handler function - */ -void jab_state_handler(jconn j, jconn_state_h h) -{ - if(!j) return; - - j->on_state = h; -} - -/* - * jab_packet_handler -- set callback handler for incoming packets - * - * parameters - * j -- connection - * h -- name of the handler function - */ -void jab_packet_handler(jconn j, jconn_packet_h h) -{ - if(!j) return; - - j->on_packet = h; -} - -void jab_logger(jconn j, jconn_logger h) -{ - if(!j) return; - - j->logger = h; -} - - -/* - * jab_start -- start connection - * - * parameters - * j -- connection - * - */ -void jab_start(jconn j) -{ - xmlnode x; - char *t,*t2; - - if(!j || (j->state != JCONN_STATE_OFF && j->state != JCONN_STATE_CONNECTING) ) return; - - if (!(j->cw_state & CW_CONNECT_WANT_SOMETHING)) { /* same as state != JCONN_STATE_CONNECTING */ - j->parser = XML_ParserCreate(NULL); - XML_SetUserData(j->parser, (void *)j); - XML_SetElementHandler(j->parser, startElement, endElement); - XML_SetCharacterDataHandler(j->parser, charData); - - if (j->cw_state & CW_CONNECT_BLOCKING) - j->fd = make_netsocket(j->port, j->server, NETSOCKET_CLIENT, j->ssl); - else - j->fd = make_nb_netsocket(j->port, j->server, NETSOCKET_CLIENT, j->ssl, &j->cw_state); - - if(j->fd < 0) { - STATE_EVT(JCONN_STATE_OFF); - return; - } - } - else { /* subsequent calls to cw_nb_connect until it finishes negociation */ - if (cw_nb_connect(j->fd, 0, 0, j->ssl, &j->cw_state)) { - if (cw_get_ssl_error()) - scr_LogPrint(LPRINT_LOGNORM, "jab_start: SSL negotiation failed: %s", cw_get_ssl_error()); - STATE_EVT(JCONN_STATE_OFF); - return; - } - } - if (j->cw_state & CW_CONNECT_WANT_SOMETHING){ /* check if it finished negociation */ - j->state = JCONN_STATE_CONNECTING; - STATE_EVT(JCONN_STATE_CONNECTING); - return; - } - change_socket_to_blocking(j->fd); - - j->state = JCONN_STATE_CONNECTED; - STATE_EVT(JCONN_STATE_CONNECTED) - - /* start stream */ - x = jutil_header(NS_CLIENT, j->user->server); - t = xmlnode2str(x); - /* this is ugly, we can create the string here instead of jutil_header */ - /* what do you think about it? -madcat */ - t2 = strstr(t,"/>"); - *t2++ = '>'; - *t2 = '\0'; - jab_send_raw(j,"<?xml version='1.0'?>"); - jab_send_raw(j,t); - xmlnode_free(x); - - j->state = JCONN_STATE_ON; - STATE_EVT(JCONN_STATE_ON) - -} - -/* - * jab_stop -- stop connection - * - * parameters - * j -- connection - */ -void jab_stop(jconn j) -{ - if (!j) return; - if (j->parser) { - XML_ParserFree(j->parser); - j->parser = NULL; - } - j->state = JCONN_STATE_OFF; - if (j->fd >= 0) { - cw_close(j->fd); - j->fd = -1; - } -} - -/* - * jab_getfd -- get file descriptor of connection socket - * - * parameters - * j -- connection - * - * returns - * fd of the socket or -1 if socket was not connected - */ -int jab_getfd(jconn j) -{ - if(j) - return j->fd; - else - return -1; -} - -/* - * jab_getjid -- get jid structure of user - * - * parameters - * j -- connection - */ -jid jab_getjid(jconn j) -{ - if(j) - return(j->user); - else - return NULL; -} - -/* jab_getsid -- get stream id - * This is the id of server's <stream:stream> tag and used for - * digest authorization. - * - * parameters - * j -- connection - */ -char *jab_getsid(jconn j) -{ - if(j) - return(j->sid); - else - return NULL; -} - -/* - * jab_getid -- get a unique id - * - * parameters - * j -- connection - */ -char *jab_getid(jconn j) -{ - snprintf(j->idbuf, 8, "%d", j->id++); - return &j->idbuf[0]; -} - -/* - * jab_send -- send xml data - * - * parameters - * j -- connection - * x -- xmlnode structure - */ -void jab_send(jconn j, xmlnode x) -{ - if (j && j->state != JCONN_STATE_OFF) - { - char *buf = xmlnode2str(x); - if (buf) { - cw_write(j->fd, buf, strlen(buf), j->ssl); - if (j->logger) - (j->logger)(j, 0, buf); - } - -#ifdef JDEBUG - printf ("out: %s\n", buf); -#endif - } -} - -/* - * jab_send_raw -- send a string - * - * parameters - * j -- connection - * str -- xml string - */ -void jab_send_raw(jconn j, const char *str) -{ - if (j && j->state != JCONN_STATE_OFF) { - cw_write(j->fd, str, strlen(str), j->ssl); - - if (j->logger) - (j->logger)(j, 0, str); - } - -#ifdef JDEBUG - printf ("out: %s\n", str); -#endif -} - -/* - * jab_recv -- read and parse incoming data - * - * parameters - * j -- connection - */ -void jab_recv(jconn j) -{ - static char buf[32768]; - int len; - - if(!j || j->state == JCONN_STATE_OFF) - return; - - len = cw_read(j->fd, buf, sizeof(buf)-1, j->ssl); - if(len>0) - { - buf[len] = '\0'; - - if (j->logger) - (j->logger)(j, 1, buf); - -#ifdef JDEBUG - printf (" in: %s\n", buf); -#endif - XML_Parse(j->parser, buf, len, 0); - } - else if(len<=0) - { - STATE_EVT(JCONN_STATE_OFF); - jab_stop(j); - } -} - -/* - * jab_poll -- check socket for incoming data - * - * parameters - * j -- connection - * timeout -- poll timeout - */ -void jab_poll(jconn j, int timeout) -{ - fd_set fds; - struct timeval tv; - int r; - - if (!j || j->state == JCONN_STATE_OFF) - return; - - if (j->fd == -1) { - STATE_EVT(JCONN_STATE_OFF); - return; - } - - FD_ZERO(&fds); - FD_SET(j->fd, &fds); - - if(timeout <= 0) { - r = select(j->fd + 1, &fds, NULL, NULL, NULL); - - } else { - tv.tv_sec = 0; - tv.tv_usec = timeout; - r = select(j->fd + 1, &fds, NULL, NULL, &tv); - - } - - if(r > 0) { - jab_recv(j); - - } else if(r) { - /* Don't disconnect for interrupted system call */ - if(errno == EINTR) return; - - scr_LogPrint(LPRINT_LOGNORM, "jab_poll: select returned errno=%d", - errno); - STATE_EVT(JCONN_STATE_OFF); - jab_stop(j); - - } -} - -/* - * jab_auth -- authorize user - * - * parameters - * j -- connection - * - * returns - * id of the iq packet - */ -char *jab_auth(jconn j) -{ - xmlnode x,y,z; - char *hash, *user, *id; - - if(!j) return(NULL); - - x = jutil_iqnew(JPACKET__SET, NS_AUTH); - id = jab_getid(j); - xmlnode_put_attrib(x, "id", id); - y = xmlnode_get_tag(x,"query"); - - user = j->user->user; - - if (user) - { - z = xmlnode_insert_tag(y, "username"); - xmlnode_insert_cdata(z, user, -1); - } - - z = xmlnode_insert_tag(y, "resource"); - xmlnode_insert_cdata(z, j->user->resource, -1); - - if (j->sid) - { - z = xmlnode_insert_tag(y, "digest"); - hash = pmalloc(x->p, strlen(j->sid)+strlen(j->pass)+1); - strcpy(hash, j->sid); - strcat(hash, j->pass); - hash = shahash(hash); - xmlnode_insert_cdata(z, hash, 40); - } - else - { - z = xmlnode_insert_tag(y, "password"); - xmlnode_insert_cdata(z, j->pass, -1); - } - - jab_send(j, x); - xmlnode_free(x); - return id; -} - -/* - * jab_auth_mcabber -- authorize user - * - * parameters - * j -- connection - * x -- xmlnode iq packet - * - * returns - * non-zero in case of failure - */ -int jab_auth_mcabber(jconn j, xmlnode x) -{ - xmlnode y,z; - char *hash, *user; - - if(!j) return -1; - - y = xmlnode_get_tag(x, "query"); - - user = j->user->user; - - if (user) - { - z = xmlnode_insert_tag(y, "username"); - xmlnode_insert_cdata(z, user, -1); - } - - z = xmlnode_insert_tag(y, "resource"); - xmlnode_insert_cdata(z, j->user->resource, -1); - - if (j->sid) - { - z = xmlnode_insert_tag(y, "digest"); - hash = pmalloc(x->p, strlen(j->sid)+strlen(j->pass)+1); - strcpy(hash, j->sid); - strcat(hash, j->pass); - hash = shahash(hash); - xmlnode_insert_cdata(z, hash, 40); - } - else - { - z = xmlnode_insert_tag(y, "password"); - xmlnode_insert_cdata(z, j->pass, -1); - } - return 0; -} - -/* - * jab_reg -- register user - * - * parameters - * j -- connection - * - * returns - * id of the iq packet - */ -char *jab_reg(jconn j) -{ - xmlnode x,y,z; - char *user, *id; - - if (!j) return(NULL); - - x = jutil_iqnew(JPACKET__SET, NS_REGISTER); - id = jab_getid(j); - xmlnode_put_attrib(x, "id", id); - y = xmlnode_get_tag(x,"query"); - - user = j->user->user; - - if (user) - { - z = xmlnode_insert_tag(y, "username"); - xmlnode_insert_cdata(z, user, -1); - } - - z = xmlnode_insert_tag(y, "resource"); - xmlnode_insert_cdata(z, j->user->resource, -1); - - if (j->pass) - { - z = xmlnode_insert_tag(y, "password"); - xmlnode_insert_cdata(z, j->pass, -1); - } - - jab_send(j, x); - xmlnode_free(x); - j->state = JCONN_STATE_ON; - STATE_EVT(JCONN_STATE_ON) - return id; -} - - -/* local functions */ - -static void startElement(void *userdata, const char *name, const char **attribs) -{ - xmlnode x; - jconn j = (jconn)userdata; - - if(j->current) - { - /* Append the node to the current one */ - x = xmlnode_insert_tag(j->current, name); - xmlnode_put_expat_attribs(x, attribs); - - j->current = x; - } - else - { - x = xmlnode_new_tag(name); - xmlnode_put_expat_attribs(x, attribs); - if(strcmp(name, "stream:stream") == 0) { - /* special case: name == stream:stream */ - /* id attrib of stream is stored for digest auth */ - j->sid = xmlnode_get_attrib(x, "id"); - /* STATE_EVT(JCONN_STATE_AUTH) */ - } else { - j->current = x; - } - } -} - -static void endElement(void *userdata, const char *name) -{ - jconn j = (jconn)userdata; - xmlnode x; - jpacket p; - - if(j->current == NULL) { - /* we got </stream:stream> */ - STATE_EVT(JCONN_STATE_OFF) - return; - } - - x = xmlnode_get_parent(j->current); - - if(x == NULL) - { - /* it is time to fire the event */ - p = jpacket_new(j->current); - - if(j->on_packet) - (j->on_packet)(j, p); - xmlnode_free(j->current); - } - - j->current = x; -} - -static void charData(void *userdata, const char *s, int slen) -{ - jconn j = (jconn)userdata; - - if (j->current) - xmlnode_insert_cdata(j->current, s, slen); -}
--- a/mcabber/libjabber/jid.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,746 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Jabber - * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/ - */ - -/** - * @file jid.c - * @brief representation and normalization of JabberIDs - */ - -#include "jabber.h" - -#ifdef LIBIDN - -# include <stringprep.h> - - -/** - * @brief datastructure to build the stringprep caches - */ -typedef struct _jid_prep_entry_st { - char *preped; /**< the result of the preparation, NULL if unchanged */ - time_t last_used; /**< when this result has last been successfully used */ - unsigned int used_count; /**< how often this result has been successfully used */ - int size; /**< the min buffer size needed to hold the result (strlen+1) */ -} *_jid_prep_entry_t; - -/** - * @brief string preparation cache - */ -typedef struct _jid_prep_cache_st { - xht hashtable; /**< the hash table containing the preped strings */ - pth_mutex_t mutex; /**< mutex controling the access to the hashtable */ - const Stringprep_profile *profile; - /**< the stringprep profile used for this cache */ -} *_jid_prep_cache_t; - -/** - * stringprep cache containging already preped nodes - * - * we are using global caches here for two reasons: - * - I do not see why different instances would want - * to have different caches as we are always doing - * the same - * - For per instance caches I would have to modify the - * interface of the jid_*() functions which would break - * compatibility with transports - */ -_jid_prep_cache_t _jid_prep_cache_node = NULL; - -/** - * stringprep cache containing already preped domains - */ -_jid_prep_cache_t _jid_prep_cache_domain = NULL; - -/** - * stringprep cache containing already preped resources - */ -_jid_prep_cache_t _jid_prep_cache_resource = NULL; - -/** - * walker for cleaning up stringprep caches - * - * @param h the hash we are walking through - * @param key the key of this item - * @param val the value of this item - * @param arg delete entries older as this unix timestamp - */ -void _jid_clean_walker(xht h, const char *key, void *val, void *arg) { - time_t *keep_newer_as = (time_t*)arg; - _jid_prep_entry_t entry = (_jid_prep_entry_t)val; - - if (entry == NULL) - return; - - if (entry->last_used <= *keep_newer_as) { - xhash_zap(h, key); - if (entry->preped != NULL) - free(entry->preped); - free(entry); - - /* sorry, I have to cast the const away */ - /* any idea how I could delete the key else? */ - if (key != NULL) - free((void*)key); - } -} - -/** - * walk through a single stringprep cache and check which entries have expired - */ -void _jid_clean_single_cache(_jid_prep_cache_t cache, time_t keep_newer_as) { - /* acquire the lock on the cache */ - pth_mutex_acquire(&(cache->mutex), FALSE, NULL); - - /* walk over all entries */ - xhash_walk(cache->hashtable, _jid_clean_walker, (void*)&keep_newer_as); - - /* we're done, release the lock on the cache */ - pth_mutex_release(&(cache->mutex)); -} - -/** - * walk through the stringprep caches and check which entries have expired - */ -void jid_clean_cache() { - /* XXX make this configurable? */ - time_t keep_newer_as = time(NULL) - 900; - - /* cleanup the nodeprep cache */ - _jid_clean_single_cache(_jid_prep_cache_node, keep_newer_as); - - /* cleanup the domain preparation cache */ - _jid_clean_single_cache(_jid_prep_cache_domain, keep_newer_as); - - /* cleanup the resourceprep cache */ - _jid_clean_single_cache(_jid_prep_cache_resource, keep_newer_as); -} - -/** - * caching wrapper around a stringprep function - * - * @param in_out_buffer buffer containing what has to be stringpreped and that gets the result - * @param max_len size of the buffer - * @param cache the used cache, defining also the used stringprep profile - * @return the return code of the stringprep call - */ -int _jid_cached_stringprep(char *in_out_buffer, int max_len, _jid_prep_cache_t cache) { - _jid_prep_entry_t preped; - int result = STRINGPREP_OK; - - /* check that the cache already exists - * we can not do anything as we don't know which profile has to be used */ - if (cache == NULL) { - return STRINGPREP_UNKNOWN_PROFILE; - } - - /* is there something that has to be stringpreped? */ - if (in_out_buffer == NULL) { - return STRINGPREP_OK; - } - - /* acquire the lock on the cache */ - pth_mutex_acquire(&(cache->mutex), FALSE, NULL); - - /* check if the requested preparation has already been done */ - preped = (_jid_prep_entry_t)xhash_get(cache->hashtable, in_out_buffer); - if (preped != NULL) { - /* we already prepared this argument */ - if (preped->size <= max_len) { - /* we can use the result */ - - /* update the statistic */ - preped->used_count++; - preped->last_used = time(NULL); - - /* do we need to copy the result? */ - if (preped->preped != NULL) { - /* copy the result */ - strcpy(in_out_buffer, preped->preped); - } - - result = STRINGPREP_OK; - } else { - /* we need a bigger buffer */ - result = STRINGPREP_TOO_SMALL_BUFFER; - } - - /* we're done, release the lock on the cache */ - pth_mutex_release(&(cache->mutex)); - } else { - char *original; - - /* stringprep needs time, release the lock on the cache for the meantime */ - pth_mutex_release(&(cache->mutex)); - - /* we have to keep the key */ - original = strdup(in_out_buffer); - - /* try to prepare the string */ - result = stringprep(in_out_buffer, max_len, STRINGPREP_NO_UNASSIGNED, cache->profile); - - /* did we manage to prepare the string? */ - if (result == STRINGPREP_OK && original != NULL) { - /* generate an entry for the cache */ - preped = (_jid_prep_entry_t)malloc(sizeof(struct _jid_prep_entry_st)); - if (preped != NULL) { - /* has there been modified something? */ - if (j_strcmp(in_out_buffer, original) == 0) { - /* no, we don't need to store a copy of the original string */ - preped->preped = NULL; - } else { - /* yes, store the stringpreped string */ - preped->preped = strdup(in_out_buffer); - } - preped->last_used = time(NULL); - preped->used_count = 1; - preped->size = strlen(in_out_buffer)+1; - - /* acquire the lock on the cache again */ - pth_mutex_acquire(&(cache->mutex), FALSE, NULL); - - /* store the entry in the cache */ - xhash_put(cache->hashtable, original, preped); - - /* we're done, release the lock on the cache */ - pth_mutex_release(&(cache->mutex)); - } else { - /* we don't need the copy of the key, if there is no memory to store it */ - free(original); - } - } else { - /* we don't need the copy of the original value */ - if (original != NULL) - free(original); - } - } - - return result; -} - -/** - * free a single stringprep cache - * - * @param cache the cache to free - */ -void _jid_stop_single_cache(_jid_prep_cache_t *cache) { - if (*cache == NULL) - return; - - _jid_clean_single_cache(*cache, time(NULL)); - - pth_mutex_acquire(&((*cache)->mutex), FALSE, NULL); - xhash_free((*cache)->hashtable); - - free(*cache); - - *cache = NULL; -} - -/** - * init a single stringprep cache - * - * @param cache the cache to init - * @param prime the prime used to init the hashtable - * @param profile profile used to prepare the strings - */ -void _jid_init_single_cache(_jid_prep_cache_t *cache, int prime, const Stringprep_profile *profile) { - /* do not init a cache twice */ - if (*cache == NULL) { - *cache = (_jid_prep_cache_t)malloc(sizeof(struct _jid_prep_cache_st)); - pth_mutex_init(&((*cache)->mutex)); - (*cache)->hashtable = xhash_new(prime); - (*cache)->profile = profile; - } -} - -/** - * free the stringprep caches - */ -void jid_stop_caching() { - _jid_stop_single_cache(&_jid_prep_cache_node); - _jid_stop_single_cache(&_jid_prep_cache_domain); - _jid_stop_single_cache(&_jid_prep_cache_resource); -} - -/** - * init the stringprep caches - * (do not call this twice at the same time, we do not have the mutexes yet) - */ -void jid_init_cache() { - /* init the nodeprep cache */ - _jid_init_single_cache(&_jid_prep_cache_node, 2003, stringprep_xmpp_nodeprep); - - /* init the nameprep cache (domains) */ - _jid_init_single_cache(&_jid_prep_cache_domain, 2003, stringprep_nameprep); - - /* init the resourceprep cache */ - _jid_init_single_cache(&_jid_prep_cache_resource, 2003, stringprep_xmpp_resourceprep); -} - -/** - * nameprep the domain identifier in a JID and check if it is valid - * - * @param jid data structure holding the JID - * @return 0 if JID is valid, non zero otherwise - */ -int _jid_safe_domain(jid id) { - int result=0; - - /* there must be a domain identifier */ - if (j_strlen(id->server) == 0) - return 1; - - /* nameprep the domain identifier */ - result = _jid_cached_stringprep(id->server, strlen(id->server)+1, _jid_prep_cache_domain); - if (result == STRINGPREP_TOO_SMALL_BUFFER) { - /* nameprep wants to expand the string, e.g. conversion from ß to ss */ - size_t biggerbuffersize = 1024; - char *biggerbuffer = pmalloc(id->p, biggerbuffersize); - if (biggerbuffer == NULL) - return 1; - strcpy(biggerbuffer, id->server); - result = _jid_cached_stringprep(biggerbuffer, biggerbuffersize, _jid_prep_cache_domain); - id->server = biggerbuffer; - } - if (result != STRINGPREP_OK) - return 1; - - /* the namepreped domain must not be longer than 1023 bytes */ - if (j_strlen(id->server) > 1023) - return 1; - - /* if nothing failed, the domain is valid */ - return 0; -} - -/** - * nodeprep the node identifier in a JID and check if it is valid - * - * @param jid data structure holding the JID - * @return 0 if JID is valid, non zero otherwise - */ -int _jid_safe_node(jid id) { - int result=0; - - /* it is valid to have no node identifier in the JID */ - if (id->user == NULL) - return 0; - - /* nodeprep */ - result = _jid_cached_stringprep(id->user, strlen(id->user)+1, _jid_prep_cache_node); - if (result == STRINGPREP_TOO_SMALL_BUFFER) { - /* nodeprep wants to expand the string, e.g. conversion from ß to ss */ - size_t biggerbuffersize = 1024; - char *biggerbuffer = pmalloc(id->p, biggerbuffersize); - if (biggerbuffer == NULL) - return 1; - strcpy(biggerbuffer, id->user); - result = _jid_cached_stringprep(biggerbuffer, biggerbuffersize, _jid_prep_cache_node); - id->user = biggerbuffer; - } - if (result != STRINGPREP_OK) - return 1; - - /* the nodepreped node must not be longer than 1023 bytes */ - if (j_strlen(id->user) > 1023) - return 1; - - /* if nothing failed, the node is valid */ - return 0; -} - -/** - * resourceprep the resource identifier in a JID and check if it is valid - * - * @param jid data structure holding the JID - * @return 0 if JID is valid, non zero otherwise - */ -int _jid_safe_resource(jid id) { - int result=0; - - /* it is valid to have no resource identifier in the JID */ - if (id->resource == NULL) - return 0; - - /* resource prep the resource identifier */ - result = _jid_cached_stringprep(id->resource, strlen(id->resource)+1, _jid_prep_cache_resource); - if (result == STRINGPREP_TOO_SMALL_BUFFER) { - /* resourceprep wants to expand the string, e.g. conversion from ß to ss */ - size_t biggerbuffersize = 1024; - char *biggerbuffer = pmalloc(id->p, biggerbuffersize); - if (biggerbuffer == NULL) - return 1; - strcpy(biggerbuffer, id->resource); - result = _jid_cached_stringprep(id->resource, strlen(id->resource)+1, _jid_prep_cache_resource); - id->resource = biggerbuffer; - } - if (result != STRINGPREP_OK) - return 1; - - /* the resourcepreped node must not be longer than 1023 bytes */ - if (j_strlen(id->resource) > 1023) - return 1; - - /* if nothing failed, the resource is valid */ - return 0; - -} - -#else /* no LIBIDN */ - -/** - * check if the domain identifier in a JID is valid - * - * @param jid data structure holding the JID - * @return 0 if domain is valid, non zero otherwise - */ -int _jid_safe_domain(jid id) { - char *str; - - /* there must be a domain identifier */ - if (j_strlen(id->server) == 0) - return 1; - - /* and it must not be longer than 1023 bytes */ - if (strlen(id->server) > 1023) - return 1; - - /* lowercase the hostname, make sure it's valid characters */ - for(str = id->server; *str != '\0'; str++) - { - *str = tolower(*str); - if(!(isalnum(*str) || *str == '.' || *str == '-' || *str == '_')) return 1; - } - - /* otherwise it's okay as far as we can tell without LIBIDN */ - return 0; -} - -/** - * check if the node identifier in a JID is valid - * - * @param jid data structure holding the JID - * @return 0 if node is valid, non zero otherwise - */ -int _jid_safe_node(jid id) { - char *str; - - /* node identifiers may not be longer than 1023 bytes */ - if (j_strlen(id->user) > 1023) - return 1; - - /* check for low and invalid ascii characters in the username */ - if(id->user != NULL) - for(str = id->user; *str != '\0'; str++) - if(*str <= 32 || *str == ':' || *str == '@' || *str == '<' || *str == '>' || *str == '\'' || *str == '"' || *str == '&') return 1; - - /* otherwise it's okay as far as we can tell without LIBIDN */ - return 0; -} - -/** - * check if the resource identifier in a JID is valid - * - * @param jid data structure holding the JID - * @return 0 if resource is valid, non zero otherwise - */ -int _jid_safe_resource(jid id) { - /* resources may not be longer than 1023 bytes */ - if (j_strlen(id->resource) > 1023) - return 1; - - /* otherwise it's okay as far as we can tell without LIBIDN */ - return 0; -} - -#endif - -/** - * nodeprep/nameprep/resourceprep the JID and check if it is valid - * - * @param jid data structure holding the JID - * @return NULL if the JID is invalid, pointer to the jid otherwise - */ -jid jid_safe(jid id) -{ - if (_jid_safe_domain(id)) - return NULL; - if (_jid_safe_node(id)) - return NULL; - if (_jid_safe_resource(id)) - return NULL; - - return id; -} - -jid jid_new(pool p, char *idstr) -{ - char *server, *resource, *type, *str; - jid id; - - if(p == NULL || idstr == NULL || strlen(idstr) == 0) - return NULL; - - /* user@server/resource */ - - str = pstrdup(p, idstr); - - id = pmalloco(p,sizeof(struct jid_struct)); - id->p = p; - - resource = strstr(str,"/"); - if(resource != NULL) - { - *resource = '\0'; - ++resource; - if(strlen(resource) > 0) - id->resource = resource; - }else{ - resource = str + strlen(str); /* point to end */ - } - - type = strstr(str,":"); - if(type != NULL && type < resource) - { - *type = '\0'; - ++type; - str = type; /* ignore the type: prefix */ - } - - server = strstr(str,"@"); - if(server == NULL || server > resource) - { /* if there's no @, it's just the server address */ - id->server = str; - }else{ - *server = '\0'; - ++server; - id->server = server; - if(strlen(str) > 0) - id->user = str; - } - - return jid_safe(id); -} - -void jid_set(jid id, char *str, int item) -{ - char *old; - - if(id == NULL) - return; - - /* invalidate the cached copy */ - id->full = NULL; - - switch(item) - { - case JID_RESOURCE: - old = id->resource; - if(str != NULL && strlen(str) != 0) - id->resource = pstrdup(id->p, str); - else - id->resource = NULL; - if(_jid_safe_resource(id)) - id->resource = old; /* revert if invalid */ - break; - case JID_USER: - old = id->user; - if(str != NULL && strlen(str) != 0) - id->user = pstrdup(id->p, str); - else - id->user = NULL; - if(_jid_safe_node(id)) - id->user = old; /* revert if invalid */ - break; - case JID_SERVER: - old = id->server; - id->server = pstrdup(id->p, str); - if(_jid_safe_domain(id)) - id->server = old; /* revert if invalid */ - break; - } - -} - -char *jid_full(jid id) -{ - spool s; - - if(id == NULL) - return NULL; - - /* use cached copy */ - if(id->full != NULL) - return id->full; - - s = spool_new(id->p); - - if(id->user != NULL) - spooler(s, id->user,"@",s); - - spool_add(s, id->server); - - if(id->resource != NULL) - spooler(s, "/",id->resource,s); - - id->full = spool_print(s); - return id->full; -} - -/* parses a /resource?name=value&foo=bar into an xmlnode representing <resource name="value" foo="bar"/> */ -xmlnode jid_xres(jid id) -{ - char *cur, *qmark, *amp, *eq; - xmlnode x; - - if(id == NULL || id->resource == NULL) return NULL; - - cur = pstrdup(id->p, id->resource); - qmark = strstr(cur, "?"); - if(qmark == NULL) return NULL; - *qmark = '\0'; - qmark++; - - x = _xmlnode_new(id->p, cur, NTYPE_TAG); - - cur = qmark; - while(cur != '\0') - { - eq = strstr(cur, "="); - if(eq == NULL) break; - *eq = '\0'; - eq++; - - amp = strstr(eq, "&"); - if(amp != NULL) - { - *amp = '\0'; - amp++; - } - - xmlnode_put_attrib(x,cur,eq); - - if(amp != NULL) - cur = amp; - else - break; - } - - return x; -} - -/* local utils */ -int _jid_nullstrcmp(char *a, char *b) -{ - if(a == NULL && b == NULL) return 0; - if(a == NULL || b == NULL) return -1; - return strcmp(a,b); -} -int _jid_nullstrcasecmp(char *a, char *b) -{ - if(a == NULL && b == NULL) return 0; - if(a == NULL || b == NULL) return -1; - return strcasecmp(a,b); -} - -int jid_cmp(jid a, jid b) -{ - if(a == NULL || b == NULL) - return -1; - - if(_jid_nullstrcmp(a->resource, b->resource) != 0) return -1; - if(_jid_nullstrcasecmp(a->user, b->user) != 0) return -1; - if(_jid_nullstrcmp(a->server, b->server) != 0) return -1; - - return 0; -} - -/* suggested by Anders Qvist <quest@valdez.netg.se> */ -int jid_cmpx(jid a, jid b, int parts) -{ - if(a == NULL || b == NULL) - return -1; - - if(parts & JID_RESOURCE && _jid_nullstrcmp(a->resource, b->resource) != 0) return -1; - if(parts & JID_USER && _jid_nullstrcasecmp(a->user, b->user) != 0) return -1; - if(parts & JID_SERVER && _jid_nullstrcmp(a->server, b->server) != 0) return -1; - - return 0; -} - -/* makes a copy of b in a's pool, requires a valid a first! */ -jid jid_append(jid a, jid b) -{ - jid next; - - if(a == NULL) - return NULL; - - if(b == NULL) - return a; - - next = a; - while(next != NULL) - { - /* check for dups */ - if(jid_cmp(next,b) == 0) - break; - if(next->next == NULL) - next->next = jid_new(a->p,jid_full(b)); - next = next->next; - } - return a; -} - -xmlnode jid_nodescan(jid id, xmlnode x) -{ - xmlnode cur; - pool p; - jid tmp; - - if(id == NULL || xmlnode_get_firstchild(x) == NULL) return NULL; - - p = pool_new(); - for(cur = xmlnode_get_firstchild(x); cur != NULL; cur = xmlnode_get_nextsibling(cur)) - { - if(xmlnode_get_type(cur) != NTYPE_TAG) continue; - - tmp = jid_new(p,xmlnode_get_attrib(cur,"jid")); - if(tmp == NULL) continue; - - if(jid_cmp(tmp,id) == 0) break; - } - pool_free(p); - - return cur; -} - -jid jid_user(jid a) -{ - jid ret; - - if(a == NULL || a->resource == NULL) return a; - - ret = pmalloco(a->p,sizeof(struct jid_struct)); - ret->p = a->p; - ret->user = a->user; - ret->server = a->server; - - return ret; -}
--- a/mcabber/libjabber/jpacket.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyrights - * - * Portions created by or assigned to Jabber.com, Inc. are - * Copyright (c) 1999-2002 Jabber.com, Inc. All Rights Reserved. Contact - * information for Jabber.com, Inc. is available at http://www.jabber.com/. - * - * Portions Copyright (c) 1998-1999 Jeremie Miller. - * - * Acknowledgements - * - * Special thanks to the Jabber Open Source Contributors for their - * suggestions and support of Jabber. - * - */ - -/** - * @file jpacket.c - * @brief a jpacket is a wrapper around an xmlnode that contains an XMPP stanza - * - * A jpacket adds some variables to an xmlnode that contains a stanza, so that - * jabberd is able to cache information on the stanza type (message, presence, iq) - * that is contained in this jpacket and to further classify the presence stanzas. - * It also adds some pointers to important data inside the xmlnode, that has - * to be accessed often (e.g. sender and receiver of a stanza). - */ - -#include "jabber.h" - -/** - * create a new jpacket by wrapping an xmlnode - * - * @param x the xmlnode that should be wrapped - * @return the newly created jpacket (NULL on failure) - */ -jpacket jpacket_new(xmlnode x) -{ - jpacket p; - - if(x == NULL) - return NULL; - - p = pmalloc(xmlnode_pool(x),sizeof(_jpacket)); - p->x = x; - - return jpacket_reset(p); -} - -/** - * recalculate the information the jpacket holds about the stanza - * - * @param p the packet that should get its information recalculated - * @return the jpacket (as given as the p parameter) - */ -jpacket jpacket_reset(jpacket p) -{ - char *val; - xmlnode x; - - x = p->x; - memset(p,0,sizeof(_jpacket)); - p->x = x; - p->p = xmlnode_pool(x); - - if(strncmp(xmlnode_get_name(x),"message",7) == 0) { - p->type = JPACKET_MESSAGE; - } else if(strncmp(xmlnode_get_name(x),"presence",8) == 0) { - p->type = JPACKET_PRESENCE; - val = xmlnode_get_attrib(x, "type"); - if(val == NULL) - p->subtype = JPACKET__AVAILABLE; - else if(strcmp(val,"unavailable") == 0) - p->subtype = JPACKET__UNAVAILABLE; - else if(strcmp(val,"probe") == 0) - p->subtype = JPACKET__PROBE; - else if(strcmp(val,"error") == 0) - p->subtype = JPACKET__ERROR; - else if(strcmp(val,"invisible") == 0) - p->subtype = JPACKET__INVISIBLE; - else if(*val == 's' || *val == 'u') - p->type = JPACKET_S10N; - else if(strcmp(val,"available") == 0) { - /* someone is using type='available' which is frowned upon */ - /* XXX better reject this presence? */ - xmlnode_hide_attrib(x,"type"); - p->subtype = JPACKET__AVAILABLE; - } else - p->type = JPACKET_UNKNOWN; - } else if(strncmp(xmlnode_get_name(x),"iq",2) == 0) { - p->type = JPACKET_IQ; - p->iq = xmlnode_get_tag(x,"?xmlns"); - p->iqns = xmlnode_get_attrib(p->iq,"xmlns"); - } - - /* set up the jids if any, flag packet as unknown if they are unparseable */ - val = xmlnode_get_attrib(x,"to"); - if(val != NULL) - if((p->to = jid_new(p->p, val)) == NULL) - p->type = JPACKET_UNKNOWN; - val = xmlnode_get_attrib(x,"from"); - if(val != NULL) - if((p->from = jid_new(p->p, val)) == NULL) - p->type = JPACKET_UNKNOWN; - - return p; -} - -/** - * get the subtype of a jpacket - * - * @param p the jpacket for which the caller wants to know the subtype - * @return the subtype of the jpacket (one of the JPACKET__* constants) - */ -int jpacket_subtype(jpacket p) -{ - char *type; - int ret = p->subtype; - - if(ret != JPACKET__UNKNOWN) - return ret; - - ret = JPACKET__NONE; /* default, when no type attrib is specified */ - type = xmlnode_get_attrib(p->x, "type"); - if(j_strcmp(type,"error") == 0) - ret = JPACKET__ERROR; - else - switch(p->type) - { - case JPACKET_MESSAGE: - if(j_strcmp(type,"chat") == 0) - ret = JPACKET__CHAT; - else if(j_strcmp(type,"groupchat") == 0) - ret = JPACKET__GROUPCHAT; - else if(j_strcmp(type,"headline") == 0) - ret = JPACKET__HEADLINE; - break; - case JPACKET_S10N: - if(j_strcmp(type,"subscribe") == 0) - ret = JPACKET__SUBSCRIBE; - else if(j_strcmp(type,"subscribed") == 0) - ret = JPACKET__SUBSCRIBED; - else if(j_strcmp(type,"unsubscribe") == 0) - ret = JPACKET__UNSUBSCRIBE; - else if(j_strcmp(type,"unsubscribed") == 0) - ret = JPACKET__UNSUBSCRIBED; - break; - case JPACKET_IQ: - if(j_strcmp(type,"get") == 0) - ret = JPACKET__GET; - else if(j_strcmp(type,"set") == 0) - ret = JPACKET__SET; - else if(j_strcmp(type,"result") == 0) - ret = JPACKET__RESULT; - break; - } - - p->subtype = ret; - return ret; -}
--- a/mcabber/libjabber/jutil.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,415 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyrights - * - * Portions created by or assigned to Jabber.com, Inc. are - * Copyright (c) 1999-2002 Jabber.com, Inc. All Rights Reserved. Contact - * information for Jabber.com, Inc. is available at http://www.jabber.com/. - * - * Portions Copyright (c) 1998-1999 Jeremie Miller. - * - * Acknowledgements - * - * Special thanks to the Jabber Open Source Contributors for their - * suggestions and support of Jabber. - * - */ - -/** - * @file jutil.c - * @brief various utilities mainly for handling xmlnodes containing stanzas - */ - -#include "jabber.h" - -/** - * utility for making presence stanzas - * - * @param type the type of the presence (one of the JPACKET__* contants) - * @param to to whom the presence should be sent, NULL for a broadcast presence - * @param status optional status (CDATA for the <status/> element, NULL for now <status/> element) - * @return the xmlnode containing the created presence stanza - */ -xmlnode jutil_presnew(int type, char *to, char *status) -{ - xmlnode pres; - - pres = xmlnode_new_tag("presence"); - switch(type) - { - case JPACKET__SUBSCRIBE: - xmlnode_put_attrib(pres,"type","subscribe"); - break; - case JPACKET__UNSUBSCRIBE: - xmlnode_put_attrib(pres,"type","unsubscribe"); - break; - case JPACKET__SUBSCRIBED: - xmlnode_put_attrib(pres,"type","subscribed"); - break; - case JPACKET__UNSUBSCRIBED: - xmlnode_put_attrib(pres,"type","unsubscribed"); - break; - case JPACKET__PROBE: - xmlnode_put_attrib(pres,"type","probe"); - break; - case JPACKET__UNAVAILABLE: - xmlnode_put_attrib(pres,"type","unavailable"); - break; - case JPACKET__INVISIBLE: - xmlnode_put_attrib(pres,"type","invisible"); - break; - } - if(to != NULL) - xmlnode_put_attrib(pres,"to",to); - if(status != NULL) - xmlnode_insert_cdata(xmlnode_insert_tag(pres,"status"),status,strlen(status)); - - return pres; -} - -/** - * utility for making IQ stanzas, that contain a <query/> element in a different namespace - * - * @note In traditional Jabber protocols the element inside an iq element has the name "query". - * This util is not able to create IQ stanzas that contain a query which a element that does - * not have the name "query" - * - * @param type the type of the iq stanza (one of JPACKET__GET, JPACKET__SET, JPACKET__RESULT, JPACKET__ERROR) - * @param ns the namespace of the <query/> element - * @return the created xmlnode - */ -xmlnode jutil_iqnew(int type, char *ns) -{ - xmlnode iq; - - iq = xmlnode_new_tag("iq"); - switch(type) - { - case JPACKET__GET: - xmlnode_put_attrib(iq,"type","get"); - break; - case JPACKET__SET: - xmlnode_put_attrib(iq,"type","set"); - break; - case JPACKET__RESULT: - xmlnode_put_attrib(iq,"type","result"); - break; - case JPACKET__ERROR: - xmlnode_put_attrib(iq,"type","error"); - break; - } - xmlnode_put_attrib(xmlnode_insert_tag(iq,"query"),"xmlns",ns); - - return iq; -} - -/** - * utility for making message stanzas - * - * @param type the type of the message (as a string!) - * @param to the recipient of the message - * @param subj the subject of the message (NULL for no subject element) - * @param body the body of the message - * @return the xmlnode containing the new message stanza - */ -xmlnode jutil_msgnew(char *type, char *to, char *subj, char *body) -{ - xmlnode msg; - - msg = xmlnode_new_tag("message"); - - if (type != NULL) { - xmlnode_put_attrib (msg, "type", type); - } - - if (to != NULL) { - xmlnode_put_attrib (msg, "to", to); - } - - if (subj != NULL) { - xmlnode_insert_cdata(xmlnode_insert_tag(msg, "subject"), subj, strlen(subj)); - } - - if (body != NULL) { - xmlnode_insert_cdata(xmlnode_insert_tag(msg, "body"), body, strlen(body)); - } - - return msg; -} - -/** - * utility for making stream packets (containing the stream header element) - * - * @param xmlns the default namespace of the stream (e.g. jabber:client or jabber:server) - * @param server the domain of the server - * @return the xmlnode containing the root element of the stream - */ -xmlnode jutil_header(char* xmlns, char* server) -{ - xmlnode result; - if ((xmlns == NULL)||(server == NULL)) - return NULL; - result = xmlnode_new_tag("stream:stream"); - xmlnode_put_attrib(result, "xmlns:stream", "http://etherx.jabber.org/streams"); - xmlnode_put_attrib(result, "xmlns", xmlns); - xmlnode_put_attrib(result, "to", server); - - return result; -} - -/** - * returns the priority on an available presence packet - * - * @param xmlnode the xmlnode containing the presence packet - * @return the presence priority, -129 for unavailable presences and errors - */ -int jutil_priority(xmlnode x) -{ - char *str; - int p; - - if(x == NULL) - return -129; - - if(xmlnode_get_attrib(x,"type") != NULL) - return -129; - - x = xmlnode_get_tag(x,"priority"); - if(x == NULL) - return 0; - - str = xmlnode_get_data((x)); - if(str == NULL) - return 0; - - p = atoi(str); - /* xmpp-im section 2.2.2.3 */ - return p<-128 ? -128 : p>127 ? 127 : p; -} - -/** - * reverse sender and destination of a packet - * - * @param x the xmlnode where sender and receiver should be exchanged - */ -void jutil_tofrom(xmlnode x) -{ - char *to, *from; - - to = xmlnode_get_attrib(x,"to"); - from = xmlnode_get_attrib(x,"from"); - xmlnode_put_attrib(x,"from",to); - xmlnode_put_attrib(x,"to",from); -} - -/** - * change and xmlnode to be the result xmlnode for the original iq query - * - * @param x the xmlnode that should become the result for itself - * @return the result xmlnode (same as given as parameter x) - */ -xmlnode jutil_iqresult(xmlnode x) -{ - xmlnode cur; - - jutil_tofrom(x); - - xmlnode_put_attrib(x,"type","result"); - - /* hide all children of the iq, they go back empty */ - for(cur = xmlnode_get_firstchild(x); cur != NULL; cur = xmlnode_get_nextsibling(cur)) - xmlnode_hide(cur); - - return x; -} - -/** - * get the present time as a textual timestamp in the format YYYYMMDDTHH:MM:SS - * - * @note this function is not thread safe - * - * @return pointer to a static (!) buffer containing the timestamp (or NULL on failure) - */ -char *jutil_timestamp(void) -{ - time_t t; - struct tm *new_time; - static char timestamp[18]; - int ret; - - t = time(NULL); - - if(t == (time_t)-1) - return NULL; - new_time = gmtime(&t); - - ret = snprintf(timestamp, 18, "%d%02d%02dT%02d:%02d:%02d", 1900+new_time->tm_year, - new_time->tm_mon+1, new_time->tm_mday, new_time->tm_hour, - new_time->tm_min, new_time->tm_sec); - - if(ret == -1) - return NULL; - - return timestamp; -} - -/** - * map a terror structure to a xterror structure - * - * terror structures have been used in jabberd14 up to version 1.4.3 but - * are not able to hold XMPP compliant stanza errors. The xterror - * structure has been introduced to be XMPP compliant. This function - * is to ease writting wrappers that accept terror structures and call - * the real functions that require now xterror structures - * - * @param old the terror struct that should be converted - * @param mapped pointer to the xterror struct that should be filled with the converted error - */ -void jutil_error_map(terror old, xterror *mapped) -{ - mapped->code = old.code; - if (old.msg == NULL) - mapped->msg[0] = 0; - else - strncpy(mapped->msg, old.msg, sizeof(mapped->msg)); - - switch (old.code) - { - case 302: - strcpy(mapped->type, "modify"); - strcpy(mapped->condition, "redirect"); - break; - case 400: - strcpy(mapped->type, "modify"); - strcpy(mapped->condition, "bad-request"); - break; - case 401: - strcpy(mapped->type, "auth"); - strcpy(mapped->condition, "not-authorized"); - break; - case 402: - strcpy(mapped->type, "auth"); - strcpy(mapped->condition, "payment-required"); - break; - case 403: - strcpy(mapped->type, "auth"); - strcpy(mapped->condition, "forbidden"); - break; - case 404: - strcpy(mapped->type, "cancel"); - strcpy(mapped->condition, "item-not-found"); - break; - case 405: - strcpy(mapped->type, "cancel"); - strcpy(mapped->condition, "not-allowed"); - break; - case 406: - strcpy(mapped->type, "modify"); - strcpy(mapped->condition, "not-acceptable"); - break; - case 407: - strcpy(mapped->type, "auth"); - strcpy(mapped->condition, "registration-requited"); - break; - case 408: - strcpy(mapped->type, "wait"); - strcpy(mapped->condition, "remote-server-timeout"); - break; - case 409: - strcpy(mapped->type, "cancel"); - strcpy(mapped->condition, "conflict"); - break; - case 500: - strcpy(mapped->type, "wait"); - strcpy(mapped->condition, "internal-server-error"); - break; - case 501: - strcpy(mapped->type, "cancel"); - strcpy(mapped->condition, "feature-not-implemented"); - break; - case 502: - strcpy(mapped->type, "wait"); - strcpy(mapped->condition, "service-unavailable"); - break; - case 503: - strcpy(mapped->type, "cancel"); - strcpy(mapped->condition, "service-unavailable"); - break; - case 504: - strcpy(mapped->type, "wait"); - strcpy(mapped->condition, "remote-server-timeout"); - break; - case 510: - strcpy(mapped->type, "cancel"); - strcpy(mapped->condition, "service-unavailable"); - break; - default: - strcpy(mapped->type, "wait"); - strcpy(mapped->condition, "undefined-condition"); - } -} - -/** - * update an xmlnode to be the error stanza for itself - * - * @param x the xmlnode that should become an stanza error message - * @param E the structure that holds the error information - */ -void jutil_error_xmpp(xmlnode x, xterror E) -{ - xmlnode err; - char code[4]; - - xmlnode_put_attrib(x, "type", "error"); - err = xmlnode_insert_tag(x, "error"); - - snprintf(code, sizeof(code), "%d", E.code); - xmlnode_put_attrib(err, "code", code); - if (E.type != NULL) - xmlnode_put_attrib(err, "type", E.type); - if (E.condition != NULL) - xmlnode_put_attrib(xmlnode_insert_tag(err, E.condition), "xmlns", NS_XMPP_STANZAS); - if (E.msg != NULL) - { - xmlnode text; - text = xmlnode_insert_tag(err, "text"); - xmlnode_put_attrib(text, "xmlns", NS_XMPP_STANZAS); - xmlnode_insert_cdata(text, E.msg, strlen(E.msg)); - } - - jutil_tofrom(x); -} - -/** - * add a delayed delivery (JEP-0091) element to a message using the - * present timestamp. - * If a reason is given, this reason will be added as CDATA to the - * inserted element - * - * @param msg the message where the element should be added - * @param reason plain text information why the delayed delivery information has been added - */ -void jutil_delay(xmlnode msg, char *reason) -{ - xmlnode delay; - - delay = xmlnode_insert_tag(msg,"x"); - xmlnode_put_attrib(delay,"xmlns",NS_DELAY); - xmlnode_put_attrib(delay,"from",xmlnode_get_attrib(msg,"to")); - xmlnode_put_attrib(delay,"stamp",jutil_timestamp()); - if(reason != NULL) - xmlnode_insert_cdata(delay,reason,strlen(reason)); -}
--- a/mcabber/libjabber/latin1tab.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -The contents of this file are subject to the Mozilla Public License -Version 1.1 (the "License"); you may not use this file except in -compliance with the License. You may obtain a copy of the License at -http://www.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -License for the specific language governing rights and limitations -under the License. - -The Original Code is expat. - -The Initial Developer of the Original Code is James Clark. -Portions created by James Clark are Copyright (C) 1998, 1999 -James Clark. All Rights Reserved. - -Contributor(s): - -Alternatively, the contents of this file may be used under the terms -of the GNU General Public License (the "GPL"), in which case the -provisions of the GPL are applicable instead of those above. If you -wish to allow use of your version of this file only under the terms of -the GPL and not to allow others to use your version of this file under -the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the -GPL. If you do not delete the provisions above, a recipient may use -your version of this file under either the MPL or the GPL. -*/ - -/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
--- a/mcabber/libjabber/libxode.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,468 +0,0 @@ -/* - * jabberd - Jabber Open Source Server - * Copyright (c) 2002 Jeremie Miller, Thomas Muldowney, - * Ryan Eatmon, Robert Norris - * - * 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., 59 Temple Place, Suite 330, Boston, MA02111-1307USA - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <string.h> -#include <stdlib.h> -#include <sys/types.h> -#include <stdio.h> -#include <setjmp.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -#include <signal.h> -#include <strings.h> -#include <unistd.h> -#include <sys/time.h> -#include <syslog.h> -#include <netinet/in.h> -#include <netdb.h> -#include <arpa/inet.h> -#include <sys/socket.h> - -#include "xmlparse.h" - -/* -** Arrange to use either varargs or stdargs -*/ - -#define MAXSHORTSTR 203 /* max short string length */ -#define QUAD_T unsigned long long - -#ifdef __STDC__ - -#include <stdarg.h> - -# define VA_LOCAL_DECL va_list ap; -# define VA_START(f) va_start(ap, f) -# define VA_END va_end(ap) - -#else /* __STDC__ */ - -# include <varargs.h> - -# define VA_LOCAL_DECL va_list ap; -# define VA_START(f) va_start(ap) -# define VA_END va_end(ap) - -#endif /* __STDC__ */ - - -#ifndef INCL_LIBXODE_H -#define INCL_LIBXODE_H - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifndef HAVE_SNPRINTF -extern int ap_snprintf(char *, size_t, const char *, ...); -#define snprintf ap_snprintf -#endif - -#ifndef HAVE_VSNPRINTF -extern int ap_vsnprintf(char *, size_t, const char *, va_list ap); -#define vsnprintf ap_vsnprintf -#endif - -#define ZONE zonestr(__FILE__,__LINE__) -char *zonestr(char *file, int line); - -/* --------------------------------------------------------- */ -/* */ -/* Pool-based memory management routines */ -/* */ -/* --------------------------------------------------------- */ - -#undef POOL_DEBUG -/* - flip these, this should be a prime number for top # of pools debugging -#define POOL_DEBUG 40009 -*/ - -/* pheap - singular allocation of memory */ -struct pheap -{ - void *block; - int size, used; -}; - -/* pool_cleaner - callback type which is associated - with a pool entry; invoked when the pool entry is - free'd */ -typedef void (*pool_cleaner)(void *arg); - -/* pfree - a linked list node which stores an - allocation chunk, plus a callback */ -struct pfree -{ - pool_cleaner f; - void *arg; - struct pheap *heap; - struct pfree *next; -}; - -/* pool - base node for a pool. Maintains a linked list - of pool entries (pfree) */ -typedef struct pool_struct -{ - int size; - struct pfree *cleanup; - struct pheap *heap; -#ifdef POOL_DEBUG - char name[8], zone[32]; - int lsize; -} _pool, *pool; -#define pool_new() _pool_new(__FILE__,__LINE__) -#define pool_heap(i) _pool_new_heap(i,__FILE__,__LINE__) -#else -} _pool, *pool; -#define pool_heap(i) _pool_new_heap(i, NULL, 0) -#define pool_new() _pool_new(NULL, 0) -#endif - -pool _pool_new(char *zone, int line); /* new pool :) */ -pool _pool_new_heap(int size, char *zone, int line); /* creates a new memory pool with an initial heap size */ -void *pmalloc(pool p, int size); /* wrapper around malloc, takes from the pool, cleaned up automatically */ -void *pmalloc_x(pool p, int size, char c); /* Wrapper around pmalloc which prefils buffer with c */ -void *pmalloco(pool p, int size); /* YAPW for zeroing the block */ -char *pstrdup(pool p, const char *src); /* wrapper around strdup, gains mem from pool */ -void pool_stat(int full); /* print to stderr the changed pools and reset */ -char *pstrdupx(pool p, const char *src); /* temp stub */ -void pool_cleanup(pool p, pool_cleaner f, void *arg); /* calls f(arg) before the pool is freed during cleanup */ -void pool_free(pool p); /* calls the cleanup functions, frees all the data on the pool, and deletes the pool itself */ -int pool_size(pool p); /* returns total bytes allocated in this pool */ - - - - -/* --------------------------------------------------------- */ -/* */ -/* Socket helper stuff */ -/* */ -/* --------------------------------------------------------- */ -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - -#define NETSOCKET_SERVER 0 -#define NETSOCKET_CLIENT 1 -#define NETSOCKET_UDP 2 - -#ifndef WIN32 -int make_netsocket(u_short port, char *host, int type, int ssl); -int make_nb_netsocket(u_short port, char *host, int type, int ssl, int * state); -void change_socket_to_blocking(int socket); -struct in_addr *make_addr(char *host); -int set_fd_close_on_exec(int fd, int flag); -#endif - - -/* --------------------------------------------------------- */ -/* */ -/* String management routines */ -/* */ -/* --------------------------------------------------------- */ -char *j_strdup(const char *str); /* provides NULL safe strdup wrapper */ -char *j_strcat(char *dest, char *txt); /* strcpy() clone */ -int j_strcmp(const char *a, const char *b); /* provides NULL safe strcmp wrapper */ -int j_strcasecmp(const char *a, const char *b); /* provides NULL safe strcasecmp wrapper */ -int j_strncmp(const char *a, const char *b, int i); /* provides NULL safe strncmp wrapper */ -int j_strncasecmp(const char *a, const char *b, int i); /* provides NULL safe strncasecmp wrapper */ -int j_strlen(const char *a); /* provides NULL safe strlen wrapper */ -int j_atoi(const char *a, int def); /* checks for NULL and uses default instead, convienence */ -void str_b64decode(char *str); /* what it says */ - - -/* --------------------------------------------------------- */ -/* */ -/* SHA calculations */ -/* */ -/* --------------------------------------------------------- */ -#if (SIZEOF_INT == 4) -typedef unsigned int uint32; -#elif (SIZEOF_SHORT == 4) -typedef unsigned short uint32; -#else -typedef unsigned int uint32; -#endif /* HAVEUINT32 */ - -int sha_hash(int *data, int *hash); -int sha_init(int *hash); -char *shahash(char *str); /* NOT THREAD SAFE */ -void shahash_r(const char* str, char hashbuf[40]); /* USE ME */ - -int strprintsha(char *dest, int *hashval); - - -/* --------------------------------------------------------- */ -/* */ -/* Hashtable functions */ -/* */ -/* --------------------------------------------------------- */ -typedef int (*KEYHASHFUNC)(const void *key); -typedef int (*KEYCOMPAREFUNC)(const void *key1, const void *key2); -typedef int (*TABLEWALKFUNC)(void *user_data, const void *key, void *data); - -typedef void *HASHTABLE; - -HASHTABLE ghash_create(int buckets, KEYHASHFUNC hash, KEYCOMPAREFUNC cmp); -void ghash_destroy(HASHTABLE tbl); -void *ghash_get(HASHTABLE tbl, const void *key); -int ghash_put(HASHTABLE tbl, const void *key, void *value); -int ghash_remove(HASHTABLE tbl, const void *key); -int ghash_walk(HASHTABLE tbl, TABLEWALKFUNC func, void *user_data); -int str_hash_code(const char *s); - - -/* --------------------------------------------------------- */ -/* */ -/* XML escaping utils */ -/* */ -/* --------------------------------------------------------- */ -char *strescape(pool p, char *buf); /* Escape <>&'" chars */ -char *strunescape(pool p, char *buf); - - -/* --------------------------------------------------------- */ -/* */ -/* String pools (spool) functions */ -/* */ -/* --------------------------------------------------------- */ -struct spool_node -{ - char *c; - struct spool_node *next; -}; - -typedef struct spool_struct -{ - pool p; - int len; - struct spool_node *last; - struct spool_node *first; -} *spool; - -spool spool_new(pool p); /* create a string pool */ -void spooler(spool s, ...); /* append all the char * args to the pool, terminate args with s again */ -char *spool_print(spool s); /* return a big string */ -void spool_add(spool s, char *str); /* add a single string to the pool */ -char *spools(pool p, ...); /* wrap all the spooler stuff in one function, the happy fun ball! */ - - -/* --------------------------------------------------------- */ -/* */ -/* xmlnodes - Document Object Model */ -/* */ -/* --------------------------------------------------------- */ -#define NTYPE_TAG 0 -#define NTYPE_ATTRIB 1 -#define NTYPE_CDATA 2 - -#define NTYPE_LAST 2 -#define NTYPE_UNDEF -1 - -/* -------------------------------------------------------------------------- - Node structure. Do not use directly! Always use accessor macros - and methods! - -------------------------------------------------------------------------- */ -typedef struct xmlnode_t -{ - char* name; - unsigned short type; - char* data; - int data_sz; - int complete; - pool p; - struct xmlnode_t* parent; - struct xmlnode_t* firstchild; - struct xmlnode_t* lastchild; - struct xmlnode_t* prev; - struct xmlnode_t* next; - struct xmlnode_t* firstattrib; - struct xmlnode_t* lastattrib; -} _xmlnode, *xmlnode; - -/* Node creation routines */ -xmlnode xmlnode_wrap(xmlnode x,const char* wrapper); -xmlnode xmlnode_new_tag(const char* name); -xmlnode xmlnode_new_tag_pool(pool p, const char* name); -xmlnode xmlnode_insert_tag(xmlnode parent, const char* name); -xmlnode xmlnode_insert_cdata(xmlnode parent, const char* CDATA, unsigned int size); -xmlnode xmlnode_insert_tag_node(xmlnode parent, xmlnode node); -void xmlnode_insert_node(xmlnode parent, xmlnode node); -xmlnode xmlnode_str(char *str, int len); -xmlnode xmlnode_file(char *file); -xmlnode xmlnode_dup(xmlnode x); /* duplicate x */ -xmlnode xmlnode_dup_pool(pool p, xmlnode x); - -/* Node Memory Pool */ -pool xmlnode_pool(xmlnode node); -xmlnode _xmlnode_new(pool p, const char *name, unsigned int type); - -/* Node editing */ -void xmlnode_hide(xmlnode child); -void xmlnode_hide_attrib(xmlnode parent, const char *name); - -/* Node deletion routine, also frees the node pool! */ -void xmlnode_free(xmlnode node); - -/* Locates a child tag by name and returns it */ -xmlnode xmlnode_get_tag(xmlnode parent, const char* name); -char* xmlnode_get_tag_data(xmlnode parent, const char* name); - -/* Attribute accessors */ -void xmlnode_put_attrib(xmlnode owner, const char* name, const char* value); -char* xmlnode_get_attrib(xmlnode owner, const char* name); -void xmlnode_put_expat_attribs(xmlnode owner, const char** atts); - -/* Bastard am I, but these are fun for internal use ;-) */ -void xmlnode_put_vattrib(xmlnode owner, const char* name, void *value); -void* xmlnode_get_vattrib(xmlnode owner, const char* name); - -/* Node traversal routines */ -xmlnode xmlnode_get_firstattrib(xmlnode parent); -xmlnode xmlnode_get_firstchild(xmlnode parent); -xmlnode xmlnode_get_lastchild(xmlnode parent); -xmlnode xmlnode_get_nextsibling(xmlnode sibling); -xmlnode xmlnode_get_prevsibling(xmlnode sibling); -xmlnode xmlnode_get_parent(xmlnode node); - -/* Node information routines */ -char* xmlnode_get_name(xmlnode node); -char* xmlnode_get_data(xmlnode node); -int xmlnode_get_datasz(xmlnode node); -int xmlnode_get_type(xmlnode node); - -int xmlnode_has_children(xmlnode node); -int xmlnode_has_attribs(xmlnode node); - -/* Node-to-string translation */ -char* xmlnode2str(xmlnode node); - -/* Node-to-terminated-string translation - -- useful for interfacing w/ scripting langs */ -char* xmlnode2tstr(xmlnode node); - -int xmlnode_cmp(xmlnode a, xmlnode b); /* compares a and b for equality */ - -int xmlnode2file(char *file, xmlnode node); /* writes node to file */ -int xmlnode2file_limited(char *file, xmlnode node, size_t sizelimit); - -/* Expat callbacks */ -void expat_startElement(void* userdata, const char* name, const char** atts); -void expat_endElement(void* userdata, const char* name); -void expat_charData(void* userdata, const char* s, int len); - -/*********************** - * XSTREAM Section - ***********************/ - -#define XSTREAM_MAXNODE 1000000 -#define XSTREAM_MAXDEPTH 100 - -#define XSTREAM_ROOT 0 /* root element */ -#define XSTREAM_NODE 1 /* normal node */ -#define XSTREAM_CLOSE 2 /* closed </stream:stream> */ -#define XSTREAM_ERR 4 /* parser error */ - -typedef void (*xstream_onNode)(int type, xmlnode x, void *arg); /* xstream event handler */ - -typedef struct xstream_struct -{ - XML_Parser parser; - xmlnode node; - char *cdata; - int cdata_len; - pool p; - xstream_onNode f; - void *arg; - int status; - int depth; -} *xstream, _xstream; - -xstream xstream_new(pool p, xstream_onNode f, void *arg); /* create a new xstream */ -int xstream_eat(xstream xs, char *buff, int len); /* parse new data for this xstream, returns last XSTREAM_* status */ - -/* convience functions */ -xmlnode xstream_header(char *nspace, char *to, char *from); -char *xstream_header_char(xmlnode x); - -/* SHA.H */ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is SHA 180-1 Header File - * - * The Initial Developer of the Original Code is Paul Kocher of - * Cryptography Research. Portions created by Paul Kocher are - * Copyright (C) 1995-9 by Cryptography Research, Inc. All - * Rights Reserved. - * - * Contributor(s): - * - * Paul Kocher - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your - * version of this file only under the terms of the GPL and not to - * allow others to use your version of this file under the MPL, - * indicate your decision by deleting the provisions above and - * replace them with the notice and other provisions required by - * the GPL. If you do not delete the provisions above, a recipient - * may use your version of this file under either the MPL or the - * GPL. - */ - -typedef struct { - uint32_t H[5]; - uint32_t W[80]; - int lenW; - uint32_t sizeHi,sizeLo; -} SHA_CTX; - - -void shaInit(SHA_CTX *ctx); -void shaUpdate(SHA_CTX *ctx, unsigned char *dataIn, int len); -void shaFinal(SHA_CTX *ctx, unsigned char hashout[20]); -void shaBlock(unsigned char *dataIn, int len, unsigned char hashout[20]); - - -/* END SHA.H */ - -#ifdef __cplusplus -} -#endif - -#endif /* INCL_LIBXODE_H */
--- a/mcabber/libjabber/log.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Jabber - * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/ - */ - -#include "jabber.h" -#include "log.h" - -#ifdef DEBUG - -void jdebug(char *zone, const char *msgfmt, ...) -{ - va_list ap; - static char loghdr[LOGSIZE_HDR]; - static char logmsg[LOGSIZE_TAIL]; - static int size; - - /* XXX: We may want to check the sizes eventually */ - size = snprintf(loghdr, LOGSIZE_HDR, "debug/%s %s\n", zone, msgfmt); - - va_start(ap, msgfmt); - size = vsnprintf(logmsg, LOGSIZE_TAIL, loghdr, ap); - - fprintf(stderr,"%s",logmsg); - - return; -} - - -#endif /* DEBUG */
--- a/mcabber/libjabber/log.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Jabber - * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/ - */ - -#ifndef INCL_LOG_H -#define INCL_LOG_H - -#define LOGSIZE_HDR 1024 -#define LOGSIZE_TAIL 2048 - - -#ifdef DEBUG - void jdebug(char *zone, const char *msgfmt, ...); -#else - #define jdebug if(0) warn -#endif - - - -#endif /* INCL_LOG_H */ -
--- a/mcabber/libjabber/nametab.h Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -static const unsigned namingBitmap[] = { -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, -0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, -0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, -0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, -0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, -0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, -0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, -0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, -0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, -0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, -0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, -0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, -0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, -0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, -0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, -0x40000000, 0xF580C900, 0x00000007, 0x02010800, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, -0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, -0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, -0x00000000, 0x00004C40, 0x00000000, 0x00000000, -0x00000007, 0x00000000, 0x00000000, 0x00000000, -0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, -0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, -0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, -0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, -0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, -0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, -0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, -0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, -0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, -0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, -0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, -0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, -0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, -0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, -0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, -0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, -0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, -0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, -}; -static const unsigned char nmstrtPages[] = { -0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, -0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -static const unsigned char namePages[] = { -0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, -0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -};
--- a/mcabber/libjabber/pool.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,474 +0,0 @@ -/* - * pool.c - * This code comes from jabberd - Jabber Open Source Server - * Copyright (c) 2002 Jeremie Miller, Thomas Muldowney, - * Ryan Eatmon, Robert Norris - * Copyright (C) 1998-1999 The Jabber Team http://jabber.org/ - * - * 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., 59 Temple Place, Suite 330, Boston, MA02111-1307USA - * - * Copyrights - * - * Portions created by or assigned to Jabber.com, Inc. are - * Copyright (c) 1999-2002 Jabber.com, Inc. All Rights Reserved. Contact - * information for Jabber.com, Inc. is available at http://www.jabber.com/. - * - * Portions Copyright (c) 1998-1999 Jeremie Miller. - * - * Acknowledgements - * - * Special thanks to the Jabber Open Source Contributors for their - * suggestions and support of Jabber. - * - */ - -/** - * @file pool.c - * @brief Handling of memory pools - * - * Jabberd handles its memory allocations in pools. You create a pool, can - * allocate memory from it and all allocations will be freed if you free - * the pool. Therefore you don't have to care that each malloc is freed, - * you only have to take care that the pool is freed. - * - * The normal call-flow for pools is: - * - * pool p = pool_new(); - * struct mystruct *allocation1 = pmalloc(sizeof(struct mystruct)); - * struct myotherstruct *allocation2 = pmalloc(sizeof(struct myotherstruct)); - * ... - * pool_free(p); - */ - -#include "libxode.h" - -#define MAX_MALLOC_TRIES 10 /**< how many seconds we try to allocate memory */ - -#ifdef POOL_DEBUG -int pool__total = 0; /**< how many memory blocks are allocated */ -int pool__ltotal = 0; -xht pool__disturbed = NULL; - -inline void *_retried__malloc(size_t size); - -/** - * create a new memory allocation and increment the pool__total counter - * - * only used if POOL_DEBUG is defined, else it is an alias for malloc - * - * @param size size of the memory to allocate - * @return pointer to the allocated memory - */ -void *_pool__malloc(size_t size) -{ - pool__total++; - return malloc(size); -} - -/** - * free memory and decrement the pool__total counter - * - * only used if POOL_DEBUG is defined, else it is an alias for free - * - * @param block pointer to the memory allocation that should be freed - */ -void _pool__free(void *block) -{ - pool__total--; - free(block); -} -#else -#define _pool__malloc malloc /**< _pool__malloc updates pool__total counter if POOL_DEBUG is defined */ -#define _pool__free free /**< _pool__free updates pool__total counter if POOL_DEBUG is defined */ -#endif - -/** - * try to allocate memory - * - * If allocation fails, it will be retries for MAX_MALLOC_TRIES seconds. - * If it still fails, we exit the process - * - * @param size how many bytes of memory we allocate - * @return pointer to the allocated memory - */ -void *_retried__malloc(size_t size) { - void *allocated_memory; - int malloc_tries = 0; - - while ((allocated_memory=_pool__malloc(size)) == NULL) { - if (malloc_tries++ > MAX_MALLOC_TRIES) { - exit(999); - } - - sleep(1); //pth_sleep(1); - } - - return allocated_memory; -} - -/** - * make an empty pool - * - * Use the macro pool_new() instead of a direct call to this function. The - * macro will create the parameters for you. - * - * @param zone the file in which the pool_new macro is called - * @param line the line in the file in which the pool_new macro is called - * @return the new allocated memory pool - */ -pool _pool_new(char *zone, int line) -{ - // int malloc_tries = 0; -#ifdef POOL_DEBUG - int old__pool__total; -#endif - - pool p = _retried__malloc(sizeof(_pool)); - - p->cleanup = NULL; - p->heap = NULL; - p->size = 0; - -#ifdef POOL_DEBUG - p->lsize = -1; - p->zone[0] = '\0'; - strcat(p->zone,zone); - snprintf(p->zone, sizeof(p->zone), "%s:%i", zone, line); - snprintf(p->name, sizeof(p->name), "%X", p); - - if(pool__disturbed == NULL) - { - pool__disturbed = (xht)1; /* reentrancy flag! */ - pool__disturbed = ghash_create(POOL_DEBUG,(KEYHASHFUNC)str_hash_code,(KEYCOMPAREFUNC)j_strcmp); - } - if(pool__disturbed != (xht)1) - ghash_put(pool__disturbed,p->name,p); -#endif - - return p; -} - -/** - * free a memory heap (struct pheap) - * - * @param arg which heep should be freed - */ -void _pool_heap_free(void *arg) -{ - struct pheap *h = (struct pheap *)arg; - - _pool__free(h->block); - _pool__free(h); -} - -/** - * append a pool_cleaner function (callback) to a pool - * - * mem should always be freed last - * - * All appended pool_cleaner functions will be called if a pool is freed. - * This might be used to clean logically subpools. - * - * @param p to which pool the pool_cleaner should be added - * @param pf structure containing the reference to the pool_cleaner and links for the list - */ -void _pool_cleanup_append(pool p, struct pfree *pf) -{ - struct pfree *cur; - - if(p->cleanup == NULL) - { - p->cleanup = pf; - return; - } - - /* fast forward to end of list */ - for(cur = p->cleanup; cur->next != NULL; cur = cur->next); - - cur->next = pf; -} - -/** - * create a cleanup tracker - * - * this function is used to create a pfree structure that can be passed to _pool_cleanup_append() - * - * @param p the pool to which the pool_cleaner should be added - * @param f the function that should be called if the pool is freed - * @param arg the parameter that should be passed to the pool_cleaner function - * @return pointer to the new pfree structure - */ -struct pfree *_pool_free(pool p, pool_cleaner f, void *arg) -{ - struct pfree *ret; - - /* make the storage for the tracker */ - ret = _retried__malloc(sizeof(struct pfree)); - ret->f = f; - ret->arg = arg; - ret->next = NULL; - - return ret; -} - -/** - * create a heap and make sure it get's cleaned up - * - * pheaps are used by memory pools internally to handle the memory allocations - * - * @note the macro pool_heap calls _pool_new_heap and NOT _pool_heap - * - * @param p for which pool the heap should be created - * @param size how big the pool should be - * @return pointer to the new pheap - */ -struct pheap *_pool_heap(pool p, int size) -{ - struct pheap *ret; - struct pfree *clean; - - /* make the return heap */ - ret = _retried__malloc(sizeof(struct pheap)); - ret->block = _retried__malloc(size); - ret->size = size; - p->size += size; - ret->used = 0; - - /* append to the cleanup list */ - clean = _pool_free(p, _pool_heap_free, (void *)ret); - clean->heap = ret; /* for future use in finding used mem for pstrdup */ - _pool_cleanup_append(p, clean); - - return ret; -} - -/** - * create a new memory pool and set the initial heap size - * - * @note you should not call this function but use the macro pool_heap instead which fills zone and line automatically - * - * @param size the initial size of the memory pool - * @param zone the file where this function is called (for debugging) - * @param line the line in the file where this function is called - * @return the new memory pool - */ -pool _pool_new_heap(int size, char *zone, int line) -{ - pool p; - p = _pool_new(zone, line); - p->heap = _pool_heap(p,size); - return p; -} - -/** - * allocate memory from a memory pool - * - * @param p the pool to use - * @param size how much memory to allocate - * @return pointer to the allocated memory - */ -void *pmalloc(pool p, int size) -{ - void *block; - - if(p == NULL) - { - fprintf(stderr,"Memory Leak! [pmalloc received NULL pool, unable to track allocation, exiting]\n"); - abort(); - } - - /* if there is no heap for this pool or it's a big request, just raw, I like how we clean this :) */ - if(p->heap == NULL || size > (p->heap->size / 2)) - { - block = _retried__malloc(size); - p->size += size; - _pool_cleanup_append(p, _pool_free(p, _pool__free, block)); - return block; - } - - /* we have to preserve boundaries, long story :) */ - if(size >= 4) - while(p->heap->used&7) p->heap->used++; - - /* if we don't fit in the old heap, replace it */ - if(size > (p->heap->size - p->heap->used)) - p->heap = _pool_heap(p, p->heap->size); - - /* the current heap has room */ - block = (char *)p->heap->block + p->heap->used; - p->heap->used += size; - return block; -} - -/** - * allocate memory and initialize the memory with the given char c - * - * @deprecated jabberd does use pmalloco instead, this function will be removed - * - * @param p which pool to use - * @param size the size of the allocation - * @param c the initialization character - * @return pointer to the allocated memory - */ -void *pmalloc_x(pool p, int size, char c) -{ - void* result = pmalloc(p, size); - if (result != NULL) - memset(result, c, size); - return result; -} - -/** - * allocate memory and initialize the memory with zero bytes - * - * easy safety utility (for creating blank mem for structs, etc) - * - * @param p which pool to use - * @param size the size of the allocation - * @return pointer to the allocated memory - */ -void *pmalloco(pool p, int size) -{ - void *block = pmalloc(p, size); - memset(block, 0, size); - return block; -} - -/** - * duplicate a string and allocate memory for it - * - * @todo efficient: move this to const char* and then loop through the existing heaps to see if src is within a block in this pool - * - * @param p the pool to use - * @param src the string that should be duplicated - * @return the duplicated string - */ -char *pstrdup(pool p, const char *src) -{ - char *ret; - - if(src == NULL) - return NULL; - - ret = pmalloc(p,strlen(src) + 1); - strcpy(ret,src); - - return ret; -} - -/** - * when pstrdup() is moved to "const char*", this one would actually return a new block - */ -char *pstrdupx(pool p, const char *src) -{ - return pstrdup(p, src); -} - -/** - * get the size of a memory pool - * - * @param p the pool - * @return the size - */ -int pool_size(pool p) -{ - if(p == NULL) return 0; - - return p->size; -} - -/** - * free a pool (and all memory that is allocated in it) - * - * @param p which pool to free - */ -void pool_free(pool p) -{ - struct pfree *cur, *stub; - - if(p == NULL) return; - - cur = p->cleanup; - while(cur != NULL) - { - (*cur->f)(cur->arg); - stub = cur->next; - _pool__free(cur); - cur = stub; - } - -#ifdef POOL_DEBUG - ghash_remove(pool__disturbed,p->name); -#endif - - _pool__free(p); - -} - -/** - * public cleanup utils, insert in a way that they are run FIFO, before mem frees - */ -void pool_cleanup(pool p, pool_cleaner f, void *arg) -{ - struct pfree *clean; - - clean = _pool_free(p, f, arg); - clean->next = p->cleanup; - p->cleanup = clean; -} - -#ifdef POOL_DEBUG -void debug_log(char *zone, const char *msgfmt, ...); -void _pool_stat(xht h, const char *key, void *data, void *arg) -{ - pool p = (pool)data; - - if(p->lsize == -1) - debug_log("pool_debug","%s: %s is a new pool",p->zone, p->name); - else if(p->size > p->lsize) - debug_log("pool_debug","%s: %s grew %d",p->zone, p->name, p->size - p->lsize); - else if((int)arg) - debug_log("pool_debug","%s: %s exists %d",p->zone,p->name, p->size); - p->lsize = p->size; -} - -/** - * print memory pool statistics (for debugging purposes) - * - * @param full make a full report? (0 = no, 1 = yes) - */ -void pool_stat(int full) -{ - if (pool__disturbed == NULL || pool__disturbed == (xht)1) - return; - - ghash_walk(pool__disturbed,_pool_stat,(void *)full); - if(pool__total != pool__ltotal) - debug_log("pool_debug","%d\ttotal missed mallocs",pool__total); - pool__ltotal = pool__total; - - return; -} -#else -/** - * dummy implementation: print memory pool statistics (for debugging purposes, real implementation if POOL_DEBUG is defined) - * - * @param full make a full report? (0 = no, 1 = yes) - */ -void pool_stat(int full) -{ - return; -} -#endif
--- a/mcabber/libjabber/pproxy.c Thu Oct 08 19:40:23 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -/* - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyrights - * - * Portions created by or assigned to Jabber.com, Inc. are - * Copyright (c) 1999-2002 Jabber.com, Inc. All Rights Reserved. Contact - * information for Jabber.com, Inc. is available at http://www.jabber.com/. - * - * Portions Copyright (c) 1998-1999 Jeremie Miller. - * - * Acknowledgements - * - * Special thanks to the Jabber Open Source Contributors for their - * suggestions and support of Jabber. - * - * - */ - -/** - * @file pproxy.c - * @brief presence proxy database - DEPRECATED - * - * @deprecated these functions are not used by jabberd itself (but aim-t uses them), they will be removed from jabberd - * - * The presence proxy database is used to store presences for different resources of a JID. - * - * these aren't the most efficient things in the world, a hash optimized for tiny spaces would be far better - */ - -#include "jabber.h" -