Commit e86a2956 authored by Tobias Frost's avatar Tobias Frost

Import Upstream version 3.8.0

parent f8f1380f
3.7.9 -> 3.8.0
- added "dateyesterday" option (see man page)
- fixed crash when config file had exactly 4096*N bytes
- added WITH_ACL make option to link against -lacl and preserve ACLs
during rotation
- added "su" option to define user/group for rotation. Logrotate now
skips directories which are world writable or writable by group
which is not "root" unless "su" directive is used.
- fixed CVE-2011-1098: race condition by creation of new files
- fixed possible shell injection when using "shred" directive (CVE-2011-1154)
- fixed escaping of file names within 'write state' action (CVE-2011-1155)
- better 'size' directive description
- fixed possible buffer-overflow when reading config files
- NetBSD/FreeBSD compilation fixes
- Solaris compilation fixes
3.7.8 -> 3.7.9
- fix building on Solaris (patch by András Szilárd)
- don't copy config files on the stack -- mmap them instead
......@@ -15,6 +15,11 @@ CFLAGS += -DWITH_SELINUX
LOADLIBES += -lselinux
ifeq ($(WITH_ACL),yes)
LOADLIBES += -lacl
# HP-UX using GCC
ifeq ($(OS_NAME),HP-UX)
ifeq ($(RPM_OPT_FLAGS),)
......@@ -36,13 +41,14 @@ endif
# Solaris using gcc
ifeq ($(OS_NAME),SunOS)
ifeq ($(RPM_OPT_FLAGS),)
CC ?= gcc
CPP = $(CC) -E -M
INSTALL = /usr/ucb/install
ifeq ($(CC),cc)
CPP = cc -xM
CC = gcc
INSTALL = install
LOADLIBES += -lasprintf
ifeq ($(BASEDIR),)
ifeq ($(BASEDIR),)
BASEDIR = /usr/local
......@@ -53,6 +59,20 @@ ifeq ($(OS_NAME),Linux)
BASEDIR = /usr
# FreeBSD
ifeq ($(OS_NAME),FreeBSD)
CFLAGS += -I${LOCALBASE}/include
ifeq ($(OS_NAME),NetBSD)
CFLAGS += -I/usr/include
CFLAGS += -I$(BASEDIR)/include
LOADLIBES += -L/usr/lib
ifneq ($(POPT_DIR),)
......@@ -107,11 +127,15 @@ install:
$(INSTALL) $(PROG) $(PREFIX)/$(BINDIR) 0755 bin bin; \
$(INSTALL) $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"` 0644 bin bin; \
$(INSTALL) $(MAN5) $(PREFIX)/$(MANDIR)/man`echo $(MAN5) | sed "s/.*\.//"` 0644 bin bin; \
else if [ "$(OS_NAME)" = FreeBSD ]; then \
$(BSD_INSTALL_MAN) $(MAN) $(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \
$(BSD_INSTALL_MAN) $(MAN5) $(MANDIR)/man`echo $(MAN5) | sed "s/.*\.//"`/$(MAN5); \
else \
$(INSTALL) -m 755 $(PROG) $(PREFIX)/$(BINDIR); \
$(INSTALL) -m 644 $(MAN) $(PREFIX)/$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \
$(INSTALL) -m 644 $(MAN5) $(PREFIX)/$(MANDIR)/man`echo $(MAN5) | sed "s/.*\.//"`/$(MAN5); \
fi; fi
co RCS/*,v
This diff is collapsed.
......@@ -2,6 +2,8 @@
* OS-specific definitions
#define ROOT_UID 0
#ifdef __hpux
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/contrib/bin/gzip"
......@@ -16,6 +18,13 @@
#define STATEFILE "/var/log/logrotate.status"
#ifdef __NetBSD__
#define DEFAULT_MAIL_COMMAND "/usr/bin/mail -s"
#define COMPRESS_COMMAND "/usr/bin/gzip"
#define UNCOMPRESS_COMMAND "/usr/bin/gunzip"
#define STATEFILE "/var/log/logrotate.status"
* Default settings for Linux - leave these last.
......@@ -11,9 +11,9 @@ removal, and mailing of log files. Each log file may be handled daily,
weekly, monthly, or when it grows too large.
Normally, \fBlogrotate\fR is run as a daily cron job. It will not modify
a log multiple times in one day unless the criterium for that log is
a log multiple times in one day unless the criterion for that log is
based on the log's size and \fBlogrotate\fR is being run multiple times
each day, or unless the \fB-f\fR or \fB-force\fR option is used.
each day, or unless the \fB-f\fR or \fB--force\fR option is used.
Any number of config files may be given on the command line. Later config
files may override the options given in earlier files, so the order
......@@ -31,7 +31,11 @@ non-zero status.
\fB-?\fR, \fB-\-help\fR
Prints help message.
\fB-d\fR, \fB-\-debug\fR
Turns on debug mode and implies \fB-v\fR. In debug mode, no changes will
be made to the logs or to the \fBlogrotate\fR state file.
......@@ -208,7 +212,7 @@ Log files are rotated every day.
Archive old versions of log files adding a daily extension like YYYYMMDD
instead of simply adding a number. The extension may be configured using
the \fBdateformat\fR option.
the \fBdateformat\fR and \fBdateyesterday\fR options.
\fBdateformat\fR \fIformat_string\fR
......@@ -223,6 +227,12 @@ but 01/12/2001 is not, since 01/11/2002 would sort lower while it is later).
This is because when using the \fBrotate\fR option, logrotate sorts all
rotated filenames to find out which logfiles are older and should be removed.
Use yesterday's instead of today's date to create the \fBdateext\fR
extension, so that the rotated log file has a date in its name that is
the same as the timestamps within it.
Postpone compression of the previous log file to the next rotation cycle.
......@@ -411,7 +421,7 @@ are removed rather than rotated.
\fBsize \fIsize\fR
Log files are rotated when they grow bigger than \fIsize\fR bytes. If
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
......@@ -450,6 +460,12 @@ rotated from the original log files. If you specify 9, log files will
be created with a .9, skipping 0-8. Files will still be rotated the
number of times specified with the \fBcount\fR directive.
\fBsu \fIuser\fR \fIgroup\fR
Rotate log files set under this user and group instead of using default
user/group (usually root). \fIuser\fR specifies the user name used for
rotation and \fIgroup\fR specifies the group used for rotation.
\fBtabooext\fR [+] \fIlist\fR
The current taboo extension list is changed (see the \fBinclude\fR directive
......@@ -482,9 +498,12 @@ Configuration options.
.BR gzip (1)
Erik Troan <>
Preston Brown <>
Erik Troan, Preston Brown, Jan Kaluza.
This diff is collapsed.
......@@ -18,6 +18,8 @@
#define LOG_FLAG_COPY (1 << 8)
#define LOG_FLAG_DATEEXT (1 << 9)
#define LOG_FLAG_SHRED (1 << 10)
#define LOG_FLAG_SU (1 << 11)
#define LOG_FLAG_DATEYESTERDAY (1 << 12)
#define NO_MODE ((mode_t) -1)
#define NO_UID ((uid_t) -1)
......@@ -50,6 +52,8 @@ struct logInfo {
mode_t createMode; /* if any/all of these are -1, we use the */
uid_t createUid; /* attributes from the log file just rotated */
gid_t createGid;
uid_t suUid; /* switch user to this uid and group to this gid */
gid_t suGid;
/* these are at the end so they end up nil */
const char **compress_options_list;
int compress_options_count;
......@@ -62,5 +66,8 @@ extern int numLogs;
extern int debug;
int readAllConfigPaths(const char **paths);
#if !defined(asprintf)
int asprintf(char **string_ptr, const char *format, ...);
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.7.9
Version: 3.8.0
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
* Tue Jun 21 2011 Jan Kaluza <> 3.8.0-1
- new upstream version
* Mon Jun 28 2010 Jan Kaluza <> 3.7.9-1
- new upstream version
......@@ -375,4 +375,23 @@ test.log.$DATESTRING 0 zero
rm -rf testdir
# shred test
cleanup 15
preptest test.log 15 1 0
rm -rf testdir
mkdir testdir
$RLR test-config.15 --force
# this rotation should use shred
$RLR test-config.15 --force
checkoutput <<EOF
test.log 0
test.log.1 0
rm -rf testdir
&DIR&/test.log {
shredcycles 20
rotate 1
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