From 9a62fdb85d59213fbabf69e5d28d11b45e111688 Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Sun, 31 Jul 2005 11:49:26 +0000 Subject: [PATCH] added valid-user support, fixed #4 git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@491 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/http_auth.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/http_auth.c b/src/http_auth.c index cfc68f29..f84f8408 100644 --- a/src/http_auth.c +++ b/src/http_auth.c @@ -309,11 +309,16 @@ static int http_auth_match_rules(server *srv, mod_auth_plugin_data *p, const cha if (i == p->conf.auth_require->used) { return -1; } - + req = ((data_array *)(p->conf.auth_require->data[i]))->value; require = (data_string *)array_get_element(req, "require"); + /* if we get here, the user we got a authed user */ + if (0 == strcmp(require->value->ptr, "valid-user")) { + return 0; + } + /* user=name1|group=name3|host=name4 */ /* seperate the string by | */ @@ -340,6 +345,11 @@ static int http_auth_match_rules(server *srv, mod_auth_plugin_data *p, const cha /* from r to r + r_len is a rule */ + if (0 == strncmp(r, "valid-user", r_len)) { + log_error_write(srv, __FILE__, __LINE__, "s", "valid-user cannot be combined with other require rules"); + return -1; + } + /* search for = in the rules */ if (NULL == (eq = strchr(r, '='))) { log_error_write(srv, __FILE__, __LINE__, "s", "= is missing");