From nobody@FreeBSD.org  Sun Mar 21 02:13:01 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 21341106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 21 Mar 2010 02:13:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 108168FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 21 Mar 2010 02:13:01 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o2L2D0tk089548
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 21 Mar 2010 02:13:00 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o2L2D0xC089547;
	Sun, 21 Mar 2010 02:13:00 GMT
	(envelope-from nobody)
Message-Id: <201003210213.o2L2D0xC089547@www.freebsd.org>
Date: Sun, 21 Mar 2010 02:13:00 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] [pkg_install] Replace vsystem'ed call to mkdir(1) in add/futil.c with mkdir(1)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         144921
>Category:       bin
>Synopsis:       [patch] pkg_add(1): Replace vsystem'ed call to mkdir(1) in add/futil.c with mkdir(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 21 02:20:01 UTC 2010
>Closed-Date:    Mon May 21 13:09:53 UTC 2012
>Last-Modified:  Sun Feb 03 22:28:23 UTC 2013
>Originator:     Garrett Cooper
>Release:        9-CURRENT
>Organization:
Cisco Systems, Inc.
>Environment:
>Description:
There's no reason why we should expose the end-user to potential
security issues in creating a subshell, or incur the unnecessary
overhead of using mkdir(1) via vsystem when we can use mkdir(2) instead.
>How-To-Repeat:

>Fix:
See patch.

Patch attached with submission follows:

==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/add/futil.c#1 - /scratch/freebsd/perforce/pkg_install-enhancements/usr.sbin/pkg_install/add/futil.c ====
@@ -50,7 +50,7 @@
 	    }
 	}
 	else {
-	    if (vsystem("/bin/mkdir %s", dir)) {
+	    if (mkdir(dir, 0700) < 0) {
 		if (cp2)
 		    *cp2 = '/';
 		return FAIL;


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: flz 
State-Changed-When: Thu Apr 1 17:07:01 UTC 2010 
State-Changed-Why:  
Committed to HEAD. Will MFC in a few weeks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144921 
Responsible-Changed-From-To: freebsd-bugs->portmgr 
Responsible-Changed-By: flz 
Responsible-Changed-When: Thu Apr 1 17:19:27 UTC 2010 
Responsible-Changed-Why:  
pkg_install is maintained by portmgr. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144921 
State-Changed-From-To: patched->closed 
State-Changed-By: bapt 
State-Changed-When: Mon May 21 13:09:52 UTC 2012 
State-Changed-Why:  
Committed and MFCed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144921 
>Unformatted:
