Changes for building on Centos 6
authorDan Breslau <dbreslau@painless-security.com>
Wed, 2 Aug 2017 02:31:22 +0000 (03:31 +0100)
committerDan Breslau <dbreslau@painless-security.com>
Wed, 2 Aug 2017 02:32:41 +0000 (03:32 +0100)
configure.ac
moonshot-ui.spec.in
src/moonshot-id.vala
src/moonshot-identity-dialog.vala
src/moonshot-identity-management-view.vala
src/moonshot-identity-manager-app.vala
src/moonshot-settings.vala
src/moonshot-trust-anchor-dialog.vala
src/moonshot-utils.vala

index 184918f..d61aa0a 100644 (file)
@@ -1,6 +1,6 @@
 AC_PREREQ([2.63])
 AC_INIT([Moonshot-ui],
-        [1.0.3],
+        [1.0.4],
         [moonshot-community@jiscmail.ac.uk],
         [moonshot-ui],
         [http://www.project-moonshot.org/])
index c2104d9..7d0a243 100644 (file)
@@ -1,6 +1,6 @@
 Name:           @PACKAGE@
 Version:        @VERSION@
-Release:        2%{?dist}
+Release:        1%{?dist}
 Summary:        Moonshot Federated Identity User Interface
 
 Group:          Security Tools
index 513b993..5c64933 100644 (file)
@@ -175,7 +175,7 @@ openssl to produce this format.  Alternatively, base64 encode a DER format certi
         cert.chomp();
 
         uchar[] binary = Base64.decode(cert);
-        IdCard.logger.trace("get_expiration_date: encoded length=%d; decoded length=%d".printf(cert.length, binary.length));
+        IdCard.logger.trace("get_expiration_date: encoded length=%ld; decoded length=%d".printf(cert.length, binary.length));
 
         char buf[64];
         string err = (string) get_cert_valid_before(binary, binary.length, buf, 64);
index 6f59f2f..b1cbe2f 100644 (file)
@@ -537,8 +537,10 @@ class IdentityDialog : Dialog
         {
             // Export the certificate in PEM format.
 
-            const string CERT_HEADER = "-----BEGIN CERTIFICATE-----\n";
-            const string CERT_FOOTER = "\n-----END CERTIFICATE-----\n";
+            // const string CERT_HEADER = "-----BEGIN CERTIFICATE-----\n";
+            // const string CERT_FOOTER = "\n-----END CERTIFICATE-----\n";
+            string CERT_HEADER = "-----BEGIN CERTIFICATE-----\n";
+            string CERT_FOOTER = "\n-----END CERTIFICATE-----\n";
 
             // Strip any embedded newlines in the certificate...
             string cert = id.trust_anchor.ca_cert.replace("\n", "");
@@ -558,8 +560,12 @@ class IdentityDialog : Dialog
             string filename = dialog.get_filename();
             var file  = File.new_for_path(filename);
             var stream = file.replace(null, false, FileCreateFlags.PRIVATE);
+#if VALA_0_12
+           // Not sure if this works in 12; it definitely doesn't work in 10.
             stream.write(newcert.data);
-
+#else
+            stream.write(newcert.data, newcert.length);
+#endif
             // Save the parent directory to use as default for next save
             export_directory = file.get_parent().get_path();
         }
index f46ba26..d1c35bb 100644 (file)
@@ -277,11 +277,11 @@ public class IdentityManagerView : Window {
                        Columns.PASSWORD_COL, id_card.password);
     }
 
-    private IdCardWidget add_id_card_widget(IdCard id_card)
+    private void add_id_card_widget(IdCard id_card)
     {
         if (id_card == null) {
             logger.trace("add_id_card_widget: id_card == null; returning.");
-            return null;
+            return;
         }
 
         logger.trace("add_id_card_widget: id_card.nai='%s'; selected nai='%s'"
@@ -308,7 +308,6 @@ public class IdentityManagerView : Window {
             // at preventing duplicate NAIs.
             this.selected_card = id_card;
         }
-        return id_card_widget;
     }
 
     private void widget_selected_cb(IdCardWidget id_card_widget)
index 350b68e..ed4ae98 100644 (file)
@@ -271,8 +271,9 @@ public class IdentityManagerApp {
     }
 #elif IPC_DBUS_GLIB
     private void init_ipc_server() {
+        DBus.Connection? conn = null;
         try {
-            var conn = DBus.Bus.get(DBus.BusType.SESSION);
+            conn = DBus.Bus.get(DBus.BusType.SESSION);
             dynamic DBus.Object bus = conn.get_object("org.freedesktop.DBus",
                                                       "/org/freedesktop/DBus",
                                                       "org.freedesktop.DBus");
@@ -354,7 +355,7 @@ public class IdentityManagerApp {
     private void init_ipc_server() {
         this.ipc_server = new MoonshotServer(this);
         bool shown = false;
-       var our_name = "org.janet.Moonshot";
+        var our_name = "org.janet.Moonshot";
         GLib.Bus.own_name(GLib.BusType.SESSION,
                           our_name,
                           GLib.BusNameOwnerFlags.NONE,
@@ -363,7 +364,7 @@ public class IdentityManagerApp {
                           // Name acquired callback:
                           (conn, name) => {
                               logger.trace(@"init_ipc_server: name_acquired_closure; show_requested=$show_requested; conn="
-                             + (conn==null?"null":"non-null; name='" + name + "'"));
+                              + (conn==null?"null":"non-null; name='" + name + "'"));
 
                               name_is_owned = true;
 
index 4dea622..b1c272a 100644 (file)
@@ -72,13 +72,13 @@ private void save_keyfile(KeyFile key_file)
     File dest = null;
 
     // Make the directory if it doesn't already exist; ignore errors.
-       try {
-               File dir = File.new_for_path(config_dir);
+    try {
+        File dir = File.new_for_path(config_dir);
         dest = dir.get_child(KEY_FILE_NAME);
-               dir.make_directory_with_parents();
-       } catch (Error e) {
+        dir.make_directory_with_parents();
+    } catch (Error e) {
         logger().trace("save_keyfile: make_directory_with_parents threw error (this is usually ignorable) : " + e.message);
-       }
+    }
 
     // It would be nice to use key_file.save_to_file, but the binding doesn't exist
     // in earlier versions of valac
@@ -91,7 +91,7 @@ private void save_keyfile(KeyFile key_file)
         // var ds = new DataOutputStream(s);
         // ds.put_string(data);
         string new_etag;
-        dest.replace_contents(data.data, null, false, FileCreateFlags.REPLACE_DESTINATION | FileCreateFlags.PRIVATE, out new_etag);
+        dest.replace_contents(data, data.length, null, false, FileCreateFlags.REPLACE_DESTINATION | FileCreateFlags.PRIVATE, out new_etag);
     }
     catch(Error e) {
         logger().error("save_keyfile: error when writing to file: " + e.message);
index 89ea6fc..a489303 100644 (file)
@@ -57,11 +57,11 @@ public class TrustAnchorConfirmationRequest : GLib.Object {
 
     public void set_callback(owned TrustAnchorConfirmationCallback cb)
     {
-//        #if VALA_0_12
+#if VALA_0_12
             this.callback = ((owned) cb);
-//        #else
-//            this.callback = ((IdCard) => cb(IdCard));
-//        #endif
+#else
+            this.callback = ((IdCard) => cb(IdCard));
+#endif
     }
 
     public bool execute() {
index 7652469..a389c7a 100644 (file)
@@ -185,10 +185,20 @@ internal static void clear_password_entry(Entry entry) {
     random_chars[len] = 0;
     string r = (string) random_chars;
     var buf = entry.get_buffer();
+#if VALA_0_12
+    // Not sure if this works in 12; it definitely doesn't work in 10.
     buf.set_text(r.data);
 
     // Now delete the data
     buf.delete_text(0, len);
+#else
+    string[] a = new string[1];
+    a[0] = r;
+    buf.set_text(a);
+
+    // Now delete the data
+    buf.delete_text(0, (int) len);
+#endif
 }
 
 static Gdk.Color white;