From b4846e8daffe14658826c638a843aea45606ca79 Mon Sep 17 00:00:00 2001 From: David Troy Date: Sat, 1 Apr 2006 17:41:56 +0000 Subject: git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@47 f02b47b9-160a-0410-81a6-dc3441afb0ec --- Makefile | 10 ++++++---- src/ssl.c | 23 +++++++++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 02d80cb..2350849 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/src/ssl.c b/src/ssl.c index c912435..5570790 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -54,13 +54,8 @@ #include #include -#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 */ -- cgit