Don't just send data in plain when doing NLST.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@595 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1996-06-16 02:26:19 +00:00
parent d5948ffbc6
commit c2c3535e02

View File

@@ -1698,6 +1698,8 @@ send_file_list(char *whichf)
int freeglob = 0; int freeglob = 0;
glob_t gl; glob_t gl;
char buf[MaxPathLen];
if (strpbrk(whichf, "~{[*?") != NULL) { if (strpbrk(whichf, "~{[*?") != NULL) {
int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE; int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
@@ -1750,8 +1752,9 @@ send_file_list(char *whichf)
goto out; goto out;
transflag++; transflag++;
} }
fprintf(dout, "%s%s\n", dirname, sprintf(buf, "%s%s\n", dirname,
type == TYPE_A ? "\r" : ""); type == TYPE_A ? "\r" : "");
auth_write(fileno(dout), buf, strlen(buf));
byte_count += strlen(dirname) + 1; byte_count += strlen(dirname) + 1;
continue; continue;
} else if (!S_ISDIR(st.st_mode)) } else if (!S_ISDIR(st.st_mode))
@@ -1775,26 +1778,25 @@ send_file_list(char *whichf)
* not a directory or special file. * not a directory or special file.
*/ */
if (simple || (stat(nbuf, &st) == 0 && if (simple || (stat(nbuf, &st) == 0 &&
S_ISREG(st.st_mode))) { S_ISREG(st.st_mode))) {
if (dout == NULL) { if (dout == NULL) {
dout = dataconn("file list", (off_t)-1, dout = dataconn("file list", (off_t)-1, "w");
"w"); if (dout == NULL)
if (dout == NULL) goto out;
goto out; transflag++;
transflag++; }
} if(strncmp(nbuf, "./", 2) == 0)
if (nbuf[0] == '.' && nbuf[1] == '/') sprintf(buf, "%s%s\n", nbuf +2,
fprintf(dout, "%s%s\n", &nbuf[2], type == TYPE_A ? "\r" : "");
type == TYPE_A ? "\r" : ""); else
else sprintf(buf, "%s%s\n", nbuf,
fprintf(dout, "%s%s\n", nbuf, type == TYPE_A ? "\r" : "");
type == TYPE_A ? "\r" : ""); auth_write(fileno(dout), buf, strlen(buf));
byte_count += strlen(nbuf) + 1; byte_count += strlen(nbuf) + 1;
} }
} }
(void) closedir(dirp); (void) closedir(dirp);
} }
if (dout == NULL) if (dout == NULL)
reply(550, "No files found."); reply(550, "No files found.");
else if (ferror(dout) != 0) else if (ferror(dout) != 0)
@@ -1803,8 +1805,11 @@ send_file_list(char *whichf)
reply(226, "Transfer complete."); reply(226, "Transfer complete.");
transflag = 0; transflag = 0;
if (dout != NULL) if (dout != NULL){
(void) fclose(dout); auth_write(fileno(dout), buf, 0); /* XXX flush */
(void) fclose(dout);
}
data = -1; data = -1;
pdata = -1; pdata = -1;
out: out: