The name of the exported functions for an NSS module is quite
fixed, it is derived from the module name:
_nss_$module_$function
Since we will create another NSS module with very similar
implementation we might as well generate the function names at
the compile time.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
The NSS module shouldn't rely on custom leases database to not have
entries for leases which have expired.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* tools/nss/libvirt_nss.[ch]: add BSD-comptabile wrappers and
register via the nss_module_register() interface
* m4/virt-nss.m4: add checks if we're building NSS for FreeBSD
* tools/Makefile.am: handle target library name differences, as
Linux needs libnss_libvirt.so.2 and FreeBSD needs
nss_libvirt.so.1. Also, different syms files have to be used
as Linux needs to export all the methods while FreeBSD
only needs to have nss_module_register()
* tests/nsstest.c, tests/nssmock.c: s/__linux__/NSS/
* tests/nssmock.c: pass int instead of mode_t to va_arg() to please
gcc 4.8
* libvirt_nss_bsd.syms: FreeBSD syms file
Every aligning requires at least one cast and it's hard to read. Let's
make a function that makes sure the pointer is moved according to the
alignment and use that to move throughout the data buffer.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This function is a different beast compared to previous ones.
But yet again, nothing surprising is happening here.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
The implementation is pretty straightforward. Moreover, because
of the nature of things, gethostbyname_r and gethostbyname2_r can
be implemented at the same time too.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Name Service Switch is a glibc feature responsible for many
things. Translating domain names into IP addresses and vice versa
is just one of them. However, currently it's the only
functionality that this commit is tickling. Well, in this commit
the plugin skeleton is introduced. Implementation to come in next
patches.
Because of the future testing, where the implementation is to be
linked with a test, this needs to go into static library. Linking
a program with an .so statically is not portable. Therefore a
dummy libnss_libvirt_impl library is being introduced too.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>