Blame SOURCES/bash-5.0-cve-2019-18276.patch

e658f2
diff --git a/config.h.in b/config.h.in
e658f2
index 1a89e85..2df4786 100644
e658f2
--- a/config.h.in
e658f2
+++ b/config.h.in
e658f2
@@ -801,6 +801,14 @@
e658f2
 #undef HAVE_SETREGID
e658f2
 #undef HAVE_DECL_SETREGID
e658f2
 
e658f2
+/* Define if you have the setregid function.  */
e658f2
+#undef HAVE_SETRESGID
e658f2
+#undef HAVE_DECL_SETRESGID
e658f2
+
e658f2
+/* Define if you have the setresuid function.  */
e658f2
+#undef HAVE_SETRESUID
e658f2
+#undef HAVE_DECL_SETRESUID
e658f2
+
e658f2
 /* Define if you have the setvbuf function.  */
e658f2
 #undef HAVE_SETVBUF
e658f2
 
e658f2
diff --git a/configure.ac b/configure.ac
e658f2
index a3f6d8f..e5162c4 100644
e658f2
--- a/configure.ac
e658f2
+++ b/configure.ac
e658f2
@@ -799,6 +799,7 @@ AC_CHECK_DECLS([confstr])
e658f2
 AC_CHECK_DECLS([printf])
e658f2
 AC_CHECK_DECLS([sbrk])
e658f2
 AC_CHECK_DECLS([setregid])
e658f2
+AC_CHECK_DECLS[(setresuid, setresgid])
e658f2
 AC_CHECK_DECLS([strcpy])
e658f2
 AC_CHECK_DECLS([strsignal])
e658f2
 
e658f2
diff --git a/shell.c b/shell.c
e658f2
index 4aae182..484d8a9 100644
e658f2
--- a/shell.c
e658f2
+++ b/shell.c
e658f2
@@ -1286,7 +1286,11 @@ disable_priv_mode ()
e658f2
 {
e658f2
   int e;
e658f2
 
e658f2
+#if HAVE_DECL_SETRESUID
e658f2
+  if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0)
e658f2
+#else
e658f2
   if (setuid (current_user.uid) < 0)
e658f2
+#endif
e658f2
     {
e658f2
       e = errno;
e658f2
       sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid);
e658f2
@@ -1295,7 +1299,11 @@ disable_priv_mode ()
e658f2
 	exit (e);
e658f2
 #endif
e658f2
     }
e658f2
+#if HAVE_DECL_SETRESGID
e658f2
+  if (setresgid (current_user.gid, current_user.gid, current_user.gid) < 0)
e658f2
+#else
e658f2
   if (setgid (current_user.gid) < 0)
e658f2
+#endif
e658f2
     sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid);
e658f2
 
e658f2
   current_user.euid = current_user.uid;
e658f2
-- 
e658f2
2.25.4