Hello all, I would like to document the reason behind two recent commits that change code in the Bison parser and in the corresponding handcrafted scanner in the file "ftpd/ftpcmd.y".
In commit 5f59063, "ftpd: Setting of idle time.", the old misbehaviour ftp> idle 200 Current IDLE time limit is 900 seconds; max 7200 ftp> idle 800 500 'SITE IDLE 800': command not understood. was corrected to the expected ftp> idle 200 Current IDLE time limit is 900 seconds; max 7200 ftp> idle 800 200 Maximum IDLE time set to 800 seconds This malfunction seems to be there from the very beginning, since the parser rule for "site idle number" was not written properly to capture the intended syntax. In commit 1d9298c, "ftpd: Capture syntax errors.", the old unhelpful responses ftp> umask first 500 'SITE UMASK first': command not understood. ftp> chmod second second 500 'SITE UMASK first': command not understood. ftp> chmod third third 500 'SITE CHMOD second second': command not understood. ftp> quote noop 500 'SITE CHMOD third third': command not understood. ftp> reset 200 NOOP command successful. (observe the mismatched responses to commands; a "reset" is needed to recover) have been corrected to produce ftp> umask first 500 'SITE UMASK first': syntax error ftp> chmod second second 500 'SITE UMASK second second': syntax error ftp> chmod third third 500 'SITE CHMOD third third': syntax error ftp> quote noop 200 NOOP command successful. In addition, unknown commands see a new response: ftp> quote unknown 500 'UNKNOWN': command not recognized Also this misbehaviour on syntax errors is very old, in addition to the fact that the user never got to see the hint that a syntax error had indeed been identified. The causes have been identified as too eagerly calling yyerror() in the scanner, and also having the scanner to abort an evaluation where continued evaluation would have enabled the parser to detect the syntax error, thus avoiding to send two error messages to the client. As said initially, this explanation is written for the record. As a side effect, commit 88488eb, "ftpd: Implement FEAT and OPTS.", should improve the response of our server program when it talks to mechanized client software of more recent dates. Best regards, Mats E A