Ticket #1473: mod_userdir.patch

File mod_userdir.patch, 1.9 kB (added by kadlec@mail.kfki.hu, 6 months ago)
  • src/mod_userdir.c

    old new  
    2121        array *include_user; 
    2222        buffer *path; 
    2323        buffer *basepath; 
     24        unsigned short letterhomes; 
    2425} plugin_config; 
    2526 
    2627typedef struct { 
     
    8788                { "userdir.exclude-user",       NULL, T_CONFIG_ARRAY,  T_CONFIG_SCOPE_CONNECTION },       /* 1 */ 
    8889                { "userdir.include-user",       NULL, T_CONFIG_ARRAY,  T_CONFIG_SCOPE_CONNECTION },       /* 2 */ 
    8990                { "userdir.basepath",           NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },       /* 3 */ 
     91                { "userdir.letterhomes",        NULL, T_CONFIG_BOOLEAN,T_CONFIG_SCOPE_CONNECTION },       /* 4 */ 
    9092                { NULL,                         NULL, T_CONFIG_UNSET,  T_CONFIG_SCOPE_UNSET } 
    9193        }; 
    9294 
     
    102104                s->include_user = array_init(); 
    103105                s->path = buffer_init(); 
    104106                s->basepath = buffer_init(); 
     107                s->letterhomes = 0; 
    105108 
    106109                cv[0].destination = s->path; 
    107110                cv[1].destination = s->exclude_user; 
    108111                cv[2].destination = s->include_user; 
    109112                cv[3].destination = s->basepath; 
     113                cv[4].destination = &(s->letterhomes); 
    110114 
    111115                p->config_storage[i] = s; 
    112116 
     
    128132        PATCH(exclude_user); 
    129133        PATCH(include_user); 
    130134        PATCH(basepath); 
     135        PATCH(letterhomes); 
    131136 
    132137        /* skip the first, the global context */ 
    133138        for (i = 1; i < srv->config_context->used; i++) { 
     
    149154                                PATCH(include_user); 
    150155                        } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.basepath"))) { 
    151156                                PATCH(basepath); 
     157                        } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("userdir.letterhomes"))) { 
     158                                PATCH(letterhomes); 
    152159                        } 
    153160                } 
    154161        } 
     
    253260 
    254261                buffer_copy_string_buffer(p->temp_path, p->conf.basepath); 
    255262                BUFFER_APPEND_SLASH(p->temp_path); 
     263                if (p->conf.letterhomes) { 
     264                        buffer_append_string_len(p->temp_path, p->username->ptr, 1); 
     265                        BUFFER_APPEND_SLASH(p->temp_path); 
     266                } 
    256267                buffer_append_string_buffer(p->temp_path, p->username); 
    257268        } 
    258269        BUFFER_APPEND_SLASH(p->temp_path);