Dummy pythoon request replier
[darcs-mirror-pam-dbus.git] / dummy / auth-dummy.py
1 #!/usr/bin/python
2
3 import dbus.service
4 import gobject
5
6 from dbus.mainloop.glib import DBusGMainLoop
7
8
9
10 class PamDbusAnswer(dbus.service.Object):
11     def __init__(self, bus_name, object_path="/de/nomeata/pam_dbus"):
12         dbus.service.Object.__init__(self, bus_name, object_path)
13
14     @dbus.service.method(dbus_interface='de.nomeata.pam_dbus',
15                          in_signature='ssss', out_signature='b')
16     def MayLogin(self, service, user, rhost, ruser):
17         print service, user, rhost, ruser
18         return True
19
20
21 DBusGMainLoop(set_as_default=True)
22
23 system_bus = dbus.SystemBus()
24 name = dbus.service.BusName("de.nomeata.pam_dbus", bus=system_bus)
25 object = PamDbusAnswer(name)
26
27 mainloop = gobject.MainLoop()
28 mainloop.run()
29