dparrish / libcli

Libcli provides a shared library for including a Cisco-like command-line interface into other software. It's a telnet interface which supports command-line editing, history, authentication and callbacks for a user-definable function tree.
https://dparrish.com/link/libcli
GNU Lesser General Public License v2.1
289 stars 143 forks source link

Correct quote parsing and allow for 'escaping' quotes #53

Closed RobSanders closed 4 years ago

RobSanders commented 4 years ago

Currently cli_parse_line() is not correctly several types of lines with quotes. For example (ignore quotes for the 'parsed' output):

Note that in all 3 cases text is lost. Ideally libcli should support:

Open question on how two properly quoted strings without whitespace separating them should be handled. Combined into a single string, or converted into two separate tokens?

RobSanders commented 4 years ago

Currently when libcli detects a 'new' quote it starts a new word(possibly discarding anything before the new quote). So parsing the fragment \<"alpha"beta> you would get words \<alpha> and \<beta>. Suggest with the patch that libcli should treat any (unless escaped) quote as an implicit 'word' separator.

RobSanders commented 4 years ago

Fixed in 1.10.3