rpms/logrotate/FC-6 logrotate-widecharPath.patch, NONE, 1.1 logrotate.spec, 1.53, 1.54

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Jan 9 09:56:50 UTC 2007


Author: pvrabec

Update of /cvs/dist/rpms/logrotate/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv12108

Modified Files:
	logrotate.spec 
Added Files:
	logrotate-widecharPath.patch 
Log Message:
allow multibyte characters in readPath() (#122145)


logrotate-widecharPath.patch:
 config.c    |   19 +++++++++++++++++--
 logrotate.c |    2 ++
 2 files changed, 19 insertions(+), 2 deletions(-)

--- NEW FILE logrotate-widecharPath.patch ---
--- logrotate-3.7.4/config.c.widechar	2007-01-08 14:29:06.000000000 +0100
+++ logrotate-3.7.4/config.c	2007-01-08 14:33:41.000000000 +0100
@@ -14,6 +14,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <assert.h>
+#include <wchar.h>
 
 #include "basenames.h"
 #include "log.h"
@@ -82,13 +83,24 @@
     char *start = *startPtr;
     char *path;
 
+    wchar_t pwc;
+    size_t len;
+
     if (!isolateValue(configFile, lineNum, key, &start, &endtag)) {
 	oldchar = *endtag, *endtag = '\0';
 
 	chptr = start;
 
-	/* this is technically too restrictive -- let's see if anyone
-	   complains */
+	while( (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != 0 ) {
+		if( len == (size_t)(-1) || len == (size_t)(-2) || !iswprint(pwc) || iswblank(pwc) ) {
+		    message(MESS_ERROR, "%s:%d bad %s path %s\n",
+			    configFile, lineNum, key, start);
+		    return NULL;
+		}
+		chptr += len;
+	}
+
+/*
 	while (*chptr && isprint(*chptr) && *chptr != ' ')
 	    chptr++;
 	if (*chptr) {
@@ -96,8 +108,11 @@
 		    configFile, lineNum, key, start);
 	    return NULL;
 	}
+*/
+
 	path = strdup(start);
 
+
 	*endtag = oldchar, start = endtag;
 
 	*startPtr = start;
--- logrotate-3.7.4/logrotate.c.widechar	2007-01-08 14:36:09.000000000 +0100
+++ logrotate-3.7.4/logrotate.c	2007-01-08 14:38:01.000000000 +0100
@@ -12,6 +12,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <glob.h>
+#include <locale.h>
 
 #ifdef WITH_SELINUX
 #include <selinux/selinux.h>
@@ -1344,6 +1345,7 @@
     };
 
     logSetLevel(MESS_NORMAL);
+    setlocale (LC_ALL, "");
 
     optCon = poptGetContext("logrotate", argc, argv, options, 0);
     poptReadDefaultConfig(optCon, 1);


Index: logrotate.spec
===================================================================
RCS file: /cvs/dist/rpms/logrotate/FC-6/logrotate.spec,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- logrotate.spec	5 Jan 2007 12:00:50 -0000	1.53
+++ logrotate.spec	9 Jan 2007 09:56:48 -0000	1.54
@@ -1,13 +1,15 @@
 Summary: Rotates, compresses, removes and mails system log files.
 Name: logrotate
 Version: 3.7.4
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPL
 Group: System Environment/Base
 Source: logrotate-%{PACKAGE_VERSION}.tar.gz
 Patch1: logrotate-selinux.patch
 Patch2: logrotate-fdLeak.patch
 Patch3: logrotate-sizeOption.patch
+Patch4: logrotate-widecharPath.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}.root
 BuildRequires: libselinux-devel
 
@@ -27,6 +29,7 @@
 %patch1 -p1 -b .rhat
 %patch2 -p1 -b .fdLeak
 %patch3 -p1 -b .sizeOption
+%patch4 -p1 -b .widecharPath
 
 %build
 make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -g" \
@@ -57,6 +60,9 @@
 %attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) /var/lib/logrotate.status
 
 %changelog
+* Tue Jan 09 2007 Peter Vrabec <pvrabec at redhat.com> 3.7.4-9
+- allow multibyte characters in readPath() (#122145)
+
 * Fri Jan 05 2007 Peter Vrabec <pvrabec at redhat.com> 3.7.4-8
 - "size" option was ignored in config files (#221341)
 




More information about the fedora-cvs-commits mailing list