rpms/ypbind/devel ypbind-mt-1.31-matches.patch, NONE, 1.1 ypbind.spec, 1.72, 1.73

Karel Klíč kklic at fedoraproject.org
Wed Jun 23 09:30:24 UTC 2010


Author: kklic

Update of /cvs/extras/rpms/ypbind/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv21355

Modified Files:
	ypbind.spec 
Added Files:
	ypbind-mt-1.31-matches.patch 
Log Message:
Remove matches when dereferencing DBus connection

ypbind-mt-1.31-matches.patch:
 ypbind_dbus_nm.c |   45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

--- NEW FILE ypbind-mt-1.31-matches.patch ---
diff -up ypbind-mt-1.20.4/src/ypbind_dbus_nm.c.matches ypbind-mt-1.20.4/src/ypbind_dbus_nm.c
--- ypbind-mt-1.20.4/src/ypbind_dbus_nm.c.matches	2010-06-22 19:52:43.732020839 +0200
+++ ypbind-mt-1.20.4/src/ypbind_dbus_nm.c	2010-06-22 20:10:55.040016349 +0200
@@ -51,6 +51,17 @@ typedef enum NMState {
 
 #endif
 
+#define DBUS_MESSAGE_MATCH			\
+  "type='signal',"				\
+  "interface='" DBUS_INTERFACE_DBUS "',"	\
+  "sender='" DBUS_SERVICE_DBUS "'"
+
+#define NM_MESSAGE_MATCH			\
+  "type='signal',"				\
+  "interface='" NM_DBUS_INTERFACE "',"		\
+  "sender='" NM_DBUS_SERVICE "',"		\
+  "path='" NM_DBUS_PATH "'"
+
 #include "ypbind.h"
 #include "log_msg.h"
 #include "local.h"
@@ -276,10 +287,7 @@ dbus_init (void)
   if (!dbus_connection_add_filter (connection, dbus_filter, NULL, NULL))
     goto out;
 
-  dbus_bus_add_match (connection, "type='signal',"
-		      "interface='" DBUS_INTERFACE_DBUS "',"
-		      "sender='" DBUS_SERVICE_DBUS "'",
-		      &error);
+  dbus_bus_add_match (connection, DBUS_MESSAGE_MATCH, &error);
   if (dbus_error_is_set (&error))
     {
       log_msg (LOG_ERR, "Error adding match, %s: %s",
@@ -291,16 +299,17 @@ dbus_init (void)
       goto out;
     }
 
-  dbus_bus_add_match (connection,
-		      "type='signal',"
-		      "interface='" NM_DBUS_INTERFACE "',"
-		      "sender='" NM_DBUS_SERVICE "',"
-		      "path='" NM_DBUS_PATH "'", &error);
+  dbus_bus_add_match (connection, NM_MESSAGE_MATCH, &error);
   if (dbus_error_is_set (&error))
     {
       log_msg (LOG_ERR, "Error adding match, %s: %s",
 	       error.name, error.message);
       dbus_error_free (&error);
+
+      dbus_bus_remove_match (connection, DBUS_MESSAGE_MATCH, &error);
+      if (dbus_error_is_set (&error)) /* ignore the error */
+	dbus_error_free (&error);
+
       dbus_connection_unref (connection);
       connection = NULL;
       goto out;
@@ -314,6 +323,24 @@ dbus_init (void)
       if (!check_for_nm (connection))
 	{
 	  /* NetworkManager not in use.  */
+
+	  /* The matches must be removed here. When dbus_init() is
+	     called repeatedly without removing matches, it starts to
+	     report errors:
+	     Error adding match, org.freedesktop.DBus.Error.LimitsExceeded:
+	     Connection ":1.0" is not allowed to add more match rules
+	   */
+	  dbus_bus_remove_match (connection, DBUS_MESSAGE_MATCH, &error);
+	  if (dbus_error_is_set (&error))
+	    {
+	      /* ignore the error, most likely it is MatchRuleNotFound. */
+	      dbus_error_free (&error);
+	    }
+
+	  dbus_bus_remove_match (connection, NM_MESSAGE_MATCH, &error);
+	  if (dbus_error_is_set (&error))
+	    dbus_error_free (&error);
+
 	  dbus_connection_unref (connection);
 	  is_online = 1;
 	  return 0;


Index: ypbind.spec
===================================================================
RCS file: /cvs/extras/rpms/ypbind/devel/ypbind.spec,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -p -r1.72 -r1.73
--- ypbind.spec	8 Jun 2010 10:15:47 -0000	1.72
+++ ypbind.spec	23 Jun 2010 09:30:24 -0000	1.73
@@ -1,7 +1,7 @@
 Summary: The NIS daemon which binds NIS clients to an NIS domain
 Name: ypbind
 Version: 1.31
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: GPLv2
 Group: System Environment/Daemons
 Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
@@ -9,6 +9,8 @@ Url: http://www.linux-nis.org/nis/ypbind
 Source1: ypbind.init
 Source2: nis.sh
 Patch1: ypbind-1.11-gettextdomain.patch
+# Sent to upstream.
+Patch2: ypbind-mt-1.31-matches.patch
 Requires(post): chkconfig
 Requires(preun): chkconfig
 # This is for /sbin/service
@@ -38,6 +40,7 @@ also need to install the ypserv package 
 %prep
 %setup -q -n ypbind-mt-%{version}
 %patch1 -p1 -b .gettextdomain
+%patch2 -p1 -b .matches
 
 %build
 %configure --enable-dbus-nm
@@ -79,6 +82,10 @@ fi
 %doc README NEWS COPYING
 
 %changelog
+* Wed Jun 23 2010 Karel Klic <kklic at redhat.com> - 3:1.31-7
+- Added -matches.patch removing matches when dereferencing
+  DBus connection.
+
 * Tue Jun  8 2010 Karel Klic <kklic at redhat.com> - 3:1.31-6
 - ypbind.init: take the first domainname in yp.conf and use
   only that (rhbz#601296)



More information about the scm-commits mailing list