Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 May 2006 19:24:22 +0100 (BST)
From:      Mark Ovens <marko@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/98032: [PATCH] sysutils/portmanager dumps core if not run as root
Message-ID:  <20060527182422.9930C1CC7C@postbag.magichamster.com>
Resent-Message-ID: <200605271830.k4RIUKNm055356@freefall.freebsd.org>

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

>Number:         98032
>Category:       ports
>Synopsis:       [PATCH] sysutils/portmanager dumps core if not run as root
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 27 18:30:20 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Mark Ovens
>Release:        FreeBSD 6.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD redshift 6.1-RC FreeBSD 6.1-RC #0: Mon May  1 14:05:04 BST 2006     root@redshift:/usr/obj/usr/src/sys/REDSHIFT  i386


	
>Description:

If portmanager is run as a user other than root it dumps core because the user does not have write perms for /usr/local/share/portmanager/ignore.db. This is not very graceful!

/home/mark{4}% portmanager
touch: /usr/local/share/portmanager/ignore.db: Permission denied
MGdbCreate error, lstat of /usr/local/share/portmanager/ignore.db failed
lstat: No such file or directory
Assertion failed: (0), function MGdbCreate, file MGdbCreate.c, line 64.
Abort (core dumped)
/home/mark{5}%
	
>How-To-Repeat:
Run portmanager as a non-root user
	
>Fix:
Apply the following patch
	

--- portmanager.c.diff begins here ---
--- portmanager/portmanager.c.orig	Tue Dec 13 00:20:58 2005
+++ portmanager/portmanager.c	Sat May 27 18:08:32 2006
@@ -34,7 +34,13 @@
 int	main( int argc, char** argv, char** argp)
 {
 	int	errorCode	= 0;
-	
+
+	if ( getuid() != 0 )
+	{
+		fprintf( stderr, "%s must be run as root\n", argv[0] );
+		exit( 1 );
+	}
+
 	errorCode	= MGPMrCommandLine( argc, (char**)argv, (char**)argp ); 
 	exit( errorCode );
 }
--- portmanager.c.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



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