logrotate/logrotate-3.7.8-autoext.patch
Michal Vyskocil a7ebe2d3f3 Accepting request 81574 from home:vitezslav_cizek:branches:Base:System
- update to 3.8.1
- dropped CVE patches as they were merged to upstream
- changelog
  - fixed 1 memory leak in prerotateSingleLog
  - do not redirect logrotate errors to /dev/null in cron script
  - fixed "size" directive parsing
  - handle situation when acl_get_fd is supported, but acl_set_fd is not
  - added "maxsize" directive (see man page)
  - 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

OBS-URL: https://build.opensuse.org/request/show/81574
OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=18
2011-09-13 09:24:51 +00:00

67 lines
2.3 KiB
Diff

Index: config.c
===================================================================
--- config.c.orig
+++ config.c
@@ -583,6 +583,7 @@ static int readConfigFile(const char *co
char **scriptDest = NULL;
struct logInfo *newlog = defConfig;
char *start, *chptr;
+ char *compresscmd_base;
char *dirName;
struct group *group;
struct passwd *pw = NULL;
@@ -1205,6 +1206,18 @@ static int readConfigFile(const char *co
message(MESS_DEBUG, "compress_prog is now %s\n",
newlog->compress_prog);
+ compresscmd_base=strdup(basename(newlog->compress_prog));
+ i=0; /* have to check whether we may do this! */
+ /* we check whether we changed the compress_cmd. In case we use the apropriate extension
+ as listed in compress_cmd_list */
+ while ((i>=0)&&(strcmp(compress_cmd_list[i][0], "EOLIST"))){
+ if (0==strcmp(compress_cmd_list[i][0], compresscmd_base)){
+ newlog->compress_ext=strdup((char *)compress_cmd_list[i][1]);
+ message(MESS_DEBUG, "compress_ext was changed to %s\n", newlog->compress_ext);
+ i=-10; /* terminate loop! */
+ }
+ i++;
+ }
} else if (!strcmp(key, "uncompresscmd")) {
freeLogItem (uncompress_prog);
Index: logrotate.c
===================================================================
--- logrotate.c.orig
+++ logrotate.c
@@ -76,6 +76,16 @@ unsigned int hashSize;
int numLogs = 0;
int debug = 0;
char *mailCommand = DEFAULT_MAIL_COMMAND;
+/* This is the declaration. Note the "2" is needed in the definition (logrotate.h), too! */
+const char * compress_cmd_list[][2] = {
+ {"gzip", ".gz"},
+ {"bzip2", ".bz2"},
+ {"xz", ".xz"},
+ {"compress", ".Z"},
+ {"zip", "zip"},
+ {"EOLIST", "EOLIST"} /* end-marker */
+};
+
time_t nowSecs = 0;
static uid_t save_euid;
static gid_t save_egid;
Index: logrotate.h
===================================================================
--- logrotate.h.orig
+++ logrotate.h
@@ -66,6 +66,9 @@ TAILQ_HEAD(logInfoHead, logInfo) logs;
extern int numLogs;
extern int debug;
+/* This is the definition. Note we have to carry the "2" within the declaration (logrotate.c), too! */
+extern const char * compress_cmd_list[][2];
+
int readAllConfigPaths(const char **paths);
#if !defined(asprintf)
int asprintf(char **string_ptr, const char *format, ...);