Hi All, I came across this will debugging an issue with Apache. I've Apache 2.2.4default configuration with this extra configuration snippet.
Alias /f "F:/" <Directory "F:/"> Options Indexes Order Allow,Deny Allow from all </Directory> It basically maps http://localhost/f/ to F: drive on the machine. When this partition is empty, apache returns 403 Forbidden. But if it wasn't F:/ but some directory inside like F:/htdocs, and it is empty the error doesn't come. This error seems to be coming from mod_autoindex that uses apr_dir_open like this: if ((status = apr_dir_open(&thedir, name, r->pool)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, "Can't open directory for index: %s", r->filename); return HTTP_FORBIDDEN; } Here, argument "name" is "F:/". This happens because within apr_dir_open a call is made to apr_dir_read that does this: apr_status_t rv; if (rv = utf8_to_unicode_path(wdirname, sizeof(wdirname) / sizeof(apr_wchar_t), thedir->dirname)) { return rv; } eos = wcschr(wdirname, '\0'); eos[0] = '*'; eos[1] = '\0'; thedir->dirhand = FindFirstFileW(wdirname, thedir->w.entry); eos[0] = '\0'; if (thedir->dirhand == INVALID_HANDLE_VALUE) { return apr_get_os_error(); } The FindFirstFileW fails on an empty top level directory as it doesn't even have DOT and dot-dot entries. Shouldn't the behavior of apr_dir_open take this into consideration? I suggest apr_dir_open to still return success even if the directory is completely empty. Is this a valid bug? -- Vinay Y S http://vinay-ys.blogspot.com
