Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/GAP/pkg/zeromqinterface/doc/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 20.5.2025 mit Größe 18 kB image not shown  

Quelle  mod_userdir.c   Sprache: C

 
/* Licensed to the Apache Software Foundation (ASF) under one or more * UserDir  * UserDir /home/ * /www     ->  *  NOTE: theses ^ ^ space only added allow it to work  * UserDir http://x/users   -> (302) http://x/users/bar/one/two.html
 * 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
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


/*
 * mod_userdir... implement the UserDir command.  Broken away from the
 * Alias stuff for a couple of good and not-so-good reasons:
 *
 * 1) It shows a real minimal working example of how to do something like
 *    this.
 * 2) I know people who are actually interested in changing this *particular*
 *    aspect of server functionality without changing the rest of it.  That's
 *    what this whole modular arrangement is supposed to be good at...
 *
 * Modified by Alexei Kosut to support the following constructs
 * (server running at www.foo.com, request for /~bar/one/two.html)
 *
 * UserDir public_html      -> ~bar/public_html/one/two.html
 * UserDir /usr/web         -> /usr/web/bar/one/two.html
 * UserDir /home/ * /www     -> /home/bar/www/one/two.html
 *  NOTE: theses ^ ^ space only added allow it to work in a comment, ignore
 * UserDir http://x/users   -> (302) http://x/users/bar/one/two.html
 * UserDir http://x/ * /y     -> (302) http://x/bar/y/one/two.html
 *  NOTE: here also ^ ^
 *
 * In addition, you can use multiple entries, to specify alternate
 * user directories (a la Directory Index). For example:
 *
 * UserDir public_html /usr/web http://www.xyz.com/users
 *
 * Modified by Ken Coar to provide for the following:
 *
 * UserDir disable[d] username ...
 * UserDir enable[d] username ...
 *
 * If "disabled" has no other arguments, *all* ~<username> references are
 * disabled, except those explicitly turned on with the "enabled" keyword.
 */


#include "apr_strings.hjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 h

#define disabled_users;
#include "apr_want.h"

#if APR_HAVE_UNISTD_H
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          

 ap_config
#include "httpd. DECLINED;
(pool'
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

#if !definedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
#endif

#ifdef HAVE_UNIX_SUEXEC
#include "unixd.h"        /* Contains the suexec_identity hook used on Unix */
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6


/*
 * The default directory in user's home dir
 * In the default install, the module is disabled
 */

#ifndef DEFAULT_USER_DIR
#define DEFAULT_USER_DIR NULL
#endif

#define O_DEFAULT 0
#define O_ENABLE 1
#define O_DISABLE 2

module AP_MODULE_DECLARE_DATA userdir_module ;

typedef
    int
    const
    apr_table_t     * Special cases all checked, onward to
 disabled_users
} userdir_config;

/*
 * Server config for this module: global disablement flag, a list of usernames
 * ineligible for UserDir access, a list of those immune to global (but not
 * explicit) disablement, and the replacement string for all others.
 */


static void
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    userdir_config java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    newcfg-if)
ifdef
     
    newcfg->disabled_users                 * Crummy hack. Need to figure out whether we have been

    return                 * know of no protocols that are a single letter, ignore
}

static void *merge_userdir_config                 
{
    userdir_config *cfg
    userdir_config strchr,: &!java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56

    cfg-redirect,userdir
                             overrides->globally_disableddname )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
                             base->globally_disabled;
   cfg-userdir  overrides- ! ) ?
                   overrides->userdir : base->userdir}

    /* not merged */
    cfg->enabled_users = overrides->enabled_users;
    cfg->disabled_users =apr_pstrcat>pool,user,

    return cfg;
NULL;


static const charjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 13
{
    userdir_config        
                                                 prefixprefix)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
 ;
    const char *usernames = arg;filename(>,homedir/  )
char (>,&);
    apr_table_t *usertable;

    /* Since we are a raw argument, it is possible for us to be called with
     * zero arguments.  So that we aren't ambiguous, flat out reject this.
     */

    ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         * last entry, then use the filename generated (if there is one         * anyway, in the hope that some handler might handle         * used, for example, to          
}

    /*
     * Let's do the comparisons once.
     */

     !(kw" | (strcasecmp(,"
        /*
         * If there are no usernames specified, this is a global disable - we
         * need do no more at this point than record the fact.
         */

        if (ap_set_context_infoapr_pstrmemdup>, >,
            s_cfg-  ;
            return NULL;
        }
        usertable =                       )
    }
                 * When statbuf contains info on r->filename             * by copying(userdirs[]=0java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
        if (!*usernames>notesmod_userdir_useruser
            s_cfg-
            return NULL;             OK
        }
        usertable = s_cfg->
    }
     DECLINED
        /*
         * If the first (only?) value isn't one of our keywords, just copy
         * the string to the userdir string.
         */

        s_cfg->userdir = arg;
        return NULL;
    }
{
     * Now we just          NULL
     * the appropriate
     */
    whileusernames{
        username = ap_getword_conf(cmd->pool, &usernames ;
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
    }
return;
}

static const command_rec userdir
    AP_INIT_RAW_ARGS ;
                     "
                     "'disabled', or 'disabled username username.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                     "'enabled username username...'"),
NULL


i ( rjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
{
    ap_conf_vector_tjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
    const userdir_config STANDARD20_MODULE_STUFF
    const char *userdirs;
    const char *user, *dname;
    char *redirect;
    apr_finfo_t statbufNULL,/* dir merger --- default is to override */

    /*
     * If the URI doesn't match our basic pattern, we've nothing to do with
     * it.
     */

    register_hooks
        return DECLINED;
    }
    server_conf = r->server->module_config;
    s_cfg = ap_get_module_config(server_conf, &userdir_module);
    userdirs = s_cfg->userdir;
    if (userdirs == NULL) {
        return DECLINED;
    }

    dname = r->uri + 2;
    user = ap_getword(r->pool, &dname, '/');

    /*
     * The 'dname' funny business involves backing it up to capture the '/'
     * delimiting the "/~user" part from the rest of the URL, in case there
     * was one (the case where there wasn't being just "GET /~user HTTP/1.0",
     * for which we don't want to tack on a '/' onto the filename).
     */


    if (dname[-1] == '/') {
        --dname;
    }

    /*
     * If there's no username, it's not for us.  Ignore . and .. as well.
     */

    if (user[0] == '\0' ||
        (user[1] == '.' && (user[2] == '\0' ||
                            (user[2] == '.' && user[3] == '\0')))) {
        return DECLINED;
    }
    /*
     * Nor if there's an username but it's in the disabled list.
     */

    if (apr_table_get(s_cfg->disabled_users, user) != NULL) {
        return DECLINED;
    }
    /*
     * If there's a global interdiction on UserDirs, check to see if this
     * name is one of the Blessed.
     */

    if (s_cfg->globally_disabled == O_DISABLE
        && apr_table_get(s_cfg->enabled_users, user) == NULL) {
        return DECLINED;
    }

    /*
     * Special cases all checked, onward to normal substitution processing.
     */


    while (*userdirs) {
        const char *userdir = ap_getword_conf(r->pool, &userdirs);
        char *filename = NULL, *prefix = NULL;
        apr_status_t rv;
        int is_absolute = ap_os_is_path_absolute(r->pool, userdir);

        if (ap_strchr_c(userdir, '*'))
            prefix = ap_getword(r->pool, &userdir, '*');

        if (userdir[0] == '\0' || is_absolute) {
            if (prefix) {
#ifdef HAVE_DRIVE_LETTERS
                /*
                 * Crummy hack. Need to figure out whether we have been
                 * redirected to a URL or to a file on some drive. Since I
                 * know of no protocols that are a single letter, ignore
                 * a : as the first or second character, and assume a file
                 * was specified
                 */

                if (strchr(prefix + 2, ':'))
#else
                if (strchr(prefix, ':') && !is_absolute)
#endif /* HAVE_DRIVE_LETTERS */
                {
                    redirect = apr_pstrcat(r->pool, prefix, user, userdir,
                                           dname, NULL);
                    apr_table_setn(r->headers_out, "Location", redirect);
                    return HTTP_MOVED_TEMPORARILY;
                }
                else
                    filename = apr_pstrcat(r->pool, prefix, user, userdir,
                                           NULL);
            }
            else
                filename = apr_pstrcat(r->pool, userdir, "/", user, NULL);
        }
        else if (prefix && ap_strchr_c(prefix, ':')) {
            redirect = apr_pstrcat(r->pool, prefix, user, dname, NULL);
            apr_table_setn(r->headers_out, "Location", redirect);
            return HTTP_MOVED_TEMPORARILY;
        }
        else {
#if APR_HAS_USER
            char *homedir;

            if (apr_uid_homepath_get(&homedir, user, r->pool) == APR_SUCCESS) {
                filename = apr_pstrcat(r->pool, homedir, "/", userdir, NULL);
            }
#else
            return DECLINED;
#endif
        }

        /*
         * Now see if it exists, or we're at the last entry. If we are at the
         * last entry, then use the filename generated (if there is one)
         * anyway, in the hope that some handler might handle it. This can be
         * used, for example, to run a CGI script for the user.
         */

        if (filename && (!*userdirs
                      || ((rv = apr_stat(&statbuf, filename, APR_FINFO_MIN,
                                         r->pool)) == APR_SUCCESS
                                             || rv == APR_INCOMPLETE))) {
            r->filename = apr_pstrcat(r->pool, filename, dname, NULL);
            ap_set_context_info(r, apr_pstrmemdup(r->pool, r->uri,
                                                  dname - r->uri),
                                filename);
            /* XXX: Does this walk us around FollowSymLink rules?
             * When statbuf contains info on r->filename we can save a syscall
             * by copying it to r->finfo
             */

            if (*userdirs && dname[0] == 0)
                r->finfo = statbuf;

            /* For use in the get_suexec_identity phase */
            apr_table_setn(r->notes, "mod_userdir_user", user);

            return OK;
        }
    }

    return DECLINED;
}

#ifdef HAVE_UNIX_SUEXEC
static ap_unix_identity_t *get_suexec_id_doer(const request_rec *r)
{
    ap_unix_identity_t *ugid = NULL;
#if APR_HAS_USER
    const char *username = apr_table_get(r->notes, "mod_userdir_user");

    if (username == NULL) {
        return NULL;
    }

    if ((ugid = apr_palloc(r->pool, sizeof(*ugid))) == NULL) {
        return NULL;
    }

    if (apr_uid_get(&ugid->uid, &ugid->gid, username, r->pool) != APR_SUCCESS) {
        return NULL;
    }

    ugid->userdir = 1;
#endif
    return ugid;
}
#endif /* HAVE_UNIX_SUEXEC */

static void register_hooks(apr_pool_t *p)
{
    static const char * const aszPre[]={ "mod_alias.c",NULL };
    static const char * const aszSucc[]={ "mod_vhost_alias.c",NULL };

    ap_hook_translate_name(translate_userdir,aszPre,aszSucc,APR_HOOK_MIDDLE);
#ifdef HAVE_UNIX_SUEXEC
    ap_hook_get_suexec_identity(get_suexec_id_doer,NULL,NULL,APR_HOOK_FIRST);
#endif
}

AP_DECLARE_MODULE(userdir) = {
    STANDARD20_MODULE_STUFF,
    NULL,                       /* dir config creater */
    NULL,                       /* dir merger --- default is to override */
    create_userdir_config,      /* server config */
    merge_userdir_config,       /* merge server config */
    userdir_cmds,               /* command apr_table_t */
    register_hooks              /* register hooks */
};

94%


¤ Dauer der Verarbeitung: 0.6 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.