rpms/logrotate/devel logrotate-3.7.1-selinux.patch, NONE, 1.1 logrotate.spec, 1.21, 1.22

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Mar 17 22:39:52 UTC 2005


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

Modified Files:
	logrotate.spec 
Added Files:
	logrotate-3.7.1-selinux.patch 
Log Message:
* Thu Mar 17 2005 Dan Walsh <dwalsh at redhat.com> 3.7.1-9
- Add selinux_getenforce() calls to work when not in enforcing mode


logrotate-3.7.1-selinux.patch:
 logrotate.c |  121 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 63 insertions(+), 58 deletions(-)

--- NEW FILE logrotate-3.7.1-selinux.patch ---
--- logrotate-3.7.1/logrotate.c~	2005-03-17 12:48:27.192521752 -0500
+++ logrotate-3.7.1/logrotate.c	2005-03-17 12:58:25.661540632 -0500
@@ -250,44 +250,43 @@
 	    return 1;
 	}
 #ifdef WITH_SELINUX
-	if ((selinux_enabled=(is_selinux_enabled()>0)))
-	  {
-	    security_context_t oldContext;
-	    if (fgetfilecon(fdcurr, &oldContext) >=0) {
-	      if (getfscreatecon(&prev_context) < 0) {
-		message(MESS_ERROR, "error getting default context: %s\n", 
-			strerror(errno));
-		if (selinux_getenforce()) {
+	if ((selinux_enabled=(is_selinux_enabled()>0)))	{
+		security_context_t oldContext;
+		if (fgetfilecon(fdcurr, &oldContext) >=0) {
+			if (getfscreatecon(&prev_context) < 0) {
+				message(MESS_ERROR, "error getting default context: %s\n", 
+					strerror(errno));
+				if (selinux_getenforce()) {
+					freecon(oldContext);
+					return 1;
+				}
+			}
+			if (setfscreatecon(oldContext) < 0) {
+				message(MESS_ERROR, "error setting file context %s to %s: %s\n", 
+					saveLog, oldContext,strerror(errno));
+				if (selinux_getenforce()) {
+					freecon(oldContext);
+					return 1;
+				}
+			}
 			freecon(oldContext);
-			return 1;
-		}
-	      }
-	      if (setfscreatecon(oldContext) < 0) {
-		message(MESS_ERROR, "error setting file context %s to %s: %s\n", 
-			saveLog, oldContext,strerror(errno));
-		if (selinux_getenforce()) {
-			freecon(oldContext);
-			return 1;
-		}
-	      }
-	      freecon(oldContext);
-	    } else {
-	      message(MESS_ERROR, "error getting file context %s: %s\n", currLog,
-		      strerror(errno));
-		if (selinux_getenforce()) {
-			return 1;
+		} else {
+			message(MESS_ERROR, "error getting file context %s: %s\n", currLog,
+				strerror(errno));
+			if (selinux_getenforce()) {
+				return 1;
+			}
 		}
-	    }
-	  }
+	}
 #endif
 	fdsave = open(saveLog, O_WRONLY | O_CREAT | O_TRUNC,sb->st_mode);
 #ifdef WITH_SELINUX
 	if (selinux_enabled) {
-	  setfscreatecon(prev_context);
-	  if (prev_context!= NULL) {
-	    freecon(prev_context);
-	    prev_context=NULL;
-	  }
+		setfscreatecon(prev_context);
+		if (prev_context!= NULL) {
+			freecon(prev_context);
+			prev_context=NULL;
+		}
 	}
 #endif
 	if (fdsave < 0) {
@@ -533,27 +532,33 @@
     
 #ifdef WITH_SELINUX
     if ((selinux_enabled=(is_selinux_enabled()>0))) {
-      security_context_t oldContext=NULL;
-      if (getfilecon(log->files[logNum], &oldContext)>0) {
-	if (getfscreatecon(&prev_context) < 0) {
-	  message(MESS_ERROR, "error getting default context: %s\n", 
-		  strerror(errno));
-	  freecon(oldContext);
-	  return 1;
-	}
-	if (setfscreatecon(oldContext) < 0) {
-	  message(MESS_ERROR, "error setting file context %s to %s: %s\n", 
-		  log->files[logNum], oldContext,strerror(errno));
-	  freecon(oldContext);
-	  return 1;
-	}
-	freecon(oldContext);
-      } else {
-	message(MESS_ERROR, "error getting file context %s: %s\n", 
-		log->files[logNum], 
-		strerror(errno));
-	return 1;
-      }
+	    security_context_t oldContext=NULL;
+	    if (getfilecon(log->files[logNum], &oldContext)>0) {
+		    if (getfscreatecon(&prev_context) < 0) {
+			    message(MESS_ERROR, "error getting default context: %s\n", 
+				    strerror(errno));
+			    if (selinux_getenforce()) {
+				    freecon(oldContext);
+				    return 1;
+			    }
+		    }
+		    if (setfscreatecon(oldContext) < 0) {
+			    message(MESS_ERROR, "error setting file context %s to %s: %s\n", 
+				    log->files[logNum], oldContext,strerror(errno));
+			    if (selinux_getenforce()) {
+				    freecon(oldContext);
+				    return 1;
+			    }
+		    }
+		    freecon(oldContext);
+	    } else {
+		    message(MESS_ERROR, "error getting file context %s: %s\n", 
+			    log->files[logNum], 
+			    strerror(errno));
+		    if (selinux_getenforce()) {
+			    return 1;
+		    }
+	    }
     }
 #endif
     for (i = rotateCount + logStart - 1; (i >= 0) && !hasErrors; i--) {
@@ -731,11 +736,11 @@
     
 #ifdef WITH_SELINUX
 	if (selinux_enabled) {
-	  setfscreatecon(prev_context);
-	  if (prev_context!= NULL) {
-	    freecon(prev_context);
-	    prev_context=NULL;
-	  }
+		setfscreatecon(prev_context);
+		if (prev_context!= NULL) {
+			freecon(prev_context);
+			prev_context=NULL;
+		}
 	}
 #endif
     return hasErrors;


Index: logrotate.spec
===================================================================
RCS file: /cvs/dist/rpms/logrotate/devel/logrotate.spec,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- logrotate.spec	17 Mar 2005 13:54:02 -0000	1.21
+++ logrotate.spec	17 Mar 2005 22:39:50 -0000	1.22
@@ -5,7 +5,7 @@
 Summary: Rotates, compresses, removes and mails system log files.
 Name: logrotate
 Version: 3.7.1
-Release: 8
+Release: 9
 License: GPL
 Group: System Environment/Base
 Source: logrotate-%{PACKAGE_VERSION}.tar.gz
@@ -13,6 +13,7 @@
 Patch1: logrotate-3.7.1-man.patch
 Patch2: logrotate-3.7.1-conf.patch
 Patch3: logrotate-3.7.1-noTMPDIR.patch
+Patch4: logrotate-3.7.1-selinux.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}.root
 
 %description
@@ -32,6 +33,7 @@
 %patch1 -p1 -b .orig
 %patch2 -p1 -b .conf
 %patch3 -p1 -b .noTMPDIR
+%patch4 -p1 -b .selinux
 
 %build
 make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -g" \
@@ -64,6 +66,9 @@
 %attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) /var/lib/logrotate.status
 
 %changelog
+* Thu Mar 17 2005 Dan Walsh <dwalsh at redhat.com> 3.7.1-9
+- Add selinux_getenforce() calls to work when not in enforcing mode
+
 * Thu Mar 17 2005 Peter Vrabec <pvrabec at redhat.com> 3.7.1-8
 - rebuild
 




More information about the fedora-cvs-commits mailing list