[evolution] Drop unused e-cert-db.c:default_nickname() function



commit 1f38d1726eea377ac625d2d53e21682c831d1d45
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 25 10:32:41 2013 +0200

    Drop unused e-cert-db.c:default_nickname() function

 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 b3bb08c..e8e91a4 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]