Project

General

Profile

Bug #1826 » mod_webdav_POSIX_readdir-upd.patch

gstrauss, 2016-03-30 15:22

View differences:

src/mod_webdav.c
prop_200 = buffer_init();
prop_404 = buffer_init();
switch(depth) {
case 0:
/* Depth: 0 */
{
/* Depth: 0 or Depth: 1 */
webdav_get_props(srv, con, p, &(con->physical), req_props, prop_200, prop_404);
buffer_append_string_len(b,CONST_STR_LEN("<D:response>\n"));
......
}
buffer_append_string_len(b,CONST_STR_LEN("</D:response>\n"));
}
if (depth == 1) {
break;
case 1:
if (NULL != (dir = opendir(con->physical.path->ptr))) {
struct dirent *de;
physical d;
......
d.rel_path = buffer_init();
while(NULL != (de = readdir(dir))) {
if (de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0') {
if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || (de->d_name[1] == '.' && de->d_name[2] == '\0'))) {
continue;
/* ignore the parent dir */
/* ignore the parent and target dir */
}
buffer_copy_buffer(d.path, dst->path);
......
buffer_copy_buffer(d.rel_path, dst->rel_path);
buffer_append_slash(d.rel_path);
if (de->d_name[0] == '.' && de->d_name[1] == '\0') {
/* don't append the . */
} else {
buffer_append_string(d.path, de->d_name);
buffer_append_string(d.rel_path, de->d_name);
}
buffer_append_string(d.path, de->d_name);
buffer_append_string(d.rel_path, de->d_name);
buffer_reset(prop_200);
buffer_reset(prop_404);
......
buffer_free(d.path);
buffer_free(d.rel_path);
}
break;
}
if (req_props) {
(2-2/2)