summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-11 07:20:57 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-11 07:20:57 +0100
commitc2009ddeb7052dfe443f0239893f627759580c29 (patch)
tree41a2c5309ff941f45aa0dfbf826e2f92fa59d9c3 /lib
parent1d038a9cf5e154406710800c372631f5c7c3fd81 (diff)
downloadabrt-c2009ddeb7052dfe443f0239893f627759580c29.tar.gz
abrt-c2009ddeb7052dfe443f0239893f627759580c29.tar.xz
abrt-c2009ddeb7052dfe443f0239893f627759580c29.zip
SOSreport/TicketUploader: use more restrictive file modes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Plugins/SOSreport.cpp3
-rw-r--r--lib/Plugins/TicketUploader.cpp2
-rw-r--r--lib/Utils/copyfd.cpp4
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/Plugins/SOSreport.cpp b/lib/Plugins/SOSreport.cpp
index 899b446f..25769105 100644
--- a/lib/Plugins/SOSreport.cpp
+++ b/lib/Plugins/SOSreport.cpp
@@ -103,8 +103,9 @@ void CActionSOSreport::Run(const char *pActionDir, const char *pArgs)
dd.Open(pActionDir);
//Not useful
//dd.SaveText("sosreportoutput", output);
- if (copy_file(sosreport_filename.c_str(), sosreport_dd_filename.c_str()) < 0)
+ if (copy_file(sosreport_filename.c_str(), sosreport_dd_filename.c_str(), 0644) < 0)
{
+ dd.Close();
throw CABRTException(EXCEP_PLUGIN,
"Can't copy '%s' to '%s'",
sosreport_filename.c_str(),
diff --git a/lib/Plugins/TicketUploader.cpp b/lib/Plugins/TicketUploader.cpp
index a4fe0e87..de197912 100644
--- a/lib/Plugins/TicketUploader.cpp
+++ b/lib/Plugins/TicketUploader.cpp
@@ -221,7 +221,7 @@ string CTicketUploader::Report(const map_crash_report_t& pCrashReport,
else if (it->second[CD_TYPE] == CD_BIN)
{
string ofile_name = concat_path_file(tmptar_name.c_str(), it->first.c_str());
- if (copy_file(it->second[CD_CONTENT].c_str(), ofile_name.c_str()) < 0)
+ if (copy_file(it->second[CD_CONTENT].c_str(), ofile_name.c_str(), 0644) < 0)
{
throw CABRTException(EXCEP_PLUGIN,
"Can't copy '%s' to '%s'",
diff --git a/lib/Utils/copyfd.cpp b/lib/Utils/copyfd.cpp
index 9abe7522..fdc568ac 100644
--- a/lib/Utils/copyfd.cpp
+++ b/lib/Utils/copyfd.cpp
@@ -106,7 +106,7 @@ off_t copyfd_eof(int fd1, int fd2)
return full_fd_action(fd1, fd2, 0);
}
-off_t copy_file(const char *src_name, const char *dst_name)
+off_t copy_file(const char *src_name, const char *dst_name, int mode)
{
off_t r;
int src = open(src_name, O_RDONLY);
@@ -115,7 +115,7 @@ off_t copy_file(const char *src_name, const char *dst_name)
perror_msg("Can't open '%s'", src_name);
return -1;
}
- int dst = open(dst_name, O_WRONLY | O_TRUNC | O_CREAT, 0666);
+ int dst = open(dst_name, O_WRONLY | O_TRUNC | O_CREAT, mode);
if (dst < 0)
{
close(src);