do not try to parse config files bigger than 16MB
- remove unused patches
This commit is contained in:
parent
73d8d1d0ef
commit
cf8f914e12
@ -1,67 +0,0 @@
|
|||||||
Index: logrotate.c
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.c (revision 335)
|
|
||||||
+++ logrotate.c (working copy)
|
|
||||||
@@ -410,13 +410,15 @@
|
|
||||||
}
|
|
||||||
if (prev_acl) {
|
|
||||||
if (acl_set_fd(outFile, prev_acl) == -1) {
|
|
||||||
- message(MESS_ERROR, "setting ACL for %s: %s\n",
|
|
||||||
- compressedName, strerror(errno));
|
|
||||||
- acl_free(prev_acl);
|
|
||||||
- prev_acl = NULL;
|
|
||||||
- close(inFile);
|
|
||||||
- close(outFile);
|
|
||||||
- return 1;
|
|
||||||
+ if (errno != ENOTSUP) {
|
|
||||||
+ message(MESS_ERROR, "setting ACL for %s: %s\n",
|
|
||||||
+ compressedName, strerror(errno));
|
|
||||||
+ acl_free(prev_acl);
|
|
||||||
+ prev_acl = NULL;
|
|
||||||
+ close(inFile);
|
|
||||||
+ close(outFile);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
acl_free(prev_acl);
|
|
||||||
prev_acl = NULL;
|
|
||||||
@@ -624,14 +626,16 @@
|
|
||||||
}
|
|
||||||
#ifdef WITH_ACL
|
|
||||||
if (prev_acl) {
|
|
||||||
- if (acl_set_fd(fdsave, prev_acl) == -1) {
|
|
||||||
- message(MESS_ERROR, "setting ACL for %s: %s\n",
|
|
||||||
- saveLog, strerror(errno));
|
|
||||||
- acl_free(prev_acl);
|
|
||||||
- prev_acl = NULL;
|
|
||||||
- close(fdsave);
|
|
||||||
- close(fdcurr);
|
|
||||||
- return 1;
|
|
||||||
+ if ((fdsave, prev_acl) == -1) {
|
|
||||||
+ if (errno != ENOTSUP) {
|
|
||||||
+ message(MESS_ERROR, "setting ACL for %s: %s\n",
|
|
||||||
+ saveLog, strerror(errno));
|
|
||||||
+ acl_free(prev_acl);
|
|
||||||
+ prev_acl = NULL;
|
|
||||||
+ close(fdsave);
|
|
||||||
+ close(fdcurr);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
acl_free(prev_acl);
|
|
||||||
prev_acl = NULL;
|
|
||||||
@@ -1331,9 +1335,11 @@
|
|
||||||
#ifdef WITH_ACL
|
|
||||||
if (prev_acl) {
|
|
||||||
if (acl_set_fd(fd, prev_acl) == -1) {
|
|
||||||
- message(MESS_ERROR, "setting ACL for %s: %s\n",
|
|
||||||
- log->files[logNum], strerror(errno));
|
|
||||||
- hasErrors = 1;
|
|
||||||
+ if (errno != ENOTSUP) {
|
|
||||||
+ message(MESS_ERROR, "setting ACL for %s: %s\n",
|
|
||||||
+ log->files[logNum], strerror(errno));
|
|
||||||
+ hasErrors = 1;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
acl_free(prev_acl);
|
|
||||||
prev_acl = NULL;
|
|
@ -1,97 +0,0 @@
|
|||||||
Index: logrotate.c
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.c (revision 336)
|
|
||||||
+++ logrotate.c (working copy)
|
|
||||||
@@ -786,6 +786,8 @@
|
|
||||||
}
|
|
||||||
if (log->minsize && sb.st_size < log->minsize)
|
|
||||||
state->doRotate = 0;
|
|
||||||
+ if (log->maxsize && sb.st_size > log->maxsize)
|
|
||||||
+ state->doRotate = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The notifempty flag overrides the normal criteria */
|
|
||||||
@@ -1465,6 +1467,9 @@
|
|
||||||
if (log->minsize)
|
|
||||||
message(MESS_DEBUG, "only log files >= %llu bytes are rotated, ", log->minsize);
|
|
||||||
|
|
||||||
+ if (log->maxsize)
|
|
||||||
+ message(MESS_DEBUG, "log files >= %llu are rotated earlier, ", log->minsize);
|
|
||||||
+
|
|
||||||
if (log->logAddress) {
|
|
||||||
message(MESS_DEBUG, "old logs mailed to %s\n", log->logAddress);
|
|
||||||
} else {
|
|
||||||
Index: logrotate.h
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.h (revision 336)
|
|
||||||
+++ logrotate.h (working copy)
|
|
||||||
@@ -36,6 +36,7 @@
|
|
||||||
enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_YEARLY, ROT_SIZE,
|
|
||||||
ROT_FORCE } criterium;
|
|
||||||
unsigned long long threshhold;
|
|
||||||
+ unsigned long long maxsize;
|
|
||||||
unsigned long long minsize;
|
|
||||||
int rotateCount;
|
|
||||||
int rotateAge;
|
|
||||||
Index: config.c
|
|
||||||
===================================================================
|
|
||||||
--- config.c (revision 336)
|
|
||||||
+++ config.c (working copy)
|
|
||||||
@@ -290,6 +290,7 @@
|
|
||||||
to->criterium = from->criterium;
|
|
||||||
to->threshhold = from->threshhold;
|
|
||||||
to->minsize = from->minsize;
|
|
||||||
+ to->maxsize = from->maxsize;
|
|
||||||
to->rotateCount = from->rotateCount;
|
|
||||||
to->rotateAge = from->rotateAge;
|
|
||||||
to->logStart = from->logStart;
|
|
||||||
@@ -504,6 +505,7 @@
|
|
||||||
.criterium = ROT_SIZE,
|
|
||||||
.threshhold = 1024 * 1024,
|
|
||||||
.minsize = 0,
|
|
||||||
+ .maxsize = 0,
|
|
||||||
.rotateCount = 0,
|
|
||||||
.rotateAge = 0,
|
|
||||||
.logStart = -1,
|
|
||||||
@@ -885,7 +887,8 @@
|
|
||||||
newlog->flags |= LOG_FLAG_CREATE;
|
|
||||||
} else if (!strcmp(key, "nocreate")) {
|
|
||||||
newlog->flags &= ~LOG_FLAG_CREATE;
|
|
||||||
- } else if (!strcmp(key, "size") || !strcmp(key, "minsize")) {
|
|
||||||
+ } else if (!strcmp(key, "size") || !strcmp(key, "minsize") ||
|
|
||||||
+ !strcmp(key, "maxsize")) {
|
|
||||||
unsigned long long size = 0;
|
|
||||||
char *opt = key;
|
|
||||||
|
|
||||||
@@ -930,6 +933,8 @@
|
|
||||||
if (!strncmp(opt, "size", 4)) {
|
|
||||||
newlog->criterium = ROT_SIZE;
|
|
||||||
newlog->threshhold = size;
|
|
||||||
+ } else if (!strncmp(opt, "maxsize", 7)) {
|
|
||||||
+ newlog->maxsize = size;
|
|
||||||
} else {
|
|
||||||
newlog->minsize = size;
|
|
||||||
}
|
|
||||||
Index: logrotate.8
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.8 (revision 336)
|
|
||||||
+++ logrotate.8 (working copy)
|
|
||||||
@@ -285,7 +285,17 @@
|
|
||||||
configured address if \fBmaillast\fR and \fBmail\fR are configured.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
-\fBminsize\fR \fIsize\fR
|
|
||||||
+\fBmaxsize\fR \fIsize\fR
|
|
||||||
+Log files are rotated when they grow bigger than \fIsize\fR bytes even
|
|
||||||
+before the additionally specified time interval (\fBdaily\fR, \fBweekly\fR,
|
|
||||||
+\fBmonthly\fR, or \fByearly\fR). The related \fBsize\fR option is similar
|
|
||||||
+except that it is mutually exclusive with the time interval options, and it
|
|
||||||
+causes log files to be rotated without regard for the last rotation time.
|
|
||||||
+When \fBmaxsize\fR is used, both the size and timestamp of a log file are
|
|
||||||
+considered.
|
|
||||||
+
|
|
||||||
+.TP
|
|
||||||
+\fBminsize\fR \fIsize\fR
|
|
||||||
Log files are rotated when they grow bigger than \fIsize\fR bytes, but not
|
|
||||||
before the additionally specified time interval (\fBdaily\fR, \fBweekly\fR,
|
|
||||||
\fBmonthly\fR, or \fByearly\fR). The related \fBsize\fR option is similar
|
|
@ -1,11 +0,0 @@
|
|||||||
Index: /trunk/examples/logrotate.cron
|
|
||||||
===================================================================
|
|
||||||
--- a/examples/logrotate.cron (revision 268)
|
|
||||||
+++ b/examples/logrotate.cron (revision 334)
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
-/usr/sbin/logrotate /etc/logrotate.conf >/dev/null 2>&1
|
|
||||||
+/usr/sbin/logrotate /etc/logrotate.conf
|
|
||||||
EXITVALUE=$?
|
|
||||||
if [ $EXITVALUE != 0 ]; then
|
|
@ -1,44 +0,0 @@
|
|||||||
Index: trunk/config.c
|
|
||||||
===================================================================
|
|
||||||
--- trunk/config.c (revision 334)
|
|
||||||
+++ trunk/config.c (working copy)
|
|
||||||
@@ -891,7 +891,6 @@
|
|
||||||
|
|
||||||
if ((key = isolateValue(configFile, lineNum, opt, &start,
|
|
||||||
&buf, length)) != NULL) {
|
|
||||||
- free(opt);
|
|
||||||
int l = strlen(key) - 1;
|
|
||||||
if (key[l] == 'k') {
|
|
||||||
key[l] = '\0';
|
|
||||||
@@ -903,6 +902,7 @@
|
|
||||||
key[l] = '\0';
|
|
||||||
multiplier = 1024 * 1024 * 1024;
|
|
||||||
} else if (!isdigit(key[l])) {
|
|
||||||
+ free(opt);
|
|
||||||
message(MESS_ERROR, "%s:%d unknown unit '%c'\n",
|
|
||||||
configFile, lineNum, key[l]);
|
|
||||||
if (newlog != defConfig) {
|
|
||||||
@@ -919,6 +919,7 @@
|
|
||||||
if (*chptr) {
|
|
||||||
message(MESS_ERROR, "%s:%d bad size '%s'\n",
|
|
||||||
configFile, lineNum, key);
|
|
||||||
+ free(opt);
|
|
||||||
if (newlog != defConfig) {
|
|
||||||
state = STATE_ERROR;
|
|
||||||
continue;
|
|
||||||
@@ -926,11 +927,13 @@
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- if (!strncmp(key, "size", 4)) {
|
|
||||||
+ if (!strncmp(opt, "size", 4)) {
|
|
||||||
newlog->criterium = ROT_SIZE;
|
|
||||||
newlog->threshhold = size;
|
|
||||||
- } else
|
|
||||||
+ } else {
|
|
||||||
newlog->minsize = size;
|
|
||||||
+ }
|
|
||||||
+ free(opt);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
free(opt);
|
|
@ -1,24 +0,0 @@
|
|||||||
Index: logrotate.8
|
|
||||||
===================================================================
|
|
||||||
--- logrotate.8 (revision 347)
|
|
||||||
+++ logrotate.8 (working copy)
|
|
||||||
@@ -434,8 +434,8 @@
|
|
||||||
Log files are rotated only if they grow bigger then \fIsize\fR bytes. If
|
|
||||||
\fIsize\fR is followed by \fIk\fR, the size is assumed to be in kilobytes.
|
|
||||||
If the \fIM\fR is used, the size is in megabytes, and if \fIG\fR is used, the
|
|
||||||
-size is in gigabytes. So \fBsize 100\fR, \fIsize 100k\fR, \fIsize 100M\fR and
|
|
||||||
-\fIsize 100G\f are all valid.
|
|
||||||
+size is in gigabytes. So \fIsize 100\fR, \fIsize 100k\fR, \fIsize 100M\fR and
|
|
||||||
+\fIsize 100G\fR are all valid.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBsharedscripts\fR
|
|
||||||
@@ -459,7 +459,7 @@
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBshredcycles\fR \fIcount\fR
|
|
||||||
-Asks GNU \fBshred\fR(1) to overwite log files \fBcount\fR times before
|
|
||||||
+Asks GNU \fBshred\fR(1) to overwrite log files \fBcount\fR times before
|
|
||||||
deletion. Without this option, \fBshred\fR's default will be used.
|
|
||||||
|
|
||||||
.TP
|
|
@ -1,45 +0,0 @@
|
|||||||
Index: /trunk/config.c
|
|
||||||
===================================================================
|
|
||||||
--- trunk/config.c (revision 343)
|
|
||||||
+++ trunk/config.c (revision 344)
|
|
||||||
@@ -600,4 +600,5 @@
|
|
||||||
static unsigned recursion_depth = 0U;
|
|
||||||
char *globerr_msg = NULL;
|
|
||||||
+ int in_config = 0;
|
|
||||||
struct flock fd_lock = {
|
|
||||||
.l_start = 0,
|
|
||||||
@@ -1301,4 +1302,5 @@
|
|
||||||
key = NULL;
|
|
||||||
} else if (*start == '/' || *start == '"' || *start == '\'') {
|
|
||||||
+ in_config = 0;
|
|
||||||
if (newlog != defConfig) {
|
|
||||||
message(MESS_ERROR, "%s:%d unexpected log filename\n",
|
|
||||||
@@ -1323,8 +1325,16 @@
|
|
||||||
|
|
||||||
endtag = start;
|
|
||||||
- while (endtag - buf < length && *endtag != '{' && *endtag != '\0') {
|
|
||||||
+ while (endtag - buf < length && *endtag != '{' && *endtag != '}' && *endtag != '\0') {
|
|
||||||
endtag++;}
|
|
||||||
if (endtag - buf > length)
|
|
||||||
continue;
|
|
||||||
+ if (*endtag == '}') {
|
|
||||||
+ message(MESS_ERROR, "%s:%d unexpected } (missing previous '{')\n", configFile,
|
|
||||||
+ lineNum);
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ if (*endtag == '{') {
|
|
||||||
+ in_config = 1;
|
|
||||||
+ }
|
|
||||||
char *key = strndup(start, endtag - start);
|
|
||||||
start = endtag;
|
|
||||||
@@ -1418,4 +1428,10 @@
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
+ if (!in_config) {
|
|
||||||
+ message(MESS_ERROR, "%s:%d unexpected } (missing previous '{')\n", configFile,
|
|
||||||
+ lineNum);
|
|
||||||
+ goto error;
|
|
||||||
+ }
|
|
||||||
+ in_config = 0;
|
|
||||||
if (globerr_msg) {
|
|
||||||
if (!(newlog->flags & LOG_FLAG_MISSINGOK))
|
|
18
logrotate-3.8.4-big-config.patch
Normal file
18
logrotate-3.8.4-big-config.patch
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Index: config.c
|
||||||
|
===================================================================
|
||||||
|
--- a/config.c (revision 415)
|
||||||
|
+++ b/config.c (working copy)
|
||||||
|
@@ -695,6 +695,13 @@
|
||||||
|
|
||||||
|
length = sb.st_size;
|
||||||
|
|
||||||
|
+ if (length > 0xffffff) {
|
||||||
|
+ message(MESS_ERROR, "file %s too large, probably not a config file.\n",
|
||||||
|
+ configFile);
|
||||||
|
+ close(fd);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* We can't mmap empty file... */
|
||||||
|
if (length == 0) {
|
||||||
|
message(MESS_DEBUG,
|
@ -1,11 +1,12 @@
|
|||||||
Summary: Rotates, compresses, removes and mails system log files
|
Summary: Rotates, compresses, removes and mails system log files
|
||||||
Name: logrotate
|
Name: logrotate
|
||||||
Version: 3.8.4
|
Version: 3.8.4
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPL+
|
License: GPL+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Url: https://fedorahosted.org/logrotate/
|
Url: https://fedorahosted.org/logrotate/
|
||||||
Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
|
Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
|
||||||
|
Patch0: logrotate-3.8.4-big-config.patch
|
||||||
|
|
||||||
Requires: coreutils >= 5.92 popt
|
Requires: coreutils >= 5.92 popt
|
||||||
BuildRequires: libselinux-devel popt-devel libacl-devel acl
|
BuildRequires: libselinux-devel popt-devel libacl-devel acl
|
||||||
@ -24,6 +25,7 @@ log files on your system.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1 -b .bigconfig
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes WITH_ACL=yes
|
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes WITH_ACL=yes
|
||||||
@ -57,6 +59,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
|
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 14 2013 Jan Kaluza <jkaluza@redhat.com> - 3.8.4-2
|
||||||
|
- do not try to parse config files bigger than 16MB
|
||||||
|
- remove unused patches
|
||||||
|
|
||||||
* Tue Apr 30 2013 Jan Kaluza <jkaluza@redhat.com> - 3.8.4-1
|
* Tue Apr 30 2013 Jan Kaluza <jkaluza@redhat.com> - 3.8.4-1
|
||||||
- new upstream version 3.8.4
|
- new upstream version 3.8.4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user