diff options
| author | Karel Klic <kklic@redhat.com> | 2009-11-09 13:55:20 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2009-11-09 13:55:20 +0100 |
| commit | 19f406b4930c931a932dc6930762e8e12e29ce8b (patch) | |
| tree | b08468bf9a010cbce0ecd000a0279222f0d4b4e7 /src/Applet/Applet.cpp | |
| parent | 801ab58f32f2cb7dca3352b721a07c83705a0287 (diff) | |
| parent | 8fa9a6ecd247454ab758efecf818d8067455c778 (diff) | |
| download | abrt-19f406b4930c931a932dc6930762e8e12e29ce8b.tar.gz abrt-19f406b4930c931a932dc6930762e8e12e29ce8b.tar.xz abrt-19f406b4930c931a932dc6930762e8e12e29ce8b.zip | |
merge
Diffstat (limited to 'src/Applet/Applet.cpp')
| -rw-r--r-- | src/Applet/Applet.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp index 9d7be5f..2eed556 100644 --- a/src/Applet/Applet.cpp +++ b/src/Applet/Applet.cpp @@ -20,6 +20,7 @@ #include <dbus/dbus-shared.h> #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> +#include <limits.h> #if HAVE_CONFIG_H #include <config.h> #endif @@ -48,13 +49,12 @@ static void Crash(DBusMessage* signal) dbus_message_iter_init(signal, &in_iter); const char* progname; r = load_val(&in_iter, progname); - if (r != ABRT_DBUS_MORE_FIELDS) + /* Optional 2nd param: uid */ + const char* uid_str = NULL; + if (r == ABRT_DBUS_MORE_FIELDS) { - error_msg("dbus signal %s: parameter type mismatch", __func__); - return; + r = load_val(&in_iter, uid_str); } - const char* uid_str; - r = load_val(&in_iter, uid_str); if (r != ABRT_DBUS_LAST_FIELD) { error_msg("dbus signal %s: parameter type mismatch", __func__); @@ -63,10 +63,18 @@ static void Crash(DBusMessage* signal) //if (m_pSessionDBus->has_name("com.redhat.abrt.gui")) // return; - uid_t uid_num = atoi(uid_str); +// uid_t uid_num = atol(uid_str); - if (uid_num != getuid()) - return; + if (uid_str != NULL) + { + char *end; + errno = 0; + unsigned long uid_num = strtoul(uid_str, &end, 10); + if (errno || *end != '\0' || uid_num != getuid()) + { + return; + } + } const char* message = _("A crash in package %s has been detected"); //applet->AddEvent(uid, progname); @@ -241,7 +249,7 @@ int main(int argc, char** argv) "Problem connecting to dbus, or applet is already running"); /* Show disabled icon if daemon is not running */ - if (!dbus_bus_name_has_owner(system_conn, CC_DBUS_NAME, &err)) + if (!dbus_bus_name_has_owner(system_conn, ABRTD_DBUS_NAME, &err)) { const char* msg = _("ABRT service is not running"); puts(msg); |
