Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ftpd fix previous, and ensure that closedataconn() i...
details: https://anonhg.NetBSD.org/src/rev/fbbb9b491304
branches: trunk
changeset: 521526:fbbb9b491304
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Feb 01 04:35:30 2002 +0000
description:
fix previous, and ensure that closedataconn() is only called after dataconn()
and with a non-NULL file pointer. active transfers now work correctly again,
passive transfers work, and the data stream is only closed after a PASV or
EPSV if a successful connection was initiated with dataconn().
diffstat:
libexec/ftpd/cmds.c | 9 +++++----
libexec/ftpd/ftpd.c | 13 +++++--------
libexec/ftpd/version.h | 4 ++--
3 files changed, 12 insertions(+), 14 deletions(-)
diffs (104 lines):
diff -r fc25ed032a02 -r fbbb9b491304 libexec/ftpd/cmds.c
--- a/libexec/ftpd/cmds.c Fri Feb 01 01:32:20 2002 +0000
+++ b/libexec/ftpd/cmds.c Fri Feb 01 04:35:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmds.c,v 1.14 2002/01/17 05:21:47 itojun Exp $ */
+/* $NetBSD: cmds.c,v 1.15 2002/02/01 04:35:30 lukem Exp $ */
/*
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: cmds.c,v 1.14 2002/01/17 05:21:47 itojun Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.15 2002/02/01 04:35:30 lukem Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -246,12 +246,13 @@
perror_reply(501, path);
return;
}
+ if ((dirp = opendir(path)) == NULL)
+ goto mlsdperror;
+
dout = dataconn("MLSD", (off_t)-1, "w");
if (dout == NULL)
return;
- if ((dirp = opendir(path)) == NULL)
- goto mlsdperror;
f.stat = &sb;
while ((dp = readdir(dirp)) != NULL) {
snprintf(name, sizeof(name), "%s/%s", path, dp->d_name);
diff -r fc25ed032a02 -r fbbb9b491304 libexec/ftpd/ftpd.c
--- a/libexec/ftpd/ftpd.c Fri Feb 01 01:32:20 2002 +0000
+++ b/libexec/ftpd/ftpd.c Fri Feb 01 04:35:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpd.c,v 1.136 2002/01/21 11:25:20 lukem Exp $ */
+/* $NetBSD: ftpd.c,v 1.137 2002/02/01 04:35:31 lukem Exp $ */
/*
* Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
@@ -109,7 +109,7 @@
#if 0
static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: ftpd.c,v 1.136 2002/01/21 11:25:20 lukem Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.137 2002/02/01 04:35:31 lukem Exp $");
#endif
#endif /* not lint */
@@ -1284,8 +1284,7 @@
(void)gettimeofday(&start, NULL);
sendrv = send_data(fin, dout, st.st_blksize, isdata);
(void)gettimeofday(&finish, NULL);
- (void) fclose(dout); /* close now to affect timing stats */
- dout = NULL;
+ closedataconn(dout); /* close now to affect timing stats */
timersub(&finish, &start, &td);
tdp = &td;
done:
@@ -1324,7 +1323,6 @@
reply(226, "Transfer complete.");
}
cleanupretrieve:
- closedataconn(dout);
if (stderrfd != -1)
(void)close(stderrfd);
if (isconversion)
@@ -1399,15 +1397,14 @@
reply(226, "Transfer complete.");
}
(void)gettimeofday(&finish, NULL);
- (void) fclose(din); /* close now to affect timing stats */
- din = NULL;
+ closedataconn(din); /* close now to affect timing stats */
timersub(&finish, &start, &td);
tdp = &td;
done:
logxfer(desc, byte_count, name, NULL, tdp, NULL);
(*closefunc)(fout);
cleanupstore:
- closedataconn(din);
+ ;
}
static FILE *
diff -r fc25ed032a02 -r fbbb9b491304 libexec/ftpd/version.h
--- a/libexec/ftpd/version.h Fri Feb 01 01:32:20 2002 +0000
+++ b/libexec/ftpd/version.h Fri Feb 01 04:35:30 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.39 2002/01/21 11:25:21 lukem Exp $ */
+/* $NetBSD: version.h,v 1.40 2002/02/01 04:35:31 lukem Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -36,5 +36,5 @@
*/
#ifndef FTPD_VERSION
-#define FTPD_VERSION "NetBSD-ftpd 20020121"
+#define FTPD_VERSION "NetBSD-ftpd 20020201"
#endif
Home |
Main Index |
Thread Index |
Old Index