Bug#495459: Zaptel - udev file

Tzafrir Cohen tzafrir.cohen at xorcom.com
Fri Jun 19 18:08:24 UTC 2009


On Sun, Aug 17, 2008 at 05:14:55PM +0200, Stefan Lesicnik wrote:
> Package: zaptel
> Version: 1:1.4.11~dfsg-1
> User: ubuntu-devel at lists.ubuntu.com
> Usertags: origin-ubuntu ubuntu-patch intrepid
> 
> Attached please find the debdiff used to close Ubuntu LP: 64059 -
> https://bugs.launchpad.net/ubuntu/+source/zaptel/+bug/64059
> as it may be useful to Debian.

Looking at this patch, I see it is invalid. It merely uses the invalid
upstream udev rules file, and that one has wrong user and group.

Attached a patch that fixes most of the problem at the source: changes
device names from zap<something> to zap!<something>. This makes udev put
them automatically under /dev/zap/ ('!' translates as a directory
separator).

A separate udev rule to set the permissions would still be needed, but
we already have that in Debian.

I don't think this patch will ever need applying. But if anybody
actually needs it, go ahead.

The off-by-one part of it should probably get fixed, though.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir
-------------- next part --------------
Add '!' as a directory separator to Zaptel device names. This makes
udev generate files under zap/ on his own.

Also fixes a off-by-one error which happens to be unexploitable.

This is a backport of the fixes from DAHDI: r5179.

--- a/kernel/zaptel-base.c
+++ b/kernel/zaptel-base.c
@@ -5299,7 +5299,7 @@ int zt_register(struct zt_span *span, in
 	for (x = 0; x < span->channels; x++) {
 		char chan_name[50];
 		if (span->chans[x].channo < 250) {
-			sprintf(chan_name, "zap%d", span->chans[x].channo);
+			sprintf(chan_name, "zap!%d", span->chans[x].channo);
 			CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name);
 		}
 	}
@@ -7826,9 +7826,9 @@ int zt_register_chardev(struct zt_charde
 #endif /* CONFIG_DEVFS_FS */
 
 #ifdef CONFIG_ZAP_UDEV
-	char udevname[strlen(dev->name) + 3];
+	char udevname[strlen(dev->name) + sizeof("zap!")];
 
-	strcpy(udevname, "zap");
+	strcpy(udevname, "zap!");
 	strcat(udevname, dev->name);
 	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, dev->minor), NULL, udevname);
 #endif /* CONFIG_ZAP_UDEV */
@@ -7862,10 +7862,10 @@ static int __init zt_init(void) {
 
 #ifdef CONFIG_ZAP_UDEV /* udev support functions */
 	zap_class = class_create(THIS_MODULE, "zaptel");
-	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer");
-	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel");
-	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
-	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");
+	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zap!timer");
+	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zap!channel");
+	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zap!pseudo");
+	CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zap!ctl");
 #endif /* CONFIG_ZAP_UDEV */
 
 #ifdef CONFIG_DEVFS_FS


More information about the Pkg-voip-maintainers mailing list