From 5f106e460c99a69c358ee66bdafdcd67354855df Mon Sep 17 00:00:00 2001 From: ohnx Date: Mon, 31 Dec 2018 01:53:02 +0000 Subject: [PATCH] Remove old debug code in preparation for new code --- .travis.yml | 22 ++-------------------- Makefile | 20 ++++++++------------ debug/Makefile | 5 ----- debug/hook_net.c | 28 ---------------------------- 4 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 debug/Makefile delete mode 100644 debug/hook_net.c diff --git a/.travis.yml b/.travis.yml index fcccefc..5e5cab1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,7 @@ language: c compiler: - gcc - -env: - global: - # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created - # via the "travis encrypt" command using the project repo's public key - - secure: "zxB/HrSnLlzoB0gFT0w2IYLeF4eZRjI+TLGfVm7eWFFfosDNM7vEfJ3OTFxHh1BRh0+Ts+PwqCSLSv7L5IeHHZkft8YuDHQfc5qYheqmiJHdrh5br+UyVLrfnk3p15Im3Kum3aSQBOBfdmxO6vWfeKIL6EDf5UD9i0ZPYq7mwFbxOdmC1a9l/ucHOPQ8imvhqEINb7sXogrC/8jf9Cq8q53lt8OzXGa4I5HJa9CUxJ83ozE2zpu2cCAcTvcve1Up3pYQlsykXspbQPqBdNLHK+HYd8kSKw+WbfAkvSZ6UV9aC8Hp6nwmOMjih3B6v3XxguODhOglVwKpf4ecu290LOnE34K3De5tx2PJepD9IdupQD+ejcgvDS/0mPp9Bo+cpsqCRYSv05BQnunzoWGjKvQMTEM4d5tmGlCsrMD88YfuSywfx1RJX07QnhT4qPm8hBVbtnA4wovwS/m50vB1pjX1lZVEXJw6XSz/j3jAXYqTQYwCE39B7Ap8zKx1VUvem+rIasojAGmpjZY9gF4E4CBqvjkcZncsuTKekMFrWz2AjoHAVIy7hDo05gTjH/UAOU9mFg5T0LxZXZwZVmdOETtLlDf+WG7hTE4b4+oAb9wYLV8fZpOLynTFVV0gLeApm4GDNNxVxUpem45LWuQpbG5J5xU1TA7OVXHkHBcqtwo=" - -before_install: - - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- - -addons: - coverity_scan: - project: - name: "ohnx/mail" - description: "Build submitted via Travis CI" - notification_email: masonx.01@gmail.com - build_command_prepend: "make clean" - build_command: "make -j4" - branch_pattern: coverity_scan + - clang script: - - make -j4 + - make test diff --git a/Makefile b/Makefile index 79e0994..6661eaa 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ INCLUDES=-Iinclude/ -Idist/mbedtls/include LIBS=-lpthread -Ldist/ -lmbedtls -lmbedcrypto -lmbedx509 -CFLAGS=$(INCLUDES) -Wall -Werror -std=gnu99 -pedantic +CFLAGS+=$(INCLUDES) -Wall -Werror -std=gnu99 -pedantic OBJ=objs/smtp.o objs/mail.o objs/server.o objs/mail_serialize.o objs/ssl.o OUTPUT=barid @@ -24,22 +24,18 @@ objs/%.o: src/%.c $(OUTPUT): dist/libmbedtls.a $(OBJ) $(CC) $^ -o $@ $(LIBS) $(CFLAGS) -debug/hook_net.so: debug/hook_net.c - $(MAKE) -C debug/ - -.PHONY: debugnet -debugnet: $(OUTPUT) debug/hook_net.so - LD_PRELOAD=debug/hook_net.so ./$(OUTPUT) - .PHONY: debug -debug: CFLAGS += -g -O0 -fsanitize=address +debug: CFLAGS += -g -O0 debug: $(OUTPUT) - # valgrind --leak-check=full --show-leak-kinds=all ./$(OUTPUT) -p 2525 example.com example.org example.net -s + +.PHONY: test +test: debug + @-echo "Tests are a WIP" .PHONY: clean clean: -rm -f $(OBJ) -rm -f $(OUTPUT) - $(MAKE) clean -C debug/ - $(MAKE) clean -C dist/mbedtls + -$(MAKE) clean -C debug/ + -$(MAKE) clean -C dist/mbedtls diff --git a/debug/Makefile b/debug/Makefile deleted file mode 100644 index 8ea99ca..0000000 --- a/debug/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -default: - gcc -Wall -Werror -fPIC -shared -o hook_net.so hook_net.c -ldl - -clean: - -rm -f hook_net.so diff --git a/debug/hook_net.c b/debug/hook_net.c deleted file mode 100644 index 85d265d..0000000 --- a/debug/hook_net.c +++ /dev/null @@ -1,28 +0,0 @@ -#define _GNU_SOURCE - -#include -#include -#include - -ssize_t send(int socket, const void *buffer, size_t length, int flags) { - ssize_t (*orig_send)(int, const void *, size_t, int); - orig_send = dlsym(RTLD_NEXT, "send"); - - /* print sending data */ - printf("%02d << ```%s```\n", socket, (const char *)buffer); - - return (*orig_send)(socket, buffer, length, flags); -} - -ssize_t recv(int socket, void *buffer, size_t length, int flags) { - ssize_t (*orig_recv)(int, void *, size_t, int); - ssize_t ret; - orig_recv = dlsym(RTLD_NEXT, "recv"); - - ret = (*orig_recv)(socket, buffer, length, flags); - - /* print received data */ - printf("%02d >> ```%s```\n", socket, (const char *)buffer); - - return ret; -}