[PATCH] to make Samba work in FreeBSD jails

Gerhard Sittig Gerhard.Sittig at gmx.net
Thu Dec 14 19:16:45 GMT 2000


The message I'm replying to went out some one month ago to
samba-technical at lists.samba.org and up to the current day was
responded to with pure silence.  Reading the BUGS.txt document I
understand that this can be considered normal and that
samba at samba.org is the address to direct bug reports and patches
to.  Well, I feel the depending on IP 127.0.0.1 to be there a
serious bug. :>

On Thu, Nov 16, 2000 at 20:09 +0100, Gerhard Sittig wrote:
> 
> May I draw your attention towards the problem report at
> http://www.freebsd.org/cgi/query-pr.cgi?pr=22316 ?  This
> article describes a method of making Samba work in a
> restrictive jail(2) environment FreeBSD provides.

The essence is like this:  The presence of "localhost" with an IP
of 127.0.0.1 may be a good assumption in today's network stacks,
but it's just that - an assumption - and miserably fails in
certain environments (no matter how much the ORA book tries to
declare it for a given fact).

The patch cited in the above referenced FreeBSD problem report
(as well as available on explicit request to me) helps to fix
this breakage by collapsing all the hardwired names and addresses
into a single spot.  So you can still deliver a package with your
assumption, and yet have those with a slightly differing
environment change the addresses and names with affordable amount
of work and minimal possibility of errors.

The patch was made against samba 2.0.7, but I lately checked the
just released 2.2.0-alpha1 code and noticed nothing was done in
this respect.  So the issue still exists:  All the hardcoded
assumptions are sprinkled all over the source tree.  And once
"localhost" doesn't resolve or IP 127.0.0.1 is not available
samba fails to operate.

> I feel the patches to bundle all the "localhost" synonyms in
> one place to be useful for everyone when incorporated into the
> Samba base system.  Sprinkling hardcoded values all over the
> project files could turn out to be a problem later for other
> reasons, too.  Please consider applying the patches to your
> software.  Thanks!

I still hope you would see the benefit of accepting the patch (or
the core of it leaving the BSD specific part of the ports
mechanism aside).  Feel free to ask me for another diff against
2.2.0-*, I will produce one if needed.  But the fix is quite
obvious:
- don't specify "localhost" directly in the *.c files
- don't specify "127.0.0.1" directly in the *.c files
- don't specify "0x7F000001" directly in the *.c files (done
  already, although the macro's definition could still need to
  change)
- provide an easy way to change the assumed values (i.e. a
  separate and short header file with no other unrelated
  definitions) for those who cannot or don't want to use the
  above given values - for whatever reason - and provide a header
  file with the above assumptions for those who don't feel like
  changing these values.

So you could take the above cited patch in verbatim form when
leaving the Makefile hook for producing loopback.h (you would
ship it with your source already) and the script used for
producing it (it's of interest only for those who don't agree to
your values).  Although the script could serve you internally
(and once only) to produce the loopback.h file you will ship.


Free free to tell me when I'm missing something or even better
when you think the patch to be of value for you.  But please do
reply.  Thank you for your attention.


virtually yours   82D1 9B9C 01DC 4FB4 D7B4  61BE 3F49 4F77 72DE DA76
Gerhard Sittig   true | mail -s "get gpg key" Gerhard.Sittig at gmx.net
-- 
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.




More information about the samba mailing list