This commit is contained in:
Barak A. Pearlmutter 2016-12-28 23:08:26 +00:00 committed by GitHub
commit be25d71f26
35 changed files with 474 additions and 247 deletions

26
.gitignore vendored
View File

@ -1,5 +1,27 @@
/bin/
*.o
.deps/
.dirstamp
/aclocal.m4
/autom4te.cache/
/autotools/
/compile
/config.h
/config.h.in
/config.log
/config.status
/configure
/depcomp
/install-sh
/iodine
/iodined
/missing
/src/base64u.c
/src/base64u.h
/tests/test
/stamp-h1
/test-driver
/test-iodine
/test-iodine.log
/test-iodine.trs
/test-suite.log
Makefile
Makefile.in

View File

@ -5,7 +5,6 @@ language: objective-c
os: osx
before_install: brew update
install: brew install check
script: make && make test
install: brew install check autoconf-archive
script: autoreconf --install && ./configure && make && make test

109
Makefile
View File

@ -1,109 +0,0 @@
prefix?=/usr/local
sbindir=$(prefix)/sbin
datadir=$(prefix)/share
mandir=$(datadir)/man
DESTDIR=
INSTALL=install
INSTALL_FLAGS=
MKDIR=mkdir
MKDIR_FLAGS=-p
RM=rm
RM_FLAGS=-f
TARGETOS = `uname`
all:
@(cd src; $(MAKE) TARGETOS=$(TARGETOS) all)
install: all
$(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(sbindir)
$(INSTALL) $(INSTALL_FLAGS) bin/iodine $(DESTDIR)$(sbindir)/iodine
chmod 755 $(DESTDIR)$(sbindir)/iodine
$(INSTALL) $(INSTALL_FLAGS) bin/iodined $(DESTDIR)$(sbindir)/iodined
chmod 755 $(DESTDIR)$(sbindir)/iodined
$(MKDIR) $(MKDIR_FLAGS) $(DESTDIR)$(mandir)/man8
$(INSTALL) $(INSTALL_FLAGS) man/iodine.8 $(DESTDIR)$(mandir)/man8/iodine.8
chmod 644 $(DESTDIR)$(mandir)/man8/iodine.8
uninstall:
$(RM) $(RM_FLAGS) $(DESTDIR)$(sbindir)/iodine
$(RM) $(RM_FLAGS) $(DESTDIR)$(sbindir)/iodined
$(RM) $(RM_FLAGS) $(DESTDIR)$(mandir)/man8/iodine.8
test: all
@echo "!! The check library is required for compiling and running the tests"
@echo "!! Get it at http://check.sf.net"
@(cd tests; $(MAKE) TARGETOS=$(TARGETOS) all)
clean:
@echo "Cleaning..."
@(cd src; $(MAKE) clean)
@(cd tests; $(MAKE) clean)
@rm -rf bin iodine-latest*
#Helper target for windows/android zipfiles
iodine-latest:
@rm -rf iodine-latest*
@mkdir -p iodine-latest
@echo "Create date: " > iodine-latest/VERSION.txt
@LANG=en_US date >> iodine-latest/VERSION.txt
@echo "Git version: " >> iodine-latest/VERSION.txt
@git rev-parse HEAD >> iodine-latest/VERSION.txt
@for i in README.md CHANGELOG TODO; do cp $$i iodine-latest/$$i.txt; done
@unix2dos iodine-latest/*
#non-PIE build for old android
cross-android-old:
@(cd src; $(MAKE) base64u.c base64u.h)
@(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_PLATFORM=android-3)
#Position-indepedent build for modern android
cross-android:
@(cd src; $(MAKE) base64u.c base64u.h)
@(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_PLATFORM=android-16)
iodine-latest-android.zip: iodine-latest
@mv iodine-latest iodine-latest-android
@mkdir -p iodine-latest-android/pre-kitkat/armeabi
@mkdir -p iodine-latest-android/pre-kitkat/x86
@$(MAKE) cross-android-old TARGET_ARCH_ABI=armeabi
@cp src/libs/armeabi/* iodine-latest-android/pre-kitkat/armeabi
@$(MAKE) cross-android-old TARGET_ARCH_ABI=x86
@cp src/libs/x86/* iodine-latest-android/pre-kitkat/x86
@rm -rf src/libs src/obj
@mkdir -p iodine-latest-android/armeabi
@mkdir -p iodine-latest-android/arm64-v8a
@mkdir -p iodine-latest-android/x86
@$(MAKE) cross-android TARGET_ARCH_ABI=armeabi
@cp src/libs/armeabi/* iodine-latest-android/armeabi
@$(MAKE) cross-android TARGET_ARCH_ABI=arm64-v8a
@cp src/libs/arm64-v8a/* iodine-latest-android/arm64-v8a
@$(MAKE) cross-android TARGET_ARCH_ABI=x86
@cp src/libs/x86/* iodine-latest-android/x86
@cp README-android.txt iodine-latest-android
@zip -r iodine-latest-android.zip iodine-latest-android
cross-mingw32:
@(cd src; $(MAKE) TARGETOS=windows32 CC=i686-w64-mingw32-gcc all)
cross-mingw64:
@(cd src; $(MAKE) TARGETOS=windows32 CC=x86_64-w64-mingw32-gcc all)
iodine-latest-windows.zip: iodine-latest
@mv iodine-latest iodine-latest-windows
@mkdir -p iodine-latest-windows/64bit iodine-latest-windows/32bit
@(cd src; $(MAKE) TARGETOS=windows32 CC=i686-w64-mingw32-gcc clean all)
@i686-w64-mingw32-strip bin/iodine*
@for i in `ls bin`; do cp bin/$$i iodine-latest-windows/32bit/$$i.exe; done
@cp /usr/i686-w64-mingw32/bin/zlib1.dll iodine-latest-windows/32bit
@(cd src; $(MAKE) TARGETOS=windows32 CC=x86_64-w64-mingw32-gcc clean all)
@x86_64-w64-mingw32-strip bin/iodine*
@for i in `ls bin`; do cp bin/$$i iodine-latest-windows/64bit/$$i.exe; done
@cp /usr/x86_64-w64-mingw32/bin/zlib1.dll iodine-latest-windows/64bit
@cp README-win32.txt iodine-latest-windows
@zip -r iodine-latest-windows.zip iodine-latest-windows

151
Makefile.am Normal file
View File

@ -0,0 +1,151 @@
## Process this file with automake to produce Makefile.in
################################################################
## shared ##
################################################################
AM_CPPFLAGS = -D$(OS)
AM_CFLAGS = -pedantic
################################################################
## docs ##
################################################################
dist_man_MANS = man/iodine.8
dist_doc_DATA = CHANGELOG README.md README-android.txt README-win32.txt \
TODO doc/proto_00000402.txt doc/proto_00000500.txt \
doc/proto_00000502.txt
################################################################
## misc ##
################################################################
EXTRA_DIST = .travis.yml doc/iodine-server.service \
doc/iodine-server.socket doc/iodine.te src/Android.mk
################################################################
## src/ ##
################################################################
sbin_PROGRAMS = iodine iodined
COMMONSRC0 = src/base32.c src/base64.c src/common.c src/dns.c \
src/encoding.c src/login.c src/md5.c src/read.c
COMMONSRC = $(COMMONSRC0) src/base128.c src/tun.c src/base64u.c \
src/base64u.h src/android_dns.h src/base128.h src/base32.h \
src/base64.h src/common.h src/dns.h src/encoding.h src/login.h \
src/md5.h src/read.h src/tun.h src/version.h src/windows.h
iodine_SOURCES = $(COMMONSRC) src/iodine.c src/client.c src/util.c \
src/client.h src/util.h
iodined_SOURCES = $(COMMONSRC) src/iodined.c src/user.c \
src/fw_query.c src/fw_query.h src/user.h
EXTRA_DIST += src/android_dns.h src/base128.h src/base32.h \
src/base64.h src/client.h src/common.h src/dns.h src/encoding.h \
src/fw_query.h src/login.h src/md5.h src/read.h src/tun.h src/user.h \
src/util.h src/version.h src/windows.h
src/base64u.c: src/base64.c
@echo Making $@
@echo '/* No use in editing, produced by Makefile! */' > $@
sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < $< >> $@
src/base64u.h: src/base64.h
@echo Making $@
@echo '/* No use in editing, produced by Makefile! */' > $@
sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < $< >> $@
BUILT_SOURCES = src/base64u.c src/base64u.h
MOSTLYCLEANFILES = src/base64u.c src/base64u.h
clean-local:
@echo Clean Android Stuff
-rm -rf src/obj src/libs
################################################################
## tests/ ##
################################################################
if HAVE_CHECK
TESTS = test-iodine
noinst_PROGRAMS = test-iodine
test_iodine_SOURCES = tests/test.c tests/base32.c tests/base64.c \
tests/common.c tests/read.c tests/dns.c tests/encoding.c \
tests/login.c tests/user.c tests/fw_query.c $(COMMONSRC0) src/user.c \
src/fw_query.c
EXTRA_DIST += tests/test.h
test_iodine_LDADD = $(CHECK_LIBS)
test_iodine_CFLAGS = $(AM_CFLAGS) $(CHECK_CFLAGS)
test_iodine_CPPFLAGS = $(AM_CPPFLAGS) -I src
endif
################################################################
## Ancient History ##
################################################################
# retain compatibility with former target "test"
.PHONY: test
test: check
# Compile for Android.
# It is likely possible to tweak autotools into supporting this
# configuration, once that is tested the below should be removed.
.PHONY: cross-android
cross-android: src/base64u.c src/base64u.h
(cd src; ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk)
.PHONY: cross-android-dist
cross-android-dist:
rm -rf iodine-latest-android*
mkdir -p iodine-latest-android/armeabi iodine-latest-android/x86
$(MAKE) cross-android TARGET_ARCH_ABI=armeabi
cp src/libs/armeabi/* iodine-latest-android/armeabi
$(MAKE) cross-android TARGET_ARCH_ABI=x86
cp src/libs/x86/* iodine-latest-android/x86
cp README.md README-android.txt CH* TO* iodine-latest-android/
echo "Create date: " > iodine-latest-android/VERSION
date >> iodine-latest-android/VERSION
echo "Git version: " >> iodine-latest-android/VERSION
echo $(GITREVISION) >> iodine-latest-android/VERSION
zip -r iodine-latest-android.zip iodine-latest-android
# Compile for MS Windows.
# This platform is supported by autotools, so the below should be removed once
# autotools is tested in that configuration.
.PHONY: cross-mingw
cross-mingw:
echo "WARNING:"
echo "This make target is unlikely to work properly."
echo "Cross compilation is supported by autotools."
echo " ./configure --build=turingmachine-unknown-linux-gnu --host=mingw32"
$(MAKE) OS=WINDOWS32 CC=i686-mingw32-gcc all
.PHONY: cross-mingw-dist
cross-mingw-dist: cross-mingw
rm -rf iodine-latest-win32*
mkdir -p iodine-latest-win32/bin
for i in `ls bin`; do cp bin/$$i iodine-latest-win32/bin/$$i.exe; done
cp /usr/i686-mingw32/usr/bin/zlib1.dll iodine-latest-win32/bin/
cp README.md README-win32.txt CH* TO* iodine-latest-win32/
echo "Create date: " > iodine-latest-win32/VERSION
date >> iodine-latest-win32/VERSION
echo "Git version: " >> iodine-latest-win32/VERSION
echo $(GITREVISION) >> iodine-latest-win32/VERSION
zip -r iodine-latest-win32.zip iodine-latest-win32

View File

@ -10,14 +10,7 @@ firewalled, but DNS queries are allowed.
COMPILING
---------
Iodine has no configure script. There are two optional features for Linux
(SELinux and systemd support) that will be enabled automatically if the
relevant header files are found in `/usr/include`.
(See script at `./src/osflags`)
Run `make` to compile the server and client binaries.
Run `make install` to copy binaries and manpage to the destination directory.
Run `make test` to compile and run the unit tests. (Requires the `check` library)
Standard `autotools` build scripts, so a simple `autoreconf --install && ./configure && make`, followed by an optional `make check`, and a `make install`, should do it. All the usual build options for cross-compilation etc should be available, such as `./configure --help=short` to find package-specific configuration options.
QUICKSTART

191
configure.ac Normal file
View File

@ -0,0 +1,191 @@
# Process this file with autoconf to produce a configure script.
# Prologue
AC_PREREQ([2.69])
AC_INIT([iodine],[0.7.0],[erik@kryo.se],[],[http://dev.kryo.se/iodine/])
AC_CONFIG_SRCDIR([src/iodine.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([autotools])
AC_CONFIG_AUX_DIR([autotools])
AM_INIT_AUTOMAKE([subdir-objects foreign -Wall])
# Misc
# Define OS to upcased "uname --kernel-name", i.e., LINUX, DARWIN, etc.
# Used by Makefile.am as cpp symbol to define.
# We use autotools canonical designation to allow cross compilation.
# It would be reasonable to, at some point, update the C sources to
# use these more canonical designations.
# But for now, we must adjust some of them.
AC_MSG_CHECKING([environment to compile for])
AC_CANONICAL_HOST
# No need to adjust these: FREEBSD, NETBSD, OPENBSD, BEOS
AS_CASE([${host_os}],
[linux-gnu], [OS=LINUX],
[mingw32], [OS=WINDOWS32],
[macos], [OS=DARWIN],
[linux-android], [OS=ANDROID],
[OS="$(echo ${host_os}|tr "a-z" "A-Z")"])
uname_os="$(uname | tr "a-z" "A-Z")"
# Avoid, e.g., OS=DARWIN15.6.0
AS_CASE([${uname_os}],
[DARWIN], [OS=DARWIN])
AC_MSG_NOTICE([host_os: ${host_os}])
AC_MSG_NOTICE([uname_os: ${uname_os}])
AC_MSG_NOTICE([adjusted OS: ${OS}])
AC_SUBST([OS])
AS_CASE([${OS}],
[WINDOWS32],
AC_DEFINE([WINVER],[0x0501],
[Define appropriately on MS Windows 32]))
# The AC_SUBST for GITREVISION is used only in legacy stanza; remove
# when unused in Makefile.am, leaving only the config.h #define.
AC_SUBST([GITREVISION],[$(git describe --tags --always --dirty || echo not-in-git)])
AC_DEFINE_UNQUOTED([GITREVISION],["${GITREVISION}"],
[Precise git commit checked out when building])
# Checks for programs
AC_PROG_CC
AC_PROG_CC_STDC
AS_IF([test "x${ac_cv_prog_cc_stdc}" = xno],
[AC_MSG_WARN([Unable to engage Standard C (C99) option])],)
# This is to avoid
# error: invalid application of sizeof to incomplete type struct in6_pktinfo
# whose definition is guarded by _GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
AX_CFLAGS_WARN_ALL
AC_PROG_INSTALL
# Process options
AC_ARG_ENABLE([systemd],
[AS_HELP_STRING([--enable-systemd],
[enable systemd support @<:@default=check@:>@])],,
[enable_systemd=check])
AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux],
[enable selinux support @<:@default=check@:>@])],,
[enable_selinux=check])
# Checks for libraries
# Unclear why pthread is needed.
# Uncomment and replace ? by called procedure requiring -lpthread.
#AC_SEARCH_LIBS([?], [pthread])
AC_SEARCH_LIBS([uncompress], [z])
# Enable systemd per option by setting HAVE_SYSTEMD
AS_CASE([${enable_systemd}],
[yes|check],
[AC_MSG_CHECKING([systemd])
AC_SEARCH_LIBS([sd_listen_fds], [systemd-daemon])
AC_CHECK_FUNC([sd_listen_fds],
[AC_MSG_RESULT([enabled: systemd])
AC_DEFINE([HAVE_SYSTEMD],[1],
[Define to 1 to enable systemd support])],
AS_CASE([${enable_systemd}],
[yes],
AC_MSG_ERROR([systemd support not available]),
AC_MSG_RESULT([disabled: systemd])))],
[no],,
[AC_MSG_ERROR([invalid argument, --enable-systemd=${enable_systemd}])])
# Enable selinux per option by setting HAVE_SETCON
AS_CASE([${enable_selinux}],
[yes|check],
[AC_SEARCH_LIBS([setcon], [selinux])
AC_CHECK_FUNCS([setcon],
AC_MSG_RESULT([enabled: selinux]),
AS_CASE([${enable_selinux}],
[yes],
AC_MSG_ERROR([selinux support not available]),
[check],
AC_MSG_RESULT([disabled: selinux])))],
[no],
AC_MSG_RESULT([disabled: selinux]),
[AC_MSG_ERROR([invalid argument, --enable-selinux=${enable_selinux}])])
# The check library is used for the unit testing. Not bothering to
# implement an --enable-tests option, as they are only run by "make
# check" so there is no user-level difference. If the unit tests
# won't even *compile* there is probably a better solution than just
# turning them off, and build time is minimal.
PKG_CHECK_MODULES(CHECK,[check],
AC_MSG_RESULT([enabled: unit testing]),
AC_MSG_RESULT([disabled: unit testing]))
AM_CONDITIONAL([HAVE_CHECK],[test -z "${CHECK_PKG_ERRORS}"])
# For each commented AC_SEARCH_LIBS below, uncomment and replace ? by
# called procedure provided only by that library on the platform(s) in
# question.
# for SunOS / solaris:
#AC_SEARCH_LIBS([?], [nsl])
# for BeOS:
#AC_SEARCH_LIBS([?], [bind])
#AC_SEARCH_LIBS([?], [bsd])
# for SunOS / solaris / BeOS:
#AC_SEARCH_LIBS([?], [socket])
# for Haiku:
#AC_SEARCH_LIBS([?], [network])
# for MS windows32:
#AC_SEARCH_LIBS([?], [ws2_32])
#AC_SEARCH_LIBS([?], [iphlpapi])
# Checks for headers
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h systemd/sd-daemon.h selinux/selinux.h])
# Checks for typedefs, structures, and compiler characteristics
AC_CHECK_TYPES([socklen_t],,
AC_DEFINE([socklen_t],[int],
[define to int if type socklen_t not found]),
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
])
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# Checks for library functions
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_CHECK_FUNCS([alarm dup2 inet_ntoa memset select socket strcasecmp strchr strdup strerror strrchr strstr])
# Epilogue
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -1,48 +0,0 @@
COMMONOBJS = tun.o dns.o read.o encoding.o login.o base32.o base64.o base64u.o base128.o md5.o common.o
CLIENTOBJS = iodine.o client.o util.o
CLIENT = ../bin/iodine
SERVEROBJS = iodined.o user.o fw_query.o
SERVER = ../bin/iodined
OS = `echo $(TARGETOS) | tr "a-z" "A-Z"`
ARCH = `uname -m`
HEAD_COMMIT = `git rev-parse --short HEAD`
LIBPATH = -L.
LDFLAGS += -lz `sh osflags $(TARGETOS) link` $(LIBPATH)
CFLAGS += -std=c99 -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` -DGITREVISION=\"$(HEAD_COMMIT)\"
all: stateos $(CLIENT) $(SERVER)
stateos:
@echo OS is $(OS), arch is $(ARCH)
$(CLIENT): $(COMMONOBJS) $(CLIENTOBJS)
@echo LD $@
@mkdir -p ../bin
@$(CC) $(COMMONOBJS) $(CLIENTOBJS) -o $(CLIENT) $(LDFLAGS)
$(SERVER): $(COMMONOBJS) $(SERVEROBJS)
@echo LD $@
@mkdir -p ../bin
@$(CC) $(COMMONOBJS) $(SERVEROBJS) -o $(SERVER) $(LDFLAGS)
.c.o:
@echo CC $<
@$(CC) $(CFLAGS) $< -o $@
base64u.o client.o iodined.o: base64u.h
base64u.c: base64.c
@echo Making $@
@echo '/* No use in editing, produced by Makefile! */' > $@
@sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < base64.c >> $@
base64u.h: base64.h
@echo Making $@
@echo '/* No use in editing, produced by Makefile! */' > $@
@sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < base64.h >> $@
clean:
@echo "Cleaning src/"
@rm -f $(CLIENT){,.exe} $(SERVER){,.exe} *~ *.o *.core base64u.*
@rm -rf obj libs #android stuff

View File

@ -28,6 +28,10 @@
* 1000 8
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -16,6 +16,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -16,6 +16,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdint.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <time.h>
#include <sys/types.h>
#include <sys/param.h>

View File

@ -18,6 +18,12 @@
#ifndef __COMMON_H__
#define __COMMON_H__
#ifdef DARWIN
#ifndef __APPLE_USE_RFC_3542
#define __APPLE_USE_RFC_2292
#endif
#endif
/* Last byte of raw header is the command */
#define RAW_HDR_LEN 4
#define RAW_HDR_IDENT_LEN 3

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <time.h>
#include <stdio.h>
#include <stdint.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "common.h"
#include "encoding.h"

View File

@ -14,6 +14,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "fw_query.h"

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <sys/types.h>

View File

@ -1,52 +0,0 @@
#!/bin/sh
case $2 in
link)
case $1 in
SunOS | solaris)
echo '-lsocket -lnsl';
;;
BeOS)
echo '-lsocket -lbind -lbsd';
;;
Haiku)
echo '-lnetwork';
;;
windows32)
echo '-lws2_32 -liphlpapi';
;;
Linux)
FLAGS="";
[ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -lselinux";
[ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS $(pkg-config --libs libsystemd-daemon)";
[ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS $(pkg-config --libs libsystemd)";
echo $FLAGS;
;;
esac
;;
cflags)
case $1 in
windows32)
echo '-DWINVER=0x0501';
;;
BeOS)
echo '-Dsocklen_t=int';
;;
Darwin)
echo '-D__APPLE_USE_RFC_3542';
;;
Linux)
FLAGS="-D_GNU_SOURCE"
[ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -DHAVE_SETCON";
[ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS -DHAVE_SYSTEMD";
echo $FLAGS;
;;
GNU/kFreeBSD|GNU)
echo '-D_GNU_SOURCE'
;;
esac
;;
*)
;;
esac

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <stdint.h>
#include <stdlib.h>

View File

@ -16,6 +16,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdint.h>
#include <time.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include "common.h"

View File

@ -1,25 +0,0 @@
TEST = test
OBJS = test.o base32.o base64.o common.o read.o dns.o encoding.o login.o user.o fw_query.o
SRCOBJS = ../src/base32.o ../src/base64.o ../src/common.o ../src/read.o ../src/dns.o ../src/encoding.o ../src/login.o ../src/md5.o ../src/user.o ../src/fw_query.o
OS = `uname | tr "a-z" "A-Z"`
CHECK_PATH = /usr/local
LDFLAGS = -L$(CHECK_PATH)/lib `pkg-config check --libs` -lpthread `sh ../src/osflags $(TARGETOS) link`
CFLAGS = -std=c99 -g -Wall -D$(OS) `pkg-config check --cflags` -I../src -I$(CHECK_PATH)/include -pedantic `sh ../src/osflags $(TARGETOS) cflags`
all: $(TEST)
@LD_LIBRARY_PATH=${CHECK_PATH}/lib ./$(TEST)
$(TEST): $(OBJS) $(SRCOBJS)
@echo LD $(TEST)
@$(CC) -o $@ $(SRCOBJS) $(OBJS) $(LDFLAGS)
.c.o:
@echo CC $<
@$(CC) $(CFLAGS) -c $<
clean:
@echo "Cleaning tests/"
@rm -f *~ *.core $(TEST) $(OBJS)

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -15,6 +15,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <common.h>
#include <unistd.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -14,6 +14,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include "fw_query.h"

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <string.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <stdio.h>
#include <stdarg.h>

View File

@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <check.h>
#include <stdio.h>
#include <string.h>