diff options
Diffstat (limited to 'src/proxyfunc.c')
-rw-r--r-- | src/proxyfunc.c | 9 |
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 ) |