On 26/01/2016, Clint Adams <[email protected]> wrote:
> On Tue, Jan 26, 2016 at 04:43:58PM +0000, Alan Jenkins wrote:
>> Fix: replace htonl(INADDR_ANY) in fakerootd.c with htonl(INADDR_LOOPBACK).
>>  Not tested, but libfakeroot already connects to INADDR_LOOPBACK.  I'm not
>> aware of anything else this would break.
>
> I believe there were people connecting across VMs at one point,
> but I guess they can file a bug to request an option.

I think they must have already been patching communicate.c, to
connect() to a different address.  Or forwarding the port somehow.  So
I think that's very reasonable.


Dammit: I copied the suggested fix from my earlier email, but there's
a logic bug in it.  If port is not set explicitly with `--port`, that
change won't do anything.

  if (port > 0) {
    memset((char *) &addr, 0, sizeof (addr));
    addr.sin_family = AF_INET;
    addr.sin_addr.s_addr = htonl(INADDR_ANY);
    addr.sin_port = htons(port);

    if (bind(sd, (struct sockaddr *) &addr, sizeof (addr)) < 0)
      fail("bind");
  }

Fix: additionally, make the bind unconditional & then it will work
correctly.  The kernel understands "port 0" to mean "I don't care,
just pick one".  Still not tested, except for prototyping the system
calls from python.

Thanks again
Alan

Reply via email to