--- modules/proxy/mod_proxy_ftp.c (revision 570820) +++ modules/proxy/mod_proxy_ftp.c (working copy) @@ -504,9 +504,7 @@ /* a directory/file? */ else if (ctx->buffer[0] == 'd' || ctx->buffer[0] == '-' || ctx->buffer[0] == 'l' || apr_isdigit(ctx->buffer[0])) { - int searchidx = 0; char *searchptr = NULL; - int firstfile = 1; if (apr_isdigit(ctx->buffer[0])) { /* handle DOS dir */ searchptr = strchr(ctx->buffer, '<'); if (searchptr != NULL) @@ -514,22 +512,24 @@ searchptr = strchr(ctx->buffer, '>'); if (searchptr != NULL) *searchptr = ']'; + filename = strrchr(ctx->buffer, ' '); + *(filename++) = '\0'; + } else { + /* Assume it is a unix format. Unless we find out using + * a SYST at the begining, we do not have a way to know for sure.*/ + /* Unix ls -l format: + * perm links owner group bytes month day hour:min path + */ + int cchars = 0; + char* f = ctx->buffer; + for(cchars = 0; cchars < 8; ++cchars) { + f = strchr(f, ' '); + while(*(++f) == ' '); + } + *(f-1) = '\0'; + filename = f; } - filename = strrchr(ctx->buffer, ' '); - *(filename++) = '\0'; - - /* handle filenames with spaces in 'em */ - if (!strcmp(filename, ".") || !strcmp(filename, "..") || firstfile) { - firstfile = 0; - searchidx = filename - ctx->buffer; - } - else if (searchidx != 0 && ctx->buffer[searchidx] != 0) { - *(--filename) = ' '; - ctx->buffer[searchidx - 1] = '\0'; - filename = &ctx->buffer[searchidx]; - } - /* Append a slash to the HREF link for directories */ if (!strcmp(filename, ".") || !strcmp(filename, "..") || ctx->buffer[0] == 'd') { str = apr_psprintf(p, "%s %s\n",