match.append_string(keyring_store_attribute, keyring_store_version);
GLib.List<GnomeKeyring.Found> items;
GnomeKeyring.find_items_sync(item_type, match, out items);
- items.foreach((entry) => {
+ foreach(unowned GnomeKeyring.Found entry in items) {
GnomeKeyring.Result result = GnomeKeyring.item_delete_sync(null, entry.item_id);
if (result != GnomeKeyring.Result.OK) {
stdout.printf("GnomeKeyring.item_delete_sync() failed. result: %d", result);
}
- });
+ }
}
private void load_id_cards() {
match.append_string(keyring_store_attribute, keyring_store_version);
GLib.List<GnomeKeyring.Found> items;
GnomeKeyring.find_items_sync(item_type, match, out items);
- items.foreach((entry) => {
+ foreach(unowned GnomeKeyring.Found entry in items) {
IdCard id_card = new IdCard ();
int i;
int rules_patterns_index = -1;
int rules_always_confirm_index = -1;
+ string store_password = null;
for (i=0; i<entry.attributes.len; i++) {
- var attribute = entry.attributes.data[i];
+ var attribute = ((GnomeKeyring.Attribute *) entry.attributes.data[i]);
string value = attribute.string_value;
if (attribute.name == "Issuer") {
id_card.issuer = value;
id_card.trust_anchor.subject = value;
} else if (attribute.name == "Subject-Alt") {
id_card.trust_anchor.subject_alt = value;
+ } else if (attribute.name == "StorePassword") {
+ store_password = value;
}
}
if ((rules_always_confirm_index != -1) && (rules_patterns_index != -1)) {
- string rules_patterns_all = entry.attributes.data[rules_patterns_index].string_value;
- string rules_always_confirm_all = entry.attributes.data[rules_always_confirm_index].string_value;
+ string rules_patterns_all = ((GnomeKeyring.Attribute *) entry.attributes.data[rules_patterns_index]) .string_value;
+ string rules_always_confirm_all = ((GnomeKeyring.Attribute *) entry.attributes.data[rules_always_confirm_index]) .string_value;
string [] rules_always_confirm = rules_always_confirm_all.split(";");
string [] rules_patterns = rules_patterns_all.split(";");
if (rules_patterns.length == rules_always_confirm.length) {
id_card.rules = rules;
}
}
- id_card.password = entry.secret;
+
+ if (store_password != null)
+ id_card.store_password = (store_password == "yes");
+ else
+ id_card.store_password = ((entry.secret != null) && (entry.secret != ""));
+
+ if (id_card.store_password)
+ id_card.password = entry.secret;
+ else
+ id_card.password = null;
id_card_list.add(id_card);
- });
+ }
}
public void store_id_cards () {
attributes.append_string("Server-Cert", id_card.trust_anchor.server_cert);
attributes.append_string("Subject", id_card.trust_anchor.subject);
attributes.append_string("Subject-Alt", id_card.trust_anchor.subject_alt);
+ attributes.append_string("StorePassword", id_card.store_password ? "yes" : "no");
GnomeKeyring.Result result = GnomeKeyring.item_create_sync(null,
- item_type, id_card.display_name,
- attributes, id_card.password, true, out item_id);
+ item_type, id_card.display_name, attributes,
+ id_card.store_password ? id_card.password : "",
+ true, out item_id);
if (result != GnomeKeyring.Result.OK) {
stdout.printf("GnomeKeyring.item_create_sync() failed. result: %d", result);
}