core: fix crash when connecting to new Wi-Fi network (bgo #723163)

If the user is AddAndActivating a new network, the connection may not
have an NMSettingConnection yet, but we know that once it does, the
user will be authorized.
This commit is contained in:
Dan Winship 2014-01-28 08:39:11 -05:00
parent 9694723f08
commit ff350c04c0

View file

@ -535,9 +535,6 @@ nm_auth_uid_in_acl (NMConnection *connection,
if (0 == uid)
return TRUE;
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
/* Reject the request if the request comes from no session at all */
if (!nm_session_monitor_uid_has_session (smon, uid, &user, &local)) {
if (out_error_desc) {
@ -555,6 +552,14 @@ nm_auth_uid_in_acl (NMConnection *connection,
return FALSE;
}
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
/* This can only happen when called from AddAndActivate, so we know
* the user will be authorized when the connection is completed.
*/
return TRUE;
}
/* Match the username returned by the session check to a user in the ACL */
if (!nm_setting_connection_permissions_user_allowed (s_con, user)) {
if (out_error_desc)