# nsswitch not working: FreedBSD 12.0 and samba 4.10.5



## msummerfield (Sep 4, 2019)

I have just performed a clean install of FreeBSD 12.0 from the DVD iso, followed by samba 4.10.5 from packages.

I have configured samba smbd, nmbd, and winbindd, and these are all working fine, i.e. I can see and access shares on the FreeBSD host from Windows 10, FreeBSD (11.0, samba 4.4.5) and Linux (Ubuntu 18.04, samba 4.7.6) and vice versa. winbindd also appears to be working, i.e.:

`wbinfo -N hp-envy`

produces:


```
192.168.1.104   hp-envy
```

as expected (hp-envy is a Windows 10 laptop).

My nsswitch.conf file contains:


```
group: compat
group_compat: nis
hosts: files wins dns
netgroup: compat
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files
```

However, nsswitch is not working, e.g. I get:


```
> ping hp-envy
ping: cannot resolve hp-envy: Unknown host
```

The following message appears in /var/log/debug.log:


```
Sep  3 18:49:49 postgres ping[1150]: NSSWITCH(_nsdispatch): wins, hosts, gethostbyname2_r, not found, and no fallback provided
```

/usr/local/lib/nss_wins.so.1 exists, and the symbol _nss_wins_gethostbyname2_r exists:


```
> nm /usr/local/lib/nss_wins.so.1  
0000000000000000 A NSS_WINS_1
0000000000201d20 a _DYNAMIC
0000000000201f60 a _GLOBAL_OFFSET_TABLE_
w _Jv_RegisterClasses
0000000000201d00 d __CTOR_END__
0000000000201cf8 d __CTOR_LIST__
0000000000201d10 d __DTOR_END__
0000000000201d08 d __DTOR_LIST__
0000000000001410 r __FRAME_END__
0000000000201d18 d __JCR_END__
0000000000201d18 d __JCR_LIST__
0000000000202180 A __bss_start
w __cxa_finalize@@FBSD_1.0
0000000000001240 t __do_global_ctors_aux
0000000000000d30 t __do_global_dtors_aux
0000000000202010 d __do_global_dtors_aux.completed
0000000000202008 d __do_global_dtors_aux.p
0000000000202000 d __dso_handle
U __error@@FBSD_1.0
U __inet_pton@@FBSD_1.0
00000000000010d0 T __nss_wins_freebsd_gethostbyname2_r
U __stack_chk_fail@@FBSD_1.0
U __stack_chk_guard@@FBSD_1.0
0000000000202180 A _edata
0000000000202188 A _end
0000000000001278 T _fini
0000000000000c20 T _init
0000000000001090 T _nss_wins_gethostbyname2_r
0000000000000dc0 T _nss_wins_gethostbyname_r
0000000000000d90 t frame_dummy
U memcpy@@FBSD_1.0
0000000000202020 d methods
0000000000001220 T nss_module_register
U pthread_mutex_lock@@FBSD_1.0
U pthread_mutex_unlock@@FBSD_1.0
U strchr@@FBSD_1.0
U strlcpy@@FBSD_1.0
U strlen@@FBSD_1.0
U wbcFreeMemory@@WBCLIENT_0.9
U wbcResolveWinsByName@@WBCLIENT_0.9
U wbcSetClientProcessName@@WBCLIENT_0.15
0000000000202180 b wins_nss_mutex
```

Running `stat` on /usr/local/lib/nss_wins.so.1 seems to show that it is, in fact, accessed when `ping` is run.

Exactly the same setup works perfectly on the FreeBSD 11.0/samba 4.4.5 box.

I know there are different conventions regarding the leading underscores in the symbol table, so I am wondering if some incompatibility has crept in between the latest versions of FreeBSD's implementation of nsdispatch() and samba 4.10.5.

Any clues would be much appreciated.


----------



## msummerfield (Sep 7, 2019)

I downgraded to the samba 4.8.12_3 package, and it is now working. So this looks to be a compatibility problem between Freebsd 12.0 and the samba 4.10.5 package.


----------

