krb5-auth-dialog r128 - in trunk: . src



Author: guidog
Date: Sat Feb 28 17:47:53 2009
New Revision: 128
URL: http://svn.gnome.org/viewvc/krb5-auth-dialog?rev=128&view=rev

Log:
add dbus method to acquire kerberos tickets:

Added:
   trunk/src/krb5-auth-applet-dbus.xml
Modified:
   trunk/ChangeLog
   trunk/README
   trunk/src/Makefile.am
   trunk/src/krb5-auth-dbus.c
   trunk/src/krb5-auth-dbus.h
   trunk/src/krb5-auth-dialog.c

Modified: trunk/README
==============================================================================
--- trunk/README	(original)
+++ trunk/README	Sat Feb 28 17:47:53 2009
@@ -26,5 +26,14 @@
 strings that kerberos uses.  We are checking that in for now, until
 kerberos gets translated.
 
+Requesting a TGT via DBus:
+You can request a ticket granting ticket via DBus:
 
+ dbus-send --print-reply --type=method_call \
+              --dest=org.gnome.KrbAuthDialog \
+               /org/gnome/KrbAuthDialog \
+               org.gnome.KrbAuthDialog.acquireTgt \
+               string:'principal'
 
+If the sent principal doesn't match the one currently in the ticket cache the
+request fails. To request a TGT for the "default" principal use string:''.

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sat Feb 28 17:47:53 2009
@@ -39,6 +39,15 @@
 			@GLADE_LIBS@ \
 			@GTK_LIBS@
 
+BUILT_SOURCES = \
+	krb5-auth-applet-dbus-glue.h
+
+krb5-auth-applet-dbus-glue.h: $(srcdir)/krb5-auth-applet-dbus.xml
+	dbus-binding-tool                 \
+		--mode=glib-server        \
+		--prefix=krb5_auth_dialog \
+		$< > $@
+
 AM_CPPFLAGS = -I $(top_srcdir)/gtksecentry/ -I $(top_srcdir)/secmem/
 
 pkgdatadir = $(datadir)/krb5-auth-dialog
@@ -52,4 +61,6 @@
 	krb5-auth-dialog.1.in
 
 CLEANFILES = $(schema_DATA)
-DISTCLEANFILES = krb5-auth-dialog.desktop
+DISTCLEANFILES = \
+	krb5-auth-dialog.desktop 	\
+	krb5-auth-applet-dbus-glue.h

Added: trunk/src/krb5-auth-applet-dbus.xml
==============================================================================
--- (empty file)
+++ trunk/src/krb5-auth-applet-dbus.xml	Sat Feb 28 17:47:53 2009
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<node name="/org/gnome/KrbAuthDialog">
+  <interface name="org.gnome.KrbAuthDialog">
+    <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="KaApplet"/>
+    <method name="acquireTgt">
+      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="ka_dbus_acquire_tgt"/>
+      <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+      <arg type="s" name="principal" direction="in" />
+      <arg type="b" name="success" direction="out"/>
+    </method>
+  </interface>
+</node>
+

Modified: trunk/src/krb5-auth-dbus.c
==============================================================================
--- trunk/src/krb5-auth-dbus.c	(original)
+++ trunk/src/krb5-auth-dbus.c	Sat Feb 28 17:47:53 2009
@@ -23,13 +23,38 @@
 #include <dbus/dbus-glib.h>
 #include "krb5-auth-applet.h"
 #include "krb5-auth-dbus.h"
+#include "krb5-auth-applet-dbus-glue.h"
+
+static DBusGConnection *session;
+
+gboolean
+ka_dbus_acquire_tgt (KaApplet *applet,
+		     const gchar *principal, DBusGMethodInvocation *context)
+{
+       gboolean success;
+
+       KA_DEBUG("Getting TGT for '%s'", principal);
+       success = ka_check_credentials(applet, principal);
+       dbus_g_method_return(context, success);
+       return TRUE;
+}
+
+
+gboolean
+ka_dbus_service(KaApplet* applet)
+{
+	dbus_g_connection_register_g_object (session,
+				       "/org/gnome/KrbAuthDialog",
+				       G_OBJECT(applet));
+	return TRUE;
+}
+
 
 gboolean
 ka_dbus_connect(unsigned int* status)
 {
 	guint request_name_reply;
 	unsigned int flags;
-	DBusGConnection *session;
 	DBusGProxy *bus_proxy;
 	GError* error = NULL;
 
@@ -46,6 +71,9 @@
 					       "/org/freedesktop/DBus",
 					       "org.freedesktop.DBus");
 
+	dbus_g_object_type_install_info(KA_TYPE_APPLET,
+					&dbus_glib_krb5_auth_dialog_object_info);
+
 	if (!dbus_g_proxy_call (bus_proxy,
 				"RequestName",
 				&error,

Modified: trunk/src/krb5-auth-dbus.h
==============================================================================
--- trunk/src/krb5-auth-dbus.h	(original)
+++ trunk/src/krb5-auth-dbus.h	Sat Feb 28 17:47:53 2009
@@ -22,7 +22,14 @@
 #define KRB5_AUTH_DBUS_H
 
 #include <glib.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include "krb5-auth-applet.h"
 
 gboolean ka_dbus_connect(unsigned int* status);
+gboolean ka_dbus_service(KaApplet* applet);
+gboolean ka_dbus_acquire_tgt (KaApplet *applet,
+			      const gchar *principal,
+			      DBusGMethodInvocation *context);
 
 #endif /* KRB5_AUTH_DBUS_H */

Modified: trunk/src/krb5-auth-dialog.c
==============================================================================
--- trunk/src/krb5-auth-dialog.c	(original)
+++ trunk/src/krb5-auth-dialog.c	Sat Feb 28 17:47:53 2009
@@ -977,6 +977,7 @@
 		if (credentials_expiring ((gpointer)applet)) {
 			g_timeout_add_seconds (CREDENTIAL_CHECK_INTERVAL, (GSourceFunc)credentials_expiring, applet);
 		}
+		ka_dbus_service(applet);
 		gtk_main ();
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]