[ppp/f15] fixes #682381 - hardcodes eth0 fixes #708260 - SELinux is preventing access on the file LCK..ttyUSB3

Jiri Skala jskala at fedoraproject.org
Thu Jun 2 06:16:45 UTC 2011


commit 5126090b6411f93929f5d2df2e9ddf562e441050
Author: Jiri Skala <jskala at redhat.com>
Date:   Thu Jun 2 08:16:33 2011 +0200

    fixes #682381 - hardcodes eth0
    fixes #708260 - SELinux is preventing access on the file LCK..ttyUSB3

 ppp-2.4.5-eth.patch  |  124 ++++++++++++++++++++++++++++++++++++++++++++++++++
 ppp-2.4.5-lock.patch |   12 +++++
 ppp-tmpfs.conf       |    1 +
 ppp.spec             |   14 +++++-
 4 files changed, 150 insertions(+), 1 deletions(-)
---
diff --git a/ppp-2.4.5-eth.patch b/ppp-2.4.5-eth.patch
new file mode 100644
index 0000000..0e7e525
--- /dev/null
+++ b/ppp-2.4.5-eth.patch
@@ -0,0 +1,124 @@
+diff -up ppp-2.4.5/pppd/ether.c.inc.eth ppp-2.4.5/pppd/ether.c.inc
+--- ppp-2.4.5/pppd/ether.c.inc.eth	2011-06-01 10:28:35.356139063 +0200
++++ ppp-2.4.5/pppd/ether.c.inc	2011-06-01 11:20:37.876897352 +0200
+@@ -0,0 +1,46 @@
++#define PREF_ETH   "eth"
++#define PREF_EM    "em"
++
++static char *dev_file = "/proc/self/net/dev";
++
++/*
++ * get_first_ethernet - return the name of the first ethernet-style
++ * interface on this system.
++ */
++char *
++get_first_ethernet()
++{
++  FILE *f;
++  char buf[255], *dv, *smc;
++  char pci[16];
++
++  memset(pci, 0, sizeof(pci));
++  if ((f = fopen(dev_file, "r")) != NULL)
++  {
++    // go through network dev file
++    while (fgets (buf, sizeof(buf), f) != NULL)
++    {
++      // the line describes interface
++      if ((smc = strchr(buf, ':')) != NULL)
++      {
++        // trim white characters
++        for (dv=buf, *smc=0; *dv <= ' '; dv++) ;
++        // is "eth" (originial ethernet name) or "em" (ethernet on board)
++        if (!strncmp(dv, PREF_ETH, strlen(PREF_ETH)) ||
++            !strncmp(dv, PREF_EM, strlen(PREF_EM)))
++        {
++          return strdup(dv);
++        }
++        // remember the first pci NIC-card
++        if (strlen(pci) == 0 && dv[0] == 'p' && isdigit(dv[1]))
++        {
++          strcpy(pci, dv);
++        }
++      }
++    }
++    fclose(f);
++  }
++  // return pci NIC-card or nil if no if name
++  return strlen(pci) > 0 ? strdup(pci) : 0L;
++}
++
+diff -up ppp-2.4.5/pppd/plugins/rp-pppoe/pppoe-discovery.c.eth ppp-2.4.5/pppd/plugins/rp-pppoe/pppoe-discovery.c
+--- ppp-2.4.5/pppd/plugins/rp-pppoe/pppoe-discovery.c.eth	2011-06-01 09:39:13.099343548 +0200
++++ ppp-2.4.5/pppd/plugins/rp-pppoe/pppoe-discovery.c	2011-06-01 11:41:02.188252304 +0200
+@@ -47,6 +47,8 @@
+ #include <net/if_arp.h>
+ #endif
+ 
++#include "../../ether.c.inc"
++
+ char *xstrdup(const char *s);
+ void usage(void);
+ 
+@@ -686,7 +688,7 @@ int main(int argc, char *argv[])
+ 
+     /* default interface name */
+     if (!conn->ifName)
+-	conn->ifName = strdup("eth0");
++	conn->ifName = get_first_ethernet();
+ 
+     conn->discoverySocket = -1;
+     conn->sessionSocket = -1;
+diff -up ppp-2.4.5/pppd/sys-linux.c.eth ppp-2.4.5/pppd/sys-linux.c
+--- ppp-2.4.5/pppd/sys-linux.c.eth	2011-06-01 09:39:13.074343397 +0200
++++ ppp-2.4.5/pppd/sys-linux.c	2011-06-01 11:50:13.736565685 +0200
+@@ -144,6 +144,8 @@
+ #include <sys/locks.h>
+ #endif
+ 
++#include "ether.c.inc"
++
+ #ifdef INET6
+ #ifndef _LINUX_IN6_H
+ /*
+@@ -1869,16 +1871,6 @@ get_if_hwaddr(u_char *addr, char *name)
+ 	return ret;
+ }
+ 
+-/*
+- * get_first_ethernet - return the name of the first ethernet-style
+- * interface on this system.
+- */
+-char *
+-get_first_ethernet()
+-{
+-	return "eth0";
+-}
+-
+ /********************************************************************
+  *
+  * Return user specified netmask, modified by any mask we might determine
+@@ -2783,6 +2775,7 @@ ether_to_eui64(eui64_t *p_eui64)
+     struct ifreq ifr;
+     int skfd;
+     const unsigned char *ptr;
++    char warn_msg[80];
+ 
+     skfd = socket_fd(PF_INET6, SOCK_DGRAM, 0);
+     if(skfd == -1)
+@@ -2791,11 +2784,13 @@ ether_to_eui64(eui64_t *p_eui64)
+         return 0;
+     }
+ 
+-    strcpy(ifr.ifr_name, "eth0");
++    strcpy(ifr.ifr_name, get_first_ethernet());
+     if(ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
+     {
+         close(skfd);
+-        warn("could not obtain hardware address for eth0");
++        snprintf(warn_msg, sizeof(warn_msg),
++          "could not obtain hardware address for %s", ifr.ifr_name);
++        warn(warn_msg);
+         return 0;
+     }
+     close(skfd);
diff --git a/ppp-2.4.5-lock.patch b/ppp-2.4.5-lock.patch
new file mode 100644
index 0000000..6bda620
--- /dev/null
+++ b/ppp-2.4.5-lock.patch
@@ -0,0 +1,12 @@
+diff -up ppp-2.4.5/pppd/utils.c.lock ppp-2.4.5/pppd/utils.c
+--- ppp-2.4.5/pppd/utils.c.lock	2011-05-30 15:30:36.432371849 +0200
++++ ppp-2.4.5/pppd/utils.c	2011-05-30 15:30:48.575495854 +0200
+@@ -859,7 +859,7 @@ complete_read(int fd, void *buf, size_t 
+ /* Procedures for locking the serial device using a lock file. */
+ #ifndef LOCK_DIR
+ #ifdef __linux__
+-#define LOCK_DIR	"/var/lock"
++#define LOCK_DIR	"/var/lock/ppp"
+ #else
+ #ifdef SVR4
+ #define LOCK_DIR	"/var/spool/locks"
diff --git a/ppp-tmpfs.conf b/ppp-tmpfs.conf
index 195ef47..cdbf047 100644
--- a/ppp-tmpfs.conf
+++ b/ppp-tmpfs.conf
@@ -1 +1,2 @@
 d	/var/run/ppp	0755 root root
+d	/var/lock/ppp	0755 root root
diff --git a/ppp.spec b/ppp.spec
index db1d755..ba83d88 100644
--- a/ppp.spec
+++ b/ppp.spec
@@ -1,7 +1,7 @@
 Summary: The Point-to-Point Protocol daemon
 Name: ppp
 Version: 2.4.5
-Release: 16%{?dist}
+Release: 17%{?dist}
 License: BSD and LGPLv2+ and GPLv2+ and Public Domain
 Group: System Environment/Daemons
 URL: http://www.samba.org/ppp
@@ -29,6 +29,8 @@ Patch25: ppp-2.4.5-var_run_ppp.patch
 Patch26: ppp-2.4.5-manpg.patch
 Patch27: ppp-2.4.5-eaptls-mppe-0.99.patch
 Patch28: ppp-2.4.5-ppp_resolv.patch
+Patch29: ppp-2.4.5-eth.patch
+Patch30: ppp-2.4.5-lock.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: pam-devel, libpcap-devel, openssl-devel
@@ -73,6 +75,10 @@ This package contains the header files for building plugins for ppp.
 %patch26 -p1 -b .manpg
 %patch27 -p1 -b .eaptls
 %patch28 -p1 -b .ppp_resolv
+# fixes bz#682381 - hardcodes eth0
+%patch29 -p1 -b .eth
+# fixes bz#708260 - SELinux is preventing access on the file LCK..ttyUSB3
+%patch30 -p1 -b .lock
 
 rm -f scripts/*.local
 rm -f scripts/*.change_resolv_conf
@@ -102,6 +108,7 @@ install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/ppp
 # Provide pointers for people who expect stuff in old places
 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/ppp
 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/ppp
+mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lock/ppp
 
 install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
 install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/ppp.conf
@@ -130,6 +137,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pppd
 %dir %{_sysconfdir}/ppp
 %dir %{_localstatedir}/run/ppp
+%dir %{_localstatedir}/lock/ppp
 %attr(700, root, root) %dir %{_localstatedir}/log/ppp
 %config %{_sysconfdir}/tmpfiles.d/ppp.conf
 %config(noreplace) %{_sysconfdir}/ppp/eaptls-client
@@ -147,6 +155,10 @@ rm -rf $RPM_BUILD_ROOT
 %doc PLUGINS
 
 %changelog
+* Thu Jun 02 2011 Jiri Skala <jskala at redhat.com> - 2.4.5-17
+- fixes #682381 - hardcodes eth0
+- fixes #708260 - SELinux is preventing access on the file LCK..ttyUSB3
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.4.5-16
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list