desproxy-0.1.0~pre3/0000755000175000017500000000000010062156661011300 5ustar desproxy-0.1.0~pre3/Makefile.in0000644000175000017500000000114710062156430013342 0ustar # Top level Makefile for desproxy # # Copyright (C) 2004 Miguelanxo Otero Salgueiro # # This program is free software; you can redistribute it and/or modify # it under the tems of the GNU General Public License version 2 as # published by the Free Software Foundation. SHELL = /bin/sh prefix = @prefix@ datadir = @datadir@ localedir = $(datadir)/locale bindir = @prefix@/bin all: @cd src \ && make \ && cd .. clean: @cd src \ && make clean \ && cd .. dist-clean: @cd src \ && make dist-clean \ && cd .. \ && rm Makefile config.h config.log config.status install: @./install-sh $(bindir) $(localedir) desproxy-0.1.0~pre3/AUTHORS0000644000175000017500000000044010062153362012341 0ustar Miguelanxo Otero Salgueiro - Main author and maintainer Rutger Nijlunsing - Patch for proxy authentification. - Patch for variable USER_AGENT Mikhail Krivtsov - Patch for desproxy-dns UDP short write desproxy-0.1.0~pre3/Changes0000644000175000017500000000567510062156661012610 0ustar 0.1.0-pre3 (10/06/2004) - Patched desproxy-dns.c, the UDP short write bug should be ironed out. - Added changes suggested by Dag Wieers to install script and Makefile.in - Removed non-working desproxy-test. - Removed i18n obsolete po dir. Desproxy lacks locale support by now. 0.1.0-pre2 - Important fixes: - BUFFER OVERFLOWS (formely BUFFER OVERRUN's) doesn't take desproxy down. - desproxy-socksserver joins the two previous socks servers (versions 4 and 5) and incorporates some bug fixes. - all the applications terminate only after error or pressing , because waiting for ENTER as before prevented from running in non-terminals (background). - The source code compiles without modification in: - Linux (tested debian 2.2 and 3.0) - MacOS X (tested MacOS X 10.2 SERVER Edition) - SunOS (tested SunOS 5.8) - Removed i18n obsolete messages in po/ (make install will fail when trying to install mo files) 0.1.0-pre1 - Changelog lost. 0.0.22 (01/23/2002) - Just renamed 0.0.22a3 and released 0.0.22. 0.0.22a3 (01/19/2002) - Alpha version again. This time HTTP 400 bug (lacking HOST header bug) should be fixed. Added User-Agent header. 0.0.22a2 (01/14/2002) - Alpha version, release2. Only released to people who requested, tries to work using MS & IBM proxies (strict HTTP/1.1 headers, including HOST). Documentation goes html. 0.0.21 (01/08/2002) - Fixed that silly bug that make socks5server stop working... - Added desproxy-socks4server, a socks v4 server, useful if you have clients that don't support the later socks 5 version (i.e. MS Internet Explorer & friends... :D) 0.0.20 (12/17/2001) - Another unstable release. Just added windows port and fix write() bug. 0.0.19 (11/21/2001) - THIS IS AN UNSTABLE RELEASE!! This release is out to free me from answer many mails requesting desproxy-socks5server to be released. So this is out! NEWS from 0.0.10: - Added desproxy-dns, a dns forwarder - Added desproxy-socks5server, a socks5server using desproxy, and able to use HTTP proxies as parent proxies. - Added socket2socket, a tiny application to connect 2 sockets (useful? -> yes, for me). Many code cleaned (but some code dirtier :P than 0.0.10 release). 0.0.10 (10/11/2001) - Now desproxy supports multiple connections (leaving request_socket open for new connections) It can be now used to connect to web sites using multiple client connections. Thanks to Kandy for the suggestion. 0.0.9 (07/10/2001) - CHANGES.log -> NEWS - new code included : - gettext i18n - configure & install scripts 0.0.8 (07/07/2001) - First CHANGES.log - Started source migration from galician to english desproxy-0.1.0~pre3/config.h.in0000644000175000017500000000300607455352047013332 0ustar /* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if you have the gethostbyname function. */ #undef HAVE_GETHOSTBYNAME /* Define if you have the inet_ntoa function. */ #undef HAVE_INET_NTOA /* Define if you have the memset function. */ #undef HAVE_MEMSET /* Define if you have the select function. */ #undef HAVE_SELECT /* Define if you have the setlocale function. */ #undef HAVE_SETLOCALE /* Define if you have the socket function. */ #undef HAVE_SOCKET /* Define if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define if you have the header file. */ #undef HAVE_ERRNO_H /* Define if you have the header file. */ #undef HAVE_LIBINTL_H /* Define if you have the header file. */ #undef HAVE_LOCALE_H /* Define if you have the header file. */ #undef HAVE_NETDB_H /* Define if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H desproxy-0.1.0~pre3/configure0000755000175000017500000027050407732070146013222 0ustar #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.50. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # # ADDED for compatibility with SunOS # if (test `uname` = "SunOS") \ then LIBS="-lsocket -lnsl" fi # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Avoid depending upon Character Ranges. ac_cr_az='abcdefghijklmnopqrstuvwxyz' ac_cr_AZ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' ac_cr_09='0123456789' ac_cr_alnum=$ac_cr_az$ac_cr_AZ$ac_cr_09 # Sed expression to map a string onto a valid sh and CPP variable names. ac_tr_sh="sed y%*+%pp%;s%[^_$ac_cr_alnum]%_%g" ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[^_$ac_cr_alnum]%_%g" ac_unique_file="src/desproxy.c" # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. 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' # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= 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 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # 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_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$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 ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) 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 | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$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_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } 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 "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$ac_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$ac_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir \ exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; NONE ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. build=$build_alias host=$host_alias target=$target_alias # FIXME: should be removed in autoconf 3.0. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # 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 "$as_me: error: cannot find sources in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # 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 < if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. EOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue cd $ac_subdir # A "../" for each directory in /$ac_subdir. ac_dots=`echo $ac_subdir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` case $srcdir in .) # No --srcdir option. We are building in place. ac_sub_srcdir=$srcdir ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_sub_srcdir=$srcdir/$ac_subdir ;; *) # Relative path. ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; esac # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_sub_srcdir/configure.gnu; then echo $SHELL $ac_sub_srcdir/configure.gnu --help=recursive elif test -f $ac_sub_srcdir/configure; then echo $SHELL $ac_sub_srcdir/configure --help=recursive elif test -f $ac_sub_srcdir/configure.ac || test -f $ac_sub_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\EOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. EOF exit 0 fi exec 5>config.log cat >&5 </dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` PATH = $PATH _ASUNAME } >&5 cat >&5 <\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" ac_sep=" " ;; esac # Get rid of the leading space. done # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. trap 'exit_status=$? # Save into config.log some information that might help in debugging. echo >&5 echo "## ----------------- ##" >&5 echo "## Cache variables. ##" >&5 echo "## ----------------- ##" >&5 echo >&5 # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } >&5 sed "/^$/d" confdefs.h >conftest.log if test -s conftest.log; then echo >&5 echo "## ------------ ##" >&5 echo "## confdefs.h. ##" >&5 echo "## ------------ ##" >&5 echo >&5 cat conftest.log >&5 fi (echo; echo) >&5 test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" >&5 echo "$as_me: exit $exit_status" >&5 rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_status=$?; ac_signal='$ac_signal'; { (exit $ac_status); exit $ac_status; }' $ac_signal done ac_signal=0 # 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 # Let the site file select an alternate cache file if it wants to. # 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 "$as_me:807: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:818: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:826: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_suggest_removing_cache=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:842: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_suggest_removing_cache=: ;; ,set) { echo "$as_me:846: WARNING: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: WARNING: \`$ac_var' was not set in the previous run" >&2;} ac_suggest_removing_cache=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:852: WARNING: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: WARNING: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:854: WARNING: former value: $ac_old_val" >&5 echo "$as_me: WARNING: former value: $ac_old_val" >&2;} { echo "$as_me:856: WARNING: current value: $ac_new_val" >&5 echo "$as_me: WARNING: current value: $ac_new_val" >&2;} ac_suggest_removing_cache=: fi;; esac done if $ac_suggest_removing_cache; then { echo "$as_me:863: WARNING: changes in the environment can compromise the build" >&5 echo "$as_me: WARNING: changes in the environment can compromise the build" >&2;} { echo "$as_me:865: WARNING: consider removing $cache_file and starting over" >&5 echo "$as_me: WARNING: consider removing $cache_file and starting over" >&2;} fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if { (echo "$as_me:884: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:887: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else ac_path_separator=: fi PATH_SEPARATOR="$ac_path_separator" rm -f conftest.sh ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:907: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:922: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:930: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:933: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:942: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:957: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:965: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:968: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:981: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:996: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1004: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1007: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1016: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:1031: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1039: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1042: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi 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 "$as_me:1055: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:1075: found $ac_dir/$ac_word" >&5 break done 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 $# != 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" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1097: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1100: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:1111: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:1126: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1134: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1137: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in 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 "$as_me:1150: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:1165: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1173: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1176: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:1188: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } cat >conftest.$ac_ext <<_ACEOF #line 1193 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compiler, and finding out an intuition # of exeext. echo "$as_me:1209: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:1212: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1215: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `ls a.exe conftest.exe a.* conftest conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1232: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:1238: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1243: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:1249: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1252: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1259: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:1267: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1274: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1276: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1279: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1281: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1284: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:1300: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:1306: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:1312: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1318 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1330: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1333: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1345: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:1352: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1356: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1362 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1377: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1380: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1383: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1386: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:1398: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:1404: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1410 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1422: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1425: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1428: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1431: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:1441: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&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 # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1468: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1471: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1474: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1477: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line 1489 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1502: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1505: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1508: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1511: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line 1521 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1533: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1536: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1539: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1542: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:1583: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # 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 # AmigaOS /C/install, which installs bootblocks on floppy discs # 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 "$as_me:1603: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. case $ac_dir/ in / | ./ | .// | /cC/* \ | /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 $as_executable_p "$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. : elif test $ac_prog = install && grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done 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 "$as_me:1652: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&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}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:1663: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 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 conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:1683: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:1687: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # Checks for libraries. # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:1701: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do # break 2 since there is a loop in there. ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 1723 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1728: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1734: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 1757 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1761: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1767: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break 2 fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:1804: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 1814 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:1819: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1825: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 1848 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:1852: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1858: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:1886: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_header in arpa/inet.h errno.h libintl.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h do ac_ac_Header=`echo "ac_cv_header_$ac_header" | $ac_tr_sh` echo "$as_me:1900: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$ac_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1906 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:1910: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:1916: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$ac_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$ac_ac_Header=no" fi rm -f conftest.err conftest.$ac_ext fi echo "$as_me:1935: result: `eval echo '${'$ac_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 if test `eval echo '${'$ac_ac_Header'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1952 "configure" #include "confdefs.h" #include #include #include int main () { struct tm *tp; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1967: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1970: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1973: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1976: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:1986: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi # Checks for library functions. echo "$as_me:1997: checking for working memcmp" >&5 echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 if test "${ac_cv_func_memcmp_working+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_working=no else cat >conftest.$ac_ext <<_ACEOF #line 2006 "configure" #include "confdefs.h" int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = 0x40, c1 = 0x80, c2 = 0x81; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) exit (1); /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) exit (1); } exit (0); } ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:2042: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2045: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:2047: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2050: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memcmp_working=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_func_memcmp_working=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi fi echo "$as_me:2062: result: $ac_cv_func_memcmp_working" >&5 echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext" echo "$as_me:2066: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2072 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:2080: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:2086: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 2108 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 2126 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line 2147 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:2173: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2176: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:2178: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2181: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_ext fi fi fi echo "$as_me:2194: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_func in gethostbyname inet_ntoa memset select setlocale socket do ac_ac_var=`echo "ac_cv_func_$ac_func" | $ac_tr_sh` echo "$as_me:2207: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$ac_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2213 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:2244: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2247: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:2250: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2253: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$ac_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$ac_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:2263: result: `eval echo '${'$ac_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$ac_ac_var'}'`" >&6 if test `eval echo '${'$ac_ac_var'}'` = yes; then cat >>confdefs.h <confcache <<\_ACEOF # 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, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # 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 \ "s/'/'\\\\''/g; s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:2354: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated automatically by configure. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } exec 6>&1 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\EOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:2527: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # Handling of arguments. 'Makefile' ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; 'src/Makefile' ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; 'config.h' ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; # This is an error. -*) { { echo "$as_me:2551: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) { { echo "$as_me:2556: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; esac shift done exec 5>>config.log cat >&5 << _ACEOF ## ----------------------- ## ## Running config.status. ## ## ----------------------- ## This file was extended by $as_me 2.50, executed with > $ac_cs_invocation on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF EOF cat >>$CONFIG_STATUS <<\EOF # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit $?); exit $?; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : ${TMPDIR=/tmp} { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } EOF cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@DEFS@,$DEFS,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CPP@,$CPP,;t t s,@LIBOBJS@,$LIBOBJS,;t t 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_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" EOF cat >>$CONFIG_STATUS <<\EOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } 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 $srcdir in .) ac_srcdir=. if test -z "$ac_dots"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_dots$srcdir$ac_dir_suffix ac_top_srcdir=$ac_dots$srcdir ;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_dots$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:2777: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ configure_input="Generated automatically from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:2795: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:2808: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done EOF cat >>$CONFIG_STATUS <<\EOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:2869: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:2880: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:2893: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in EOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\EOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end EOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\EOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\EOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated automatically by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then { echo "$as_me:3010: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } fi rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done EOF cat >>$CONFIG_STATUS <<\EOF { (exit 0); exit 0; } EOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: exec 5>/dev/null $SHELL $CONFIG_STATUS || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi desproxy-0.1.0~pre3/configure.in0000644000175000017500000000124307455352047013621 0ustar # Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([src/desproxy.c]) AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET # Checks for libraries. # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h errno.h libintl.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_TIME # Checks for library functions. AC_FUNC_MEMCMP AC_HEADER_STDC AC_CHECK_FUNCS([gethostbyname inet_ntoa memset select setlocale socket]) AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT desproxy-0.1.0~pre3/install-sh0000755000175000017500000000151610062156401013277 0ustar #!/bin/sh # # desproxy install script # # (c) 2004 Miguelanxo Otero Salgueiro # BINDIR=$1 LOCALEDIR=$2 BINS="desproxy desproxy-inetd desproxy-dns desproxy-socksserver socket2socket" echo "Using binary dir: $BINDIR" echo "Using locale dir: $LOCALEDIR" # Directories echo "Making directories..." mkdir -p $BINDIR mkdir -p $LOCALEDIR # Binaries echo "Copying binaries..." for bin in $BINS; do if (cp src/$bin $BINDIR); then echo "$bin installed" else exit 1 fi done # Locales if (test $LOCALEDIR != ""); then echo "" echo "*************************************" echo "* This version lacks locale support *" echo "* locales won't be installed *" echo "*************************************" echo "" fi # Installation OK echo "" echo "*******************" echo "* Installation OK *" echo "*******************" echo "" desproxy-0.1.0~pre3/doc/0000755000175000017500000000000007731654161012054 5ustar desproxy-0.1.0~pre3/doc/config-en.html0000644000175000017500000002352407731653760014621 0ustar desproxy Readme

desproxy Readme

desproxy - a TCP tunnel for HTTP proxies

(c) 2001 Miguelanxo Otero Salgueiro
desproxy.sourceforge.net


desproxy is just an answer to a question I have been wondering, for about a year: ¿Is there any way to make TCP connections trought HTTP proxies? Short answer: YES! Long answer: YES, but at the expense of decreased flexibility. Maybe it isn't useful for you (I hope that's not your case), or its too difficult for you newbie. desproxy just stands between your proxy and your favourite TCP application, waiting for a connection to make a TCP tunnel trought the HTTP proxy. Let's see one example

Real life example

Imagine you're inside a corporation, with a HTTP/1.1 compliant proxy (proxy.corporation.com:8080) that is the only way to get out there... But, hey! you want to chat using your favourite irc server (irc.foo.bar:6667 isn't that?) so you launch "desproxy" this way:

desproxy irc.foo.bar 6667 proxy.corporation.com 8080 6667

Now, desproxy is listening on your local port 6667, waiting for a connection (from your irc client). So you launch xchat, zircon... and type

/server 127.0.0.1 6667

xchat now tries to connect with your local port 6667, desproxy "hears the bell" and after accepting the incoming connection, makes a connection to the irc server (irc.foo.bar 6667) trough the HTTP proxy (proxy.corporation.com 8080). When it gets the connection with the irc server, desproxy hooks the two sockets together, so xchat gets the wellcome message from the irc server as if it were connected to /server irc.foo.bar 6667 .

Usage

Usage: desproxy remote_host remote_port proxy_host proxy_port local_port

remote_host & remote_port: Address of the machine you want to connect to.
proxy_host & proxy_port : Address of the HTTP proxy.
local_port : The one in which desproxy will listen waiting for connections.

Programs reported to work using "desproxy"

  • telnet (OK)
  • ftp (not transfers, just basic commands)
  • ncftp (untested, should work in passive mode)
  • ssh & scp (OK)
  • popclient & fetchmail (OK)
  • sendmail (OK)
  • xchat, zircon, mIRC for windows (only basic behaviour, no DCC)

Programs that WILL NOT work using "desproxy"

Those that accept (or request) connections to start from the other side of the proxy (remote to local), like classic ftp (not passive).

desproxy-inetd

desproxy-inetd is just a flavor of desproxy that doesn't bind to a local port but reads directly from standard input (and doensn't display anything beside the raw incoming "tunnelized" connection.

Usage: desproxy-inetd remote_host remote_port proxy_host proxy_port

NOTE the lack of local_host. desproxy-inetd is designed to work like any other inetd daemon. Here is my /etc/inetd.conf line for fetchmail:

pop3 stream tcp nowait mail /usr/bin/desproxy-inetd desproxy-inetd atlas.uvigo.es 110 httpproxy.uvigo.es 8080

desproxy-inetd works great to test if your proxy supports TCP tunneling; just launch

desproxy-inetd ftp.gnu.org 21 your.proxy your_proxy_port

and wait to see the FTP prompt! does it work? great! NO?...

desproxy-socks4server

desproxy-socks4server is a Socks version 4 server using desproxy . That means you can manage dinamic connections trough your HTTP proxy. For example you can use MSIE, MS Messenger, News readers, Irc clients... every application supporting a socks server/proxy.

desproxy-socks5server

desproxy-socks5server is a Socks version 5 server, just like desproxy-socks4server is a Socks version 4 server.

desproxy-dns

desproxy-dns is a dns forwarder using desproxy. It's used in conjuction with a socks server, because many clients need dns access to resolve names prior to passing them to the socks server. It supports UDP & TCP access, and forwards dns queries using TCP connections to public DNS servers. You can use any DNS server you wish, just search the web for one and give it a try!

Troubleshooting

A normal desproxy session looks like this:

miguel@Kosmos3000$ desproxy 127.0.0.1 21 127.0.0.1 4480 2222
-----------------------------------
desproxy 0.0.8

HTTP/1.1
(c) Miguelanxo Otero Salgueiro 2001
-----------------------------------

Listening on port 2222
Connection request from 127.0.0.1, port 1227
Connecting to http proxy (127.0.0.1:4480)
Bidirectional connection stablished
(127.0.0.1:21) <-> (localhost)
proxy -> local (72) bytes
local -> proxy (13) bytes
proxy -> local (35) bytes
local -> proxy (14) bytes
proxy -> local (447) bytes
End of connection.

Here, I connect to my local ftp server (127.0.0.1:21) using my local proxy (127.0.0.1:4480). You can see were the connection from another session was accepted (from 127.0.0.1 too :)), how after the connection is accepted desproxy connects to the proxy and some REAL interchange of bytes (a FTP login session).

"desproxy" is quite self explanatory about errors. "desproxy-inetd" is far more obscure, because the way inetd uses it (can't print error messages).

Basically there are two kind of errors:
  • Errors reported when connecting to the proxy: the http page showing the error is displayed.
  • Every other error: a short error message is displayed.
Errors reported by proxy may be the worse...

Some common HTTP errors (as reported by the proxy)

  • HTTP 400 Bad Request -> some versions of desproxy (0.0.21) cause this error (FATAL)
  • HTTP 403 Forbidden -> forbidden to do that (FATAL)
  • HTTP 404 Not Found -> Page not found, or resource not found (MINOR)
  • HTTP 405 Method not Allowed -> can do CONNECT method (FATAL)
  • HTTP 500 Internal Server Error -> maybe you're trying to connect to a closed port (conenection refused) (MINOR)
  • HTTP 503 Service Unavailable -> The proxy can't reach the site (MINOR)
  • HTTP 505 HTTP Version Not Supported -> CONNECT method not available (FATAL)
  • HTTP 502 Bad Gateway -> Stands for "DNS lookup error" (MINOR)
(FATAL) -> forget about using "desproxy", you can't surpass the proxy.
(TODO) -> To do, not yet implemented.
(MINOR) -> temporary fault or maybe YOUR fault!

COPYING

desproxy is licensed using the GNU GENERAL PUBLIC LICENSE.
Please read COPYING for more details.





         


desproxy-0.1.0~pre3/doc/manual-en.html0000644000175000017500000004057307731654161014630 0ustar  

 
  desproxy Manual
 
 
  

NOTE: The most recent version of this document can be obtained here.

Introduction: What is desproxy for?

Desproxy is a TCP tunnel for HTTP proxies.

HTTP proxies are network servers that are used to give HTTP (web) access to computers that are not connected to the Internet. This is a typical scenario in corporate networks and recently in home networks too. HTTP proxies connect to the Internet either directly or via a parent proxy (which in fact connects to the Internet directly or via another parent proxy, and so on...)

HTTP clients (web browsers) use HTTP proxies to request web pages; the HTTP server just forwards those request to the destination server. All the negotiation is done via the HTTP protocol, which is designed just to carry HTTP requests and no generic (TCP/IP) traffic. That is why you can't (normally) use Internet applications beside your web server if you are behind a HTTP proxy.

That is what desproxy is good for. Desproxy is a TCP tunnel, which means desproxy can forward TCP/IP traffic via a HTTP proxy. Desproxy uses a HTTP/1.1 method (CONNECT) to establish TCP/IP connections on demand. CONNECT is used for SSL connections when accessing to secure sites, so if you can access sites that support SSL (www.hotmail.com for example) you can use desproxy.

Note I recall TCP/IP traffic.

Not all IP (Internet) traffic is just TCP/IP. In fact there are two more protocols widely used in the Internet not supported by desproxy: UDP and ICMP:

  • ICMP is used to manage large IP networks. The only application using ICMP you may miss is ping.

  • UDP is an unreliable connection-less fast transport protocol, mostly used in network games and other applications that need low latency network traffic. Notably DNS uses UDP packets for fast delivery.

Will desproxy work with my HTTP proxy?

Short answer: just give it a try

Long answer: desproxy should work with every HTTP proxy, with the following exceptions:

  • MS Proxies with NTLM authentication. NTLM is a proprietary authentication method from Microsoft, not a standard authentication method. Maybe in the future desproxy will support NTLM authentication, but currently it doesn't.

  • HTTP/1.0 Proxies. Desproxy needs the CONNECT method, which is only available from HTTP/1.1 protocol version. It's very unlikely your proxy doesn't accept HTTP/1.1 requests.

  • HTTP/1.1 Proxies without the CONNECT method. Maybe your network administrator deactivated CONNECT support in the proxy, or maybe CONNECT is restricted to the HTTPS port (443).

Assumptions

Let's assume the following:
  • your HTTP proxy host name is "proxy" and its address is "192.0.0.1"

  • your HTTP proxy port is "8080"

  • your HTTP proxy doesn't need authentication. It case you need HTTP authentication, please read this.

  • your system console will be:

    • MS/DOS box if you are running Windows 95, Windows 98, or Windows ME

    • Windows NT command shell if you are running Windows NT, Windows 2000 or Windows XP

    • A terminal (xterm, the console or a virtual terminal) if you are running Linux, *BSD or other UN*X

About connections

Imagine you need a network application that uses only one TCP/IP connection with just one server. That's the case of IRC in which you connect to an IRC server or ssh where you tipically connect just to one UNIX computer at a time. That's what I called a "static connection".

Of course that's not the case of a web browser or a file sharing program, both of them doing several connections at a time to different computers. That's what I call "dynamic connections".

Static connections examples

How to use desproxy to...

...connect to IRC

Suppose you want to connect to IRC using irc.undernet.org port 6667 as your IRC server. First you have to start a system console (see Assumptions above for details) and type

desproxy irc.undernet.org 6667 proxy 8080 1080

That should start desproxy, giving you the copyright notice along with some information. The following is a screen capture from desproxy 0.0.23

-----------------------------------
desproxy                     0.0.23

(c) Miguelanxo Otero Salgueiro 2001

This release brought to you patched
by Rutger Nijlunsig.

See RutgerWork.txt in documentation
for details about new features.

Great work guy!
-----------------------------------

TCP port 1080 Binded & Listening
Press ENTER to Quit

Desproxy reports it is listening in local port 1080 ready for a connection.

Open your favourite IRC client (install it first ;D) and connect to 127.0.0.1 port 1080 as your irc server (127.0.0.1 is a virtual IP, always referencing to your local machine). Then, your IRC client should connect to desproxy. It looks like

Connection request from 127.0.0.1, port 1220
Connecting to http proxy (proxy:8080)
Bidirectional connection established

Then you should be able to use your IRC client as if you were directly connected to irc.undernet.org.

...log in a computer using ssh

Suppose you have a shell account in a computer that supports secure connections via ssh. Let's assume it's called shell.corporate.com. SSH uses port number 22 by default. So start a new system console and type:

desproxy shell.corporate.com 22 proxy 8080 1080

Then, tell your ssh client to connect to localhost (127.0.0.1) port 1080 and you should get a ssh password prompt!

...use other static clients

Let's assume you want to use network application X, which doesn't support HTTP proxies but use one TCP/IP connection (like IRC and SSH). To make X work with desproxy, you just have to do the following:
  • Search for the default port of that application:

    • ftp: 21

    • ssh: 22

    • telnet: 23

    • smtp: 25

    • ...

  • Search for the default server of that application (if there is one)

    • AIM: toc.oscar.aol.com (port 21)

    • ICQ: icq.mirabilis.com (port 4000)

    • Yahoo messenger: cs.yahoo.com (port 5050)

    • MSN Messenger: messenger.hotmail.com (port 1863)

    • ...

  • Start desproxy, passing that info as command line parameters. The format is

    desproxy remote_host remote_port proxy_host proxy_port local_port

    Just give a local_port of your desire, but always over 1023, cause lower ports may need administrator privileges.

Using desproxy with dynamic connections

You can see that for every application that needs to be un-proxyzed you have to start a desproxy program. That is OK if you are using irc, ssh or other application that always connects to the same server. But if you need to dynamically establish TCP connections it's impossible to follow that path.

That's why I wrote desproxy-socks5server. Desproxy-socks5server is just a desproxy implementation of a Socks 5 Server. A Socks 5 Server is like a "TCP proxy": you just request a TCP connection and the Socks 5 Server does the work for you.

Of course, client applications need to have support for Socks 5 Server. If your application lacks Socks 5 support, you can use desproxy-socks4server instead, given it has Socks 4 support.

If the application lacks any Socks support, and needs dynamic connections, you can't do anything: it won't work behind the HTTP proxy.

Using desproxy-socksXserver (X being 4 or 5) is very easy: you only have to start a system console and type:

desproxy-socks4server proxy 8080 1080

or

desproxy-socks5server proxy 8080 1080

Here I'm assuming "proxy" and "8080" to be your proxy name and port.

That should start the Socks server. Then you have to tell your application to use Socks server "127.0.0.1" port "1080". Just see in the proxy configuration and look for "Socks Server" adjustments.

That is not all, unfortunately. Beside having your Socks server up you need DNS access. Of course if you don't have DNS access, you just have to use desproxy-dns. So let's see the two scenarios

DNS for dynamic connections

Direct DNS access

If you have direct DNS access then you don't need to do anything else. You know you have direct DNS access if you can resolve host names to IP addresses. To test DNS just start a system console and type

ping www.hotmail.com

Of course, you can't ping anything outside the proxy, but ping should display the IP address of hotmail, if it can resolve it. Ping should display something like

Pinging www.hotmail.com [64.4.43.7] with 32 bytes of data

if you are using MS Windows, or

PING www.hotmail.com (64.4.43.7): 56 data bytes

if you are running Linux, *BSD or UN*X.

Ping should also complain about losing all the packets. OK, that's as it should be. If ping displays "unknown host www.hotmail.com" try a different one, like "www.yahoo.com" or "www.sun.com". It that three displayed "unknown host" then you don't have DNS access.

No DNS access

If you don't have DNS access you have to do two things:
  • Search for a public accessible DNS server IP address

    Let's assume you find one (195.196.180.14).

  • Start desproxy-dns

    Open another system console and type

    desproxy-dns 195.196.180.14 proxy 8080

After that you will have a DNS server running in your computer.

NOTE: as desproxy-dns listens in port 53 (which is less than 1024) you may need administrator privileges to exec desproxy-dns (in fact if you are running UN*X, you actually have to run desproxy-dns as root).

OK, so you have a dns server accessible now. But your computer doesn't know anything about that. You must configure your network accordingly (again, need to be root in UN*X).

In Windows just go to Control Panel-> Network-> TCP/IP -> Network Adapter-> Properties-> DNS Configuration. Select "Activate DNS" and add "127.0.0.1" as a DNS server. Then restart. Test the ping again. Works? OK!

In UN*X just edit /etc/resolv.conf and add the line "nameserver 127.0.0.1". You don't have to restart anything. Just test ping and see if it works.

Dynamic connections examples

How to use desproxy to...

...instant message anyone

Just remember to get a DNS server (directly or using desproxy-dns) see above. Then, start a socks4server

desproxy-socks4server proxy 8080 1080

You could start desproxy-socks5server, but some applications refuse to work with Socks 5 (MS Internet Explorer for example) and the Socks 4 Version is faster.

Remember to leave blank the username and password fields in the client Socks configuration: desproxy does all the work, in case your HTTP proxy needs authentication.

Get your favourite Instant Messaging program and configure it to use Socks 5 Server "127.0.0.1" port "1080". Then, log in and have fun!

...share files

Again, the same applies for DNS. Remember to start a desproxy-socks4server, configure your program and go!

About HTTP Authentication

Some HTTP proxies need for security reasons a method of checking client's identity. That's called HTTP authentication (or HTTP authorization).

Despoxy now supports Basic HTTP authentication. If your proxy needs other kind of authentication (either Digest or NTLM) desproxy won't work.

For desproxy to work with a HTTP proxy that needs authentication, you have to tell desproxy which username and password to use. Desproxy reads the environment variable PROXY_USER to get that info.

Suppose your proxy username is "mayka" and your proxy password is "007sgotLTK". Then, before using any of the desproxy programs you should type:

set PROXY_USER=mayka:007sgotLTK

in your system console.

Beware passwords can include some characters that should be escaped from the system console. For example, if your password is "moon!=sun", and you are running Linux, you should type

export PROXY_USER=yourusername:moon\!\=sun

Note characters "!" and "=" are escaped using the backslash "\". If you are running MS Windows, as long as I know, you don't have to escape any valid password character.

Troubleshooting

A normal desproxy session looks like this:

miguel@Kosmos3000$ desproxy 127.0.0.1 21 127.0.0.1 4480 2222

-----------------------------------
desproxy                      0.0.8

HTTP/1.1
(c) Miguelanxo Otero Salgueiro 2001
-----------------------------------

Listening on port 2222
Connection request from 127.0.0.1, port 1227
Connecting to http proxy (127.0.0.1:4480)
Bidirectional connection stablished
(127.0.0.1:21) <-> (localhost)
End of connection.

Here, I connected to my local ftp server (127.0.0.1:21) using my local proxy (127.0.0.1:4480). You can see how, after the connection is accepted, desproxy connected to the proxy, interchanged some bytes (a FTP session) and terminates the connection.

Desproxy is quite self explanatory about errors. Desproxy-inetd is far more obscure, because the way inetd uses it (can't print error messages) to the console.

Basically there are two kind of errors:

  • Errors reported when connecting to the proxy: the http page showing the error is displayed.

  • Every other error: a short error message is displayed.

Errors reported by proxy may be the worse...

Some common HTTP errors (as reported by the proxy)

  • HTTP 400 Bad Request - Some versions of desproxy (0.0.21) cause this error (FATAL)

  • HTTP 403 Forbidden - Forbidden to do that (FATAL)

  • HTTP 404 Not Found - Page not found, or resource not found (MINOR)

  • HTTP 405 Method not Allowed - Can't do CONNECT method (FATAL)

  • HTTP 500 Internal Server Error - Maybe you're trying to connect to a remote closed port (remote site reported connection refused) (MINOR)

  • HTTP 503 Service Unavailable -> The proxy can't reach the site (MINOR)

  • HTTP 505 HTTP Version Not Supported - CONNECT method not available (FATAL)

  • HTTP 502 Bad Gateway - Stands for "DNS lookup error" (MINOR)

(FATAL) - Forget about using "desproxy", you can't surpass the proxy.
(TODO) - To do, not yet implemented.
(MINOR) - Temporary fault or maybe YOUR fault!.


desproxy-0.1.0~pre3/src/0000755000175000017500000000000010062156407012065 5ustar desproxy-0.1.0~pre3/src/Makefile.in0000644000175000017500000000353610062152071014132 0ustar # # Makefile.in: makefile for desproxy src/ directory # # Copyright (C) 2003 Miguelanxo Otero Salgueiro # # This program is free software; you can redistribute it and/or modify # it under the tems of the GNU General Public License version 2 as # published by the Free Software Foundation. # # prefix = @prefix@ bindir = @prefix@/bin localedir = @prefix@/share/locale SHELL = /bin/sh INSTALL_PROGRAM = @INSTALL_PROGRAM@ CC = @CC@ CFLAGS = @CFLAGS@ -Wall DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" LIBS = @LIBS@ objects = util.o desproxy.o desproxy-inetd.o desproxy-socksserver.o \ desproxy-dns.o socket2socket.o bins = desproxy desproxy-inetd desproxy-socksserver \ desproxy-dns socket2socket all: $(bins) desproxy: desproxy.o util.o $(CC) $(CFLAGS) $(LIBS) util.o desproxy.o -o desproxy desproxy-inetd: desproxy-inetd.o util.o $(CC) $(CFLAGS) $(LIBS) util.o desproxy-inetd.o -o desproxy-inetd desproxy-socksserver: desproxy-socksserver.o util.o $(CC) $(CFLAGS) $(LIBS) util.o desproxy-socksserver.o -o desproxy-socksserver desproxy-dns: desproxy-dns.o util.o $(CC) $(CFLAGS) $(LIBS) util.o desproxy-dns.o -o desproxy-dns socket2socket: socket2socket.o util.o $(CC) $(CFLAGS) $(LIBS) util.o socket2socket.o -o socket2socket desproxy.o: desproxy.c desproxy.h $(CC) $(CFLAGS) $(DEFS) -c desproxy.c desproxy-inetd.o: desproxy-inetd.c desproxy.h $(CC) $(CFLAGS) $(DEFS) -c desproxy-inetd.c desproxy-socksserver.o: desproxy-socksserver.c desproxy.h $(CC) $(CFLAGS) $(DEFS) -c desproxy-socksserver.c desproxy-dns.o: desproxy-dns.c desproxy.h $(CC) $(CFLAGS) $(DEFS) -c desproxy-dns.c socket2socket.o: socket2socket.c desproxy.h $(CC) $(CFLAGS) $(DEFS) -c socket2socket.c util.o: util.c desproxy.h $(CC) $(CFLAGS) $(DEFS) -c util.c clean: rm -rf $(objects) $(bins) desproxy.conf install: install dist-clean: rm -rf $(objects) $(bins) Makefile desproxy-0.1.0~pre3/src/desproxy-dns.c0000644000175000017500000001702110062144734014671 0ustar /* * desproxy-dns.c: DNS forwarder through HTTP proxy * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include "desproxy.h" #include #define DNSPORT 53 #define MAXREQUESTLEN 512 #define PROGRAM_NAME "desproxy-dns" #define PROGRAM_VERSION VERSION #define UDP_CONNECTION (MAX_CONNECTIONS - 1) char UDP_buffer[MAXREQUESTLEN]; int request_socket, maxfd; struct request { unsigned char buffer[MAXREQUESTLEN]; unsigned short int size; unsigned short int bib; // Bytes In Buffer } requests[MAX_CONNECTIONS]; /* * Function: void EOC_dns(int connection) * Purpose : terminates connection gracefully * Params : int connection */ void EOC_dns (int connection) // terminates connection { debug_printf (">EOC_dns(%d)\n", connection); if (connection != UDP_CONNECTION) { FD_CLR (client_socket[connection], &mask); FD_CLR (client_socket[connection], &rmask); close (client_socket[connection]); } FD_CLR (proxy_socket[connection], &mask); FD_CLR (proxy_socket[connection], &rmask); close (proxy_socket[connection]); client_socket_is_free[connection] = 1; debug_printf ("EOC_dns>\n"); } int answer_request (int connection, int size) { int count; int htons_size; char buffer[MAXREQUESTLEN + 2]; debug_printf (">answer_request(%d,%d)\n", connection, size); if (connection == UDP_CONNECTION) { memcpy (&buffer[2], UDP_buffer, size); htons_size = htons (size); memcpy (buffer, &htons_size, 2); debug_printf ("UDP\n"); } else { memcpy (buffer, requests[connection].buffer, size + 2); debug_printf ("TCP\n"); } debug_printf ("proxy_host %s\n", proxy_host); debug_printf ("proxy_port %s\n", proxy_port); if (connect_host_to_proxy (connection, dns_server, "53") != 0) { printf ("connect_host_to_proxy: ERROR\n"); return (-1); } if ((count = write (proxy_socket[connection], buffer, size + 2)) == -1) { perror ("write"); return (-2); } debug_printf ("#BEGIN OF REQUEST#"); if (DEBUG) { write (1, buffer, count); fflush (stdout); } debug_printf ("#END OF REQUEST#"); debug_printf ("LOCAL->PROXY(%d)\n", count); if ((count = read (proxy_socket[connection], buffer, 2)) == -1) { perror ("read"); return (-3); } size = ntohs (*((unsigned short int *) buffer)); debug_printf ("size=%d\n", size); if ((count = read (proxy_socket[connection], &buffer[2], size)) == -1) { perror ("write"); return (-4); } debug_printf ("PROXY->LOCAL(%d)\n", count); if (connection == UDP_CONNECTION) { /*size = count - 2;*/ /*memcpy (buffer, &buffer[2], size);*/ if ((count = sendto (client_socket[connection], &buffer[2], size, 0, (struct sockaddr *) &client, client_length)) != size) { perror ("sendto"); //short write return (-5); } } else { if ((count = write (client_socket[connection], buffer, size + 2)) == -1) { perror ("write"); return (-6); } } debug_printf ("LOCAL->CLIENT(%d)\n", count); debug_printf ("answer_request>\n"); return (0); } void parse_command_line (int argc, char **argv) { debug_printf (">parse_command_line(COMMAND_LINE)\n"); if (argc != 4) { printf (gettext ("Usage: desproxy-dns dns_server proxy_host proxy_port\n\n")); exit (1); } dns_server = argv[1]; proxy_host = argv[2]; proxy_port = argv[3]; debug_printf ("parse_command_line>\n"); } void process_connection_request (void) { int connection; debug_printf (">process_connection_request()\n"); for (connection = 0; connection < MAX_CONNECTIONS - 1; connection++) if (client_socket_is_free[connection]) break; if (connection == MAX_CONNECTIONS - 1) { printf (gettext ("There are no connections available at this time\n")); } else { client_length = sizeof (client); client_socket[connection] = accept (request_socket, (struct sockaddr *) &client, &client_length); if (client_socket[connection] < 0) { perror ("accept"); EOC_dns (connection); return; } client_socket_is_free[connection] = 0; printf (gettext ("TCP request from %s, port %d\n"), inet_ntoa (client.sin_addr), ntohs (client.sin_port)); if (client_socket[connection] > maxfd) maxfd = client_socket[connection]; FD_SET (client_socket[connection], &mask); requests[connection].bib = 0; // initializes requests[connection] } debug_printf ("process_connection_request>\n"); } int main (int argc, char **argv) { int connection; int nfound; int count; struct timeval timeout; signal (SIGPIPE, SIG_IGN); initialize_gettext (); print_program_version (PROGRAM_NAME, PROGRAM_VERSION); parse_command_line (argc, argv); request_socket = listen_in_TCP_port (DNSPORT); client_socket[UDP_CONNECTION] = bind_UDP_port (DNSPORT); if (fcntl (client_socket[UDP_CONNECTION], F_SETFL, O_NONBLOCK) < 0) // mark UDP socketet as NON BLOCKING { perror ("fnctl"); exit (1); } printf (gettext ("Press to Quit\n\n")); mark_all_client_sockets_as_free (); FD_ZERO (&mask); FD_SET (request_socket, &mask); maxfd = request_socket; while (1) { rmask = mask; timeout.tv_sec = 0; timeout.tv_usec = 500000; nfound = select (maxfd + 1, &rmask, NULL, NULL, &timeout); debug_printf ("nfound> (%d)\n", nfound); if (nfound < 0) { if (errno == EINTR) { printf (gettext ("Interrupted by system call\n")); continue; } perror ("select"); exit (1); } if (FD_ISSET (request_socket, &rmask)) // processes connection requests { process_connection_request (); } for (connection = 0; connection < MAX_CONNECTIONS - 1; connection++) // TCP connections { if (!client_socket_is_free[connection]) { debug_printf ("client_socket_is_free[%d]=1\n", connection); if (FD_ISSET (client_socket[connection], &rmask)) { if ((count = read (client_socket[connection], buffer, BUFFER_SIZE)) == -1) { perror ("read"); exit (1); } if (count == 0) EOC_dns (connection); else { memcpy (&requests[connection]. buffer[requests[connection].bib], buffer, count); requests[connection].bib = requests[connection].bib + count; if (requests[connection].bib > 2) // if at least 2 bib (Bytes In Buffer), we have request size { requests[connection].size = htons (* ((unsigned short int *) &requests[connection].buffer[0])); if (requests[connection].size == requests[connection].bib - 2) { if (answer_request (connection, requests[connection].size) < 0) { EOC_dns (connection); } } } } } } } client_length = sizeof (client); memset (&client, 0, sizeof client); if ((count = recvfrom (client_socket[UDP_CONNECTION], UDP_buffer, MAXREQUESTLEN, 0, (struct sockaddr *) &client, &client_length)) < 1) // UDP connections { if (errno != EAGAIN) { perror ("recvfrom"); exit (1); } } else { printf (gettext ("UDP request from %s, port %d\n"), inet_ntoa (client.sin_addr), ntohs (client.sin_port)); answer_request (UDP_CONNECTION, count); { EOC_dns (UDP_CONNECTION); } } fflush (stdout); } exit (0); } desproxy-0.1.0~pre3/src/desproxy-inetd.c0000644000175000017500000000456407732027542015227 0ustar /* * desproxy-inetd.c: use desproxy from inetd * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include "desproxy.h" #define PROGRAM_NAME "desproxy-inetd" #define PROGRAM_VERSION VERSION char *remote_host, *remote_port; void client_to_proxy (void) { int count; if ((count = read (0, buffer, sizeof (buffer))) == -1) { perror ("read"); exit (1); } if (count == 0) { exit (0); } else { if ((count = write (proxy_socket[0], buffer, count)) == -1) { perror ("write"); exit (1); } } } void proxy_to_client (void) { int count; if ((count = read (proxy_socket[0], buffer, sizeof (buffer))) == -1) { perror ("read"); exit (1); } if (count == 0) { exit (0); } else { if ((count = write (1, buffer, count)) == -1) { perror ("write"); exit (1); } } } void parse_command_line (int argc, char **argv) { debug_printf (">parse_command_line(COMMAND_LINE)\n"); if (argc != 5) { print_program_version (PROGRAM_NAME, PROGRAM_VERSION); printf (gettext ("Usage: desproxy-inetd remote_host remote_port proxy_host" " proxy_port\n\n")); exit (1); } remote_host = argv[1]; remote_port = argv[2]; proxy_host = argv[3]; proxy_port = argv[4]; debug_printf ("parse_command_line>\n"); } void process_connection_request (void) { if (connect_host_to_proxy (0, remote_host, remote_port) != 0) { printf ("connect_host_to_proxy: ERROR\n"); exit (1); } } int main (int argc, char **argv) { int nfound; struct timeval timeout; signal (SIGPIPE, SIG_IGN); initialize_gettext (); parse_command_line (argc, argv); FD_ZERO (&mask); FD_SET (0, &mask); process_connection_request (); while (1) { rmask = mask; timeout.tv_sec = 5; timeout.tv_usec = 0; nfound = select (maxfd + 1, &rmask, NULL, NULL, &timeout); debug_printf ("%d", nfound); if (nfound < 0) { if (errno != EINTR) { perror ("select"); exit (1); } } if (FD_ISSET (0, &rmask)) { client_to_proxy (); } if (FD_ISSET (proxy_socket[0], &rmask)) { proxy_to_client (); } } } desproxy-0.1.0~pre3/src/util.c0000644000175000017500000004066607732027447013235 0ustar /* * util.c: misc functions common to all desproxy binaries * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include #include "desproxy.h" /* * Function : encode_base64 (const char *string, char *p) * Purpose : creates a base 64 encoded string * Params : p - string to encode * : s - string buffer to write into * * Note : Taken from transconnect (http://transconnect.sourceforge.net/) */ static void base64_encode (const char *s, char *p) { char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int i, length; length = strlen (s); for (i = 0; i < length; i += 3) { *p++ = base64[s[0] >> 2]; *p++ = base64[((s[0] & 3) << 4) + (s[1] >> 4)]; *p++ = base64[((s[1] & 0xf) << 2) + (s[2] >> 6)]; *p++ = base64[s[2] & 0x3f]; s += 3; } if (i == length + 1) *(p - 1) = '='; else if (i == length + 2) *(p - 1) = *(p - 2) = '='; *p = '\0'; } /* * Function : debug_printf(char *fmt, ...) * Purpose : prints arguments like printf if DEBUG is set, and * adds fflush(stdout) * Params : same as printf, as defined in * * Note : this function obtained via IRC chat in * irc.openprojects.net, #c channel. */ int debug_printf (const char *fmt, ...) { int n; va_list ap; if (DEBUG) { va_start (ap, fmt); n = vprintf (fmt, ap); va_end (ap); fflush (stdout); return n; } return 0; } /* * Function : char *get_console_line (void) * Purpose : gets a line from console to char console_line[256] * Params : none */ char * get_console_line (void) { int count; fgets (console_line, 256, stdin); for (count = 0; count < strlen (console_line); count++) if (console_line[count] < 32) console_line[count] = 0; return console_line; } /* * Function : void strtolower(char *string) * Purpose : changes char *string to lowercase * Params : char *string - string to lowercase */ void strtolower (char *string) { int count; for (count = 0; count < strlen (string); count++) { string[count] = tolower (string[count]); } } /* * Function : void print_connection(int connection, char *string) * Purpose : outputs info string for a connection * Parms : int connection - numbre of connection * char *string - text to output */ void print_connection (int connection, char *string) { printf (gettext ("Connection")); printf (" #%d: %s", connection, string); } /* * Function: void EOC (int connection) * Purpose : terminates connection gracefully * Params : int connection - connection number to terminate */ void EOC (int connection) { debug_printf (">EOC(%d)\n", connection); debug_printf ("connection_status[%d]=%d\n", connection, connection_status[connection]); client_socket_is_free[connection] = 1; FD_CLR (client_socket[connection], &mask); FD_CLR (client_socket[connection], &rmask); close (client_socket[connection]); if (connection_status[connection] == BICONNECTED) { debug_printf ("connection_status[connection] == BICONNECTED\n"); FD_CLR (proxy_socket[connection], &mask); FD_CLR (proxy_socket[connection], &rmask); close (proxy_socket[connection]); } connection_status[connection] = TO_RESET; print_connection (connection, gettext ("end of connection\n")); debug_printf ("EOC>\n"); } /* * Function : mark_all_client_sockets_as_free (void) * Purpose : initializes client sockets, marking all of them as free * Params : none */ void mark_all_client_sockets_as_free (void) { int connection; debug_printf (">mark_all_client_sockets_as_free ()\n"); for (connection = 0; connection < MAX_CONNECTIONS; connection++) client_socket_is_free[connection] = 1; debug_printf ("mark_all_client_sockets_as_free>\n"); } /* * Function : print_program_version(char *PROGRAM_NAME, char *PROGRAM_VERSION); * Purpose : outputs program name & version "window" * Params : char *PROGRAM_NAME - program name * char *PROGRAM_VERSION - program version */ void print_program_version (char *PROGRAM_NAME, char *PROGRAM_VERSION) { int count; printf ("\n-----------------------------------\n"); printf ("%s", PROGRAM_NAME); for (count = 0; count < 25 - strlen (PROGRAM_NAME); count++) printf (" "); for (count = 0; count < 10 - strlen (PROGRAM_VERSION); count++) printf (" "); printf ("%s\n\n", PROGRAM_VERSION); printf ("(C) 2003 Miguelanxo Otero Salgueiro\n"); printf ("-----------------------------------\n\n"); } /* * Function : void strnsend (int fd, char *string, int len) * Purpose : almost same as write () + debugging * Params : fd - file descriptor * : char *string - data to write * : int len - length of data */ void strnsend (int fd, char *string, int len) { debug_printf (">strnsend(%d,%s,%d)\n", fd, string, len); /* int towrite,index=0; towrite=len; while (towrite>BUFFSIZE) { memcpy(&buffer,&string[index],BUFFSIZE); write(fd,buffer,BUFFSIZE); towrite=towrite-BUFFSIZE; index=index+BUFFSIZE; } memcpy(&buffer,&string[index],towrite); write(fd,buffer,towrite); if (DEBUG) { write(1,buffer,towrite); fflush(stdout); } */ write (fd, string, len); debug_printf ("strnsend>\n"); } /* * Function : void strsend(int fd, char *string) * Purpose : send null terminated string to file descriptor * Params : int fd - file descriptor * : char *string - data to send */ void strsend (int fd, char *string) { strnsend (fd, string, strlen (string)); } /* * Function : char *parse_HTTP_return_code(void) * Purpose : gets a parsed HTTP return code from line in buffer * : (returns a pointer to global variable HTTP_return_code) * Params : none */ char * parse_HTTP_return_code (void) { int count; debug_printf (">parse_HTTP_return_code\n"); /* * initialize HTTP_return_code to XXX (undefined/error) */ strcpy (HTTP_return_code, "XXX"); if (!memcmp (buffer, "HTTP", 4)) { for (count = 0; buffer[count] != ' '; count++) if (count == BUFFER_SIZE) break; if (count < BUFFER_SIZE) { memcpy (HTTP_return_code, &buffer[count + 1], 3); HTTP_return_code[3] = 0; debug_printf ("parse_HTTP_return_code>\n"); return HTTP_return_code; } } printf ("parse_HTTP_return_code:"); printf (gettext ("bad proxy response.\n")); exit (1); } /* * Function : void wait_for_crlf(int fd) * Purpose : reads data from file descriptor until sequence CR LF found * : (data is stored in global variable buffer) * Params : int fd - file descriptor * Returns : 0 if Ok, -1 otherwise */ int wait_for_crlf (int fd) { unsigned char previous_byte = 0; int count; debug_printf (">wait_for_crfl(%d)\n", fd); count = 0; while (1) { read (fd, &buffer[count], 1); debug_printf ("%c", buffer[count]); if ((buffer[count] == '\n') && (previous_byte == '\r')) break; if (count == BUFFER_SIZE) { printf (" (CASCA)\n\n"); printf ("wait_for_crlf: BUFFER OVERFLOW!\n"); return (-1); } previous_byte = buffer[count]; count++; } buffer[count + 1] = 0; debug_printf ("wait_for_crfl>\n"); return (0); } /* * Function : void wait_for_2crlf(int fd) * Purpose : reads file descriptor until sequence CR LR CR LF found * : (that sequence is used to mark HTTP header end) * Params : int fd - file descriptor to read from * Returns : 0 if Ok, -1 otherwise */ int wait_for_2crlf (int fd) { debug_printf (">wait_for_2crlf\n"); while (memcmp (buffer, "\r\n", 2)) { if (wait_for_crlf (fd) < 0) { return (-1); } } debug_printf ("wait_for_2crlf>\n"); return (0); } /* * Function : int connect_host_to_proxy(int connection, char *remote_host * : char *remote_port) * Purpose : connects to remote_host:remote_port * : trough proxy_host:proxy_port * Params : int connection - number of connection in use * : char *remote_host - remote host (name or IP as string) * : char *remote_port - remote port (number as string) */ int connect_host_to_proxy (int connection, char *remote_host, char *remote_port) { int count; char proxy_user[256]; char User_Agent[256]; debug_printf (">connect_host_to_proxy(%d,%s,%s)\n", connection, remote_host, remote_port); debug_printf (">socket(AF_INET,SOCK_STREAM,0)\n"); if ((proxy_socket[connection] = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket"); return -1; } debug_printf ("socket> (%d)\n", proxy_socket[connection]); if ((proxy_hostent = gethostbyname (proxy_host)) == NULL) { switch (h_errno) { case TRY_AGAIN: { printf ("gethostbyname:"); printf (gettext (" temporary error")); printf (gettext (" in name resolution\n")); break; } case HOST_NOT_FOUND: { printf ("gethostbyname:"); printf (gettext (" unknown host\n")); break; } default: { printf ("gethostbyname:"); printf (gettext (" non-recoverable")); printf (gettext (" name server error\n")); } } return -2; } memset (&proxy, 0, sizeof proxy); proxy.sin_family = AF_INET; memcpy (&proxy.sin_addr, proxy_hostent->h_addr, proxy_hostent->h_length); proxy.sin_port = htons (atoi (proxy_port)); debug_printf (">connect\n"); if (connect (proxy_socket[connection], (struct sockaddr *) &proxy, sizeof proxy) < 0) { perror ("connect"); return -3; } debug_printf ("connect>\n"); status = PROXY_OK; strcpy (string, "CONNECT "); strcat (string, remote_host); strcat (string, ":"); strcat (string, remote_port); strcat (string, " HTTP/1.1\r\nHost: "); strcat (string, remote_host); strcat (string, ":"); strcat (string, remote_port); strcat (string, "\r\nUser-Agent: "); if (getenv ("USER_AGENT") != NULL) { strncpy (User_Agent, getenv ("USER_AGENT"), 255); } else { strcpy (User_Agent, "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"); } strcat (string, User_Agent); if (getenv ("PROXY_USER") != NULL) { char proxy_authorization_base64[257]; strncpy (proxy_user, getenv ("PROXY_USER"), 255); base64_encode (proxy_user, proxy_authorization_base64); strcat (string, "\r\nProxy-authorization: Basic "); strcat (string, proxy_authorization_base64); debug_printf ("Proxy-authorization: Basic %s\n", proxy_authorization_base64); } strcat (string, "\r\n\r\n"); strsend (proxy_socket[connection], string); while (status == PROXY_OK) { if (wait_for_crlf (proxy_socket[connection]) < 0) { EOC (connection); return -4; } parse_HTTP_return_code (); if (!strcmp (HTTP_return_code, "200")) status = BICONNECTED; else status = PROXY_FAULT; } if (status == PROXY_FAULT) { /* * if PROXY_FAULT then write HTTP response to stdout */ while ((count = read (proxy_socket[connection], buffer, sizeof (buffer))) != 0) write (1, buffer, count); return -5; } /* * discard the rest of HTTP header until CR LF CR LF * (that is, to the beginning of the real connection) */ if (wait_for_2crlf (proxy_socket[connection]) < 0) { return -6; } print_connection (connection, gettext ("bidirectional connection stablished\n\n")); if (proxy_socket[connection] > maxfd) maxfd = proxy_socket[connection]; FD_SET (proxy_socket[connection], &mask); debug_printf ("connect_host_to_proxy> (0)\n"); return 0; } /* * Function : void initialize_gettext(void) * Purpose : initializes gettext (i18n) extension * Params : none */ void initialize_gettext (void) { debug_printf (">initialize_gettext()\n"); setlocale (LC_ALL, ""); bindtextdomain ("desproxy", LOCALEDIR); textdomain ("desproxy"); debug_printf ("initilize_gettext>\n"); } /* * Function : int bind_UDP_port(unsigned int request_port) * Purpose : binds requested UDP port * Params : unsigned int request_port - requested port */ int bind_UDP_port (unsigned int request_port) { int UDP_socket; debug_printf ("bind_UDP_port(%d)\n", request_port); if ((UDP_socket = socket (PF_INET, SOCK_DGRAM, 0)) < 0) { perror ("socket"); exit (1); } memset (&server, 0, sizeof server); server.sin_family = AF_INET; server.sin_addr.s_addr = htonl (INADDR_ANY); server.sin_port = htons (request_port); if ((bind (UDP_socket, (struct sockaddr *) &server, sizeof server)) < 0) { perror ("bind"); exit (1); } printf (gettext ("UDP port ")); printf ("%d", request_port); printf (gettext (" Bound\n")); debug_printf ("bind_UDP_port> (%d)\n", UDP_socket); return (UDP_socket); } /* * Function : int listen_in_TCP_port(unsigned int request_port) * Purpose : listens in requested TCP port for incoming connections * Parmas : unsigned int request_port - requested port */ int listen_in_TCP_port (unsigned int request_port) { int request_socket; debug_printf ("listen_in_TCP_port(%d)\n", request_port); if ((request_socket = socket (PF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket"); exit (1); } memset (&server, 0, sizeof server); server.sin_family = AF_INET; server.sin_addr.s_addr = htonl (INADDR_ANY); server.sin_port = htons (request_port); if ((bind (request_socket, (struct sockaddr *) &server, sizeof server)) < 0) { perror ("bind"); exit (1); } if (listen (request_socket, SOMAXCONN) < 0) { perror ("listen"); exit (1); } printf (gettext ("TCP port ")); printf ("%d", request_port); printf (gettext (" Bound & Listening\n")); debug_printf ("listen_in_TCP_port> (%d)\n", request_socket); return (request_socket); } /* * Function : int look_for_desproxy_conf(void) * NYI */ int look_for_desproxy_conf (void) { FILE *desproxy_conf; if ((desproxy_conf = fopen ("desproxy.conf", "r")) == NULL) { return 0; } fclose (desproxy_conf); return (1); } /* * Function : void turn_console_echo_off(void) * Purpose : turns off console echo * : stores old tty status in global variable old_tty * Params : none */ void turn_console_echo_off (void) { struct termios tty; /* * Save the old tty settings */ tcgetattr (0, &old_tty); /* * get rid of echo for the new tty settings. * * (from man tcgetattr) * * ICANON Enable canonical mode. This enables the special * characters EOF, EOL, EOL2, ERASE, KILL, LNEXT, * REPRINT, STATUS, and WERASE, and buffers by lines. * * ECHO Echo input characters. * * ECHOE If ICANON is also set, the ERASE character erases * the preceding input character, and WERASE erases * the preceding word. * * ECHOK If ICANON is also set, the KILL character erases * the current line. * * ECHONL If ICANON is also set, echo the NL character even * if ECHO is not set. */ tty = old_tty; tty.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL); /* * set new tty settings * * (from man tcsetattr) * * TCSAFLUSH * * the change occurs after all output written to the * object referred by fd has been transmitted, and all * input that has been received but not read will be * discarded before the change is made. */ tcsetattr (0, TCSAFLUSH, &tty); } /* * Function : void turn_console_echo_on(void) * Purpose : turns on console echo * : restores old tty status stored in global variable old_tty * Params : none */ void turn_console_echo_on (void) { /* * Now reset the old settings */ tcsetattr (0, TCSAFLUSH, &old_tty); } /* * Function : void get_username_and_password(void) * Purpose : requests user to give username and password * : strores them in global variables username & password * Params : none */ void get_username_and_password (void) { strcpy (console_line, ""); while (!strcmp (console_line, "")) { printf (gettext ("Username: ")); strcpy (username, get_console_line ()); } printf (gettext ("Password: ")); /* * turn out echo, so password is not displayed when typed */ turn_console_echo_off (); strcpy (password, get_console_line ()); /* * turn on echo again */ turn_console_echo_on (); /* * send \n because the one in the passwd didn't echo :) */ printf ("\n"); } desproxy-0.1.0~pre3/src/desproxy.c0000644000175000017500000001127507732027475014130 0ustar /* * desproxy.c: Main program file for desproxy * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include "desproxy.h" #define PROGRAM_NAME "desproxy" #define PROGRAM_VERSION VERSION int request_socket; int connection_status[MAX_CONNECTIONS]; char *remote_host, *remote_port; void client_to_proxy (int connection) { int count; print_connection (connection, "client -> proxy"); if ((count = read (client_socket[connection], buffer, sizeof (buffer))) == -1) { perror ("read"); EOC (connection); return; } printf (" %4d bytes read\n", count); if (count == 0) { EOC (connection); return; } else { if ((count = write (proxy_socket[connection], buffer, count)) == -1) { perror ("write"); EOC (connection); } } } void proxy_to_client (int connection) { int count; print_connection (connection, "proxy -> client"); if ((count = read (proxy_socket[connection], buffer, sizeof (buffer))) == -1) { perror ("read"); EOC (connection); return; } printf (" %4d bytes read\n", count); if (count == 0) { EOC (connection); return; } else { if ((count = write (client_socket[connection], buffer, count)) == -1) { perror ("write"); EOC (connection); } } } void parse_command_line (int argc, char **argv) { debug_printf (">parse_command_line(COMMAND_LINE)\n"); if (argc != 6) { printf (gettext ("Usage: desproxy remote_host remote_port proxy_host" " proxy_port local_port\n\n")); exit (1); } remote_host = argv[1]; remote_port = argv[2]; proxy_host = argv[3]; proxy_port = argv[4]; local_port = argv[5]; debug_printf ("parse_command_line>\n"); } void process_connection_request (void) { int connection; debug_printf (">process_connection_request()\n"); for (connection = 0; connection < MAX_CONNECTIONS; connection++) if (client_socket_is_free[connection]) break; if (connection == MAX_CONNECTIONS) { printf (gettext ("There are no connections available at this time\n")); } else { client_length = sizeof (client); client_socket[connection] = accept (request_socket, (struct sockaddr *) &client, &client_length); if (client_socket[connection] < 0) { perror ("accept"); EOC (connection); return; } client_socket_is_free[connection] = 0; printf (gettext ("Connection request from %s, port %d\n"), inet_ntoa (client.sin_addr), ntohs (client.sin_port)); if (client_socket[connection] > maxfd) maxfd = client_socket[connection]; FD_SET (client_socket[connection], &mask); printf (gettext ("Connecting to http proxy (%s:%s)\n"), proxy_host, proxy_port); if (connect_host_to_proxy (connection, remote_host, remote_port) != 0) { printf ("connect_host_to_proxy: ERROR\n"); EOC (connection); return; } else { connection_status[connection] = BICONNECTED; } } debug_printf ("process_connection_request>\n"); } int main (int argc, char **argv) { int connection, nfound; struct timeval timeout; signal (SIGPIPE, SIG_IGN); initialize_gettext (); print_program_version (PROGRAM_NAME, PROGRAM_VERSION); parse_command_line (argc, argv); request_socket = listen_in_TCP_port (atoi (local_port)); printf (gettext ("Press to Quit\n\n")); mark_all_client_sockets_as_free (); FD_ZERO (&mask); FD_SET (request_socket, &mask); maxfd = request_socket; while (1) { rmask = mask; timeout.tv_sec = 5; timeout.tv_usec = 0; nfound = select (maxfd + 1, &rmask, NULL, NULL, &timeout); debug_printf ("%d", nfound); if (nfound < 0) { if (errno == EINTR) { printf (gettext ("Interrupted by system call\n")); continue; } perror ("select"); exit (1); } if (FD_ISSET (request_socket, &rmask)) { process_connection_request (); } for (connection = 0; connection < MAX_CONNECTIONS; connection++) { if (!client_socket_is_free[connection]) { debug_printf ("client_socket[%d]=%d\n", connection, client_socket[connection]); debug_printf ("connection_status[%d]=%d\n", connection, connection_status[connection]); if (FD_ISSET (client_socket[connection], &rmask)) { client_to_proxy (connection); } if (connection_status[connection] == BICONNECTED) { if (FD_ISSET (proxy_socket[connection], &rmask)) { proxy_to_client (connection); } } } } fflush (stdout); } } desproxy-0.1.0~pre3/src/desproxy.h0000644000175000017500000000424210062153463014114 0ustar /* * desproxy.h: Main header file for desproxy * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "util.h" #ifdef HAVE_CONFIG_H #include "../config.h" #endif #ifndef HAVE_LIBINTL_H #warning #warning **************************** #warning * Not using GNU gettext * #warning * for internationalization * #warning * (libintl.h not found) * #warning **************************** #warning #define gettext(A) A #define bindtextdomain(A,B) "" #define textdomain(A) "" #else #include #endif #define PROXY_OK 0 #define BICONNECTED 1 #define PROXY_FAULT 2 #define END_OF_CONNECTION 3 #define NOTHING_READ 4 #define PROTOCOL_V5_OK 5 #define PROTOCOL_V4_OK 6 #define NMETHODS_READ 7 #define LOOKING_FOR_METHODS 8 #define METHOD_ACCEPTED_V4 9 #define METHOD_ACCEPTED_V5 10 #define TO_RESET 11 #define MAX_CONNECTIONS 10 #define BUFFER_SIZE 1500 #define VERSION "0.1.0-pre3" /* * Debug level, 0 = none, 1 = basic, >1 = full */ #define DEBUG 0 int status, fd, maxfd; int client_socket[MAX_CONNECTIONS]; int proxy_socket[MAX_CONNECTIONS]; int connection_status[MAX_CONNECTIONS]; char *proxy_host; char *proxy_port; char *dns_server; char *local_port; char username[256], password[256]; unsigned char string[256], console_line[256], HTTP_return_code[4]; unsigned char buffer[BUFFER_SIZE], client_socket_is_free[MAX_CONNECTIONS]; fd_set mask, rmask; struct sockaddr_in proxy; struct hostent *proxy_hostent; struct sockaddr_in server; struct sockaddr_in client; struct sockaddr_in proxy; struct sockaddr_in remote; struct termios old_tty; int client_length; int server_length; int proxy_length; int remote_length; desproxy-0.1.0~pre3/src/socket2socket.c0000644000175000017500000001445707732027635015041 0ustar /* * socket2socket.c: Joins two sockets together * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include #include "desproxy.h" #define MAX_CONNECTIONS 10 #define PROGRAM_VERSION VERSION #define PROGRAM_NAME "socket2socket" unsigned char client_socket_is_free[MAX_CONNECTIONS]; int client_socket[MAX_CONNECTIONS]; int remote_socket[MAX_CONNECTIONS]; void EOC_s2s (int index) { close (client_socket[index]); close (remote_socket[index]); FD_CLR (client_socket[index], &mask); FD_CLR (remote_socket[index], &mask); client_socket_is_free[index] = 1; printf (gettext ("End of connection\n")); fflush (stdout); fflush (stderr); } int main (int argc, char **argv) { int request_socket, addrlen; int index, count; struct sockaddr_in server; struct sockaddr_in remote; struct hostent *remote_hostent; char *remote_host; char *remote_port; char *local_port; int nfound, maxfd; struct timeval timeout; int outfile = 1; char *outfilename; signal (SIGPIPE, SIG_IGN); print_program_version (PROGRAM_NAME, PROGRAM_VERSION); if ((argc < 4) || (argc > 5)) { printf (gettext ("Usage: socket2socket remote_host remote_port local_port" " [logfile]\n\n")); exit (1); } remote_host = argv[1]; remote_port = argv[2]; local_port = argv[3]; if (argc == 5) { outfilename = argv[4]; if ((outfile = open (outfilename, O_CREAT | O_WRONLY, S_IREAD | S_IWRITE)) == -1) { perror ("open"); exit (1); } } if ((request_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket"); exit (1); } memset (&server, 0, sizeof server); server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons (atoi (local_port)); if ((bind (request_socket, (struct sockaddr *) &server, sizeof server)) < 0) { perror ("bind"); exit (1); } if (listen (request_socket, SOMAXCONN) < 0) { perror ("listen"); exit (1); } printf (gettext ("Listening in port %d\n"), atoi (local_port)); printf (gettext ("Press to Quit\n\n")); mark_all_client_sockets_as_free (); FD_ZERO (&mask); FD_SET (request_socket, &mask); maxfd = request_socket; while (1) { rmask = mask; timeout.tv_sec = 5; timeout.tv_usec = 0; nfound = select (maxfd + 1, &rmask, NULL, NULL, &timeout); if (nfound < 0) { if (errno == EINTR) { printf (gettext ("Interrupted by system call\n")); continue; } perror ("select"); exit (1); } if (FD_ISSET (request_socket, &rmask)) { addrlen = sizeof (remote); for (index = 0; index < MAX_CONNECTIONS; index++) if (client_socket_is_free[index]) break; if (index == MAX_CONNECTIONS) { printf (gettext ("There are no connections available at this time\n")); } else { client_socket_is_free[index] = 0; client_socket[index] = accept (request_socket, (struct sockaddr *) &remote, &addrlen); if (client_socket[index] < 0) { perror ("accept"); exit (1); } printf (gettext ("Connection request from %s, port %d\n"), inet_ntoa (remote.sin_addr), ntohs (remote.sin_port)); if (client_socket[index] > maxfd) maxfd = client_socket[index]; printf (gettext ("Connecting to remote host (%s:%s)\n"), remote_host, remote_port); if ((remote_socket[index] = socket (AF_INET, SOCK_STREAM, 0)) < 0) { perror ("socket"); exit (1); } if (remote_socket[index] > maxfd) maxfd = remote_socket[index]; if ((remote_hostent = gethostbyname (remote_host)) == 0) { perror ("gethostbyname"); exit (1); } memset (&remote, 0, sizeof remote); remote.sin_family = AF_INET; memcpy (&remote.sin_addr, remote_hostent->h_addr, remote_hostent->h_length); remote.sin_port = htons (atoi (remote_port)); if (connect (remote_socket[index], (struct sockaddr *) &remote, sizeof remote) < 0) { close (remote_socket[index]); printf ("\n"); perror ("connect"); exit (1); } printf (gettext ("Bidirectional connection stablished\n")); printf ("(%s:%s) <-> (localhost)\n", remote_host, remote_port); FD_SET (remote_socket[index], &mask); FD_SET (client_socket[index], &mask); } } for (index = 0; index < MAX_CONNECTIONS; index++) { if (!client_socket_is_free[index]) { if (FD_ISSET (remote_socket[index], &rmask)) { printf ("remote -> local (connection #%d) ", index); fflush (stdout); if ((count = read (remote_socket[index], buffer, sizeof (buffer))) == -1) { perror ("read"); EOC_s2s (index); } else { if (count == 0) { EOC_s2s (index); } else { if ((count = write (client_socket[index], buffer, count)) == -1) { perror ("\nwrite"); fflush (stderr); EOC_s2s (index); } else { if (argc == 5) { write (outfile, "[R->L]", 6); write (outfile, buffer, count); fsync (outfile); } printf (" %d Bytes\n", count); fflush (stdout); } } } } } if (!client_socket_is_free[index]) { if (FD_ISSET (client_socket[index], &rmask)) { printf ("local -> remote (connection #%d)", index); fflush (stdout); if ((count = read (client_socket[index], buffer, sizeof (buffer))) == -1) { perror ("read"); EOC_s2s (index); } else { if (count == 0) { EOC_s2s (index); } else { if ((count = write (remote_socket[index], buffer, count)) == -1) { perror ("write"); EOC_s2s (index); } else { if (argc == 5) { write (outfile, "[L->R]", 6); write (outfile, buffer, count); fsync (outfile); } printf (" %d bytes\n", count); fflush (stdout); } } } } } } fflush (stdout); fflush (stderr); } exit (0); } desproxy-0.1.0~pre3/src/util.h0000644000175000017500000001204507732027462013225 0ustar /* * util.h: misc functions common to all desproxy binaries * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ /* * Function : base64_encode (const char *string, char *p) * Purpose : create a base 64 encoded string * Params : p - string to encode * : s - string buffer to write into * * Note : Taken from transconnect (http://transconnect.sourceforge.net/) */ //static void encode_base64 (const char *s, char *p); /* * Function : debug_printf(char *fmt, ...) * Purpose : prints arguments like printf, but adds fflush(stdout) * Params : same as printf, as defined in * * Note : this function obtained via IRC chat in * : irc.openprojects.net, #c channel. */ int debug_printf (const char *fmt, ...); /* * Function : char *get_console_line(void) * Purpose : gets a line from console to char console_line[256] * : (returns a pointer to global variable console_line) * Params : none */ char *get_console_line (void); /* * Function : void strtolower(char *string) * Purpose : changes char *string to lowercase * Params : char *string - string to lowercase */ void strtolower (char *string); /* * Function: void EOC (int connection) * Purpose : terminates connection gracefully * Params : int connection - connection number to terminate */ void EOC (int connection); /* * Function : void mark_all_client_sockets_as_free(void) * Purpose : initializes client sockets, marking all of them as free * Params : none */ void mark_all_client_sockets_as_free (void); /* * Function : void strnsend(int fd, char *string, int len) * Purpose : almost same as write() + debugging * Params : fd - file descriptor * : char *string - data to write * : int len - length of data */ void strnsend (int fd, char *string, int len); /* * Function : void strsend(int fd, char *string) * Purpose : send null terminated string to file descriptor * Params : int fd - file descriptor * : char *string - data to send */ void strsend (int fd, char *string); /* * Function : void print_program_version(char *PROGRAM_NAME, * : char *PROGRAM_VERSION); * Purpose : outputs program name & version "window" * Params : char *PROGRAM_NAME - program name * : char *PROGRAM_VERSION - program version */ void print_program_version (char *PROGRAM_NAME, char *PROGRAM_VERSION); /* * Function : char *parse_HTTP_return_code(void) * Purpose : gets a parsed HTTP return code from line in buffer * : (returns a pointer to global variable HTTP_return_code) * Params : none */ char *parse_HTTP_return_code (void); /* * Function : void wait_for_crlf(int fd) * Purpose : reads data from file descriptor until sequence CR LF found * : (data is stored in global variable buffer) * Params : int fd - file descriptor * Returns : 0 if Ok, -1 otherwise */ int wait_for_crlf (int fd); /* * Function : void wait_for_2crlf(int fd) * Purpose : reads file descriptor until sequence CR LR CR LF found * : (that sequence is used to mark HTTP header end) * Params : int fd - file descriptor to read from * Returns : 0 if Ok, -1 otherwise */ int wait_for_2crlf (int fd); /* * Function : int connect_host_to_proxy(int connection, char *remote_host * : char *remote_port) * Purpose : connects to remote_host:remote_port * : trough proxy_host:proxy_port * Params : int connection - number of connection in use * : char *remote_host - remote host (name or IP as string) * : char *remote_port - remote port (number as string) */ int connect_host_to_proxy (int connection, char *remote_host, char *remote_port); /* * Function : void initialize_gettext(void) * Purpose : initializes gettext (i18n) extension * Params : none */ void initialize_gettext (void); /* * Function : int listen_in_TCP_port(unsigned int request_port) * Purpose : listens in requested TCP port for incoming connections * Params : unsigned int request_port - requested port */ int listen_in_TCP_port (unsigned int request_port); /* * Function : int bind_UDP_port(unsigned int request_port) * Purpose : binds requested UDP port * Params : unsigned int request_port - requested port */ int bind_UDP_port (unsigned int request_port); /* * Function : void print_connection(int connection, char *string) * Purpose : outputs info string for a connection * Params : int connection - numbre of connection * : char *string - text to output */ void print_connection (int connection, char *string); /* * Function : int look_for_desproxy_conf(void) * NYI */ int look_for_desproxy_conf (void); /* * Function : void get_username_and_password(void) * Purpose : requests user to give username and password * : strores them in global variables username & password * Params : none */ void get_username_and_password (void); desproxy-0.1.0~pre3/src/desproxy-socksserver.c0000644000175000017500000003153707732027565016502 0ustar /* * desproxy-socksserver.c: Socks Version 4 & 5 server for HTTP proxies * * Copyright (C) 2003 Miguelanxo Otero Salgueiro * * This program is free software; you can redistribute it and/or modify * it under the tems of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #include "desproxy.h" #define PROGRAM_NAME "desproxy-socksserver" #define PROGRAM_VERSION VERSION int request_socket, request_length; char remote_host[256], remote_port[6]; unsigned char nmethods[MAX_CONNECTIONS]; unsigned char methods[MAX_CONNECTIONS][256]; /* * Parses command line */ void parse_command_line (int argc, char **argv) { debug_printf (">parse_command_line(COMMAND_LINE)\n"); if (argc != 4) { printf (gettext ("Usage: desproxy-socksserver proxy_host" " proxy_port local_port\n\n")); exit (1); } proxy_host = argv[1]; proxy_port = argv[2]; local_port = argv[3]; debug_printf ("parse_command_line>\n"); } /* * invoked for the first time something is read */ void nothing_read (connection) { debug_printf (">nothing_read()\n"); if (read (client_socket[connection], buffer, 1) == -1) { perror ("read"); EOC (connection); return; } if (buffer[0] == 4) { connection_status[connection] = PROTOCOL_V4_OK; debug_printf ("nothing_read>\n"); return; } if (buffer[0] == 5) { connection_status[connection] = PROTOCOL_V5_OK; debug_printf ("nothing_read>\n"); return; } printf (gettext ("invalid client protocol version (")); printf ("%d)\n", buffer[0]); /* * send general SOCKS error */ strnsend (client_socket[connection], "\x05\x01\x00\x00", 4); EOC (connection); return; } /* * invoked when we read the protocol header and it is 4 */ void protocol_v4_ok (connection) { debug_printf (">protocol_v4_ok()\n"); if (read (client_socket[connection], buffer, 1) == -1) { perror ("read"); EOC (connection); return; } if (buffer[0] != 1) { debug_printf ("Method != 1 (CONNECT) => method refused\n"); strnsend (client_socket[connection], "\x00\x5B\x00\x00\x00\x00\x00\x00", 8); EOC (connection); } else { debug_printf ("Method 1 (CONNECT) accepted\n"); connection_status[connection] = METHOD_ACCEPTED_V4; } debug_printf ("protocol_v4_ok>\n"); return; } /* * invoked when we read the protocol header and it is 5 */ void protocol_v5_ok (connection) { debug_printf (">protocol_v5_ok()\n"); if (read (client_socket[connection], buffer, 1) == -1) { perror ("read"); EOC (connection); return; } nmethods[connection] = buffer[0]; connection_status[connection] = NMETHODS_READ; //NMETHODS is read debug_printf ("Number of methods: %d\n", nmethods[connection]); debug_printf ("protocol_v5_ok>\n"); return; } /* * Invoked when the method is accepted for protocol version 4 */ void method_accepted_v4 (connection) { debug_printf (">method_accepted()\n"); if (read (client_socket[connection], buffer, 6) == -1) { perror ("read"); EOC (connection); return; } debug_printf ("IP "); debug_printf ("(%d.%d.%d.%d:%d)\n", buffer[2], buffer[3], buffer[4], buffer[5], buffer[0] * 256 + buffer[1]); sprintf (remote_host, "%d.%d.%d.%d", buffer[2], buffer[3], buffer[4], buffer[5]); sprintf (remote_port, "%d", buffer[0] * 256 + buffer[1]); buffer[0] = 0xff; while (buffer[0] != 0) { if (read (client_socket[connection], buffer, 1) == -1) { perror ("read"); EOC (connection); return; } } if (connect_host_to_proxy (connection, remote_host, remote_port) != 0) { strnsend (client_socket[connection], "\x00\x5B\x00\x00\x00\x00\x00\x00", 8); printf ("connect_host_to_proxy: ERROR\n"); EOC (connection); return; } else { /* * Send success */ strnsend (client_socket[connection], "\x00\x5A\x00\x00\x00\x00\x00\x00", 8); connection_status[connection] = BICONNECTED; } } /* * Invoked when the method is accepted for protocol version 5 */ void method_accepted_v5 (connection) { unsigned char index; debug_printf (">method_accepted()\n"); if (read (client_socket[connection], buffer, 4) == -1) { perror ("read"); EOC (connection); return; } debug_printf ("VER %d\n", buffer[0]); debug_printf ("CMD %d\n", buffer[1]); debug_printf ("RSV %d\n", buffer[2]); debug_printf ("ATYP %d\n", buffer[3]); if (buffer[1] != 1) { debug_printf ("Command %d not supported\n", buffer[1]); /* * Send "Command not supported" */ strnsend (client_socket[connection], "\x05\x07\x00\x01", 4); strnsend (client_socket[connection], (char *) &server.sin_port, 2); strnsend (client_socket[connection], (char *) &server.sin_addr.s_addr, 4); EOC (connection); return; } if (buffer[3] == 1) { if (read (client_socket[connection], buffer, 6) == -1) { perror ("read"); EOC (connection); return; } debug_printf ("ATYP = IP "); debug_printf ("(%d.%d.%d.%d:%d)\n", buffer[0], buffer[1], buffer[2], buffer[3], buffer[4] * 256 + buffer[5]); sprintf (remote_host, "%d.%d.%d.%d", buffer[0], buffer[1], buffer[2], buffer[3]); sprintf (remote_port, "%d", buffer[4] * 256 + buffer[5]); } if (buffer[3] == 3) { if (read (client_socket[connection], buffer, 1) == -1) { perror ("read"); EOC (connection); return; } debug_printf ("ATYP = DOMAINNAME\n"); strcpy (remote_host, ""); for (index = buffer[0]; index > 0; index--) { if (read (client_socket[connection], buffer, 1) == -1) { perror ("read"); EOC (connection); return; } strncat (remote_host, buffer, 1); } strncat (remote_host, "\x00", 1); debug_printf ("remote_host %s\n", remote_host); if (read (client_socket[connection], buffer, 2) == -1) { perror ("read"); EOC (connection); return; } sprintf (remote_port, "%d", buffer[0] * 256 + buffer[1]); debug_printf ("remote_port %s\n", remote_port); } if (connect_host_to_proxy (connection, remote_host, remote_port) != 0) { /* * Send "Host unreachable" */ strnsend (client_socket[connection], "\x05\x04\x00\x01", 4); printf ("connect_host_to_proxy: ERROR\n"); EOC (connection); return; } else { /* * Send "Success" */ strnsend (client_socket[connection], "\x05\x00\x00\x01", 4); strnsend (client_socket[connection], (char *) &server.sin_port, 2); strnsend (client_socket[connection], (char *) &server.sin_addr.s_addr, 4); connection_status[connection] = BICONNECTED; } } void nmethods_read (connection) { unsigned char index; debug_printf (">nmethods_read()\n"); if (read (client_socket[connection], &methods[connection][0], nmethods[connection]) == -1) { perror ("read"); EOC (connection); return; } connection_status[connection] = LOOKING_FOR_METHODS; for (index = 0; index < nmethods[connection]; index++) { /* * if there is one method 0 (NOAUTH) then accept it */ if (methods[connection][index] == 0) { connection_status[connection] = METHOD_ACCEPTED_V5; strnsend (client_socket[connection], "\x05\x00", 2); debug_printf ("Selected method 0\n"); } } if (connection_status[connection] != METHOD_ACCEPTED_V5) { debug_printf (gettext ("All methods rejected\n")); strnsend (client_socket[connection], "\x05\xff", 2); EOC (connection); return; } debug_printf ("nmethods_read>\n"); } /* * Invoked for transcactions when the client is accepted yet */ void biconnected (connection) { int count; debug_printf (">biconnected()\n"); debug_printf ("client -> proxy (%d) ", connection); if ((count = read (client_socket[connection], buffer, sizeof (buffer))) == -1) { debug_printf ("-1 bytes\n"); perror ("read"); EOC (connection); return; } if (count == 0) { debug_printf ("0 bytes\n"); EOC (connection); } else { if ((count = write (proxy_socket[connection], buffer, count)) == -1) { perror ("write"); EOC (connection); return; } debug_printf ("%d bytes\n", count); } debug_printf ("biconnected>\n"); } /* * Processes connection requests */ void process_connection_request (void) { int connection; debug_printf (">process_connection_request()\n"); for (connection = 0; connection < MAX_CONNECTIONS; connection++) if (client_socket_is_free[connection]) break; if (connection == MAX_CONNECTIONS) { printf (gettext ("There are no connections available at this time\n")); } else { client_length = sizeof (client); client_socket[connection] = accept (request_socket, (struct sockaddr *) &client, &client_length); if (client_socket[connection] < 0) { perror ("accept"); EOC (connection); return; } debug_printf ("accept> (%d)\n", client_socket[connection]); client_socket_is_free[connection] = 0; printf (gettext ("Connection request from %s, port %d\n"), inet_ntoa (client.sin_addr), ntohs (client.sin_port)); if (client_socket[connection] > maxfd) maxfd = client_socket[connection]; FD_SET (client_socket[connection], &mask); connection_status[connection] = NOTHING_READ; } debug_printf ("process_connection_request>\n"); } int main (int argc, char **argv) { int connection; int count; int nfound; struct timeval timeout; signal (SIGPIPE, SIG_IGN); initialize_gettext (); print_program_version (PROGRAM_NAME, PROGRAM_VERSION); parse_command_line (argc, argv); request_socket = listen_in_TCP_port (atoi (local_port)); printf (gettext ("Press to Quit\n\n")); mark_all_client_sockets_as_free (); FD_ZERO (&mask); FD_SET (request_socket, &mask); maxfd = request_socket; while (1) { rmask = mask; timeout.tv_sec = 5; timeout.tv_usec = 0; nfound = select (maxfd + 1, &rmask, NULL, NULL, &timeout); if (DEBUG > 1) debug_printf ("nfound> (%d)\n", nfound); if (nfound < 0) { if (errno == EINTR) { printf (gettext ("Interrupted by system call\n")); continue; } perror ("select"); exit (1); } /* * Proccess connection request */ if (FD_ISSET (request_socket, &rmask)) { process_connection_request (); } /* * Incoming connections */ for (connection = 0; connection < MAX_CONNECTIONS; connection++) { if (DEBUG > 1) debug_printf ("connection #%d\n", connection); if (!client_socket_is_free[connection]) { debug_printf ("client_socket_is_free[%d]=%d\n", connection, client_socket_is_free[connection]); if (FD_ISSET (client_socket[connection], &rmask)) { debug_printf ("FD_ISSET(client_socket[%d],&rmask\n", connection); if (connection_status[connection] == BICONNECTED) { biconnected (connection); } if (connection_status[connection] == METHOD_ACCEPTED_V4) { method_accepted_v4 (connection); } if (connection_status[connection] == METHOD_ACCEPTED_V5) { method_accepted_v5 (connection); } if (connection_status[connection] == NMETHODS_READ) { nmethods_read (connection); } if (connection_status[connection] == PROTOCOL_V4_OK) { protocol_v4_ok (connection); } if (connection_status[connection] == PROTOCOL_V5_OK) { protocol_v5_ok (connection); } if (connection_status[connection] == NOTHING_READ) { nothing_read (connection); } } if (connection_status[connection] == BICONNECTED) { if (FD_ISSET (proxy_socket[connection], &rmask)) { debug_printf ("proxy -> client (%d) ", connection); if ((count = read (proxy_socket[connection], buffer, sizeof (buffer))) == -1) { perror ("read"); EOC (connection); } else { if (count == 0) { EOC (connection); } else { if ((count = write (client_socket[connection], buffer, count)) == -1) { perror ("write"); EOC (connection); } } debug_printf ("%d bytes\n", count); } } } } } if (DEBUG > 1) { for (connection = 0; connection < MAX_CONNECTIONS; connection++) { debug_printf ("connection_status[%d]=%d\n", connection, connection_status[connection]); if (FD_ISSET (proxy_socket[connection], &rmask)) { debug_printf ("FD_ISSET(proxy_socket[%d],&rmask)\n", connection); } if (FD_ISSET (client_socket[connection], &rmask)) { debug_printf ("FD_ISSET(client_socket[%d],&rmask)\n", connection); } } } } exit (0); } desproxy-0.1.0~pre3/INSTALL0000644000175000017500000000047107731652677012354 0ustar +---------------------------------+ | desproxy installation procedure | +---------------------------------+ desproxy install is very easy (and very little documented :P) You only need a C compiler (only tested gcc) and do the following: 1) ./configure 2) make 3) make install (maybe you have to become root) desproxy-0.1.0~pre3/COPYING0000644000175000017500000004313107731651723012345 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.