[Samba] Hostname resolve fails after upgrade from 4.2 to 4.5

Uri Simchoni uri at samba.org
Fri May 12 17:35:35 UTC 2017


(a bit off-topic for samba-technical so I removed that CC)

The short answer would be to read the nsswitch.conf manpage - you need
libnss_wins.so in /lib and you need "wins" in the "hosts" line in
/etc/nsswitch.conf.

I found this description in the wiki, which tries to explain how this
works (pretty much what I've written):
https://wiki.samba.org/index.php?title=Mounting_samba_shares_from_a_unix_client#NetBios_name_resolution_with_WINS

Again, ping is independent, but depends on glibc. Glibc, in turn, when
doing "getaddrinfo", doesn't just send DNS packets. Instead, it looks at
the "hosts" line in /etc/nsswitch.conf (see man nsswitch.conf). For each
entry "foo" there it loads a shared library /lib/libnss_foo.so. It then
calls that library to do the name->IP resolving.

When you build and install samba, it places libnss_wins.so in
${DESTDIR}/${prefix}/lib. Someone (Samba install doens't do *that*) must
have added "wins" to the "hosts" line in /etc/nsswitch.conf, or NetBIOS
name resolution wouldn't work at all. The *implementation* of
libnss_wins.so has changed in Samba 4.4, it's no longer self-contained
but depends on winbindd. On the plus side, the amount of code that's
pulled into the "ping" process space by this dynamic loading is smaller,
which prevents issues in some cases.

I hope that helps,
Uri.

On 05/11/2017 10:11 PM, Guru Prasad wrote:
> If the machine has samba 4.4 or above installed in it then any program
> such as ping sends a request to winbindd for name resolution.
> 
> Hope ping is a independent program and doesn't depend on samba or winbindd.
> Then how will the ping/mount request reaches winbindd from 4.4 and not
> before that.
> 
> Is there any specific rule for this in nsswitch conf or somewhere else.
> 
> Please bear with me in case if my questions troubles you in your busy
> schedule.
> 
> 
> Thanks
> Guru
> 
> On May 12, 2017 12:34 AM, "Guru Prasad" <gp22online at gmail.com
> <mailto:gp22online at gmail.com>> wrote:
> 
>     Thank you very much for the explanation Uri.
> 
>     Thanks
>     Guru
> 
>     On May 12, 2017 12:13 AM, "Uri Simchoni" <uri at samba.org
>     <mailto:uri at samba.org>> wrote:
> 
>         On 05/11/2017 09:33 PM, Guru Prasad wrote:
>         > Thank you very much Uri.
>         > It means winbindd handles netbios name resolution from samba
>         4.4.0.
>         > Just to understand, before samba 4.4.0 under which process
>         this netbios
>         > name resolution  was handled?
>         >
>         It was under the process that called getaddrinfo() or any other
>         glibc
>         name resolution routine.
> 
>         Glibc has a plugin mechanism (name service switch, or nsswitch for
>         short) which loads plugins acording to /etc/nsswitch.conf. When a
>         program (such as ping) calls getaddrinfo(), the glibc implementation
>         loads those plugins and runs them according to the order and policy
>         defined in /etc/nsswitch.conf.
> 
>         Prior to 4.4.0, the wins plugin itself would send and receive
>         netbios
>         packets, from the context that called getaddrinfo() or any other
>         such
>         function. Since 4.4.0, it sends a request to winbindd (over a Unix
>         domain socket) and awaits response.
> 
>         Uri
>         > Thanks
>         > Guru
>         >
> 




More information about the samba mailing list