summaryrefslogtreecommitdiff
path: root/daemon/simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/simple.c')
-rw-r--r--daemon/simple.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/daemon/simple.c b/daemon/simple.c
index e33e833..d2f8063 100644
--- a/daemon/simple.c
+++ b/daemon/simple.c
@@ -150,6 +150,7 @@ static int complete_digest_ha1(simple_context_t* ctx, digest_record_t* rec,
int found = 0;
char* t;
char* t2;
+ size_t len;
char line[SIMPLE_MAXLINE];
ASSERT(ctx && rec && buf && user && user[0] && code);
@@ -199,9 +200,11 @@ static int complete_digest_ha1(simple_context_t* ctx, digest_record_t* rec,
/* Check the realm */
if(strcmp(t, ctx->realm) == 0)
{
+ len = MD5_LEN;
+
/* Now try antd decode the ha1 */
- t = ha_bufdechex(buf, t2, MD5_LEN);
- if(t != NULL)
+ t = ha_bufdechex(buf, t2, &len);
+ if(t && len == MD5_LEN)
{
memcpy(rec->ha1, t, MD5_LEN);
found = 1;
@@ -233,6 +236,7 @@ static int validate_user_password(simple_context_t* ctx, ha_buffer_t* buf,
unsigned char ha1[MD5_LEN];
char* t;
char* t2;
+ size_t len;
ASSERT(ctx && buf && code);
ASSERT(user && user[0] && clearpw);
@@ -306,9 +310,11 @@ static int validate_user_password(simple_context_t* ctx, ha_buffer_t* buf,
/* Check the realm */
if(strcmp(t, ctx->realm) == 0)
{
+ len = MD5_LEN;
+
/* Now try antd decode the ha1 */
- t = ha_bufdechex(buf, t2, MD5_LEN);
- if(t && memcmp(ha1, t, MD5_LEN) == 0)
+ t = ha_bufdechex(buf, t2, &len);
+ if(t && len == MD5_LEN && memcmp(ha1, t, MD5_LEN) == 0)
{
found = 1;
break;