diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-20 14:29:21 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-20 14:29:21 +0100 |
commit | 3a7ca2d4447aafc43168c220894a7261ead9e05d (patch) | |
tree | 6083a34748d25d071037d073096edf1d07886aa2 | |
parent | ddd077dc416c1ceef7f803b4d618bd6d302f6ed1 (diff) | |
download | abrt-3a7ca2d4447aafc43168c220894a7261ead9e05d.tar.gz abrt-3a7ca2d4447aafc43168c220894a7261ead9e05d.tar.xz abrt-3a7ca2d4447aafc43168c220894a7261ead9e05d.zip |
fix a case where we don't process a crash if uid has no user record
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | lib/Plugins/CCpp.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 83b0e9a3..d83d9b5a 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -99,10 +99,11 @@ static pid_t ExecVP(char** pArgs, uid_t uid, string& pOutput) int pipeout[2]; pid_t child; + gid_t gid = uid; struct passwd* pw = getpwuid(uid); - if (!pw) + if (pw) { - throw CABRTException(EXCEP_PLUGIN, string(__func__) + ": cannot get GID for UID."); + gid = pw->pw_gid; } xpipe(pipeout); @@ -124,8 +125,8 @@ static pid_t ExecVP(char** pArgs, uid_t uid, string& pOutput) /* Not a good idea, we won't see any error messages */ /* close(STDERR_FILENO); */ - setgroups(1, &pw->pw_gid); - setregid(pw->pw_gid, pw->pw_gid); + setgroups(1, &gid); + setregid(gid, gid); setreuid(uid, uid); setsid(); |