diff options
author | David Troy <dave@popvox.com> | 2006-06-19 09:16:45 +0000 |
---|---|---|
committer | David Troy <dave@popvox.com> | 2006-06-19 09:16:45 +0000 |
commit | 933875c14b2c937bcec409231e3467ecc602032b (patch) | |
tree | 8c5cc3936a1bc8e6a58c3bf64402cdcf7dd60539 | |
parent | 65b1273dabf6f8129ebca43bfefb4ec07adcaddc (diff) | |
download | astmanproxy-933875c14b2c937bcec409231e3467ecc602032b.tar.gz astmanproxy-933875c14b2c937bcec409231e3467ecc602032b.tar.xz astmanproxy-933875c14b2c937bcec409231e3467ecc602032b.zip |
Resolved 1.21pre merge conflicts
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/trunk@125 f02b47b9-160a-0410-81a6-dc3441afb0ec
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | VERSIONS | 1 | ||||
-rw-r--r-- | src/astmanproxy.c | 28 | ||||
-rw-r--r-- | src/include/astmanproxy.h | 3 | ||||
-rw-r--r-- | src/ssl.c | 2 |
5 files changed, 20 insertions, 17 deletions
@@ -40,9 +40,8 @@ ifeq (${OSARCH},Darwin) PERMDIR_REAL=/opt/etc/asterisk LOGDIR=/opt/log/asterisk CERTDIR := /opt/lib/asterisk/certs - OBJS+=poll.o ifeq (${OSREV},7.9.0) - OBJS+=dlfcn.o + OBJS+=poll.o dlfcn.o endif ASTLINK=-Wl,-force_flat_namespace,-dynamic SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace @@ -1,6 +1,7 @@ 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 + Changed message to dynamically allocated in HandleAsterisk, solving bus error on 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 1c07c66..bb17935 100644 --- a/src/astmanproxy.c +++ b/src/astmanproxy.c @@ -1,5 +1,5 @@ /* Asterisk Manager Proxy - Copyright (c) 2005 David C. Troy <dave@popvox.com> + Copyright (c) 2005-2006 David C. Troy <dave@popvox.com> This program is free software, distributed under the terms of the GNU General Public License. @@ -311,41 +311,44 @@ void *session_do(struct mansession *s) void *HandleAsterisk(struct mansession *s) { - struct message m; + struct message *m; int res,i; char iabuf[INET_ADDRSTRLEN]; if (ConnectAsterisk(s)) goto leave; + if (! (m = malloc(sizeof(struct message))) ) + goto leave; + for (;;) { debugmsg("asterisk@%s: attempting read...", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); memset(&m, 0, sizeof(struct message) ); - res = s->input->read(s, &m); - m.session = s; + res = s->input->read(s, m); + m->session = s; if (res > 0) { if (debug) { - for(i=0; i<m.hdrcount; i++) { - debugmsg("asterisk@%s got: %s", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr), m.headers[i]); + for(i=0; i<m->hdrcount; i++) { + debugmsg("asterisk@%s got: %s", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr), m->headers[i]); } } if (!s->connected) { - if ( !strcmp("Authentication accepted", astman_get_header(&m, "Message")) ) { + if ( !strcmp("Authentication accepted", astman_get_header(m, "Message")) ) { s->connected = 1; if (debug) debugmsg("asterisk@%s: connected successfully!", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr) ); } - if ( !strcmp("Authentication failed", astman_get_header(&m, "Message")) ) { + if ( !strcmp("Authentication failed", astman_get_header(m, "Message")) ) { s->connected = -1; } } - m.session = s; - AddHeader(&m, "Server: %s", m.session->server->ast_host); + m->session = s; + AddHeader(m, "Server: %s", m->session->server->ast_host); - if (!WriteClients(&m)) + if (!WriteClients(m)) break; } else if (res < 0) { /* TODO: do we need to do more than this here? or something different? */ @@ -355,6 +358,7 @@ void *HandleAsterisk(struct mansession *s) break; } } + free(m); leave: if (debug) @@ -511,7 +515,7 @@ static void *accept_thread() { int as; struct sockaddr_in sin; - int sinlen; + socklen_t sinlen; struct mansession *s; struct protoent *p; int arg = 1; diff --git a/src/include/astmanproxy.h b/src/include/astmanproxy.h index dc7ac87..9d8ed89 100644 --- a/src/include/astmanproxy.h +++ b/src/include/astmanproxy.h @@ -17,11 +17,10 @@ #include <stdarg.h> #include <dirent.h> #include <errno.h> +#include <dlfcn.h> #ifdef __APPLE__ - #include "dlfcn-compat.h" #include "poll-compat.h" #else - #include <dlfcn.h> #include <sys/poll.h> #endif @@ -257,7 +257,7 @@ int close_sock(int socket) socket = sec_channel[socket].fd; } - ret= close(socket); + ret= close(get_real_fd(socket)); if (ssl) SSL_free (ssl); |