summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-08-03 20:02:25 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-08-03 21:43:16 +0200
commitac5be04955ab8fc74a0870eccb32468e29d83b8b (patch)
tree1b1a7c80a116e5a14065e3441cf5bcbaeb3372a9
parentf586f72e94ca7d63f615c8f3d8549ed3d4a801ae (diff)
downloadgnutls-ac5be04955ab8fc74a0870eccb32468e29d83b8b.tar.gz
Do not try to parse arbitrary objects as certificates.
-rw-r--r--src/pkcs11.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pkcs11.c b/src/pkcs11.c
index d7843b04cd..b8dfea70d3 100644
--- a/src/pkcs11.c
+++ b/src/pkcs11.c
@@ -77,7 +77,7 @@ pkcs11_list (FILE * outfile, const char *url, int type, unsigned int login,
gnutls_pkcs11_obj_t *crt_list;
gnutls_x509_crt_t xcrt;
unsigned int crt_list_size = 0, i;
- int ret;
+ int ret, otype;
char *output;
int attrs;
unsigned int obj_flags = 0;
@@ -171,9 +171,9 @@ pkcs11_list (FILE * outfile, const char *url, int type, unsigned int login,
fprintf (outfile, "Object %d:\n\tURL: %s\n", i, output);
+ otype = gnutls_pkcs11_obj_get_type(crt_list[i]);
fprintf (outfile, "\tType: %s\n",
- gnutls_pkcs11_type_get_name (gnutls_pkcs11_obj_get_type
- (crt_list[i])));
+ gnutls_pkcs11_type_get_name (otype));
size = sizeof (buf);
ret =
@@ -199,12 +199,13 @@ pkcs11_list (FILE * outfile, const char *url, int type, unsigned int login,
}
fprintf (outfile, "\tID: %s\n\n", buf);
-
-
if (attrs == GNUTLS_PKCS11_OBJ_ATTR_ALL
|| attrs == GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY)
continue;
+ if (otype != GNUTLS_PKCS11_OBJ_X509_CRT)
+ continue;
+
ret = gnutls_x509_crt_init (&xcrt);
if (ret < 0)
{