Commit 3e6b741a authored by Ondrej Holy's avatar Ondrej Holy
Browse files

user-accounts: check for NULL on um_realm_object_get_common

um_realm_object_get_common can return NULL, which shouldn't be passed
into subsequent functions to avoid crashes.

https://bugzilla.gnome.org/show_bug.cgi?id=705351
parent 15a1bf71
......@@ -655,6 +655,8 @@ enterprise_add_realm (UmAccountDialog *self,
gchar *name;
common = um_realm_object_get_common (realm);
g_return_if_fail (common != NULL);
realm_name = um_realm_common_get_name (common);
/*
......@@ -793,6 +795,12 @@ enterprise_permit_user_login (UmAccountDialog *self)
GVariant *options;
common = um_realm_object_get_common (self->selected_realm);
if (common != NULL) {
g_debug ("Failed to register account: failed to get d-bus interface");
show_error_dialog (self, _("Failed to register account"), NULL);
finish_action (self);
return;
}
login = um_realm_calculate_login (common, gtk_entry_get_text (self->enterprise_login));
g_return_if_fail (login != NULL);
......
......@@ -479,12 +479,14 @@ um_realm_is_configured (UmRealmObject *realm)
{
UmRealmCommon *common;
const gchar *configured;
gboolean is;
gboolean is = FALSE;
common = um_realm_object_get_common (realm);
configured = um_realm_common_get_configured (common);
is = configured != NULL && !g_str_equal (configured, "");
g_object_unref (common);
if (common != NULL) {
configured = um_realm_common_get_configured (common);
is = configured != NULL && !g_str_equal (configured, "");
g_object_unref (common);
}
return is;
}
......
......@@ -524,6 +524,9 @@ find_matching_realm (UmRealmManager *realm_manager, const gchar *login)
gint i;
common = um_realm_object_get_common (l->data);
if (common == NULL)
continue;
permitted_logins = um_realm_common_get_permitted_logins (common);
for (i = 0; permitted_logins[i] != NULL; i++) {
if (g_strcmp0 (permitted_logins[i], login) == 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment