File: polkit-dbus.xml

package info (click to toggle)
policykit 0.9-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 5,984 kB
  • ctags: 1,593
  • sloc: ansic: 16,528; xml: 10,659; sh: 9,472; makefile: 633
file content (570 lines) | stat: -rw-r--r-- 34,296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="polkit-polkit-dbus">
<refmeta>
<refentrytitle role="top_of_page" id="polkit-polkit-dbus.top_of_page">Caller Determination</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>POLKIT Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Caller Determination</refname>
<refpurpose>Obtaining seat, session and caller information
via D-Bus and ConsoleKit.</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="polkit-polkit-dbus.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
<link linkend="PolKitSession">PolKitSession</link>*      <link linkend="polkit-session-new-from-objpath">polkit_session_new_from_objpath</link>     (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         const <link linkend="char">char</link> *objpath,
                                                         <link linkend="uid-t">uid_t</link> uid,
                                                         <link linkend="DBusError">DBusError</link> *error);
<link linkend="PolKitSession">PolKitSession</link>*      <link linkend="polkit-session-new-from-cookie">polkit_session_new_from_cookie</link>      (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         const <link linkend="char">char</link> *cookie,
                                                         <link linkend="DBusError">DBusError</link> *error);
<link linkend="PolKitCaller">PolKitCaller</link>*       <link linkend="polkit-caller-new-from-dbus-name">polkit_caller_new_from_dbus_name</link>    (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         const <link linkend="char">char</link> *dbus_name,
                                                         <link linkend="DBusError">DBusError</link> *error);
<link linkend="PolKitCaller">PolKitCaller</link>*       <link linkend="polkit-caller-new-from-pid">polkit_caller_new_from_pid</link>          (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         <link linkend="pid-t">pid_t</link> pid,
                                                         <link linkend="DBusError">DBusError</link> *error);
<link linkend="polkit-bool-t">polkit_bool_t</link>       <link linkend="polkit-is-authorization-relevant">polkit_is_authorization_relevant</link>    (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         <link linkend="PolKitAuthorization">PolKitAuthorization</link> *auth,
                                                         <link linkend="DBusError">DBusError</link> *error);
                    <link linkend="PolKitTracker">PolKitTracker</link>;
<link linkend="PolKitTracker">PolKitTracker</link>*      <link linkend="polkit-tracker-new">polkit_tracker_new</link>                  (void);
<link linkend="PolKitTracker">PolKitTracker</link>*      <link linkend="polkit-tracker-ref">polkit_tracker_ref</link>                  (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker);
<link linkend="void">void</link>                <link linkend="polkit-tracker-unref">polkit_tracker_unref</link>                (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker);
<link linkend="void">void</link>                <link linkend="polkit-tracker-set-system-bus-connection">polkit_tracker_set_system_bus_connection</link>
                                                        (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="DBusConnection">DBusConnection</link> *con);
<link linkend="void">void</link>                <link linkend="polkit-tracker-init">polkit_tracker_init</link>                 (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker);
<link linkend="polkit-bool-t">polkit_bool_t</link>       <link linkend="polkit-tracker-dbus-func">polkit_tracker_dbus_func</link>            (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="DBusMessage">DBusMessage</link> *message);
<link linkend="PolKitCaller">PolKitCaller</link>*       <link linkend="polkit-tracker-get-caller-from-dbus-name">polkit_tracker_get_caller_from_dbus_name</link>
                                                        (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         const <link linkend="char">char</link> *dbus_name,
                                                         <link linkend="DBusError">DBusError</link> *error);
<link linkend="PolKitCaller">PolKitCaller</link>*       <link linkend="polkit-tracker-get-caller-from-pid">polkit_tracker_get_caller_from_pid</link>  (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="pid-t">pid_t</link> pid,
                                                         <link linkend="DBusError">DBusError</link> *error);
<link linkend="polkit-bool-t">polkit_bool_t</link>       <link linkend="polkit-tracker-is-authorization-relevant">polkit_tracker_is_authorization_relevant</link>
                                                        (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="PolKitAuthorization">PolKitAuthorization</link> *auth,
                                                         <link linkend="DBusError">DBusError</link> *error);
</synopsis>
</refsynopsisdiv>









<refsect1 id="polkit-polkit-dbus.description" role="desc">
<title role="desc.title">Description</title>
<para>
Helper library for obtaining seat, session and caller information
via D-Bus and ConsoleKit. This library is only useful when writing
a mechanism. 
</para>
<para>
If the mechanism itself is a daemon exposing a remote services via
the system message bus it's often a better idea, to reduce
roundtrips, to use the high-level <link linkend="PolKitTracker"><type>PolKitTracker</type></link> class rather than
the low-level functions <link linkend="polkit-caller-new-from-dbus-name"><function>polkit_caller_new_from_dbus_name()</function></link> and
<link linkend="polkit-caller-new-from-pid"><function>polkit_caller_new_from_pid()</function></link>.
</para>
<para>
These functions are in <literal>libpolkit-dbus</literal>.</para>
<para>

</para>
</refsect1>

<refsect1 id="polkit-polkit-dbus.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="polkit-session-new-from-objpath" role="function">
<title>polkit_session_new_from_objpath ()</title>
<indexterm zone="polkit-session-new-from-objpath"><primary>polkit_session_new_from_objpath</primary></indexterm><programlisting><link linkend="PolKitSession">PolKitSession</link>*      polkit_session_new_from_objpath     (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         const <link linkend="char">char</link> *objpath,
                                                         <link linkend="uid-t">uid_t</link> uid,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
This function will construct a <link linkend="PolKitSession"><type>PolKitSession</type></link> object by querying
the ConsoleKit daemon for information. Note that this will do a lot
of blocking IO so it is best avoided if your process already
tracks/caches all the information. If you pass in <parameter>uid</parameter> as a
non-negative number, a round trip can be saved.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>con</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus system bus connection
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>objpath</parameter>&nbsp;:</term>
<listitem><simpara> object path of ConsoleKit session object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uid</parameter>&nbsp;:</term>
<listitem><simpara> the user owning the session or -1 if unknown
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new object or <link linkend="NULL:CAPS"><type>NULL</type></link> if an error occured (in which case
<parameter>error</parameter> will be set)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="polkit-session-new-from-cookie" role="function">
<title>polkit_session_new_from_cookie ()</title>
<indexterm zone="polkit-session-new-from-cookie"><primary>polkit_session_new_from_cookie</primary></indexterm><programlisting><link linkend="PolKitSession">PolKitSession</link>*      polkit_session_new_from_cookie      (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         const <link linkend="char">char</link> *cookie,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
This function will construct a <link linkend="PolKitSession"><type>PolKitSession</type></link> object by querying
the ConsoleKit daemon for information. Note that this will do a lot
of blocking IO so it is best avoided if your process already
tracks/caches all the information.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>con</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus system bus connection
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>cookie</parameter>&nbsp;:</term>
<listitem><simpara> a ConsoleKit XDG_SESSION_COOKIE
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new object or <link linkend="NULL:CAPS"><type>NULL</type></link> if an error occured (in which case
<parameter>error</parameter> will be set)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="polkit-caller-new-from-dbus-name" role="function">
<title>polkit_caller_new_from_dbus_name ()</title>
<indexterm zone="polkit-caller-new-from-dbus-name"><primary>polkit_caller_new_from_dbus_name</primary></indexterm><programlisting><link linkend="PolKitCaller">PolKitCaller</link>*       polkit_caller_new_from_dbus_name    (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         const <link linkend="char">char</link> *dbus_name,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
This function will construct a <link linkend="PolKitCaller"><type>PolKitCaller</type></link> object by querying
both the system bus daemon and the ConsoleKit daemon for
information. Note that this will do a lot of blocking IO so it is
best avoided if your process already tracks/caches all the
information. You can use the <link linkend="PolKitTracker"><type>PolKitTracker</type></link> class for this.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>con</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus system bus connection
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dbus_name</parameter>&nbsp;:</term>
<listitem><simpara> unique system bus connection name
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new object or <link linkend="NULL:CAPS"><type>NULL</type></link> if an error occured (in which case
<parameter>error</parameter> will be set)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="polkit-caller-new-from-pid" role="function">
<title>polkit_caller_new_from_pid ()</title>
<indexterm zone="polkit-caller-new-from-pid"><primary>polkit_caller_new_from_pid</primary></indexterm><programlisting><link linkend="PolKitCaller">PolKitCaller</link>*       polkit_caller_new_from_pid          (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         <link linkend="pid-t">pid_t</link> pid,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
This function will construct a <link linkend="PolKitCaller"><type>PolKitCaller</type></link> object by querying
both information in /proc (on Linux) and the ConsoleKit daemon for
information about a given process. Note that this will do a lot of
blocking IO so it is best avoided if your process already
tracks/caches all the information. You can use the <link linkend="PolKitTracker"><type>PolKitTracker</type></link>
class for this.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>con</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus system bus connection
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pid</parameter>&nbsp;:</term>
<listitem><simpara> process id
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new object or <link linkend="NULL:CAPS"><type>NULL</type></link> if an error occured (in which case
<parameter>error</parameter> will be set)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="polkit-is-authorization-relevant" role="function" condition="since:0.7">
<title>polkit_is_authorization_relevant ()</title>
<indexterm zone="polkit-is-authorization-relevant" role="0.7"><primary>polkit_is_authorization_relevant</primary></indexterm><programlisting><link linkend="polkit-bool-t">polkit_bool_t</link>       polkit_is_authorization_relevant    (<link linkend="DBusConnection">DBusConnection</link> *con,
                                                         <link linkend="PolKitAuthorization">PolKitAuthorization</link> *auth,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
As explicit authorizations are scoped (process single shot,
process, session or everything), they become irrelevant once the
entity (process or session) ceases to exist. This function
determines whether the authorization is still relevant; it's useful
for reporting and graphical tools displaying authorizations.
</para>
<para>
Note that this may do blocking IO to check for session
authorizations so it is best avoided if your process already
tracks/caches all the information. You can use the
<link linkend="polkit-tracker-is-authorization-relevant"><function>polkit_tracker_is_authorization_relevant()</function></link> method on the
<link linkend="PolKitTracker"><type>PolKitTracker</type></link> class for this.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>con</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus system bus connection
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>auth</parameter>&nbsp;:</term>
<listitem><simpara> authorization to check for
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> return location for error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><type>TRUE</type></link> if the authorization still applies, <link linkend="FALSE:CAPS"><type>FALSE</type></link> if an
error occurred (then error will be set) or if the entity the
authorization refers to has gone out of scope.

This function is in <literal>libpolkit-dbus</literal>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="PolKitTracker" role="struct">
<title>PolKitTracker</title>
<indexterm zone="PolKitTracker"><primary>PolKitTracker</primary></indexterm><programlisting>typedef struct _PolKitTracker PolKitTracker;</programlisting>
<para>
Instances of this class are used to cache information about
callers; typically this is used in scenarios where the same caller
is calling into a mechanism multiple times. 
</para>
<para>
Thus, an application can use this class to get the <link linkend="PolKitCaller"><type>PolKitCaller</type></link>
object; the class will listen to both NameOwnerChanged and
ActivityChanged signals from the message bus and update / retire
the <link linkend="PolKitCaller"><type>PolKitCaller</type></link> objects.
</para>
<para>
An example of how to use <link linkend="PolKitTracker"><type>PolKitTracker</type></link> is provided here. First, build the following program
</para>
<para>
<programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../../examples/tracker-example/tracker-example.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</para>
<para>
with
</para>
<para>
<programlisting>gcc -o tracker-example `pkg-config --cflags --libs dbus-glib-1 polkit-dbus` tracker-example.c</programlisting>
</para>
<para>
Then put the following content
</para>
<para>
<programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../../examples/tracker-example/dk.fubar.PolKitTestService.conf" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</para>
<para>
in the file <literal>/etc/dbus-1/system.d/dk.fubar.PolKitTestService.conf</literal>. Finally,
create a small Python client like this
</para>
<para>
<programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../../examples/tracker-example/tracker-example-client.py" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</para>
<para>
as <literal>tracker-example-client.py</literal>. Now, run <literal>tracker-example</literal>
in one window and <literal>tracker-example-client</literal> in another. The output of
the former should look like this
</para>
<para>
<programlisting>
18:20:00.414: PolKitCaller: refcount=1 dbus_name=:1.473 uid=500 pid=8636 selinux_context=system_u:system_r:unconfined_t
18:20:00.414: PolKitSession: refcount=1 uid=0 objpath=/org/freedesktop/ConsoleKit/Session1 is_active=1 is_local=1 remote_host=(null)
18:20:00.414: PolKitSeat: refcount=1 objpath=/org/freedesktop/ConsoleKit/Seat1

18:20:01.424: PolKitCaller: refcount=1 dbus_name=:1.473 uid=500 pid=8636 selinux_context=system_u:system_r:unconfined_t
18:20:01.424: PolKitSession: refcount=1 uid=0 objpath=/org/freedesktop/ConsoleKit/Session1 is_active=1 is_local=1 remote_host=(null)
18:20:01.424: PolKitSeat: refcount=1 objpath=/org/freedesktop/ConsoleKit/Seat1

18:20:02.434: PolKitCaller: refcount=1 dbus_name=:1.473 uid=500 pid=8636 selinux_context=system_u:system_r:unconfined_t
18:20:02.434: PolKitSession: refcount=1 uid=0 objpath=/org/freedesktop/ConsoleKit/Session1 is_active=0 is_local=1 remote_host=(null)
18:20:02.434: PolKitSeat: refcount=1 objpath=/org/freedesktop/ConsoleKit/Seat1

18:20:03.445: PolKitCaller: refcount=1 dbus_name=:1.473 uid=500 pid=8636 selinux_context=system_u:system_r:unconfined_t
18:20:03.445: PolKitSession: refcount=1 uid=0 objpath=/org/freedesktop/ConsoleKit/Session1 is_active=1 is_local=1 remote_host=(null)
18:20:03.445: PolKitSeat: refcount=1 objpath=/org/freedesktop/ConsoleKit/Seat1
</programlisting>
</para>
<para>
The point of the test program is simply to gather caller
information about clients (the small Python program, you may launch
multiple instances of it) that repeatedly calls into the D-Bus
service; if one runs <literal>strace(1)</literal> in front of the
test program one will notice that there is only syscall / IPC
overhead (except for printing to stdout) on the first call from the
client.
</para>
<para>
The careful reader will notice that, during the testing session, we
did a quick VT switch away from the session (and back) which is
reflected in the output.
</para>
<para>
These functions are in <literal>libpolkit-dbus</literal>.</para>
<para>

</para></refsect2>
<refsect2 id="polkit-tracker-new" role="function" condition="since:0.7">
<title>polkit_tracker_new ()</title>
<indexterm zone="polkit-tracker-new" role="0.7"><primary>polkit_tracker_new</primary></indexterm><programlisting><link linkend="PolKitTracker">PolKitTracker</link>*      polkit_tracker_new                  (void);</programlisting>
<para>
Creates a new <link linkend="PolKitTracker"><type>PolKitTracker</type></link> object.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new object

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-ref" role="function" condition="since:0.7">
<title>polkit_tracker_ref ()</title>
<indexterm zone="polkit-tracker-ref" role="0.7"><primary>polkit_tracker_ref</primary></indexterm><programlisting><link linkend="PolKitTracker">PolKitTracker</link>*      polkit_tracker_ref                  (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker);</programlisting>
<para>
Increase reference count.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the object

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-unref" role="function" condition="since:0.7">
<title>polkit_tracker_unref ()</title>
<indexterm zone="polkit-tracker-unref" role="0.7"><primary>polkit_tracker_unref</primary></indexterm><programlisting><link linkend="void">void</link>                polkit_tracker_unref                (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker);</programlisting>
<para>
Decreases the reference count of the object. If it becomes zero,
the object is freed. Before freeing, reference counts on embedded
objects are decresed by one.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker object
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-set-system-bus-connection" role="function" condition="since:0.7">
<title>polkit_tracker_set_system_bus_connection ()</title>
<indexterm zone="polkit-tracker-set-system-bus-connection" role="0.7"><primary>polkit_tracker_set_system_bus_connection</primary></indexterm><programlisting><link linkend="void">void</link>                polkit_tracker_set_system_bus_connection
                                                        (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="DBusConnection">DBusConnection</link> *con);</programlisting>
<para>
Tell the <link linkend="PolKitTracker"><type>PolKitTracker</type></link> object to use the given D-Bus connection
when it needs to fetch information from the system message bus and
ConsoleKit services. This is used for priming the cache.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>con</parameter>&nbsp;:</term>
<listitem><simpara> the connection to the system message bus
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-init" role="function" condition="since:0.7">
<title>polkit_tracker_init ()</title>
<indexterm zone="polkit-tracker-init" role="0.7"><primary>polkit_tracker_init</primary></indexterm><programlisting><link linkend="void">void</link>                polkit_tracker_init                 (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker);</programlisting>
<para>
Initialize the tracker.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker object
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-dbus-func" role="function" condition="since:0.7">
<title>polkit_tracker_dbus_func ()</title>
<indexterm zone="polkit-tracker-dbus-func" role="0.7"><primary>polkit_tracker_dbus_func</primary></indexterm><programlisting><link linkend="polkit-bool-t">polkit_bool_t</link>       polkit_tracker_dbus_func            (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="DBusMessage">DBusMessage</link> *message);</programlisting>
<para>
The owner of the <link linkend="PolKitTracker"><type>PolKitTracker</type></link> object must pass signals from the
system message bus (just NameOwnerChanged will do) and all signals
from the ConsoleKit service into this function.
</para>
<para>
This function is in <literal>libpolkit-dbus</literal>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>message</parameter>&nbsp;:</term>
<listitem><simpara> message to pass
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><type>TRUE</type></link> only if there was a change in the ConsoleKit database.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-get-caller-from-dbus-name" role="function" condition="since:0.7">
<title>polkit_tracker_get_caller_from_dbus_name ()</title>
<indexterm zone="polkit-tracker-get-caller-from-dbus-name" role="0.7"><primary>polkit_tracker_get_caller_from_dbus_name</primary></indexterm><programlisting><link linkend="PolKitCaller">PolKitCaller</link>*       polkit_tracker_get_caller_from_dbus_name
                                                        (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         const <link linkend="char">char</link> *dbus_name,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
This function is similar to <link linkend="polkit-caller-new-from-dbus-name"><function>polkit_caller_new_from_dbus_name()</function></link>
except that it uses the cache in <link linkend="PolKitTracker"><type>PolKitTracker</type></link>. So on the second
and subsequent calls, for the same D-Bus name, there will be no
syscall or IPC overhead in calling this function.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dbus_name</parameter>&nbsp;:</term>
<listitem><simpara> unique name on the system message bus
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A <link linkend="PolKitCaller"><type>PolKitCaller</type></link> object; the caller must use
<link linkend="polkit-caller-unref"><function>polkit_caller_unref()</function></link> on the object when done with it. Returns
<link linkend="NULL:CAPS"><type>NULL</type></link> if an error occured (in which case error will be set).

This function is in <literal>libpolkit-dbus</literal>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-get-caller-from-pid" role="function" condition="since:0.7">
<title>polkit_tracker_get_caller_from_pid ()</title>
<indexterm zone="polkit-tracker-get-caller-from-pid" role="0.7"><primary>polkit_tracker_get_caller_from_pid</primary></indexterm><programlisting><link linkend="PolKitCaller">PolKitCaller</link>*       polkit_tracker_get_caller_from_pid  (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="pid-t">pid_t</link> pid,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
This function is similar to <link linkend="polkit-caller-new-from-pid"><function>polkit_caller_new_from_pid()</function></link>
except that it uses the cache in <link linkend="PolKitTracker"><type>PolKitTracker</type></link>. So on the second
and subsequent calls, for the same D-Bus name, there will be no
IPC overhead in calling this function. 
</para>
<para>
There will be some syscall overhead to lookup the time when the
given process is started (on Linux, looking up /proc/$pid/stat);
this is needed because pid's can be recycled and the cache thus
needs to record this in addition to the pid.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pid</parameter>&nbsp;:</term>
<listitem><simpara> UNIX process id to look at
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> D-Bus error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> A <link linkend="PolKitCaller"><type>PolKitCaller</type></link> object; the caller must use
<link linkend="polkit-caller-unref"><function>polkit_caller_unref()</function></link> on the object when done with it. Returns
<link linkend="NULL:CAPS"><type>NULL</type></link> if an error occured (in which case error will be set).

This function is in <literal>libpolkit-dbus</literal>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>
<refsect2 id="polkit-tracker-is-authorization-relevant" role="function" condition="since:0.7">
<title>polkit_tracker_is_authorization_relevant ()</title>
<indexterm zone="polkit-tracker-is-authorization-relevant" role="0.7"><primary>polkit_tracker_is_authorization_relevant</primary></indexterm><programlisting><link linkend="polkit-bool-t">polkit_bool_t</link>       polkit_tracker_is_authorization_relevant
                                                        (<link linkend="PolKitTracker">PolKitTracker</link> *pk_tracker,
                                                         <link linkend="PolKitAuthorization">PolKitAuthorization</link> *auth,
                                                         <link linkend="DBusError">DBusError</link> *error);</programlisting>
<para>
As explicit authorizations are scoped (process single shot,
process, session or everything), they become irrelevant once the
entity (process or session) ceases to exist. This function
determines whether the authorization is still relevant; it's useful
for reporting and graphical tools displaying authorizations.
</para>
<para>
This function is similar to <link linkend="polkit-is-authorization-relevant"><function>polkit_is_authorization_relevant()</function></link> only
that it avoids IPC overhead on the 2nd and subsequent calls when
checking authorizations scoped for a session.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>pk_tracker</parameter>&nbsp;:</term>
<listitem><simpara> the tracker
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>auth</parameter>&nbsp;:</term>
<listitem><simpara> authorization to check for
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>error</parameter>&nbsp;:</term>
<listitem><simpara> return location for error
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><type>TRUE</type></link> if the authorization still applies, <link linkend="FALSE:CAPS"><type>FALSE</type></link> if an
error occurred (then error will be set) or if the entity the
authorization refers to has gone out of scope.

This function is in <literal>libpolkit-dbus</literal>.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since  0.7
</para></refsect2>

</refsect1>




</refentry>