assert (strstr (string, "pin-source=%7cmy-pin-file") != NULL);
free (string);
- ret = p11_kit_uri_parse ("pkcs11:pin-source=blah%2Fblah", P11_KIT_URI_FOR_ANY, uri);
+ ret = p11_kit_uri_parse ("pkcs11:?pin-source=blah%2Fblah", P11_KIT_URI_FOR_ANY, uri);
assert_num_eq (P11_KIT_URI_OK, ret);
pin_source = p11_kit_uri_get_pin_source (uri);
assert (strstr (string, "pkcs11:pin-value=1%2a%26%23%25%26%40%28") != NULL);
free (string);
- ret = p11_kit_uri_parse ("pkcs11:pin-value=blah%2Fblah", P11_KIT_URI_FOR_ANY, uri);
+ ret = p11_kit_uri_parse ("pkcs11:?pin-value=blah%2Fblah", P11_KIT_URI_FOR_ANY, uri);
assert_num_eq (P11_KIT_URI_OK, ret);
pin_value = p11_kit_uri_get_pin_value (uri);
uri = p11_kit_uri_new ();
assert_ptr_not_null (uri);
- ret = p11_kit_uri_parse ("pkcs11:pin-value=blahblah%2", P11_KIT_URI_FOR_ANY, uri);
+ ret = p11_kit_uri_parse ("pkcs11:?pin-value=blahblah%2", P11_KIT_URI_FOR_ANY, uri);
assert_num_eq (P11_KIT_URI_BAD_ENCODING, ret);
p11_kit_uri_free (uri);
uri->pin_value = NULL;
uri->slot_id = (CK_SLOT_ID)-1;
+ /* Parse the path. */
for (;;) {
- spos = strchr (string, ';');
- if (spos == NULL) {
- spos = string + strlen (string);
- assert (*spos == '\0');
- if (spos == string)
- break;
- }
+ spos = string + strcspn (string, ";?");
+ if (spos == string)
+ break;
epos = strchr (string, '=');
- if (epos == NULL || spos == string || epos == string || epos >= spos) {
+ if (epos == NULL || epos == string || epos >= spos) {
free (allocated);
return P11_KIT_URI_BAD_SYNTAX;
}
ret = parse_module_info (string, epos, epos + 1, spos, uri);
if (ret == 0 && (uri_type & P11_KIT_URI_FOR_MODULE_WITH_VERSION) == P11_KIT_URI_FOR_MODULE_WITH_VERSION)
ret = parse_module_version_info (string, epos, epos + 1, spos, uri);
- if (ret == 0)
- ret = parse_extra_info (string, epos, epos + 1, spos, uri);
if (ret < 0) {
free (allocated);
if (ret == 0)
uri->unrecognized = true;
+ string = spos;
if (*spos == '\0')
break;
- string = spos + 1;
+ if (*spos == '?')
+ break;
+ string++;
+ }
+
+ /* Parse the query. */
+ for (;;) {
+ if (*string == '\0')
+ break;
+ string++;
+ spos = strchr (string, '&');
+ if (spos == NULL) {
+ spos = string + strlen (string);
+ assert (*spos == '\0');
+ if (spos == string)
+ break;
+ }
+
+ epos = strchr (string, '=');
+ if (epos == NULL || spos == string || epos == string || epos >= spos) {
+ free (allocated);
+ return P11_KIT_URI_BAD_SYNTAX;
+ }
+
+ ret = parse_extra_info (string, epos, epos + 1, spos, uri);
+ if (ret < 0) {
+ free (allocated);
+ return ret;
+ }
+ if (ret == 0)
+ uri->unrecognized = true;
+
+ string = spos;
}
free (allocated);