Fixed to not allow duplicate PKCS registering. Bug #17.
authorPekka Riikonen <priikone@silcnet.org>
Fri, 30 Aug 2002 07:07:44 +0000 (07:07 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Fri, 30 Aug 2002 07:07:44 +0000 (07:07 +0000)
CHANGES
lib/silccrypt/silcpkcs.c

diff --git a/CHANGES b/CHANGES
index 0351172bdc056a42537278f86365bfff0c1aaf43..eaa81a00dcb9f71d8fcd42147dbd6fb8b3c0f400 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@ Fri Aug 30 08:57:33 CEST 2002 Pekka Riikonen <priikone@silcnet.org>
          fingerprint instead of two first bytes when determining
          if it is set.  Bug #18.  Affected file silcd/command.c.
 
+       * Fixed duplicate PKCS name registering to not allow it.
+         Bugs #17.  Affected file lib/silccrypt/silcpkcs.c.
+
 Sun Aug 25 08:02:04 CEST 2002 Lubomir Sedlacik <salo@silcnet.org>
 
        * Conditionalize non-gcc compiler optimizations for various
index d9662663de4bae0e377b9daf27482ebd0cc4fddc..e079e40aa4be939b0bc7fe0cdd5dd41b4703425e 100644 (file)
@@ -71,6 +71,16 @@ bool silc_pkcs_register(const SilcPKCSObject *pkcs)
 
   SILC_LOG_DEBUG(("Registering new PKCS `%s'", pkcs->name));
 
+  /* Check if exists already */
+  if (silc_pkcs_list) {
+    SilcPKCSObject *entry;
+    silc_dlist_start(silc_pkcs_list);
+    while ((entry = silc_dlist_get(silc_pkcs_list)) != SILC_LIST_END) {
+      if (!strcmp(entry->name, pkcs->name))
+        return FALSE;
+    }
+  }
+
   new = silc_calloc(1, sizeof(*new));
   new->name = strdup(pkcs->name);
   new->init = pkcs->init;