polkit-agent: Include subject PID in ::initiate

It is not always clear what triggered a particular polkit request, so
displaying more information to the user is desirable. Unfortunately
the information provided by polkitd is rather sparse, and is usually
limited to subject- and caller PID. Still that's better than nothing,
so include the PID of the initiating process in the signal parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=688351
This commit is contained in:
Florian Müllner 2017-06-28 21:40:43 +02:00
parent d9a1434ae9
commit 087f290ff7
2 changed files with 4 additions and 2 deletions

View File

@ -380,7 +380,7 @@ var AuthenticationAgent = new Lang.Class({
} }
}, },
_onInitiate(nativeAgent, actionId, message, iconName, cookie, userNames) { _onInitiate(nativeAgent, actionId, message, iconName, cookie, subjectPid, userNames) {
// Don't pop up a dialog while locked // Don't pop up a dialog while locked
if (Main.sessionMode.isLocked) { if (Main.sessionMode.isLocked) {
this._sessionUpdatedId = Main.sessionMode.connect('updated', () => { this._sessionUpdatedId = Main.sessionMode.connect('updated', () => {

View File

@ -162,7 +162,8 @@ shell_polkit_authentication_agent_class_init (ShellPolkitAuthenticationAgentClas
NULL, /* accumulator data */ NULL, /* accumulator data */
NULL, /* marshaller */ NULL, /* marshaller */
G_TYPE_NONE, G_TYPE_NONE,
5, 6,
G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
@ -267,6 +268,7 @@ auth_request_initiate (AuthRequest *request)
request->message, request->message,
request->icon_name, request->icon_name,
request->cookie, request->cookie,
polkit_details_lookup (request->details, "polkit.subject-pid"),
user_names); user_names);
g_strfreev (user_names); g_strfreev (user_names);
} }