bin/121512: [sysctl] [patch] sysctl(8) should return 1 if the user
is not allowed to change values
Romain Tartiere
romain at blogreen.org
Sun Mar 9 10:10:03 UTC 2008
>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 at 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:
More information about the freebsd-bugs
mailing list