For the TrustAnchor dialog, CANCEL should be the default.
[moonshot-ui.git] / src / moonshot-webp-parser.vala
index efe53b5..de52aff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014, JANET(UK)
+ * Copyright (c) 2011-2016, JANET(UK)
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,10 +33,12 @@ using Moonshot;
 
 namespace WebProvisioning
 { 
-
+    private MoonshotLogger logger;
 
     public static int main(string[] args)
     {
+        logger = new MoonshotLogger("WebProvisioning (WebpParser)");
+
         int arg_index = -1;
         int force_flat_file_store = 0;
         bool bad_switch = false;
@@ -73,16 +75,26 @@ namespace WebProvisioning
     
         var webp = new Parser(webp_file);
         webp.parse();
-    
-        foreach (IdCard card in cards)
+        logger.trace(@"Have $(webp.cards.length) IdCards");
+        foreach (IdCard card in webp.cards)
         {
+
+            if (card == null) {
+                logger.trace(@"Skipping null IdCard");
+                continue;
+            }
+
             Moonshot.Error error;
             string[] rules_patterns = {};
             string[] rules_always_confirm = {};
         
             /* use temp arrays to workaround centos array property bug */
             var rules = card.rules;
-            var services = card.services;
+            string[] svcs = new string[card.services.size];
+            for (int i = 0; i < card.services.size; i++) {
+                svcs[i] = card.services[i];
+            }
+
             if (rules.length > 0)
             {
                 int i = 0;
@@ -96,13 +108,14 @@ namespace WebProvisioning
                 }
             }
 
+            logger.trace(@"Installing IdCard named '$(card.display_name)'");
             Moonshot.install_id_card(card.display_name,
                                      card.username,
                                      card.password,
                                      card.issuer,
                                      rules_patterns,
                                      rules_always_confirm,
-                                     services,
+                                     svcs,
                                      card.trust_anchor.ca_cert,
                                      card.trust_anchor.subject,
                                      card.trust_anchor.subject_alt,