Received: (from majordom@localhost) by hyperreal.org (8.8.5/8.8.5) id QAA12057; Wed, 3 Sep 1997 16:51:18 -0700 (PDT) Received: from veal.organic.com (h20.n145.organic.com [204.152.145.20]) by hyperreal.org (8.8.5/8.8.5) with ESMTP id QAA12037 for ; Wed, 3 Sep 1997 16:51:10 -0700 (PDT) Received: from localhost (akosut@localhost) by veal.organic.com (8.8.3/8.6.12) with SMTP id QAA08980 for ; Wed, 3 Sep 1997 16:51:02 -0700 (PDT) X-Authentication-Warning: veal.organic.com: akosut owned process doing -bs Date: Wed, 3 Sep 1997 16:51:00 -0700 (PDT) From: Alexei Kosut To: new-httpd@apache.org Subject: Re: Auth failure in Win32 In-Reply-To: <340B30ED.CF62CC@algroup.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org On Mon, 1 Sep 1997, Ben Laurie wrote: > I don't see why we should try to make it work. Just accept that > pathnames on Win32 look like :/. It's the way it is. You > don't expect Apache to warn you that is a stupid > thing to do, so why expect it to warn about ? > > I admit I'm reversing my previous position :-) Yes, well... okay. But pathnames on Win32 don't always look like :/, where and are lowercase strings. In fact, the Windows tools nearly always use uppercase drive letters. I agree that it's fine to use lowercase representations internally, but I don't think we should just say "oh, all entries have to be lowercase, and with lowercase drive letters," and expect people to do so. Especially since no other Windows program does, and even the DirectoryRoot and Alias and such functions do not (Apache will expand it out after translating the URL). So I think a patch like this one is appropriate: Index: main/http_core.c =================================================================== RCS file: /export/home/cvs/apachen/src/main/http_core.c,v retrieving revision 1.118 diff -u -r1.118 http_core.c --- http_core.c 1997/09/02 16:12:08 1.118 +++ http_core.c 1997/09/03 23:46:25 @@ -753,6 +753,16 @@ return NULL; } +/* We use this in and , to ensure that + * people don't get bitten by wrong-cased regex matches + */ + +#ifdef WIN32 +#define USE_ICASE REG_ICASE +#else +#define USE_ICASE 0 +#endif + static const char end_dir_magic[] = " outside of any section"; const char *end_dirsection (cmd_parms *cmd, void *dummy) { @@ -782,11 +792,15 @@ cmd->override = OR_ALL|ACCESS_CONF; if (cmd->info) { /* */ - r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); } else if (!strcmp(cmd->path, "~")) { cmd->path = getword_conf (cmd->pool, &arg); - r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + } + else { + /* Ensure that the pathname is canonical */ + cmd->path = os_canonical_filename(cmd->pool, cmd->path); } errmsg = srm_command_loop (cmd, new_dir_conf); @@ -881,16 +895,21 @@ if (cmd->info) { /* */ if (old_path && cmd->path[0] != '/' && cmd->path[0] != '^') cmd->path = pstrcat(cmd->pool, "^", old_path, cmd->path, NULL); - r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); } else if (!strcmp(cmd->path, "~")) { cmd->path = getword_conf (cmd->pool, &arg); if (old_path && cmd->path[0] != '/' && cmd->path[0] != '^') cmd->path = pstrcat(cmd->pool, "^", old_path, cmd->path, NULL); - r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED); + r = pregcomp(cmd->pool, cmd->path, REG_EXTENDED|USE_ICASE); + } + else { + if (old_path && cmd->path[0] != '/') + cmd->path = pstrcat(cmd->pool, old_path, cmd->path, NULL); + + /* Ensure that the pathname is canonical */ + cmd->path = os_canonical_filename(cmd->pool, cmd->path); } - else if (old_path && cmd->path[0] != '/') - cmd->path = pstrcat(cmd->pool, old_path, cmd->path, NULL); errmsg = srm_command_loop (cmd, new_file_conf); if (errmsg != end_file_magic) return errmsg; -- Alexei Kosut