--- /dev/null
+stamp-h1\r
+*.stamp\r
+*.exe\r
+*.o\r
+.deps\r
+.dirstamp\r
+po/stamp-po\r
+po/remove-potcdate.*\r
+po/moonshot.pot\r
+po/insert-header.sin\r
+po/*.header\r
+po/*.sed\r
+po/[Rr]ules-quot\r
+po/POTFILES\r
+Makefile.in\r
+Makefile\r
+po/Makevars.template\r
+configure\r
+config.h*\r
+config.log\r
+config.status\r
+build-aux\r
+autom4te.cache\r
+aclocal.m4\r
+ABOUT-NLS\r
+src/moonshot-add-dialog.c\r
+src/moonshot-custom-vbox.c\r
+src/moonshot-id.c\r
+src/moonshot-idcard-widget.c\r
+src/moonshot-identity-request.c\r
+src/moonshot-identities-manager.c\r
+src/moonshot-msrpc.h\r
+src/moonshot-msrpc_c.c\r
+src/moonshot-msrpc_s.c\r
+src/moonshot-password-dialog.c\r
+src/moonshot-server.c\r
+src/moonshot-utils.c\r
+src/moonshot-window.c\r
+src/msrpc-client.c\r
+src/dbus-client\r
+src/dbus-client.c\r
+src/moonshot\r
+m4/codeset.m4\r
+m4/gettext.m4\r
+m4/glibc2.m4\r
+m4/glibc21.m4\r
+m4/iconv.m4\r
+m4/intdiv0.m4\r
+m4/intl.m4\r
+m4/intldir.m4\r
+m4/intlmacosx.m4\r
+m4/intmax.m4\r
+m4/inttypes-pri.m4\r
+m4/inttypes_h.m4\r
+m4/lcmessage.m4\r
+m4/lib-ld.m4\r
+m4/lib-link.m4\r
+m4/lib-prefix.m4\r
+m4/lock.m4\r
+m4/longlong.m4\r
+m4/nls.m4\r
+m4/po.m4\r
+m4/printf-posix.m4\r
+m4/progtest.m4\r
+m4/size_max.m4\r
+m4/stdint_h.m4\r
+m4/uintmax_t.m4\r
+m4/visibility.m4\r
+m4/wchar_t.m4\r
+m4/wint_t.m4\r
+m4/xsize.m4\r
+moonshot.msi\r
+moonshot.wixpdb\r
+po/Makefile.in.in\r
+app.wixobj\r
+org.janet.Moonshot.service\r
src/moonshot-custom-vbox.vala \
src/moonshot-identities-manager.vala \
src/moonshot-identity-request.vala \
+ src/moonshot-server.vala \
src/moonshot-window.vala \
src/moonshot-password-dialog.vala \
src/moonshot-utils.vala
--pkg msrpc-1.0 \
--define=IPC_MSRPC
-noinst_HEADERS = src/moonshot-msrpc.h
-
src_moonshot_SOURCES += \
- src/moonshot-msrpc-server.vala \
- src/moonshot-msrpc_s.c \
src/moonshot-msrpc.vapi
+nodist_src_moonshot_SOURCES = \
+ src/moonshot-msrpc_s.c
+
bin_PROGRAMS += src/msrpc-client
-src_msrpc_client_SOURCES = \
+nodist_src_msrpc_client_SOURCES = \
src/msrpc-client.vala \
- src/moonshot-msrpc_c.c \
- src/moonshot-msrpc.vapi
+ src/moonshot-msrpc.vapi \
+ src/moonshot-msrpc_c.c
src_msrpc_client_LDADD = \
$(moonshot_LIBS)
src/moonshot-msrpc_s.c: src/moonshot-msrpc.h
-else
+endif
-# IPC_DBUS
+if IPC_DBUS
# DBus service file
dbusservicedir = $(datadir)/dbus-1/services
--pkg dbus-glib-1 \
--define=IPC_DBUS
-src_moonshot_SOURCES += src/moonshot-dbus-server.vala
-
bin_PROGRAMS += src/dbus-client
src_dbus_client_SOURCES = \
+++ /dev/null
-[DBus (name = "org.janet.Moonshot")]
-public class MoonshotServer : Object {
-
- private MainWindow main_window;
-
- public MoonshotServer (Gtk.Window window)
- {
- this.main_window = (MainWindow) window;
- }
-
- /**
- * This is the function used by the GSS mechanism to get the NAI,
- * password and certificate of the ID card for the specificated service.
- *
- * The function will block until the user choose the ID card.
- *
- * @param nai NAI of the ID Card (optional)
- * @param password Password of the ID Card (optional)
- * @param service Service application request an ID Card for
- * @param nai_out NAI stored in the ID Card
- * @param password_out Password stored in the ID Card
- * @param certificate Certificate stored in th ID Card
- *
- * @return true if the user choose a correct ID card for that service,
- * false otherwise.
- */
- public async bool get_identity (string nai,
- string password,
- string service,
- out string nai_out,
- out string password_out,
- out string certificate_out)
- {
- bool has_service = false;
-
- var request = new IdentityRequest (main_window,
- nai,
- password,
- service);
- request.set_callback ((IdentityRequest) => get_identity.callback());
- request.execute ();
- yield;
-
- nai_out = "";
- password_out = "";
- certificate_out = "";
-
- var id_card = request.id_card;
-
- if (id_card != null) {
- foreach (string id_card_service in id_card.services)
- {
- if (id_card_service == service)
- has_service = true;
- }
-
- if (has_service)
- {
- nai_out = id_card.nai;
- password_out = id_card.password;
- certificate_out = "certificate";
-
- return true;
- }
- }
-
- return false;
- }
-}
+++ /dev/null
-using Rpc;
-using MoonshotRpcInterface;
-
-/* This class must be a singleton, because we use a global RPC
- * binding handle. I cannot picture a situation where more than
- * one instance of the same interface would be needed so this
- * shouldn't be a problem.
- *
- * Shutdown is automatically done by the RPC runtime when the
- * process ends
- */
-public class MoonshotServer : Object {
- private static MainWindow main_window;
-
- private static MoonshotServer instance = null;
-
- public static void start (Gtk.Window window)
- {
- main_window = (MainWindow) window;
- Rpc.server_start (MoonshotRpcInterface.spec, "/org/janet/Moonshot", Rpc.Flags.PER_USER);
- }
-
- public static MoonshotServer get_instance ()
- {
- if (instance == null)
- instance = new MoonshotServer ();
- return instance;
- }
-
- [CCode (cname = "moonshot_get_identity")]
- public static void moonshot_get_identity (Rpc.AsyncCall call,
- string nai,
- string password,
- string service,
- ref string nai_out,
- ref string password_out,
- ref string certificate_out)
- {
- bool result = false;
-
- var request = new IdentityRequest (main_window,
- nai,
- password,
- service);
-
- // Pass execution to the main loop and block the RPC thread
- request.mutex = new Mutex ();
- request.cond = new Cond ();
- request.set_callback (return_identity_cb);
-
- request.mutex.lock ();
- Idle.add (request.execute);
-
- while (request.complete == false)
- request.cond.wait (request.mutex);
-
- nai_out = "";
- password_out = "";
- certificate_out = "";
-
- var id_card = request.id_card;
- bool has_service = false;
-
- if (id_card == null) {
- foreach (string id_card_service in id_card.services)
- {
- if (id_card_service == service)
- has_service = true;
- }
-
- if (has_service)
- {
- // The strings are freed by the RPC runtime
- nai_out = id_card.nai;
- password_out = id_card.password;
- certificate_out = "certificate";
-
- result = true;
- }
- }
-
- // The outputs must be set before this function is called. For this
- // reason they are 'ref' not 'out' parameters - Vala assigns to the
- // 'out' parameters only at the end of the function, which is too
- // late.
- call.return (&result);
-
- request.cond.signal ();
- request.mutex.unlock ();
- }
-
- // Called from the main loop thread when an identity has
- // been selected
- static void return_identity_cb (IdentityRequest request) {
- // Notify the RPC thread that the request is complete
- request.mutex.lock ();
- request.cond.signal ();
-
- // Block the main loop until the RPC call has returned
- // to avoid any races
- request.cond.wait (request.mutex);
- request.mutex.unlock ();
- }
-}
--- /dev/null
+#if IPC_DBUS
+
+[DBus (name = "org.janet.Moonshot")]
+public class MoonshotServer : Object {
+
+ private MainWindow main_window;
+
+ public MoonshotServer (Gtk.Window window)
+ {
+ this.main_window = (MainWindow) window;
+ }
+
+ /**
+ * This is the function used by the GSS mechanism to get the NAI,
+ * password and certificate of the ID card for the specificated service.
+ *
+ * The function will block until the user choose the ID card.
+ *
+ * @param nai NAI of the ID Card (optional)
+ * @param password Password of the ID Card (optional)
+ * @param service Service application request an ID Card for
+ * @param nai_out NAI stored in the ID Card
+ * @param password_out Password stored in the ID Card
+ * @param certificate Certificate stored in th ID Card
+ *
+ * @return true if the user choose a correct ID card for that service,
+ * false otherwise.
+ */
+ public async bool get_identity (string nai,
+ string password,
+ string service,
+ out string nai_out,
+ out string password_out,
+ out string certificate_out)
+ {
+ bool has_service = false;
+
+ var request = new IdentityRequest (main_window,
+ nai,
+ password,
+ service);
+ request.set_callback ((IdentityRequest) => get_identity.callback());
+ request.execute ();
+ yield;
+
+ nai_out = "";
+ password_out = "";
+ certificate_out = "";
+
+ var id_card = request.id_card;
+
+ if (id_card != null) {
+ foreach (string id_card_service in id_card.services)
+ {
+ if (id_card_service == service)
+ has_service = true;
+ }
+
+ if (has_service)
+ {
+ nai_out = id_card.nai;
+ password_out = id_card.password;
+ certificate_out = "certificate";
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
+
+#elif IPC_MSRPC
+
+using Rpc;
+using MoonshotRpcInterface;
+
+/* This class must be a singleton, because we use a global RPC
+ * binding handle. I cannot picture a situation where more than
+ * one instance of the same interface would be needed so this
+ * shouldn't be a problem.
+ *
+ * Shutdown is automatically done by the RPC runtime when the
+ * process ends
+ */
+public class MoonshotServer : Object {
+ private static MainWindow main_window;
+
+ private static MoonshotServer instance = null;
+
+ public static void start (Gtk.Window window)
+ {
+ main_window = (MainWindow) window;
+ Rpc.server_start (MoonshotRpcInterface.spec, "/org/janet/Moonshot", Rpc.Flags.PER_USER);
+ }
+
+ public static MoonshotServer get_instance ()
+ {
+ if (instance == null)
+ instance = new MoonshotServer ();
+ return instance;
+ }
+
+ [CCode (cname = "moonshot_get_identity")]
+ public static void moonshot_get_identity (Rpc.AsyncCall call,
+ string nai,
+ string password,
+ string service,
+ ref string nai_out,
+ ref string password_out,
+ ref string certificate_out)
+ {
+ bool result = false;
+
+ var request = new IdentityRequest (main_window,
+ nai,
+ password,
+ service);
+
+ // Pass execution to the main loop and block the RPC thread
+ request.mutex = new Mutex ();
+ request.cond = new Cond ();
+ request.set_callback (return_identity_cb);
+
+ request.mutex.lock ();
+ Idle.add (request.execute);
+
+ while (request.complete == false)
+ request.cond.wait (request.mutex);
+
+ nai_out = "";
+ password_out = "";
+ certificate_out = "";
+
+ var id_card = request.id_card;
+ bool has_service = false;
+
+ if (id_card == null) {
+ foreach (string id_card_service in id_card.services)
+ {
+ if (id_card_service == service)
+ has_service = true;
+ }
+
+ if (has_service)
+ {
+ // The strings are freed by the RPC runtime
+ nai_out = id_card.nai;
+ password_out = id_card.password;
+ certificate_out = "certificate";
+
+ result = true;
+ }
+ }
+
+ // The outputs must be set before this function is called. For this
+ // reason they are 'ref' not 'out' parameters - Vala assigns to the
+ // 'out' parameters only at the end of the function, which is too
+ // late.
+ call.return (&result);
+
+ request.cond.signal ();
+ request.mutex.unlock ();
+ }
+
+ [CCode (cname = "moonshot_get_default_identity")]
+ public static void get_default_identity (Rpc.AsyncCall call,
+ ref string nai_out,
+ ref string password_out)
+ {
+ bool result = false;
+
+ var request = new IdentityRequest.default (main_window);
+
+ // This is really a lot of work to get a default identity.
+ // However, it's really best to do so in the main loop to avoid
+ // races (the alternative is add a mutex to the ID card data,
+ // but this is the only place it would be used).
+ request.mutex = new Mutex ();
+ request.cond = new Cond ();
+ request.set_callback (return_identity_cb);
+
+ request.mutex.lock ();
+ Idle.add (request.execute);
+
+ while (request.complete == false)
+ request.cond.wait (request.mutex);
+
+ nai_out = "";
+ password_out = "";
+ certificate_out = "";
+
+ var id_card = request.id_card;
+ bool has_service = false;
+
+ if (id_card == null) {
+ foreach (string id_card_service in id_card.services)
+ {
+ if (id_card_service == service)
+ has_service = true;
+ }
+
+ if (has_service)
+ {
+ // The strings are freed by the RPC runtime
+ nai_out = id_card.nai;
+ password_out = id_card.password;
+ certificate_out = "certificate";
+
+ result = true;
+ }
+ }
+
+ // The outputs must be set before this function is called. For this
+ // reason they are 'ref' not 'out' parameters - Vala assigns to the
+ // 'out' parameters only at the end of the function, which is too
+ // late.
+ call.return (&result);
+
+ request.cond.signal ();
+ request.mutex.unlock ();
+ }
+
+ // Called from the main loop thread when an identity has
+ // been selected
+ static void return_identity_cb (IdentityRequest request) {
+ // Notify the RPC thread that the request is complete
+ request.mutex.lock ();
+ request.cond.signal ();
+
+ // Block the main loop until the RPC call has returned
+ // to avoid any races
+ request.cond.wait (request.mutex);
+ request.mutex.unlock ();
+ }
+}
+
+#endif