Changeset 204
- Timestamp:
- 07/28/04 15:12:04 (4 years ago)
- Files:
-
- trackerd/trunk/Makefile.in (modified) (5 diffs)
- trackerd/trunk/config.h.in (modified) (1 diff)
- trackerd/trunk/configure (modified) (16 diffs)
- trackerd/trunk/configure.in (modified) (13 diffs)
- trackerd/trunk/trackerd/banlist.c (modified) (5 diffs)
- trackerd/trunk/trackerd/banlist.h (modified) (2 diffs)
- trackerd/trunk/trackerd/commands.c (modified) (27 diffs)
- trackerd/trunk/trackerd/commands.h (modified) (3 diffs)
- trackerd/trunk/trackerd/main.c (modified) (9 diffs)
- trackerd/trunk/trackerd/settings.c (modified) (13 diffs)
- trackerd/trunk/trackerd/settings.h (modified) (3 diffs)
- trackerd/trunk/trackerd/tracker.c (modified) (23 diffs)
- trackerd/trunk/trackerd/tracker.h (modified) (9 diffs)
- trackerd/trunk/trackerd/utility.c (modified) (9 diffs)
- trackerd/trunk/trackerd/utility.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trackerd/trunk/Makefile.in
r189 r204 1 1 SUBDIRS = trackerd 2 DISTFILES = INSTALL LICENSE README Makefile .in config.guess config.h.in config.sub configure configure.in install-sh man run trackerd2 DISTFILES = INSTALL LICENSE README Makefile Makefile.in config.guess config.h.in config.sub configure configure.in install-sh man run trackerd 3 3 4 4 WT_PACKAGE_VERSION = @WT_PACKAGE_VERSION@ … … 30 30 SED = @SED@ 31 31 CUT = @CUT@ 32 FIND = @FIND@ 33 XARGS = @XARGS@ 32 34 OPENSSL = @OPENSSL@ 33 35 … … 95 97 $(INSTALL) -m 644 -o root -g bin man/trackerd.8 $(mandir)/man8/ 96 98 97 dist: distclean99 dist: 98 100 @echo "Making $@ in ." 99 101 … … 105 107 $(CP) -pr $$i wired-tracker-$(WT_PACKAGE_VERSION)/$$i; \ 106 108 done 109 110 $(MAKE) -C wired-tracker-$(WT_PACKAGE_VERSION) -f Makefile distclean 107 111 108 112 $(TAR) -czf wired-tracker-$(WT_PACKAGE_VERSION).tar.gz wired-tracker-$(WT_PACKAGE_VERSION) 109 113 $(RM) -rf wired-tracker-$(WT_PACKAGE_VERSION) 110 114 111 115 clean: clean-recursive 112 116 @echo "Making $@ in ." … … 117 121 @echo "Making $@ in ." 118 122 123 $(FIND) . -name .DS_Store -print0 | $(XARGS) -0 $(RM) -f 124 $(FIND) . -name CVS -print0 | $(XARGS) -0 $(RM) -rf 119 125 $(RM) -f Makefile config.h config.log config.status 120 126 $(RM) -f wired-tracker-$(WT_PACKAGE_VERSION).tar.gz 127 128 autoclean: 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 38 38 #undef HAVE_LIMITS_H 39 39 40 /* Define to 1 if you have the `localtime_r' function. */ 41 #undef HAVE_LOCALTIME_R 42 40 43 /* Define to 1 if `lstat' has the bug that it succeeds when given the 41 44 zero-length file name argument. */ trackerd/trunk/configure
r199 r204 311 311 #endif" 312 312 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'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 FIND XARGS OPENSSL CPP EGREP LIBOBJS LTLIBOBJS' 314 314 ac_subst_files='' 315 315 … … 844 844 esac 845 845 cat <<\_ACEOF 846 847 Optional 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 846 852 847 853 Optional Packages: … … 1391 1397 1392 1398 1399 # These are used in configure.in 1400 1401 1393 1402 1394 1403 ####################################################################### … … 2451 2460 2452 2461 2462 2453 2463 # Check for some other group to use than "daemon" 2454 2464 echo "$as_me:$LINENO: checking for group" >&5 … … 2526 2536 WT_GROUP="$with_group" 2527 2537 2538 2539 2540 # Check for warnings 2541 echo "$as_me:$LINENO: checking whether to enable warnings" >&5 2542 echo $ECHO_N "checking whether to enable warnings... $ECHO_C" >&6 2543 # Check whether --enable-warnings or --disable-warnings was given. 2544 if test "${enable_warnings+set}" = set; then 2545 enableval="$enable_warnings" 2546 2547 fi; 2548 2549 if test -n "$enable_warnings"; then 2550 echo "$as_me:$LINENO: result: yes" >&5 2551 echo "${ECHO_T}yes" >&6 2552 CFLAGS="$CFLAGS -Wall" 2553 else 2554 echo "$as_me:$LINENO: result: no" >&5 2555 echo "${ECHO_T}no" >&6 2556 fi 2528 2557 2529 2558 … … 2806 2835 echo "$as_me:$LINENO: result: $CUT" >&5 2807 2836 echo "${ECHO_T}$CUT" >&6 2837 else 2838 echo "$as_me:$LINENO: result: no" >&5 2839 echo "${ECHO_T}no" >&6 2840 fi 2841 2842 # Extract the first word of "find", so it can be a program name with args. 2843 set dummy find; ac_word=$2 2844 echo "$as_me:$LINENO: checking for $ac_word" >&5 2845 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 2846 if test "${ac_cv_prog_FIND+set}" = set; then 2847 echo $ECHO_N "(cached) $ECHO_C" >&6 2848 else 2849 if test -n "$FIND"; then 2850 ac_cv_prog_FIND="$FIND" # Let the user override the test. 2851 else 2852 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 2853 for as_dir in $PATH 2854 do 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 2863 done 2864 done 2865 2866 fi 2867 fi 2868 FIND=$ac_cv_prog_FIND 2869 if test -n "$FIND"; then 2870 echo "$as_me:$LINENO: result: $FIND" >&5 2871 echo "${ECHO_T}$FIND" >&6 2872 else 2873 echo "$as_me:$LINENO: result: no" >&5 2874 echo "${ECHO_T}no" >&6 2875 fi 2876 2877 # Extract the first word of "xargs", so it can be a program name with args. 2878 set dummy xargs; ac_word=$2 2879 echo "$as_me:$LINENO: checking for $ac_word" >&5 2880 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 2881 if test "${ac_cv_prog_XARGS+set}" = set; then 2882 echo $ECHO_N "(cached) $ECHO_C" >&6 2883 else 2884 if test -n "$XARGS"; then 2885 ac_cv_prog_XARGS="$XARGS" # Let the user override the test. 2886 else 2887 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 2888 for as_dir in $PATH 2889 do 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 2898 done 2899 done 2900 2901 fi 2902 fi 2903 XARGS=$ac_cv_prog_XARGS 2904 if test -n "$XARGS"; then 2905 echo "$as_me:$LINENO: result: $XARGS" >&5 2906 echo "${ECHO_T}$XARGS" >&6 2808 2907 else 2809 2908 echo "$as_me:$LINENO: result: no" >&5 … … 2977 3076 echo "${ECHO_T}$ac_cv_lib_m_main" >&6 2978 3077 if test $ac_cv_lib_m_main = yes; then 2979 LIBS="$LIBS -lm" 3078 3079 LIBS="$LIBS -lm" 3080 2980 3081 fi 2981 3082 … … 3117 3218 echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 3118 3219 if test $ac_cv_lib_socket_setsockopt = yes; then 3119 LIBS="$LIBS -lsocket" 3220 3221 LIBS="$LIBS -lsocket" 3222 3120 3223 fi 3121 3224 … … 3257 3360 echo "${ECHO_T}$ac_cv_lib_nsl_gethostent" >&6 3258 3361 if test $ac_cv_lib_nsl_gethostent = yes; then 3259 LIBS="$LIBS -lnsl" 3362 3363 LIBS="$LIBS -lnsl" 3364 3260 3365 fi 3261 3366 … … 3931 4036 else 3932 4037 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 4041 If 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 4044 echo "$as_me: error: could not locate OpenSSL 4045 4046 If 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;} 3935 4049 { (exit 1); exit 1; }; } 3936 4050 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 4052 fi 4053 4054 4055 else 4056 4057 4058 { { echo "$as_me:$LINENO: error: could not locate OpenSSL 4059 4060 If 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 4063 echo "$as_me: error: could not locate OpenSSL 4064 4065 If 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;} 3944 4068 { (exit 1); exit 1; }; } 4069 3945 4070 3946 4071 fi … … 4143 4268 else 4144 4269 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 4273 If 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 4276 echo "$as_me: error: could not locate OpenSSL 4277 4278 If 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;} 4147 4281 { (exit 1); exit 1; }; } 4148 4282 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 4284 fi 4285 4286 4287 else 4288 4289 4290 { { echo "$as_me:$LINENO: error: could not locate OpenSSL 4291 4292 If 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 4295 echo "$as_me: error: could not locate OpenSSL 4296 4297 If 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;} 4156 4300 { (exit 1); exit 1; }; } 4301 4157 4302 4158 4303 fi … … 5461 5606 5462 5607 for 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 5467 5624 do 5468 5625 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` … … 5915 6072 fi 5916 6073 5917 echo "$as_me:$LINENO: checking return type of signal handlers" >&55918 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&65919 if test "${ac_cv_type_signal+set}" = set; then5920 echo $ECHO_N "(cached) $ECHO_C" >&65921 else5922 cat >conftest.$ac_ext <<_ACEOF5923 #line $LINENO "configure"5924 /* confdefs.h. */5925 _ACEOF5926 cat confdefs.h >>conftest.$ac_ext5927 cat >>conftest.$ac_ext <<_ACEOF5928 /* end confdefs.h. */5929 #include <sys/types.h>5930 #include <signal.h>5931 #ifdef signal5932 # undef signal5933 #endif5934 #ifdef __cplusplus5935 extern "C" void (*signal (int, void (*)(int)))(int);5936 #else5937 void (*signal ()) ();5938 #endif5939 5940 int5941 main ()5942 {5943 int i;5944 ;5945 return 0;5946 }5947 _ACEOF5948 rm -f conftest.$ac_objext5949 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&55950 (eval $ac_compile) 2>&55951 ac_status=$?5952 echo "$as_me:$LINENO: \$? = $ac_status" >&55953 (exit $ac_status); } &&5954 { ac_try='test -s conftest.$ac_objext'5955 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&55956 (eval $ac_try) 2>&55957 ac_status=$?5958 echo "$as_me:$LINENO: \$? = $ac_status" >&55959 (exit $ac_status); }; }; then5960 ac_cv_type_signal=void5961 else5962 echo "$as_me: failed program was:" >&55963 sed 's/^/| /' conftest.$ac_ext >&55964 5965 ac_cv_type_signal=int5966 fi5967 rm -f conftest.$ac_objext conftest.$ac_ext5968 fi5969 echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&55970 echo "${ECHO_T}$ac_cv_type_signal" >&65971 5972 cat >>confdefs.h <<_ACEOF5973 #define RETSIGTYPE $ac_cv_type_signal5974 _ACEOF5975 5976 5977 6074 echo "$as_me:$LINENO: checking for size_t" >&5 5978 6075 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 … … 7100 7197 rm -f conftest* 7101 7198 7199 echo "$as_me:$LINENO: checking return type of signal handlers" >&5 7200 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 7201 if test "${ac_cv_type_signal+set}" = set; then 7202 echo $ECHO_N "(cached) $ECHO_C" >&6 7203 else 7204 cat >conftest.$ac_ext <<_ACEOF 7205 #line $LINENO "configure" 7206 /* confdefs.h. */ 7207 _ACEOF 7208 cat confdefs.h >>conftest.$ac_ext 7209 cat >>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 7217 extern "C" void (*signal (int, void (*)(int)))(int); 7218 #else 7219 void (*signal ()) (); 7220 #endif 7221 7222 int 7223 main () 7224 { 7225 int i; 7226 ; 7227 return 0; 7228 } 7229 _ACEOF 7230 rm -f conftest.$ac_objext 7231 if { (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 7243 else 7244 echo "$as_me: failed program was:" >&5 7245 sed 's/^/| /' conftest.$ac_ext >&5 7246 7247 ac_cv_type_signal=int 7248 fi 7249 rm -f conftest.$ac_objext conftest.$ac_ext 7250 fi 7251 echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 7252 echo "${ECHO_T}$ac_cv_type_signal" >&6 7253 7254 cat >>confdefs.h <<_ACEOF 7255 #define RETSIGTYPE $ac_cv_type_signal 7256 _ACEOF 7257 7258 7102 7259 echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 7103 7260 echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6 … … 7336 7493 7337 7494 7495 7338 7496 for 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 \ 7346 7524 uname 7347 7525 do … … 8078 8256 s,@SED@,$SED,;t t 8079 8257 s,@CUT@,$CUT,;t t 8258 s,@FIND@,$FIND,;t t 8259 s,@XARGS@,$XARGS,;t t 8080 8260 s,@OPENSSL@,$OPENSSL,;t t 8081 8261 s,@CPP@,$CPP,;t t trackerd/trunk/configure.in
r199 r204 1 1 # Process this file with autoconf to produce a configure script 2 AC_INIT( trackerd, 1.0, axel@zankasoftware.com)3 AC_PREREQ( 2.57)2 AC_INIT([trackerd], [1.0], [axel@zankasoftware.com]) 3 AC_PREREQ([2.57]) 4 4 AC_CONFIG_SRCDIR([config.h.in]) 5 5 AC_CONFIG_HEADER([config.h]) … … 9 9 10 10 # 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)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]) 15 15 16 16 # These are used in the Makefile 17 AC_SUBST(WT_PACKAGE_VERSION, "AC_PACKAGE_VERSION") 17 AC_SUBST([WT_PACKAGE_VERSION], ["AC_PACKAGE_VERSION"]) 18 19 # These are used in configure.in 20 AC_DEFUN([WT_MSG_LIB_ERROR], [ 21 AC_MSG_ERROR([could not locate $1 22 23 If 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 ]) 18 27 19 28 … … 31 40 # Check for some other user to use than "wired" 32 41 AC_MSG_CHECKING([for user]) 33 AC_ARG_WITH( user,34 [ --with-user=USER use a user other than "wired"]42 AC_ARG_WITH([user], 43 [ --with-user=USER use a user other than "wired"] 35 44 ) 36 45 … … 53 62 ]) 54 63 55 AC_DEFINE_UNQUOTED(WT_USER, "$with_user", User name) 56 AC_SUBST(WT_USER, "$with_user") 64 AC_DEFINE_UNQUOTED([WT_USER], ["$with_user"], [User name]) 65 AC_SUBST([WT_USER], ["$with_user"]) 66 57 67 58 68 # Check for some other group to use than "daemon" 59 69 AC_MSG_CHECKING([for group]) 60 AC_ARG_WITH( group,70 AC_ARG_WITH([group], 61 71 [ --with-group=GROUP use a group other than "daemon"] 62 72 ) … … 80 90 ]) 81 91 82 AC_DEFINE_UNQUOTED(WT_GROUP, "$with_group", Group name) 83 AC_SUBST(WT_GROUP, "$with_group") 92 AC_DEFINE_UNQUOTED([WT_GROUP], ["$with_group"], [Group name]) 93 AC_SUBST([WT_GROUP], ["$with_group"]) 94 95 96 # Check for warnings 97 AC_MSG_CHECKING([whether to enable warnings]) 98 AC_ARG_ENABLE([warnings], 99 [ --enable-warnings enable warnings] 100 ) 101 102 if test -n "$enable_warnings"; then 103 AC_MSG_RESULT([yes]) 104 CFLAGS="$CFLAGS -Wall" 105 else 106 AC_MSG_RESULT([no]) 107 fi 84 108 85 109 … … 87 111 # Checks for programs. 88 112 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) 113 AC_CHECK_PROG([MV], [mv], [mv]) 114 AC_CHECK_PROG([CP], [cp], [cp]) 115 AC_CHECK_PROG([RM], [rm], [rm]) 116 AC_CHECK_PROG([MKDIR], [mkdir], [mkdir]) 117 AC_CHECK_PROG([CHMOD], [chmod], [chmod]) 118 AC_CHECK_PROG([TAR], [tar], [tar]) 119 AC_CHECK_PROG([SED], [sed], [sed]) 120 AC_CHECK_PROG([CUT], [cut], [cut]) 121 AC_CHECK_PROG([FIND], [find], [find]) 122 AC_CHECK_PROG([XARGS], [xargs], [xargs]) 123 AC_CHECK_PROG([OPENSSL], [openssl], [openssl]) 98 124 99 125 … … 102 128 103 129 # Check if we need the math library 104 AC_CHECK_FUNC(pow, [], [ 105 AC_CHECK_LIB(m, main, LIBS="$LIBS -lm") 130 AC_CHECK_FUNC([pow], [], [ 131 AC_CHECK_LIB([m], [main], [ 132 LIBS="$LIBS -lm" 133 ]) 106 134 ]) 107 135 … … 109 137 # Check if we need the socket library 110 138 AC_CHECK_FUNC(setsockopt, [], [ 111 AC_CHECK_LIB(socket, setsockopt, LIBS="$LIBS -lsocket") 139 AC_CHECK_LIB([socket], [setsockopt], [ 140 LIBS="$LIBS -lsocket" 141 ]) 112 142 ]) 113 143 114 144 115 145 # Check if we need the network services library 116 AC_CHECK_FUNC(gethostent, [], [ 117 AC_CHECK_LIB(nsl, gethostent, LIBS="$LIBS -lnsl") 146 AC_CHECK_FUNC([gethostent], [], [ 147 AC_CHECK_LIB([nsl], [gethostent], [ 148 LIBS="$LIBS -lnsl" 149 ]) 118 150 ]) 119 151 … … 121 153 # Check for the OpenSSL crypto library 122 154 AC_CHECK_HEADERS([openssl/sha.h], [ 123 AC_CHECK_LIB( crypto, main, [155 AC_CHECK_LIB([crypto], [main], [ 124 156 LIBS="$LIBS -lcrypto" 125 157 ], [ 126 AC_MSG_ERROR([could not locate a usable SHA interface inOpenSSL])158 WT_MSG_LIB_ERROR([OpenSSL]) 127 159 ]) 128 160 ], [ 129 AC_MSG_ERROR([could not locateOpenSSL])161 WT_MSG_LIB_ERROR([OpenSSL]) 130 162 ]) 131 163 … … 133 165 # Check for the OpenSSL ssl library 134 166 AC_CHECK_HEADERS([openssl/ssl.h], [ 135 AC_CHECK_LIB( ssl, main, [167 AC_CHECK_LIB([ssl], [main], [ 136 168 LIBS="$LIBS -lssl" 137 169 ], [ 138 AC_MSG_ERROR([could not locate a usable OpenSSL implementation])170 WT_MSG_LIB_ERROR([OpenSSL]) 139 171 ]) 140 172 ], [ 141 AC_MSG_ERROR([could not locateOpenSSL])173 WT_MSG_LIB_ERROR([OpenSSL]) 142 174 ]) 143 175 … … 241 273 AC_HEADER_STDBOOL 242 274 AC_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 ]) 247 291 248 292 … … 255 299 AC_TYPE_MODE_T 256 300 AC_TYPE_OFF_T 257 AC_TYPE_SIGNAL258 301 AC_TYPE_SIZE_T 259 302 AC_STRUCT_TM … … 268 311 AC_FUNC_REALLOC 269 312 AC_FUNC_SELECT_ARGTYPES 313 AC_TYPE_SIGNAL 270 314 AC_FUNC_STAT 271 315 AC_FUNC_STRFTIME 272 316 AC_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 \ 280 344 uname]) 281 345 trackerd/trunk/trackerd/banlist.c
r189 r204 1 /* $Id: banlist.c,v 1. 1 2004/05/12 22:09:25morris Exp $ */1 /* $Id: banlist.c,v 1.2 2004/07/28 13:12:04 morris Exp $ */ 2 2 3 3 /* … … 27 27 */ 28 28 29 #include "config.h" 30 29 31 #include <sys/param.h> 30 32 #include <sys/types.h> … … 37 39 #include <math.h> 38 40 39 #include "config.h"40 41 #include "banlist.h" 41 42 #include "settings.h" … … 43 44 44 45 45 int wt_check_ban(char *ip) {46 FILE *fp;47 char buffer[BUFSIZ], *p;48 int result = 1;46 bool wt_ip_is_banned(char *ip) { 47 FILE *fp; 48 char buffer[BUFSIZ], *p; 49 bool banned = false; 49 50 50 51 /* check the banlist if we're configured to do so */ 51 52 if(strlen(wt_settings.banlist) > 0) { 53 52 54 /* open the banlist file */ 53 55 fp = fopen(wt_settings.banlist, "r"); 54 56 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 { 56 94 wt_log(LOG_WARNING, "Could not open %s: %s", 57 95 wt_settings.banlist, strerror(errno)); 58 59 return 0;60 96 } 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);97 97 } 98 99 return result;98 99 return banned; 100 100 } 101 101 … … 104 104 #pragma mark - 105 105 106 int wt_ip_wildcard(char *match, char *test) { 107 char *ip, *o, *m, *t; 108 int result = 0; 106 bool wt_ip_matches_wildcard(char *ip, char *match) { 107 char i[16], m[16]; 108 char *ii, *mm, *p1, *p2; 109 int matches = 0; 109 110 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; 112 116 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++; 116 120 } 117 118 free(o);119 121 120 return result == 4 ? 1 : 0;122 return matches == 4 ? true : false; 121 123 } 122 124 123 125 124 126 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;127 bool 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; 129 131 130 /* separate ip and netmask */ 131 p = strchr(match, '/'); 132 netmask = p + 1; 133 *p = '\0'; 132 strlcpy(m, match, sizeof(m)); 134 133 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'; 145 138 } 146 139 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)); 148 149 } 149 150 150 151 151 152 152 unsigned int wt_iptou(char *ip) { 153 char *ap, *o, *p; 154 int i = 3, out = 0; 153 int wt_iptou(char *ip) { 154 unsigned int a, b, c, d; 155 155 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; 158 158 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; 165 160 }
