Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
openwsman
0003-Separate-URL-query-parsing-from-parsing-li...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-Separate-URL-query-parsing-from-parsing-list-of-URLs.patch of Package openwsman
From 3836dde52959a6b2949cc72fce29bfff04e216aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de> Date: Mon, 15 Dec 2014 15:56:44 +0100 Subject: [PATCH 3/6] Separate URL query parsing from parsing list of URLs, fixes #48 The fix to #38 introduced a regression and broken parsing of vendor_namespaces in src/plugins/cim/cim_data.c The real cause is the mis-use of u_parse_query to parse a comma-separated list of URLs. The real fix is to separate URL query parsing from parsing a list of URLs --- include/u/uri.h | 1 + src/lib/u/uri.c | 17 +++++++++++++++-- src/plugins/cim/cim_data.c | 4 +++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/u/uri.h b/include/u/uri.h index d9d32332955e..bf4967086f7f 100644 --- a/include/u/uri.h +++ b/include/u/uri.h @@ -26,6 +26,7 @@ typedef struct u_uri_s u_uri_t; int u_uri_parse (const char *s, u_uri_t **pu); void u_uri_free (u_uri_t *uri); hash_t *u_parse_query(const char *query); +hash_t *u_parse_list(const char *list); #ifdef __cplusplus } diff --git a/src/lib/u/uri.c b/src/lib/u/uri.c index f686e5cb55f4..abc6ecdeb633 100644 --- a/src/lib/u/uri.c +++ b/src/lib/u/uri.c @@ -201,18 +201,20 @@ static int u_string_unify(char *s) } -hash_t *u_parse_query(const char *query) +static hash_t * +_u_parse(const char *query, const char *separator) { char *pp, *tok, *src, *q = NULL; char *key=NULL, *val=NULL; hash_t *h = NULL; dbg_err_if(query == NULL); + dbg_err_if(separator == NULL); q = u_strdup(query); h = hash_create3(HASHCOUNT_T_MAX, 0, 0); /* foreach name=value pair... */ - for (src = q; (tok = strtok_r(src, "&", &pp)) != NULL; src = NULL) { + for (src = q; (tok = strtok_r(src, separator, &pp)) != NULL; src = NULL) { /* dup the string so we can modify it */ key = u_strdup(tok); dbg_err_if(key == NULL); @@ -257,6 +259,17 @@ err: return NULL; } +hash_t * +u_parse_query(const char *query) +{ + return _u_parse(query, "&"); +} + +hash_t * +u_parse_list(const char *list) +{ + return _u_parse(list, ","); +} diff --git a/src/plugins/cim/cim_data.c b/src/plugins/cim/cim_data.c index 3dce8036324a..0f1885cc4a94 100644 --- a/src/plugins/cim/cim_data.c +++ b/src/plugins/cim/cim_data.c @@ -102,6 +102,7 @@ set_vendor_namespaces(void) (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces)); ns->class_prefix = CimResource_Namespaces[i].class_prefix; ns->ns = (char*) CimResource_Namespaces[i].ns; + debug("Namespace %s => %s", ns->class_prefix, ns->ns); lnode_t *node = lnode_create(ns); list_append(l, node); } @@ -113,6 +114,7 @@ set_vendor_namespaces(void) (WsSupportedNamespaces *)u_malloc(sizeof(WsSupportedNamespaces)); ns->class_prefix = (char*)hnode_getkey(hn); ns->ns = (char*) hnode_get(hn); + debug("Namespace %s => %s", ns->class_prefix, ns->ns); lnode_t *node = lnode_create(ns); list_append(l, node); } @@ -169,7 +171,7 @@ void set_config( void *self, dictionary *config ) indication_profile_implementation_ns = iniparser_getstring(config, "cim:indication_profile_implementation_ns", "root/interop"); debug("vendor namespaces: %s", namespaces); if (namespaces) { - hash_t * t = u_parse_query(namespaces); + hash_t * t = u_parse_list(namespaces); if (t) { vendor_namespaces = t; } -- 2.1.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor