]> granicus.if.org Git - apache/blobdiff - modules/aaa/mod_authn_anon.c
Introduce a per connection "peer_ip" and a per request "client_ip" to
[apache] / modules / aaa / mod_authn_anon.c
index 6353b3eb442658aa5c1c8bdc18cf82cba54e4739..fc47619430b06527d9cc9f675e47a96484ebe157 100644 (file)
@@ -1,9 +1,9 @@
-/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
@@ -20,7 +20,7 @@
  * as the password.
  *
  * Just add the following tokes to your <directory> setup:
- * 
+ *
  * Anonymous                    magic-userid [magic-userid]...
  *
  * Anonymous_MustGiveEmail      [ on | off ] default = on
@@ -28,8 +28,8 @@
  * Anonymous_VerifyEmail        [ on | off ] default = off
  * Anonymous_NoUserId           [ on | off ] default = off
  *
- * The magic user id is something like 'anonymous', it is NOT case sensitive. 
- * 
+ * The magic user id is something like 'anonymous', it is NOT case sensitive.
+ *
  * The MustGiveEmail flag can be used to force users to enter something
  * in the password field (like an email address). Default is on.
  *
@@ -38,7 +38,7 @@
  * in broken GUIs like W95 is often given by the user. The Default is off.
  *
  * Dirk.vanGulik@jrc.it; http://ewse.ceo.org; http://me-www.jrc.it/~dirkx
- * 
+ *
  */
 
 #include "apr_strings.h"
@@ -113,7 +113,7 @@ static const char *anon_set_string_slots(cmd_parms *cmd,
 
 static const command_rec authn_anon_cmds[] =
 {
-    AP_INIT_ITERATE("Anonymous", anon_set_string_slots, NULL, OR_AUTHCFG, 
+    AP_INIT_ITERATE("Anonymous", anon_set_string_slots, NULL, OR_AUTHCFG,
      "a space-separated list of user IDs"),
     AP_INIT_FLAG("Anonymous_MustGiveEmail", ap_set_flag_slot,
      (void *)APR_OFFSETOF(authn_anon_config_rec, mustemail),
@@ -140,7 +140,7 @@ static authn_status check_anonymous(request_rec *r, const char *user,
     authn_status res = AUTH_USER_NOT_FOUND;
 
     /* Ignore if we are not configured */
-    if (!conf->users) {
+    if (!conf->users && !conf->anyuserid) {
         return AUTH_USER_NOT_FOUND;
     }
 
@@ -198,11 +198,12 @@ static const authn_provider authn_anon_provider =
 
 static void register_hooks(apr_pool_t *p)
 {
-    ap_register_provider(p, AUTHN_PROVIDER_GROUP, "anon", "0",
-                         &authn_anon_provider);
+    ap_register_auth_provider(p, AUTHN_PROVIDER_GROUP, "anon",
+                              AUTHN_PROVIDER_VERSION,
+                              &authn_anon_provider, AP_AUTH_INTERNAL_PER_CONF);
 }
 
-module AP_MODULE_DECLARE_DATA authn_anon_module =
+AP_DECLARE_MODULE(authn_anon) =
 {
     STANDARD20_MODULE_STUFF,
     create_authn_anon_dir_config, /* dir config creater */