🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #47

Problem with fileutils 3.4: chown(2) priviledged

#47
From: Jason Merrill
Date: Mon, 02 Nov 1992 07:11
35 lines
1735 bytes
On the Sequent Symmetry, the system call chown(2) is considered
priviledged; if a non-superuser calls it, the call fails and errno is set
to EPERM.  This breaks chgrp and install rather badly.  The supplied
chgrp is setuid root, and the install doesn't set gid unless you're root.
Even the call chown(fname,-1,-1) fails.

Under Ultrix 4.2A (47), the situation is identical, as far as I can tell.

Under SunOS 4.1.2, the situation is the same except that chgrp isn't setuid
root, so no one can chgrp their files.

Is there a solution for this?  Why isn't there a separate library function
to set the group?

At any rate, install(1) shouldn't fail every time a non-root user runs it.

This patch will make install act like it does on these machines; there
should probably be a check for this behavior in configure.

--- /tmp/RCSA005056	Sun Nov  1 23:10:19 1992
+++ install.c	Sun Nov  1 23:06:53 1992
@@ -379,7 +379,7 @@
      want to know.  But AFS returns EPERM when you try to change a
      file's group; thus the kludge.  */
 
-  if (chown (path, owner_id, group_id)
+  if (getuid() == 0 && chown (path, owner_id, group_id)
 #ifdef AFS
       && errno != EPERM
 #endif


--
Jason Merrill
jason@jarthur.claremont.edu
Technical Details
Message-ID: <1992Nov2.071132.18627@muddcs.claremont.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jarthur.claremont.edu!jason

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!jarthur.claremont.edu!jason
From: jason@jarthur.claremont.edu (Jason Merrill)
Subject: Problem with fileutils 3.4: chown(2) priviledged
Message-ID: <1992Nov2.071132.18627@muddcs.claremont.edu>
Sender: gnulists@ai.mit.edu
Organization: Harvey Mudd College, Claremont, CA 91711
Distribution: gnu
Date: Mon, 2 Nov 1992 07:11:32 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 36