libvirt/tools/nss
Michal Privoznik d7dd4e1f89 nss: Don't fail on empty files
Before we rewrote nss plugin so that it doesn't use libvirt's
internal functions it used virLeaseReadCustomLeaseFile() to parse
.status files. After the rewrite it's using read() + yajl_parse()
+ yajl_complete_parse(). There's one catch though,
virLeaseReadCustomLeaseFile() skipped over empty files.

An empty .status file is created when a network is started. This
is because we configure dnsmasq to use our leasehelper. So the
first thing it does it calls it as follows:

  DNSMASQ_INTERFACE=virbr0 /usr/libexec/libvirt_leaseshelper init

which causes the leasehelper to create empty virbr0.status file.
If there is only one libvirt network then that is no problem -
there are no other .status files to parse anyway. But if there
are two or more networks then the first empty .status file causes
whole parsing process and subsequently the whole name lookup
process to fail.

Fixes: v5.7.0-rc1~343

Reported-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-11-28 15:37:41 +01:00
..
libvirt_guest_nss.syms nss: Introduce libvirt-guest module 2016-12-06 13:34:00 +01:00
libvirt_nss_bsd.syms nss: FreeBSD support 2016-03-30 10:21:44 +03:00
libvirt_nss_leases.c nss: Don't fail on empty files 2019-11-28 15:37:41 +01:00
libvirt_nss_leases.h tools: avoid accidentally using files from gnulib 2019-08-08 13:32:02 +01:00
libvirt_nss_macs.c nss: Don't leak memory on parse error 2019-08-09 12:17:19 +02:00
libvirt_nss_macs.h tools: avoid accidentally using files from gnulib 2019-08-08 13:32:02 +01:00
libvirt_nss.c nss: Don't leak @addr in gethostbyname4() 2019-09-30 12:27:22 +02:00
libvirt_nss.h libvirt_nss.h: Separate function declarations with an empty line 2019-09-30 12:27:41 +02:00
libvirt_nss.syms Implement _nss_libvirt_gethostbyname4_r 2016-03-18 17:29:53 +01:00