summaryrefslogtreecommitdiffstats
path: root/abs/core/bash/privmode-setuid-fail.patch
blob: 059857d0bf98bde29fb353e567ba850cca7d227f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
*** ../bash-4.3-patched/shell.c	2014-01-14 08:04:32.000000000 -0500
--- shell.c	2014-06-06 16:29:01.000000000 -0400
***************
*** 1227,1232 ****
  disable_priv_mode ()
  {
!   setuid (current_user.uid);
!   setgid (current_user.gid);
    current_user.euid = current_user.uid;
    current_user.egid = current_user.gid;
--- 1229,1246 ----
  disable_priv_mode ()
  {
!   int e;
! 
!   if (setuid (current_user.uid) < 0)
!     {
!       e = errno;
!       sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid);
! #if defined (EXIT_ON_SETUID_FAILURE)
!       if (e == EAGAIN)
!	exit (e);
! #endif
!     }
!   if (setgid (current_user.gid) < 0)
!     sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid);
! 
    current_user.euid = current_user.uid;
    current_user.egid = current_user.gid;