Changeset 204

Show
Ignore:
Timestamp:
07/28/04 15:12:04 (4 years ago)
Author:
morris
Message:

sync with wired

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trackerd/trunk/Makefile.in

    r189 r204  
    11SUBDIRS                                 = trackerd 
    2 DISTFILES                               = INSTALL LICENSE README Makefile.in config.guess config.h.in config.sub configure configure.in install-sh man run trackerd 
     2DISTFILES                               = INSTALL LICENSE README Makefile Makefile.in config.guess config.h.in config.sub configure configure.in install-sh man run trackerd 
    33 
    44WT_PACKAGE_VERSION              = @WT_PACKAGE_VERSION@ 
     
    3030SED                                             = @SED@ 
    3131CUT                                             = @CUT@ 
     32FIND                                    = @FIND@ 
     33XARGS                                   = @XARGS@ 
    3234OPENSSL                                 = @OPENSSL@ 
    3335 
     
    9597        $(INSTALL) -m 644 -o root -g bin man/trackerd.8 $(mandir)/man8/ 
    9698 
    97 dist: distclean 
     99dist: 
    98100        @echo "Making $@ in ." 
    99101 
     
    105107                $(CP) -pr $$i wired-tracker-$(WT_PACKAGE_VERSION)/$$i; \ 
    106108        done 
     109         
     110        $(MAKE) -C wired-tracker-$(WT_PACKAGE_VERSION) -f Makefile distclean 
    107111 
    108112        $(TAR) -czf wired-tracker-$(WT_PACKAGE_VERSION).tar.gz wired-tracker-$(WT_PACKAGE_VERSION) 
    109113        $(RM) -rf wired-tracker-$(WT_PACKAGE_VERSION) 
    110  
     114         
    111115clean: clean-recursive 
    112116        @echo "Making $@ in ." 
     
    117121        @echo "Making $@ in ." 
    118122 
     123        $(FIND) . -name .DS_Store -print0 | $(XARGS) -0 $(RM) -f 
     124        $(FIND) . -name CVS -print0 | $(XARGS) -0 $(RM) -rf 
    119125        $(RM) -f Makefile config.h config.log config.status 
    120126        $(RM) -f wired-tracker-$(WT_PACKAGE_VERSION).tar.gz 
     127 
     128autoclean: 
     129        @echo "Making $@ in ." 
     130         
     131        $(RM) -rf autom4te.cache 
     132        $(RM) -f autoscan.log configure.scan config.h.in~ 
  • trackerd/trunk/config.h.in

    r200 r204  
    3838#undef HAVE_LIMITS_H 
    3939 
     40/* Define to 1 if you have the `localtime_r' function. */ 
     41#undef HAVE_LOCALTIME_R 
     42 
    4043/* Define to 1 if `lstat' has the bug that it succeeds when given the 
    4144   zero-length file name argument. */ 
  • trackerd/trunk/configure

    r199 r204  
    311311#endif" 
    312312 
    313 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os WT_PACKAGE_VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE WT_USER WT_GROUP MV CP RM MKDIR CHMOD TAR SED CUT OPENSSL CPP EGREP LIBOBJS LTLIBOBJS' 
     313ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os WT_PACKAGE_VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE WT_USER WT_GROUP MV CP RM MKDIR CHMOD TAR SED CUT FIND XARGS OPENSSL CPP EGREP LIBOBJS LTLIBOBJS' 
    314314ac_subst_files='' 
    315315 
     
    844844   esac 
    845845  cat <<\_ACEOF 
     846 
     847Optional Features: 
     848  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no) 
     849  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes] 
     850  --enable-warnings       enable warnings 
     851 
    846852 
    847853Optional Packages: 
     
    13911397 
    13921398 
     1399# These are used in configure.in 
     1400 
     1401 
    13931402 
    13941403####################################################################### 
     
    24512460 
    24522461 
     2462 
    24532463# Check for some other group to use than "daemon" 
    24542464echo "$as_me:$LINENO: checking for group" >&5 
     
    25262536WT_GROUP="$with_group" 
    25272537 
     2538 
     2539 
     2540# Check for warnings 
     2541echo "$as_me:$LINENO: checking whether to enable warnings" >&5 
     2542echo $ECHO_N "checking whether to enable warnings... $ECHO_C" >&6 
     2543# Check whether --enable-warnings or --disable-warnings was given. 
     2544if test "${enable_warnings+set}" = set; then 
     2545  enableval="$enable_warnings" 
     2546 
     2547fi; 
     2548 
     2549if test -n "$enable_warnings"; then 
     2550        echo "$as_me:$LINENO: result: yes" >&5 
     2551echo "${ECHO_T}yes" >&6 
     2552        CFLAGS="$CFLAGS -Wall" 
     2553else 
     2554        echo "$as_me:$LINENO: result: no" >&5 
     2555echo "${ECHO_T}no" >&6 
     2556fi 
    25282557 
    25292558 
     
    28062835  echo "$as_me:$LINENO: result: $CUT" >&5 
    28072836echo "${ECHO_T}$CUT" >&6 
     2837else 
     2838  echo "$as_me:$LINENO: result: no" >&5 
     2839echo "${ECHO_T}no" >&6 
     2840fi 
     2841 
     2842# Extract the first word of "find", so it can be a program name with args. 
     2843set dummy find; ac_word=$2 
     2844echo "$as_me:$LINENO: checking for $ac_word" >&5 
     2845echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 
     2846if test "${ac_cv_prog_FIND+set}" = set; then 
     2847  echo $ECHO_N "(cached) $ECHO_C" >&6 
     2848else 
     2849  if test -n "$FIND"; then 
     2850  ac_cv_prog_FIND="$FIND" # Let the user override the test. 
     2851else 
     2852as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 
     2853for as_dir in $PATH 
     2854do 
     2855  IFS=$as_save_IFS 
     2856  test -z "$as_dir" && as_dir=. 
     2857  for ac_exec_ext in '' $ac_executable_extensions; do 
     2858  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 
     2859    ac_cv_prog_FIND="find" 
     2860    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 
     2861    break 2 
     2862  fi 
     2863done 
     2864done 
     2865 
     2866fi 
     2867fi 
     2868FIND=$ac_cv_prog_FIND 
     2869if test -n "$FIND"; then 
     2870  echo "$as_me:$LINENO: result: $FIND" >&5 
     2871echo "${ECHO_T}$FIND" >&6 
     2872else 
     2873  echo "$as_me:$LINENO: result: no" >&5 
     2874echo "${ECHO_T}no" >&6 
     2875fi 
     2876 
     2877# Extract the first word of "xargs", so it can be a program name with args. 
     2878set dummy xargs; ac_word=$2 
     2879echo "$as_me:$LINENO: checking for $ac_word" >&5 
     2880echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 
     2881if test "${ac_cv_prog_XARGS+set}" = set; then 
     2882  echo $ECHO_N "(cached) $ECHO_C" >&6 
     2883else 
     2884  if test -n "$XARGS"; then 
     2885  ac_cv_prog_XARGS="$XARGS" # Let the user override the test. 
     2886else 
     2887as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 
     2888for as_dir in $PATH 
     2889do 
     2890  IFS=$as_save_IFS 
     2891  test -z "$as_dir" && as_dir=. 
     2892  for ac_exec_ext in '' $ac_executable_extensions; do 
     2893  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 
     2894    ac_cv_prog_XARGS="xargs" 
     2895    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 
     2896    break 2 
     2897  fi 
     2898done 
     2899done 
     2900 
     2901fi 
     2902fi 
     2903XARGS=$ac_cv_prog_XARGS 
     2904if test -n "$XARGS"; then 
     2905  echo "$as_me:$LINENO: result: $XARGS" >&5 
     2906echo "${ECHO_T}$XARGS" >&6 
    28082907else 
    28092908  echo "$as_me:$LINENO: result: no" >&5 
     
    29773076echo "${ECHO_T}$ac_cv_lib_m_main" >&6 
    29783077if test $ac_cv_lib_m_main = yes; then 
    2979   LIBS="$LIBS -lm" 
     3078 
     3079                LIBS="$LIBS -lm" 
     3080 
    29803081fi 
    29813082 
     
    31173218echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 
    31183219if test $ac_cv_lib_socket_setsockopt = yes; then 
    3119   LIBS="$LIBS -lsocket" 
     3220 
     3221                LIBS="$LIBS -lsocket" 
     3222 
    31203223fi 
    31213224 
     
    32573360echo "${ECHO_T}$ac_cv_lib_nsl_gethostent" >&6 
    32583361if test $ac_cv_lib_nsl_gethostent = yes; then 
    3259   LIBS="$LIBS -lnsl" 
     3362 
     3363                LIBS="$LIBS -lnsl" 
     3364 
    32603365fi 
    32613366 
     
    39314036else 
    39324037 
    3933                 { { echo "$as_me:$LINENO: error: could not locate a usable SHA interface in OpenSSL" >&5 
    3934 echo "$as_me: error: could not locate a usable SHA interface in OpenSSL" >&2;} 
     4038 
     4039        { { echo "$as_me:$LINENO: error: could not locate OpenSSL 
     4040 
     4041If you installed OpenSSL into a non-standard directory, please run: 
     4042 
     4043    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 
     4044echo "$as_me: error: could not locate OpenSSL 
     4045 
     4046If you installed OpenSSL into a non-standard directory, please run: 
     4047 
     4048    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} 
    39354049   { (exit 1); exit 1; }; } 
    39364050 
    3937 fi 
    3938  
    3939  
    3940 else 
    3941  
    3942         { { echo "$as_me:$LINENO: error: could not locate OpenSSL" >&5 
    3943 echo "$as_me: error: could not locate OpenSSL" >&2;} 
     4051 
     4052fi 
     4053 
     4054 
     4055else 
     4056 
     4057 
     4058        { { echo "$as_me:$LINENO: error: could not locate OpenSSL 
     4059 
     4060If you installed OpenSSL into a non-standard directory, please run: 
     4061 
     4062    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 
     4063echo "$as_me: error: could not locate OpenSSL 
     4064 
     4065If you installed OpenSSL into a non-standard directory, please run: 
     4066 
     4067    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} 
    39444068   { (exit 1); exit 1; }; } 
     4069 
    39454070 
    39464071fi 
     
    41434268else 
    41444269 
    4145                 { { echo "$as_me:$LINENO: error: could not locate a usable OpenSSL implementation" >&5 
    4146 echo "$as_me: error: could not locate a usable OpenSSL implementation" >&2;} 
     4270 
     4271        { { echo "$as_me:$LINENO: error: could not locate OpenSSL 
     4272 
     4273If you installed OpenSSL into a non-standard directory, please run: 
     4274 
     4275    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 
     4276echo "$as_me: error: could not locate OpenSSL 
     4277 
     4278If you installed OpenSSL into a non-standard directory, please run: 
     4279 
     4280    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} 
    41474281   { (exit 1); exit 1; }; } 
    41484282 
    4149 fi 
    4150  
    4151  
    4152 else 
    4153  
    4154         { { echo "$as_me:$LINENO: error: could not locate OpenSSL" >&5 
    4155 echo "$as_me: error: could not locate OpenSSL" >&2;} 
     4283 
     4284fi 
     4285 
     4286 
     4287else 
     4288 
     4289 
     4290        { { echo "$as_me:$LINENO: error: could not locate OpenSSL 
     4291 
     4292If you installed OpenSSL into a non-standard directory, please run: 
     4293 
     4294    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&5 
     4295echo "$as_me: error: could not locate OpenSSL 
     4296 
     4297If you installed OpenSSL into a non-standard directory, please run: 
     4298 
     4299    env CPPFLAGS=\"-I/path/to/include\" LDFLAGS=\"-L/path/to/lib\" ./configure" >&2;} 
    41564300   { (exit 1); exit 1; }; } 
     4301 
    41574302 
    41584303fi 
     
    54615606 
    54625607for ac_header in  \ 
    5463         arpa/inet.h             errno.h                 fcntl.h                 limits.h \ 
    5464         netdb.h                 netinet/in.h    stdlib.h                string.h \ 
    5465         sys/ioctl.h             sys/param.h             sys/socket.h    sys/time.h \ 
    5466         sys/vfs.h               syslog.h                unistd.h 
     5608        arpa/inet.h \ 
     5609        errno.h \ 
     5610        fcntl.h \ 
     5611        limits.h \ 
     5612        netdb.h \ 
     5613        netinet/in.h \ 
     5614        stdlib.h \ 
     5615        string.h \ 
     5616        sys/ioctl.h \ 
     5617        sys/param.h \ 
     5618        sys/socket.h \ 
     5619        sys/time.h \ 
     5620        sys/vfs.h \ 
     5621        syslog.h \ 
     5622        unistd.h 
     5623 
    54675624do 
    54685625as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` 
     
    59156072fi 
    59166073 
    5917 echo "$as_me:$LINENO: checking return type of signal handlers" >&5 
    5918 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 
    5919 if test "${ac_cv_type_signal+set}" = set; then 
    5920   echo $ECHO_N "(cached) $ECHO_C" >&6 
    5921 else 
    5922   cat >conftest.$ac_ext <<_ACEOF 
    5923 #line $LINENO "configure" 
    5924 /* confdefs.h.  */ 
    5925 _ACEOF 
    5926 cat confdefs.h >>conftest.$ac_ext 
    5927 cat >>conftest.$ac_ext <<_ACEOF 
    5928 /* end confdefs.h.  */ 
    5929 #include <sys/types.h> 
    5930 #include <signal.h> 
    5931 #ifdef signal 
    5932 # undef signal 
    5933 #endif 
    5934 #ifdef __cplusplus 
    5935 extern "C" void (*signal (int, void (*)(int)))(int); 
    5936 #else 
    5937 void (*signal ()) (); 
    5938 #endif 
    5939  
    5940 int 
    5941 main () 
    5942 { 
    5943 int i; 
    5944   ; 
    5945   return 0; 
    5946 } 
    5947 _ACEOF 
    5948 rm -f conftest.$ac_objext 
    5949 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 
    5950   (eval $ac_compile) 2>&5 
    5951   ac_status=$? 
    5952   echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    5953   (exit $ac_status); } && 
    5954          { ac_try='test -s conftest.$ac_objext' 
    5955   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 
    5956   (eval $ac_try) 2>&5 
    5957   ac_status=$? 
    5958   echo "$as_me:$LINENO: \$? = $ac_status" >&5 
    5959   (exit $ac_status); }; }; then 
    5960   ac_cv_type_signal=void 
    5961 else 
    5962   echo "$as_me: failed program was:" >&5 
    5963 sed 's/^/| /' conftest.$ac_ext >&5 
    5964  
    5965 ac_cv_type_signal=int 
    5966 fi 
    5967 rm -f conftest.$ac_objext conftest.$ac_ext 
    5968 fi 
    5969 echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 
    5970 echo "${ECHO_T}$ac_cv_type_signal" >&6 
    5971  
    5972 cat >>confdefs.h <<_ACEOF 
    5973 #define RETSIGTYPE $ac_cv_type_signal 
    5974 _ACEOF 
    5975  
    5976  
    59776074echo "$as_me:$LINENO: checking for size_t" >&5 
    59786075echo $ECHO_N "checking for size_t... $ECHO_C" >&6 
     
    71007197rm -f conftest* 
    71017198 
     7199echo "$as_me:$LINENO: checking return type of signal handlers" >&5 
     7200echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 
     7201if test "${ac_cv_type_signal+set}" = set; then 
     7202  echo $ECHO_N "(cached) $ECHO_C" >&6 
     7203else 
     7204  cat >conftest.$ac_ext <<_ACEOF 
     7205#line $LINENO "configure" 
     7206/* confdefs.h.  */ 
     7207_ACEOF 
     7208cat confdefs.h >>conftest.$ac_ext 
     7209cat >>conftest.$ac_ext <<_ACEOF 
     7210/* end confdefs.h.  */ 
     7211#include <sys/types.h> 
     7212#include <signal.h> 
     7213#ifdef signal 
     7214# undef signal 
     7215#endif 
     7216#ifdef __cplusplus 
     7217extern "C" void (*signal (int, void (*)(int)))(int); 
     7218#else 
     7219void (*signal ()) (); 
     7220#endif 
     7221 
     7222int 
     7223main () 
     7224{ 
     7225int i; 
     7226  ; 
     7227  return 0; 
     7228} 
     7229_ACEOF 
     7230rm -f conftest.$ac_objext 
     7231if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 
     7232  (eval $ac_compile) 2>&5 
     7233  ac_status=$? 
     7234  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     7235  (exit $ac_status); } && 
     7236         { ac_try='test -s conftest.$ac_objext' 
     7237  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 
     7238  (eval $ac_try) 2>&5 
     7239  ac_status=$? 
     7240  echo "$as_me:$LINENO: \$? = $ac_status" >&5 
     7241  (exit $ac_status); }; }; then 
     7242  ac_cv_type_signal=void 
     7243else 
     7244  echo "$as_me: failed program was:" >&5 
     7245sed 's/^/| /' conftest.$ac_ext >&5 
     7246 
     7247ac_cv_type_signal=int 
     7248fi 
     7249rm -f conftest.$ac_objext conftest.$ac_ext 
     7250fi 
     7251echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 
     7252echo "${ECHO_T}$ac_cv_type_signal" >&6 
     7253 
     7254cat >>confdefs.h <<_ACEOF 
     7255#define RETSIGTYPE $ac_cv_type_signal 
     7256_ACEOF 
     7257 
     7258 
    71027259echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 
    71037260echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6 
     
    73367493 
    73377494 
     7495 
    73387496for ac_func in  \ 
    7339         gethostbyaddr   gethostbyname   gethostname             gettimeofday \ 
    7340         inet_ntoa               memset                  mkdir                   pow \ 
    7341         realpath                rmdir                   select                  setproctitle \ 
    7342         socket                  strcasecmp              strncasecmp             strcasestr \ 
    7343         strchr                  strdup                  strerror                strlcpy \ 
    7344         strpbrk                 strrchr                 strsep                  strstr \ 
    7345         strtol                  strtoul                 strtoull                tzset \ 
     7497        gethostbyaddr \ 
     7498        gethostbyname   gethostname             gettimeofday \ 
     7499        inet_ntoa \ 
     7500        localtime_r \ 
     7501        memset \ 
     7502        mkdir \ 
     7503        pow \ 
     7504        realpath \ 
     7505        rmdir \ 
     7506        select \ 
     7507        setproctitle \ 
     7508        socket \ 
     7509        strcasecmp \ 
     7510        strncasecmp \ 
     7511        strcasestr \ 
     7512        strchr \ 
     7513        strdup \ 
     7514        strerror \ 
     7515        strlcpy \ 
     7516        strpbrk \ 
     7517        strrchr \ 
     7518        strsep \ 
     7519        strstr \ 
     7520        strtol \ 
     7521        strtoul \ 
     7522        strtoull \ 
     7523        tzset \ 
    73467524        uname 
    73477525do 
     
    80788256s,@SED@,$SED,;t t 
    80798257s,@CUT@,$CUT,;t t 
     8258s,@FIND@,$FIND,;t t 
     8259s,@XARGS@,$XARGS,;t t 
    80808260s,@OPENSSL@,$OPENSSL,;t t 
    80818261s,@CPP@,$CPP,;t t 
  • trackerd/trunk/configure.in

    r199 r204  
    11# Process this file with autoconf to produce a configure script 
    2 AC_INIT(trackerd, 1.0, axel@zankasoftware.com
    3 AC_PREREQ(2.57
     2AC_INIT([trackerd], [1.0], [axel@zankasoftware.com]
     3AC_PREREQ([2.57]
    44AC_CONFIG_SRCDIR([config.h.in]) 
    55AC_CONFIG_HEADER([config.h]) 
     
    99 
    1010# These are used in the source code 
    11 AC_DEFINE(WT_PACKAGE_VERSION, "AC_PACKAGE_VERSION", Application version
    12 AC_DEFINE(WT_PROTOCOL_VERSION, "1.0", Protocol version
    13 AC_DEFINE(WT_BUGREPORT, "AC_PACKAGE_BUGREPORT", Maintainer's email address
    14 AC_DEFINE_UNQUOTED(WT_CPU, "$host_cpu", Host CPU
     11AC_DEFINE([WT_PACKAGE_VERSION], ["AC_PACKAGE_VERSION"], [Application version]
     12AC_DEFINE([WT_PROTOCOL_VERSION], ["1.0"], [Protocol version]
     13AC_DEFINE([WT_BUGREPORT], ["AC_PACKAGE_BUGREPORT"], [Maintainer's email address]
     14AC_DEFINE_UNQUOTED([WT_CPU], ["$host_cpu"], [Host CPU]
    1515 
    1616# These are used in the Makefile 
    17 AC_SUBST(WT_PACKAGE_VERSION, "AC_PACKAGE_VERSION") 
     17AC_SUBST([WT_PACKAGE_VERSION], ["AC_PACKAGE_VERSION"]) 
     18 
     19# These are used in configure.in 
     20AC_DEFUN([WT_MSG_LIB_ERROR], [ 
     21        AC_MSG_ERROR([could not locate $1 
     22         
     23If you installed $1 into a non-standard directory, please run: 
     24 
     25    env CPPFLAGS="-I/path/to/include" LDFLAGS="-L/path/to/lib" ./configure]) 
     26]) 
    1827 
    1928 
     
    3140# Check for some other user to use than "wired" 
    3241AC_MSG_CHECKING([for user]) 
    33 AC_ARG_WITH(user
    34 [  --with-user=USER        use a user other than "wired"] 
     42AC_ARG_WITH([user]
     43       [  --with-user=USER        use a user other than "wired"] 
    3544) 
    3645 
     
    5362]) 
    5463 
    55 AC_DEFINE_UNQUOTED(WT_USER, "$with_user", User name) 
    56 AC_SUBST(WT_USER, "$with_user") 
     64AC_DEFINE_UNQUOTED([WT_USER], ["$with_user"], [User name]) 
     65AC_SUBST([WT_USER], ["$with_user"]) 
     66 
    5767 
    5868# Check for some other group to use than "daemon" 
    5969AC_MSG_CHECKING([for group]) 
    60 AC_ARG_WITH(group
     70AC_ARG_WITH([group]
    6171        [  --with-group=GROUP      use a group other than "daemon"] 
    6272) 
     
    8090]) 
    8191 
    82 AC_DEFINE_UNQUOTED(WT_GROUP, "$with_group", Group name) 
    83 AC_SUBST(WT_GROUP, "$with_group") 
     92AC_DEFINE_UNQUOTED([WT_GROUP], ["$with_group"], [Group name]) 
     93AC_SUBST([WT_GROUP], ["$with_group"]) 
     94 
     95 
     96# Check for warnings 
     97AC_MSG_CHECKING([whether to enable warnings]) 
     98AC_ARG_ENABLE([warnings], 
     99        [  --enable-warnings       enable warnings] 
     100
     101 
     102if test -n "$enable_warnings"; then 
     103        AC_MSG_RESULT([yes]) 
     104        CFLAGS="$CFLAGS -Wall" 
     105else 
     106        AC_MSG_RESULT([no]) 
     107fi 
    84108 
    85109 
     
    87111# Checks for programs. 
    88112 
    89 AC_CHECK_PROG(MV, mv, mv) 
    90 AC_CHECK_PROG(CP, cp, cp) 
    91 AC_CHECK_PROG(RM, rm, rm) 
    92 AC_CHECK_PROG(MKDIR, mkdir, mkdir) 
    93 AC_CHECK_PROG(CHMOD, chmod, chmod) 
    94 AC_CHECK_PROG(TAR, tar, tar) 
    95 AC_CHECK_PROG(SED, sed, sed) 
    96 AC_CHECK_PROG(CUT, cut, cut) 
    97 AC_CHECK_PROG(OPENSSL, openssl, openssl) 
     113AC_CHECK_PROG([MV], [mv], [mv]) 
     114AC_CHECK_PROG([CP], [cp], [cp]) 
     115AC_CHECK_PROG([RM], [rm], [rm]) 
     116AC_CHECK_PROG([MKDIR], [mkdir], [mkdir]) 
     117AC_CHECK_PROG([CHMOD], [chmod], [chmod]) 
     118AC_CHECK_PROG([TAR], [tar], [tar]) 
     119AC_CHECK_PROG([SED], [sed], [sed]) 
     120AC_CHECK_PROG([CUT], [cut], [cut]) 
     121AC_CHECK_PROG([FIND], [find], [find]) 
     122AC_CHECK_PROG([XARGS], [xargs], [xargs]) 
     123AC_CHECK_PROG([OPENSSL], [openssl], [openssl]) 
    98124 
    99125 
     
    102128 
    103129# Check if we need the math library 
    104 AC_CHECK_FUNC(pow, [], [ 
    105         AC_CHECK_LIB(m, main, LIBS="$LIBS -lm") 
     130AC_CHECK_FUNC([pow], [], [ 
     131        AC_CHECK_LIB([m], [main], [ 
     132                LIBS="$LIBS -lm" 
     133        ]) 
    106134]) 
    107135 
     
    109137# Check if we need the socket library 
    110138AC_CHECK_FUNC(setsockopt, [], [ 
    111         AC_CHECK_LIB(socket, setsockopt, LIBS="$LIBS -lsocket") 
     139        AC_CHECK_LIB([socket], [setsockopt], [ 
     140                LIBS="$LIBS -lsocket" 
     141        ]) 
    112142]) 
    113143 
    114144 
    115145# Check if we need the network services library 
    116 AC_CHECK_FUNC(gethostent, [], [ 
    117         AC_CHECK_LIB(nsl, gethostent, LIBS="$LIBS -lnsl") 
     146AC_CHECK_FUNC([gethostent], [], [ 
     147        AC_CHECK_LIB([nsl], [gethostent], [ 
     148                LIBS="$LIBS -lnsl" 
     149        ]) 
    118150]) 
    119151 
     
    121153# Check for the OpenSSL crypto library 
    122154AC_CHECK_HEADERS([openssl/sha.h], [ 
    123         AC_CHECK_LIB(crypto, main, [ 
     155        AC_CHECK_LIB([crypto], [main], [ 
    124156                LIBS="$LIBS -lcrypto" 
    125157        ], [ 
    126                 AC_MSG_ERROR([could not locate a usable SHA interface in OpenSSL]) 
     158                WT_MSG_LIB_ERROR([OpenSSL]) 
    127159        ]) 
    128160], [ 
    129         AC_MSG_ERROR([could not locate OpenSSL]) 
     161        WT_MSG_LIB_ERROR([OpenSSL]) 
    130162]) 
    131163 
     
    133165# Check for the OpenSSL ssl library 
    134166AC_CHECK_HEADERS([openssl/ssl.h], [ 
    135         AC_CHECK_LIB(ssl, main, [ 
     167        AC_CHECK_LIB([ssl], [main], [ 
    136168                LIBS="$LIBS -lssl" 
    137169        ], [ 
    138                 AC_MSG_ERROR([could not locate a usable OpenSSL implementation]) 
     170                WT_MSG_LIB_ERROR([OpenSSL]) 
    139171        ]) 
    140172], [ 
    141         AC_MSG_ERROR([could not locate OpenSSL]) 
     173        WT_MSG_LIB_ERROR([OpenSSL]) 
    142174]) 
    143175 
     
    241273AC_HEADER_STDBOOL 
    242274AC_CHECK_HEADERS([ \ 
    243         arpa/inet.h             errno.h                 fcntl.h                 limits.h \ 
    244         netdb.h                 netinet/in.h    stdlib.h                string.h \ 
    245         sys/ioctl.h             sys/param.h             sys/socket.h    sys/time.h \ 
    246         sys/vfs.h               syslog.h                unistd.h]) 
     275        arpa/inet.h \ 
     276        errno.h \ 
     277        fcntl.h \ 
     278        limits.h \ 
     279        netdb.h \ 
     280        netinet/in.h \ 
     281        stdlib.h \ 
     282        string.h \ 
     283        sys/ioctl.h \ 
     284        sys/param.h \ 
     285        sys/socket.h \ 
     286        sys/time.h \ 
     287        sys/vfs.h \ 
     288        syslog.h \ 
     289        unistd.h 
     290]) 
    247291 
    248292 
     
    255299AC_TYPE_MODE_T 
    256300AC_TYPE_OFF_T 
    257 AC_TYPE_SIGNAL 
    258301AC_TYPE_SIZE_T 
    259302AC_STRUCT_TM 
     
    268311AC_FUNC_REALLOC 
    269312AC_FUNC_SELECT_ARGTYPES 
     313AC_TYPE_SIGNAL 
    270314AC_FUNC_STAT 
    271315AC_FUNC_STRFTIME 
    272316AC_CHECK_FUNCS([ \ 
    273         gethostbyaddr   gethostbyname   gethostname             gettimeofday \ 
    274         inet_ntoa               memset                  mkdir                   pow \ 
    275         realpath                rmdir                   select                  setproctitle \ 
    276         socket                  strcasecmp              strncasecmp             strcasestr \ 
    277         strchr                  strdup                  strerror                strlcpy \ 
    278         strpbrk                 strrchr                 strsep                  strstr \ 
    279         strtol                  strtoul                 strtoull                tzset \ 
     317        gethostbyaddr \ 
     318        gethostbyname   gethostname             gettimeofday \ 
     319        inet_ntoa \ 
     320        localtime_r \ 
     321        memset \ 
     322        mkdir \ 
     323        pow \ 
     324        realpath \ 
     325        rmdir \ 
     326        select \ 
     327        setproctitle \ 
     328        socket \ 
     329        strcasecmp \ 
     330        strncasecmp \ 
     331        strcasestr \ 
     332        strchr \ 
     333        strdup \ 
     334        strerror \ 
     335        strlcpy \ 
     336        strpbrk \ 
     337        strrchr \ 
     338        strsep \ 
     339        strstr \ 
     340        strtol \ 
     341        strtoul \ 
     342        strtoull \ 
     343        tzset \ 
    280344        uname]) 
    281345 
  • trackerd/trunk/trackerd/banlist.c

    r189 r204  
    1 /* $Id: banlist.c,v 1.1 2004/05/12 22:09:25 morris Exp $ */ 
     1/* $Id: banlist.c,v 1.2 2004/07/28 13:12:04 morris Exp $ */ 
    22 
    33/* 
     
    2727 */ 
    2828 
     29#include "config.h" 
     30 
    2931#include <sys/param.h> 
    3032#include <sys/types.h> 
     
    3739#include <math.h> 
    3840 
    39 #include "config.h" 
    4041#include "banlist.h" 
    4142#include "settings.h" 
     
    4344 
    4445 
    45 int wt_check_ban(char *ip) { 
    46         FILE                                   *fp; 
    47         char                                   buffer[BUFSIZ], *p; 
    48         int                                            result = 1
     46bool wt_ip_is_banned(char *ip) { 
     47        FILE            *fp; 
     48        char            buffer[BUFSIZ], *p; 
     49        bool           banned = false
    4950 
    5051        /* check the banlist if we're configured to do so */ 
    5152        if(strlen(wt_settings.banlist) > 0) { 
     53 
    5254                /* open the banlist file */ 
    5355                fp = fopen(wt_settings.banlist, "r"); 
    5456                 
    55                 if(!fp) { 
     57                if(fp) { 
     58                        while(fgets(buffer, sizeof(buffer), fp) != NULL) { 
     59                                /* remove the linebreak if any */ 
     60                                if((p = strchr(buffer, '\n')) != NULL) 
     61                                        *p = '\0'; 
     62                 
     63                                /* ignore comments */ 
     64                                if(buffer[0] == '#' || buffer[0] == '\0') 
     65                                        continue; 
     66                                 
     67                                if(strchr(buffer, '*')) { 
     68                                        /* test wildcard string */ 
     69                                        if(wt_ip_matches_wildcard(ip, buffer)) { 
     70                                                banned = true; 
     71                                                 
     72                                                break; 
     73                                        } 
     74                                } 
     75                                else if(strchr(buffer, '/')) { 
     76                                        /* test netmask string */ 
     77                                        if(wt_ip_matches_netmask(ip, buffer)) { 
     78                                                banned = true; 
     79                                                 
     80                                                break; 
     81                                        } 
     82                                } else { 
     83                                        /* test absolute string */ 
     84                                        if(strcmp(ip, buffer) == 0) { 
     85                                                banned = true; 
     86                                                 
     87                                                break; 
     88                                        } 
     89                                } 
     90                        } 
     91                         
     92                        fclose(fp); 
     93                } else { 
    5694                        wt_log(LOG_WARNING, "Could not open %s: %s", 
    5795                                wt_settings.banlist, strerror(errno)); 
    58                          
    59                         return 0; 
    6096                } 
    61          
    62                 while(fgets(buffer, sizeof(buffer), fp) != NULL) { 
    63                         /* remove the linebreak if any */ 
    64                         if((p = strchr(buffer, '\n')) != NULL) 
    65                                 *p = '\0'; 
    66          
    67                         /* ignore comments */ 
    68                         if(buffer[0] == '#' || buffer[0] == '\0') 
    69                                 continue; 
    70                          
    71                         if(strchr(buffer, '*')) { 
    72                                 /* test wildcard string */ 
    73                                 if(wt_ip_wildcard(buffer, ip)) { 
    74                                         result = -1; 
    75                                          
    76                                         break; 
    77                                 } 
    78                         } 
    79                         else if(strchr(buffer, '/')) { 
    80                                 /* test netmask string */ 
    81                                 if(wt_ip_netmask(buffer, ip)) { 
    82                                         result = -1; 
    83                                          
    84                                         break; 
    85                                 } 
    86                         } else { 
    87                                 /* test absolute string */ 
    88                                 if(strcmp(ip, buffer) == 0) { 
    89                                         result = -1; 
    90                                          
    91                                         break; 
    92                                 } 
    93                         } 
    94                 } 
    95                  
    96                 fclose(fp); 
    9797        } 
    98          
    99         return result
     98 
     99        return banned
    100100} 
    101101 
     
    104104#pragma mark - 
    105105 
    106 int wt_ip_wildcard(char *match, char *test) { 
    107         char    *ip, *o, *m, *t; 
    108         int             result = 0; 
     106bool wt_ip_matches_wildcard(char *ip, char *match) { 
     107        char    i[16], m[16]; 
     108        char    *ii, *mm, *p1, *p2; 
     109        int             matches = 0; 
    109110         
    110         /* we're going to modify the ip */ 
    111         o = ip = strdup(test); 
     111        strlcpy(i, ip, sizeof(i)); 
     112        ii = i; 
     113 
     114        strlcpy(m, match, sizeof(m)); 
     115        mm = m; 
    112116         
    113         while((m = strsep(&match, ".")) && (t = strsep(&ip, "."))) { 
    114                 if(strcmp(m, t) == 0 || strcmp(m, "*") == 0) 
    115                         result++; 
     117        while((p1 = strsep(&ii, ".")) && (p2 = strsep(&mm, "."))) { 
     118                if(strcmp(p1, p2) == 0 || strcmp(p2, "*") == 0) 
     119                        matches++; 
    116120        } 
    117          
    118         free(o); 
    119121 
    120         return result == 4 ? 1 : 0
     122        return matches == 4 ? true : false
    121123} 
    122124 
    123125 
    124126 
    125 int wt_ip_netmask(char *match, char *test) { 
    126         char                    *p, *netmask
    127         unsigned int   ip_u = 0, netmask_u = 0, test_u = 0
    128         unsigned int    bits
     127bool wt_ip_matches_netmask(char *ip, char *match) { 
     128        char                    m[32], netmask[16]
     129        char                   *p
     130        unsigned int    ip_u, match_u, netmask_u
    129131         
    130         /* separate ip and netmask */ 
    131         p               = strchr(match, '/'); 
    132         netmask = p + 1; 
    133         *p              = '\0'; 
     132        strlcpy(m, match, sizeof(m)); 
    134133         
    135         /* convert to decimals */ 
    136         ip_u    = wt_iptou(match); 
    137         test_u  = wt_iptou(test); 
    138  
    139         /* check if the netmask is in ip form */ 
    140         if(strchr(netmask, '.')) { 
    141                 netmask_u       = wt_iptou(netmask); 
    142         } else { 
    143                 bits            = strtoul(netmask, NULL, 10); 
    144                 netmask_u       = ((unsigned int) pow(2, bits) - 1) << (32 - bits); 
     134        if((p = strchr(m, '/'))) { 
     135                strlcpy(netmask, p + 1, sizeof(netmask)); 
     136                 
     137                *p = '\0'; 
    145138        } 
    146139         
    147         return (ip_u & netmask_u) == (test_u & netmask_u); 
     140        ip_u            = wt_iptou(ip); 
     141        match_u         = wt_iptou(m); 
     142         
     143        if(strchr(netmask, '.')) 
     144                netmask_u = wt_iptou(netmask); 
     145        else 
     146                netmask_u = pow(2.0, 32.0) - pow(2.0, (float) 32 - strtoul(netmask, NULL, 10)); 
     147         
     148        return ((ip_u & netmask_u) == (match_u & netmask_u)); 
    148149} 
    149150 
    150151 
    151152 
    152 unsigned int wt_iptou(char *ip) { 
    153         char    *ap, *o, *p; 
    154         int             i = 3, out = 0; 
     153int wt_iptou(char *ip) { 
     154        unsigned int    a, b, c, d; 
    155155         
    156         /* we're going to modify the ip */ 
    157         o = p = strdup(ip)
     156        if(sscanf(ip, "%u.%u.%u.%u", &a, &b, &c, &d) == 4) 
     157               return (a << 24) + (b << 16) + (c << 8) + d
    158158         
    159         while((ap = strsep(&p, "."))) 
    160                 out += strtoul(ap, NULL, 10) * (unsigned int) pow(256, i--); 
    161          
    162         free(o); 
    163          
    164         return out; 
     159        return -1; 
    165160}