New upstream release 2.1.3

This commit is contained in:
Jakub Filak 2013-03-27 16:55:27 +01:00
commit 550837e579
4 changed files with 19 additions and 148 deletions

1
.gitignore vendored
View file

@ -24,3 +24,4 @@ abrt-1.1.13.tar.gz
/abrt-2.1.0.tar.gz
/abrt-2.1.1.tar.gz
/abrt-2.1.2.tar.gz
/abrt-2.1.3.tar.gz

View file

@ -1,139 +0,0 @@
From f3ef192d2ee78bdb4290ea966bc1467d2b599a7e Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Fri, 22 Mar 2013 10:18:16 +0100
Subject: [ABRT PATCH] abrtd: recreate Dump Location directory if it is delete
- add inotify watch IN_DELETE_SELF and IN_MOVE_SELF and as a rection on
these events create the dump location and restore inotify watch.
- closes #624
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/daemon/abrtd.c | 82 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 50 insertions(+), 32 deletions(-)
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index f6d3965..7bc93ef 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -41,6 +41,7 @@
/* Maximum number of simultaneously opened client connections. */
#define MAX_CLIENT_COUNT 10
+#define IN_DUMP_LOCATION_FLAGS (IN_CREATE | IN_MOVED_TO | IN_DELETE_SELF | IN_MOVE_SELF)
/* Daemon initializes, then sits in glib main loop, waiting for events.
* Events can be:
@@ -490,6 +491,36 @@ static gboolean handle_event_output_cb(GIOChannel *gio, GIOCondition condition,
/* Removing will also drop the last ref to this gio, closing/freeing it */
}
+static void ensure_writable_dir(const char *dir, mode_t mode, const char *user)
+{
+ struct stat sb;
+
+ if (mkdir(dir, mode) != 0 && errno != EEXIST)
+ perror_msg_and_die("Can't create '%s'", dir);
+ if (stat(dir, &sb) != 0 || !S_ISDIR(sb.st_mode))
+ error_msg_and_die("'%s' is not a directory", dir);
+
+ struct passwd *pw = getpwnam(user);
+ if (!pw)
+ perror_msg_and_die("Can't find user '%s'", user);
+
+ if ((sb.st_uid != pw->pw_uid || sb.st_gid != pw->pw_gid) && lchown(dir, pw->pw_uid, pw->pw_gid) != 0)
+ perror_msg_and_die("Can't set owner %u:%u on '%s'", (unsigned int)pw->pw_uid, (unsigned int)pw->pw_gid, dir);
+ if ((sb.st_mode & 07777) != mode && chmod(dir, mode) != 0)
+ perror_msg_and_die("Can't set mode %o on '%s'", mode, dir);
+}
+
+static void sanitize_dump_dir_rights()
+{
+ /* We can't allow everyone to create dumps: otherwise users can flood
+ * us with thousands of bogus or malicious dumps */
+ /* 07000 bits are setuid, setgit, and sticky, and they must be unset */
+ /* 00777 bits are usual "rwxrwxrwx" access rights */
+ ensure_writable_dir(g_settings_dump_location, 0755, "abrt");
+ /* temp dir */
+ ensure_writable_dir(VAR_RUN"/abrt", 0755, "root");
+}
+
/* Inotify handler */
static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpointer ptr_unused)
@@ -594,6 +625,22 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin
continue;
}
+ if (event->mask & IN_DELETE_SELF || event->mask & IN_MOVE_SELF)
+ {
+ /* HACK: we expect that we watch deletion only of 'g_settings_dump_location'
+ * but this handler is used for 'g_settings_sWatchCrashdumpArchiveDir' too
+ */
+ log("Recreating deleted dump location '%s'", g_settings_dump_location);
+ inotify_rm_watch(g_io_channel_unix_get_fd(gio), event->wd);
+ sanitize_dump_dir_rights();
+ if (inotify_add_watch(g_io_channel_unix_get_fd(gio), g_settings_dump_location, IN_DUMP_LOCATION_FLAGS) < 0)
+ {
+ perror_msg_and_die("inotify_add_watch failed on recreated '%s'", g_settings_dump_location);
+ }
+
+ continue;
+ }
+
if (!(event->mask & IN_ISDIR) || !name)
{
/* ignore lock files and such */
@@ -810,36 +857,6 @@ static void start_syslog_logging()
putenv((char*)"ABRT_SYSLOG=1");
}
-static void ensure_writable_dir(const char *dir, mode_t mode, const char *user)
-{
- struct stat sb;
-
- if (mkdir(dir, mode) != 0 && errno != EEXIST)
- perror_msg_and_die("Can't create '%s'", dir);
- if (stat(dir, &sb) != 0 || !S_ISDIR(sb.st_mode))
- error_msg_and_die("'%s' is not a directory", dir);
-
- struct passwd *pw = getpwnam(user);
- if (!pw)
- perror_msg_and_die("Can't find user '%s'", user);
-
- if ((sb.st_uid != pw->pw_uid || sb.st_gid != pw->pw_gid) && lchown(dir, pw->pw_uid, pw->pw_gid) != 0)
- perror_msg_and_die("Can't set owner %u:%u on '%s'", (unsigned int)pw->pw_uid, (unsigned int)pw->pw_gid, dir);
- if ((sb.st_mode & 07777) != mode && chmod(dir, mode) != 0)
- perror_msg_and_die("Can't set mode %o on '%s'", mode, dir);
-}
-
-static void sanitize_dump_dir_rights()
-{
- /* We can't allow everyone to create dumps: otherwise users can flood
- * us with thousands of bogus or malicious dumps */
- /* 07000 bits are setuid, setgit, and sticky, and they must be unset */
- /* 00777 bits are usual "rwxrwxrwx" access rights */
- ensure_writable_dir(g_settings_dump_location, 0755, "abrt");
- /* temp dir */
- ensure_writable_dir(VAR_RUN"/abrt", 0755, "root");
-}
-
int main(int argc, char** argv)
{
/* I18n */
@@ -966,8 +983,9 @@ int main(int argc, char** argv)
perror_msg_and_die("inotify_init failed");
close_on_exec_on(inotify_fd);
- /* Watching 'g_settings_dump_location' for new files... */
- if (inotify_add_watch(inotify_fd, g_settings_dump_location, IN_CREATE | IN_MOVED_TO) < 0)
+ /* Watching 'g_settings_dump_location' for new files and delete self
+ * because hooks expects that the dump location exists if abrtd is runnig*/
+ if (inotify_add_watch(inotify_fd, g_settings_dump_location, IN_DUMP_LOCATION_FLAGS) < 0)
{
perror_msg("inotify_add_watch failed on '%s'", g_settings_dump_location);
goto init_error;
--
1.8.1.4

View file

@ -24,8 +24,8 @@
Summary: Automatic bug detection and reporting tool
Name: abrt
Version: 2.1.2
Release: 3%{?dist}
Version: 2.1.3
Release: 1%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://fedorahosted.org/abrt/
@ -36,8 +36,6 @@ Patch1: disable_gpg_check.patch
Patch2: abrt-2.1.1-hide_all_ureport_stuff.patch
Patch3: abrt-2.1.1-dont_enable_shortened_reporting_in_gnome.patch
Patch4: abrt-2.1.1-disable_autoreporting_dialog.patch
# Remove this patch with abrt-2.1.3
Patch5: abrt-2.1.2-recreate_dump_location.patch
BuildRequires: dbus-devel
BuildRequires: gtk3-devel
@ -229,7 +227,12 @@ Requires: gnome-abrt
Requires: abrt-plugin-bodhi
Requires: libreport-plugin-logger, libreport-plugin-bugzilla
Requires: libreport-plugin-ureport
%if 0%{?fedora}
Requires: libreport-fedora
%endif
%if 0%{?rhel}
Requires: libreport-rhel
%endif
#Requires: abrt-plugin-firefox
Obsoletes: bug-buddy > 0.0.1
Provides: bug-buddy
@ -272,7 +275,6 @@ problems handled by ABRT in Python.
%endif
#Fedora
%patch1 -p1 -b .gpgcheck
%patch5 -p1 -b .dumplocation
%build
autoconf
@ -576,7 +578,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%config(noreplace) %{_sysconfdir}/%{name}/gpg_keys
%config(noreplace) %{_sysconfdir}/libreport/events.d/abrt_event.conf
%config(noreplace) %{_sysconfdir}/libreport/events.d/smart_event.conf
%config(noreplace) %{_sysconfdir}/libreport/events.d/smolt_event.conf
%dir %attr(0755, abrt, abrt) %{_localstatedir}/tmp/%{name}
%dir %attr(0700, abrt, abrt) %{_localstatedir}/spool/%{name}-upload
# abrtd runs as root
@ -611,7 +612,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files gui
%defattr(-,root,root,-)
%{_bindir}/abrt-gui
%dir %{_datadir}/%{name}
# all glade, gtkbuilder and py files for gui
%{_datadir}/icons/hicolor/*/apps/*
@ -650,7 +650,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_sysconfdir}/libreport/events/analyze_CCpp.xml
%{_sysconfdir}/libreport/events/analyze_LocalGDB.xml
%{_sysconfdir}/libreport/events/collect_xsession_errors.xml
%{_sysconfdir}/libreport/events/collect_Smolt.xml
%{_sysconfdir}/libreport/events/collect_GConf.xml
%{_sysconfdir}/libreport/events/collect_vimrc_user.xml
%{_sysconfdir}/libreport/events/collect_vimrc_system.xml
@ -751,6 +750,16 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_defaultdocdir}/%{name}-python-%{version}/examples/
%changelog
* Wed Mar 27 2013 Jakub Filak <jfilak@redhat.com> 2.1.3-1
- record runlevel
- Integration with satyr
- dbus: check correct errno after dump_dir_is_accessible_by_uid()
- require libreport workflow package acc. to OS type
- remove the abrt-gui closes #629
- retrace-client: do not allow space in os_release_id; closes #625
- Remove all smolt-related files and code bits
- abrtd: recreate Dump Location directory if it is delete
* Mon Mar 25 2013 Jakub Filak <jfilak@redhat.com> 2.1.2-3
- Check if restorecon cmd exists and run it only if it does
- Resolves: #926934

View file

@ -1 +1 @@
9d79f548fd5b2814afe4cf8b4ea78f51 abrt-2.1.2.tar.gz
ba54ade40bd9688d0260b6e2355d1faa abrt-2.1.3.tar.gz