summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Toso <victortoso@redhat.com>2016-04-23 10:20:20 +0200
committerVictor Toso <victortoso@redhat.com>2016-04-28 23:01:49 +0200
commit9e3e121e35769d13f6bee7f80ca8f40d7735bf0b (patch)
treefa482b4d29a716206d34070cdc9fc22e80c42789
parent15052a375b2149222d73d3fd8a703e7cfcc65be3 (diff)
console-kit: do not use empty session
DBus might return empty string for active-session, probably in a non user session (e.g. gdm). It is better to keep the variable as NULL as we check against that (but never against empty strings). Signed-off-by: Victor Toso <victortoso@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
-rw-r--r--src/console-kit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/console-kit.c b/src/console-kit.c
index 9da1165..3a72657 100644
--- a/src/console-kit.c
+++ b/src/console-kit.c
@@ -357,7 +357,12 @@ static char *console_kit_check_active_session_change(struct session_info *info)
}
dbus_message_iter_get_basic(&iter, &session);
- info->active_session = strdup(session);
+ if (session != NULL && session[0] != '\0') {
+ info->active_session = strdup(session);
+ } else {
+ syslog(LOG_WARNING, "(console-kit) received invalid session. "
+ "No active-session at the moment");
+ }
dbus_message_unref(message);
/* non blocking read of the next available message */