ad349c46b4
- add logrotate-CVE-2011-1098.patch (bnc#677336) - add logrotate-shred-CVE-2011-1154.patch (bnc#679661) - add logrotate-CVE-2011-1155.patch (bnc#679662) OBS-URL: https://build.opensuse.org/request/show/70307 OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=12
34 lines
1.1 KiB
Diff
34 lines
1.1 KiB
Diff
Index: logrotate-3.7.9/logrotate.c
|
|
===================================================================
|
|
--- logrotate-3.7.9.orig/logrotate.c
|
|
+++ logrotate-3.7.9/logrotate.c
|
|
@@ -204,7 +204,9 @@ int createOutputFile(char *fileName, int
|
|
{
|
|
int fd;
|
|
|
|
- fd = open(fileName, flags, sb->st_mode);
|
|
+ unlink(fileName);
|
|
+ fd = open(fileName, (flags | O_EXCL | O_NOFOLLOW),
|
|
+ (S_IRUSR | S_IWUSR) & sb->st_mode);
|
|
if (fd < 0) {
|
|
message(MESS_ERROR, "error creating output file %s: %s\n",
|
|
fileName, strerror(errno));
|
|
@@ -316,7 +318,7 @@ static int compressLogFile(char *name, s
|
|
}
|
|
|
|
outFile =
|
|
- createOutputFile(compressedName, O_RDWR | O_CREAT | O_TRUNC, sb);
|
|
+ createOutputFile(compressedName, O_RDWR | O_CREAT, sb);
|
|
if (outFile < 0) {
|
|
close(inFile);
|
|
return 1;
|
|
@@ -495,7 +497,7 @@ static int copyTruncate(char *currLog, c
|
|
}
|
|
#endif
|
|
fdsave =
|
|
- createOutputFile(saveLog, O_WRONLY | O_CREAT | O_TRUNC, sb);
|
|
+ createOutputFile(saveLog, O_WRONLY | O_CREAT, sb);
|
|
#ifdef WITH_SELINUX
|
|
if (selinux_enabled) {
|
|
setfscreatecon_raw(prev_context);
|