From owner-freebsd-bugs@FreeBSD.ORG Sun Mar 9 10:10:03 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 571CA1065670 for ; Sun, 9 Mar 2008 10:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 292C78FC23 for ; Sun, 9 Mar 2008 10:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m29AA1bu060723 for ; Sun, 9 Mar 2008 10:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m29AA1D4060722; Sun, 9 Mar 2008 10:10:01 GMT (envelope-from gnats) Resent-Date: Sun, 9 Mar 2008 10:10:01 GMT Resent-Message-Id: <200803091010.m29AA1D4060722@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Romain Tartiere Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C27C1065674 for ; Sun, 9 Mar 2008 10:09:54 +0000 (UTC) (envelope-from romain@blogreen.org) Received: from postfix1-g20.free.fr (postfix1-g20.free.fr [212.27.60.42]) by mx1.freebsd.org (Postfix) with ESMTP id BAA5B8FC19 for ; Sun, 9 Mar 2008 10:09:53 +0000 (UTC) (envelope-from romain@blogreen.org) Received: from smtp3-g19.free.fr (smtp3-g19.free.fr [212.27.42.29]) by postfix1-g20.free.fr (Postfix) with ESMTP id 1D43623A7C86 for ; Sun, 9 Mar 2008 10:39:12 +0100 (CET) Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id D6FF217B597 for ; Sun, 9 Mar 2008 10:39:10 +0100 (CET) Received: from marvin.blogreen.org (marvin.blogreen.org [82.247.213.140]) by smtp3-g19.free.fr (Postfix) with ESMTP id BBB6D17B5C3 for ; Sun, 9 Mar 2008 10:39:10 +0100 (CET) Received: by marvin.blogreen.org (Postfix, from userid 1001) id 51AB55C052; Sun, 9 Mar 2008 10:39:10 +0100 (CET) Message-Id: <20080309093910.51AB55C052@marvin.blogreen.org> Date: Sun, 9 Mar 2008 10:39:10 +0100 (CET) From: Romain Tartiere To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/121512: [sysctl] [patch] sysctl(8) should return 1 if the user is not allowed to change values X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Romain Tartiere List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Mar 2008 10:10:03 -0000 >Number: 121512 >Category: bin >Synopsis: [sysctl] [patch] sysctl(8) should return 1 if the user is not allowed to change values >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Mar 09 10:10:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Romain Tartiere >Release: FreeBSD 7.0-STABLE i386 >Organization: >Environment: System: FreeBSD marvin.blogreen.org 7.0-STABLE FreeBSD 7.0-STABLE #12: Tue Mar 4 14:26:24 CET 2008 root@marvin.blogreen.org:/usr/obj/usr/src/sys/MARVIN i386 >Description: Launching sysctl(8) to tune the system as a regular user will fail because of permissions ... > % sysctl vfs.usermount=1 > vfs.usermount: 1 > sysctl: vfs.usermount: Operation not permitted > % ... but the program still returns 0. Exiting with 1 may be more consistent. The attached patch handle this very particular case. Maybe it is even possible to change the default statement to call err(3) whatever the error is. >How-To-Repeat: % sysctl vfs.usermount=1 && echo Success || echo Failed vfs.usermount: 1 sysctl: vfs.usermount: Operation not permitted Success % >Fix: --- patch-sysctl.c begins here --- --- /usr/src/sbin/sysctl/sysctl.c 2007-06-11 15:02:15.000000000 +0200 +++ sysctl/sysctl.c 2008-03-09 10:23:57.000000000 +0100 @@ -302,6 +302,8 @@ case ENOMEM: errx(1, "%s: type is unknown to this program", string); + case EPERM: + err(1, "%s", string); default: warn("%s", string); return; --- patch-sysctl.c ends here --- >Release-Note: >Audit-Trail: >Unformatted: