Date: Mon, 24 Jul 2000 11:41:10 -0400 (EDT) From: Cyrus Rahman <cr@jcmax.com> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/20141: ports: comms/hylafax patch-ad breaks serial line locking Message-ID: <200007241541.LAA46118@plasma.jcmax.com>
next in thread | raw e-mail | index | archive | help
>Number: 20141 >Category: ports >Synopsis: Hylafax fails to correctly lock serial devices >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 24 08:50:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Cyrus Rahman >Release: FreeBSD 4.1-RC i386 >Organization: >Environment: Hylafax 4.2b2 as currently distributed in the ports collection. >Description: Hylafax has recently been patched to eliminate some unchecked string operations. One of these patches is incorrect and causes the pid of the process trying to lock a serial device in /var/spool/lock to be incorrectly written into the lock file. >How-To-Repeat: Run hylafax with faxgetty and notice how multiple processes write to the modem at the same time. >Fix: The second part of patch listed here (currently part of patch-ad) is not necessary: diff -ruN faxd/UUCPLock.c++.orig faxd/UUCPLock.c++ --- faxd/UUCPLock.c++.orig Sun Jun 13 00:41:05 1999 +++ faxd/UUCPLock.c++ Mon Jun 12 21:56:52 2000 @@ -37,6 +37,7 @@ } #endif #include <pwd.h> +#include <grp.h> /* * UUCP Device Locking Support. @@ -148,6 +149,13 @@ UUCPuid = pwd->pw_uid; UUCPgid = pwd->pw_gid; endpwent(); // paranoia + + + const group *grp = getgrnam("dialer"); + if (!grp) + faxApp::fatal("Can not deduce identity of DIALER"); + UUCPgid = grp->gr_gid; + endgrent(); // paranoia } } uid_t UUCPLock::getUUCPUid() { setupIDs(); return UUCPuid; } @@ -307,7 +315,7 @@ AsciiUUCPLock::setPID(pid_t pid) { // XXX should this be %d or %ld? depends on pid_t - sprintf((char*) data, "%*d\n", UUCP_PIDDIGITS, pid); + snprintf((char*) data, sizeof(data), "%*d\n", UUCP_PIDDIGITS, pid); } bool To fix the problem remove the second part of this patch, e.g. the seven lines beginning with '@@ -307'. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007241541.LAA46118>