Commit be7a0fcf authored by Tobias Frost's avatar Tobias Frost

Import Upstream version 3.7.7

parent 2fc8d5c6
logrotate
.depend
3.7.6 -> 3.7.7
- dateformat
- fix possible buffer overflows in strings handling
- various minor bugfixes
- change logInfo handling (patches by Leonardo Chiquitto)
3.7.5 -> 3.7.6
- patches from Leonardo Chiquitto that fix compile warnings
- examples/logrotate-default: add btmp rotation, dateext
- update man page
- tabooext honor wildcards
- fix selinux support with dateext
3.7.1 -> 3.7.5
- import Fedora patches
- add option to use shred for deleting files, patch by
Peter Eckersley <pde@eff.org>
- ignore .cfsaved files
- bugfixes
3.7 -> 3.7.1:
- Fix sending mails and running scripts after the
system() -> execve() changes
......
VERSION = $(shell awk '/Version:/ { print $$2 }' logrotate.spec)
CVSROOT = $(shell cat CVS/Root)
CVSTAG = r$(subst .,-,$(VERSION))
OS_NAME = $(shell uname -s)
LFS = $(shell echo `getconf LFS_CFLAGS 2>/dev/null`)
CFLAGS = -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS)
PROG = logrotate
MAN = logrotate.8
LOADLIBES = -lpopt
SVNURL= svn+ssh://svn.fedorahosted.org/svn/logrotate
SVNPUBURL = http://svn.fedorahosted.org/svn/logrotate
SVNTAG = r$(subst .,-,$(VERSION))
ifeq ($(WITH_SELINUX),yes)
CFLAGS += -DWITH_SELINUX
......@@ -111,12 +112,12 @@ co:
co RCS/*,v
(cd examples; co RCS/*,v)
cvstag:
cvs tag -cF $(CVSTAG) .
svntag:
svn copy $(SVNURL)/trunk $(SVNURL)/tags/$(SVNTAG) -m "Release $(VERSION)"
archive: cvstag
create-archive:
@rm -rf /tmp/logrotate-$(VERSION) /tmp/logrotate
@cd /tmp; cvs -d $(CVSROOT) export -r$(CVSTAG) logrotate; mv logrotate logrotate-$(VERSION)
@cd /tmp; svn export $(SVNPUBURL)/tags/$(SVNTAG) logrotate-$(VERSION)
@cd /tmp/logrotate-$(VERSION)
@cd /tmp; tar czSpf logrotate-$(VERSION).tar.gz logrotate-$(VERSION)
@rm -rf /tmp/logrotate-$(VERSION)
......@@ -125,6 +126,8 @@ archive: cvstag
@echo " "
@echo "The final archive is ./logrotate-$(VERSION).tar.gz."
archive: clean svntag create-archive
ifeq (.depend,$(wildcard .depend))
include .depend
endif
......@@ -5,24 +5,27 @@
/* Return NAME with any leading path stripped off. */
char *ourBaseName(char *name) {
char *ourBaseName(char *name)
{
char *base;
base = strrchr(name, '/');
return base ? base + 1 : name;
}
static void stripTrailingSlashes(char *path) {
char * last;
static void stripTrailingSlashes(char *path)
{
char *last;
last = path + strlen(path) - 1;
while (last > path && *last == '/')
*last-- = '\0';
}
char * ourDirName(char * origname) {
char * slash;
char * name;
char *ourDirName(char *origname)
{
char *slash;
char *name;
name = strdup(origname);
......
......@@ -2,8 +2,8 @@
#define H_BASENAMES
/* returns a pointer inside of name */
char * ourBaseName(char *name);
char *ourBaseName(char *name);
/* returns a malloc'd string which must be freed by the caller */
char * ourDirName(char * origname);
char *ourDirName(char *origname);
#endif
This diff is collapsed.
......@@ -3,39 +3,38 @@
*/
#ifdef __hpux
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/contrib/bin/gzip"
#define UNCOMPRESS_COMMAND " /usr/contrib/bin/gunzip"
#define STATEFILE "/var/run/logrotate.status"
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/contrib/bin/gzip"
#define UNCOMPRESS_COMMAND " /usr/contrib/bin/gunzip"
#define STATEFILE "/var/run/logrotate.status"
#endif
#ifdef SunOS
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/local/bin/gzip"
#define UNCOMPRESS_COMMAND "/usr/local/bin/gunzip"
#define STATEFILE "/var/log/logrotate.status"
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
#define COMPRESS_COMMAND "/usr/local/bin/gzip"
#define UNCOMPRESS_COMMAND "/usr/local/bin/gunzip"
#define STATEFILE "/var/log/logrotate.status"
#endif
/*
* Default settings for Linux - leave these last.
*/
#ifndef DEFAULT_MAIL_COMMAND
#define DEFAULT_MAIL_COMMAND "/bin/mail"
#define DEFAULT_MAIL_COMMAND "/bin/mail"
#endif
#ifndef COMPRESS_COMMAND
#define COMPRESS_COMMAND "/bin/gzip"
#define COMPRESS_COMMAND "/bin/gzip"
#endif
#ifndef COMPRESS_EXT
#define COMPRESS_EXT ".gz"
#define COMPRESS_EXT ".gz"
#endif
#ifndef UNCOMPRESS_COMMAND
#define UNCOMPRESS_COMMAND "/bin/gunzip"
#define UNCOMPRESS_COMMAND "/bin/gunzip"
#endif
#ifndef STATEFILE
#define STATEFILE "/var/lib/logrotate.status"
#define STATEFILE "/var/lib/logrotate.status"
#endif
......@@ -8,16 +8,27 @@ rotate 4
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- we'll rotate them here
# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}
/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}
......
......@@ -8,34 +8,40 @@
#include "log.h"
int logLevel = MESS_DEBUG;
static FILE * errorFile = NULL;
static FILE * messageFile = NULL;
static FILE *errorFile = NULL;
static FILE *messageFile = NULL;
int flags = 0;
void logSetLevel(int level) {
void logSetLevel(int level)
{
logLevel = level;
}
void logSetErrorFile(FILE * f) {
void logSetErrorFile(FILE * f)
{
errorFile = f;
}
void logSetMessageFile(FILE * f) {
void logSetMessageFile(FILE * f)
{
messageFile = f;
}
void logSetFlags(int newFlags) {
void logSetFlags(int newFlags)
{
flags |= newFlags;
}
void logClearFlags(int newFlags) {
void logClearFlags(int newFlags)
{
flags &= ~newFlags;
}
#if 0
void log(int fd, char * format, ...) {
void log(int fd, char *format, ...)
{
int i = 0;
char * buf = NULL;
char *buf = NULL;
va_list args;
int size;
......@@ -43,7 +49,8 @@ void log(int fd, char * format, ...) {
do {
i += 1000;
if (buf) free(buf);
if (buf)
free(buf);
buf = malloc(i);
size = vsnprintf(buf, i, format, args);
} while (size >= i);
......@@ -56,9 +63,10 @@ void log(int fd, char * format, ...) {
}
#endif
void message(int level, char * format, ...) {
void message(int level, char *format, ...)
{
va_list args;
FILE * where = NULL;
FILE *where = NULL;
int showTime = 0;
if (errorFile == NULL)
......@@ -66,23 +74,23 @@ void message(int level, char * format, ...) {
if (messageFile == NULL)
messageFile = stderr;
where = errorFile;
if (level >= logLevel) {
va_start(args, format);
switch (level) {
case MESS_DEBUG:
case MESS_DEBUG:
where = messageFile;
showTime = 1;
break;
case MESS_NORMAL:
case MESS_VERBOSE:
case MESS_NORMAL:
case MESS_VERBOSE:
where = messageFile;
break;
default:
if (flags & LOG_TIMES)
default:
if (flags & LOG_TIMES)
fprintf(where, "%ld: ", (long) time(NULL));
fprintf(errorFile, "error: ");
break;
......@@ -97,7 +105,7 @@ void message(int level, char * format, ...) {
va_end(args);
if (level == MESS_FATAL) exit(1);
if (level == MESS_FATAL)
exit(1);
}
}
......@@ -12,14 +12,14 @@
#define LOG_TIMES (1 << 0)
void message(int level, char * format, ...)
void message(int level, char *format, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)));
__attribute__ ((format(printf, 2, 3)));
#else
;
;
#endif
#if 0
void log(int fd, char * format, ...);
void log(int fd, char *format, ...);
#endif
void logSetErrorFile(FILE * f);
void logSetMessageFile(FILE * f);
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,6 +2,7 @@
#define H_LOGROTATE
#include <sys/types.h>
#include <sys/queue.h>
#include <glob.h>
#include "config.h"
......@@ -15,45 +16,51 @@
#define LOG_FLAG_MAILFIRST (1 << 6)
#define LOG_FLAG_SHAREDSCRIPTS (1 << 7)
#define LOG_FLAG_COPY (1 << 8)
#define LOG_FLAG_DATEEXT (1 << 9)
#define LOG_FLAG_SHRED (1 << 10)
#define NO_MODE ((mode_t) -1)
#define NO_UID ((uid_t) -1)
#define NO_GID ((gid_t) -1)
#define NO_FORCE_ROTATE 0
#define FORCE_ROTATE 1
struct rotatePatternElement {
enum { RP_NONE = 0, RP_FILENAME, RP_STRING, RP_COUNT, RP_MONTH, RP_DAY,
RP_YEAR } type;
char * arg;
struct rotatePatternElement * next;
};
typedef struct {
char * pattern;
char ** files;
struct logInfo {
char *pattern;
char **files;
int numFiles;
char * oldDir;
enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_SIZE, ROT_FORCE } criterium;
char *oldDir;
enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_YEARLY, ROT_SIZE,
ROT_FORCE } criterium;
unsigned int threshhold;
unsigned int minsize;
int rotateCount;
int rotateAge;
int logStart;
char * pre, * post, * first, * last;
char * logAddress;
char * extension;
char * compress_prog;
char * uncompress_prog;
char * compress_ext;
struct rotatePatternElement * rotatePattern;
char *pre, *post, *first, *last;
char *logAddress;
char *extension;
char *compress_prog;
char *uncompress_prog;
char *compress_ext;
char *dateformat; /* specify format for strftime (for dateext) */
int flags;
int shred_cycles; /* if !=0, pass -n shred_cycles to GNU shred */
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;
/* these are at the end so they end up nil */
const char ** compress_options_list;
const char **compress_options_list;
int compress_options_count;
} logInfo;
TAILQ_ENTRY(logInfo) list;
};
int readConfigPath(const char * path, logInfo * defConfig,
logInfo ** logsPtr, int * numLogsPtr);
TAILQ_HEAD(logInfoHead, logInfo) logs;
extern int numLogs;
extern int debug;
int readAllConfigPaths(const char **paths);
#endif
%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1}
%define WITH_SELINUX 1
BuildRequires: libselinux-devel
%endif
Summary: Rotates, compresses, removes and mails system log files.
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.7.1
Release: 2
License: GPL
Version: 3.7.7
Release: 1
License: GPL+
Group: System Environment/Base
Source: logrotate-%{PACKAGE_VERSION}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}.root
Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
Requires: coreutils >= 5.92 libsepol libselinux popt
BuildRequires: libselinux-devel popt-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
The logrotate utility is designed to simplify the administration of
......@@ -23,39 +21,181 @@ Install the logrotate package if you need a utility to deal with the
log files on your system.
%prep
%setup
%setup -q
%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" \
%if %{WITH_SELINUX}
WITH_SELINUX=yes
%endif
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes
%install
rm -rf $RPM_BUILD_ROOT
make PREFIX=$RPM_BUILD_ROOT MANDIR=%{_mandir} install
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
mkdir -p $RPM_BUILD_ROOT/etc/cron.daily
mkdir -p $RPM_BUILD_ROOT/var/lib
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib
install -m 644 examples/logrotate-default $RPM_BUILD_ROOT/etc/logrotate.conf
install -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/etc/cron.daily/logrotate
touch $RPM_BUILD_ROOT/var/lib/logrotate.status
install -p -m 644 examples/logrotate-default $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.conf
install -p -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/logrotate
touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate.status
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc CHANGES
%attr(0755, root, root) /usr/sbin/logrotate
%doc CHANGES COPYING
%attr(0755, root, root) %{_sbindir}/logrotate
%attr(0644, root, root) %{_mandir}/man8/logrotate.8*
%attr(0755, root, root) /etc/cron.daily/logrotate
%attr(0644, root, root) %config(noreplace) /etc/logrotate.conf
%attr(0755, root, root) %dir /etc/logrotate.d
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) /var/lib/logrotate.status
%attr(0755, root, root) %{_sysconfdir}/cron.daily/logrotate
%attr(0644, root, root) %config(noreplace) %{_sysconfdir}/logrotate.conf
%attr(0755, root, root) %dir %{_sysconfdir}/logrotate.d
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
%changelog
* Wed May 14 2008 Tomas Smetana <tsmetana@redhat.com> 3.7.7-1
- new upstream version
* Tue Aug 07 2007 Tomas Smetana <tsmetana@redhat.com> 3.7.6-1
- new upstream version
* Thu Mar 01 2007 Peter Vrabec <pvrabec@redhat.com> 3.7.5-1
- new upstream release.
* Fri Feb 09 2007 Peter Vrabec <pvrabec@redhat.com> 3.7.4-13
- another spec file fixes (#226104)
* Thu Feb 08 2007 Peter Vrabec <pvrabec@redhat.com> 3.7.4-12
- fix problem with compress_options_list (#227706)
- fix spec file to meet Fedora standards (#226104)
* Tue Jan 23 2007 Peter Vrabec <pvrabec@redhat.com> 3.7.4-11
- logrotate won't stop if there are some errors in configuration
or glob failures (#166510, #182062)
* Wed Jan 10 2007 Peter Vrabec <pvrabec@redhat.com> 3.7.4-10
- fix some rpmlint issues
* Tue Jan 09 2007 Peter Vrabec <pvrabec@redhat.com> 3.7.4-9
- allow multibyte characters in readPath() (#122145)
* Fri Jan 05 2007 Peter Vrabec <pvrabec@redhat.com> 3.7.4-8
- "size" option was ignored in config files (#221341)
* Sun Oct 01 2006 Jesse Keating <jkeating@redhat.com> - 3.7.4-7
- rebuilt for unwind info generation, broken in gcc-4.1.1-21
* Tue Sep 26 2006 Peter Vrabec <pvrabec@redhat.com> 3.7.4-6
- fix leaking file descriptor (#205072)
* Wed Aug 09 2006 Dan Walsh <dwalsh@redhat.com> 3.7.4-5
- Use selinux raw functions
* Mon Jul 24 2006 Peter Vrabec <pvrabec@redhat.com> 3.7.4-4
- make error message, about ignoring certain config files,
a debug message instead (#196052)
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 3.7.4-3.1
- rebuild
* Tue Jun 13 2006 Peter Vrabec <pvrabec@redhat.com> 3.7.4-3
- rename ENOSUP to ENOTSUP
* Tue Jun 13 2006 Peter Vrabec <pvrabec@redhat.com> 3.7.4-2
- clean up a couple of SELinux problems. Patch from Daniel J. Walsh.
* Wed May 17 2006 Peter Vrabec <pvrabec@redhat.com> 3.7.4-1
- add new "minsize" option (#173088)
* Tue Mar 28 2006 Peter Vrabec <pvrabec@redhat.com> 3.7.3-3
- correct man page "extension" option description (#185318)
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 3.7.3-2.2.1
- bump again for double-long bug on ppc(64)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 3.7.3-2.2
- rebuilt for new gcc4.1 snapshot and glibc changes
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Sun Nov 13 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.3-2
- fix_free_segfaults (#172918)
* Sat Nov 12 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.3-1
- new upstream release
- indent sources
* Fri Nov 11 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-12
- fix_free_segfaults (#172918)
* Mon Nov 07 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-11
- man description for "nodateext" option (#171577)
- remove not working "pattern" option (#171577)
* Tue Oct 25 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-10
- some more clean up (#171587)
* Thu Oct 20 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-9
- fix_free_segfaults (#171093)
* Tue Oct 18 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-8
- fix leaks of tabooExts
* Sat Oct 15 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-7
- fix_free_segfaults (#170904)
* Wed Oct 12 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-6
- code clean up (#169885)
* Mon Oct 10 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-5
- fix bug introduced in logrotate 3.7.2-3(#169858)
- fix some memory leaks (#169888)
* Fri Sep 23 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-4
- do not run compression program in debug mode (#166912)
* Wed Sep 07 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-3
- even when sharedscript option used, do postrotate
script before compress (#167575)
* Wed Aug 17 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-2
- allow yearly rotations(#134612)
* Mon Aug 01 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.2-1
- new upstream release
* Tue Jul 26 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.1-14
- fix some "error running script" messages
* Tue Jul 26 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.1-13
- fix man page (#163458,#163366)
* Wed Jun 22 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.1-12
- enhance logrotate with "dateext", "maxage"
* Thu Mar 31 2005 Dan Walsh <dwalsh@redhat.com> 3.7.1-10
- use security_getenforce() instead of selinux_getenforcemode
* Thu Mar 17 2005 Dan Walsh <dwalsh@redhat.com> 3.7.1-9
- Add selinux_getenforce() calls to work when not in enforcing mode
* Thu Mar 17 2005 Peter Vrabec <pvrabec@redhat.com> 3.7.1-8
- rebuild
* Tue Feb 22 2005 Peter Vrabec <pvrabec@redhat.com>
- do not use tmpfile to run script anymore (#149270)
* Fri Feb 18 2005 Peter Vrabec <pvrabec@redhat.com>
- remove logrotate-3.7.1-share.patch, it doesn't solve (#140353)
* Mon Dec 13 2004 Peter Vrabec <pvrabec@redhat.com> - 3.7.1-5
- Add section to logrotate.conf for "/var/log/btmp" (#117844)
* Mon Dec 13 2004 Peter Vrabec <pvrabec@redhat.com> - 3.7.1-4
- Typo and missing information in man page (#139346)
* Mon Dec 06 2004 Peter Vrabec <pvrabec@redhat.com> - 3.7.1-3
- compressed logfiles and logrotate (#140353)
* Tue Oct 19 2004 Miloslav Trmac <mitr@redhat.com> - 3.7.1-2
- Fix sending mails (#131583)
- Preserve file attributes when compressing files (#121523, original patch by
......@@ -117,7 +257,7 @@ rm -rf $RPM_BUILD_ROOT
- Apply various bugfix patches from the openwall people
* Tue Jan 29 2002 Elliot Lee <sopwith@redhat.com> 3.6.2-1
- Fix bug #55809 (include logrotate.status in %files)
- Fix bug #55809 (include logrotate.status in "files")
- Fix bug #58328 (incorrect error detection when reading state file)
- Allow 'G' size specifier from bug #57242
......
......@@ -354,4 +354,19 @@ EOF
rm -rf testdir
# sanity rotation check using dateext and dateformat
cleanup 14
preptest test.log 14 1 0
$RLR test-config.14 --force
DATESTRING=$(/bin/date +%Y-%m-%d)
checkoutput <<EOF
test.log 0
test.log.$DATESTRING 0 zero
EOF
rm -rf testdir
cleanup
create
&DIR&/test.log {
daily
dateext
dateformat .%Y-%m-%d
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