diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-09-12 02:56:28 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-09-13 20:28:58 +0800 |
commit | cd53ba990035bdb4861d9660917d457533d4ecb2 (patch) | |
tree | d9c9da2208f4a921c514497ea92d27e3d88481d1 /smime | |
parent | b2b27cfa1bfcd6efdac30d2745a6e8cd4e6de134 (diff) | |
download | gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.gz gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.bz2 gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.lz gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.xz gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.zst gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.zip |
Coding style cleanups.
Diffstat (limited to 'smime')
-rw-r--r-- | smime/gui/ca-trust-dialog.c | 6 | ||||
-rw-r--r-- | smime/gui/cert-trust-dialog.c | 32 | ||||
-rw-r--r-- | smime/gui/certificate-manager.c | 66 | ||||
-rw-r--r-- | smime/gui/e-cert-selector.c | 70 | ||||
-rw-r--r-- | smime/lib/e-asn1-object.c | 2 | ||||
-rw-r--r-- | smime/lib/e-cert-db.c | 218 | ||||
-rw-r--r-- | smime/lib/e-cert-trust.c | 74 | ||||
-rw-r--r-- | smime/lib/e-cert.c | 94 | ||||
-rw-r--r-- | smime/lib/e-cert.h | 2 | ||||
-rw-r--r-- | smime/lib/e-pkcs12.c | 30 |
10 files changed, 297 insertions, 297 deletions
diff --git a/smime/gui/ca-trust-dialog.c b/smime/gui/ca-trust-dialog.c index 47f4d5db81..a8169dd2e7 100644 --- a/smime/gui/ca-trust-dialog.c +++ b/smime/gui/ca-trust-dialog.c @@ -54,7 +54,7 @@ free_data (gpointer data) } static void -catd_response(GtkWidget *w, guint id, CATrustDialogData *data) +catd_response (GtkWidget *w, guint id, CATrustDialogData *data) { switch (id) { case GTK_RESPONSE_ACCEPT: { @@ -102,8 +102,8 @@ ca_trust_dialog_show (ECert *cert, gboolean importing) w = e_builder_get_widget(ctd_data->builder, "ca-trust-label"); txt = g_strdup_printf(_("Certificate '%s' is a CA certificate.\n\nEdit trust settings:"), e_cert_get_cn(cert)); - gtk_label_set_text((GtkLabel *)w, txt); - g_free(txt); + gtk_label_set_text ((GtkLabel *)w, txt); + g_free (txt); g_signal_connect (ctd_data->dialog, "response", G_CALLBACK (catd_response), ctd_data); diff --git a/smime/gui/cert-trust-dialog.c b/smime/gui/cert-trust-dialog.c index 9c87c666ab..cfd8ce464f 100644 --- a/smime/gui/cert-trust-dialog.c +++ b/smime/gui/cert-trust-dialog.c @@ -60,20 +60,20 @@ free_data (gpointer data) } static void -ctd_response(GtkWidget *w, guint id, CertTrustDialogData *data) +ctd_response (GtkWidget *w, guint id, CertTrustDialogData *data) { CERTCertTrust trust; CERTCertificate *icert; switch (id) { case GTK_RESPONSE_OK: - icert = e_cert_get_internal_cert(data->cert); - e_cert_trust_init(&trust); - e_cert_trust_set_valid_peer(&trust); + 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)), + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->trust_button)), FALSE); - CERT_ChangeCertTrust (CERT_GetDefaultCertDB(), icert, &trust); + CERT_ChangeCertTrust (CERT_GetDefaultCertDB (), icert, &trust); break; case GTK_RESPONSE_ACCEPT: { /* just *what on earth* was chris thinking here!?!?! copied from certificate-manager.c */ @@ -101,7 +101,7 @@ ctd_response(GtkWidget *w, guint id, CertTrustDialogData *data) trust_email, trust_objsign); - CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), icert, &trust); + CERT_ChangeCertTrust (CERT_GetDefaultCertDB (), icert, &trust); } gtk_widget_destroy (dialog); @@ -122,7 +122,7 @@ cert_trust_dialog_show (ECert *cert) ctd_data->dialog = e_builder_get_widget (ctd_data->builder, "cert-trust-dialog"); ctd_data->cert = g_object_ref (cert); - ctd_data->cacert = e_cert_get_ca_cert(cert); + ctd_data->cacert = e_cert_get_ca_cert (cert); ctd_data->trust_button = e_builder_get_widget(ctd_data->builder, "cert-trust"); ctd_data->notrust_button = e_builder_get_widget(ctd_data->builder, "cert-notrust"); @@ -132,19 +132,19 @@ cert_trust_dialog_show (ECert *cert) g_object_set_data_full (G_OBJECT (ctd_data->dialog), "CertTrustDialogData", ctd_data, free_data); - icert = e_cert_get_internal_cert(cert); - if (e_cert_trust_has_trusted_peer(icert->trust, FALSE, TRUE, FALSE)) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (ctd_data->trust_button), TRUE); + icert = e_cert_get_internal_cert (cert); + if (e_cert_trust_has_trusted_peer (icert->trust, FALSE, TRUE, FALSE)) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->trust_button), TRUE); else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (ctd_data->notrust_button), TRUE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctd_data->notrust_button), TRUE); - 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, + 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")); else - gtk_label_set_text((GtkLabel *)ctd_data->label, + 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")); diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index d0823b8acb..103b319ec3 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -153,7 +153,7 @@ import_your (GtkWidget *widget, CertificateManagerData *cfm) NULL); gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); - filter = gtk_file_filter_new(); + filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("All PKCS12 files")); gtk_file_filter_add_mime_type (filter, "application/x-x509-user-cert"); gtk_file_filter_add_mime_type (filter, "application/x-pkcs12"); @@ -192,7 +192,7 @@ delete_your (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->yourcerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->yourcerts_treeview)), NULL, &iter)) { ECert *cert; @@ -227,7 +227,7 @@ view_your (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->yourcerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->yourcerts_treeview)), NULL, &iter)) { ECert *cert; @@ -353,7 +353,7 @@ initialize_yourcerts_ui (CertificateManagerData *cfm) cell, "text", 0, NULL); - gtk_tree_view_column_set_resizable(column, TRUE); + gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_append_column (GTK_TREE_VIEW (cfm->yourcerts_treeview), column); gtk_tree_view_column_set_sort_column_id (column, 0); @@ -362,7 +362,7 @@ initialize_yourcerts_ui (CertificateManagerData *cfm) cell, "text", 1, NULL); - gtk_tree_view_column_set_resizable(column, TRUE); + gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_append_column (GTK_TREE_VIEW (cfm->yourcerts_treeview), column); gtk_tree_view_column_set_sort_column_id (column, 1); @@ -407,7 +407,7 @@ view_contact (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->contactcerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->contactcerts_treeview)), NULL, &iter)) { ECert *cert; @@ -431,7 +431,7 @@ edit_contact (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->contactcerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->contactcerts_treeview)), NULL, &iter)) { ECert *cert; @@ -465,7 +465,7 @@ import_contact (GtkWidget *widget, CertificateManagerData *cfm) NULL); gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); - filter = gtk_file_filter_new(); + filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("All email certificate files")); gtk_file_filter_add_mime_type (filter, "application/x-x509-email-cert"); gtk_file_filter_add_mime_type (filter, "application/x-x509-ca-cert"); @@ -514,7 +514,7 @@ delete_contact (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->contactcerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->contactcerts_treeview)), NULL, &iter)) { ECert *cert; @@ -575,7 +575,7 @@ initialize_contactcerts_ui (CertificateManagerData *cfm) cell, "text", 0, NULL); - gtk_tree_view_column_set_resizable(column, TRUE); + gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_append_column (GTK_TREE_VIEW (cfm->contactcerts_treeview), column); gtk_tree_view_column_set_sort_column_id (column, 0); @@ -584,7 +584,7 @@ initialize_contactcerts_ui (CertificateManagerData *cfm) cell, "text", 1, NULL); - gtk_tree_view_column_set_resizable(column, TRUE); + gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_append_column (GTK_TREE_VIEW (cfm->contactcerts_treeview), column); gtk_tree_view_column_set_sort_column_id (column, 1); @@ -593,7 +593,7 @@ initialize_contactcerts_ui (CertificateManagerData *cfm) cell, "text", 2, NULL); - gtk_tree_view_column_set_resizable(column, TRUE); + gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_append_column (GTK_TREE_VIEW (cfm->contactcerts_treeview), column); gtk_tree_view_column_set_sort_column_id (column, 2); @@ -622,7 +622,7 @@ view_ca (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->authoritycerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->authoritycerts_treeview)), NULL, &iter)) { ECert *cert; @@ -646,7 +646,7 @@ edit_ca (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->authoritycerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->authoritycerts_treeview)), NULL, &iter)) { ECert *cert; @@ -679,7 +679,7 @@ edit_ca (GtkWidget *widget, CertificateManagerData *cfm) trust_email, trust_objsign); - CERT_ChangeCertTrust (CERT_GetDefaultCertDB(), icert, &trust); + CERT_ChangeCertTrust (CERT_GetDefaultCertDB (), icert, &trust); } gtk_widget_destroy (dialog); @@ -702,7 +702,7 @@ import_ca (GtkWidget *widget, CertificateManagerData *cfm) NULL); gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); - filter = gtk_file_filter_new(); + filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("All CA certificate files")); gtk_file_filter_add_mime_type (filter, "application/x-x509-ca-cert"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (filesel), filter); @@ -749,7 +749,7 @@ delete_ca (GtkWidget *widget, CertificateManagerData *cfm) { GtkTreeIter iter; - if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(cfm->authoritycerts_treeview)), + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cfm->authoritycerts_treeview)), NULL, &iter)) { ECert *cert; @@ -858,17 +858,17 @@ add_user_cert (CertificateManagerData *cfm, ECert *cert) if (e_cert_get_cn (cert)) gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, e_cert_get_cn (cert), - 1, e_cert_get_usage(cert), - 2, e_cert_get_serial_number(cert), - 3, e_cert_get_expires_on(cert), + 1, e_cert_get_usage (cert), + 2, e_cert_get_serial_number (cert), + 3, e_cert_get_expires_on (cert), 4, cert, -1); else gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, e_cert_get_nickname (cert), - 1, e_cert_get_usage(cert), - 2, e_cert_get_serial_number(cert), - 3, e_cert_get_expires_on(cert), + 1, e_cert_get_usage (cert), + 2, e_cert_get_serial_number (cert), + 3, e_cert_get_expires_on (cert), 4, cert, -1); } @@ -903,14 +903,14 @@ add_contact_cert (CertificateManagerData *cfm, ECert *cert) gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, e_cert_get_cn (cert), 1, e_cert_get_email (cert), - 2, e_cert_get_usage(cert), + 2, e_cert_get_usage (cert), 3, cert, -1); else gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, e_cert_get_nickname (cert), 1, e_cert_get_email (cert), - 2, e_cert_get_usage(cert), + 2, e_cert_get_usage (cert), 3, cert, -1); } @@ -1052,9 +1052,9 @@ load_certs (CertificateManagerData *cfm, certList = PK11_ListCerts (PK11CertListUnique, NULL); - for (node = CERT_LIST_HEAD(certList); - !CERT_LIST_END(node, certList); - node = CERT_LIST_NEXT(node)) { + for (node = CERT_LIST_HEAD (certList); + !CERT_LIST_END (node, certList); + node = CERT_LIST_NEXT (node)) { ECert *cert = e_cert_new (CERT_DupCertificate ((CERTCertificate*)node->cert)); ECertType ct = e_cert_get_cert_type (cert); @@ -1135,9 +1135,9 @@ certificate_manager_config_new (EPreferencesWindow *window) cfm_data->import_ca_button = e_builder_get_widget (cfm_data->builder, "authority-import-button"); cfm_data->delete_ca_button = e_builder_get_widget (cfm_data->builder, "authority-delete-button"); - initialize_yourcerts_ui(cfm_data); - initialize_contactcerts_ui(cfm_data); - initialize_authoritycerts_ui(cfm_data); + initialize_yourcerts_ui (cfm_data); + initialize_contactcerts_ui (cfm_data); + initialize_authoritycerts_ui (cfm_data); /* Run this in an idle callback so Evolution has a chance to * fully initialize itself and start its main loop before we @@ -1152,8 +1152,8 @@ certificate_manager_config_new (EPreferencesWindow *window) gtk_container_remove (GTK_CONTAINER (parent), widget); /* FIXME: remove when implemented */ - gtk_widget_set_sensitive(cfm_data->backup_your_button, FALSE); - gtk_widget_set_sensitive(cfm_data->backup_all_your_button, FALSE); + gtk_widget_set_sensitive (cfm_data->backup_your_button, FALSE); + gtk_widget_set_sensitive (cfm_data->backup_all_your_button, FALSE); return widget; } diff --git a/smime/gui/e-cert-selector.c b/smime/gui/e-cert-selector.c index 71f2c00504..064b31f90e 100644 --- a/smime/gui/e-cert-selector.c +++ b/smime/gui/e-cert-selector.c @@ -63,46 +63,46 @@ Issued by: */ static CERTCertListNode * -ecs_find_current(ECertSelector *ecs) +ecs_find_current (ECertSelector *ecs) { struct _ECertSelectorPrivate *p = ecs->priv; CERTCertListNode *node; gint n; - if (p->certlist == NULL || CERT_LIST_EMPTY(p->certlist)) + if (p->certlist == NULL || CERT_LIST_EMPTY (p->certlist)) return NULL; n = gtk_combo_box_get_active (GTK_COMBO_BOX (p->combobox)); - node = CERT_LIST_HEAD(p->certlist); - while (n>0 && !CERT_LIST_END(node, p->certlist)) { + node = CERT_LIST_HEAD (p->certlist); + while (n>0 && !CERT_LIST_END (node, p->certlist)) { n--; - node = CERT_LIST_NEXT(node); + node = CERT_LIST_NEXT (node); } - g_return_val_if_fail (!CERT_LIST_END(node, p->certlist), NULL); + g_return_val_if_fail (!CERT_LIST_END (node, p->certlist), NULL); return node; } static void -e_cert_selector_response(GtkDialog *dialog, gint button) +e_cert_selector_response (GtkDialog *dialog, gint button) { CERTCertListNode *node; switch (button) { case GTK_RESPONSE_OK: - node = ecs_find_current((ECertSelector *)dialog); + node = ecs_find_current ((ECertSelector *)dialog); break; default: node = NULL; break; } - g_signal_emit(dialog, ecs_signals[ECS_SELECTED], 0, node?node->cert->nickname:NULL); + g_signal_emit (dialog, ecs_signals[ECS_SELECTED], 0, node?node->cert->nickname:NULL); } static void -ecs_cert_changed(GtkWidget *w, ECertSelector *ecs) +ecs_cert_changed (GtkWidget *w, ECertSelector *ecs) { struct _ECertSelectorPrivate *p = ecs->priv; CERTCertListNode *node; @@ -110,16 +110,16 @@ ecs_cert_changed(GtkWidget *w, ECertSelector *ecs) GString *text; text = g_string_new(""); - node = ecs_find_current(ecs); + node = ecs_find_current (ecs); if (node) { /* FIXME: add serial no, validity date, uses */ g_string_append_printf(text, _("Issued to:\n Subject: %s\n"), node->cert->subjectName); g_string_append_printf(text, _("Issued by:\n Subject: %s\n"), node->cert->issuerName); } - buffer = gtk_text_view_get_buffer((GtkTextView *)p->description); - gtk_text_buffer_set_text(buffer, text->str, text->len); - g_string_free(text, TRUE); + buffer = gtk_text_view_get_buffer ((GtkTextView *)p->description); + gtk_text_buffer_set_text (buffer, text->str, text->len); + g_string_free (text, TRUE); } /** @@ -140,7 +140,7 @@ ecs_cert_changed(GtkWidget *w, ECertSelector *ecs) * Return value: A dialogue to be shown. **/ GtkWidget * -e_cert_selector_new(gint type, const gchar *currentid) +e_cert_selector_new (gint type, const gchar *currentid) { ECertSelector *ecs; struct _ECertSelectorPrivate *p; @@ -152,7 +152,7 @@ e_cert_selector_new(gint type, const gchar *currentid) GtkWidget *w; gint n=0, active=0; - ecs = g_object_new(e_cert_selector_get_type(), NULL); + ecs = g_object_new (e_cert_selector_get_type (), NULL); p = ecs->priv; builder = gtk_builder_new (); @@ -178,23 +178,23 @@ e_cert_selector_new(gint type, const gchar *currentid) gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (p->combobox)))); - certlist = CERT_FindUserCertsByUsage(CERT_GetDefaultCertDB(), usage, FALSE, TRUE, NULL); + certlist = CERT_FindUserCertsByUsage (CERT_GetDefaultCertDB (), usage, FALSE, TRUE, NULL); ecs->priv->certlist = certlist; if (certlist != NULL) { - node = CERT_LIST_HEAD(certlist); - while (!CERT_LIST_END(node, certlist)) { + node = CERT_LIST_HEAD (certlist); + while (!CERT_LIST_END (node, certlist)) { if (node->cert->nickname || node->cert->emailAddr) { gtk_combo_box_append_text (GTK_COMBO_BOX (p->combobox), node->cert->nickname?node->cert->nickname:node->cert->emailAddr); if (currentid != NULL - && ((node->cert->nickname != NULL && strcmp(node->cert->nickname, currentid) == 0) - || (node->cert->emailAddr != NULL && strcmp(node->cert->emailAddr, currentid) == 0))) + && ((node->cert->nickname != NULL && strcmp (node->cert->nickname, currentid) == 0) + || (node->cert->emailAddr != NULL && strcmp (node->cert->emailAddr, currentid) == 0))) active = n; n++; } - node = CERT_LIST_NEXT(node); + node = CERT_LIST_NEXT (node); } } @@ -202,47 +202,47 @@ e_cert_selector_new(gint type, const gchar *currentid) g_signal_connect (p->combobox, "changed", G_CALLBACK(ecs_cert_changed), ecs); - g_object_unref(builder); + g_object_unref (builder); - ecs_cert_changed(p->combobox, ecs); + ecs_cert_changed (p->combobox, ecs); - return GTK_WIDGET(ecs); + return GTK_WIDGET (ecs); } static void -e_cert_selector_init(ECertSelector *ecs) +e_cert_selector_init (ECertSelector *ecs) { - gtk_dialog_add_buttons((GtkDialog *)ecs, + gtk_dialog_add_buttons ((GtkDialog *)ecs, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - ecs->priv = g_malloc0(sizeof(*ecs->priv)); + ecs->priv = g_malloc0 (sizeof (*ecs->priv)); } static void -e_cert_selector_finalise(GObject *o) +e_cert_selector_finalise (GObject *o) { ECertSelector *ecs = (ECertSelector *)o; if (ecs->priv->certlist) - CERT_DestroyCertList(ecs->priv->certlist); + CERT_DestroyCertList (ecs->priv->certlist); - g_free(ecs->priv); + g_free (ecs->priv); - ((GObjectClass *)e_cert_selector_parent_class)->finalize(o); + ((GObjectClass *)e_cert_selector_parent_class)->finalize (o); } static void -e_cert_selector_class_init(ECertSelectorClass *klass) +e_cert_selector_class_init (ECertSelectorClass *klass) { ((GObjectClass *)klass)->finalize = e_cert_selector_finalise; ((GtkDialogClass *)klass)->response = e_cert_selector_response; ecs_signals[ECS_SELECTED] = g_signal_new("selected", - G_OBJECT_CLASS_TYPE(klass), + G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(ECertSelectorClass, selected), + G_STRUCT_OFFSET (ECertSelectorClass, selected), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); diff --git a/smime/lib/e-asn1-object.c b/smime/lib/e-asn1-object.c index 7f69802ab6..22788c4bba 100644 --- a/smime/lib/e-asn1-object.c +++ b/smime/lib/e-asn1-object.c @@ -89,7 +89,7 @@ e_asn1_object_class_init (EASN1ObjectClass *klass) { GObjectClass *object_class; - object_class = G_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_ref (PARENT_TYPE); diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index 2e23df2c4a..8c6c6f0c04 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -315,7 +315,7 @@ set_nss_error (GError **error) } static SECStatus PR_CALLBACK -collect_certs(gpointer arg, SECItem **certs, gint numcerts) +collect_certs (gpointer arg, SECItem **certs, gint numcerts) { CERTDERCerts *collectArgs; SECItem *cert; @@ -324,17 +324,17 @@ collect_certs(gpointer arg, SECItem **certs, gint numcerts) collectArgs = (CERTDERCerts *)arg; collectArgs->numcerts = numcerts; - collectArgs->rawCerts = (SECItem *) PORT_ArenaZAlloc( + collectArgs->rawCerts = (SECItem *) PORT_ArenaZAlloc ( collectArgs->arena, sizeof (SECItem) * numcerts); if (collectArgs->rawCerts == NULL) - return(SECFailure); + return (SECFailure); cert = collectArgs->rawCerts; while (numcerts--) { - rv = SECITEM_CopyItem(collectArgs->arena, cert, *certs); + rv = SECITEM_CopyItem (collectArgs->arena, cert, *certs); if (rv == SECFailure) - return(SECFailure); + return (SECFailure); cert++; certs++; } @@ -349,14 +349,14 @@ e_cert_db_get_certs_from_package (PRArenaPool *arena, { /*nsNSSShutDownPreventionLock locker;*/ CERTDERCerts *collectArgs = - (CERTDERCerts *)PORT_ArenaZAlloc(arena, sizeof(CERTDERCerts)); + (CERTDERCerts *)PORT_ArenaZAlloc (arena, sizeof (CERTDERCerts)); SECStatus sec_rv; if (!collectArgs) return NULL; collectArgs->arena = arena; - sec_rv = CERT_DecodeCertPackage(data, + sec_rv = CERT_DecodeCertPackage (data, length, collect_certs, (gpointer)collectArgs); @@ -425,21 +425,21 @@ static void initialize_nss (void) { /* Use camel_init() to initialise NSS consistently... */ - camel_init(e_get_user_data_dir(), TRUE); + camel_init (e_get_user_data_dir (), TRUE); /* ... except for the bits we only seem to do here. FIXME */ - PK11_SetPasswordFunc(pk11_password); + PK11_SetPasswordFunc (pk11_password); /* Enable ciphers for PKCS#12 */ - SEC_PKCS12EnableCipher(PKCS12_RC4_40, 1); - SEC_PKCS12EnableCipher(PKCS12_RC4_128, 1); - SEC_PKCS12EnableCipher(PKCS12_RC2_CBC_40, 1); - SEC_PKCS12EnableCipher(PKCS12_RC2_CBC_128, 1); - SEC_PKCS12EnableCipher(PKCS12_DES_56, 1); - SEC_PKCS12EnableCipher(PKCS12_DES_EDE3_168, 1); - SEC_PKCS12SetPreferredCipher(PKCS12_DES_EDE3_168, 1); + SEC_PKCS12EnableCipher (PKCS12_RC4_40, 1); + SEC_PKCS12EnableCipher (PKCS12_RC4_128, 1); + SEC_PKCS12EnableCipher (PKCS12_RC2_CBC_40, 1); + SEC_PKCS12EnableCipher (PKCS12_RC2_CBC_128, 1); + SEC_PKCS12EnableCipher (PKCS12_DES_56, 1); + SEC_PKCS12EnableCipher (PKCS12_DES_EDE3_168, 1); + SEC_PKCS12SetPreferredCipher (PKCS12_DES_EDE3_168, 1); #ifdef notyet - PORT_SetUCS2_ASCIIConversionFunction(ucs2_ascii_conversion_fn); + PORT_SetUCS2_ASCIIConversionFunction (ucs2_ascii_conversion_fn); #endif } @@ -458,7 +458,7 @@ install_loadable_roots (void) for (i = 0; i < module->slotCount; i++) { PK11SlotInfo *slot = module->slots[i]; if (PK11_IsPresent (slot)) { - if (PK11_HasRootCerts(slot)) { + if (PK11_HasRootCerts (slot)) { RootsModule = module; break; } @@ -541,15 +541,15 @@ e_cert_db_class_init (ECertDBClass *klass) { GObjectClass *object_class; - object_class = G_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_ref (PARENT_TYPE); object_class->dispose = e_cert_db_dispose; - initialize_nss(); + initialize_nss (); /* check to see if you have a rootcert module installed */ - install_loadable_roots(); + install_loadable_roots (); e_cert_db_signals[PK11_PASSWD] = g_signal_new ("pk11_passwd", @@ -644,9 +644,9 @@ e_cert_db_find_cert_by_nickname (ECertDB *certdb, CERTCertificate *cert = NULL; /*PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting \"%s\"\n", asciiname));*/ - cert = PK11_FindCertFromNickname((gchar *)nickname, NULL); + cert = PK11_FindCertFromNickname ((gchar *)nickname, NULL); if (!cert) { - cert = CERT_FindCertByNickname(CERT_GetDefaultCertDB(), (gchar *)nickname); + cert = CERT_FindCertByNickname (CERT_GetDefaultCertDB (), (gchar *)nickname); } if (cert) { @@ -678,22 +678,22 @@ 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); - slotID = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG]); + moduleID = NS_NSS_GET_LONG (keyItem.data); + slotID = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG]); /* build the issuer/SN structure*/ - issuerSN.serialNumber.len = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG*2]); - issuerSN.derIssuer.len = NS_NSS_GET_LONG(&keyItem.data[NS_NSS_LONG*3]); + issuerSN.serialNumber.len = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG*2]); + issuerSN.derIssuer.len = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG*3]); issuerSN.serialNumber.data= &keyItem.data[NS_NSS_LONG*4]; issuerSN.derIssuer.data= &keyItem.data[NS_NSS_LONG*4+ issuerSN.serialNumber.len]; - cert = CERT_FindCertByIssuerAndSN(CERT_GetDefaultCertDB(), &issuerSN); - PR_FREEIF(keyItem.data); + cert = CERT_FindCertByIssuerAndSN (CERT_GetDefaultCertDB (), &issuerSN); + PR_FREEIF (keyItem.data); if (cert) { ECert *ecert = e_cert_new (cert); return e_cert; @@ -736,7 +736,7 @@ e_cert_db_find_cert_by_email_address (ECertDB *certdb, CERTCertList *certlist; any_cert = CERT_FindCertByNicknameOrEmailAddr ( - CERT_GetDefaultCertDB(), (gchar *) email); + CERT_GetDefaultCertDB (), (gchar *) email); if (!any_cert) { set_nss_error (error); @@ -745,32 +745,32 @@ 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(), + certlist = CERT_CreateSubjectCertList (NULL, + CERT_GetDefaultCertDB (), &any_cert->derSubject, - PR_Now(), PR_TRUE); + PR_Now (), PR_TRUE); if (!certlist) { set_nss_error (error); - CERT_DestroyCertificate(any_cert); + CERT_DestroyCertificate (any_cert); return NULL; } if (SECSuccess != CERT_FilterCertListByUsage ( certlist, certUsageEmailRecipient, PR_FALSE)) { set_nss_error (error); - CERT_DestroyCertificate(any_cert); + CERT_DestroyCertificate (any_cert); CERT_DestroyCertList (certlist); return NULL; } - if (CERT_LIST_END(CERT_LIST_HEAD(certlist), certlist)) { + if (CERT_LIST_END (CERT_LIST_HEAD (certlist), certlist)) { set_nss_error (error); - CERT_DestroyCertificate(any_cert); + CERT_DestroyCertificate (any_cert); CERT_DestroyCertList (certlist); return NULL; } - cert = e_cert_new (CERT_DupCertificate (CERT_LIST_HEAD(certlist)->cert)); + cert = e_cert_new (CERT_DupCertificate (CERT_LIST_HEAD (certlist)->cert)); CERT_DestroyCertList (certlist); CERT_DestroyCertificate (any_cert); @@ -803,7 +803,7 @@ confirm_download_ca_cert (ECertDB *cert_db, } static gboolean -handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) +handle_ca_cert_download (ECertDB *cert_db, GList *certs, GError **error) { ECert *certToShow; SECItem der; @@ -853,13 +853,13 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) cert1IssuerName = e_cert_get_issuer_name (cert1); cert1SubjectName = e_cert_get_subject_name (cert1); - if (!strcmp(cert1IssuerName, cert0SubjectName)) { + if (!strcmp (cert1IssuerName, cert0SubjectName)) { /* In this case, the first cert in the list signed the second, so the first cert is the root. Let's display the last cert in the list. */ certToShow = E_CERT (g_list_last (certs)->data); } - else if (!strcmp(cert0IssuerName, cert1SubjectName)) { + else if (!strcmp (cert0IssuerName, cert1SubjectName)) { /* In this case the second cert has signed the first cert. The first cert is the leaf, so let's display it. */ certToShow = cert0; @@ -884,10 +884,10 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) { /*PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Creating temp cert\n"));*/ - CERTCertDBHandle *certdb = CERT_GetDefaultCertDB(); - tmpCert = CERT_FindCertByDERCert(certdb, &der); + CERTCertDBHandle *certdb = CERT_GetDefaultCertDB (); + tmpCert = CERT_FindCertByDERCert (certdb, &der); if (!tmpCert) { - tmpCert = CERT_NewTempCertificate(certdb, &der, + tmpCert = CERT_NewTempCertificate (certdb, &der, NULL, PR_FALSE, PR_TRUE); } if (!tmpCert) { @@ -898,7 +898,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) } #if 0 - CERTCertificateCleaner tmpCertCleaner(tmpCert); + CERTCertificateCleaner tmpCertCleaner (tmpCert); #endif if (tmpCert->isperm) { @@ -921,7 +921,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) /*PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("trust is %d\n", trustBits));*/ - nickname = CERT_MakeCANickname(tmpCert); + nickname = CERT_MakeCANickname (tmpCert); /*PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Created nick \"%s\"\n", nickname.get()));*/ @@ -932,11 +932,11 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) trust_email, trust_objsign); - srv = CERT_AddTempCertToPerm(tmpCert, + srv = CERT_AddTempCertToPerm (tmpCert, nickname, &trust); - if (srv != SECSuccess && PORT_GetError() != SEC_ERROR_TOKEN_NOT_LOGGED_IN) { + if (srv != SECSuccess && PORT_GetError () != SEC_ERROR_TOKEN_NOT_LOGGED_IN) { set_nss_error (error); return FALSE; } @@ -952,20 +952,20 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) if (i == selCertIndex) continue; - certToShow = do_QueryElementAt(x509Certs, i); - certToShow->GetRawDER(&der.len, (PRUint8 **)&der.data); + certToShow = do_QueryElementAt (x509Certs, i); + certToShow->GetRawDER (&der.len, (PRUint8 **)&der.data); CERTCertificate *tmpCert2 = - CERT_NewTempCertificate(certdb, &der, nsnull, PR_FALSE, PR_TRUE); + CERT_NewTempCertificate (certdb, &der, nsnull, PR_FALSE, PR_TRUE); if (!tmpCert2) { NS_ASSERTION(0, "Couldn't create temp cert from DER blob\n"); 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_DestroyCertificate(tmpCert2); + nickname.Adopt (CERT_MakeCANickname (tmpCert2)); + CERT_AddTempCertToPerm (tmpCert2, NS_CONST_CAST (gchar *,nickname.get ()), + defaultTrust.GetTrust ()); + CERT_DestroyCertificate (tmpCert2); } #endif return TRUE; @@ -978,7 +978,7 @@ e_cert_db_delete_cert (ECertDB *certdb, ECert *ecert) { /* nsNSSShutDownPreventionLock locker; - nsNSSCertificate *nssCert = NS_STATIC_CAST(nsNSSCertificate*, aCert); */ + nsNSSCertificate *nssCert = NS_STATIC_CAST (nsNSSCertificate*, aCert); */ CERTCertificate *cert; @@ -998,7 +998,7 @@ e_cert_db_delete_cert (ECertDB *certdb, CERTCertTrust trust; e_cert_trust_init_with_values (&trust, 0, 0, 0); - CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), + CERT_ChangeCertTrust (CERT_GetDefaultCertDB (), cert, &trust); } @@ -1014,7 +1014,7 @@ e_cert_db_import_certs (ECertDB *certdb, GError **error) { /*nsNSSShutDownPreventionLock locker;*/ - PRArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + PRArenaPool *arena = PORT_NewArena (DER_DEFAULT_CHUNKSIZE); GList *certs = NULL; CERTDERCerts *certCollection = e_cert_db_get_certs_from_package (arena, data, length); gint i; @@ -1022,7 +1022,7 @@ e_cert_db_import_certs (ECertDB *certdb, if (!certCollection) { set_nss_error (error); - PORT_FreeArena(arena, PR_FALSE); + PORT_FreeArena (arena, PR_FALSE); return FALSE; } @@ -1036,14 +1036,14 @@ e_cert_db_import_certs (ECertDB *certdb, set_nss_error (error); g_list_foreach (certs, (GFunc)g_object_unref, NULL); g_list_free (certs); - PORT_FreeArena(arena, PR_FALSE); + PORT_FreeArena (arena, PR_FALSE); return FALSE; } certs = g_list_append (certs, cert); } switch (cert_type) { case E_CERT_CA: - rv = handle_ca_cert_download(certdb, certs, error); + rv = handle_ca_cert_download (certdb, certs, error); if (rv && imported_certs) { GList *l; @@ -1062,13 +1062,13 @@ e_cert_db_import_certs (ECertDB *certdb, default: /* We only deal with import CA certs in this method currently.*/ set_nss_error (error); - PORT_FreeArena(arena, PR_FALSE); + PORT_FreeArena (arena, PR_FALSE); rv = FALSE; } g_list_foreach (certs, (GFunc)g_object_unref, NULL); g_list_free (certs); - PORT_FreeArena(arena, PR_FALSE); + PORT_FreeArena (arena, PR_FALSE); return rv; } @@ -1085,16 +1085,16 @@ e_cert_db_import_email_cert (ECertDB *certdb, SECItem **rawCerts; gint numcerts; gint i; - PRArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + PRArenaPool *arena = PORT_NewArena (DER_DEFAULT_CHUNKSIZE); CERTDERCerts *certCollection = e_cert_db_get_certs_from_package (arena, data, length); if (!certCollection) { set_nss_error (error); - PORT_FreeArena(arena, PR_FALSE); + PORT_FreeArena (arena, PR_FALSE); return FALSE; } - cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), certCollection->rawCerts, + cert = CERT_NewTempCertificate (CERT_GetDefaultCertDB (), certCollection->rawCerts, (gchar *)NULL, PR_FALSE, PR_TRUE); if (!cert) { set_nss_error (error); @@ -1102,7 +1102,7 @@ e_cert_db_import_email_cert (ECertDB *certdb, goto loser; } numcerts = certCollection->numcerts; - rawCerts = (SECItem **) PORT_Alloc(sizeof(SECItem *) * numcerts); + rawCerts = (SECItem **) PORT_Alloc (sizeof (SECItem *) * numcerts); if (!rawCerts) { set_nss_error (error); rv = FALSE; @@ -1113,7 +1113,7 @@ e_cert_db_import_email_cert (ECertDB *certdb, rawCerts[i] = &certCollection->rawCerts[i]; } - srv = CERT_ImportCerts(CERT_GetDefaultCertDB(), certUsageEmailSigner, + srv = CERT_ImportCerts (CERT_GetDefaultCertDB (), certUsageEmailSigner, numcerts, rawCerts, NULL, PR_TRUE, PR_FALSE, NULL); if (srv != SECSuccess) { @@ -1121,7 +1121,7 @@ e_cert_db_import_email_cert (ECertDB *certdb, rv = FALSE; goto loser; } - CERT_SaveSMimeProfile(cert, NULL, NULL); + CERT_SaveSMimeProfile (cert, NULL, NULL); if (imported_certs) { *imported_certs = NULL; @@ -1137,12 +1137,12 @@ e_cert_db_import_email_cert (ECertDB *certdb, *imported_certs = g_slist_reverse (*imported_certs); } - PORT_Free(rawCerts); + PORT_Free (rawCerts); loser: if (cert) - CERT_DestroyCertificate(cert); + CERT_DestroyCertificate (cert); if (arena) - PORT_FreeArena(arena, PR_TRUE); + PORT_FreeArena (arena, PR_TRUE); return rv; } @@ -1160,16 +1160,16 @@ default_nickname (CERTCertificate *cert) PK11SlotInfo *slot=NULL; CK_OBJECT_HANDLE keyHandle; - CERTCertDBHandle *defaultcertdb = CERT_GetDefaultCertDB(); + CERTCertDBHandle *defaultcertdb = CERT_GetDefaultCertDB (); - username = CERT_GetCommonName(&cert->subject); + username = CERT_GetCommonName (&cert->subject); if (username == NULL) username = PL_strdup(""); if (username == NULL) goto loser; - caname = CERT_GetOrgName(&cert->issuer); + caname = CERT_GetOrgName (&cert->issuer); if (caname == NULL) caname = PL_strdup(""); @@ -1180,19 +1180,19 @@ default_nickname (CERTCertificate *cert) nickFmt = "%1$s's %2$s ID"; - nickname = PR_smprintf(nickFmt, username, caname); + nickname = PR_smprintf (nickFmt, username, caname); /* * We need to see if the private key exists on a token, if it does * then we need to check for nicknames that already exist on the smart * card. */ - slot = PK11_KeyForCertExists(cert, &keyHandle, NULL); + slot = PK11_KeyForCertExists (cert, &keyHandle, NULL); if (slot == NULL) { goto loser; } - if (!PK11_IsInternal(slot)) { + if (!PK11_IsInternal (slot)) { tmp = PR_smprintf("%s:%s", PK11_GetTokenName(slot), nickname); - PR_Free(nickname); + PR_Free (nickname); nickname = tmp; tmp = NULL; } @@ -1205,27 +1205,27 @@ default_nickname (CERTCertificate *cert) if (nickname == NULL) goto loser; - if (PK11_IsInternal(slot)) { + if (PK11_IsInternal (slot)) { /* look up the nickname to make sure it isn't in use already */ - dummycert = CERT_FindCertByNickname(defaultcertdb, nickname); + dummycert = CERT_FindCertByNickname (defaultcertdb, nickname); } else { /* * Check the cert against others that already live on the smart * card. */ - dummycert = PK11_FindCertFromNickname(nickname, NULL); + dummycert = PK11_FindCertFromNickname (nickname, NULL); if (dummycert != NULL) { /* * Make sure the subject names are different. */ - if (CERT_CompareName(&cert->subject, &dummycert->subject) == SECEqual) { + if (CERT_CompareName (&cert->subject, &dummycert->subject) == SECEqual) { /* * There is another certificate with the same nickname and * the same subject name on the smart card, so let's use this * nickname. */ - CERT_DestroyCertificate(dummycert); + CERT_DestroyCertificate (dummycert); dummycert = NULL; } } @@ -1234,32 +1234,32 @@ default_nickname (CERTCertificate *cert) goto done; /* found a cert, destroy it and loop */ - CERT_DestroyCertificate(dummycert); - if (tmp != nickname) PR_Free(nickname); + CERT_DestroyCertificate (dummycert); + if (tmp != nickname) PR_Free (nickname); count++; } /* end of while (1) */ loser: if (nickname) { - PR_Free(nickname); + PR_Free (nickname); } nickname = NULL; done: if (caname) { - PR_Free(caname); + PR_Free (caname); } if (username) { - PR_Free(username); + PR_Free (username); } if (slot != NULL) { - PK11_FreeSlot(slot); + PK11_FreeSlot (slot); if (nickname != NULL) { tmp = nickname; - nickname = strchr(tmp, ':'); + nickname = strchr (tmp, ':'); if (nickname != NULL) { nickname++; - nickname = PL_strdup(nickname); - PR_Free(tmp); + nickname = PL_strdup (nickname); + PR_Free (tmp); tmp = NULL; } else { nickname = tmp; @@ -1267,8 +1267,8 @@ default_nickname (CERTCertificate *cert) } } } - PR_FREEIF(tmp); - return(nickname); + PR_FREEIF (tmp); + return (nickname); } gboolean @@ -1286,7 +1286,7 @@ e_cert_db_import_user_cert (ECertDB *certdb, PRArenaPool *arena; CERTCertificate * cert=NULL; - arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); + arena = PORT_NewArena (DER_DEFAULT_CHUNKSIZE); if (arena == NULL) { set_nss_error (error); goto loser; @@ -1298,19 +1298,19 @@ e_cert_db_import_user_cert (ECertDB *certdb, goto loser; } - cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), collectArgs->rawCerts, + cert = CERT_NewTempCertificate (CERT_GetDefaultCertDB (), collectArgs->rawCerts, (gchar *)NULL, PR_FALSE, PR_TRUE); if (!cert) { set_nss_error (error); goto loser; } - slot = PK11_KeyForCertExists(cert, NULL, NULL); + slot = PK11_KeyForCertExists (cert, NULL, NULL); if (slot == NULL) { set_nss_error (error); goto loser; } - PK11_FreeSlot(slot); + PK11_FreeSlot (slot); /* pick a nickname for the cert */ if (cert->nickname) { @@ -1320,31 +1320,31 @@ e_cert_db_import_user_cert (ECertDB *certdb, nickname = cert->nickname; } else { - nickname = default_nickname(cert); + nickname = default_nickname (cert); } /* user wants to import the cert */ - slot = PK11_ImportCertForKey(cert, nickname, NULL); + slot = PK11_ImportCertForKey (cert, nickname, NULL); if (!slot) { set_nss_error (error); goto loser; } - PK11_FreeSlot(slot); + PK11_FreeSlot (slot); numCACerts = collectArgs->numcerts - 1; if (numCACerts) { CACerts = collectArgs->rawCerts+1; - if (!CERT_ImportCAChain(CACerts, numCACerts, certUsageUserCertImport)) { + if (!CERT_ImportCAChain (CACerts, numCACerts, certUsageUserCertImport)) { rv = TRUE; } } loser: if (arena) { - PORT_FreeArena(arena, PR_FALSE); + PORT_FreeArena (arena, PR_FALSE); } if (cert) { - CERT_DestroyCertificate(cert); + CERT_DestroyCertificate (cert); } return rv; } @@ -1491,10 +1491,10 @@ e_cert_db_login_to_slot (ECertDB *cert_db, PK11_InitPin (slot, "", pwd); } - PK11_SetPasswordFunc(pk11_password); + PK11_SetPasswordFunc (pk11_password); if (PK11_Authenticate (slot, PR_TRUE, NULL) != SECSuccess) { printf ("PK11_Authenticate failed (err = %d/%d)\n", - PORT_GetError(), PORT_GetError() + 0x2000); + PORT_GetError (), PORT_GetError () + 0x2000); return FALSE; } } diff --git a/smime/lib/e-cert-trust.c b/smime/lib/e-cert-trust.c index cec7e06041..5bb13318a8 100644 --- a/smime/lib/e-cert-trust.c +++ b/smime/lib/e-cert-trust.c @@ -48,7 +48,7 @@ void e_cert_trust_init (CERTCertTrust *trust) { - memset(trust, 0, sizeof(CERTCertTrust)); + memset (trust, 0, sizeof (CERTCertTrust)); } void @@ -57,10 +57,10 @@ e_cert_trust_init_with_values (CERTCertTrust *trust, guint email, guint objsign) { - memset(trust, 0, sizeof(CERTCertTrust)); - e_cert_trust_add_trust(&trust->sslFlags, ssl); - e_cert_trust_add_trust(&trust->emailFlags, email); - e_cert_trust_add_trust(&trust->objectSigningFlags, objsign); + memset (trust, 0, sizeof (CERTCertTrust)); + e_cert_trust_add_trust (&trust->sslFlags, ssl); + e_cert_trust_add_trust (&trust->emailFlags, email); + e_cert_trust_add_trust (&trust->objectSigningFlags, objsign); } void @@ -68,9 +68,9 @@ e_cert_trust_copy (CERTCertTrust *trust, CERTCertTrust *t) { if (t) - memcpy(trust, t, sizeof(CERTCertTrust)); + memcpy (trust, t, sizeof (CERTCertTrust)); else - memset(trust, 0, sizeof(CERTCertTrust)); + memset (trust, 0, sizeof (CERTCertTrust)); } void @@ -108,11 +108,11 @@ e_cert_trust_add_peer_trust (CERTCertTrust *trust, PRBool objSign) { if (ssl) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_TRUSTED); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_TRUSTED); if (email) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_TRUSTED); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_TRUSTED); if (objSign) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_TRUSTED); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_TRUSTED); } void @@ -127,19 +127,19 @@ e_cert_trust_set_ssl_trust (CERTCertTrust *trust, { trust->sslFlags = 0; if (peer || tPeer) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_VALID_PEER); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_VALID_PEER); if (tPeer) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_TRUSTED); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_TRUSTED); if (ca || tCA) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_VALID_CA); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_VALID_CA); if (tClientCA) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_TRUSTED_CLIENT_CA); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_TRUSTED_CLIENT_CA); if (tCA) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_TRUSTED_CA); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_TRUSTED_CA); if (user) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_USER); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_USER); if (warn) - e_cert_trust_add_trust(&trust->sslFlags, CERTDB_SEND_WARN); + e_cert_trust_add_trust (&trust->sslFlags, CERTDB_SEND_WARN); } void @@ -154,19 +154,19 @@ e_cert_trust_set_email_trust (CERTCertTrust *trust, { trust->emailFlags = 0; if (peer || tPeer) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_VALID_PEER); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_VALID_PEER); if (tPeer) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_TRUSTED); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_TRUSTED); if (ca || tCA) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_VALID_CA); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_VALID_CA); if (tClientCA) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_TRUSTED_CLIENT_CA); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_TRUSTED_CLIENT_CA); if (tCA) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_TRUSTED_CA); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_TRUSTED_CA); if (user) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_USER); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_USER); if (warn) - e_cert_trust_add_trust(&trust->emailFlags, CERTDB_SEND_WARN); + e_cert_trust_add_trust (&trust->emailFlags, CERTDB_SEND_WARN); } void @@ -181,19 +181,19 @@ e_cert_trust_set_objsign_trust (CERTCertTrust *trust, { trust->objectSigningFlags = 0; if (peer || tPeer) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_VALID_PEER); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_VALID_PEER); if (tPeer) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_TRUSTED); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_TRUSTED); if (ca || tCA) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_VALID_CA); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_VALID_CA); if (tClientCA) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_TRUSTED_CLIENT_CA); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_TRUSTED_CLIENT_CA); if (tCA) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_TRUSTED_CA); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_TRUSTED_CA); if (user) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_USER); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_USER); if (warn) - e_cert_trust_add_trust(&trust->objectSigningFlags, CERTDB_SEND_WARN); + e_cert_trust_add_trust (&trust->objectSigningFlags, CERTDB_SEND_WARN); } void @@ -311,9 +311,9 @@ e_cert_trust_set_user (CERTCertTrust *trust) PRBool e_cert_trust_has_any_ca (CERTCertTrust *trust) { - if (e_cert_trust_has_trust(trust->sslFlags, CERTDB_VALID_CA) || - e_cert_trust_has_trust(trust->emailFlags, CERTDB_VALID_CA) || - e_cert_trust_has_trust(trust->objectSigningFlags, CERTDB_VALID_CA)) + if (e_cert_trust_has_trust (trust->sslFlags, CERTDB_VALID_CA) || + e_cert_trust_has_trust (trust->emailFlags, CERTDB_VALID_CA) || + e_cert_trust_has_trust (trust->objectSigningFlags, CERTDB_VALID_CA)) return PR_TRUE; return PR_FALSE; @@ -364,9 +364,9 @@ e_cert_trust_has_peer (CERTCertTrust *trust, PRBool e_cert_trust_has_any_user (CERTCertTrust *trust) { - if (e_cert_trust_has_trust(trust->sslFlags, CERTDB_USER) || - e_cert_trust_has_trust(trust->emailFlags, CERTDB_USER) || - e_cert_trust_has_trust(trust->objectSigningFlags, CERTDB_USER)) + if (e_cert_trust_has_trust (trust->sslFlags, CERTDB_USER) || + e_cert_trust_has_trust (trust->emailFlags, CERTDB_USER) || + e_cert_trust_has_trust (trust->objectSigningFlags, CERTDB_USER)) return PR_TRUE; return PR_FALSE; diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c index 1dee4d4a65..6a6fef462e 100644 --- a/smime/lib/e-cert.c +++ b/smime/lib/e-cert.c @@ -118,7 +118,7 @@ e_cert_dispose (GObject *object) if (ec->priv->serial_number) PORT_Free (ec->priv->serial_number); - g_free(ec->priv->usage_string); + g_free (ec->priv->usage_string); if (ec->priv->sha1_fingerprint) PORT_Free (ec->priv->sha1_fingerprint); @@ -131,12 +131,12 @@ e_cert_dispose (GObject *object) if (ec->priv->delete) { printf ("attempting to delete cert marked for deletion\n"); if (e_cert_get_cert_type (ec) == E_CERT_USER) { - PK11_DeleteTokenCertAndKey(ec->priv->cert, NULL); - } else if (!PK11_IsReadOnly(ec->priv->cert->slot)) { + PK11_DeleteTokenCertAndKey (ec->priv->cert, NULL); + } else if (!PK11_IsReadOnly (ec->priv->cert->slot)) { /* If the list of built-ins does contain a non-removable copy of this certificate, our call will not remove the certificate permanently, but rather remove all trust. */ - SEC_DeletePermCertificate(ec->priv->cert); + SEC_DeletePermCertificate (ec->priv->cert); } } @@ -157,7 +157,7 @@ e_cert_class_init (ECertClass *klass) { GObjectClass *object_class; - object_class = G_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_ref (PARENT_TYPE); @@ -241,16 +241,16 @@ 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, + memset (fingerprint, 0, sizeof fingerprint); + 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, + memset (fingerprint, 0, sizeof fingerprint); + PK11_HashBuf (SEC_OID_MD5, fingerprint, cert->priv->cert->derCert.data, cert->priv->cert->derCert.len); fpItem.data = fingerprint; @@ -280,7 +280,7 @@ e_cert_new_from_der (gchar *data, guint32 len) return NULL; if (cert->dbhandle == NULL) - cert->dbhandle = CERT_GetDefaultCertDB(); + cert->dbhandle = CERT_GetDefaultCertDB (); return e_cert_new (cert); } @@ -416,7 +416,7 @@ static struct { }; const gchar * -e_cert_get_usage(ECert *cert) +e_cert_get_usage (ECert *cert) { if (cert->priv->usage_string == NULL) { gint i; @@ -427,12 +427,12 @@ e_cert_get_usage(ECert *cert) if (icert->keyUsage & usageinfo[i].bit) { if (str->len != 0) g_string_append(str, ", "); - g_string_append(str, _(usageinfo[i].text)); + g_string_append (str, _(usageinfo[i].text)); } } cert->priv->usage_string = str->str; - g_string_free(str, FALSE); + g_string_free (str, FALSE); } return cert->priv->usage_string; @@ -469,10 +469,10 @@ e_cert_get_chain (ECert *ecert) l = g_list_append (l, ecert); - if (SECITEM_CompareItem(&cert->derIssuer, &cert->derSubject) == SECEqual) + if (SECITEM_CompareItem (&cert->derIssuer, &cert->derSubject) == SECEqual) break; - next_cert = CERT_FindCertIssuer (cert, PR_Now(), certUsageSSLClient); + next_cert = CERT_FindCertIssuer (cert, PR_Now (), certUsageSSLClient); if (!next_cert) break; @@ -484,9 +484,9 @@ e_cert_get_chain (ECert *ecert) } ECert * -e_cert_get_ca_cert(ECert *ecert) +e_cert_get_ca_cert (ECert *ecert) { - CERTCertificate *cert, *next = e_cert_get_internal_cert(ecert), *internal; + CERTCertificate *cert, *next = e_cert_get_internal_cert (ecert), *internal; cert = next; internal = cert; @@ -495,13 +495,13 @@ e_cert_get_ca_cert(ECert *ecert) CERT_DestroyCertificate (cert); cert = next; - next = CERT_FindCertIssuer (cert, PR_Now(), certUsageAnyCA); + next = CERT_FindCertIssuer (cert, PR_Now (), certUsageAnyCA); } while (next && next != cert); if (cert == internal) - return g_object_ref(ecert); + return g_object_ref (ecert); else - return e_cert_new(cert); + return e_cert_new (cert); } static gboolean @@ -509,7 +509,7 @@ get_int_value (SECItem *versionItem, unsigned long *version) { SECStatus srv; - srv = SEC_ASN1DecodeInteger(versionItem,version); + srv = SEC_ASN1DecodeInteger (versionItem,version); if (srv != SECSuccess) { g_warning ("could not decode version of cert"); return FALSE; @@ -565,7 +565,7 @@ process_serial_number_der (SECItem *serialItem, e_asn1_object_set_display_name (item, _("Serial Number")); - serialNumber = CERT_Hexify(serialItem, 1); + serialNumber = CERT_Hexify (serialItem, 1); e_asn1_object_set_display_value (item, serialNumber); PORT_Free (serialNumber); /* XXX the right free to use? */ @@ -622,7 +622,7 @@ get_default_oid_format (SECItem *oid, static gboolean get_oid_text (SECItem *oid, gchar **text) { - SECOidTag oidTag = SECOID_FindOIDTag(oid); + SECOidTag oidTag = SECOID_FindOIDTag (oid); gchar *temp; switch (oidTag) { @@ -765,7 +765,7 @@ static gboolean process_subject_public_key_info (CERTSubjectPublicKeyInfo *spki, EASN1Object *parentSequence) { - EASN1Object *spkiSequence = e_asn1_object_new(); + EASN1Object *spkiSequence = e_asn1_object_new (); EASN1Object *sequenceItem; EASN1Object *printableItem; SECItem data; @@ -810,8 +810,8 @@ process_ns_cert_type_extensions (SECItem *extData, decoded.data = NULL; decoded.len = 0; - if (SECSuccess != SEC_ASN1DecodeItem(NULL, &decoded, - SEC_ASN1_GET(SEC_BitStringTemplate), extData)) { + if (SECSuccess != SEC_ASN1DecodeItem (NULL, &decoded, + SEC_ASN1_GET (SEC_BitStringTemplate), extData)) { g_string_append (text, _("Error: Unable to process extension")); return TRUE; } @@ -859,8 +859,8 @@ process_key_usage_extensions (SECItem *extData, GString *text) decoded.data = NULL; decoded.len = 0; - if (SECSuccess != SEC_ASN1DecodeItem(NULL, &decoded, - SEC_ASN1_GET(SEC_BitStringTemplate), extData)) { + if (SECSuccess != SEC_ASN1DecodeItem (NULL, &decoded, + SEC_ASN1_GET (SEC_BitStringTemplate), extData)) { g_string_append (text, _("Error: Unable to process extension")); return TRUE; } @@ -930,7 +930,7 @@ process_single_extension (CERTCertExtension *extension, GString *str = g_string_new (""); gchar *text; EASN1Object *extensionItem; - SECOidTag oidTag = SECOID_FindOIDTag(&extension->id); + SECOidTag oidTag = SECOID_FindOIDTag (&extension->id); get_oid_text (&extension->id, &text); @@ -1027,14 +1027,14 @@ process_name (CERTName *name, gchar **value) return FALSE; /* This function returns a string in UTF8 format. */ - decodeItem = CERT_DecodeAVAValue(&ava->value); + decodeItem = CERT_DecodeAVAValue (&ava->value); if (!decodeItem) { return FALSE; } avavalue = g_string_new_len ((gchar *)decodeItem->data, decodeItem->len); - SECITEM_FreeItem(decodeItem, PR_TRUE); + SECITEM_FreeItem (decodeItem, PR_TRUE); /* Translators: This string is used in Certificate details for fields like Issuer or Subject, which shows the field name on the left and its respective value @@ -1111,28 +1111,28 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq) g_object_unref (subitem); #ifdef notyet - nsCOMPtr<nsIASN1Sequence> validitySequence = new nsNSSASN1Sequence(); + nsCOMPtr<nsIASN1Sequence> validitySequence = new nsNSSASN1Sequence (); nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpValidity").get(), text); - validitySequence->SetDisplayName(text); - asn1Objects->AppendElement(validitySequence, PR_FALSE); + validitySequence->SetDisplayName (text); + asn1Objects->AppendElement (validitySequence, PR_FALSE); nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpNotBefore").get(), text); nsCOMPtr<nsIX509CertValidity> validityData; - GetValidity(getter_AddRefs(validityData)); + GetValidity (getter_AddRefs (validityData)); PRTime notBefore, notAfter; - validityData->GetNotBefore(¬Before); - validityData->GetNotAfter(¬After); + validityData->GetNotBefore (¬Before); + validityData->GetNotAfter (¬After); validityData = 0; - rv = ProcessTime(notBefore, text.get(), validitySequence); - if (NS_FAILED(rv)) + rv = ProcessTime (notBefore, text.get (), validitySequence); + if (NS_FAILED (rv)) return rv; nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpNotAfter").get(), text); - rv = ProcessTime(notAfter, text.get(), validitySequence); - if (NS_FAILED(rv)) + rv = ProcessTime (notAfter, text.get (), validitySequence); + if (NS_FAILED (rv)) return rv; #endif @@ -1258,13 +1258,13 @@ e_cert_mark_for_deletion (ECert *cert) #if 0 /* make sure user is logged in to the token */ - nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext(); + nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext (); #endif - if (PK11_NeedLogin(cert->priv->cert->slot) - && !PK11_NeedUserInit(cert->priv->cert->slot) - && !PK11_IsInternal(cert->priv->cert->slot)) { - if (SECSuccess != PK11_Authenticate(cert->priv->cert->slot, PR_TRUE, NULL)) { + if (PK11_NeedLogin (cert->priv->cert->slot) + && !PK11_NeedUserInit (cert->priv->cert->slot) + && !PK11_IsInternal (cert->priv->cert->slot)) { + if (SECSuccess != PK11_Authenticate (cert->priv->cert->slot, PR_TRUE, NULL)) { return FALSE; } } @@ -1285,7 +1285,7 @@ e_cert_get_cert_type (ECert *ecert) if (e_cert_trust_has_any_user (cert->trust)) return E_CERT_USER; if (e_cert_trust_has_any_ca (cert->trust) - || CERT_IsCACert(cert,NULL)) + || CERT_IsCACert (cert,NULL)) return E_CERT_CA; if (e_cert_trust_has_peer (cert->trust, PR_TRUE, PR_FALSE, PR_FALSE)) return E_CERT_SITE; diff --git a/smime/lib/e-cert.h b/smime/lib/e-cert.h index 8c70bcded2..3a092a71d4 100644 --- a/smime/lib/e-cert.h +++ b/smime/lib/e-cert.h @@ -89,7 +89,7 @@ PRTime e_cert_get_issued_on_time (ECert *cert); const gchar * e_cert_get_issued_on (ECert *cert); PRTime e_cert_get_expires_on_time (ECert *cert); const gchar * e_cert_get_expires_on (ECert *cert); -const gchar * e_cert_get_usage(ECert *cert); +const gchar * e_cert_get_usage (ECert *cert); const gchar * e_cert_get_serial_number (ECert *cert); const gchar * e_cert_get_sha1_fingerprint (ECert *cert); diff --git a/smime/lib/e-pkcs12.c b/smime/lib/e-pkcs12.c index 7f5b49d37f..d73b3c96af 100644 --- a/smime/lib/e-pkcs12.c +++ b/smime/lib/e-pkcs12.c @@ -72,9 +72,9 @@ struct _EPKCS12Private { static GObjectClass *parent_class; /* 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); +static gboolean handle_error (gint myerr); #define PKCS12_BUFFER_SIZE 2048 #define PKCS12_RESTORE_OK 1 @@ -107,7 +107,7 @@ e_pkcs12_class_init (EPKCS12Class *klass) { GObjectClass *object_class; - object_class = G_OBJECT_CLASS(klass); + object_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_ref (PARENT_TYPE); @@ -179,7 +179,7 @@ input_to_decoder (SEC_PKCS12DecoderContext *dcx, const gchar *path, GError **err } /* feed the file data into the decoder */ - srv = SEC_PKCS12DecoderUpdate(dcx, + srv = SEC_PKCS12DecoderUpdate (dcx, (guchar *) buf, amount); if (srv) { @@ -212,7 +212,7 @@ prompt_for_password (gchar *title, gchar *prompt, SECItem *pwd) guchar *outptr; gunichar2 c; - SECITEM_AllocItem(NULL, pwd, sizeof (gunichar2) * (len + 1)); + SECITEM_AllocItem (NULL, pwd, sizeof (gunichar2) * (len + 1)); outptr = pwd->data; while (inptr && (c = (gunichar2) (g_utf8_get_char (inptr) & 0xffff))) { @@ -298,16 +298,16 @@ import_from_file_helper (EPKCS12 *pkcs12, PK11SlotInfo *slot, We should use that error code instead of inventing a new one for every error possible. */ if (srv != SECSuccess) { - if (SEC_ERROR_BAD_PASSWORD == PORT_GetError()) { + if (SEC_ERROR_BAD_PASSWORD == PORT_GetError ()) { *aWantRetry = TRUE; } - handle_error(PKCS12_NSS_ERROR); + handle_error (PKCS12_NSS_ERROR); } else if (!rv) { - handle_error(PKCS12_RESTORE_FAILED); + handle_error (PKCS12_RESTORE_FAILED); } /* finish the decoder */ if (dcx) - SEC_PKCS12DecoderFinish(dcx); + SEC_PKCS12DecoderFinish (dcx); return TRUE; } @@ -321,7 +321,7 @@ e_pkcs12_import_from_file (EPKCS12 *pkcs12, const gchar *path, GError **error) printf ("importing pkcs12 from '%s'\n", path); - slot = PK11_GetInternalKeySlot(); + slot = PK11_GetInternalKeySlot (); if (!e_cert_db_login_to_slot (e_cert_db_peek (), slot)) return FALSE; @@ -345,7 +345,7 @@ e_pkcs12_export_to_file (EPKCS12 *pkcs12, /* what to do when the nickname collides with one already in the db. TODO: not handled, throw a dialog allowing the nick to be changed? */ static SECItem * PR_CALLBACK -nickname_collision(SECItem *oldNick, PRBool *cancel, gpointer wincx) +nickname_collision (SECItem *oldNick, PRBool *cancel, gpointer wincx) { /* nsNSSShutDownPreventionLock locker; */ gint count = 1; @@ -391,24 +391,24 @@ nickname_collision(SECItem *oldNick, PRBool *cancel, gpointer wincx) g_free (nickname); nickname = g_strdup (default_nickname); } - cert = CERT_FindCertByNickname(CERT_GetDefaultCertDB(), + cert = CERT_FindCertByNickname (CERT_GetDefaultCertDB (), nickname); if (!cert) { break; } - CERT_DestroyCertificate(cert); + CERT_DestroyCertificate (cert); count++; } new_nick = PR_Malloc (sizeof (SECItem)); new_nick->type = siAsciiString; new_nick->data = (guchar *)nickname; - new_nick->len = strlen((gchar *)new_nick->data); + new_nick->len = strlen ((gchar *)new_nick->data); return new_nick; } static gboolean -handle_error(gint myerr) +handle_error (gint myerr) { printf ("handle_error (%d)\n", myerr); |