summaryrefslogtreecommitdiff
path: root/daemon/simple.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-06-11 21:48:27 +0000
committerStef Walter <stef@memberwebs.com>2008-06-11 21:48:27 +0000
commit0cb3f6098d959479a96c26a92d91becc2110b30d (patch)
tree22f1447d6c7ad77d802c476297cf9547f822f81a /daemon/simple.c
parent67d7a6cc4d3234ac93e521632701e8d42513e042 (diff)
Support getting groups from the server and limiting access based on LDAP groups. See #112
Diffstat (limited to 'daemon/simple.c')
-rw-r--r--daemon/simple.c14
1 files changed, 9 insertions, 5 deletions
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 <stdio.h>
#include <fcntl.h>
+#include <unistd.h>
#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;