summary refs log tree commit diff
path: root/src/settings/nm-agent-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings/nm-agent-manager.c')
-rw-r--r--src/settings/nm-agent-manager.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index d9199f51..531fabc5 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -262,10 +262,11 @@ impl_agent_manager_register (NMAgentManager *self,
 		goto done;
 	}
 
-	if (!nm_session_monitor_uid_has_session (priv->session_monitor,
-                                             sender_uid,
-                                             NULL,
-                                             &local)) {
+	if (   0 != sender_uid
+	    && !nm_session_monitor_uid_has_session (priv->session_monitor,
+	                                            sender_uid,
+	                                            NULL,
+	                                            &local)) {
 		error = g_error_new_literal (NM_AGENT_MANAGER_ERROR,
 		                             NM_AGENT_MANAGER_ERROR_SESSION_NOT_FOUND,
 		                             local && local->message ? local->message : "Session not found");
@@ -552,15 +553,12 @@ request_add_agent (Request *req,
 	 * or that the permissions is empty (ie, visible by everyone).
 	 */
 	agent_uid = nm_secret_agent_get_owner_uid (agent);
-	if (0 != agent_uid) {
-		if (!nm_auth_uid_in_acl (req->connection, session_monitor, agent_uid, NULL)) {
-			nm_log_dbg (LOGD_AGENTS, "(%s) agent ignored for secrets request %p/%s (not in ACL)",
-					    nm_secret_agent_get_description (agent),
-					    req, req->setting_name);
-			/* Connection not visible to this agent's user */
-			return;
-		}
-		/* Caller is allowed to manipulate this connection */
+	if (!nm_auth_uid_in_acl (req->connection, session_monitor, agent_uid, NULL)) {
+		nm_log_dbg (LOGD_AGENTS, "(%s) agent ignored for secrets request %p/%s (not in ACL)",
+		            nm_secret_agent_get_description (agent),
+		            req, req->setting_name);
+		/* Connection not visible to this agent's user */
+		return;
 	}
 
 	/* If the request should filter agents by UID, do that now */