Rename directory with handlers
authorJoachim Breitner <mail@joachim-breitner.de>
Fri, 8 Aug 2008 02:51:23 +0000 (02:51 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Fri, 8 Aug 2008 02:51:23 +0000 (02:51 +0000)
dummy/auth-dummy.py [deleted file]
dummy/pam-dbus-notification-daemon.py [deleted file]
handlers/auth-dummy.py [new file with mode: 0644]
handlers/pam-dbus-notification-daemon.py [new file with mode: 0644]

diff --git a/dummy/auth-dummy.py b/dummy/auth-dummy.py
deleted file mode 100644 (file)
index 6ecebc1..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/python
-
-import dbus.service
-import gobject
-
-from dbus.mainloop.glib import DBusGMainLoop
-
-
-
-class PamDbusAnswer(dbus.service.Object):
-    def __init__(self, bus_name, object_path="/de/nomeata/pam_dbus"):
-        dbus.service.Object.__init__(self, bus_name, object_path)
-
-    @dbus.service.method(dbus_interface='de.nomeata.pam_dbus',
-                         in_signature='ssss', out_signature='b')
-    def MayLogin(self, service, user, rhost, ruser):
-       print service, user, rhost, ruser
-       return True
-
-
-DBusGMainLoop(set_as_default=True)
-
-system_bus = dbus.SystemBus()
-name = dbus.service.BusName("de.nomeata.pam_dbus", bus=system_bus)
-object = PamDbusAnswer(name)
-
-mainloop = gobject.MainLoop()
-mainloop.run()
-
diff --git a/dummy/pam-dbus-notification-daemon.py b/dummy/pam-dbus-notification-daemon.py
deleted file mode 100644 (file)
index 7ff780a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/python
-
-import pygtk
-import gtk
-import gobject
-
-import dbus
-import dbus.service
-import dbus.glib
-
-import pynotify
-
-# list of Notifications around, kept to prevent the garbage collector to handle them.
-ns = []
-
-def notify_cb(n, action, pam_cb):
-    if pam_cb is not None:
-        if action == "permit":
-            pam_cb(True)
-        else:
-            pam_cb(False)
-        pam_cb = None
-    ns.remove(n)
-
-# Initializite pynotify
-if not pynotify.init("pam-dbus"):
-    sys.exit(1)
-
-# dbus object to answer the request
-class PamDbusAnswer(dbus.service.Object):
-     def __init__(self, bus_name, object_path="/de/nomeata/pam_dbus"):
-         dbus.service.Object.__init__(self, bus_name, object_path)
-     @dbus.service.method(dbus_interface='de.nomeata.pam_dbus',
-                          in_signature='ssss', out_signature='b',
-                          async_callbacks=('ret_cb', 'error_cb'))
-     def MayLogin(self, service, user, rhost, ruser, ret_cb, error_cb):
-
-         n = pynotify.Notification("Login request","Someone " + 
-                            ("named %s " % ruser if ruser else "") +
-                            "tries to log in via %s " % service + 
-                            ("from %s " % rhost if rhost else "") + 
-                            "as user %s. " % user + 
-                            "Do you want to allow that?")
-
-         n.set_timeout(5*60*1000)
-         n.add_action("permit", "Permit login", notify_cb, ret_cb)
-         n.add_action("deny", "Deny login", notify_cb,ret_cb)
-         n.connect("closed",lambda n: notify_cb(n,"closed", ret_cb))
-
-         if not n.show():
-             print "Failed to send notification"
-             sys.exit(1)
-
-         ns.append(n)
-system_bus = dbus.SystemBus()
-name = dbus.service.BusName("de.nomeata.pam_dbus", bus=system_bus)
-object = PamDbusAnswer(name)
-
-gtk.main()
-
diff --git a/handlers/auth-dummy.py b/handlers/auth-dummy.py
new file mode 100644 (file)
index 0000000..6ecebc1
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import dbus.service
+import gobject
+
+from dbus.mainloop.glib import DBusGMainLoop
+
+
+
+class PamDbusAnswer(dbus.service.Object):
+    def __init__(self, bus_name, object_path="/de/nomeata/pam_dbus"):
+        dbus.service.Object.__init__(self, bus_name, object_path)
+
+    @dbus.service.method(dbus_interface='de.nomeata.pam_dbus',
+                         in_signature='ssss', out_signature='b')
+    def MayLogin(self, service, user, rhost, ruser):
+       print service, user, rhost, ruser
+       return True
+
+
+DBusGMainLoop(set_as_default=True)
+
+system_bus = dbus.SystemBus()
+name = dbus.service.BusName("de.nomeata.pam_dbus", bus=system_bus)
+object = PamDbusAnswer(name)
+
+mainloop = gobject.MainLoop()
+mainloop.run()
+
diff --git a/handlers/pam-dbus-notification-daemon.py b/handlers/pam-dbus-notification-daemon.py
new file mode 100644 (file)
index 0000000..7ff780a
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+
+import pygtk
+import gtk
+import gobject
+
+import dbus
+import dbus.service
+import dbus.glib
+
+import pynotify
+
+# list of Notifications around, kept to prevent the garbage collector to handle them.
+ns = []
+
+def notify_cb(n, action, pam_cb):
+    if pam_cb is not None:
+        if action == "permit":
+            pam_cb(True)
+        else:
+            pam_cb(False)
+        pam_cb = None
+    ns.remove(n)
+
+# Initializite pynotify
+if not pynotify.init("pam-dbus"):
+    sys.exit(1)
+
+# dbus object to answer the request
+class PamDbusAnswer(dbus.service.Object):
+     def __init__(self, bus_name, object_path="/de/nomeata/pam_dbus"):
+         dbus.service.Object.__init__(self, bus_name, object_path)
+     @dbus.service.method(dbus_interface='de.nomeata.pam_dbus',
+                          in_signature='ssss', out_signature='b',
+                          async_callbacks=('ret_cb', 'error_cb'))
+     def MayLogin(self, service, user, rhost, ruser, ret_cb, error_cb):
+
+         n = pynotify.Notification("Login request","Someone " + 
+                            ("named %s " % ruser if ruser else "") +
+                            "tries to log in via %s " % service + 
+                            ("from %s " % rhost if rhost else "") + 
+                            "as user %s. " % user + 
+                            "Do you want to allow that?")
+
+         n.set_timeout(5*60*1000)
+         n.add_action("permit", "Permit login", notify_cb, ret_cb)
+         n.add_action("deny", "Deny login", notify_cb,ret_cb)
+         n.connect("closed",lambda n: notify_cb(n,"closed", ret_cb))
+
+         if not n.show():
+             print "Failed to send notification"
+             sys.exit(1)
+
+         ns.append(n)
+system_bus = dbus.SystemBus()
+name = dbus.service.BusName("de.nomeata.pam_dbus", bus=system_bus)
+object = PamDbusAnswer(name)
+
+gtk.main()
+