On Tue, Apr 25, 2017 at 13:08 -0600, Todd C. Miller wrote:
> I don't have any objection to this but if it is committed a
> similar change should be made to check_login_epsvall.
> 
>  - todd

Indeed, it supresses errors from PORT and the like, while
keeping the "530 Please login with USER and PASS.".

Before:

    USER foo
    331 Password required for foo.
    PORT 12567
    530 Please login with USER and PASS.
    500 'PORT 12567': command not understood.

After:

    USER foo
    331 Password required for foo.
    PORT 12567
    530 Please login with USER and PASS.

OK?

Index: libexec/ftpd/ftpcmd.y
===================================================================
RCS file: /home/cvs/src/libexec/ftpd/ftpcmd.y,v
retrieving revision 1.65
diff -u -p -U5 -r1.65 ftpcmd.y
--- libexec/ftpd/ftpcmd.y       17 Apr 2017 21:49:01 -0000      1.65
+++ libexec/ftpd/ftpcmd.y       26 Apr 2017 17:36:11 -0000
@@ -954,20 +954,24 @@ check_login
                        if (logged_in)
                                $$ = 1;
                        else {
                                reply(530, "Please login with USER and PASS.");
                                $$ = 0;
+                               state = 0;
+                               YYABORT;
                        }
                }
        ;
 
 check_login_epsvall
        : /* empty */
                {
                        if (!logged_in) {
                                reply(530, "Please login with USER and PASS.");
                                $$ = 0;
+                               state = 0;
+                               YYABORT;
                        } else if (epsvall) {
                                reply(501, "the command is disallowed "
                                    "after EPSV ALL");
                                usedefault = 1;
                                $$ = 0;

Reply via email to