summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Troy <dave@popvox.com>2006-04-04 20:38:07 +0000
committerDavid Troy <dave@popvox.com>2006-04-04 20:38:07 +0000
commit6c9d46845fbaa89dc5481fb8d0d1c78728628122 (patch)
treee1fcd7ffe275e366c32ad889a60ead10dc92d594
parente4b66ca5172292a09ac0f68b9373fcbe83cef8d6 (diff)
downloadastmanproxy-6c9d46845fbaa89dc5481fb8d0d1c78728628122.zip
astmanproxy-6c9d46845fbaa89dc5481fb8d0d1c78728628122.tar.gz
astmanproxy-6c9d46845fbaa89dc5481fb8d0d1c78728628122.tar.xz
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@80 f02b47b9-160a-0410-81a6-dc3441afb0ec
-rw-r--r--TODO2
-rw-r--r--src/astmanproxy.c6
-rw-r--r--src/include/ssl.h2
-rw-r--r--src/ssl.c17
4 files changed, 16 insertions, 11 deletions
diff --git a/TODO b/TODO
index 5febf5a..439c6d8 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+fix non-blocking in ast_connect
+
'connected' flag; do not set until we get "authentication accepted' back from server
Check for module versions; do not run without modules installed
use a key? see loader.c in *
diff --git a/src/astmanproxy.c b/src/astmanproxy.c
index ac30b1b..9481610 100644
--- a/src/astmanproxy.c
+++ b/src/astmanproxy.c
@@ -663,13 +663,13 @@ int main(int argc, char *argv[])
/* Read initial state for user permissions */
ReadPerms();
+ /* Initialize SSL Client-Side Context */
+ client_init_secure();
+
/* Initialize global client/server list */
sessions = NULL;
LaunchAsteriskThreads();
- /* Initialize SSL Client-Side Context */
- client_init_secure();
-
/* Setup listener socket to setup new sessions... */
if ((asock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
fprintf(stderr,"Cannot create listener socket!\n");
diff --git a/src/include/ssl.h b/src/include/ssl.h
index a52b424..19c74a7 100644
--- a/src/include/ssl.h
+++ b/src/include/ssl.h
@@ -28,7 +28,7 @@ extern "C" {
The negative fd is used as an index into this data structure (after processing).
Choose SEC_MAX to be impossibly large for the application.
*/
-#define SEC_MAX 8
+#define SEC_MAX 16
struct {
int fd;
SSL* ssl;
diff --git a/src/ssl.c b/src/ssl.c
index ce38814..c77d57a 100644
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -108,9 +108,10 @@ int client_init_secure(void)
SSL_load_error_strings();
cctx = SSL_CTX_new (meth);
- if (!cctx) {
- fprintf(stderr, "Failed to create a client ssl context!\n");
- }
+ if (!cctx)
+ debugmsg("Failed to create a client ssl context!");
+ else
+ debugmsg("Client SSL Context Initialized");
return 0;
}
@@ -346,10 +347,12 @@ int ast_connect(struct mansession *a) {
sec_channel[s].ssl = ssl;
SSL_set_fd(ssl, fd); /* and attach the real fd */
err = SSL_connect(ssl); /* now try and connect */
- }
+ } else
+ debugmsg("couldn't create ssl client context");
fd = -(s+2); /* offset by two and negate */
/* this tells us it is a ssl fd */
- }
+ } else
+ debugmsg("couldn't get SSL slot!");
if (err==-1) {
close_sock(fd); /* that frees the ssl too */
@@ -370,8 +373,8 @@ int connect_nonb(struct mansession *a)
s = get_real_fd(a->fd);
- flags = fcntl(s, F_GETFL, 0);
- fcntl(s, F_SETFL, flags | O_NONBLOCK);
+/* flags = fcntl(s, F_GETFL, 0);
+ fcntl(s, F_SETFL, flags | O_NONBLOCK); */
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one))==-1) {
(void)close(s);