sshd's -e doesn't work as expected

Ben Lindstrom mouring at eviladmin.org
Fri Dec 28 11:47:52 EST 2007


Does one also want to consider -i along with -D or -d?

- Ben

On Thu, 27 Dec 2007, Jim Knoble wrote:

> Circa 2007-12-27 03:30 dixit Julio M. Merino Vidal:
>
> : On 27/12/2007, at 0:41, Jim Knoble wrote:
> :
> : > I think the intent was for '-e' to be used with '-D':
>    [...]
> : > Perhaps sshd should complain if '-e' appears without '-D'?
> :
> : Maybe, but I want it to run it in the background, so I would need to
> : launch it with & instead.
> :
> : Thinking about it, this may be good enough though.  At first, I
> : thought that the pidfile was written before the call to daemon(3) so
> : I thought it'd be safe to access that file immediately after the call
> : to sshd (without -D nor -d) returned.  But after checking the code I
> : see this is not the case (how could it be? you don't know the pid
> : until you fork...), so it makes no difference for me to use -D or &
> : because I can hit the race condition in any of the two ways.
>
> If you need the PID of the sshd process, you can get it without a race
> using (for example):
>
> 	#!/bin/sh
> 	/usr/local/sbin/sshd -D &
> 	SSHD_PID="$!"
>
> The shell knows the process ID of the child it spawns to run sshd.
>
> : So, OK.  If -e is always supposed to be used alongside with -D, then
> : the daemon should complain about that situation.
>
> Perhaps you could generate a patch and attach it to your bug report.
>
> --
> jim knoble  |  jmknoble at pobox.com  |  http://www.pobox.com/~jmknoble/
> (GnuPG key ID: 6F39C2CC  >>>>>>  http://www.pobox.com/~jmknoble/keys/ )
> (GnuPG fingerprint: 5024:D578:7CF4:5660:7269::F6F3:B919:9307:6F39:C2CC)
> +----------------------------------------------------------------------+
> |[L]iberty, as we all know, cannot flourish in a country that is perma-|
> | nently on a war footing, or even a near-war footing.  --Aldous Huxley|
> +----------------------------------------------------------------------+
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev at mindrot.org
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
>


More information about the openssh-unix-dev mailing list