Edgar Ehritt: htaccess Zugriff für alle

Beitrag lesen

Hallo Martin,

Die Welt ist case sensitive.

dieser Blödsinn ist zwar immer wieder hier im Forum zu lesen, entspricht aber keinesfalls der Wahrheit. Ein Blick in die Sourcen Apaches bestätigt auch die üblichen Erfahrungen mit der Konfiguration.

Auffinden von Direktiven (/server/config.c):

AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name,  
                                                     const command_rec *cmds)  
{  
    while (cmds->name) {  
        if (!strcasecmp(name, cmds->name))  
            return cmds;  
  
        ++cmds;  
    }  
  
    return NULL;  
}

Direktivendeklaration (ab hier aus /modules/aaa/authz_host.c):

static const command_rec authz_host_cmds[] =  
{  
    AP_INIT_TAKE1("order", order, NULL, OR_LIMIT,  
                  "'allow,deny', 'deny,allow', or 'mutual-failure'"),  
    AP_INIT_ITERATE2("allow", allow_cmd, &its_an_allow, OR_LIMIT,  
                     "'from' followed by hostnames or IP-address wildcards"),  
    AP_INIT_ITERATE2("deny", allow_cmd, NULL, OR_LIMIT,  
                     "'from' followed by hostnames or IP-address wildcards"),  
    {NULL}  
};

Die Werte der Direktive Allow:

static const char *allow_cmd(cmd_parms *cmd, void *dv, const char *from,  
                             const char *where_c)  
{  
    authz_host_dir_conf *d = (authz_host_dir_conf *) dv;  
    allowdeny *a;  
    char *where = apr_pstrdup(cmd->pool, where_c);  
    char *s;  
    char msgbuf[120];  
    apr_status_t rv;  
  
    if (strcasecmp(from, "from"))  
        return "allow and deny must be followed by 'from'";  
  
    a = (allowdeny *) apr_array_push(cmd->info ? d->allows : d->denys);  
    a->x.from = where;  
    a->limited = cmd->limited;  
  
    if (!strncasecmp(where, "env=!", 5)) {  
        a->type = T_NENV;  
        a->x.from += 5;  
  
    }  
    else if (!strncasecmp(where, "env=", 4)) {  
        a->type = T_ENV;  
        a->x.from += 4;  
  
    }  
    else if (!strcasecmp(where, "all")) {  
        a->type = T_ALL;  
    }  
    else if ((s = ap_strchr(where, '/'))) {  
        *s++ = '\0';  
        rv = apr_ipsubnet_create(&a->x.ip, where, s, cmd->pool);  
        if(APR_STATUS_IS_EINVAL(rv)) {  
            /* looked nothing like an IP address */  
            return "An IP address was expected";  
        }  
        else if (rv != APR_SUCCESS) {  
            apr_strerror(rv, msgbuf, sizeof msgbuf);  
            return apr_pstrdup(cmd->pool, msgbuf);  
        }  
        a->type = T_IP;  
    }  
    else if (!APR_STATUS_IS_EINVAL(rv = apr_ipsubnet_create(&a->x.ip, where,  
                                                            NULL, cmd->pool))) {  
        if (rv != APR_SUCCESS) {  
            apr_strerror(rv, msgbuf, sizeof msgbuf);  
            return apr_pstrdup(cmd->pool, msgbuf);  
        }  
        a->type = T_IP;  
    }  
    else { /* no slash, didn't look like an IP address => must be a host */  
        a->type = T_HOST;  
    }  
  
    return NULL;  
}

Die Werte der Direktive Order:

static const char *order(cmd_parms *cmd, void *dv, const char *arg)  
{  
    authz_host_dir_conf *d = (authz_host_dir_conf *) dv;  
    int i, o;  
  
    if (!strcasecmp(arg, "allow,deny"))  
        o = ALLOW_THEN_DENY;  
    else if (!strcasecmp(arg, "deny,allow"))  
        o = DENY_THEN_ALLOW;  
    else if (!strcasecmp(arg, "mutual-failure"))  
        o = MUTUAL_FAILURE;  
    else  
        return "unknown order";  
  
    for (i = 0; i < METHODS; ++i)  
        if (cmd->limited & (AP_METHOD_BIT << i))  
            d->order[i] = o;  
  
    return NULL;  
}

Manpage für strcasecmp(). Mit anderen Worten: Apache ist soetwas von statisch case INsensitive wie nur irgendetwas sein kann!

Apache auch. ;-)

Der Verweis passt zu Deiner Aussage, selbst wenn sie richtig wäre, wie "Der eine schwimmt über den See, der andere hat auch  Euro".

Gruß aus Berlin!
eddi