diff options
author | yar <yar@FreeBSD.org> | 2002-08-29 09:23:08 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2002-08-29 09:23:08 +0000 |
commit | c4deb81f31fa64ebcfd4c46ef6f6b583c12d1521 (patch) | |
tree | b5ce8cf78b04d66325a971f14b49520255be3344 /libexec | |
parent | 546572651326fb68958d7f06ce2de556b6f040a0 (diff) | |
download | FreeBSD-src-c4deb81f31fa64ebcfd4c46ef6f6b583c12d1521.zip FreeBSD-src-c4deb81f31fa64ebcfd4c46ef6f6b583c12d1521.tar.gz |
Fix lexer jam on unimplemented commands.
Submitted by: maxim
MFC after: 5 days
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ftpd/ftpcmd.y | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 6f038be..ec11dcd 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -136,7 +136,7 @@ extern int epsvall; UMASK IDLE CHMOD MDFIVE - LEXERR + LEXERR NOTIMPL %token <s> STRING %token <u> NUMBER @@ -145,7 +145,7 @@ extern int epsvall; %type <u.i> check_login_ro check_login_epsv %type <u.i> struct_code mode_code type_code form_code %type <s> pathstring pathname password username -%type <s> ALL +%type <s> ALL NOTIMPL %start cmd_list @@ -752,11 +752,15 @@ cmd reply(221, "Goodbye."); dologout(0); } + | NOTIMPL + { + nack($1); + } | error { yyclearin; /* discard lookahead data */ yyerrok; /* clear error condition */ - state = 0; /* reset lexer state */ + state = CMD; /* reset lexer state */ } ; rcmd @@ -1289,12 +1293,10 @@ yylex(void) p = lookup(cmdtab, cbuf); cbuf[cpos] = c; if (p != 0) { - if (p->implemented == 0) { - nack(p->name); - return (LEXERR); - } - state = p->state; yylval.s = p->name; + if (!p->implemented) + return (NOTIMPL); /* state remains CMD */ + state = p->state; return (p->token); } break; @@ -1313,13 +1315,12 @@ yylex(void) p = lookup(sitetab, cp); cbuf[cpos] = c; if (guest == 0 && p != 0) { - if (p->implemented == 0) { + yylval.s = p->name; + if (!p->implemented) { state = CMD; - nack(p->name); - return (LEXERR); + return (NOTIMPL); } state = p->state; - yylval.s = p->name; return (p->token); } state = CMD; |