Repository navigation
Fix known bugs - #103
Closed
lynch1981 wants to merge 11 commits into
Closed
Fix known bugs#103lynch1981 wants to merge 11 commits into
lynch1981 wants to merge 11 commits into
Conversation
A Test::Base harness drives cli_loop() over a socketpair under
AddressSanitizer ("make test") and valgrind ("make test-valgrind").
Seven SKIP blocks document reproduced bugs as ready-to-enable
regression tests.
See t/README.md for the design, block format, fixtures, and the
known-bug catalog.
* Simplify Makefile: static lib by default, Linux only - Build libcli.a by default; the shared library is opt-in via DYNAMIC_LIB=1 - Always build clitest, linked against the static library (drop TESTS) - Drop the uname/Darwin handling; Linux is the only supported platform - Remove the uninstall, rpm, rpmprep, clitest.exe and test-valgrind targets - Add .PHONY for the remaining non-file targets
* Add USE_ASAN option for the test driver, build it plain by default t/cli_driver is now built without sanitizers unless USE_ASAN is set, so the same driver works under valgrind.
cli_register_optarg() jumps to its cleanup path with optarg still NULL when the name already exists, and cli_free_optarg() then dereferenced it. Make cli_free_optarg() NULL-safe and enable the regression test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cli_int_enter_buildmode() frees cli->buildmode on every error path, but cli_loop() then printed cli->buildmode->cname. Report the failure using the entered command line instead, drop the redundant free, and enable the regression test with a check on the failure message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The block exercises optarg registration, not completion, so move it next to the other cross-cutting bug blocks and renumber completion.t. known_bugs.t now holds fixed (live) blocks as well as unfixed SKIP ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both completion branches erased the current word and copied the completion into the CLI_MAX_LINE_LENGTH buffer without a length check. Find the word start first (new cli_int_word_start() helper), ring the bell instead of completing when the result would not fit with its NUL terminator, and always terminate the buffer. Enable the regression test and add a boundary test showing that a completion which exactly fits still completes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cli_free_command() updated the previous/next siblings and cli->commands but not parent->children, so freeing a parent's first child left the parent pointing at freed memory. Move parent->children on to the next sibling. Enable the regression test and also check that the parent still resolves after its child is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cli_allow_enable() strdup's cli->enable_password but cli_done() never freed it. Free it, and drop the valgrind suppression that hid the leak so the valgrind run now covers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The auth and enable callbacks get only the typed strings, so a threaded server cannot tell which session is logging in, and cannot end a session after repeated failures. Add: - cli_set_auth_callback_ctx() and cli_set_enable_callback_ctx(): the callback also gets the cli_def. It returns CLI_OK to accept, CLI_QUIT to end the session, anything else to deny. The line after the unechoed password is ended first, so its messages start on their own line. - cli_read_password(): reads a line without echo from inside a command callback, e.g. for "username bob secret". The line stays out of the history; ctrl-c cancels; telnet options are skipped; the idle timeout applies. - Typed usernames and passwords, and the enable password, are wiped before they are freed. A failed strdup() in the login states now leaves cli_loop() through its cleanup instead of returning early. New t/auth.t covers both callbacks and cli_read_password() with the new auth_ctx fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.