From 0cb3f6098d959479a96c26a92d91becc2110b30d Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 11 Jun 2008 21:48:27 +0000 Subject: Support getting groups from the server and limiting access based on LDAP groups. See #112 --- daemon/simple.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'daemon/simple.c') diff --git a/daemon/simple.c b/daemon/simple.c index 1c37c23..1e3cc64 100644 --- a/daemon/simple.c +++ b/daemon/simple.c @@ -28,9 +28,11 @@ #include "hash.h" #include "bd.h" #include "md5.h" +#include "stringx.h" #include #include +#include #define SIMPLE_MAXLINE 256 @@ -49,8 +51,8 @@ typedef struct simple_context simple_context_t; /* Forward declarations for callbacks */ -static int validate_digest(ha_request_t* rq, const char* user, digest_context_t* dg); -static int validate_basic(ha_request_t* rq, const char* user, const char* password); +static int validate_digest(ha_request_t* rq, const char* user, digest_context_t* dg, char ***groups); +static int validate_basic(ha_request_t* rq, const char* user, const char* password, char ***groups); /* The defaults for the context */ static const simple_context_t simple_defaults = @@ -63,7 +65,8 @@ static const simple_context_t simple_defaults = * Internal Functions */ -static int validate_digest(ha_request_t* rq, const char* user, digest_context_t* dg) +static int validate_digest(ha_request_t* rq, const char* user, + digest_context_t* dg, char ***groups) { simple_context_t* ctx = (simple_context_t*)rq->context->ctx_data; FILE* f; @@ -142,7 +145,7 @@ static int validate_digest(ha_request_t* rq, const char* user, digest_context_t* } ha_messagex(rq, LOG_DEBUG, "found ha1 for user: %s", user); - memcpy(dg->ha1, t, MD5_LEN); + memcpy(dg->server_ha1, t, MD5_LEN); foundgood = 1; /* Try to do the validation */ @@ -168,7 +171,8 @@ static int validate_digest(ha_request_t* rq, const char* user, digest_context_t* return ret; } -static int validate_basic(ha_request_t* rq, const char* user, const char* password) +static int validate_basic(ha_request_t* rq, const char* user, + const char* password, char ***groups) { simple_context_t* ctx = (simple_context_t*)rq->context->ctx_data; FILE* f; -- cgit v1.2.3