[sslh] Wrong pid in pidfile and foreground option broken on sslh-fork (double fork)

Guillaume Delacour gui at iroqwa.org
Mon Aug 15 20:42:32 CEST 2011


Hello,

There is a problem with sslh-fork binary: when starting, the pid stored
in the pidfile is wrong:

$ > /tmp/sslh.pid
$ ./sslh-fork -u gui -p 127.0.0.1:9002 --ssh 127.0.0.1:9000 --ssl
127.0.0.1:9001 -P /tmp/sslh.pid
$ pidof sslh-fork
26052
$ cat /tmp/sslh.pid 
26051

The problem when you try to use an initscript to stop the daemon, is
that you can't stop it anymore.

The same problem is encountered when doing "make test" (using t file),
the process is still listenning after the end of the script:

$ make test
./t
spawned 26382
[...]
client socket closed
connection closed down
kill: No such process
1..40008
$ pidof sslh-fork
26384

I've also noted that foreground option doesn't work (the process is
detached).


I think the problem is that sslh-fork call fork() twice:
- common.c,   line 692
- sslh-fork.c line 134

After removing the call to fork() in sslh-fork.c (attachment),
foreground option work as well and the pid in the pidfile is the right
one.


Apparently no problem with the sslh-select binary.


-- 
Guillaume Delacour <gui at iroqwa.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: double_fork.diff
Type: text/x-patch
Size: 422 bytes
Desc: not available
URL: <http://rutschle.net/pipermail/sslh/attachments/20110815/3c21c278/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Ceci est une partie de message num?riquement sign?e
URL: <http://rutschle.net/pipermail/sslh/attachments/20110815/3c21c278/attachment.pgp>


More information about the sslh mailing list