rpms/logrotate/F-8 logrotate-3.7.6-selinux.patch, 1.2, 1.3 logrotate.spec, 1.69, 1.70
Tomas Smetana (tsmetana)
fedora-extras-commits at redhat.com
Mon Jan 21 13:35:27 UTC 2008
Author: tsmetana
Update of /cvs/pkgs/rpms/logrotate/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4667
Modified Files:
logrotate-3.7.6-selinux.patch logrotate.spec
Log Message:
* Mon Jan 21 2008 Tomas Smetana <tsmetana at redhat.com> 3.7.6-2.2
- fix #429454 - logrotate fails due to invalid pointer
logrotate-3.7.6-selinux.patch:
Index: logrotate-3.7.6-selinux.patch
===================================================================
RCS file: /cvs/pkgs/rpms/logrotate/F-8/logrotate-3.7.6-selinux.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- logrotate-3.7.6-selinux.patch 9 Jan 2008 09:56:33 -0000 1.2
+++ logrotate-3.7.6-selinux.patch 21 Jan 2008 13:35:19 -0000 1.3
@@ -1,26 +1,64 @@
-Written-by: Tomas Smetana <tsmetana at redhat.com>
-
diff -up logrotate-3.7.6/logrotate.c.selinux logrotate-3.7.6/logrotate.c
---- logrotate-3.7.6/logrotate.c.selinux 2008-01-09 09:37:16.000000000 +0100
-+++ logrotate-3.7.6/logrotate.c 2008-01-09 09:39:05.000000000 +0100
-@@ -899,6 +899,9 @@ int rotateSingleLog(logInfo * log, int l
+--- logrotate-3.7.6/logrotate.c.selinux 2007-08-07 09:14:35.000000000 +0200
++++ logrotate-3.7.6/logrotate.c 2008-01-21 09:32:56.000000000 +0100
+@@ -409,15 +409,17 @@ static int copyTruncate(char *currLog, c
+ }
+ #ifdef WITH_SELINUX
+ if (selinux_enabled) {
+- security_context_t oldContext;
++ security_context_t oldContext = NULL;
+ if (fgetfilecon_raw(fdcurr, &oldContext) >= 0) {
+ if (getfscreatecon_raw(&prev_context) < 0) {
+ message(MESS_ERROR,
+ "getting default context: %s\n",
+ strerror(errno));
+ if (selinux_enforce) {
+- freecon(oldContext);
+- return 1;
++ if (oldContext != NULL) {
++ freecon(oldContext);
++ }
++ return 1;
+ }
+ }
+ if (setfscreatecon_raw(oldContext) < 0) {
+@@ -425,11 +427,15 @@ static int copyTruncate(char *currLog, c
+ "setting file context %s to %s: %s\n",
+ saveLog, oldContext, strerror(errno));
+ if (selinux_enforce) {
+- freecon(oldContext);
+- return 1;
++ if (oldContext != NULL) {
++ freecon(oldContext);
++ }
++ return 1;
+ }
+ }
+- freecon(oldContext);
++ if (oldContext != NULL) {
++ freecon(oldContext);
++ }
+ } else {
+ if (errno != ENOTSUP) {
+ message(MESS_ERROR, "getting file context %s: %s\n",
+@@ -899,6 +905,9 @@ int rotateSingleLog(logInfo * log, int l
int hasErrors = 0;
struct stat sb;
int fd;
+#ifdef WITH_SELINUX
-+ security_context_t savedContext;
++ security_context_t savedContext = NULL;
+#endif
if (!state->doRotate)
return 0;
-@@ -906,7 +909,51 @@ int rotateSingleLog(logInfo * log, int l
+@@ -906,7 +915,57 @@ int rotateSingleLog(logInfo * log, int l
if (!hasErrors) {
if (!(log->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY))) {
- message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum],
+#ifdef WITH_SELINUX
+ if (selinux_enabled) {
-+ security_context_t oldContext;
++ security_context_t oldContext = NULL;
+ int fdcurr = -1;
+
+ if ((fdcurr = open(log->files[logNum], O_RDWR)) < 0) {
@@ -35,7 +73,9 @@
+ "getting default context: %s\n",
+ strerror(errno));
+ if (selinux_enforce) {
-+ freecon(oldContext);
++ if (oldContext != NULL) {
++ freecon(oldContext);
++ }
+ return 1;
+ }
+ }
@@ -44,13 +84,17 @@
+ "setting file context %s to %s: %s\n",
+ log->files[logNum], oldContext, strerror(errno));
+ if (selinux_enforce) {
-+ freecon(oldContext);
-+ return 1;
++ if (oldContext != NULL) {
++ freecon(oldContext);
++ }
++ return 1;
+ }
+ }
+ message(MESS_DEBUG, "fscreate context set to %s\n",
+ oldContext);
-+ freecon(oldContext);
++ if (oldContext != NULL) {
++ freecon(oldContext);
++ }
+ } else {
+ if (errno != ENOTSUP) {
+ message(MESS_ERROR, "getting file context %s: %s\n",
@@ -66,7 +110,7 @@
rotNames->finalName);
if (!debug && !hasErrors &&
-@@ -961,6 +1008,15 @@ int rotateSingleLog(logInfo * log, int l
+@@ -961,6 +1020,15 @@ int rotateSingleLog(logInfo * log, int l
close(fd);
}
}
Index: logrotate.spec
===================================================================
RCS file: /cvs/pkgs/rpms/logrotate/F-8/logrotate.spec,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- logrotate.spec 9 Jan 2008 09:56:33 -0000 1.69
+++ logrotate.spec 21 Jan 2008 13:35:19 -0000 1.70
@@ -1,7 +1,7 @@
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.7.6
-Release: 2.1%{?dist}
+Release: 2.2%{?dist}
License: GPL+
Group: System Environment/Base
# The source for this package was pulled from cvs.
@@ -60,6 +60,9 @@
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
%changelog
+* Mon Jan 21 2008 Tomas Smetana <tsmetana at redhat.com> 3.7.6-2.2
+- fix #429454 - logrotate fails due to invalid pointer
+
* Wed Jan 09 2008 Tomas Smetana <tsmetana at redhat.com> 3.7.6-2.1
- fix the selinux patch (minor error)
More information about the fedora-extras-commits
mailing list