diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | src/ssl.c | 23 |
2 files changed, 15 insertions, 18 deletions
@@ -26,9 +26,10 @@ BINDIR := $(DESTDIR)$(PREFIX)/sbin MODS := astmanproxy config config_perms common proxyfunc log ssl md5 HANDLERS := xml standard csv http SOBJS := $(HANDLERS:%=%.so) +LIBS := ssl ifeq (${OSARCH},Darwin) - LIBS=-lresolv + LIBS+=-lresolv CFLAGS+=-D__Darwin_ BINDIR=/opt/sbin LIBDIR=/opt/lib/astmanproxy @@ -42,7 +43,7 @@ ifeq (${OSARCH},Darwin) SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace else #These are used for all but Darwin - LIBS=-ldl -pthread + LIBS+=-ldl -pthread ASTLINK=-Wl,-E SOLINK=-shared -Xlinker -x LOGDIR=/var/log/asterisk @@ -52,12 +53,13 @@ OBJS += $(MODS:%=%.o) MODDIR := $(LIBDIR)/modules CONF_TARGET:= $(CONFDIR_REAL)/$(CONFFILE) PERM_TARGET:= $(PERMDIR_REAL)/$(PERMFILE) -DEFINES:='-DPROXY_VERSION="$(VERSION)"' '-DCDIR="$(CONFDIR)"' '-DCFILE="$(CONFFILE)"' '-DMDIR="$(MODDIR)"' '-DPDIR="$(PERMDIR)"' '-DPFILE="$(PERMFILE)"' +DEFINES:=-DAMI_WITH_SSL '-DPROXY_VERSION="$(VERSION)"' '-DCDIR="$(CONFDIR)"' '-DCFILE="$(CONFFILE)"' +DEFINES+='-DMDIR="$(MODDIR)"' '-DPDIR="$(PERMDIR)"' '-DPFILE="$(PERMFILE)"' VPATH = src # Add -g below for debug/GDB symbols #CFLAGS+= $(DEFINES) -Wall -O2 -dynamic -D_REENTRANT -fPIC -CFLAGS+= $(DEFINES) -Wall -O2 -D_REENTRANT -fPIC -Isrc/include +CFLAGS+= $(DEFINES) -Wall -O2 -D_REENTRANT -fPIC -Isrc/include -I- # For printing only SRCS := $(MODS:%=%.c) @@ -54,13 +54,8 @@ #include <netinet/in.h> #include <netinet/tcp.h> -#include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 15611 $") - -#include "asterisk/logger.h" -#include "asterisk/options.h" -#include "asterisk/config.h" -#include "asterisk/ssl_addon.h" +#include "astmanproxy.h" +#include "ssl.h" SSL_CTX *sctx; static long rec_bytes; @@ -174,7 +169,7 @@ int saccept(int s) } while( err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); SSL_set_mode(ssl, SSL_MODE_ENABLE_PARTIAL_WRITE); - ast_log(LOG_DEBUG, "ssl_addon: Connection accepted"); + debugmsg("ssl_addon: Connection accepted"); err=1; @@ -219,8 +214,8 @@ int m_recv(int s, void *buf, size_t len, int flags) if (ret > 0) rec_bytes += ret; - if (option_debug > 2) - ast_log(LOG_DEBUG, "Received data from SSL socket - %d\n", ret); + if (debug) + debugmsg("Received data from SSL socket - %d\n", ret); return ret; } @@ -255,7 +250,7 @@ int close_sock(int socket) */ int errexit(char s[]) { - ast_log(LOG_ERROR, "SSL critical error: %s", s); + debugmsg("SSL critical error: %s", s); return -1; } @@ -283,7 +278,7 @@ int is_encrypt_request(int sslclhellotimeout, int fd) ready_fdescriptors = select (fd + 1, &listeners, NULL, NULL, &tv); if (ready_fdescriptors < 0 ) { - ast_log(LOG_ERROR, "select returned error, This should not happen: \n"); + debugmsg("select returned error, This should not happen: \n"); return 0; } else if (ready_fdescriptors == 0) { return 0; @@ -295,12 +290,12 @@ int is_encrypt_request(int sslclhellotimeout, int fd) /* for tls buf[0x02] = 0x01 and ssl v3 buf[0x02] = 0x02 */ ((buf[0x02] == 0x00) || (buf[0x02] == 0x01))) { if (option_debug > 1) - ast_log(LOG_DEBUG, "Received a SSL request\n"); + debugmsg("Received a SSL request\n"); return 1; /* check for sslv23_client_method */ } else if ((buf[0x02] == 0x01) && (buf[0x03] == 0x03) && (buf[0x04] == 0x01)) { if (option_debug > 1) - ast_log(LOG_DEBUG, "Received a SSL request for SSLv23_client_method()\n"); + debugmsg("Received a SSL request for SSLv23_client_method()\n"); return 1; } /* check for sslv2 and return -1 */ |