You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2006/02/07 14:19:15 UTC

svn commit: r375595 - /httpd/test/trunk/perl-framework/c-modules/authany/mod_authany.c

Author: jorton
Date: Tue Feb  7 05:19:08 2006
New Revision: 375595

URL: http://svn.apache.org/viewcvs?rev=375595&view=rev
Log:
- attempt to adapt for trunk aaa changes; this doesn't work
but it does at least compile - not sure whether the problem
is in this code or the aaa code.

Modified:
    httpd/test/trunk/perl-framework/c-modules/authany/mod_authany.c

Modified: httpd/test/trunk/perl-framework/c-modules/authany/mod_authany.c
URL: http://svn.apache.org/viewcvs/httpd/test/trunk/perl-framework/c-modules/authany/mod_authany.c?rev=375595&r1=375594&r2=375595&view=diff
==============================================================================
--- httpd/test/trunk/perl-framework/c-modules/authany/mod_authany.c (original)
+++ httpd/test/trunk/perl-framework/c-modules/authany/mod_authany.c Tue Feb  7 05:19:08 2006
@@ -9,6 +9,40 @@
 
 #endif
 
+#include "ap_mmn.h"
+
+/* do not accept empty "" strings */
+#define strtrue(s) (s && *s)
+
+#if AP_MODULE_MAGIC_AT_LEAST(20060110, 0)
+
+#include "ap_provider.h"
+#include "mod_auth.h"
+
+static authz_status any_check_authorization(request_rec *r,
+                                            const char *requirement)
+{
+    return strtrue(r->user) && strcmp(requirement, "any-user") == 0 
+        ? AUTHZ_GRANTED : AUTHZ_DENIED;
+}
+
+static const authz_provider authz_any_provider =
+{
+    &any_check_authorization,
+};
+
+static void extra_hooks(apr_pool_t *p)
+{
+    ap_register_provider(p, AUTHZ_PROVIDER_GROUP,
+                         "user", "0", &authz_any_provider);
+}
+
+#define APACHE_HTTPD_TEST_EXTRA_HOOKS extra_hooks
+
+#include "apache_httpd_test.h"
+
+#else /* < 2.3 */
+
 #define APACHE_HTTPD_TEST_HOOK_ORDER    APR_HOOK_FIRST
 #define APACHE_HTTPD_TEST_CHECK_USER_ID authany_handler
 #define APACHE_HTTPD_TEST_AUTH_CHECKER  require_any_user
@@ -43,9 +77,6 @@
     return DECLINED;
 }
 
-/* do not accept empty "" strings */
-#define strtrue(s) (s && *s)
-
 static int authany_handler(request_rec *r)
 {
      const char *sent_pw; 
@@ -82,5 +113,6 @@
 
      return OK;
 }
+#endif
 
 APACHE_HTTPD_TEST_MODULE(authany);