summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Troy <dave@popvox.com>2006-04-01 18:52:17 +0000
committerDavid Troy <dave@popvox.com>2006-04-01 18:52:17 +0000
commite7575b72bd6cd202c6a9b93369d86bf7c7974938 (patch)
treebc4e716bc647d689bec91df1a9d77ec9730135e7
parentcf834d379b5a6a7393d0c25386c55959f5df4550 (diff)
downloadastmanproxy-e7575b72bd6cd202c6a9b93369d86bf7c7974938.tar.gz
astmanproxy-e7575b72bd6cd202c6a9b93369d86bf7c7974938.tar.xz
astmanproxy-e7575b72bd6cd202c6a9b93369d86bf7c7974938.zip
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@53 f02b47b9-160a-0410-81a6-dc3441afb0ec
-rw-r--r--src/astmanproxy.c4
-rw-r--r--src/proxyfunc.c17
2 files changed, 13 insertions, 8 deletions
diff --git a/src/astmanproxy.c b/src/astmanproxy.c
index 31af40d..bb3d260 100644
--- a/src/astmanproxy.c
+++ b/src/astmanproxy.c
@@ -15,7 +15,7 @@ extern FILE *OpenLogfile( void );
extern int SetProcUID( void );
extern void *proxyaction_do(char *proxyaction, struct message *m, struct mansession *s);
-extern void *ProxyLogin(struct mansession *s, char* username, char* secret);
+extern void *ProxyLogin(struct mansession *s, struct message *m);
extern void *ProxyLogoff(struct mansession *s);
extern int ValidateAction(struct message *m, struct mansession *s, int inbound);
@@ -274,7 +274,7 @@ void *session_do(struct mansession *s)
actionid = astman_get_header(&m, ACTION_ID);
action = astman_get_header(&m, "Action");
if ( !strcasecmp(action, "Login") )
- ProxyLogin(s, astman_get_header(&m, "UserName"), astman_get_header(&m, "Secret"));
+ ProxyLogin(s, &m);
else if ( !strcasecmp(action, "Logoff") )
ProxyLogoff(s);
else if ( !strcasecmp(action, "Challenge") )
diff --git a/src/proxyfunc.c b/src/proxyfunc.c
index ed4770e..54b7789 100644
--- a/src/proxyfunc.c
+++ b/src/proxyfunc.c
@@ -106,11 +106,16 @@ void *ProxySetAutoFilter(struct mansession *s, struct message *m) {
return 0;
}
-void *ProxyLogin(struct mansession *s, char *user, char *secret) {
- struct message m;
+void *ProxyLogin(struct mansession *s, struct message *m) {
+ struct message mo;
struct proxy_user *pu;
+ char *user, *secret, *md5key;
- memset(&m, 0, sizeof(struct message));
+ user = astman_get_header(m, "Username");
+ secret = astman_get_header(m, "Secret");
+ md5key = astman_get_header(m, "Key");
+
+ memset(&mo, 0, sizeof(struct message));
if( debug )
debugmsg("Login attempt as: %s/%s", user, secret);
@@ -118,9 +123,9 @@ void *ProxyLogin(struct mansession *s, char *user, char *secret) {
pu = pc.userlist;
while( pu ) {
if ( !strcmp(user, pu->username) && !strcmp(secret, pu->secret) ) {
- AddHeader(&m, "Response: Success");
- AddHeader(&m, "Message: Authentication accepted");
- s->output->write(s, &m);
+ AddHeader(&mo, "Response: Success");
+ AddHeader(&mo, "Message: Authentication accepted");
+ s->output->write(s, &mo);
s->authenticated = 1;
strcpy(s->user.channel, pu->channel);
strcpy(s->user.icontext, pu->icontext);