Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package inputlirc

This version fixes an important bug (#689037) which causes inputlirc to crash
immediately when started with two or more identical input devices specified on
the command line. This can happen inadvertently when combining manually
specified input devices with one or more filter options, it is very difficult
for a user to see what went wrong in such a case.

Note that I am also the upstream author, so I have made a new upstream version
fixing this bug, instead of just applying a Debian patch to the old version.

I have also enabled compiler hardening flags.

unblock inputlirc/23-1

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=nl_NL.UTF-8, LC_CTYPE=nl_NL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru inputlirc-19/ChangeLog inputlirc-23/ChangeLog
--- inputlirc-19/ChangeLog	2011-05-19 22:31:22.000000000 +0200
+++ inputlirc-23/ChangeLog	2013-02-21 16:02:21.000000000 +0100
@@ -1,3 +1,30 @@
+commit 95e620a7f245cca550b20c9da66fba38125b0790
+Author: Guus Sliepen <g...@sliepen.org>
+Date:   Thu Feb 21 15:58:18 2013 +0100
+
+    Honour $CPPFLAGS and $LDFLAGS.
+
+commit 81a9275a8345c934ec0b3e6424562520a7b71cd4
+Author: Guus Sliepen <g...@sliepen.org>
+Date:   Tue Oct 2 13:09:35 2012 +0200
+
+    Query type of input event device, and only accept those that send EV_KEY events.
+
+commit 2c683d7153ceb1ee11be497b70001d79ab62b04f
+Author: Guus Sliepen <g...@sliepen.org>
+Date:   Tue Oct 2 13:08:40 2012 +0200
+
+    Don't add input event devices to the list that cannot be read.
+    
+    This fixes a crash caused by FD_SET() not liking a negative file descriptor.
+    So also added a check right before FD_SET() just in case.
+
+commit 3de9078edb670481d06968935062efb2a5a46285
+Author: Guus Sliepen <g...@sliepen.org>
+Date:   Tue Oct 2 13:05:03 2012 +0200
+
+    Send log messages to stderr when not detached.
+
 commit 4d6c054dab4d3ab80a00db69f8cce4b89bf75caa
 Author: Guus Sliepen <g...@sliepen.org>
 Date:   Thu May 19 21:40:04 2011 +0200
diff -Nru inputlirc-19/Makefile inputlirc-23/Makefile
--- inputlirc-19/Makefile	2011-05-19 22:31:22.000000000 +0200
+++ inputlirc-23/Makefile	2013-02-21 16:00:36.000000000 +0100
@@ -1,5 +1,5 @@
 # inputlircd -- zeroconf LIRC daemon that reads from /dev/input/event devices
-# Copyright (C) 2006  Guus Sliepen <g...@sliepen.eu.org>
+# Copyright (C) 2006-2013  Guus Sliepen <g...@sliepen.org>
 # 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of version 2 of the GNU General Public License as published
@@ -31,7 +31,7 @@
 	./gennames $< > $@
 
 inputlircd: inputlircd.c /usr/include/linux/input.h names.h
-	$(CC) $(CFLAGS) -o $@ $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<
 
 install: install-sbin install-man
 
diff -Nru inputlirc-19/debian/changelog inputlirc-23/debian/changelog
--- inputlirc-19/debian/changelog	2013-03-11 12:31:19.000000000 +0100
+++ inputlirc-23/debian/changelog	2013-03-11 12:31:21.000000000 +0100
@@ -1,3 +1,13 @@
+inputlirc (23-1) unstable; urgency=low
+
+  * New upstream release.
+    - Fixes a crash when one input device is specified more than once on the
+      command line. Closes: 689037
+  * Bump Standards-Version.
+  * Enable hardening flags.
+
+ -- Guus Sliepen <g...@debian.org>  Thu, 21 Feb 2013 16:17:04 +0100
+
 inputlirc (19-1) unstable; urgency=low
 
   * New upstream release.
diff -Nru inputlirc-19/debian/control inputlirc-23/debian/control
--- inputlirc-19/debian/control	2013-03-11 12:31:19.000000000 +0100
+++ inputlirc-23/debian/control	2013-03-11 12:31:21.000000000 +0100
@@ -2,8 +2,8 @@
 Section: utils
 Priority: extra
 Maintainer: Guus Sliepen <g...@debian.org>
-Build-Depends: debhelper (>> 7)
-Standards-Version: 3.9.2
+Build-Depends: debhelper (>> 7), dpkg-dev (>= 1.16.1~)
+Standards-Version: 3.9.4
 
 Package: inputlirc
 Architecture: any
diff -Nru inputlirc-19/debian/rules inputlirc-23/debian/rules
--- inputlirc-19/debian/rules	2013-03-11 12:31:19.000000000 +0100
+++ inputlirc-23/debian/rules	2013-03-11 12:31:21.000000000 +0100
@@ -11,18 +11,8 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
-
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-	INSTALL_PROGRAM += -s
-endif
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildflags.mk
 
 configure: configure-stamp
 configure-stamp:
diff -Nru inputlirc-19/inputlircd.c inputlirc-23/inputlircd.c
--- inputlirc-19/inputlircd.c	2011-05-19 22:31:22.000000000 +0200
+++ inputlirc-23/inputlircd.c	2013-02-21 16:00:36.000000000 +0100
@@ -1,6 +1,6 @@
 /*
     inputlircd -- zeroconf LIRC daemon that reads from /dev/input/event devices
-    Copyright (C) 2006  Guus Sliepen <g...@sliepen.eu.org>
+    Copyright (C) 2006-2013  Guus Sliepen <g...@sliepen.org>
 
     This program is free software; you can redistribute it and/or modify it
     under the terms of version 2 of the GNU General Public License as published
@@ -145,6 +145,20 @@
 		return -1;
 	}
 
+	char bits = 0;
+
+	if(ioctl(fd, EVIOCGBIT(0, sizeof bits), &bits) < 0) {
+		close(fd);
+		syslog(LOG_ERR, "Could not read supported event types from %s: %s\n", name, strerror(errno));
+		return -1;
+	}
+
+	if(!(bits & 2)) {
+		close(fd);
+		syslog(LOG_ERR, "%s does not support EV_KEY events\n", name);
+		return -1;
+	}
+
 	if(grab) {
 		if(ioctl(fd, EVIOCGRAB, 1) < 0) {
 			close(fd);
@@ -177,6 +191,8 @@
 	evdev_t *newdev;
 
 	fd = open_evdev(name);
+	if(fd < 0)
+		return;
 
 	newdev = xalloc(sizeof *newdev);
 	newdev->fd = fd;
@@ -363,6 +379,8 @@
 	FD_ZERO(&permset);
 	
 	for(evdev = evdevs; evdev; evdev = evdev->next) {
+		if(evdev->fd < 0)
+			continue;
 		FD_SET(evdev->fd, &permset);
 		if(evdev->fd > maxfd)
 			maxfd = evdev->fd;
@@ -450,6 +468,8 @@
 		return EX_USAGE;
 	}
 
+	openlog("inputlircd", LOG_PERROR, LOG_DAEMON);
+
 	for(i = optind; i < argc; i++)
 		add_evdev(argv[i]);
 
@@ -473,8 +493,11 @@
 		return EX_OSERR;
 	}
 
-	if(!foreground)
+	if(!foreground) {
+		closelog();
 		daemon(0, 0);
+		openlog("inputlircd", 0, LOG_DAEMON);
+	}
 
 	syslog(LOG_INFO, "Started");
 

Reply via email to