CVE-2022-34295: Use of Insufficiently Random Values (CWE-330)
value: totd before 1.5.3 does not properly randomize mesg IDs.
CWE description: The product uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
CVSS v3 base score: 6.5
Published: 2022-06-23T17:15Z
Repository: https://github.com/fwdillema/totd
Language: C
Files changed: ne_mesg.c, read_config.c
Commit date: 2014-02-18 15:02:20 +0100
Commit message: Patch provided by Gabor Lencse for generating better randomized mesg IDs.

Diff: diff --git a/config.log b/config.log
deleted file mode 100644
index 0b13485..0000000
--- a/config.log
+++ /dev/null
@@ -1,696 +0,0 @@
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by configure, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
-
-  $ ./configure 
-
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = drifter.fritz.box
-uname -m = x86_64
-uname -r = 12.4.0
-uname -s = Darwin
-uname -v = Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64
-
-/usr/bin/uname -p = i386
-/bin/uname -X     = unknown
-
-/bin/arch              = unknown
-/usr/bin/arch -k       = unknown
-/usr/convex/getsysinfo = unknown
-hostinfo               = Mach kernel version:
-	 Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64
-Kernel configured for up to 4 processors.
-2 processors are physically available.
-4 processors are logically available.
-Processor type: i486 (Intel 80486)
-Processors active: 0 1 2 3
-Primary memory available: 16.00 gigabytes
-Default processor set: 145 tasks, 695 threads, 4 processors
-Load average: 0.65, Mach factor: 3.35
-/bin/machine           = unknown
-/usr/bin/oslevel       = unknown
-/bin/universe          = unknown
-
-PATH: /opt/local/bin
-PATH: /opt/local/sbin
-PATH: /usr/bin
-PATH: /bin
-PATH: /usr/sbin
-PATH: /sbin
-PATH: /usr/local/bin
-PATH: /Developer/usr/bin
-PATH: /usr/local/MacGPG2/bin
-PATH: /usr/X11/bin
-PATH: /opt/local/bin
-PATH: /usr/local/git/bin
-PATH: /Volumes/Work/Repositories/play-2.1.1
-PATH: /usr/local/scala/bin
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-configure:1300: checking "IPv6 transport support"
-configure:1319: result: "enabled"
-configure:1324: checking "IPv4 transport support"
-configure:1341: result: "enabled"
-configure:1346: checking "6to4 reverse lookup support"
-configure:1362: result: "disabled"
-configure:1367: checking "scoped address rewriting support"
-configure:1384: result: "enabled"
-configure:1389: checking "http reconfiguration and management support"
-configure:1407: result: "disabled"
-configure:1458: checking for gcc
-configure:1474: found /usr/bin/gcc
-configure:1484: result: gcc
-configure:1728: checking for C compiler version
-configure:1731: gcc --version </dev/null >&5
-i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
-Copyright (C) 2007 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-configure:1734: $? = 0
-configure:1736: gcc -v </dev/null >&5
-Using built-in specs.
-Target: i686-apple-darwin11
-Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
-Thread model: posix
-gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
-configure:1739: $? = 0
-configure:1741: gcc -V </dev/null >&5
-llvm-gcc-4.2: argument to `-V' is missing
-configure:1744: $? = 1
-configure:1768: checking for C compiler default output
-configure:1771: gcc    conftest.c  >&5
-configure:1774: $? = 0
-configure:1820: result: a.out
-configure:1825: checking whether the C compiler works
-configure:1831: ./a.out
-configure:1834: $? = 0
-configure:1851: result: yes
-configure:1858: checking whether we are cross compiling
-configure:1860: result: no
-configure:1863: checking for suffix of executables
-configure:1865: gcc -o conftest    conftest.c  >&5
-configure:1868: $? = 0
-configure:1893: result: 
-configure:1899: checking for suffix of object files
-configure:1921: gcc -c   conftest.c >&5
-configure:1924: $? = 0
-configure:1946: result: o
-configure:1950: checking whether we are using the GNU C compiler
-configure:1975: gcc -c   conftest.c >&5
-configure:1978: $? = 0
-configure:1981: test -s conftest.o
-configure:1984: $? = 0
-configure:1997: result: yes
-configure:2003: checking whether gcc accepts -g
-configure:2025: gcc -c -g  conftest.c >&5
-configure:2028: $? = 0
-configure:2031: test -s conftest.o
-configure:2034: $? = 0
-configure:2045: result: yes
-configure:2062: checking for gcc option to accept ANSI C
-configure:2123: gcc  -c -g -O2  conftest.c >&5
-configure:2126: $? = 0
-configure:2129: test -s conftest.o
-configure:2132: $? = 0
-configure:2150: result: none needed
-configure:2168: gcc -c -g -O2  conftest.c >&5
-conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me'
-configure:2171: $? = 1
-configure: failed program was:
-| #ifndef __cplusplus
-|   choke me
-| #endif
-configure:2285: checking how to run the C preprocessor
-configure:2321: gcc -E  conftest.c
-configure:2327: $? = 0
-configure:2359: gcc -E  conftest.c
-configure:2358:28: error: ac_nonexistent.h: No such file or directory
-configure:2365: $? = 1
-configure: failed program was:
-| #line 2350 "configure"
-| /* confdefs.h.  */
-| 
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:2403: result: gcc -E
-configure:2428: gcc -E  conftest.c
-configure:2434: $? = 0
-configure:2466: gcc -E  conftest.c
-configure:2465:28: error: ac_nonexistent.h: No such file or directory
-configure:2472: $? = 1
-configure: failed program was:
-| #line 2457 "configure"
-| /* confdefs.h.  */
-| 
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:2515: checking operating system specific definitions...
-configure:2561: result: Darwin
-configure:2573: checking for egrep
-configure:2583: result: grep -E
-configure:2588: checking for ANSI C header files
-configure:2614: gcc -c -g -O2  conftest.c >&5
-configure:2617: $? = 0
-configure:2620: test -s conftest.o
-configure:2623: $? = 0
-configure:2715: gcc -o conftest -g -O2   conftest.c  >&5
-configure: In function 'main':
-configure:2708: warning: incompatible implicit declaration of built-in function 'exit'
-configure:2718: $? = 0
-configure:2720: ./conftest
-configure:2723: $? = 0
-configure:2738: result: yes
-configure:2762: checking for sys/types.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for sys/stat.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for stdlib.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for string.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for memory.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for strings.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for inttypes.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for stdint.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2762: checking for unistd.h
-configure:2779: gcc -c -g -O2  conftest.c >&5
-configure:2782: $? = 0
-configure:2785: test -s conftest.o
-configure:2788: $? = 0
-configure:2799: result: yes
-configure:2834: checking fcntl.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking fcntl.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for fcntl.h
-configure:2949: result: yes
-configure:2834: checking limits.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking limits.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for limits.h
-configure:2949: result: yes
-configure:2834: checking sys/ioctl.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking sys/ioctl.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for sys/ioctl.h
-configure:2949: result: yes
-configure:2834: checking sys/time.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking sys/time.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for sys/time.h
-configure:2949: result: yes
-configure:2834: checking syslog.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking syslog.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for syslog.h
-configure:2949: result: yes
-configure:2825: checking for unistd.h
-configure:2830: result: yes
-configure:2834: checking sys/cdefs.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking sys/cdefs.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for sys/cdefs.h
-configure:2949: result: yes
-configure:2834: checking sys/filio.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking sys/filio.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for sys/filio.h
-configure:2949: result: yes
-configure:2834: checking sys/sockio.h usability
-configure:2847: gcc -c -g -O2  conftest.c >&5
-configure:2850: $? = 0
-configure:2853: test -s conftest.o
-configure:2856: $? = 0
-configure:2866: result: yes
-configure:2870: checking sys/sockio.h presence
-configure:2881: gcc -E  conftest.c
-configure:2887: $? = 0
-configure:2906: result: yes
-configure:2942: checking for sys/sockio.h
-configure:2949: result: yes
-configure:2825: checking for stdint.h
-configure:2830: result: yes
-configure:2965: checking for gethostbyname in -lnsl
-configure:2996: gcc -o conftest -g -O2   conftest.c -lnsl   >&5
-ld: library not found for -lnsl
-collect2: ld returned 1 exit status
-configure:2999: $? = 1
-configure: failed program was:
-| #line 2972 "configure"
-| /* confdefs.h.  */
-| 
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_TIME_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_SYS_CDEFS_H 1
-| #define HAVE_SYS_FILIO_H 1
-| #define HAVE_SYS_SOCKIO_H 1
-| #define HAVE_STDINT_H 1
-| /* end confdefs.h.  */
-| 
-| /* 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 gethostbyname ();
-| int
-| main ()
-| {
-| gethostbyname ();
-|   ;
-|   return 0;
-| }
-configure:3017: result: no
-configure:3029: checking for bind in -lsocket
-configure:3060: gcc -o conftest -g -O2   conftest.c -lsocket   >&5
-ld: library not found for -lsocket
-collect2: ld returned 1 exit status
-configure:3063: $? = 1
-configure: failed program was:
-| #line 3036 "configure"
-| /* confdefs.h.  */
-| 
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_TIME_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_SYS_CDEFS_H 1
-| #define HAVE_SYS_FILIO_H 1
-| #define HAVE_SYS_SOCKIO_H 1
-| #define HAVE_STDINT_H 1
-| /* end confdefs.h.  */
-| 
-| /* 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 bind ();
-| int
-| main ()
-| {
-| bind ();
-|   ;
-|   return 0;
-| }
-configure:3081: result: no
-configure:3093: checking whether SHUT_RD is defined by sys/socket.h
-configure:3113: gcc -c -g -O2  conftest.c >&5
-configure:3116: $? = 0
-configure:3119: test -s conftest.o
-configure:3122: $? = 0
-configure:3124: result: yes
-configure:3147: checking whether struct sockaddr has sa_len
-configure:3170: gcc -c -g -O2  conftest.c >&5
-configure:3173: $? = 0
-configure:3176: test -s conftest.o
-configure:3179: $? = 0
-configure:3185: result: yes
-configure:3196: checking whether struct sockaddr_in6 has sin6_scope_id
-configure:3217: gcc -c -g -O2  conftest.c >&5
-configure:3220: $? = 0
-configure:3223: test -s conftest.o
-configure:3226: $? = 0
-configure:3228: result: yes
-configure:3242: checking for an ANSI C-conforming const
-configure:3310: gcc -c -g -O2  conftest.c >&5
-configure:3313: $? = 0
-configure:3316: test -s conftest.o
-configure:3319: $? = 0
-configure:3330: result: yes
-configure:3340: checking for uid_t in sys/types.h
-configure:3364: result: yes
-configure:3379: checking for pid_t
-configure:3404: gcc -c -g -O2  conftest.c >&5
-configure:3407: $? = 0
-configure:3410: test -s conftest.o
-configure:3413: $? = 0
-configure:3424: result: yes
-configure:3436: checking for size_t
-configure:3461: gcc -c -g -O2  conftest.c >&5
-configure:3464: $? = 0
-configure:3467: test -s conftest.o
-configure:3470: $? = 0
-configure:3481: result: yes
-configure:3493: checking whether time.h and sys/time.h may both be included
-configure:3519: gcc -c -g -O2  conftest.c >&5
-configure:3522: $? = 0
-configure:3525: test -s conftest.o
-configure:3528: $? = 0
-configure:3539: result: yes
-configure:3551: checking whether gcc needs -traditional
-configure:3608:20: error: termio.h: No such file or directory
-configure:3595: result: no
-configure:3602: checking for working memcmp
-configure:3651: gcc -o conftest -g -O2   conftest.c  >&5
-configure: In function 'main':
-configure:3649: warning: incompatible implicit declaration of built-in function 'exit'
-configure:3662: warning: incompatible implicit declaration of built-in function 'strcpy'
-configure:3654: $? = 0
-configure:3656: ./conftest
-configure:3659: $? = 0
-configure:3673: result: yes
-configure:3677: checking return type of signal handlers
-configure:3709: gcc -c -g -O2  conftest.c >&5
-configure:3712: $? = 0
-configure:3715: test -s conftest.o
-configure:3718: $? = 0
-configure:3729: result: void
-configure:3744: checking for strlcpy
-configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
-configure:3797: $? = 0
-configure:3800: test -s conftest
-configure:3803: $? = 0
-configure:3814: result: yes
-configure:3744: checking for strlcat
-configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
-configure:3797: $? = 0
-configure:3800: test -s conftest
-configure:3803: $? = 0
-configure:3814: result: yes
-configure:3744: checking for daemon
-configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
-configure:3797: $? = 0
-configure:3800: test -s conftest
-configure:3803: $? = 0
-configure:3814: result: yes
-configure:3744: checking for inet_aton
-configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
-configure:3797: $? = 0
-configure:3800: test -s conftest
-configure:3803: $? = 0
-configure:3814: result: yes
-configure:3921: creating ./config.status
-
-## ---------------------- ##
-## Running config.status. ##
-## ---------------------- ##
-
-This file was extended by config.status, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
-
-  CONFIG_FILES    = 
-  CONFIG_HEADERS  = 
-  CONFIG_LINKS    = 
-  CONFIG_COMMANDS = 
-  $ ./config.status 
-
-on drifter.fritz.box
-
-config.status:613: creating Makefile
-config.status:716: creating config.h
-config.status:853: config.h is unchanged
-
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-
-ac_cv_c_compiler_gnu=yes
-ac_cv_c_const=yes
-ac_cv_env_CC_set=
-ac_cv_env_CC_value=
-ac_cv_env_CFLAGS_set=
-ac_cv_env_CFLAGS_value=
-ac_cv_env_CPPFLAGS_set=
-ac_cv_env_CPPFLAGS_value=
-ac_cv_env_CPP_set=
-ac_cv_env_CPP_value=
-ac_cv_env_LDFLAGS_set=
-ac_cv_env_LDFLAGS_value=
-ac_cv_env_build_alias_set=
-ac_cv_env_build_alias_value=
-ac_cv_env_host_alias_set=
-ac_cv_env_host_alias_value=
-ac_cv_env_target_alias_set=
-ac_cv_env_target_alias_value=
-ac_cv_exeext=
-ac_cv_func_daemon=yes
-ac_cv_func_inet_aton=yes
-ac_cv_func_memcmp_working=yes
-ac_cv_func_strlcat=yes
-ac_cv_func_strlcpy=yes
-ac_cv_header_fcntl_h=yes
-ac_cv_header_inttypes_h=yes
-ac_cv_header_limits_h=yes
-ac_cv_header_memory_h=yes
-ac_cv_header_stdc=yes
-ac_cv_header_stdint_h=yes
-ac_cv_header_stdlib_h=yes
-ac_cv_header_string_h=yes
-ac_cv_header_strings_h=yes
-ac_cv_header_sys_cdefs_h=yes
-ac_cv_header_sys_filio_h=yes
-ac_cv_header_sys_ioctl_h=yes
-ac_cv_header_sys_sockio_h=yes
-ac_cv_header_sys_stat_h=yes
-ac_cv_header_sys_time_h=yes
-ac_cv_header_sys_types_h=yes
-ac_cv_header_syslog_h=yes
-ac_cv_header_time=yes
-ac_cv_header_unistd_h=yes
-ac_cv_lib_nsl_gethostbyname=no
-ac_cv_lib_socket_bind=no
-ac_cv_objext=o
-ac_cv_prog_CPP='gcc -E'
-ac_cv_prog_ac_ct_CC=gcc
-ac_cv_prog_cc_g=yes
-ac_cv_prog_cc_stdc=
-ac_cv_prog_egrep='grep -E'
-ac_cv_prog_gcc_traditional=no
-ac_cv_type_pid_t=yes
-ac_cv_type_signal=void
-ac_cv_type_size_t=yes
-ac_cv_type_uid_t=yes
-
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-
-CC='gcc'
-CFLAGS='-g -O2'
-CPP='gcc -E'
-CPPFLAGS=''
-DBMALLOC='#'
-DBTCP='#'
-DEFS='-DHAVE_CONFIG_H'
-DOSWILL='#'
-ECHO_C='ECHO_N=''
-ECHO_T=''
-EGREP='grep -E'
-EXEEXT=''
-EXTINCLUDE=''
-LDFLAGS=''
-LIBOBJS=''
-LIBS=''
-LTLIBOBJS=''
-OBJEXT='o'
-OPTFLAGS='-DDarwin -DSCOPED_REWRITE -DUSE_INET4 -DUSE_INET6 '
-PACKAGE_BUGREPORT=''
-PACKAGE_NAME=''
-PACKAGE_STRING=''
-PACKAGE_TARNAME=''
-PACKAGE_VERSION=''
-PATH_SEPARATOR=':'
-SHELL='/bin/sh'
-SWILLCONF='--enable-ip6'
-ac_ct_CC='gcc'
-bindir='${exec_prefix}/bin'
-build_alias=''
-datadir='${prefix}/share'
-exec_prefix='${prefix}'
-host_alias=''
-includedir='${prefix}/include'
-infodir='${prefix}/info'
-libdir='${exec_prefix}/lib'
-libexecdir='${exec_prefix}/libexec'
-localstatedir='${prefix}/var'
-mandir='${prefix}/man'
-oldincludedir='/usr/include'
-prefix='/usr/local'
-program_transform_name='s,x,x,'
-sbindir='${exec_prefix}/sbin'
-sharedstatedir='${prefix}/com'
-sysconfdir='${prefix}/etc'
-target_alias=''
-
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-
-#define HAVE_DAEMON 1
-#define HAVE_FCNTL_H 1
-#define HAVE_INET_ATON 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_LIMITS_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_SA_LEN_FIELD 1
-#define HAVE_SIN6_SCOPE_ID 1
-#define HAVE_STDINT_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRLCPY 1
-#define HAVE_SYSLOG_H 1
-#define HAVE_SYS_CDEFS_H 1
-#define HAVE_SYS_FILIO_H 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_SYS_SOCKIO_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_UNISTD_H 1
-#define PACKAGE_BUGREPORT ""
-#define PACKAGE_NAME ""
-#define PACKAGE_STRING ""
-#define PACKAGE_TARNAME ""
-#define PACKAGE_VERSION ""
-#define RETSIGTYPE void
-#define STDC_HEADERS 1
-#define TIME_WITH_SYS_TIME 1
-
-configure: exit 0
diff --git a/ne_mesg.c b/ne_mesg.c
index 66e52aa..a2389fe 100644
--- a/ne_mesg.c
+++ b/ne_mesg.c
@@ -3,10 +3,11 @@
  * Copyright (C) 1999,2000,2001,2002 University of Tromso. All rights reserved.
  * Copyright (C) 2002 Invenia Innovation AS. All rights reserved.
  *
  * Author: Feike W. Dillema, feico@dillema.net.
  *         based on newbie code by Yusuke DOI, Keio Univ. Murai Lab.
+ * Modified by: Gabor Lencse, see details below
  ****************************************************************************/
 
 /*
  * <$Id: ne_mesg.c,v 3.50 2008/01/22 14:05:09 feico Exp $>
  */
@@ -16,35 +17,78 @@
 static int write_dname (u_char *, u_char *, uint16_t *, int, u_char *, u_char *);
 static int dname_copy (u_char *, u_char *, int);
 static u_char *dname_redirect (u_char *, u_char *);
 static u_char *mesg_read_sec (G_List *, u_char *, int, u_char *, int);
 
-uint16_t mesg_id (void) {
-	static uint16_t id = 0;
-
-	if (!id) {
-		srandom (time (NULL));
-		id = random ();
-	}
-	id++;
+/* Modifications made by Gabor Lencse, lencse@sze.hu for adding random Transaction IDs */
+/* For more details, see our paper (currently under review): */
+/* G. Lencse and S. Repas, "Improving the Performance and Security of the TOTD DNS64 Implementation" */
+/* http://www.hit.bme.hu/~lencse/publications/Improving-TOTD-for-review.pdf */ 
+
+#define ARRAY_SIZE 0x8000	/* Size of the static array storing permutations */
+#define NUM_USE 0x4000		/* Number of elements used up from the array of permutations */
+#define LOW_START 0x0000	/* Starting value of the lower range */
+#define HIGH_START 0x8000	/* Starting value of the higher range */
+
+static uint16_t permutation[ARRAY_SIZE]; /* The static array for storing random permutations */
+
+/* Prepare a random permutation of the integers [start, start + ARRAY_SIZE - 1] into the static array */
+/* Algorithm: http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_.22inside-out.22_algorithm */
+void make_random_permutation(int start) {
+        int i, j;
+
+        permutation[0] = start;	
+        for (i = 1; i < ARRAY_SIZE; i++) {
+                j = random() * (double)(i + 1) / RAND_MAX; /* random number from the range [0, i] */
+                if (j != i) { 
+                  permutation[i] = permutation[j];
+                }
+                permutation[j] = start + i;
+        }
+}
 
-	if (T.debug > 4)
-		syslog (LOG_DEBUG, "mesg_id() = %d", id);
-	return id;
+/* Provide hard to predict unique random DNS Transaction IDs */
+/* by using random permutations and alternating ranges */
+uint16_t mesg_id (void) {
+        static int range = 0; /* indicates that no permutation has been generated yet */
+        static int index;
+
+        if (!range) {
+                srandom(time(0)); 	/* initialize random number generator seed */
+                range = 1;		/* choose the lower range first */
+                make_random_permutation(LOW_START);
+                index = 0;		/* start from the first element */
+        }
+        if ( index == NUM_USE ) {	/* if the pool is exhasuted */
+                if (range == 1) {
+                        range = 2;	/* choose the higher range */
+                        make_random_permutation(HIGH_START);
+                }
+                else {
+                        range = 1;	/* choose the lower range */
+                        make_random_permutation(LOW_START);
+                }
+                index = 0;
+        }
+	if (T.debug > 4) { 
+		syslog (LOG_DEBUG, "mesg_id() = %d", permutation[index]);
+        }
+        return permutation[index++];
 }
+/* End of modifications by Gabor Lencse */
 
 int mesg_make_query (u_char *qname, uint16_t qtype, uint16_t qclass,
 		     uint32_t id, int rd, u_char *buf, int buflen) {
 	char *fn = "mesg_make_query()";
 	u_char *ucp;
 	int i, written_len;
 	Mesg_Hdr *hdr;
 
-	if (T.debug > 4)
+	if (T.debug > 4) { 
 		syslog (LOG_DEBUG, "%s: (qtype: %s, id: %d): start", fn,
 			string_rtype (qtype), id);
-
+        }
 	hdr = (Mesg_Hdr *) buf;
 
 	/* write header */
 	hdr->id = id;
 	hdr->opcode = OP_QUERY;
diff --git a/read_config.c b/read_config.c
index 2430230..8fcd57e 100644
--- a/read_config.c
+++ b/read_config.c
@@ -123,11 +123,12 @@ int read_config (char *config_file) {
 			if (argcnt < 2) {
 				syslog (LOG_ERR, "line %d: invalid format: interfaces <ifa> <ifb> ...", linenum);
 				errcnt++;
 			}
 
-			for (i = 0; T.iflist[i] && i < MAXINTERFACES; i++);
+			for (i = 0; T.iflist[i] && i < MAXINTERFACES; i++) { 
+                        };
 
 		 	if (i + argcnt-1 > MAXINTERFACES) {
 				syslog (LOG_ERR, "line %d: to many interfaces, more than %d", linenum, MAXINTERFACES);
 				errcnt++;
 			} else {

Vulnerable code: This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.57.  Invocation command line was

  $ ./configure 

## --------- ##
## Platform. ##
## --------- ##

hostname = drifter.fritz.box
uname -m = x86_64
uname -r = 12.4.0
uname -s = Darwin
uname -v = Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
hostinfo               = Mach kernel version:
	 Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3
Primary memory available: 16.00 gigabytes
Default processor set: 145 tasks, 695 threads, 4 processors
Load average: 0.65, Mach factor: 3.35
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /Developer/usr/bin
PATH: /usr/local/MacGPG2/bin
PATH: /usr/X11/bin
PATH: /opt/local/bin
PATH: /usr/local/git/bin
PATH: /Volumes/Work/Repositories/play-2.1.1
PATH: /usr/local/scala/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1300: checking "IPv6 transport support"
configure:1319: result: "enabled"
configure:1324: checking "IPv4 transport support"
configure:1341: result: "enabled"
configure:1346: checking "6to4 reverse lookup support"
configure:1362: result: "disabled"
configure:1367: checking "scoped address rewriting support"
configure:1384: result: "enabled"
configure:1389: checking "http reconfiguration and management support"
configure:1407: result: "disabled"
configure:1458: checking for gcc
configure:1474: found /usr/bin/gcc
configure:1484: result: gcc
configure:1728: checking for C compiler version
configure:1731: gcc --version </dev/null >&5
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:1734: $? = 0
configure:1736: gcc -v </dev/null >&5
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
configure:1739: $? = 0
configure:1741: gcc -V </dev/null >&5
llvm-gcc-4.2: argument to `-V' is missing
configure:1744: $? = 1
configure:1768: checking for C compiler default output
configure:1771: gcc    conftest.c  >&5
configure:1774: $? = 0
configure:1820: result: a.out
configure:1825: checking whether the C compiler works
configure:1831: ./a.out
configure:1834: $? = 0
configure:1851: result: yes
configure:1858: checking whether we are cross compiling
configure:1860: result: no
configure:1863: checking for suffix of executables
configure:1865: gcc -o conftest    conftest.c  >&5
configure:1868: $? = 0
configure:1893: result: 
configure:1899: checking for suffix of object files
configure:1921: gcc -c   conftest.c >&5
configure:1924: $? = 0
configure:1946: result: o
configure:1950: checking whether we are using the GNU C compiler
configure:1975: gcc -c   conftest.c >&5
configure:1978: $? = 0
configure:1981: test -s conftest.o
configure:1984: $? = 0
configure:1997: result: yes
configure:2003: checking whether gcc accepts -g
configure:2025: gcc -c -g  conftest.c >&5
configure:2028: $? = 0
configure:2031: test -s conftest.o
configure:2034: $? = 0
configure:2045: result: yes
configure:2062: checking for gcc option to accept ANSI C
configure:2123: gcc  -c -g -O2  conftest.c >&5
configure:2126: $? = 0
configure:2129: test -s conftest.o
configure:2132: $? = 0
configure:2150: result: none needed
configure:2168: gcc -c -g -O2  conftest.c >&5
conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me'
configure:2171: $? = 1
configure: failed program was:
| #ifndef __cplusplus
|   choke me
| #endif
configure:2285: checking how to run the C preprocessor
configure:2321: gcc -E  conftest.c
configure:2327: $? = 0
configure:2359: gcc -E  conftest.c
configure:2358:28: error: ac_nonexistent.h: No such file or directory
configure:2365: $? = 1
configure: failed program was:
| #line 2350 "configure"
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
configure:2403: result: gcc -E
configure:2428: gcc -E  conftest.c
configure:2434: $? = 0
configure:2466: gcc -E  conftest.c
configure:2465:28: error: ac_nonexistent.h: No such file or directory
configure:2472: $? = 1
configure: failed program was:
| #line 2457 "configure"
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
configure:2515: checking operating system specific definitions...
configure:2561: result: Darwin
configure:2573: checking for egrep
configure:2583: result: grep -E
configure:2588: checking for ANSI C header files
configure:2614: gcc -c -g -O2  conftest.c >&5
configure:2617: $? = 0
configure:2620: test -s conftest.o
configure:2623: $? = 0
configure:2715: gcc -o conftest -g -O2   conftest.c  >&5
configure: In function 'main':
configure:2708: warning: incompatible implicit declaration of built-in function 'exit'
configure:2718: $? = 0
configure:2720: ./conftest
configure:2723: $? = 0
configure:2738: result: yes
configure:2762: checking for sys/types.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for sys/stat.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for stdlib.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for string.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for memory.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for strings.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for inttypes.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for stdint.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2762: checking for unistd.h
configure:2779: gcc -c -g -O2  conftest.c >&5
configure:2782: $? = 0
configure:2785: test -s conftest.o
configure:2788: $? = 0
configure:2799: result: yes
configure:2834: checking fcntl.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking fcntl.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for fcntl.h
configure:2949: result: yes
configure:2834: checking limits.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking limits.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for limits.h
configure:2949: result: yes
configure:2834: checking sys/ioctl.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking sys/ioctl.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for sys/ioctl.h
configure:2949: result: yes
configure:2834: checking sys/time.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking sys/time.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for sys/time.h
configure:2949: result: yes
configure:2834: checking syslog.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking syslog.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for syslog.h
configure:2949: result: yes
configure:2825: checking for unistd.h
configure:2830: result: yes
configure:2834: checking sys/cdefs.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking sys/cdefs.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for sys/cdefs.h
configure:2949: result: yes
configure:2834: checking sys/filio.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking sys/filio.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for sys/filio.h
configure:2949: result: yes
configure:2834: checking sys/sockio.h usability
configure:2847: gcc -c -g -O2  conftest.c >&5
configure:2850: $? = 0
configure:2853: test -s conftest.o
configure:2856: $? = 0
configure:2866: result: yes
configure:2870: checking sys/sockio.h presence
configure:2881: gcc -E  conftest.c
configure:2887: $? = 0
configure:2906: result: yes
configure:2942: checking for sys/sockio.h
configure:2949: result: yes
configure:2825: checking for stdint.h
configure:2830: result: yes
configure:2965: checking for gethostbyname in -lnsl
configure:2996: gcc -o conftest -g -O2   conftest.c -lnsl   >&5
ld: library not found for -lnsl
collect2: ld returned 1 exit status
configure:2999: $? = 1
configure: failed program was:
| #line 2972 "configure"
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_CDEFS_H 1
| #define HAVE_SYS_FILIO_H 1
| #define HAVE_SYS_SOCKIO_H 1
| #define HAVE_STDINT_H 1
| /* end confdefs.h.  */
| 
| /* 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 gethostbyname ();
| int
| main ()
| {
| gethostbyname ();
|   ;
|   return 0;
| }
configure:3017: result: no
configure:3029: checking for bind in -lsocket
configure:3060: gcc -o conftest -g -O2   conftest.c -lsocket   >&5
ld: library not found for -lsocket
collect2: ld returned 1 exit status
configure:3063: $? = 1
configure: failed program was:
| #line 3036 "configure"
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYSLOG_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_CDEFS_H 1
| #define HAVE_SYS_FILIO_H 1
| #define HAVE_SYS_SOCKIO_H 1
| #define HAVE_STDINT_H 1
| /* end confdefs.h.  */
| 
| /* 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 bind ();
| int
| main ()
| {
| bind ();
|   ;
|   return 0;
| }
configure:3081: result: no
configure:3093: checking whether SHUT_RD is defined by sys/socket.h
configure:3113: gcc -c -g -O2  conftest.c >&5
configure:3116: $? = 0
configure:3119: test -s conftest.o
configure:3122: $? = 0
configure:3124: result: yes
configure:3147: checking whether struct sockaddr has sa_len
configure:3170: gcc -c -g -O2  conftest.c >&5
configure:3173: $? = 0
configure:3176: test -s conftest.o
configure:3179: $? = 0
configure:3185: result: yes
configure:3196: checking whether struct sockaddr_in6 has sin6_scope_id
configure:3217: gcc -c -g -O2  conftest.c >&5
configure:3220: $? = 0
configure:3223: test -s conftest.o
configure:3226: $? = 0
configure:3228: result: yes
configure:3242: checking for an ANSI C-conforming const
configure:3310: gcc -c -g -O2  conftest.c >&5
configure:3313: $? = 0
configure:3316: test -s conftest.o
configure:3319: $? = 0
configure:3330: result: yes
configure:3340: checking for uid_t in sys/types.h
configure:3364: result: yes
configure:3379: checking for pid_t
configure:3404: gcc -c -g -O2  conftest.c >&5
configure:3407: $? = 0
configure:3410: test -s conftest.o
configure:3413: $? = 0
configure:3424: result: yes
configure:3436: checking for size_t
configure:3461: gcc -c -g -O2  conftest.c >&5
configure:3464: $? = 0
configure:3467: test -s conftest.o
configure:3470: $? = 0
configure:3481: result: yes
configure:3493: checking whether time.h and sys/time.h may both be included
configure:3519: gcc -c -g -O2  conftest.c >&5
configure:3522: $? = 0
configure:3525: test -s conftest.o
configure:3528: $? = 0
configure:3539: result: yes
configure:3551: checking whether gcc needs -traditional
configure:3608:20: error: termio.h: No such file or directory
configure:3595: result: no
configure:3602: checking for working memcmp
configure:3651: gcc -o conftest -g -O2   conftest.c  >&5
configure: In function 'main':
configure:3649: warning: incompatible implicit declaration of built-in function 'exit'
configure:3662: warning: incompatible implicit declaration of built-in function 'strcpy'
configure:3654: $? = 0
configure:3656: ./conftest
configure:3659: $? = 0
configure:3673: result: yes
configure:3677: checking return type of signal handlers
configure:3709: gcc -c -g -O2  conftest.c >&5
configure:3712: $? = 0
configure:3715: test -s conftest.o
configure:3718: $? = 0
configure:3729: result: void
configure:3744: checking for strlcpy
configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
configure:3797: $? = 0
configure:3800: test -s conftest
configure:3803: $? = 0
configure:3814: result: yes
configure:3744: checking for strlcat
configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
configure:3797: $? = 0
configure:3800: test -s conftest
configure:3803: $? = 0
configure:3814: result: yes
configure:3744: checking for daemon
configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
configure:3797: $? = 0
configure:3800: test -s conftest
configure:3803: $? = 0
configure:3814: result: yes
configure:3744: checking for inet_aton
configure:3794: gcc -o conftest -g -O2   conftest.c  >&5
configure:3797: $? = 0
configure:3800: test -s conftest
configure:3803: $? = 0
configure:3814: result: yes
configure:3921: creating ./config.status

## ---------------------- ##
## Running config.status. ##
## ---------------------- ##

This file was extended by config.status, which was
generated by GNU Autoconf 2.57.  Invocation command line was

  CONFIG_FILES    = 
  CONFIG_HEADERS  = 
  CONFIG_LINKS    = 
  CONFIG_COMMANDS = 
  $ ./config.status 

on drifter.fritz.box

config.status:613: creating Makefile
config.status:716: creating config.h
config.status:853: config.h is unchanged

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_c_compiler_gnu=yes
ac_cv_c_const=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=
ac_cv_func_daemon=yes
ac_cv_func_inet_aton=yes
ac_cv_func_memcmp_working=yes
ac_cv_func_strlcat=yes
ac_cv_func_strlcpy=yes
ac_cv_header_fcntl_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_limits_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_stdc=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_cdefs_h=yes
ac_cv_header_sys_filio_h=yes
ac_cv_header_sys_ioctl_h=yes
ac_cv_header_sys_sockio_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_time_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_syslog_h=yes
ac_cv_header_time=yes
ac_cv_header_unistd_h=yes
ac_cv_lib_nsl_gethostbyname=no
ac_cv_lib_socket_bind=no
ac_cv_objext=o
ac_cv_prog_CPP='gcc -E'
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_egrep='grep -E'
ac_cv_prog_gcc_traditional=no
ac_cv_type_pid_t=yes
ac_cv_type_signal=void
ac_cv_type_size_t=yes
ac_cv_type_uid_t=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

CC='gcc'
CFLAGS='-g -O2'
CPP='gcc -E'
CPPFLAGS=''
DBMALLOC='#'
DBTCP='#'
DEFS='-DHAVE_CONFIG_H'
DOSWILL='#'
ECHO_C='ECHO_N=''
ECHO_T=''
EGREP='grep -E'
EXEEXT=''
EXTINCLUDE=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
OBJEXT='o'
OPTFLAGS='-DDarwin -DSCOPED_REWRITE -DUSE_INET4 -DUSE_INET6 '
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
SHELL='/bin/sh'
SWILLCONF='--enable-ip6'
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${prefix}/share'
exec_prefix='${prefix}'
host_alias=''
includedir='${prefix}/include'
infodir='${prefix}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='/usr/local'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define HAVE_DAEMON 1
#define HAVE_FCNTL_H 1
#define HAVE_INET_ATON 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SA_LEN_FIELD 1
#define HAVE_SIN6_SCOPE_ID 1
#define HAVE_STDINT_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRLCAT 1
#define HAVE_STRLCPY 1
#define HAVE_SYSLOG_H 1
#define HAVE_SYS_CDEFS_H 1
#define HAVE_SYS_FILIO_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_SOCKIO_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define HAVE_UNISTD_H 1
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define RETSIGTYPE void
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1

configure: exit 0
uint16_t mesg_id (void) {
	static uint16_t id = 0;

	if (!id) {
		srandom (time (NULL));
		id = random ();
	}
	id++;
	if (T.debug > 4)
		syslog (LOG_DEBUG, "mesg_id() = %d", id);
	return id;
	if (T.debug > 4)

			for (i = 0; T.iflist[i] && i < MAXINTERFACES; i++);
Fixed code:  * Modified by: Gabor Lencse, see details below
/* Modifications made by Gabor Lencse, lencse@sze.hu for adding random Transaction IDs */
/* For more details, see our paper (currently under review): */
/* G. Lencse and S. Repas, "Improving the Performance and Security of the TOTD DNS64 Implementation" */
/* http://www.hit.bme.hu/~lencse/publications/Improving-TOTD-for-review.pdf */ 

#define ARRAY_SIZE 0x8000	/* Size of the static array storing permutations */
#define NUM_USE 0x4000		/* Number of elements used up from the array of permutations */
#define LOW_START 0x0000	/* Starting value of the lower range */
#define HIGH_START 0x8000	/* Starting value of the higher range */

static uint16_t permutation[ARRAY_SIZE]; /* The static array for storing random permutations */

/* Prepare a random permutation of the integers [start, start + ARRAY_SIZE - 1] into the static array */
/* Algorithm: http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_.22inside-out.22_algorithm */
void make_random_permutation(int start) {
        int i, j;

        permutation[0] = start;	
        for (i = 1; i < ARRAY_SIZE; i++) {
                j = random() * (double)(i + 1) / RAND_MAX; /* random number from the range [0, i] */
                if (j != i) { 
                  permutation[i] = permutation[j];
                }
                permutation[j] = start + i;
        }
}
/* Provide hard to predict unique random DNS Transaction IDs */
/* by using random permutations and alternating ranges */
uint16_t mesg_id (void) {
        static int range = 0; /* indicates that no permutation has been generated yet */
        static int index;

        if (!range) {
                srandom(time(0)); 	/* initialize random number generator seed */
                range = 1;		/* choose the lower range first */
                make_random_permutation(LOW_START);
                index = 0;		/* start from the first element */
        }
        if ( index == NUM_USE ) {	/* if the pool is exhasuted */
                if (range == 1) {
                        range = 2;	/* choose the higher range */
                        make_random_permutation(HIGH_START);
                }
                else {
                        range = 1;	/* choose the lower range */
                        make_random_permutation(LOW_START);
                }
                index = 0;
        }
	if (T.debug > 4) { 
		syslog (LOG_DEBUG, "mesg_id() = %d", permutation[index]);
        }
        return permutation[index++];
/* End of modifications by Gabor Lencse */
	if (T.debug > 4) { 
        }
			for (i = 0; T.iflist[i] && i < MAXINTERFACES; i++) { 
                        };