summaryrefslogtreecommitdiffstats
path: root/src/core/settings.c
diff options
context:
space:
mode:
authorMichael Brown2014-02-17 17:14:25 +0100
committerMichael Brown2014-02-27 00:34:07 +0100
commit09b057ce841156cf8dfb8d356d36b046d875cdf4 (patch)
treee4fa240a670b4d7037ef1b2a86a576df10956891 /src/core/settings.c
parent[dhcp] Copy exactly the required length when resizing DHCP options (diff)
downloadipxe-09b057ce841156cf8dfb8d356d36b046d875cdf4.tar.gz
ipxe-09b057ce841156cf8dfb8d356d36b046d875cdf4.tar.xz
ipxe-09b057ce841156cf8dfb8d356d36b046d875cdf4.zip
[settings] Remove "uristring" setting type
Commit b5f5f73 ("[cmdline] Expand settings within each command-line token individually") effectively rendered the "uristring" setting type obsolete, since strings containing whitespace no longer break the command line parser. The concept of the "uristring" type is not well defined, since URI escaping rules depend on which portion of a URI is being escaped. Remove the "uristring" type, converting it into an alias for the "string" setting type so as to avoid breaking existing scripts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/settings.c')
-rw-r--r--src/core/settings.c54
1 files changed, 5 insertions, 49 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 1f742548..5e16b27d 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -1658,59 +1658,15 @@ const struct setting_type setting_type_string __setting_type = {
.format = format_string_setting,
};
-/**
- * Parse URI-encoded string setting value
+/** A URI-encoded string setting type
*
- * @v type Setting type
- * @v value Formatted setting value
- * @v buf Buffer to contain raw value
- * @v len Length of buffer
- * @ret len Length of raw value, or negative error
+ * This setting type is obsolete; the name ":uristring" is retained to
+ * avoid breaking existing scripts.
*/
-static int parse_uristring_setting ( const struct setting_type *type __unused,
- const char *value, void *buf, size_t len ){
- char tmp[ len + 1 /* NUL */ ];
- size_t raw_len;
-
- /* Decode to temporary buffer (including NUL) */
- raw_len = uri_decode ( value, tmp, sizeof ( tmp ) );
-
- /* Copy to output buffer (excluding NUL) */
- if ( len > raw_len )
- len = raw_len;
- memcpy ( buf, tmp, len );
-
- return raw_len;
-}
-
-/**
- * Format URI-encoded string setting value
- *
- * @v type Setting type
- * @v raw Raw setting value
- * @v raw_len Length of raw setting value
- * @v buf Buffer to contain formatted value
- * @v len Length of buffer
- * @ret len Length of formatted value, or negative error
- */
-static int format_uristring_setting ( const struct setting_type *type __unused,
- const void *raw, size_t raw_len,
- char *buf, size_t len ) {
- char tmp[ raw_len + 1 /* NUL */ ];
-
- /* Copy to temporary buffer and terminate */
- memcpy ( tmp, raw, raw_len );
- tmp[raw_len] = '\0';
-
- /* Encode directly into output buffer */
- return uri_encode ( tmp, buf, len, URI_FRAGMENT );
-}
-
-/** A URI-encoded string setting type */
const struct setting_type setting_type_uristring __setting_type = {
.name = "uristring",
- .parse = parse_uristring_setting,
- .format = format_uristring_setting,
+ .parse = parse_string_setting,
+ .format = format_string_setting,
};
/**