Magellan Linux

Annotation of /trunk/bash/patches/bash-4.3-fix-setuid.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2438 - (hide annotations) (download)
Wed Jun 11 07:12:40 2014 UTC (9 years, 11 months ago) by niro
File size: 890 byte(s)
-added security fix
1 niro 2438 diff --git shell.c shell.c
2     index bbc8a66..5bfd466 100644
3     --- shell.c
4     +++ shell.c
5     @@ -1226,8 +1226,12 @@ uidget ()
6     void
7     disable_priv_mode ()
8     {
9     - setuid (current_user.uid);
10     - setgid (current_user.gid);
11     +
12     + if( (setuid (current_user.uid) !=0) || (setgid (current_user.gid) != 0) ){
13     + report_error("Drop privileges failed!!\n");
14     + exit(EX_DROPFAIL);
15     + }
16     +
17     current_user.euid = current_user.uid;
18     current_user.egid = current_user.gid;
19     }
20     diff --git shell.h shell.h
21     index 243e467..c3625be 100644
22     --- shell.h
23     +++ shell.h
24     @@ -72,6 +72,7 @@ extern int EOF_Reached;
25     #define EX_REDIRFAIL 259 /* redirection failed */
26     #define EX_BADASSIGN 260 /* variable assignment error */
27     #define EX_EXPFAIL 261 /* word expansion failed */
28     +#define EX_DROPFAIL 262 /* Drop privileges failed */
29    
30     /* Flag values that control parameter pattern substitution. */
31     #define MATCH_ANY 0x000