From 4739232edf3e57c32d108567c7e74b081b7ca0e3 Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Fri, 14 Aug 2009 17:20:47 +0200 Subject: created conf file has uid,gid of an user --- src/Daemon/PluginManager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Daemon/PluginManager.cpp') diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp index 3fb81c0..f4fe273 100644 --- a/src/Daemon/PluginManager.cpp +++ b/src/Daemon/PluginManager.cpp @@ -281,7 +281,15 @@ void CPluginManager::SetPluginSettings(const std::string& pName, std::string home = get_home_dir(atoi(pUID.c_str())); if (home != "") { - SavePluginSettings(home + "/.abrt/" + pName + "." + PLUGINS_CONF_EXTENSION, pSettings); + std::string confPath = home + "/.abrt/" + pName + "." + PLUGINS_CONF_EXTENSION; + SavePluginSettings(confPath, pSettings); + uid_t uid = atoi(pUID.c_str()); + struct passwd* pw = getpwuid(uid); + gid_t gid = pw ? pw->pw_gid : uid; + if (chown(confPath.c_str(), uid, gid) == -1) + { + perror_msg("can't change '%s' ownership to %u:%u", confPath.c_str(), (int)uid, (int)gid); + } } } } -- cgit