Commit 5fe9e7ab authored by Paul Martin's avatar Paul Martin Committed by Tobias Frost

Import Debian changes 3.8.6-1

logrotate (3.8.6-1) unstable; urgency=low

  * New upstream release
    - logrotate crashes with sharedscripts when no logs are rotated.
    - Fix potential buffer overflow in parsing config.
  * New patch:
    - mktime-718332.patch: Fix incorrectly initialized struct tm causing
      extra rotations. (Closes: #718332)
parents d7676d03 01d65c7c
3.8.5 -> 3.8.6
- Fixed memory corruption caused by rotation directory which does not
exist with "sharedscripts" together with "prerotate" script.
3.8.4 -> 3.8.5
- Improved rotation during daylight saving time and between timezone
changes.
......
......@@ -812,7 +812,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
if (key == NULL)
continue;
rc = sscanf(key, "%200s %200s%c", createOwner,
rc = sscanf(key, "%199s %199s%c", createOwner,
createGroup, &foo);
if (rc == 3) {
message(MESS_ERROR, "%s:%d extra arguments for "
......@@ -863,11 +863,11 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
if (key == NULL)
continue;
rc = sscanf(key, "%o %200s %200s%c", &createMode,
rc = sscanf(key, "%o %199s %199s%c", &createMode,
createOwner, createGroup, &foo);
/* We support 'create <owner> <group> notation now */
if (rc == 0) {
rc = sscanf(key, "%200s %200s%c",
rc = sscanf(key, "%199s %199s%c",
createOwner, createGroup, &foo);
/* Simulate that we have read createMode and se it
* to NO_MODE. */
......
logrotate (3.8.6-1) unstable; urgency=low
* New upstream release
- logrotate crashes with sharedscripts when no logs are rotated.
- Fix potential buffer overflow in parsing config.
* New patch:
- mktime-718332.patch: Fix incorrectly initialized struct tm causing
extra rotations. (Closes: #718332)
-- Paul Martin <pm@debian.org> Tue, 03 Sep 2013 21:34:00 +0100
logrotate (3.8.5-1) unstable; urgency=low
* New upstream release
......
No longer consider state file dates before 1996 as fatal errors.
(Closes: #65534)
Index: logrotate-3.8.5/logrotate.c
Index: logrotate-3.8.6/logrotate.c
===================================================================
--- logrotate-3.8.5.orig/logrotate.c 2013-06-26 17:59:49.068795186 +0100
+++ logrotate-3.8.5/logrotate.c 2013-06-26 17:59:49.064795112 +0100
@@ -2035,7 +2035,7 @@
--- logrotate-3.8.6.orig/logrotate.c 2013-09-03 21:55:00.397439117 +0100
+++ logrotate-3.8.6/logrotate.c 2013-09-03 21:55:00.393439028 +0100
@@ -2045,7 +2045,7 @@
}
/* Hack to hide earlier bug */
......
Index: logrotate-3.8.6/logrotate.c
===================================================================
--- logrotate-3.8.6.orig/logrotate.c 2013-09-03 21:55:08.153596707 +0100
+++ logrotate-3.8.6/logrotate.c 2013-09-03 22:10:40.012851906 +0100
@@ -2114,12 +2114,14 @@
return 1;
}
+ memset(&st->lastRotated, 0, sizeof(st->lastRotated));
st->lastRotated.tm_year = year;
st->lastRotated.tm_mon = month;
st->lastRotated.tm_mday = day;
st->lastRotated.tm_hour = hour;
st->lastRotated.tm_min = minute;
st->lastRotated.tm_sec = second;
+ st->lastRotated.tm_isdst = -1;
/* fill in the rest of the st->lastRotated fields */
lr_time = mktime(&st->lastRotated);
......@@ -3,3 +3,4 @@ datehack.patch
manpage.patch
cpp-crossbuild.patch
chown-484762.patch
mktime-718332.patch
......@@ -1601,6 +1601,11 @@ int rotateLogSet(struct logInfo *log, int force)
message(MESS_DEBUG, "old logs are removed\n");
}
if (log->numFiles == 0) {
message(MESS_DEBUG, "No logs found. Rotation not needed.\n");
return 0;
}
if (log->flags & LOG_FLAG_SU) {
if (switch_user(log->suUid, log->suGid) != 0) {
return 1;
......@@ -1657,10 +1662,12 @@ int rotateLogSet(struct logInfo *log, int force)
hasErrors |= logHasErrors[i];
}
/* (nemam chyby nebo shared) a (nemam chyby nebo nonshared) */
if (log->pre
&& (!logHasErrors[j] || log->flags & LOG_FLAG_SHAREDSCRIPTS) &&
((!hasErrors && state[j]->doRotate) || (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && state[j]->doRotate) ) ) {
&& (!(
((logHasErrors[j] || !state[j]->doRotate) && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|| (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS))
))
) {
if (!numRotated) {
message(MESS_DEBUG, "not running prerotate script, "
"since no logs will be rotated\n");
......@@ -1694,8 +1701,11 @@ int rotateLogSet(struct logInfo *log, int force)
}
if (log->post
&& (!logHasErrors[j] || log->flags & LOG_FLAG_SHAREDSCRIPTS) &&
((!hasErrors && state[j]->doRotate) || (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && state[j]->doRotate) ) ) {
&& (!(
((logHasErrors[j] || !state[j]->doRotate) && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|| (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS))
))
) {
if (!numRotated) {
message(MESS_DEBUG, "not running postrotate script, "
"since no logs were rotated\n");
......
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.8.5
Version: 3.8.6
Release: 1
License: GPL+
Group: System Environment/Base
......@@ -52,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
%changelog
* Wed Jul 31 2013 Jan Kaluza <jkaluza@redhat.com> 3.8.6-1
- new upstream version
* Mon Jun 10 2013 Jan Kaluza <jkaluza@redhat.com> 3.8.5-1
- new upstream version
......
......@@ -4,7 +4,7 @@ ACL_TESTS=1
SELINUX_TESTS=0
LOGROTATE=../logrotate
M="-m ./mailer"
S=-"s state"
S="-s state"
RLR="$LOGROTATE $M $S"
# -- ACL - BEGIN --------------------------------
......@@ -1284,7 +1284,54 @@ else
echo "Does not have GNU Date, skipping part of this test"
fi
cleanup 51
# ------------------------------- Test 51 ------------------------------------
# regression in 3.8.4, logrotate crashes with sharedscripts when 0 logs rotated
preptest test.log 51 1 0
# It's memory corruption and without something in state file, it won't crash
# reliably. It would be better to run valgrind here and check the errors, but
# I don't want the test-suite to depend on valgrind...
cat > state << EOF
logrotate state -- version 2
"/var/log/httpd/backend_error_log" 2013-6-16
"/var/log/tokyotyrant/*.log" 2011-5-30
"/var/log/mailman/digest" 2011-5-30
"/var/log/piranha/piranha-gui-access" 2011-5-30
"/var/log/boincerr.log" 2011-5-30
"/var/log/btmp" 2013-7-9
"/var/log/httpd/a_log" 2011-11-15
"/var/log/cups/*_log" 2012-7-19
"/var/log/rabbitmq/*.log" 2011-5-30
"/var/log/func/func.log" 2011-11-17
"/var/log/wtmp" 2013-7-9
"/var/log/glusterfs/*glusterd.vol.log" 2011-11-17
"/var/log/imapd.log" 2011-5-30
"/var/log/cobbler/cobbler.log" 2011-11-6
"/var/log/httpd/ssl_access_log" 2013-3-27
"/var/log/mrepo.log" 2011-5-30
EOF
$RLR test-config.51
if [ $? != 0 ]; then
echo "logrotate ended with non-zero exit code (probably crashed)"
exit 3
fi
cleanup 52
# ------------------------------- Test 52 ------------------------------------
# sharedscripts are not run if the first log file does not exist
preptest test.log 52 1 0
$RLR test-config.52
checkoutput <<EOF
test.log 0
test.log.1 0 zero
scriptout 0 foo
EOF
cleanup
/var/log/this_dir_does_not_exist/*log {
size 1
missingok
sharedscripts
prerotate
/usr/bin/some-program
endscript
}
create
/var/log/does_not_exist.log &DIR&/test.log {
rotate 14
size 2
missingok
sharedscripts
postrotate
touch scriptout
echo $(cat scriptout) foo > foo
mv foo scriptout
endscript
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment