show more information if building a credential fails
authorMartin Willi <martin@strongswan.org>
Fri, 14 Aug 2009 11:19:47 +0000 (13:19 +0200)
committerMartin Willi <martin@strongswan.org>
Wed, 26 Aug 2009 09:23:50 +0000 (11:23 +0200)
src/libstrongswan/credentials/credential_factory.c

index 4063811..bce9c7d 100644 (file)
@@ -150,6 +150,7 @@ static void* create(private_credential_factory_t *this, credential_type_t type,
        builder_part_t part;
        va_list args;
        void* construct = NULL, *fn, *data;
+       int failures = 0;
        
        enumerator = create_builder_enumerator(this, type, subtype);
        while (enumerator->enumerate(enumerator, &builder))
@@ -212,12 +213,19 @@ static void* create(private_credential_factory_t *this, credential_type_t type,
                {
                        break;
                }
+               failures++;
        }
        enumerator->destroy(enumerator);
        if (!construct)
        {
-               DBG1("failed to create a builder for credential type %N,"
-                        " subtype (%d)", credential_type_names, type, subtype);
+               enum_name_t *names = key_type_names;
+               
+               if (type == CRED_CERTIFICATE)
+               {
+                       names = certificate_type_names;
+               }
+               DBG1("building %N - %N failed, tried %d builders",
+                        credential_type_names, type, names, subtype, failures);
        }
        return construct;
 }