A service reject SOAP Envelope with more then 32767 octets

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A service reject SOAP Envelope with more then 32767 octets

Prabhakar_Pujeri
A service should not send a SOAP Envelope with more then 32767 octets unless the client has specified a wsman:MaxEnvelopeSize header

Signed-off-by: prabhakar pujeri <[hidden email]>
---
 include/wsman-xml-api.h    |  1 +
 src/lib/wsman-dispatcher.c | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/wsman-xml-api.h b/include/wsman-xml-api.h
index 992c8f4..de2d42f 100644
--- a/include/wsman-xml-api.h
+++ b/include/wsman-xml-api.h
@@ -84,6 +84,7 @@ extern "C" {
 
 #define PROCESSED_MSG_ID_MAX_SIZE            200
 #define WSMAN_MINIMAL_ENVELOPE_SIZE_REQUEST  8192
+#define WSMAN_MAX_ENVELOPE_SIZE 32767
 
 
 void ws_xml_free_memory(void *ptr);
diff --git a/src/lib/wsman-dispatcher.c b/src/lib/wsman-dispatcher.c
index dd8c529..3f95c05 100644
--- a/src/lib/wsman-dispatcher.c
+++ b/src/lib/wsman-dispatcher.c
@@ -201,7 +201,7 @@ static int validate_control_headers(op_t * op)
 {
  unsigned long size = 0;
  time_t duration;
- WsXmlNodeH header, child, maxsize;
+ WsXmlNodeH header, child, maxsize=NULL;
  char *mu = NULL;
 
  header = wsman_get_soap_header_element( op->in_doc,  NULL, NULL);
@@ -213,11 +213,20 @@ static int validate_control_headers(op_t * op)
  size = ws_deserialize_uint32(NULL, header,
      0, XML_NS_WS_MAN,
      WSM_MAX_ENVELOPE_SIZE);
+
+        //  envelope should minimum size 8192
  if (size < WSMAN_MINIMAL_ENVELOPE_SIZE_REQUEST) {
  generate_op_fault(op, WSMAN_ENCODING_LIMIT,
  WSMAN_DETAIL_MINIMUM_ENVELOPE_LIMIT);
  return 0;
  }
+
+        //SOAP Envelope size should not exide 32767 if maximum envelope size not provided
+        if ( maxsize == NULL && size == WSMAN_MAX_ENVELOPE_SIZE ) {
+            generate_op_fault(op, WSMAN_ENCODING_LIMIT,
+                        WSMAN_DETAIL_MAX_ENVELOPE_SIZE);
+        }
+
  op->maxsize = size;
  }
  child = ws_xml_get_child(header, 0,
--
2.4.3


------------------------------------------------------------------------------
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: A service reject SOAP Envelope with more then 32767 octets

Klaus Kaempf
* prabhakar pujeri <[hidden email]> [Jul 23. 2015 01:07]:
> A service should not send a SOAP Envelope with more then 32767 octets unless the client has specified a wsman:MaxEnvelopeSize header

Applied to master with slight changes.

Thanks again !

Klaus
--
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel