lkml.org 
[lkml]   [2001]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] setuid(2) buggy or bad docs
From
Date
setuid(2) differs from the OpenBSD setuid(2) in that -EPERM is
returned by the syscall even if the euid of the process matches the
uid passed to it.

Either I am non compos or the thing is very wrong. The docs
(man-pages-1.35) say

ERRORS
EPERM The user is not the super-user, and uid does not
match the effective or saved user ID of the calling
process.

The following untested patch changes the kernel to match the
documentated behaviour.

--- linux-2.4.4-orig/kernel/sys.c Tue May 1 14:34:43 2001
+++ linux-2.4.4/kernel/sys.c Wed Jun 20 01:32:46 2001
@@ -603,7 +603,9 @@ asmlinkage long sys_setuid(uid_t uid)
if (uid != old_ruid && set_user(uid, old_euid != uid) < 0)
return -EAGAIN;
new_suid = uid;
- } else if ((uid != current->uid) && (uid != new_suid))
+ } else if ((uid != current->uid)
+ && (uid != new_suid)
+ && (uid != old_euid))
return -EPERM;

if (old_euid != uid)--
Summer job urgently sought due to last minute visa trouble!
Please see http://ape.n3.net/cv.html
\
 
 \ /
  Last update: 2005-03-22 12:55    [W:0.042 / U:0.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site