]> WPIA git - gigi.git/commit
add: support configuring SetUID behavior
authorLucas Werkmeister <mail@lucaswerkmeister.de>
Wed, 7 Sep 2016 13:03:47 +0000 (15:03 +0200)
committerLucas Werkmeister <mail@lucaswerkmeister.de>
Tue, 20 Sep 2016 16:00:33 +0000 (18:00 +0200)
commita59b5c1709ac6fd9b5be043119425338576e9bc7
treed4b5f3d8ff8fc027dfaef6693d6ac441f479c0cf
parentccac61faa88e98f12aaa3b5c5e64d26f3fc003c9
add: support configuring SetUID behavior

- It is now possible to skip the setuid step altogether by setting both
  UID and GID to the special value -1.
- The Java code now verifies that the values are in range for an
  unsigned 16-bit ID.
- The C code now verifies that the cast from jint to uid_t/gid_t does
  not overflow.
- The C code now skips setuid() or setgid() if the real and effective ID
  are already the desired ID.

The 16-bit limit is somewhat arbitrary. Some old UNIX systems, such as
PWB/UNIX, supported only 8-bit IDs (see for example
/usr/man/man2/getuid.2 in Henry Spencer’s tarball); Wikipedia claims
that some other UNIX systems used 15-bit values, but does not specify
which systems; Linux originally supported 16-bit IDs but then added
support for 32-bit IDs with new syscalls in Linux 2.4. On Debian
systems, the nobody user (default setuid target) is 65534, so we need to
allow at least 16-bit IDs, otherwise the default value is invalid.

Change-Id: I66600572016b18d5ff550560048cdf691dec85e8
natives/org_cacert_gigi_natives_SetUID.c
src/org/cacert/gigi/Launcher.java