- fix #661181 - fixed SIGBUS when config file is empty or 4096 bytes
- fix #666677 - preserve ACLs when rotating files
This commit is contained in:
parent
84407423c2
commit
3ad5b60452
161
logrotate-3.7.9-acl.patch
Normal file
161
logrotate-3.7.9-acl.patch
Normal file
@ -0,0 +1,161 @@
|
||||
Index: /trunk/logrotate.c
|
||||
===================================================================
|
||||
--- /trunk/logrotate.c (revision 296)
|
||||
+++ /trunk/logrotate.c (revision 299)
|
||||
@@ -33,4 +33,9 @@
|
||||
#endif
|
||||
|
||||
+#ifdef WITH_ACL
|
||||
+#include "sys/acl.h"
|
||||
+static acl_t prev_acl = NULL;
|
||||
+#endif
|
||||
+
|
||||
#include "basenames.h"
|
||||
#include "log.h"
|
||||
@@ -317,4 +322,29 @@
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+#ifdef WITH_ACL
|
||||
+ if ((prev_acl = acl_get_fd(inFile)) == NULL) {
|
||||
+ if (errno != ENOTSUP) {
|
||||
+ message(MESS_ERROR, "getting file ACL %s: %s\n",
|
||||
+ name, strerror(errno));
|
||||
+ close(inFile);
|
||||
+ close(outFile);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+ if (prev_acl) {
|
||||
+ if (acl_set_fd(outFile, prev_acl) == -1) {
|
||||
+ message(MESS_ERROR, "setting ACL for %s: %s\n",
|
||||
+ compressedName, strerror(errno));
|
||||
+ acl_free(prev_acl);
|
||||
+ prev_acl = NULL;
|
||||
+ close(inFile);
|
||||
+ close(outFile);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ acl_free(prev_acl);
|
||||
+ prev_acl = NULL;
|
||||
+ }
|
||||
+#endif /* WITH_ACL */
|
||||
|
||||
if (!fork()) {
|
||||
@@ -490,4 +520,14 @@
|
||||
}
|
||||
#endif
|
||||
+#ifdef WITH_ACL
|
||||
+ if ((prev_acl = acl_get_fd(fdcurr)) == NULL) {
|
||||
+ if (errno != ENOTSUP) {
|
||||
+ message(MESS_ERROR, "getting file ACL %s: %s\n",
|
||||
+ currLog, strerror(errno));
|
||||
+ close(fdcurr);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* WITH_ACL */
|
||||
fdsave =
|
||||
createOutputFile(saveLog, O_WRONLY | O_CREAT | O_TRUNC, sb);
|
||||
@@ -501,6 +541,26 @@
|
||||
if (fdsave < 0) {
|
||||
close(fdcurr);
|
||||
+#ifdef WITH_ACL
|
||||
+ if (prev_acl)
|
||||
+ acl_free(prev_acl);
|
||||
+#endif /* WITH_ACL */
|
||||
return 1;
|
||||
}
|
||||
+#ifdef WITH_ACL
|
||||
+ if (prev_acl) {
|
||||
+ if (acl_set_fd(fdsave, prev_acl) == -1) {
|
||||
+ message(MESS_ERROR, "setting ACL for %s: %s\n",
|
||||
+ saveLog, strerror(errno));
|
||||
+ acl_free(prev_acl);
|
||||
+ prev_acl = NULL;
|
||||
+ close(fdsave);
|
||||
+ close(fdcurr);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ acl_free(prev_acl);
|
||||
+ prev_acl = NULL;
|
||||
+ }
|
||||
+#endif /* WITH_ACL */
|
||||
+
|
||||
while ((cnt = read(fdcurr, buf, sizeof(buf))) > 0) {
|
||||
if (write(fdsave, buf, cnt) != cnt) {
|
||||
@@ -1087,4 +1147,13 @@
|
||||
}
|
||||
#endif
|
||||
+#ifdef WITH_ACL
|
||||
+ if ((prev_acl = acl_get_file(log->files[logNum], ACL_TYPE_ACCESS)) == NULL) {
|
||||
+ if (errno != ENOTSUP) {
|
||||
+ message(MESS_ERROR, "getting file ACL %s: %s\n",
|
||||
+ log->files[logNum], strerror(errno));
|
||||
+ hasErrors = 1;
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* WITH_ACL */
|
||||
message(MESS_DEBUG, "renaming %s to %s\n", log->files[logNum],
|
||||
rotNames->finalName);
|
||||
@@ -1134,10 +1203,33 @@
|
||||
|
||||
if (!debug) {
|
||||
+#ifdef WITH_ACL
|
||||
+ if (prev_acl == NULL && (prev_acl = acl_get_file(log->files[logNum], ACL_TYPE_ACCESS)) == NULL) {
|
||||
+ if (errno != ENOTSUP) {
|
||||
+ message(MESS_ERROR, "getting file ACL %s: %s\n",
|
||||
+ log->files[logNum], strerror(errno));
|
||||
+ hasErrors = 1;
|
||||
+ }
|
||||
+ }
|
||||
+#endif /* WITH_ACL */
|
||||
+ if (!hasErrors) {
|
||||
fd = createOutputFile(log->files[logNum], O_CREAT | O_RDWR,
|
||||
&sb);
|
||||
if (fd < 0)
|
||||
hasErrors = 1;
|
||||
- else
|
||||
+ else {
|
||||
+#ifdef WITH_ACL
|
||||
+ if (prev_acl) {
|
||||
+ if (acl_set_fd(fd, prev_acl) == -1) {
|
||||
+ message(MESS_ERROR, "setting ACL for %s: %s\n",
|
||||
+ log->files[logNum], strerror(errno));
|
||||
+ hasErrors = 1;
|
||||
+ }
|
||||
+ acl_free(prev_acl);
|
||||
+ prev_acl = NULL;
|
||||
+ }
|
||||
+#endif /* WITH_ACL */
|
||||
close(fd);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
@@ -1156,4 +1248,11 @@
|
||||
&state->sb, log->flags);
|
||||
|
||||
+#ifdef WITH_ACL
|
||||
+ if (prev_acl) {
|
||||
+ acl_free(prev_acl);
|
||||
+ prev_acl = NULL;
|
||||
+ }
|
||||
+#endif /* WITH_ACL */
|
||||
+
|
||||
}
|
||||
return hasErrors;
|
||||
Index: /trunk/Makefile
|
||||
===================================================================
|
||||
--- /trunk/Makefile (revision 296)
|
||||
+++ /trunk/Makefile (revision 299)
|
||||
@@ -14,4 +14,9 @@
|
||||
CFLAGS += -DWITH_SELINUX
|
||||
LOADLIBES += -lselinux
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(WITH_ACL),yes)
|
||||
+CFLAGS += -DWITH_ACL
|
||||
+LOADLIBES += -lacl
|
||||
endif
|
||||
|
2024
logrotate-3.7.9-config.patch
Normal file
2024
logrotate-3.7.9-config.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,18 @@
|
||||
Summary: Rotates, compresses, removes and mails system log files
|
||||
Name: logrotate
|
||||
Version: 3.7.9
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: GPL+
|
||||
Group: System Environment/Base
|
||||
Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz
|
||||
Patch1: logrotate-3.7.8-man-authors.patch
|
||||
Patch2: logrotate-3.7.9-man-size.patch
|
||||
Patch3: logrotate-3.7.9-man-page.patch
|
||||
Patch4: logrotate-3.7.9-config.patch
|
||||
Patch5: logrotate-3.7.9-acl.patch
|
||||
|
||||
Requires: coreutils >= 5.92 libsepol libselinux popt
|
||||
BuildRequires: libselinux-devel popt-devel
|
||||
Requires: coreutils >= 5.92 libsepol libselinux popt libacl
|
||||
BuildRequires: libselinux-devel popt-devel libacl-devel
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
%description
|
||||
@ -29,9 +31,11 @@ log files on your system.
|
||||
%patch1 -p2
|
||||
%patch2
|
||||
%patch3 -p1
|
||||
%patch4
|
||||
%patch5 -p2
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes
|
||||
make %{?_smp_mflags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS" WITH_SELINUX=yes WITH_ACL=yes
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
@ -59,6 +63,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
|
||||
|
||||
%changelog
|
||||
* Wed Dec 15 2010 Jan Kaluza <jkaluza@redhat.com> 3.7.9-5
|
||||
- fix #661181 - fixed SIGBUS when config file is empty or 4096 bytes
|
||||
- fix #666677 - preserve ACLs when rotating files
|
||||
|
||||
* Tue Oct 19 2010 Jan Kaluza <jkaluza@redhat.com> 3.7.9-4
|
||||
- fix #644309 - mention all logrotate params in man page
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user