- fix interface address null check.

This commit is contained in:
Ian Kent 2013-05-24 13:29:08 +08:00
parent 408265e86c
commit 8435ccd48f
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,55 @@
autofs-5.0.7 - fix interface address null check
From: Doug Nazar <nazard@nazar.ca>
Since commit aa6f7793 [autofs-5.0.7 - fix ipv6 proximity calculation]
get_proximity() uses getifaddrs however it crashes on interfaces with
no addresses.
Fix the NULL check to ignore interfaces with no addresses.
Also skip interfaces which are not currently running.
---
CHANGELOG | 1 +
modules/replicated.c | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 66c11de..50e83d7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -43,6 +43,7 @@
- make dump maps check for duplicate indirect mounts.
- document allowed map sources in auto.master.
- add enable sloppy mount option to configure.
+- fix interface address null check.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/replicated.c b/modules/replicated.c
index 26f64b8..6dbdade 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -165,8 +165,9 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
this = ifa;
while (this) {
- if (this->ifa_flags & IFF_POINTOPOINT ||
- this->ifa_addr->sa_data == NULL) {
+ if (!(this->ifa_flags & IFF_UP) ||
+ this->ifa_flags & IFF_POINTOPOINT ||
+ this->ifa_addr == NULL) {
this = this->ifa_next;
continue;
}
@@ -202,8 +203,9 @@ static unsigned int get_proximity(struct sockaddr *host_addr)
this = ifa;
while (this) {
- if (this->ifa_flags & IFF_POINTOPOINT ||
- this->ifa_addr->sa_data == NULL) {
+ if (!(this->ifa_flags & IFF_UP) ||
+ this->ifa_flags & IFF_POINTOPOINT ||
+ this->ifa_addr == NULL) {
this = this->ifa_next;
continue;
}

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.7
Release: 16%{?dist}
Release: 17%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -60,6 +60,7 @@ Patch44: autofs-5.0.7-fix-submount-tree-not-all-expiring.patch
Patch45: autofs-5.0.7-make-dump-maps-check-for-duplicate-indirect-mounts.patch
Patch46: autofs-5.0.7-document-allowed-map-sources-in-auto_master.patch
Patch47: autofs-5.0.7-add-enable-sloppy-mount-option-to-configure.patch
Patch48: autofs-5.0.7-fix-interface-address-null-check.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if %{with_systemd}
BuildRequires: systemd-units
@ -164,6 +165,7 @@ echo %{version}-%{release} > .version
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@ -255,6 +257,9 @@ fi
%dir /etc/auto.master.d
%changelog
* Fri May 24 2013 Ian Kent <ikent@redhat.com> - 1:5.0.7-17
- fix interface address null check.
* Mon May 13 2013 Ian Kent <ikent@redhat.com> - 1:5.0.7-16
- make dump maps check for duplicate indirect mounts (bz961312).
- document allowed map sources in auto.master(5) (bz961312).