Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 50611 | Differences between
and this patch

Collapse All | Expand All

(-)apache_1.3.33/src/modules/standard/mod_dir.c (-11 / +78 lines)
Lines 30-35 Link Here
30
30
31
typedef struct dir_config_struct {
31
typedef struct dir_config_struct {
32
    array_header *index_names;
32
    array_header *index_names;
33
	array_header *index_names_incr;
33
} dir_config_rec;
34
} dir_config_rec;
34
35
35
#define DIR_CMD_PERMS OR_INDEXES
36
#define DIR_CMD_PERMS OR_INDEXES
Lines 45-55 Link Here
45
    return NULL;
46
    return NULL;
46
}
47
}
47
48
49
static const char *addincr_index(cmd_parms *cmd, dir_config_rec *d, char *arg)
50
{
51
    if (!d->index_names_incr) {
52
	d->index_names_incr = ap_make_array(cmd->pool, 2, sizeof(char *));
53
    }
54
    *(char **)ap_push_array(d->index_names_incr) = arg;
55
    return NULL;
56
}
57
58
static const char *rem_index(cmd_parms * cmd, dir_config_rec *d, char *arg)
59
{
60
	array_header *keep;
61
	array_header *keep_incr;
62
	char **names_ptr;
63
	int num_names;
64
65
	keep = ap_make_array(cmd->pool, 2, sizeof(char *));
66
	keep_incr = ap_make_array(cmd->pool, 2, sizeof(char *));
67
68
	if (d->index_names) {
69
		names_ptr = (char **)d->index_names->elts;
70
		num_names = d->index_names->nelts;
71
72
		for (; num_names; ++names_ptr, --num_names) {
73
			char *name_ptr = *names_ptr;
74
75
			if (strcmp(name_ptr, arg) != 0 ) {
76
				*(char **)ap_push_array(keep) = name_ptr;
77
			}
78
		}
79
		d->index_names = keep;
80
	}
81
82
	if (d->index_names_incr) {
83
		names_ptr = (char **)d->index_names_incr->elts;
84
		num_names = d->index_names_incr->nelts;
85
86
		for (; num_names; ++names_ptr, --num_names) {
87
			char *name_ptr = *names_ptr;
88
89
			if (strcmp(name_ptr, arg) != 0 ) {
90
				*(char **)ap_push_array(keep_incr) = name_ptr;
91
			}
92
		}
93
		d->index_names_incr = keep_incr;
94
	}
95
	
96
	return NULL;
97
}
98
48
static const command_rec dir_cmds[] =
99
static const command_rec dir_cmds[] =
49
{
100
{
50
    {"DirectoryIndex", add_index, NULL,
101
    {"DirectoryIndex", add_index, NULL,
51
     DIR_CMD_PERMS, ITERATE,
102
     DIR_CMD_PERMS, ITERATE,
52
     "a list of file names"},
103
     "a list of file names"},
104
    {"AddDirectoryIndex", addincr_index, NULL,
105
     DIR_CMD_PERMS, ITERATE,
106
     "a list of file names"},
107
    {"RemoveDirectoryIndex", rem_index, NULL,
108
     DIR_CMD_PERMS, ITERATE,
109
     "a list of file names"},
53
    {NULL}
110
    {NULL}
54
};
111
};
55
112
Lines 59-64 Link Here
59
    (dir_config_rec *) ap_pcalloc(p, sizeof(dir_config_rec));
116
    (dir_config_rec *) ap_pcalloc(p, sizeof(dir_config_rec));
60
117
61
    new->index_names = NULL;
118
    new->index_names = NULL;
119
	new->index_names_incr = NULL;
62
    return (void *) new;
120
    return (void *) new;
63
}
121
}
64
122
Lines 69-74 Link Here
69
    dir_config_rec *add = (dir_config_rec *) addv;
127
    dir_config_rec *add = (dir_config_rec *) addv;
70
128
71
    new->index_names = add->index_names ? add->index_names : base->index_names;
129
    new->index_names = add->index_names ? add->index_names : base->index_names;
130
    new->index_names_incr = ap_append_arrays(p, base->index_names, add->index_names);
72
    return new;
131
    return new;
73
}
132
}
74
133
Lines 77-83 Link Here
77
    dir_config_rec *d =
136
    dir_config_rec *d =
78
    (dir_config_rec *) ap_get_module_config(r->per_dir_config,
137
    (dir_config_rec *) ap_get_module_config(r->per_dir_config,
79
                                         &dir_module);
138
                                         &dir_module);
80
    char *dummy_ptr[1];
81
    char **names_ptr;
139
    char **names_ptr;
82
    int num_names;
140
    int num_names;
83
    int error_notfound = 0;
141
    int error_notfound = 0;
Lines 105-120 Link Here
105
        r->filename = ap_pstrcat(r->pool, r->filename, "/", NULL);
163
        r->filename = ap_pstrcat(r->pool, r->filename, "/", NULL);
106
    }
164
    }
107
165
108
    if (d->index_names) {
166
	/* Merge index_names and index_names_incr */
109
	names_ptr = (char **)d->index_names->elts;
167
	array_header *index_names;
110
	num_names = d->index_names->nelts;
168
 
111
    }
169
	if (d->index_names) {
112
    else {
170
		if (d->index_names_incr) {
113
	dummy_ptr[0] = DEFAULT_INDEX;
171
			index_names = ap_append_arrays(r->pool, d->index_names, d->index_names_incr);
114
	names_ptr = dummy_ptr;
172
		} else {
115
	num_names = 1;
173
			index_names = d->index_names;
116
    }
174
		}
117
175
	} else if (d->index_names_incr) {
176
		index_names = d->index_names_incr;
177
	} else {
178
        index_names = ap_make_array(r->pool, 2, sizeof(char *));
179
    	*(const char **)ap_push_array(index_names) = DEFAULT_INDEX;
180
	}
181
182
	names_ptr = (char **)index_names->elts;
183
	num_names = index_names->nelts;
184
		
118
    for (; num_names; ++names_ptr, --num_names) {
185
    for (; num_names; ++names_ptr, --num_names) {
119
        char *name_ptr = *names_ptr;
186
        char *name_ptr = *names_ptr;
120
        request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r);
187
        request_rec *rr = ap_sub_req_lookup_uri(name_ptr, r);

Return to bug 50611