diff options
author | David Troy <dave@popvox.com> | 2006-04-01 18:07:37 +0000 |
---|---|---|
committer | David Troy <dave@popvox.com> | 2006-04-01 18:07:37 +0000 |
commit | cf834d379b5a6a7393d0c25386c55959f5df4550 (patch) | |
tree | 184cdfdb2eb85b5f5cc47ca3a83beb400973b406 /src/proxyfunc.c | |
parent | f723379bb0de062ba8203e0dba098b146075fb15 (diff) | |
download | astmanproxy-cf834d379b5a6a7393d0c25386c55959f5df4550.tar.gz astmanproxy-cf834d379b5a6a7393d0c25386c55959f5df4550.tar.xz astmanproxy-cf834d379b5a6a7393d0c25386c55959f5df4550.zip |
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@52 f02b47b9-160a-0410-81a6-dc3441afb0ec
Diffstat (limited to 'src/proxyfunc.c')
-rw-r--r-- | src/proxyfunc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/proxyfunc.c b/src/proxyfunc.c index 31094f8..ed4770e 100644 --- a/src/proxyfunc.c +++ b/src/proxyfunc.c @@ -64,6 +64,25 @@ void *ProxySetOutputFormat(struct mansession *s, struct message *m) { return 0; } +int ProxyChallenge(struct mansession *s, struct message *m) { + struct message mo; + + if ( strcasecmp("MD5", astman_get_header(m, "AuthType")) ) { + SendError(s, "Must specify AuthType"); + return 1; + } + + if (!*s->challenge) + snprintf(s->challenge, sizeof(s->challenge), "%d", rand()); + + memset(&mo, 0, sizeof(struct message)); + AddHeader(&mo, "Response: Success"); + AddHeader(&mo, "Challenge: %d", s->challenge); + + s->output->write(s, &mo); + return 0; +} + void *ProxySetAutoFilter(struct mansession *s, struct message *m) { struct message mo; char *value; |