summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/abrt-action-install-debuginfo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/abrt-action-install-debuginfo.c b/src/plugins/abrt-action-install-debuginfo.c
index cd5cb9df..b60c4321 100644
--- a/src/plugins/abrt-action-install-debuginfo.c
+++ b/src/plugins/abrt-action-install-debuginfo.c
@@ -16,6 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
@@ -58,6 +59,17 @@ int main(int argc, char **argv)
error_msg_and_die("bad option", arg);
}
+ /* Switch real user/group to effective ones.
+ * Otherwise yum library gets confused - gets EPERM (why??).
+ */
+ gid_t g = getegid();
+ /* do setregid only if we have to, to not upset selinux needlessly */
+ if (g != getgid())
+ setregid(g, g);
+ uid_t u = geteuid();
+ if (u != getuid())
+ setreuid(u, u);
+
/* We use full path, and execv instead of execvp in order to
* disallow user to execute his own abrt-action-install-debuginfo.py
* in his dir by setting up corresponding malicious $PATH.