From owner-freebsd-ports Sun Aug 26 12:40: 6 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B271D37B405 for ; Sun, 26 Aug 2001 12:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f7QJe1Y40704; Sun, 26 Aug 2001 12:40:01 -0700 (PDT) (envelope-from gnats) Received: from ice.42.org (ice.42.org [194.246.250.222]) by hub.freebsd.org (Postfix) with ESMTP id 5C49837B406 for ; Sun, 26 Aug 2001 12:32:21 -0700 (PDT) (envelope-from sec@ice.42.org) Received: by ice.42.org (Postfix, from userid 1000) id A5706384; Sun, 26 Aug 2001 21:32:19 +0200 (CEST) Message-Id: <20010826193219.A5706384@ice.42.org> Date: Sun, 26 Aug 2001 21:32:19 +0200 (CEST) From: Stefan `Sec` Zehl Reply-To: Stefan `Sec` Zehl To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/30111: Bugfix for net/sendfile port Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 30111 >Category: ports >Synopsis: Bugfix for net/sendfile port >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Sun Aug 26 12:40:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Stefan `Sec` Zehl >Release: FreeBSD 4.4-PRERELEASE i386 >Organization: >Environment: System: FreeBSD ice 4.4-PRERELEASE FreeBSD 4.4-PRERELEASE #7: Tue Aug 14 13:34:25 CEST 2001 root@ice:/usr/export/obj/usr/export/src/sys/ICE i386 >Description: The net/sendfile port has been broken for some time. Users beside root couldn't receive any files. This is because sete[ug]id() return (-1) on FreeBSD when asked to change to the e[ug]id the Process already has. This patch works around the problem, and makes the program usable again. >How-To-Repeat: Send a file to a known user on an affected system: matrix:~>sendfile /etc/motd user@affected.system %sendfile-Info: opening connection to saft://affected.system/user %sendfile-Fatalerror: server error: Internal error on setegid(1001): Operation not permitted >Fix: --- src/sendfiled.c.org Tue Feb 6 00:42:53 2001 +++ src/sendfiled.c Sun Aug 26 21:21:18 2001 @@ -10,6 +10,7 @@ * Chris Foote (chris@senet.com.au) * Daniel Kobras * Colin Phipps + * Stefan `Sec` Zehl * * History: * @@ -138,6 +139,7 @@ * 2001-01-17 Framstag mail2user() now runs in a subprocess * 2001-02-02 Framstag fixed openlog() bug * 2001-02-06 Framstag added timeout on waiting response from client + * 2001-08-26 sec workaround for sete[ug]id on FreeBSD * * * The sendfile-daemon of the sendfile package. @@ -4000,11 +4002,13 @@ * RETURN: nothing, but terminates program on error */ void setreugid() { + if (rgid != getegid()) if (rgid && setegid(rgid)<0) { printf("490 Internal error on setegid(%u): %s\r\n", (unsigned int)rgid,strerror(errno)); exit(1); } + if (ruid != geteuid()) if (ruid && seteuid(ruid)<0) { printf("490 Internal error on seteuid(%u): %s\r\n", (unsigned int)ruid,strerror(errno)); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message