--- /home/loic/dev/mod_autoindex.c.orig	2005-02-04 21:21:18.000000000 +0100
+++ /home/loic/dev/mod_autoindex.c	2007-04-24 22:34:03.000000000 +0200
@@ -70,6 +70,7 @@
 #define IGNORE_CLIENT       (1 << 15)
 #define IGNORE_CASE         (1 << 16)
 #define EMIT_XHTML          (1 << 17)
+#define SHOW_FORBIDDEN	    (1 << 18)
 
 #define K_NOADJUST 0
 #define K_ADJUST 1
@@ -373,6 +374,9 @@
         else if (!strcasecmp(w, "XHTML")) {
             option = EMIT_XHTML;
         }
+	else if (!strcasecmp(w, "ShowForbidden")) {
+	    option = SHOW_FORBIDDEN;
+	}
         else if (!strcasecmp(w, "None")) {
             if (action != '\0') {
                 return "Cannot combine '+' or '-' with 'None' keyword";
@@ -1252,6 +1256,7 @@
 {
     request_rec *rr;
     struct ent *p;
+    int show_forbidden = 0;
 
     /* Dot is ignored, Parent is handled by make_parent_entry() */
     if ((dirent->name[0] == '.') && (!dirent->name[1]
@@ -1283,10 +1288,16 @@
     if (!(rr = ap_sub_req_lookup_dirent(dirent, r, AP_SUBREQ_NO_ARGS, NULL))) {
         return (NULL);
     }
-
+    
+    if((autoindex_opts & SHOW_FORBIDDEN)
+	&& (rr->status == HTTP_UNAUTHORIZED || rr->status == HTTP_FORBIDDEN)) {
+	show_forbidden = 1;
+    }
+    
     if ((rr->finfo.filetype != APR_DIR && rr->finfo.filetype != APR_REG)
         || !(rr->status == OK || ap_is_HTTP_SUCCESS(rr->status)
-                              || ap_is_HTTP_REDIRECT(rr->status))) {
+                              || ap_is_HTTP_REDIRECT(rr->status)
+			      || show_forbidden == 1)) {
         ap_destroy_sub_req(rr);
         return (NULL);
     }

