Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Aug 2001 21:32:19 +0200 (CEST)
From:      Stefan `Sec` Zehl <sec@42.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/30111: Bugfix for net/sendfile port
Message-ID:  <20010826193219.A5706384@ice.42.org>

next in thread | raw e-mail | index | archive | help

>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 <kobras@lists.tat.physik.uni-tuebingen.de>
  *		Colin Phipps <cph@cph.demon.co.uk>
+ *		Stefan `Sec` Zehl <sec@42.org>
  *
  * 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010826193219.A5706384>