From 65b1273dabf6f8129ebca43bfefb4ec07adcaddc Mon Sep 17 00:00:00 2001 From: David Troy Date: Fri, 14 Apr 2006 17:41:07 +0000 Subject: git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/trunk@119 f02b47b9-160a-0410-81a6-dc3441afb0ec --- Makefile | 45 ++++++++++++++++++++++++++++----------------- VERSIONS | 1 + src/astmanproxy.c | 2 ++ src/http.c | 4 ++-- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 71d2224..a346936 100644 --- a/Makefile +++ b/Makefile @@ -14,12 +14,8 @@ LIBDIR := $(DESTDIR)/usr/lib/astmanproxy CONFFILE := astmanproxy.conf PERMFILE := astmanproxy.users DISTDIR := /var/www/html/astmanproxy -CERTDIR := /var/lib/asterisk/certs -PROXYCERT := $(CERTDIR)/proxy-server.pem -PROXYSSLCONF := $(CONFDIR)/proxy-ssl.conf CC := gcc -#LIBS := -lpthread INCLUDES := PREFIX:= /usr/local BINDIR := $(DESTDIR)$(PREFIX)/sbin @@ -30,9 +26,12 @@ HANDLERS := xml standard csv http SOBJS := $(HANDLERS:%=%.so) LIBS := -lssl +# Add -g below for debug/GDB symbols +CFLAGS:=-Wall -O2 -D_REENTRANT -fPIC -Isrc/include -I/usr/include/openssl + ifeq (${OSARCH},Darwin) LIBS+=-lresolv - CFLAGS+=-D__Darwin_ + CFLAGS+=-D__Darwin_ -Iquotesrc/include BINDIR=/opt/sbin LIBDIR=/opt/lib/astmanproxy CONFDIR=/opt/etc/asterisk @@ -40,27 +39,39 @@ ifeq (${OSARCH},Darwin) PERMDIR=/opt/etc/asterisk PERMDIR_REAL=/opt/etc/asterisk LOGDIR=/opt/log/asterisk - OBJS+=dlfcn.o poll.o + CERTDIR := /opt/lib/asterisk/certs + OBJS+=poll.o + ifeq (${OSREV},7.9.0) + OBJS+=dlfcn.o + endif ASTLINK=-Wl,-force_flat_namespace,-dynamic SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace + MKTEMP=/usr/bin/mktemp else #These are used for all but Darwin + CFLAGS+=-I- LIBS+=-ldl -pthread ASTLINK=-Wl,-E SOLINK=-shared -Xlinker -x LOGDIR=/var/log/asterisk + CERTDIR := /var/lib/asterisk/certs + MKTEMP=/bin/mktemp endif -OBJS += $(MODS:%=%.o) MODDIR := $(LIBDIR)/modules -CONF_TARGET:= $(CONFDIR_REAL)/$(CONFFILE) -PERM_TARGET:= $(PERMDIR_REAL)/$(PERMFILE) DEFINES:='-DPROXY_VERSION="$(VERSION)"' '-DCDIR="$(CONFDIR)"' '-DCFILE="$(CONFFILE)"' DEFINES+='-DMDIR="$(MODDIR)"' '-DPDIR="$(PERMDIR)"' '-DPFILE="$(PERMFILE)"' + +PROXYCERT := $(CERTDIR)/proxy-server.pem +PROXYSSLCONF := $(CONFDIR)/proxy-ssl.conf + +CFLAGS += $(DEFINES) + +OBJS += $(MODS:%=%.o) +CONF_TARGET:= $(CONFDIR_REAL)/$(CONFFILE) +PERM_TARGET:= $(PERMDIR_REAL)/$(PERMFILE) VPATH = src -# Add -g below for debug/GDB symbols -CFLAGS+= $(DEFINES) -Wall -O2 -D_REENTRANT -fPIC -Isrc/include -I/usr/include/openssl -I- # For printing only SRCS := $(MODS:%=%.c) @@ -82,8 +93,8 @@ SERIAL=`date "+%Y%m%d%H%M%S"` cert: if [ ! -f $(PROXYCERT) ]; then \ umask 77 ; \ - PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \ - PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \ + PEM1=`$(MKTEMP) /tmp/openssl.XXXXXX` ; \ + PEM2=`$(MKTEMP) /tmp/openssl.XXXXXX` ; \ if [ ! -f $(PROXYSSLCONF) ]; then \ install ./configs/ssl.conf $(PROXYSSLCONF); \ fi; \ @@ -113,8 +124,8 @@ certificate: fi; \ if [ "$$createcert" = "1" ]; then \ umask 77 ; \ - PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \ - PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \ + PEM1=`$(MKTEMP) /tmp/openssl.XXXXXX` ; \ + PEM2=`$(MKTEMP) /tmp/openssl.XXXXXX` ; \ if [ ! -f $(PROXYSSLCONF) ]; then \ install ./configs/ssl.conf $(PROXYSSLCONF); \ fi; \ @@ -135,10 +146,10 @@ install: uninstall all install $(SOBJS) $(MODDIR) install -d $(CONFDIR_REAL) if [ ! -f $(CONF_TARGET) ]; then \ - install $(CONFFILE) $(CONF_TARGET); \ + install ./configs/$(CONFFILE) $(CONF_TARGET); \ fi if [ ! -f $(PERM_TARGET) ]; then \ - install $(PERMFILE) $(PERM_TARGET); \ + install ./configs/$(PERMFILE) $(PERM_TARGET); \ fi @echo "Installation Complete!" diff --git a/VERSIONS b/VERSIONS index 0f64f57..1fc82e3 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,5 +1,6 @@ 1.21pre Added URLDecode routine to http.c to deal with URL-encoded GET/POST data Fixed xml.c to better deal with cli/unparsed data + Cleaned up Makefile for better support of Mac OS X 10.4 1.20 Cleanup and official release of 1.20pre diff --git a/src/astmanproxy.c b/src/astmanproxy.c index b84fdad..1c07c66 100644 --- a/src/astmanproxy.c +++ b/src/astmanproxy.c @@ -634,7 +634,9 @@ int main(int argc, char *argv[]) ReadConfig(); proxylog = OpenLogfile(); + debugmsg("loading handlers"); LoadHandlers(); + debugmsg("loaded handlers"); if (SetProcUID()) { fprintf(stderr,"Cannot set user/group! Check proc_user and proc_group config setting!\n"); diff --git a/src/http.c b/src/http.c index b0af09f..a21a7ed 100644 --- a/src/http.c +++ b/src/http.c @@ -10,7 +10,7 @@ #include "astmanproxy.h" // SwapChar: This routine swaps one character for another -void SwapChar(char * pOriginal, char cBad, char cGood) { +void SwapChar(char *pOriginal, char cBad, char cGood) { int i; // generic counter variable // Loop through the input string (cOriginal), character by @@ -64,7 +64,7 @@ static int IntFromHex(char *pChars) { // is a normalized string. It calls the two subroutines directly // above in this listing, IntFromHex() and SwapChar(). -void URLDecode(unsigned char *pEncoded) { +void URLDecode(char *pEncoded) { char *pDecoded; // generic pointer // First, change those pesky plusses to spaces -- cgit