diff options
author | Stef Walter <stefw@collabora.co.uk> | 2011-02-21 20:44:42 +0100 |
---|---|---|
committer | Stef Walter <stefw@collabora.co.uk> | 2011-02-21 20:44:42 +0100 |
commit | 25cbc9b3293f2c6df38bd0528b89101e5e547321 (patch) | |
tree | 18c661c0bcbe9a8781a9aa1ca5904a39865ec279 /module/p11-kit-uri.c | |
parent | ff7db14f0acae463165377f2d4b999e566298b40 (diff) |
Add uri function for listing which attribute types are present.
Diffstat (limited to 'module/p11-kit-uri.c')
-rw-r--r-- | module/p11-kit-uri.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/module/p11-kit-uri.c b/module/p11-kit-uri.c index 8c65301..7fdb33d 100644 --- a/module/p11-kit-uri.c +++ b/module/p11-kit-uri.c @@ -127,7 +127,7 @@ url_encode (const unsigned char *value, const unsigned char *end, size_t *length while (value != end) { /* These characters we let through verbatim */ - if (isalnum (*value) || strchr ("_-.", *value) != NULL) { + if (*value && (isalnum (*value) || strchr ("_-.", *value) != NULL)) { *(p++) = *(value++); /* All others get encoded */ @@ -256,6 +256,28 @@ p11_kit_uri_match_token_info (P11KitUri *uri, CK_TOKEN_INFO_PTR token_info) sizeof (token_info->serialNumber))); } +CK_ATTRIBUTE_TYPE* +p11_kit_uri_get_attribute_types (P11KitUri *uri, int *n_types) +{ + CK_ATTRIBUTE_TYPE *result; + int i, j; + + assert (uri); + assert (n_types); + + result = calloc (NUM_ATTRS, sizeof (CK_ATTRIBUTE_TYPE)); + if (result == NULL) + return NULL; + + for (i = 0, j = 0; i < NUM_ATTRS; ++i) { + if (uri->attrs[i].ulValueLen != (CK_ULONG)-1) + result[j++] = uri->attrs[i].type; + } + + *n_types = j; + return result; +} + CK_ATTRIBUTE_PTR p11_kit_uri_get_attribute (P11KitUri *uri, CK_ATTRIBUTE_TYPE type) { |