Add user tracking when claiming a device

Mark all the methods on the device as async, so we
can get access to the associated DBusGMethodInvocation.

When claiming the device, remember the sender, and for every
API entry point, check that the sender is the same as the one
that made the original claim.

Trying to enroll a user whilst the device is already claimed
from another program will fail with:
** ERROR **: failed to claim device: Device was already claimed

This is the first step towards PolicyKit and multi-user support
This commit is contained in:
Bastien Nocera
2008-05-16 17:24:45 +01:00
committed by Daniel Drake
parent 039c988f4b
commit 1748e5f484
4 changed files with 194 additions and 29 deletions

View File

@ -14,20 +14,24 @@
<method name="ListEnrolledFingers">
<arg type="au" name="enrolled_fingers" direction="out" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
<!-- FIXME make OO -->
<method name="LoadPrintData">
<arg type="u" name="finger_num" direction="in" />
<arg type="u" name="print_id" direction="out" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
<method name="UnloadPrintData">
<arg type="u" name="print_id" direction="in" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
<method name="VerifyStart">
<arg type="u" name="print_id" direction="in" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
<method name="VerifyStop">
@ -40,6 +44,7 @@
<method name="EnrollStart">
<arg type="u" name="finger_num" direction="in" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
<method name="EnrollStop">
@ -52,17 +57,20 @@
<method name="SetStorageType">
<arg type="u" name="storage_id" direction="in" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
<method name="ListEnrolledFingersFromStorage">
<arg type="s" name="username" direction="in" />
<arg type="au" name="enrolled_fingers" direction="out" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
<method name="LoadPrintDataFromStorage">
<arg type="u" name="finger_num" direction="in" />
<arg type="u" name="print_id" direction="out" />
<arg type="s" name="username" direction="in" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
</interface>