diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-11-15 06:04:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-11-15 06:04:21 +0800 |
commit | 9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91 (patch) | |
tree | 2e1e96f33404781354c422a7e9beaf458ebeb655 /smime | |
parent | 7e8f8bb9e5167b0219b48ab3e8062080d3740b0a (diff) | |
download | gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.gz gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.zst gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.zip |
** Remove trailing whitespace from source code.
2007-11-14 Matthew Barnes <mbarnes@redhat.com>
** Remove trailing whitespace from source code.
svn path=/trunk/; revision=34537
Diffstat (limited to 'smime')
-rw-r--r-- | smime/gui/cert-trust-dialog.c | 4 | ||||
-rw-r--r-- | smime/gui/certificate-manager.c | 22 | ||||
-rw-r--r-- | smime/gui/certificate-viewer.c | 8 | ||||
-rw-r--r-- | smime/gui/e-cert-selector.c | 12 | ||||
-rw-r--r-- | smime/lib/e-asn1-object.c | 26 | ||||
-rw-r--r-- | smime/lib/e-asn1-object.h | 4 | ||||
-rw-r--r-- | smime/lib/e-cert-db.c | 124 | ||||
-rw-r--r-- | smime/lib/e-cert-trust.c | 52 | ||||
-rw-r--r-- | smime/lib/e-cert-trust.h | 24 | ||||
-rw-r--r-- | smime/lib/e-cert.c | 80 | ||||
-rw-r--r-- | smime/lib/e-pkcs12.c | 44 |
11 files changed, 200 insertions, 200 deletions
diff --git a/smime/gui/cert-trust-dialog.c b/smime/gui/cert-trust-dialog.c index 43ab1b856a..9de35ae073 100644 --- a/smime/gui/cert-trust-dialog.c +++ b/smime/gui/cert-trust-dialog.c @@ -92,7 +92,7 @@ ctd_response(GtkWidget *w, guint id, CertTrustDialogData *data) 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; @@ -105,7 +105,7 @@ ctd_response(GtkWidget *w, guint id, CertTrustDialogData *data) trust_ssl, trust_email, trust_objsign); - + CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), icert, &trust); } diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index e417407c42..8a3c64321c 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -154,7 +154,7 @@ import_your (GtkWidget *widget, CertificateManagerData *cfm) if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (filesel))) { filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); - + if (e_cert_db_import_pkcs12_file (e_cert_db_peek (), filename, NULL /* XXX */)) { /* there's no telling how many certificates were added during the import, @@ -201,7 +201,7 @@ delete_your (GtkWidget *widget, CertificateManagerData *cfm) g_object_unref (cert); } } - + } static void @@ -447,7 +447,7 @@ delete_contact (GtkWidget *widget, CertificateManagerData *cfm) g_object_unref (cert); } } - + } static void @@ -527,7 +527,7 @@ static void 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)), NULL, &iter)) { @@ -551,7 +551,7 @@ static void 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)), NULL, &iter)) { @@ -570,7 +570,7 @@ edit_ca (GtkWidget *widget, CertificateManagerData *cfm) 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; CERTCertTrust trust; @@ -584,7 +584,7 @@ edit_ca (GtkWidget *widget, CertificateManagerData *cfm) trust_ssl, trust_email, trust_objsign); - + CERT_ChangeCertTrust (CERT_GetDefaultCertDB(), icert, &trust); } @@ -670,7 +670,7 @@ delete_ca (GtkWidget *widget, CertificateManagerData *cfm) g_object_unref (cert); } } - + } static void @@ -736,7 +736,7 @@ add_user_cert (CertificateManagerData *cfm, ECert *cert) if (!parent_iter) { /* 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); @@ -780,7 +780,7 @@ add_contact_cert (CertificateManagerData *cfm, ECert *cert) if (!parent_iter) { /* 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); @@ -823,7 +823,7 @@ add_ca_cert (CertificateManagerData *cfm, ECert *cert) /* 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); diff --git a/smime/gui/certificate-viewer.c b/smime/gui/certificate-viewer.c index 2580287042..342f3d8c95 100644 --- a/smime/gui/certificate-viewer.c +++ b/smime/gui/certificate-viewer.c @@ -115,7 +115,7 @@ fill_in_general (CertificateViewerData *cvm_data, ECert *cert) else { gtk_label_set_markup (GTK_LABEL (label), NOT_PART_OF_CERT_MARKUP); } - + label = glade_xml_get_widget (cvm_data->gui, "issued-by-ou"); if (e_cert_get_issuer_org_unit (cert)) { gtk_label_set_text (GTK_LABEL (label), e_cert_get_issuer_org_unit (cert)); @@ -215,7 +215,7 @@ hierarchy_selection_changed (GtkTreeSelection *selection, CertificateViewerData /* and blow away the field value */ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (cvm_data->field_text)), "", 0); - } + } } static void @@ -242,7 +242,7 @@ fields_selection_changed (GtkTreeSelection *selection, CertificateViewerData *cv 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); @@ -342,7 +342,7 @@ certificate_viewer_show (ECert *cert) gtk_window_set_title (GTK_WINDOW (cvm_data->dialog), title); - + g_free (title); fill_in_general (cvm_data, cert); diff --git a/smime/gui/e-cert-selector.c b/smime/gui/e-cert-selector.c index f9ca319509..d41be35ad6 100644 --- a/smime/gui/e-cert-selector.c +++ b/smime/gui/e-cert-selector.c @@ -129,13 +129,13 @@ ecs_cert_changed(GtkWidget *w, ECertSelector *ecs) /** * e_cert_selector_new: - * @type: - * @currentid: - * + * @type: + * @currentid: + * * Create a new ECertSelector dialog. @type specifies which type of cert to * be selected, E_CERT_SELECTOR_SIGNER for signing certs, and * E_CERT_SELECTOR_RECIPIENT for encrypting certs. - * + * * @currentid is the nickname of the cert currently selected for this user. * * You only need to connect to a single signal "selected" which will @@ -199,7 +199,7 @@ e_cert_selector_new(int type, const char *currentid) && ((node->cert->nickname != NULL && strcmp(node->cert->nickname, currentid) == 0) || (node->cert->emailAddr != NULL && strcmp(node->cert->emailAddr, currentid) == 0))) active = n; - + n++; } @@ -236,7 +236,7 @@ e_cert_selector_finalise(GObject *o) if (ecs->priv->certlist) CERT_DestroyCertList(ecs->priv->certlist); - + g_free(ecs->priv); ((GObjectClass *)e_cert_selector_parent_class)->finalize(o); diff --git a/smime/lib/e-asn1-object.c b/smime/lib/e-asn1-object.c index fe86d0ece5..6a30c223c9 100644 --- a/smime/lib/e-asn1-object.c +++ b/smime/lib/e-asn1-object.c @@ -28,23 +28,23 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is the Netscape security libraries. - * + * * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are + * Communications Corporation. Portions created by Netscape are * Copyright (C) 2000 Netscape Communications Corporation. All * Rights Reserved. - * + * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and @@ -148,7 +148,7 @@ e_asn1_object_get_type (void) /* This function is used to interpret an integer that was encoded in a DER buffer. This function is used - when converting a DER buffer into a nsIASN1Object + when converting a DER buffer into a nsIASN1Object structure. This interprets the buffer in data as defined by the DER (Distinguised Encoding Rules) of ASN1. @@ -182,7 +182,7 @@ get_integer_256 (unsigned char *data, unsigned int nb) item. It looks to see if this a multibyte length and then interprets the buffer accordingly to get the actual length value. This funciton is used mostly while parsing the DER headers. - + A DER encoded item has the following structure: <tag><length<data consisting of lenght bytes> @@ -193,7 +193,7 @@ get_der_item_length (unsigned char *data, unsigned char *end, { unsigned char lbyte = *data++; PRInt32 length = -1; - + *indefinite = FALSE; if (lbyte >= 0x80) { /* Multibyte length */ @@ -202,7 +202,7 @@ get_der_item_length (unsigned char *data, unsigned char *end, return -1; } if (nb > 0) { - + if ((data+nb) > end) { return -1; } @@ -216,7 +216,7 @@ get_der_item_length (unsigned char *data, unsigned char *end, *bytesUsed = nb+1; } else { length = lbyte; - *bytesUsed = 1; + *bytesUsed = 1; } return length; } @@ -282,7 +282,7 @@ build_from_der (EASN1Object *parent, char *data, char *end) asn1object = e_asn1_object_new (); asn1object->priv->tag = tagnum; asn1object->priv->type = type; - + if (!build_from_der (asn1object, data, (len == 0) ? end : data + len)) { g_object_unref (asn1object); return FALSE; diff --git a/smime/lib/e-asn1-object.h b/smime/lib/e-asn1-object.h index 99b422806a..251e4e80c9 100644 --- a/smime/lib/e-asn1-object.h +++ b/smime/lib/e-asn1-object.h @@ -47,7 +47,7 @@ enum { E_ASN1_OBJECT_TYPE_INTEGER = 2, E_ASN1_OBJECT_TYPE_BIT_STRING = 3, E_ASN1_OBJECT_TYPE_OCTET_STRING = 4, - E_ASN1_OBJECT_TYPE_NULL = 5, + E_ASN1_OBJECT_TYPE_NULL = 5, E_ASN1_OBJECT_TYPE_OBJECT_ID = 6, E_ASN1_OBJECT_TYPE_ENUMERATED = 10, E_ASN1_OBJECT_TYPE_UTF8_STRING = 12, @@ -59,7 +59,7 @@ enum { E_ASN1_OBJECT_TYPE_UTC_TIME = 23, E_ASN1_OBJECT_TYPE_GEN_TIME = 24, E_ASN1_OBJECT_TYPE_VISIBLE_STRING = 26, - E_ASN1_OBJECT_TYPE_UNIVERSAL_STRING = 28, + E_ASN1_OBJECT_TYPE_UNIVERSAL_STRING = 28, E_ASN1_OBJECT_TYPE_BMP_STRING = 30, E_ASN1_OBJECT_TYPE_HIGH_TAG_NUMBER = 31, E_ASN1_OBJECT_TYPE_CONTEXT_SPECIFIC = 32, diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index 0655f99424..91301052af 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -28,23 +28,23 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is the Netscape security libraries. - * + * * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are + * Communications Corporation. Portions created by Netscape are * Copyright (C) 2000 Netscape Communications Corporation. All * Rights Reserved. - * + * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and @@ -234,11 +234,11 @@ install_loadable_roots (void) SECMODListLock *lock = SECMOD_GetDefaultModuleListLock (); SECMODModule *RootsModule = NULL; int i; - + SECMOD_GetReadLock (lock); while (!RootsModule && list) { SECMODModule *module = list->module; - + for (i = 0; i < module->slotCount; i++) { PK11SlotInfo *slot = module->slots[i]; if (PK11_IsPresent (slot)) { @@ -248,11 +248,11 @@ install_loadable_roots (void) } } } - + list = list->next; } SECMOD_ReleaseReadLock (lock); - + if (RootsModule) { /* Check version, and unload module if it is too old */ CK_INFO info; @@ -265,24 +265,24 @@ install_loadable_roots (void) * define the version we expect to have. * Later version are fine. * Older versions are not ok, and we will replace with our own version. - */ + */ if ((info.libraryVersion.major < NSS_BUILTINS_LIBRARY_VERSION_MAJOR) || (info.libraryVersion.major == NSS_BUILTINS_LIBRARY_VERSION_MAJOR && info.libraryVersion.minor < NSS_BUILTINS_LIBRARY_VERSION_MINOR)) { PRInt32 modType; - + SECMOD_DeleteModule (RootsModule->commonName, &modType); - + RootsModule = NULL; } } } - + if (!RootsModule) { #ifndef G_OS_WIN32 /* grovel in various places for mozilla's built-in cert module. - + XXX yes this is gross. *sigh* */ char *paths_to_check[] = { @@ -294,10 +294,10 @@ install_loadable_roots (void) "/opt/mozilla/lib", "/opt/mozilla/lib/mozilla" }; - + for (i = 0; i < G_N_ELEMENTS (paths_to_check); i ++) { char *dll_path = g_module_build_path (paths_to_check [i], "nssckbi"); - + if (g_file_test (dll_path, G_FILE_TEST_EXISTS)) { PRInt32 modType; @@ -308,7 +308,7 @@ install_loadable_roots (void) g_free (dll_path); break; } - + g_free (dll_path); } #else @@ -464,7 +464,7 @@ e_cert_db_find_cert_by_key (ECertDB *certdb, } dummy = NSSBase64_DecodeBuffer(NULL, &keyItem, db_key, - (PRUint32)PL_strlen(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); @@ -543,7 +543,7 @@ e_cert_db_find_cert_by_email_address (ECertDB *certdb, /* XXX free certlist? */ return NULL; } - + if (CERT_LIST_END(CERT_LIST_HEAD(certlist), certlist)) { /* XXX gerror */ CERT_DestroyCertificate(any_cert); @@ -617,7 +617,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) const char* cert0IssuerName; const char* cert1SubjectName; const char* cert1IssuerName; - + cert0 = E_CERT (certs->data); cert1 = E_CERT (certs->next->data); @@ -629,16 +629,16 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) 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 + 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)) { - /* In this case the second cert has signed the first cert. The + /* In this case the second cert has signed the first cert. The first cert is the leaf, so let's display it. */ certToShow = cert0; } else { - /* It's not a chain, so let's just show the first one in the + /* It's not a chain, so let's just show the first one in the downloaded list. */ certToShow = cert0; } @@ -692,7 +692,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); /*PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Created nick \"%s\"\n", nickname.get()));*/ @@ -706,7 +706,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) srv = CERT_AddTempCertToPerm(tmpCert, nickname, - &trust); + &trust); if (srv != SECSuccess) { /* XXX gerror */ @@ -727,7 +727,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) certToShow = do_QueryElementAt(x509Certs, i); certToShow->GetRawDER(&der.len, (PRUint8 **)&der.data); - CERTCertificate *tmpCert2 = + CERTCertificate *tmpCert2 = CERT_NewTempCertificate(certdb, &der, nsnull, PR_FALSE, PR_TRUE); if (!tmpCert2) { @@ -735,7 +735,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) continue; /* Let's try to import the rest of 'em */ } nickname.Adopt(CERT_MakeCANickname(tmpCert2)); - CERT_AddTempCertToPerm(tmpCert2, NS_CONST_CAST(char*,nickname.get()), + CERT_AddTempCertToPerm(tmpCert2, NS_CONST_CAST(char*,nickname.get()), defaultTrust.GetTrust()); CERT_DestroyCertificate(tmpCert2); } @@ -762,15 +762,15 @@ e_cert_db_delete_cert (ECertDB *certdb, if (cert->slot && e_cert_get_cert_type (ecert) != E_CERT_USER) { /* To delete a cert of a slot (builtin, most likely), mark it as completely untrusted. This way we keep a copy cached in the - local database, and next time we try to load it off of the - external token/slot, we'll know not to trust it. We don't + local database, and next time we try to load it off of the + external token/slot, we'll know not to trust it. We don't want to do that with user certs, because a user may re-store - the cert onto the card again at which point we *will* want to + the cert onto the card again at which point we *will* want to trust that cert if it chains up properly. */ CERTCertTrust trust; e_cert_trust_init_with_values (&trust, 0, 0, 0); - srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), + srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), cert, &trust); } @@ -802,7 +802,7 @@ e_cert_db_import_certs (ECertDB *certdb, for (i=0; i<certCollection->numcerts; i++) { SECItem *currItem = &certCollection->rawCerts[i]; ECert *cert; - + cert = e_cert_new_from_der ((char*)currItem->data, currItem->len); if (!cert) { /* XXX gerror */ @@ -822,7 +822,7 @@ e_cert_db_import_certs (ECertDB *certdb, /* XXX gerror */ PORT_FreeArena(arena, PR_FALSE); rv = FALSE; - } + } g_list_foreach (certs, (GFunc)g_object_unref, NULL); g_list_free (certs); @@ -870,7 +870,7 @@ e_cert_db_import_email_cert (ECertDB *certdb, for ( i = 0; i < numcerts; i++ ) { rawCerts[i] = &certCollection->rawCerts[i]; } - + srv = CERT_ImportCerts(CERT_GetDefaultCertDB(), certUsageEmailSigner, numcerts, rawCerts, NULL, PR_TRUE, PR_FALSE, NULL); @@ -884,14 +884,14 @@ e_cert_db_import_email_cert (ECertDB *certdb, loser: if (cert) CERT_DestroyCertificate(cert); - if (arena) + if (arena) PORT_FreeArena(arena, PR_TRUE); return rv; } static char * default_nickname (CERTCertificate *cert) -{ +{ /* nsNSSShutDownPreventionLock locker; */ char *username = NULL; char *caname = NULL; @@ -906,19 +906,19 @@ default_nickname (CERTCertificate *cert) CERTCertDBHandle *defaultcertdb = CERT_GetDefaultCertDB(); username = CERT_GetCommonName(&cert->subject); - if ( username == NULL ) + if ( username == NULL ) username = PL_strdup(""); - if ( username == NULL ) + if ( username == NULL ) goto loser; - + caname = CERT_GetOrgName(&cert->issuer); - if ( caname == NULL ) + if ( caname == NULL ) caname = PL_strdup(""); - - if ( caname == NULL ) + + if ( caname == NULL ) goto loser; - + count = 1; nickFmt = "%1$s's %2$s ID"; @@ -940,28 +940,28 @@ default_nickname (CERTCertificate *cert) tmp = NULL; } tmp = nickname; - while ( 1 ) { + while ( 1 ) { if ( count > 1 ) { nickname = PR_smprintf("%s #%d", tmp, count); } - - if ( nickname == NULL ) + + if ( nickname == NULL ) goto loser; - + if (PK11_IsInternal(slot)) { /* look up the nickname to make sure it isn't in use already */ dummycert = CERT_FindCertByNickname(defaultcertdb, nickname); - + } else { /* - * Check the cert against others that already live on the smart + * Check the cert against others that already live on the smart * card. */ dummycert = PK11_FindCertFromNickname(nickname, NULL); if (dummycert != NULL) { /* * Make sure the subject names are different. - */ + */ if (CERT_CompareName(&cert->subject, &dummycert->subject) == SECEqual) { /* * There is another certificate with the same nickname and @@ -973,9 +973,9 @@ default_nickname (CERTCertificate *cert) } } } - if ( dummycert == NULL ) + if ( dummycert == NULL ) goto done; - + /* found a cert, destroy it and loop */ CERT_DestroyCertificate(dummycert); if (tmp != nickname) PR_Free(nickname); @@ -1081,7 +1081,7 @@ e_cert_db_import_user_cert (ECertDB *certdb, rv = TRUE; } } - + loser: if (arena) { PORT_FreeArena(arena, PR_FALSE); @@ -1120,7 +1120,7 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db, case E_CERT_SITE: /* good */ break; - + default: /* not supported (yet) */ /* XXX gerror */ @@ -1138,7 +1138,7 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db, close (fd); return FALSE; } - + buf = g_malloc (sb.st_size); if (!buf) { /* XXX gerror */ @@ -1149,7 +1149,7 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db, bytes_read = read (fd, buf, sb.st_size); close (fd); - + if (bytes_read != sb.st_size) { /* XXX gerror */ rv = FALSE; @@ -1169,7 +1169,7 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db, case E_CERT_CONTACT: rv = e_cert_db_import_email_cert (cert_db, buf, bytes_read, error); break; - + default: rv = FALSE; break; @@ -1177,7 +1177,7 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db, } g_free (buf); - return rv; + return rv; } gboolean @@ -1277,7 +1277,7 @@ e_cert_db_get_certs_from_package (PRArenaPool *arena, guint32 length) { /*nsNSSShutDownPreventionLock locker;*/ - CERTDERCerts *collectArgs = + CERTDERCerts *collectArgs = (CERTDERCerts *)PORT_ArenaZAlloc(arena, sizeof(CERTDERCerts)); SECStatus sec_rv; @@ -1286,7 +1286,7 @@ e_cert_db_get_certs_from_package (PRArenaPool *arena, collectArgs->arena = arena; sec_rv = CERT_DecodeCertPackage(data, - length, collect_certs, + length, collect_certs, (void *)collectArgs); if (sec_rv != SECSuccess) diff --git a/smime/lib/e-cert-trust.c b/smime/lib/e-cert-trust.c index d7de98bbc2..b51f24f316 100644 --- a/smime/lib/e-cert-trust.c +++ b/smime/lib/e-cert-trust.c @@ -28,27 +28,27 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is the Netscape security libraries. - * + * * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are + * Communications Corporation. Portions created by Netscape are * Copyright (C) 2000 Netscape Communications Corporation. All * Rights Reserved. - * + * * Contributor(s): * Ian McGreer <mcgreer@netscape.com> * Javier Delgadillo <javi@netscape.com> - * + * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and @@ -74,8 +74,8 @@ e_cert_trust_init (CERTCertTrust *trust) void e_cert_trust_init_with_values (CERTCertTrust *trust, - unsigned int ssl, - unsigned int email, + unsigned int ssl, + unsigned int email, unsigned int objsign) { memset(trust, 0, sizeof(CERTCertTrust)); @@ -90,7 +90,7 @@ e_cert_trust_copy (CERTCertTrust *trust, CERTCertTrust *t) if (t) memcpy(trust, t, sizeof(CERTCertTrust)); else - memset(trust, 0, sizeof(CERTCertTrust)); + memset(trust, 0, sizeof(CERTCertTrust)); } void @@ -241,7 +241,7 @@ e_cert_trust_set_trusted_ca (CERTCertTrust *trust) PR_FALSE, PR_FALSE); } -void +void e_cert_trust_set_valid_peer (CERTCertTrust *trust) { e_cert_trust_set_ssl_trust (trust, @@ -258,7 +258,7 @@ e_cert_trust_set_valid_peer (CERTCertTrust *trust) PR_FALSE, PR_FALSE); } -void +void e_cert_trust_set_valid_server_peer (CERTCertTrust *trust) { e_cert_trust_set_ssl_trust (trust, @@ -275,7 +275,7 @@ e_cert_trust_set_valid_server_peer (CERTCertTrust *trust) PR_FALSE, PR_FALSE); } -void +void e_cert_trust_set_trusted_peer (CERTCertTrust *trust) { e_cert_trust_set_ssl_trust (trust, @@ -321,8 +321,8 @@ e_cert_trust_has_any_ca (CERTCertTrust *trust) PRBool e_cert_trust_has_ca (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign) { if (checkSSL && !e_cert_trust_has_trust(trust->sslFlags, CERTDB_VALID_CA)) @@ -336,8 +336,8 @@ e_cert_trust_has_ca (CERTCertTrust *trust, PRBool e_cert_trust_has_peer (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign) { if (checkSSL && !e_cert_trust_has_trust(trust->sslFlags, CERTDB_VALID_PEER)) @@ -361,8 +361,8 @@ e_cert_trust_has_any_user (CERTCertTrust *trust) PRBool e_cert_trust_has_user (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign) { if (checkSSL && !e_cert_trust_has_trust(trust->sslFlags, CERTDB_USER)) @@ -376,8 +376,8 @@ e_cert_trust_has_user (CERTCertTrust *trust, PRBool e_cert_trust_has_trusted_ca (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign) { if (checkSSL && !(e_cert_trust_has_trust(trust->sslFlags, CERTDB_TRUSTED_CA) || @@ -386,7 +386,7 @@ e_cert_trust_has_trusted_ca (CERTCertTrust *trust, if (checkEmail && !(e_cert_trust_has_trust(trust->emailFlags, CERTDB_TRUSTED_CA) || e_cert_trust_has_trust(trust->emailFlags, CERTDB_TRUSTED_CLIENT_CA))) return PR_FALSE; - if (checkObjSign && + if (checkObjSign && !(e_cert_trust_has_trust(trust->objectSigningFlags, CERTDB_TRUSTED_CA) || e_cert_trust_has_trust(trust->objectSigningFlags, CERTDB_TRUSTED_CLIENT_CA))) return PR_FALSE; @@ -395,15 +395,15 @@ e_cert_trust_has_trusted_ca (CERTCertTrust *trust, PRBool e_cert_trust_has_trusted_peer (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign) { if (checkSSL && !(e_cert_trust_has_trust(trust->sslFlags, CERTDB_TRUSTED))) return PR_FALSE; if (checkEmail && !(e_cert_trust_has_trust(trust->emailFlags, CERTDB_TRUSTED))) return PR_FALSE; - if (checkObjSign && + if (checkObjSign && !(e_cert_trust_has_trust(trust->objectSigningFlags, CERTDB_TRUSTED))) return PR_FALSE; return PR_TRUE; diff --git a/smime/lib/e-cert-trust.h b/smime/lib/e-cert-trust.h index 00252cb19e..72fd5a9987 100644 --- a/smime/lib/e-cert-trust.h +++ b/smime/lib/e-cert-trust.h @@ -31,8 +31,8 @@ G_BEGIN_DECLS void e_cert_trust_init (CERTCertTrust *trust); void e_cert_trust_init_with_values (CERTCertTrust *trust, - unsigned int ssl, - unsigned int email, + unsigned int ssl, + unsigned int email, unsigned int objsign); void e_cert_trust_copy (CERTCertTrust *dst_trust, CERTCertTrust *src_trust); void e_cert_trust_add_ca_trust (CERTCertTrust *trust, PRBool ssl, PRBool email, PRBool objSign); @@ -58,25 +58,25 @@ void e_cert_trust_set_trusted_peer (CERTCertTrust *trust); void e_cert_trust_set_user (CERTCertTrust *trust); PRBool e_cert_trust_has_any_ca (CERTCertTrust *trust); PRBool e_cert_trust_has_ca (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign); PRBool e_cert_trust_has_peer (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign); PRBool e_cert_trust_has_any_user (CERTCertTrust *trust); PRBool e_cert_trust_has_user (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign); PRBool e_cert_trust_has_trusted_ca (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign); PRBool e_cert_trust_has_trusted_peer (CERTCertTrust *trust, - PRBool checkSSL, - PRBool checkEmail, + PRBool checkSSL, + PRBool checkEmail, PRBool checkObjSign); void e_cert_trust_add_trust (unsigned int *t, unsigned int v); PRBool e_cert_trust_has_trust (unsigned int t, unsigned int v); diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c index f006751e4b..eb7b05374f 100644 --- a/smime/lib/e-cert.c +++ b/smime/lib/e-cert.c @@ -28,23 +28,23 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is the Netscape security libraries. - * + * * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are + * Communications Corporation. Portions created by Netscape are * Copyright (C) 2000 Netscape Communications Corporation. All * Rights Reserved. - * + * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and @@ -159,7 +159,7 @@ e_cert_dispose (GObject *object) g_free (ec->priv); ec->priv = NULL; - + if (G_OBJECT_CLASS (parent_class)->dispose) G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -253,7 +253,7 @@ 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, + PK11_HashBuf(SEC_OID_SHA1, fingerprint, cert->priv->cert->derCert.data, cert->priv->cert->derCert.len); fpItem.data = fingerprint; @@ -261,7 +261,7 @@ e_cert_populate (ECert *cert) cert->priv->sha1_fingerprint = CERT_Hexify (&fpItem, TRUE); memset(fingerprint, 0, sizeof fingerprint); - PK11_HashBuf(SEC_OID_MD5, fingerprint, + PK11_HashBuf(SEC_OID_MD5, fingerprint, cert->priv->cert->derCert.data, cert->priv->cert->derCert.len); fpItem.data = fingerprint; @@ -509,7 +509,7 @@ e_cert_get_ca_cert(ECert *ecert) } static gboolean -get_int_value (SECItem *versionItem, +get_int_value (SECItem *versionItem, unsigned long *version) { SECStatus srv; @@ -561,7 +561,7 @@ process_version (SECItem *versionItem, } static gboolean -process_serial_number_der (SECItem *serialItem, +process_serial_number_der (SECItem *serialItem, EASN1Object **retItem) { char *serialNumber; @@ -585,7 +585,7 @@ get_default_oid_format (SECItem *oid, char buf[300]; unsigned int len; int written; - + unsigned long val = oid->data[0]; unsigned int i = val % 40; val /= 40; @@ -596,11 +596,11 @@ get_default_oid_format (SECItem *oid, val = 0; for (i = 1; i < oid->len; ++i) { - /* In this loop, we have to parse a DER formatted - If the first bit is a 1, then the integer is - represented by more than one byte. If the + /* In this loop, we have to parse a DER formatted + If the first bit is a 1, then the integer is + represented by more than one byte. If the first bit is set then we continue on and add - the values of the later bytes until we get + the values of the later bytes until we get a byte without the first bit set. */ unsigned long j; @@ -616,7 +616,7 @@ get_default_oid_format (SECItem *oid, len += written; if (len >= sizeof (buf)) g_warning ("OID data to big to display in 300 chars."); - val = 0; + val = 0; } *text = g_strdup (buf); @@ -625,7 +625,7 @@ get_default_oid_format (SECItem *oid, static gboolean get_oid_text (SECItem *oid, char **text) -{ +{ SECOidTag oidTag = SECOID_FindOIDTag(oid); char *temp; @@ -690,7 +690,7 @@ get_oid_text (SECItem *oid, char **text) break; } - return TRUE; + return TRUE; } @@ -699,7 +699,7 @@ process_raw_bytes (SECItem *data, char **text) { /* This function is used to display some DER bytes that we have not added support for decoding. - It prints the value of the byte out into a + It prints the value of the byte out into a string that can later be displayed as a byte string. We place a new line after 24 bytes to break up extermaly long sequence of bytes. @@ -716,7 +716,7 @@ process_raw_bytes (SECItem *data, char **text) } *text = g_string_free (str, FALSE); return TRUE; -} +} static gboolean process_sec_algorithm_id (SECAlgorithmID *algID, @@ -776,7 +776,7 @@ process_subject_public_key_info (CERTSubjectPublicKeyInfo *spki, e_asn1_object_append_child (spkiSequence, sequenceItem); /* The subjectPublicKey field is encoded as a bit string. - ProcessRawBytes expects the lenght to be in bytes, so + ProcessRawBytes expects the lenght to be in bytes, so let's convert the lenght into a temporary SECItem. */ data.data = spki->subjectPublicKey.data; @@ -797,7 +797,7 @@ process_subject_public_key_info (CERTSubjectPublicKeyInfo *spki, } static gboolean -process_ns_cert_type_extensions (SECItem *extData, +process_ns_cert_type_extensions (SECItem *extData, GString *text) { SECItem decoded; @@ -805,7 +805,7 @@ process_ns_cert_type_extensions (SECItem *extData, decoded.data = NULL; decoded.len = 0; - if (SECSuccess != SEC_ASN1DecodeItem(NULL, &decoded, + if (SECSuccess != SEC_ASN1DecodeItem(NULL, &decoded, SEC_ASN1_GET(SEC_BitStringTemplate), extData)) { g_string_append (text, _("Error: Unable to process extension")); return TRUE; @@ -854,7 +854,7 @@ process_key_usage_extensions (SECItem *extData, GString *text) decoded.data = NULL; decoded.len = 0; - if (SECSuccess != SEC_ASN1DecodeItem(NULL, &decoded, + if (SECSuccess != SEC_ASN1DecodeItem(NULL, &decoded, SEC_ASN1_GET(SEC_BitStringTemplate), extData)) { g_string_append (text, _("Error: Unable to process extension")); return TRUE; @@ -891,12 +891,12 @@ process_key_usage_extensions (SECItem *extData, GString *text) g_string_append (text, _("CRL Signer")); g_string_append (text, "\n"); } - + return TRUE; } static gboolean -process_extension_data (SECOidTag oidTag, SECItem *extData, +process_extension_data (SECOidTag oidTag, SECItem *extData, GString *str) { gboolean rv; @@ -912,7 +912,7 @@ process_extension_data (SECOidTag oidTag, SECItem *extData, rv = process_raw_bytes (extData, &text); g_string_append (str, text); g_free (text); - break; + break; } } return rv; @@ -956,7 +956,7 @@ process_single_extension (CERTCertExtension *extension, } static gboolean -process_extensions (CERTCertExtension **extensions, +process_extensions (CERTCertExtension **extensions, EASN1Object *parentSequence) { EASN1Object *extensionSequence = e_asn1_object_new (); @@ -1002,19 +1002,19 @@ process_name (CERTName *name, char **value) /* The above whille loop will put us at the last member * of the array which is a NULL pointer. So let's back - * up one spot so that we have the last non-NULL entry in - * the array in preparation for traversing the + * up one spot so that we have the last non-NULL entry in + * the array in preparation for traversing the * RDN's (Relative Distinguished Name) in reverse order. */ lastRdn--; - + /* * Loop over name contents in _reverse_ RDN order appending to string - * When building the Ascii string, NSS loops over these entries in + * When building the Ascii string, NSS loops over these entries in * reverse order, so I will as well. The difference is that NSS * will always place them in a one line string separated by commas, * where I want each entry on a single line. I can't just use a comma - * as my delimitter because it is a valid character to have in the + * as my delimitter because it is a valid character to have in the * value portion of the AVA and could cause trouble when parsing. */ for (rdn = lastRdn; rdn >= rdns; rdn--) { @@ -1072,15 +1072,15 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq) EASN1Object *sequence = e_asn1_object_new (); char *text; EASN1Object *subitem; - SECItem data; + SECItem data; e_asn1_object_set_display_name (sequence, _("Certificate")); - + if (!process_version (&cert->priv->cert->version, &subitem)) return FALSE; e_asn1_object_append_child (sequence, subitem); g_object_unref (subitem); - + if (!process_serial_number_der (&cert->priv->cert->serialNumber, &subitem)) return FALSE; e_asn1_object_append_child (sequence, subitem); @@ -1113,7 +1113,7 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq) nsCOMPtr<nsIX509CertValidity> validityData; GetValidity(getter_AddRefs(validityData)); PRTime notBefore, notAfter; - + validityData->GetNotBefore(¬Before); validityData->GetNotAfter(¬After); validityData = 0; @@ -1127,7 +1127,7 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq) if (NS_FAILED(rv)) return rv; #endif - + subitem = e_asn1_object_new (); e_asn1_object_set_display_name (subitem, _("Subject")); diff --git a/smime/lib/e-pkcs12.c b/smime/lib/e-pkcs12.c index 49a5f53e56..99b1d46753 100644 --- a/smime/lib/e-pkcs12.c +++ b/smime/lib/e-pkcs12.c @@ -28,23 +28,23 @@ * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ - * + * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. - * + * * The Original Code is the Netscape security libraries. - * + * * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are + * Communications Corporation. Portions created by Netscape are * Copyright (C) 2000 Netscape Communications Corporation. All * Rights Reserved. - * + * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and @@ -114,7 +114,7 @@ e_pkcs12_dispose (GObject *object) g_free (pk->priv); pk->priv = NULL; - + if (G_OBJECT_CLASS (parent_class)->dispose) G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -196,8 +196,8 @@ input_to_decoder (SEC_PKCS12DecoderContext *dcx, const char *path, GError **erro } /* feed the file data into the decoder */ - srv = SEC_PKCS12DecoderUpdate(dcx, - (unsigned char*) buf, + srv = SEC_PKCS12DecoderUpdate(dcx, + (unsigned char*) buf, amount); if (srv) { /* XXX g_error */ @@ -228,9 +228,9 @@ prompt_for_password (char *title, char *prompt, SECItem *pwd) const char *inptr = passwd; unsigned char *outptr; gunichar2 c; - + SECITEM_AllocItem(NULL, pwd, sizeof (gunichar2) * (len + 1)); - + outptr = pwd->data; while (inptr && (c = (gunichar2) (g_utf8_get_char (inptr) & 0xffff))) { inptr = g_utf8_next_char (inptr); @@ -238,10 +238,10 @@ prompt_for_password (char *title, char *prompt, SECItem *pwd) *outptr++ = ((char *) &c)[0]; *outptr++ = ((char *) &c)[1]; } - + *outptr++ = 0; *outptr++ = 0; - + memset (passwd, 0, strlen (passwd)); g_free (passwd); } @@ -333,7 +333,7 @@ e_pkcs12_import_from_file (EPKCS12 *pkcs12, const char *path, GError **error) gboolean rv = TRUE; gboolean wantRetry; PK11SlotInfo *slot; - + printf ("importing pkcs12 from `%s'\n", path); slot = PK11_GetInternalKeySlot(); @@ -371,7 +371,7 @@ nickname_collision(SECItem *oldNick, PRBool *cancel, void *wincx) /* The user is trying to import a PKCS#12 file that doesn't have the attribute we use to set the nickname. So in order to reduce the number of interactions we require with the user, we'll build a nickname - for the user. The nickname isn't prominently displayed in the UI, + for the user. The nickname isn't prominently displayed in the UI, so it's OK if we generate one on our own here. XXX If the NSS API were smarter and actually passed a pointer to the CERTCertificate* we're importing we could actually just @@ -385,12 +385,12 @@ nickname_collision(SECItem *oldNick, PRBool *cancel, void *wincx) /* If we've gotten this far, that means there isn't a certificate in the database that has the same subject name as the cert we're - trying to import. So we need to come up with a "nickname" to - satisfy the NSS requirement or fail in trying to import. - Basically we use a default nickname from a properties file and + trying to import. So we need to come up with a "nickname" to + satisfy the NSS requirement or fail in trying to import. + Basically we use a default nickname from a properties file and see if a certificate exists with that nickname. If there isn't, then - create update the count by one and append the string '#1' Or - whatever the count currently is, and look for a cert with + create update the count by one and append the string '#1' Or + whatever the count currently is, and look for a cert with that nickname. Keep updating the count until we find a nickname without a corresponding cert. XXX If a user imports *many* certs without the 'friendly name' @@ -423,6 +423,6 @@ static gboolean handle_error(int myerr) { printf ("handle_error (%d)\n", myerr); - + return FALSE; } |