This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: A patch for setresuid.
- To: drepper@cygnus.com (Ulrich Drepper)
- Subject: Re: A patch for setresuid.
- From: hjl@lucon.org (H.J. Lu)
- Date: Wed, 21 Oct 1998 06:55:45 -0700 (PDT)
- Cc: libc-hacker@cygnus.com (GNU C Library)
1. -1 is special and is allowed by the system call. In fact, seteuid
in glibc passes -1 to setresuid.
2. uid_t is unsigned long int and __kernel_uid_t is unsigned short int.
So (uid_t) -1 == 0xffffffff and (__kernel_uid_t) -1 == 0xffff. As
the result (uid_t) (__kernel_uid_t) -1 == (uid_t) 0xffff. It !=
(uid_t) -1 == 0xffffffff. setresuid always returns EINVAL if
any of uids is -1. That breaks any programs which uses seteuid or
setresuid. I was wondering why you didn't see it.
--
H.J. Lu (hjl@gnu.org)