diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-11-10 11:40:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-11-11 04:54:43 +0800 |
commit | 2c4ae5e7685c462f8d464448e4617b8dea029e72 (patch) | |
tree | c34f0cbb7c500ff70f10fce846631b0a948b341c /smime | |
parent | 583da46b8caf4b2a8b548b03c38fe0e84164abfb (diff) | |
download | gsoc2013-evolution-2c4ae5e7685c462f8d464448e4617b8dea029e72.tar.gz gsoc2013-evolution-2c4ae5e7685c462f8d464448e4617b8dea029e72.tar.zst gsoc2013-evolution-2c4ae5e7685c462f8d464448e4617b8dea029e72.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'smime')
-rw-r--r-- | smime/gui/cert-trust-dialog.c | 44 | ||||
-rw-r--r-- | smime/gui/certificate-manager.c | 98 | ||||
-rw-r--r-- | smime/gui/certificate-viewer.c | 93 | ||||
-rw-r--r-- | smime/gui/e-cert-selector.c | 3 | ||||
-rw-r--r-- | smime/lib/e-cert-db.c | 187 | ||||
-rw-r--r-- | smime/lib/e-cert.c | 14 | ||||
-rw-r--r-- | smime/lib/e-pkcs12.c | 27 |
7 files changed, 264 insertions, 202 deletions
diff --git a/smime/gui/cert-trust-dialog.c b/smime/gui/cert-trust-dialog.c index 3a52b82657..366a79748e 100644 --- a/smime/gui/cert-trust-dialog.c +++ b/smime/gui/cert-trust-dialog.c @@ -72,9 +72,10 @@ ctd_response (GtkWidget *w, icert = e_cert_get_internal_cert (data->cert); e_cert_trust_init (&trust); e_cert_trust_set_valid_peer (&trust); - e_cert_trust_add_peer_trust (&trust, FALSE, - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->trust_button)), - FALSE); + e_cert_trust_add_peer_trust ( + &trust, FALSE, + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->trust_button)), + FALSE); e_cert_db_change_cert_trust (icert, &trust); break; case GTK_RESPONSE_ACCEPT: { @@ -85,23 +86,26 @@ ctd_response (GtkWidget *w, g_signal_stop_emission_by_name (w, "response"); - ca_trust_dialog_set_trust (dialog, - e_cert_trust_has_trusted_ca (icert->trust, TRUE, FALSE, FALSE), - e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE), - e_cert_trust_has_trusted_ca (icert->trust, FALSE, FALSE, TRUE)); + ca_trust_dialog_set_trust ( + dialog, + e_cert_trust_has_trusted_ca (icert->trust, TRUE, FALSE, FALSE), + e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE), + e_cert_trust_has_trusted_ca (icert->trust, FALSE, FALSE, TRUE)); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { gboolean trust_ssl, trust_email, trust_objsign; - ca_trust_dialog_get_trust (dialog, - &trust_ssl, &trust_email, &trust_objsign); + ca_trust_dialog_get_trust ( + dialog, + &trust_ssl, &trust_email, &trust_objsign); e_cert_trust_init (&trust); e_cert_trust_set_valid_ca (&trust); - e_cert_trust_add_ca_trust (&trust, - trust_ssl, - trust_email, - trust_objsign); + e_cert_trust_add_ca_trust ( + &trust, + trust_ssl, + trust_email, + trust_objsign); e_cert_db_change_cert_trust (icert, &trust); } @@ -144,13 +148,15 @@ cert_trust_dialog_show (ECert *cert) icert = e_cert_get_internal_cert (ctd_data->cacert); if (e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE)) - gtk_label_set_text ((GtkLabel *) ctd_data->label, - _("Because you trust the certificate authority that issued this certificate, " - "then you trust the authenticity of this certificate unless otherwise indicated here")); + gtk_label_set_text ( + (GtkLabel *) ctd_data->label, + _("Because you trust the certificate authority that issued this certificate, " + "then you trust the authenticity of this certificate unless otherwise indicated here")); else - gtk_label_set_text ((GtkLabel *) ctd_data->label, - _("Because you do not trust the certificate authority that issued this certificate, " - "then you do not trust the authenticity of this certificate unless otherwise indicated here")); + gtk_label_set_text ( + (GtkLabel *) ctd_data->label, + _("Because you do not trust the certificate authority that issued this certificate, " + "then you do not trust the authenticity of this certificate unless otherwise indicated here")); return ctd_data->dialog; } diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index 3f8648feee..acddc8a974 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -297,7 +297,8 @@ load_treeview_state (GtkTreeView *treeview) } sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (treeview)); - gtk_tree_sortable_set_sort_column_id (sortable, + gtk_tree_sortable_set_sort_column_id ( + sortable, g_key_file_get_integer (keyfile, tree_name, "sort-column", 0), g_key_file_get_integer (keyfile, tree_name, "sort-order", GTK_SORT_ASCENDING)); @@ -313,8 +314,10 @@ report_and_free_error (CertPage *cp, { g_return_if_fail (cp != NULL); - e_notice (gtk_widget_get_toplevel (GTK_WIDGET (cp->treeview)), - GTK_MESSAGE_ERROR, "%s: %s", where, error ? error->message : _("Unknown error")); + e_notice ( + gtk_widget_get_toplevel (GTK_WIDGET (cp->treeview)), + GTK_MESSAGE_ERROR, "%s: %s", where, + error ? error->message : _("Unknown error")); if (error) g_error_free (error); @@ -342,7 +345,8 @@ header_popup_item_toggled (GtkCheckMenuItem *item, { GtkTreeViewColumn *column = user_data; - gtk_tree_view_column_set_visible (column, + gtk_tree_view_column_set_visible ( + column, gtk_check_menu_item_get_active (item)); } @@ -353,7 +357,8 @@ treeview_column_visibility_changed (GtkTreeViewColumn *column, { GtkCheckMenuItem *menu_item = user_data; - gtk_check_menu_item_set_active (menu_item, + gtk_check_menu_item_set_active ( + menu_item, gtk_tree_view_column_get_visible (column)); } @@ -369,9 +374,10 @@ treeview_selection_changed (GtkTreeSelection *selection, if (gtk_tree_selection_get_selected (selection, &model, &iter)) { ECert *cert; - gtk_tree_model_get (model, &iter, - cp->columns_count - 1, &cert, - -1); + gtk_tree_model_get ( + model, &iter, + cp->columns_count - 1, &cert, + -1); if (cert) { cert_selected = TRUE; @@ -508,9 +514,10 @@ view_cert (GtkWidget *button, if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (cp->treeview), NULL, &iter)) { ECert *cert; - gtk_tree_model_get (GTK_TREE_MODEL (cp->streemodel), &iter, - cp->columns_count - 1, &cert, - -1); + gtk_tree_model_get ( + GTK_TREE_MODEL (cp->streemodel), &iter, + cp->columns_count - 1, &cert, + -1); if (cert) { GtkWidget *dialog = certificate_viewer_show (cert); @@ -532,9 +539,10 @@ edit_cert (GtkWidget *button, if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (cp->treeview), NULL, &iter)) { ECert *cert; - gtk_tree_model_get (GTK_TREE_MODEL (cp->streemodel), &iter, - cp->columns_count - 1, &cert, - -1); + gtk_tree_model_get ( + GTK_TREE_MODEL (cp->streemodel), &iter, + cp->columns_count - 1, &cert, + -1); if (cert) { GtkWidget *dialog; @@ -543,10 +551,11 @@ edit_cert (GtkWidget *button, switch (cp->cert_type) { case E_CERT_CA: dialog = ca_trust_dialog_show (cert, FALSE); - ca_trust_dialog_set_trust (dialog, - e_cert_trust_has_trusted_ca (icert->trust, TRUE, FALSE, FALSE), - e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE), - e_cert_trust_has_trusted_ca (icert->trust, FALSE, FALSE, TRUE)); + ca_trust_dialog_set_trust ( + dialog, + e_cert_trust_has_trusted_ca (icert->trust, TRUE, FALSE, FALSE), + e_cert_trust_has_trusted_ca (icert->trust, FALSE, TRUE, FALSE), + e_cert_trust_has_trusted_ca (icert->trust, FALSE, FALSE, TRUE)); break; case E_CERT_CONTACT: dialog = cert_trust_dialog_show (cert); @@ -561,13 +570,15 @@ edit_cert (GtkWidget *button, gboolean trust_ssl, trust_email, trust_objsign; CERTCertTrust trust; - ca_trust_dialog_get_trust (dialog, - &trust_ssl, &trust_email, &trust_objsign); + ca_trust_dialog_get_trust ( + dialog, + &trust_ssl, &trust_email, &trust_objsign); e_cert_trust_init (&trust); e_cert_trust_set_valid_ca (&trust); - e_cert_trust_add_ca_trust (&trust, - trust_ssl, trust_email, trust_objsign); + e_cert_trust_add_ca_trust ( + &trust, + trust_ssl, trust_email, trust_objsign); e_cert_db_change_cert_trust (icert, &trust); } @@ -586,9 +597,11 @@ import_cert (GtkWidget *button, GtkFileFilter *filter; gint i; - filesel = gtk_file_chooser_dialog_new (_("Select a certificate to import..."), - NULL, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); + filesel = gtk_file_chooser_dialog_new ( + _("Select a certificate to import..."), NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); filter = gtk_file_filter_new (); @@ -618,8 +631,9 @@ import_cert (GtkWidget *button, break; case E_CERT_CONTACT: case E_CERT_CA: - import = e_cert_db_import_certs_from_file (e_cert_db_peek (), filename, - cp->cert_type, &imported_certs, &error); + import = e_cert_db_import_certs_from_file ( + e_cert_db_peek (), filename, + cp->cert_type, &imported_certs, &error); break; default: g_free (filename); @@ -653,9 +667,10 @@ delete_cert (GtkWidget *button, if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (cp->treeview), NULL, &iter)) { ECert *cert; - gtk_tree_model_get (GTK_TREE_MODEL (cp->streemodel), &iter, - cp->columns_count - 1, &cert, - -1); + gtk_tree_model_get ( + GTK_TREE_MODEL (cp->streemodel), &iter, + cp->columns_count - 1, &cert, + -1); if (cert && e_cert_db_delete_cert (e_cert_db_peek (), cert)) { GtkTreeIter child_iter, parent_iter; @@ -699,8 +714,9 @@ add_cert (CertPage *cp, /* create a new toplevel node */ gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL); - gtk_tree_store_set (GTK_TREE_STORE (model), &iter, - 0, organization, -1); + gtk_tree_store_set ( + GTK_TREE_STORE (model), &iter, + 0, organization, -1); /* now copy it off into parent_iter and insert it into * the hashtable */ @@ -722,11 +738,13 @@ add_cert (CertPage *cp, } if (cp->columns[i].type == G_TYPE_STRING) { - gtk_tree_store_set (GTK_TREE_STORE (model), &iter, - i, get_cert_data_func (cert), -1); + gtk_tree_store_set ( + GTK_TREE_STORE (model), &iter, + i, get_cert_data_func (cert), -1); } else if (cp->columns[i].type == G_TYPE_OBJECT) { - gtk_tree_store_set (GTK_TREE_STORE (model), &iter, - i, cert, -1); + gtk_tree_store_set ( + GTK_TREE_STORE (model), &iter, + i, cert, -1); } } } @@ -757,9 +775,11 @@ unload_certs (CertPage *cp) if (cp->root_hash) g_hash_table_destroy (cp->root_hash); - cp->root_hash = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) gtk_tree_iter_free); + cp->root_hash = g_hash_table_new_full ( + (GHashFunc) g_str_hash, + (GEqualFunc) g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) gtk_tree_iter_free); } static void diff --git a/smime/gui/certificate-viewer.c b/smime/gui/certificate-viewer.c index 9273ae90e6..af1b3226ce 100644 --- a/smime/gui/certificate-viewer.c +++ b/smime/gui/certificate-viewer.c @@ -159,10 +159,11 @@ populate_fields_tree (CertificateViewerData *cvm_data, /* first insert a node for the current asn1 */ gtk_tree_store_insert (cvm_data->fields_store, &new_iter, root, -1); - gtk_tree_store_set (cvm_data->fields_store, &new_iter, - 0, e_asn1_object_get_display_name (asn1), - 1, asn1, - -1); + gtk_tree_store_set ( + cvm_data->fields_store, &new_iter, + 0, e_asn1_object_get_display_name (asn1), + 1, asn1, + -1); if (e_asn1_object_is_valid_container (asn1)) { GList *children = e_asn1_object_get_children (asn1); @@ -191,10 +192,11 @@ hierarchy_selection_changed (GtkTreeSelection *selection, EASN1Object *asn1_object; ECert *cert; - gtk_tree_model_get (model, - &iter, - 1, &cert, - -1); + gtk_tree_model_get ( + model, + &iter, + 1, &cert, + -1); if (!cert) return; @@ -204,8 +206,9 @@ hierarchy_selection_changed (GtkTreeSelection *selection, /* wipe out the old model */ cvm_data->fields_store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); - gtk_tree_view_set_model (GTK_TREE_VIEW (cvm_data->fields_tree), - GTK_TREE_MODEL (cvm_data->fields_store)); + gtk_tree_view_set_model ( + GTK_TREE_VIEW (cvm_data->fields_tree), + GTK_TREE_MODEL (cvm_data->fields_store)); /* populate the fields from the newly selected cert */ populate_fields_tree (cvm_data, asn1_object, NULL); @@ -213,8 +216,9 @@ hierarchy_selection_changed (GtkTreeSelection *selection, g_object_unref (asn1_object); /* and blow away the field value */ - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), - "", 0); + gtk_text_buffer_set_text ( + gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), + "", 0); } } @@ -231,26 +235,30 @@ fields_selection_changed (GtkTreeSelection *selection, EASN1Object *asn1_object; const gchar *value; - gtk_tree_model_get (model, - &iter, - 1, &asn1_object, - -1); + gtk_tree_model_get ( + model, + &iter, + 1, &asn1_object, + -1); value = e_asn1_object_get_display_value (asn1_object); - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), - "", 0); + gtk_text_buffer_set_text ( + gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), + "", 0); if (value) { GtkTextIter text_iter; - gtk_text_buffer_get_start_iter (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), - &text_iter); + gtk_text_buffer_get_start_iter ( + gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), + &text_iter); - gtk_text_buffer_insert_with_tags (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), - &text_iter, - value, strlen (value), - cvm_data->text_tag, NULL); + gtk_text_buffer_insert_with_tags ( + gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), + &text_iter, + value, strlen (value), + cvm_data->text_tag, NULL); } } } @@ -266,12 +274,14 @@ fill_in_details (CertificateViewerData *cvm_data, /* hook up all the hierarchy tree foo */ cvm_data->hierarchy_store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_OBJECT); cvm_data->hierarchy_tree = e_builder_get_widget (cvm_data->builder, "cert-hierarchy-treeview"); - gtk_tree_view_set_model (GTK_TREE_VIEW (cvm_data->hierarchy_tree), - GTK_TREE_MODEL (cvm_data->hierarchy_store)); + gtk_tree_view_set_model ( + GTK_TREE_VIEW (cvm_data->hierarchy_tree), + GTK_TREE_MODEL (cvm_data->hierarchy_store)); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (cvm_data->hierarchy_tree), - -1, "Cert", gtk_cell_renderer_text_new (), - "text", 0, NULL); + gtk_tree_view_insert_column_with_attributes ( + GTK_TREE_VIEW (cvm_data->hierarchy_tree), + -1, "Cert", gtk_cell_renderer_text_new (), + "text", 0, NULL); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (cvm_data->hierarchy_tree)); g_signal_connect ( @@ -281,9 +291,10 @@ fill_in_details (CertificateViewerData *cvm_data, /* hook up all the fields tree foo */ cvm_data->fields_tree = e_builder_get_widget (cvm_data->builder, "cert-fields-treeview"); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (cvm_data->fields_tree), - -1, "Field", gtk_cell_renderer_text_new (), - "text", 0, NULL); + gtk_tree_view_insert_column_with_attributes ( + GTK_TREE_VIEW (cvm_data->fields_tree), + -1, "Field", gtk_cell_renderer_text_new (), + "text", 0, NULL); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (cvm_data->fields_tree)); g_signal_connect ( @@ -295,10 +306,11 @@ fill_in_details (CertificateViewerData *cvm_data, /* set the font of the field value viewer to be some fixed * width font to the hex display doesn't look like ass. */ - cvm_data->text_tag = gtk_text_buffer_create_tag (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), - "mono", - "font", "Mono", - NULL); + cvm_data->text_tag = gtk_text_buffer_create_tag ( + gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), + "mono", + "font", "Mono", + NULL); /* initially populate the hierarchy from the cert's chain */ cvm_data->cert_chain = e_cert_get_chain (cert); @@ -313,10 +325,11 @@ fill_in_details (CertificateViewerData *cvm_data, str = e_cert_get_subject_name (c); gtk_tree_store_insert (cvm_data->hierarchy_store, &new_iter, root, -1); - gtk_tree_store_set (cvm_data->hierarchy_store, &new_iter, - 0, str, - 1, c, - -1); + gtk_tree_store_set ( + cvm_data->hierarchy_store, &new_iter, + 0, str, + 1, c, + -1); root = &new_iter; } diff --git a/smime/gui/e-cert-selector.c b/smime/gui/e-cert-selector.c index 71f3545770..2928b550ab 100644 --- a/smime/gui/e-cert-selector.c +++ b/smime/gui/e-cert-selector.c @@ -195,7 +195,8 @@ e_cert_selector_new (gint type, while (!CERT_LIST_END (node, certlist)) { if (node->cert->nickname || node->cert->emailAddr) { gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, + gtk_list_store_set ( + store, &iter, 0, node->cert->nickname ? node->cert->nickname : node->cert->emailAddr, -1); diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index c74ac0a176..a98d085c43 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -354,7 +354,8 @@ e_cert_db_get_certs_from_package (PRArenaPool *arena, return NULL; collectArgs->arena = arena; - sec_rv = CERT_DecodeCertPackage (data, + sec_rv = CERT_DecodeCertPackage ( + data, length, collect_certs, (gpointer) collectArgs); @@ -388,12 +389,13 @@ pk11_password (PK11SlotInfo *slot, gboolean rv = FALSE; - g_signal_emit (e_cert_db_peek (), - e_cert_db_signals[PK11_PASSWD], 0, - slot, - retry, - &pwd, - &rv); + g_signal_emit ( + e_cert_db_peek (), + e_cert_db_signals[PK11_PASSWD], 0, + slot, + retry, + &pwd, + &rv); if (pwd == NULL) return NULL; @@ -530,35 +532,35 @@ e_cert_db_class_init (ECertDBClass *class) /* check to see if you have a rootcert module installed */ install_loadable_roots (); - e_cert_db_signals[PK11_PASSWD] = - g_signal_new ("pk11_passwd", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ECertDBClass, pk11_passwd), - NULL, NULL, - e_marshal_BOOLEAN__POINTER_BOOLEAN_POINTER, - G_TYPE_BOOLEAN, 3, - G_TYPE_POINTER, G_TYPE_BOOLEAN, G_TYPE_POINTER); - - e_cert_db_signals[PK11_CHANGE_PASSWD] = - g_signal_new ("pk11_change_passwd", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ECertDBClass, pk11_change_passwd), - NULL, NULL, - e_marshal_BOOLEAN__POINTER_POINTER, - G_TYPE_BOOLEAN, 2, - G_TYPE_POINTER, G_TYPE_POINTER); - - e_cert_db_signals[CONFIRM_CA_CERT_IMPORT] = - g_signal_new ("confirm_ca_cert_import", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ECertDBClass, confirm_ca_cert_import), - NULL, NULL, - e_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, - G_TYPE_BOOLEAN, 4, - G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER); + e_cert_db_signals[PK11_PASSWD] = g_signal_new ( + "pk11_passwd", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECertDBClass, pk11_passwd), + NULL, NULL, + e_marshal_BOOLEAN__POINTER_BOOLEAN_POINTER, + G_TYPE_BOOLEAN, 3, + G_TYPE_POINTER, G_TYPE_BOOLEAN, G_TYPE_POINTER); + + e_cert_db_signals[PK11_CHANGE_PASSWD] = g_signal_new ( + "pk11_change_passwd", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECertDBClass, pk11_change_passwd), + NULL, NULL, + e_marshal_BOOLEAN__POINTER_POINTER, + G_TYPE_BOOLEAN, 2, + G_TYPE_POINTER, G_TYPE_POINTER); + + e_cert_db_signals[CONFIRM_CA_CERT_IMPORT] = g_signal_new ( + "confirm_ca_cert_import", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ECertDBClass, confirm_ca_cert_import), + NULL, NULL, + e_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, + G_TYPE_BOOLEAN, 4, + G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER); } static void @@ -630,8 +632,9 @@ e_cert_db_find_cert_by_key (ECertDB *certdb, return NULL; } - dummy = NSSBase64_DecodeBuffer (NULL, &keyItem, db_key, - (PRUint32) PL_strlen (db_key)); + dummy = NSSBase64_DecodeBuffer ( + NULL, &keyItem, db_key, + (PRUint32) PL_strlen (db_key)); /* someday maybe we can speed up the search using the moduleID and slotID*/ moduleID = NS_NSS_GET_LONG (keyItem.data); @@ -697,10 +700,11 @@ e_cert_db_find_cert_by_email_address (ECertDB *certdb, /* any_cert now contains a cert with the right subject, * but it might not have the correct usage. */ - certlist = CERT_CreateSubjectCertList (NULL, - CERT_GetDefaultCertDB (), - &any_cert->derSubject, - PR_Now (), PR_TRUE); + certlist = CERT_CreateSubjectCertList ( + NULL, + CERT_GetDefaultCertDB (), + &any_cert->derSubject, + PR_Now (), PR_TRUE); if (!certlist) { set_nss_error (error); CERT_DestroyCertificate (any_cert); @@ -743,13 +747,14 @@ confirm_download_ca_cert (ECertDB *cert_db, *trust_email = *trust_objsign = FALSE; - g_signal_emit (e_cert_db_peek (), - e_cert_db_signals[CONFIRM_CA_CERT_IMPORT], 0, - cert, - trust_ssl, - trust_email, - trust_objsign, - &rv); + g_signal_emit ( + e_cert_db_peek (), + e_cert_db_signals[CONFIRM_CA_CERT_IMPORT], 0, + cert, + trust_ssl, + trust_email, + trust_objsign, + &rv); return rv; } @@ -841,8 +846,9 @@ handle_ca_cert_download (ECertDB *cert_db, CERTCertDBHandle *certdb = CERT_GetDefaultCertDB (); tmpCert = CERT_FindCertByDERCert (certdb, &der); if (!tmpCert) { - tmpCert = CERT_NewTempCertificate (certdb, &der, - NULL, PR_FALSE, PR_TRUE); + tmpCert = CERT_NewTempCertificate ( + certdb, &der, + NULL, PR_FALSE, PR_TRUE); } if (!tmpCert) { g_warning ("Couldn't create cert from DER blob"); @@ -881,14 +887,16 @@ handle_ca_cert_download (ECertDB *cert_db, e_cert_trust_init (&trust); e_cert_trust_set_valid_ca (&trust); - e_cert_trust_add_ca_trust (&trust, - trust_ssl, - trust_email, - trust_objsign); + e_cert_trust_add_ca_trust ( + &trust, + trust_ssl, + trust_email, + trust_objsign); - srv = CERT_AddTempCertToPerm (tmpCert, - nickname, - &trust); + srv = CERT_AddTempCertToPerm ( + tmpCert, + nickname, + &trust); /* If we aren't logged into the token, then what *should* * happen is the above call should fail, and we should @@ -907,12 +915,14 @@ handle_ca_cert_download (ECertDB *cert_db, if (srv != SECSuccess && PORT_GetError () == SEC_ERROR_TOKEN_NOT_LOGGED_IN && e_cert_db_login_to_slot (NULL, PK11_GetInternalKeySlot ())) { - srv = CERT_ChangeCertTrust (CERT_GetDefaultCertDB (), - tmpCert, &trust); + srv = CERT_ChangeCertTrust ( + CERT_GetDefaultCertDB (), + tmpCert, &trust); if (srv != SECSuccess) - srv = CERT_AddTempCertToPerm (tmpCert, - nickname, - &trust); + srv = CERT_AddTempCertToPerm ( + tmpCert, + nickname, + &trust); } if (srv != SECSuccess) { set_nss_error (error); @@ -941,8 +951,9 @@ handle_ca_cert_download (ECertDB *cert_db, continue; /* Let's try to import the rest of 'em */ } nickname.Adopt (CERT_MakeCANickname (tmpCert2)); - CERT_AddTempCertToPerm (tmpCert2, NS_CONST_CAST (gchar *,nickname.get ()), - defaultTrust.GetTrust ()); + CERT_AddTempCertToPerm ( + tmpCert2, NS_CONST_CAST (gchar *,nickname.get ()), + defaultTrust.GetTrust ()); CERT_DestroyCertificate (tmpCert2); } #endif @@ -953,18 +964,21 @@ gboolean e_cert_db_change_cert_trust (CERTCertificate *cert, CERTCertTrust *trus { SECStatus srv; - srv = CERT_ChangeCertTrust (CERT_GetDefaultCertDB (), - cert, trust); + srv = CERT_ChangeCertTrust ( + CERT_GetDefaultCertDB (), + cert, trust); if (srv != SECSuccess && PORT_GetError () == SEC_ERROR_TOKEN_NOT_LOGGED_IN && e_cert_db_login_to_slot (NULL, PK11_GetInternalKeySlot ())) - srv = CERT_ChangeCertTrust (CERT_GetDefaultCertDB (), - cert, trust); + srv = CERT_ChangeCertTrust ( + CERT_GetDefaultCertDB (), + cert, trust); if (srv != SECSuccess) { glong err = PORT_GetError (); - g_warning ("CERT_ChangeCertTrust() failed: %s\n", - nss_error_to_string (err)); + g_warning ( + "CERT_ChangeCertTrust() failed: %s\n", + nss_error_to_string (err)); return FALSE; } return TRUE; @@ -1093,8 +1107,9 @@ e_cert_db_import_email_cert (ECertDB *certdb, return FALSE; } - cert = CERT_NewTempCertificate (CERT_GetDefaultCertDB (), certCollection->rawCerts, - (gchar *) NULL, PR_FALSE, PR_TRUE); + cert = CERT_NewTempCertificate ( + CERT_GetDefaultCertDB (), certCollection->rawCerts, + (gchar *) NULL, PR_FALSE, PR_TRUE); if (!cert) { set_nss_error (error); rv = FALSE; @@ -1112,9 +1127,10 @@ e_cert_db_import_email_cert (ECertDB *certdb, rawCerts[i] = &certCollection->rawCerts[i]; } - srv = CERT_ImportCerts (CERT_GetDefaultCertDB (), certUsageEmailSigner, - numcerts, rawCerts, NULL, PR_TRUE, PR_FALSE, - NULL); + srv = CERT_ImportCerts ( + CERT_GetDefaultCertDB (), certUsageEmailSigner, + numcerts, rawCerts, NULL, PR_TRUE, PR_FALSE, + NULL); if (srv != SECSuccess) { set_nss_error (error); rv = FALSE; @@ -1298,8 +1314,9 @@ e_cert_db_import_user_cert (ECertDB *certdb, goto loser; } - cert = CERT_NewTempCertificate (CERT_GetDefaultCertDB (), collectArgs->rawCerts, - (gchar *) NULL, PR_FALSE, PR_TRUE); + cert = CERT_NewTempCertificate ( + CERT_GetDefaultCertDB (), collectArgs->rawCerts, + (gchar *) NULL, PR_FALSE, PR_TRUE); if (!cert) { set_nss_error (error); goto loser; @@ -1479,11 +1496,12 @@ e_cert_db_login_to_slot (ECertDB *cert_db, printf ("initializing slot password\n"); - g_signal_emit (e_cert_db_peek (), - e_cert_db_signals[PK11_CHANGE_PASSWD], 0, - NULL, - &pwd, - &rv); + g_signal_emit ( + e_cert_db_peek (), + e_cert_db_signals[PK11_CHANGE_PASSWD], 0, + NULL, + &pwd, + &rv); if (!rv) return FALSE; @@ -1494,7 +1512,8 @@ e_cert_db_login_to_slot (ECertDB *cert_db, PK11_SetPasswordFunc (pk11_password); if (PK11_Authenticate (slot, PR_TRUE, NULL) != SECSuccess) { - printf ("PK11_Authenticate failed (err = %d/%d)\n", + printf ( + "PK11_Authenticate failed (err = %d/%d)\n", PORT_GetError (), PORT_GetError () + 0x2000); return FALSE; } diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c index 7b06a80b59..cd92062779 100644 --- a/smime/lib/e-cert.c +++ b/smime/lib/e-cert.c @@ -217,17 +217,19 @@ e_cert_populate (ECert *cert) cert->priv->serial_number = CERT_Hexify (&cert->priv->cert->serialNumber, TRUE); memset (fingerprint, 0, sizeof fingerprint); - PK11_HashBuf (SEC_OID_SHA1, fingerprint, - cert->priv->cert->derCert.data, - cert->priv->cert->derCert.len); + PK11_HashBuf ( + SEC_OID_SHA1, fingerprint, + cert->priv->cert->derCert.data, + cert->priv->cert->derCert.len); fpItem.data = fingerprint; fpItem.len = SHA1_LENGTH; cert->priv->sha1_fingerprint = CERT_Hexify (&fpItem, TRUE); memset (fingerprint, 0, sizeof fingerprint); - PK11_HashBuf (SEC_OID_MD5, fingerprint, - cert->priv->cert->derCert.data, - cert->priv->cert->derCert.len); + PK11_HashBuf ( + SEC_OID_MD5, fingerprint, + cert->priv->cert->derCert.data, + cert->priv->cert->derCert.len); fpItem.data = fingerprint; fpItem.len = MD5_LENGTH; cert->priv->md5_fingerprint = CERT_Hexify (&fpItem, TRUE); diff --git a/smime/lib/e-pkcs12.c b/smime/lib/e-pkcs12.c index bc6377a0a1..fa61033151 100644 --- a/smime/lib/e-pkcs12.c +++ b/smime/lib/e-pkcs12.c @@ -65,7 +65,7 @@ #include "secerr.h" /* static callback functions for the NSS PKCS#12 library */ -static SECItem * PR_CALLBACK nickname_collision (SECItem *, PRBool *, gpointer ); +static SECItem * PR_CALLBACK nickname_collision (SECItem *, PRBool *, gpointer); static gboolean handle_error (gint myerr); @@ -123,9 +123,8 @@ input_to_decoder (SEC_PKCS12DecoderContext *dcx, } /* feed the file data into the decoder */ - srv = SEC_PKCS12DecoderUpdate (dcx, - (guchar *) buf, - amount); + srv = SEC_PKCS12DecoderUpdate ( + dcx, (guchar *) buf, amount); if (srv) { /* XXX g_error */ fclose (fp); @@ -206,13 +205,14 @@ import_from_file_helper (EPKCS12 *pkcs12, } /* initialize the decoder */ - dcx = SEC_PKCS12DecoderStart (&passwd, - slot, - /* we specify NULL for all the - funcs + data so it'll use the - default pk11wrap functions */ - NULL, NULL, NULL, - NULL, NULL, NULL); + dcx = SEC_PKCS12DecoderStart ( + &passwd, + slot, + /* we specify NULL for all the + * funcs + data so it'll use the + * default pk11wrap functions */ + NULL, NULL, NULL, + NULL, NULL, NULL); if (!dcx) { srv = SECFailure; goto finish; @@ -345,8 +345,9 @@ nickname_collision (SECItem *oldNick, g_free (nickname); nickname = g_strdup (default_nickname); } - cert = CERT_FindCertByNickname (CERT_GetDefaultCertDB (), - nickname); + cert = CERT_FindCertByNickname ( + CERT_GetDefaultCertDB (), + nickname); if (!cert) { break; } |