Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncat server leaves the socket open in child processes #2843

Open
m42a opened this issue May 16, 2024 · 0 comments
Open

ncat server leaves the socket open in child processes #2843

m42a opened this issue May 16, 2024 · 0 comments
Labels

Comments

@m42a
Copy link

m42a commented May 16, 2024

Describe the bug
In server mode, when running a command with -e or -c, ncat does not close the socket before executing the child process. Since the parent process exits when the client stops sending data, this can incorrectly cause the client to think more data is incoming.

To Reproduce

ncat -l 1234 -c 'sleep 1; echo response'
echo request | ncat 127.0.0.1 1234

When both commands are run in parallel, the server ncat will exit as soon as the client connects, but the client will wait for a second before the socket is closed (with no response data) by sh exiting.

Expected behavior
When a client has stopped sending data, ncat should either:

  1. Exit the server and fully close the connection without waiting for the child to finish.
  2. Wait for the child to finish sending output before exiting.

Option 2 is what I would prefer, but is a bigger change than option 1. In both cases though, there is no reason for the child process to keep the socket open.

Version info (please complete the following information):

  • OS: Linux 6.8.2
  • Output of ncat --version: Ncat: Version 7.94 ( https://nmap.org/ncat )
@m42a m42a added the Ncat label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant