summaryrefslogtreecommitdiffstats
path: root/src/proxyfunc.c
diff options
context:
space:
mode:
authorDavid Troy <dave@popvox.com>2006-04-07 20:55:51 +0000
committerDavid Troy <dave@popvox.com>2006-04-07 20:55:51 +0000
commit27aa7a3382cf0ed4973fa7e207d4ffc9733f69d5 (patch)
treef8a9824b3a235fa45ebe2724668881a73e9e59ae /src/proxyfunc.c
parentce35268086acbc958c33e8b39e2440c7ed1d2592 (diff)
downloadastmanproxy-27aa7a3382cf0ed4973fa7e207d4ffc9733f69d5.tar.gz
astmanproxy-27aa7a3382cf0ed4973fa7e207d4ffc9733f69d5.tar.xz
astmanproxy-27aa7a3382cf0ed4973fa7e207d4ffc9733f69d5.zip
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@94 f02b47b9-160a-0410-81a6-dc3441afb0ec
Diffstat (limited to 'src/proxyfunc.c')
-rw-r--r--src/proxyfunc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/proxyfunc.c b/src/proxyfunc.c
index d1d5f38..434baff 100644
--- a/src/proxyfunc.c
+++ b/src/proxyfunc.c
@@ -156,10 +156,12 @@ void *ProxyLogin(struct mansession *s, struct message *m) {
AddHeader(&mo, "Response: Success");
AddHeader(&mo, "Message: Authentication accepted");
s->output->write(s, &mo);
- s->authenticated = 1;
+ pthread_mutex_lock(&s->lock);
+ s->authenticated = 1;
strcpy(s->user.channel, pu->channel);
strcpy(s->user.icontext, pu->icontext);
strcpy(s->user.ocontext, pu->ocontext);
+ pthread_mutex_unlock(&s->lock);
if( debug )
debugmsg("Login as: %s", user);
break;
@@ -171,11 +173,14 @@ void *ProxyLogin(struct mansession *s, struct message *m) {
if( !pu ) {
SendError(s, "Authentication failed");
+ pthread_mutex_lock(&s->lock);
s->authenticated = 0;
+ pthread_mutex_unlock(&s->lock);
if( debug )
debugmsg("Login failed as: %s/%s", user, secret);
}
+
return 0;
}
@@ -334,7 +339,7 @@ int ValidateAction(struct message *m, struct mansession *s, int inbound) {
char *uchannel;
char *ucontext;
- if( !s->authenticated )
+ if( pc.authrequired && !s->authenticated )
return 0;
if( inbound )