From: Michael Chase-S. <mc...@us...> - 2011-11-23 03:54:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "SFCB - Small Footprint CIM Broker". The branch, master has been updated via 10b508a77d4e2e0eb8a140962b1b77fdbc3db7a0 (commit) via e2bc679719740393e8c8458bbc3ed2e77d6d49a2 (commit) from d53481dce97af2bb32d25e025e8d226893f08f72 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 10b508a77d4e2e0eb8a140962b1b77fdbc3db7a0 Author: Michael Chase-Salerno <br...@li...> Date: Tue Nov 22 22:53:32 2011 -0500 [ 3435778 ] Preserve leading/trailing whitespace in values commit e2bc679719740393e8c8458bbc3ed2e77d6d49a2 Author: Michael Chase-Salerno <br...@li...> Date: Tue Nov 22 22:51:10 2011 -0500 3435778 Preserve leading/trailing whitespace in values ----------------------------------------------------------------------- Summary of changes: diff --git a/ChangeLog b/ChangeLog index f47c1a2..63c1d5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-22 Michael Chase-Salerno <br...@li...> + + * cimXmlParser.c, control.c, httpAdapter.c, sfcb.cfg.pre.in: + [ 3435778 ] Preserve leading/trailing whitespace in values + 2011-11-04 Chris Buccella <buc...@li...> * objectImpl.c: diff --git a/README b/README index 240c7d4..36ab75d 100644 --- a/README +++ b/README @@ -513,6 +513,7 @@ file /usr/local/etc/sfcb/sfcb.cfg. For example: sslCiphers: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH registrationDir: /usr/local/var/lib/sfcb/registration providerDirs: /usr/local/lib/sfcb /usr/local/lib /usr/local/lib/cmpi + trimWhitespace: true Config Option Descriptions -------------------------- @@ -660,6 +661,11 @@ traceFile Specify the trace file for sfcb. Can be overriden by setting environment variable SFCB_TRACE_FILE. Default: stderr. +trimWhitespace + Trim leading and trailing whitespace from XML property values. + Whitespace is space, tab, crlf. Any ascii value <= 32. + Default is true + After making any changes to sfcb.cfg you must restart sfcb or get it to reload the config file by typing diff --git a/cimXmlParser.c b/cimXmlParser.c index 90686fd..cd75652 100644 --- a/cimXmlParser.c +++ b/cimXmlParser.c @@ -28,6 +28,8 @@ #include "cimRequest.h" #include "trace.h" +extern int trimws; + static int attrsOk(XmlBuffer * xb, const XmlElement * e, XmlAttr * r, const char *tag, int etag); static char *getValue(XmlBuffer * xb, const char *v); @@ -433,22 +435,24 @@ getContent(XmlBuffer * xb) xb->nulledChar = *(xb->cur); *(xb->cur) = 0; - /* - * skip leading blanks - */ - while (*start && *start <= ' ') - start++; - if (start == NULL) - return ""; // should check for *start == NULL - // instead? start==NULL shouldn't happen, - // ever. end = xb->cur; - /* - * strip trailing blanks - */ - while (*(end - 1) <= ' ') { - *(end - 1) = 0; - end -= 1; + + if (trimws) { + /* + * skip leading blanks + */ + while (*start && *start <= ' ') + start++; + if (start == NULL) + return ""; // should check for *start == NULL + // instead? start==NULL shouldn't happen, ever. + /* + * strip trailing blanks + */ + while (*(end - 1) <= ' ') { + *(end - 1) = 0; + end -= 1; + } } /* * unescape diff --git a/control.c b/control.c index 11f1567..0c5f30f 100644 --- a/control.c +++ b/control.c @@ -82,6 +82,8 @@ Control init[] = { {"useChunking", 2, "false"}, {"chunkSize", 1, "50000"}, + {"trimWhitespace", 2, "true"}, + {"keepaliveTimeout", 1, "15"}, {"keepaliveMaxRequest", 1, "10"}, {"selectTimeout", 1, "5"}, diff --git a/httpAdapter.c b/httpAdapter.c index 67bcb5c..1614e16 100644 --- a/httpAdapter.c +++ b/httpAdapter.c @@ -95,6 +95,7 @@ static long keepaliveMaxRequest = 10; static long numRequest; static long selectTimeout = 5; /* default 5 sec. timeout for select() before read() */ struct timeval httpSelectTimeout = { 0, 0 }; +int trimws; #if defined USE_SSL static SSL_CTX *ctx; @@ -1767,6 +1768,9 @@ httpDaemon(int argc, char *argv[], int sslMode) noChunking = 0; noChunking = noChunking == 0; + if (getControlBool("trimWhitespace", &trimws)) + trimws = 0; + /* * grab commandline options */ diff --git a/sfcb.cfg.pre.in b/sfcb.cfg.pre.in index f22dbec..20c69f7 100644 --- a/sfcb.cfg.pre.in +++ b/sfcb.cfg.pre.in @@ -95,6 +95,11 @@ basicAuthLib: @SFCB_CONF_BASICAUTHLIB@ ## Default is NULL which means no change to the default permission. #socketPathGroupPerm: daemon +## Trim leading and trailing whitespace from XML property values. +## Whitespace is space, tab, crlf. Any ascii value <= 32. +## Default is true +#trimWhitespace: true + ##---------------------------- Provider-Related ------------------------------- ## Max number of provider processes. hooks/post-receive -- SFCB - Small Footprint CIM Broker |