On Fri, 11 May 2007, David Lee wrote:
> [...]
> in which the 'default' clause stores the child "pid". It then proceeds:
> -----------------------------
> (void)execl("/bin/sh", "sh", "-c", centry->command
> , (const char *)NULL);
> -----------------------------
>
> It might be that different implementations of "/bin/sh" do different
> things. For instance, some Bournes (e.g. Solaris) might (I speculate!)
> might then spawn "centry->command" as a subprocess (a further fork/exec)
> whereas Bash might (speculation continues) do a direct replacement "exec".
>
> It seems that heartbeat requires the 'direct replacement "exec"' style of
> operation (stored child pid is the final "centry->command"), which Bash
> seems to give but which Bourne (child pid is intermediate "sh") doesn't.
>
> Is there any reason why this 'execl("/bin/sh" ... centry->command ...)'
> tries to go via a shell? Why doesn't it simply go directly, and
> unambiguously, to the 'centry->command'?
>
> This is beginning to feel like a Bash-ism bug.
Going off at a tangent...
If this is picking up a command from a configuration file, then what sort
of sanity checking is (or should be) done on the command being given?
Just suppose the command said "/bin/rm -rf /" or something analogous as
whatever uid/gid it is running as. (Yes, one could take the "they got
what they asked for" view, I suppose.)
--
: David Lee I.T. Service :
: Senior Systems Programmer Computer Centre :
: UNIX Team Leader Durham University :
: South Road :
: http://www.dur.ac.uk/t.d.lee/ Durham DH1 3LE :
: Phone: +44 191 334 2752 U.K. :
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/