Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/usr.sbin/faithd Pull up revision 1.10 (requested by ito...



details:   https://anonhg.NetBSD.org/src/rev/c81faa32b6c0
branches:  netbsd-1-6
changeset: 528065:c81faa32b6c0
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Jun 24 06:10:04 2002 +0000

description:
Pull up revision 1.10 (requested by itojun in ticket #355):
correct ftp relay functionality.

diffstat:

 usr.sbin/faithd/ftp.c |  33 +++++++++++++--------------------
 1 files changed, 13 insertions(+), 20 deletions(-)

diffs (91 lines):

diff -r 313e050f8f8b -r c81faa32b6c0 usr.sbin/faithd/ftp.c
--- a/usr.sbin/faithd/ftp.c     Mon Jun 24 05:06:27 2002 +0000
+++ b/usr.sbin/faithd/ftp.c     Mon Jun 24 06:10:04 2002 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ftp.c,v 1.8 2002/04/24 12:14:42 itojun Exp $   */
-/*     $KAME: ftp.c,v 1.14 2002/04/24 08:17:23 itojun Exp $    */
+/*     $NetBSD: ftp.c,v 1.8.2.1 2002/06/24 06:10:04 lukem Exp $        */
+/*     $KAME: ftp.c,v 1.18 2002/06/23 14:41:47 itojun Exp $    */
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -88,27 +88,25 @@
 
                FD_ZERO(&readfds);
                FD_SET(ctl4, &readfds);
+               maxfd = ctl4;
                FD_SET(ctl6, &readfds);
+               maxfd = (ctl6 > maxfd) ? ctl6 : maxfd;
                if (0 <= port4) {
                        FD_SET(port4, &readfds);
-                       if (port4 > maxfd)
-                               maxfd = port4;
+                       maxfd = (port4 > maxfd) ? port4 : maxfd;
                }
                if (0 <= port6) {
                        FD_SET(port6, &readfds);
-                       if (port6 > maxfd)
-                               maxfd = port6;
+                       maxfd = (port6 > maxfd) ? port6 : maxfd;
                }
 #if 0
                if (0 <= wport4) {
                        FD_SET(wport4, &readfds);
-                       if (wport4 > maxfd)
-                               maxfd = wport4;
+                       maxfd = (wport4 > maxfd) ? wport4 : maxfd;
                }
                if (0 <= wport6) {
                        FD_SET(wport6, &readfds);
-                       if (wport6 > maxfd)
-                               maxfd = wport6;
+                       maxfd = (wport6 > maxfd) ? wport6 : maxfd;
                }
 #endif
                tv.tv_sec = FAITH_TIMEOUT;
@@ -133,16 +131,13 @@
                         */
                        error = ftp_copycommand(ctl6, ctl4, &state);
 
-                       switch (error) {
-                       case -1:
+                       if (error < 0)
                                goto bad;
-                       case 0:
+                       else if (error == 0) {
                                close(ctl4);
                                close(ctl6);
                                exit_success("terminating ftp control connection");
                                /*NOTREACHED*/
-                       default:
-                               break;
                        }
                }
                if (FD_ISSET(ctl4, &readfds)) {
@@ -152,16 +147,13 @@
                         */
                        error = ftp_copyresult(ctl4, ctl6, state);
 
-                       switch (error) {
-                       case -1:
+                       if (error < 0)
                                goto bad;
-                       case 0:
+                       else if (error == 0) {
                                close(ctl4);
                                close(ctl6);
                                exit_success("terminating ftp control connection");
                                /*NOTREACHED*/
-                       default:
-                               break;
                        }
                }
                if (0 <= port4 && 0 <= port6 && FD_ISSET(port4, &readfds)) {
@@ -514,6 +506,7 @@
                        n = snprintf(sbuf, sizeof(sbuf),
                                "500 could not translate from PASV\r\n");
                        if (n < 0 || n >= sizeof(sbuf))
+                               n = 0;
                        if (n)
                                write(src, sbuf, n);
                        return n;



Home | Main Index | Thread Index | Old Index