Commit 5895930e authored by Tobias Frost's avatar Tobias Frost

Import Upstream version 3.7.8

parent be7a0fcf
3.7.7 -> 3.7.8
- do not exit on status file errors
- limit config file inclusion nesting
- use hashes for status file handling (patch by Petr Tesarik
<ptesarik@suse.cz> and Leonardo Chiquitto)
- dateformat to allow unixtime (patch by Sami Kerola
<kerolasa@iki.fi>)
- manual page corrections (taken from the Debian patches by
Paul Martin <pm@debian.org>)
3.7.6 -> 3.7.7
- dateformat
- fix possible buffer overflows in strings handling
......
......@@ -237,31 +237,18 @@ static void copyLogInfo(struct logInfo *to, struct logInfo *from)
static void freeLogInfo(struct logInfo *log)
{
if (log->pattern)
free(log->pattern);
if (log->files)
free_2d_array(log->files, log->numFiles);
if (log->oldDir)
free(log->oldDir);
if (log->pre)
free(log->pre);
if (log->post)
free(log->post);
if (log->first)
free(log->first);
if (log->last)
free(log->last);
if (log->logAddress)
free(log->logAddress);
if (log->extension)
free(log->extension);
if (log->compress_prog)
free(log->compress_prog);
if (log->uncompress_prog)
free(log->uncompress_prog);
if (log->compress_ext)
free(log->compress_ext);
if (log->compress_options_list)
free(log->compress_options_list);
free(log->dateformat);
}
......@@ -399,7 +386,9 @@ static int readConfigPath(const char *path, struct logInfo *defConfig)
freeLogInfo(&defConfigBackup);
}
fchdir(here);
if (fchdir(here) < 0) {
message(MESS_ERROR, "could not change directory to '.'");
}
close(here);
free_2d_array(namelist, files_count);
} else {
......@@ -422,26 +411,34 @@ int readAllConfigPaths(const char **paths)
{
int i, result = 0;
const char **file;
struct logInfo defConfig = { /* pattern */ NULL,
/* files, numFiles */ NULL, 0,
/* oldDir */ NULL,
/* criterium */ ROT_SIZE,
/* threshHold */ 1024 * 1024,
/* minsize */ 0,
/* rotateCount/Age */ 0, 0,
/* log start */ -1,
/* pre, post */ NULL, NULL,
/* first, last */ NULL, NULL,
/* logAddress */ NULL,
/* extension */ NULL,
/* compress_prog */ NULL,
/* uncompress_prog */ NULL,
/* compress_ext */ NULL,
/* dateformat */ NULL,
/* flags */ LOG_FLAG_IFEMPTY,
/* shred_cycles */ 0,
/* createMode/Uid/Gid */ NO_MODE, NO_UID, NO_GID,
/* compress_options_list/count */ NULL, 0
struct logInfo defConfig = {
.pattern = NULL,
.files = NULL,
.numFiles = 0,
.oldDir = NULL,
.criterium = ROT_SIZE,
.threshhold = 1024 * 1024,
.minsize = 0,
.rotateCount = 0,
.rotateAge = 0,
.logStart = -1,
.pre = NULL,
.post = NULL,
.first = NULL,
.last = NULL,
.logAddress = NULL,
.extension = NULL,
.compress_prog = NULL,
.uncompress_prog = NULL,
.compress_ext = NULL,
.dateformat = NULL,
.flags = LOG_FLAG_IFEMPTY,
.shred_cycles = 0,
.createMode = NO_MODE,
.createUid = NO_UID,
.createGid = NO_GID,
.compress_options_list = NULL,
.compress_options_count = 0
};
tabooExts = malloc(sizeof(*tabooExts) * defTabooCount);
......@@ -477,10 +474,11 @@ static int globerr(const char *pathname, int theerr)
}
#define freeLogItem(what) \
if (newlog->what) { \
free(newlog->what); \
newlog->what = NULL; \
}
do { \
free(newlog->what); \
newlog->what = NULL; \
} while (0);
#define MAX_NESTING 16U
static int readConfigFile(const char *configFile, struct logInfo *defConfig)
{
......@@ -507,6 +505,7 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
int argc, argNum;
int logerror = 0;
struct logInfo *log;
static unsigned recursion_depth = 0U;
/* FIXME: createOwner and createGroup probably shouldn't be fixed
length arrays -- of course, if we aren't run setuid it doesn't
......@@ -1095,9 +1094,17 @@ static int readConfigFile(const char *configFile, struct logInfo *defConfig)
oldchar = *endtag, *endtag = '\0';
message(MESS_DEBUG, "including %s\n", start);
if (readConfigPath(start, defConfig))
return 1;
if (++recursion_depth > MAX_NESTING) {
message(MESS_ERROR, "%s:%d include nesting too deep\n",
configFile, lineNum);
--recursion_depth;
return 1;
}
if (readConfigPath(start, defConfig)) {
--recursion_depth;
return 1;
}
--recursion_depth;
*endtag = oldchar, start = endtag;
}
......
This diff is collapsed.
This diff is collapsed.
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.7.7
Version: 3.7.8
Release: 1
License: GPL+
Group: System Environment/Base
......@@ -51,6 +51,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
%changelog
* Wed Jan 28 2009 Tomas Smetana <tsmetana@redhat.com> 3.7.8-1
- new upstream version
* Wed May 14 2008 Tomas Smetana <tsmetana@redhat.com> 3.7.7-1
- new upstream version
......
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