[libvirt] [PATCH] nss: use more strict check for automatic enabling

Roman Bogorodskiy bogorodskiy at gmail.com
Tue Mar 22 12:40:17 UTC 2016


  Michal Privoznik wrote:

> On 21.03.2016 06:21, Roman Bogorodskiy wrote:
> > Currently nss plugin is automatically enabled if nss.h header exists and
> > --without-nss-plugin is not specified. However, presence of the nss.h
> > header does not guarantee a compatible interface, so check for struct
> > gaih_addrtuple to make sure it's enabled only on platforms where it
> > could be built.
> > ---
> >  m4/virt-nss.m4 | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/m4/virt-nss.m4 b/m4/virt-nss.m4
> > index 3fa4ad3..bc054db 100644
> > --- a/m4/virt-nss.m4
> > +++ b/m4/virt-nss.m4
> > @@ -25,12 +25,14 @@ AC_DEFUN([LIBVIRT_CHECK_NSS],[
> >  
> >    fail=0
> >    if test "x$with_nss_plugin" != "xno" ; then
> > -    AC_CHECK_HEADERS([nss.h], [
> > +    AC_CHECK_TYPE([struct gaih_addrtuple], [
> >          with_nss_plugin=yes
> >        ],[
> >          if test "x$with_nss_plugin" = "xyes" ; then
> >            fail = 1
> >          fi
> > +      ],[
> > +        #include <nss.h>
> >        ])
> >  
> >      if test $fail = 1 ; then
> > 
> 
> While this would fix the build, it would disable the whole feature on
> freebsd. The problem is with the structure that is needed just for
> _nss_libvirt_gethostbyname4_r(). Should we change the code in that way
> that the function is built conditionally when the structure is present?
> That way we still could have _gethostbyname3_r() on systems providing
> the header file but not having the structure.

To tell the truth, I didn't look close at the nss implementation and
wasn't sure if interfaces are compatible on Linux and FreeBSD for such
type of things.

I'll take a look if I can use this plugin on FreeBSD if I just disable
_nss_libvirt_gethostbyname4_r() related stuff. 

Roman Bogorodskiy




More information about the libvir-list mailing list