ports/128091: zaptel drivers can't be used when asterisk runs as non-root

Wojciech Puchar wojtek at tensor.gdynia.pl
Tue Oct 14 12:40:01 UTC 2008


>Number:         128091
>Category:       ports
>Synopsis:       zaptel drivers can't be used when asterisk runs as non-root
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 14 12:40:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Wojciech Puchar
>Release:        RELENG_7
>Organization:
TENSOR ap
>Environment:
FreeBSD wojtek.tensor.gdynia.pl 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Thu Oct  9 21:12:09 CEST 2008     root at wojtek.tensor.gdynia.pl:/usr/src/sys/i386/compile/p234  i386

>Description:
zaptel drivers create nodes in /dev/zap owned by root. asterisk can't open it when running as user.
>How-To-Repeat:
try using zaptel with asterisk running as non-root
>Fix:
yes.

patch Makefile  (/usr/ports/misc/zaptel) with that:

--- Makefile.orig       2008-08-15 20:48:56.000000000 +0200
+++ Makefile    2008-10-14 14:23:06.000000000 +0200
@@ -24,6 +24,15 @@
 MAKE_ENV=      KMODDIR=${PREFIX}/lib/zaptel
 SUB_FILES=     pkg-message
 USE_RC_SUBR=   zaptel
+EXTRA_PATCHES+= ${PATCHDIR}/uidgid
+
+.if defined(ZAP_UID)
+MAKE_ARGS+=    ZAP_UID=${ZAP_UID}
+.endif
+
+.if defined(ZAP_GID)
+MAKE_ARGS+=    ZAP_GID=${ZAP_GID}
+.endif
 
 .include <bsd.port.pre.mk>


and make file files/uidgid containing:
--- zaptel/Makefile~    2008-10-14 14:28:49.000000000 +0200
+++ zaptel/Makefile     2008-10-14 14:28:49.000000000 +0200
@@ -6,6 +6,18 @@
 # CFLAGS+=-g
 CLEANFILES+=gendigits tones.h
 WERROR=-Wall
+.if defined(ZAP_UID)
+CFLAGS+= -DZAP_UID=${ZAP_UID}
+.else
+CFLAGS+= -DZAP_UID=0
+.endif
+
+.if defined(ZAP_GID)
+CFLAGS+= -DZAP_GID=${ZAP_GID}
+.else
+CFLAGS+= -DZAP_GID=0
+.endif
+
 
 SRCS+=device_if.h bus_if.h vnode_if.h

--- zaptel/zaptel.c.orig        2008-10-13 14:30:59.000000000 +0200
+++ zaptel/zaptel.c     2008-10-13 14:31:22.000000000 +0200
@@ -457,7 +457,7 @@
        snprintf(tmpname, 20, "%s%d", name, u);
 
        *dev = make_dev(&zt_devsw, unit2minor(u),
-               UID_ROOT, GID_WHEEL, 0600, tmpname);
+               ZAP_UID, ZAP_GID, 0600, tmpname);
 
        if(*dev)
        {
@@ -1233,7 +1233,7 @@
                 * zt_clone will get "zap" string as name instead of 
                 * "zap/timer" or something
                 */
-               dev_ctl = make_dev(&zt_devsw, 0, UID_ROOT, GID_WHEEL, 0664, 
+               dev_ctl = make_dev(&zt_devsw, 0, ZAP_UID, ZAP_GID, 0664, 
                                   "zap/ctl");
 
                printf("Zapata Telephony Interface Registered on major %d\n", 



this 2 files attached as single .txt file, filter through uudecode|tar xf -

Patch attached with submission follows:

begin 600 -
M'XL(`+^2]$@"`^V6_4_30!C'^;7]*YY,,<.^[/H*3F>8HXP%$-*!&&/2E/76
MG73MTMXD:O!O]^G:$3*&^(M$D_MDV5UZ]WWN>>ESVW%X1<<LH?HLY*/)QE^!
M$.+:-N!H;#O6W;'"-2TP#++MX)=CFD`,VW:=#2`;3\"\X&&.KEQG7SB]>GC?
M8^M5*'`[_B=HF@;'RW<@RUDLF83L:/@Q'#!)V]YI.ZZ^K!0!A>"ZK"C*K:H2
M&$0S;##LMFFUR7W![BYHIJVZH.`W6M[=E>&X>^@%WOL/'>GP^&1O;^!WGO\X
M];W]P<>;5L(N6]_#&:>)#,/S=\'^X,@;=J395:Q-:5&$,97A?.@%?B_`9;\C
MU9L5[^.9WPU.NV>]`V^H=`!-EG.T?M.:LRAFD:S(BL[&$*'W*8V:G[JGP?E@
M;T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