this issue is in net-analyzer/netcat-110-r8 too netcat -c does not use /bin/sh -c but works like -e Reproducible: Always Steps to Reproduce: 1. A $ ssh -o ProxyCommand='nc -l 127.0.0.1 -p 1024' a@a 2. B $ nc localhost 1024 -c '/usr/bin/nc localhost 22' Actual Results: A: output: exec /usr/bin/nc localhost 2222 failed : No such file or directory B: no output Expected Results: A: output: SSH-2.0-OpenSSH_5.8p1-hpn13v10 B: no output the follow is tail part of strace -f nc localhost 1024 -c '/usr/bin/nc localhost 2222' rt_sigaction(SIGALRM, {SIG_IGN, [ALRM], SA_RESTORER|SA_RESTART, 0x38ee231d70}, {SIG_IGN, [ALRM], SA_RESTORER|SA_RESTART, 0x38ee231d70}, 8) = 0 alarm(0) = 0 dup2(3, 0) = 0 close(3) = 0 dup2(0, 1) = 1 dup2(0, 2) = 2 execve("/usr/bin/nc localhost 2222", ["nc localhost 2222"], [/* 41 vars */]) = -1 ENOENT (No such file or directory) write(2, "exec /usr/bin/nc localhost 2222 "..., 38) = 38 write(2, " : No such file or directory\n", 29) = 29 close(3) = -1 EBADF (Bad file descriptor) exit_group(1) = ?
Created attachment 433580 [details, diff] patch to have -c option of good functional I also encountered the same situation by the follower steps: 1. server to listen on port 4000 # nc -v -l -p 4000 2. client try to connected with -c option # nc -v -c date localhost 4000 the output will be the "... no such file or directory" And the attached patch can solve this. Tks!
this was fixed in netcat-110-r9