diff options
author | Milan Crha <mcrha@redhat.com> | 2013-09-25 16:32:41 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-09-25 16:32:41 +0800 |
commit | 1f38d1726eea377ac625d2d53e21682c831d1d45 (patch) | |
tree | 47ddf4ab2dce608b156470b8df4227a651ef2f90 | |
parent | 6d96953703d24d146cdec1c25a97c07cd29c2c24 (diff) | |
download | gsoc2013-evolution-1f38d1726eea377ac625d2d53e21682c831d1d45.tar.gz gsoc2013-evolution-1f38d1726eea377ac625d2d53e21682c831d1d45.tar.zst gsoc2013-evolution-1f38d1726eea377ac625d2d53e21682c831d1d45.zip |
Drop unused e-cert-db.c:default_nickname() function
-rw-r--r-- | smime/lib/e-cert-db.c | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index b3bb08cf5b..e8e91a427a 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -1013,131 +1013,6 @@ e_cert_db_import_email_cert (ECertDB *certdb, return rv; } -static gchar * -default_nickname (CERTCertificate *cert) -{ - /* nsNSSShutDownPreventionLock locker; */ - gchar *username = NULL; - gchar *caname = NULL; - gchar *nickname = NULL; - gchar *tmp = NULL; - gint count; - const gchar *nickFmt = NULL; - CERTCertificate *dummycert; - PK11SlotInfo *slot = NULL; - CK_OBJECT_HANDLE keyHandle; - - CERTCertDBHandle *defaultcertdb = CERT_GetDefaultCertDB (); - - username = CERT_GetCommonName (&cert->subject); - if (username == NULL) - username = PL_strdup (""); - - if (username == NULL) - goto loser; - - caname = CERT_GetOrgName (&cert->issuer); - if (caname == NULL) - caname = PL_strdup (""); - - if (caname == NULL) - goto loser; - - count = 1; - - nickFmt = "%1$s's %2$s ID"; - - 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); - if (slot == NULL) { - goto loser; - } - if (!PK11_IsInternal (slot)) { - tmp = PR_smprintf ("%s:%s", PK11_GetTokenName (slot), nickname); - PR_Free (nickname); - nickname = tmp; - tmp = NULL; - } - tmp = nickname; - while (1) { - if (count > 1) { - nickname = PR_smprintf ("%s #%d", tmp, count); - } - - 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 - * 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 - * the same subject name on the smart card, so let's use this - * nickname. - */ - CERT_DestroyCertificate (dummycert); - dummycert = NULL; - } - } - } - if (dummycert == NULL) - goto done; - - /* found a cert, destroy it and loop */ - CERT_DestroyCertificate (dummycert); - if (tmp != nickname) PR_Free (nickname); - count++; - } /* end of while (1) */ - - loser: - if (nickname) { - PR_Free (nickname); - } - nickname = NULL; - done: - if (caname) { - PR_Free (caname); - } - if (username) { - PR_Free (username); - } - if (slot != NULL) { - PK11_FreeSlot (slot); - if (nickname != NULL) { - tmp = nickname; - nickname = strchr (tmp, ':'); - if (nickname != NULL) { - nickname++; - nickname = PL_strdup (nickname); - PR_Free (tmp); - tmp = NULL; - } else { - nickname = tmp; - tmp = NULL; - } - } - } - PR_FREEIF (tmp); - return (nickname); -} - gboolean e_cert_db_import_server_cert (ECertDB *certdb, gchar *data, |