File gsoap-wsse.patch of Package gsoap.openSUSE_Backports_SLE-15-SP3
Origin: https://src.fedoraproject.org/rpms/gsoap/c/48ce27e1b81f592f1247b85139cd415ae76d389b?branch=rawhide
---
gsoap/plugin/wsseapi.c | 10 +++++++++-
gsoap/plugin/wsseapi.cpp | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
Index: gsoap-2.8.102/gsoap/plugin/wsseapi.c
===================================================================
--- gsoap-2.8.102.orig/gsoap/plugin/wsseapi.c
+++ gsoap-2.8.102/gsoap/plugin/wsseapi.c
@@ -3956,9 +3956,12 @@ soap_wsse_verify_SignatureValue(struct s
if (att->name && att->text && !strcmp(att->name, "xmlns"))
{
soap_attribute(soap, att->name, att->text);
+ prt = NULL;
break;
}
}
+ if (!prt)
+ break;
}
}
else
@@ -4247,9 +4250,12 @@ soap_wsse_verify_digest(struct soap *soa
if (att->name && att->text && !strcmp(att->name, "xmlns"))
{
soap_attribute(soap, att->name, att->text);
+ prt = NULL;
break;
}
}
+ if (!prt)
+ break;
}
}
else
@@ -4984,7 +4990,7 @@ soap_wsse_add_EncryptedKey_encrypt_only(
if (soap_tagsearch(data->encid, "ds:Signature"))
{
/* support ds:Signature encryption only with HTTP chunking, otherwise content length is incorrect */
- if ((soap->omode & SOAP_IO) == SOAP_IO_BUFFER)
+ if ((soap->omode & SOAP_IO) == SOAP_IO_BUFFER || (soap->omode & SOAP_IO) == SOAP_IO_FLUSH)
soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_CHUNK;
}
}
@@ -7572,6 +7578,8 @@ soap_wsse_preparefinalsend(struct soap *
soap->c14ninclude = NULL; /* but do not render inclusive namespaces */
if ((soap->mode & SOAP_XML_INDENT))
soap->count += 5; /* correction for soap->ns = 0: add \n+indent */
+ if ((soap->mode & SOAP_XML_DEFAULTNS))
+ soap->count -= 2*(9 + strlen(ds_URI)); /* correct for xmlns="http://www.w3.org/2000/09/xmldsig#" added to SignedInfo and ds:SignatureValue */
}
soap_out_ds__SignedInfoType(soap, "ds:SignedInfo", 0, signature->SignedInfo, NULL);
soap_out__ds__SignatureValue(soap, "ds:SignatureValue", 0, &signature->SignatureValue, NULL);
Index: gsoap-2.8.102/gsoap/plugin/wsseapi.cpp
===================================================================
--- gsoap-2.8.102.orig/gsoap/plugin/wsseapi.cpp
+++ gsoap-2.8.102/gsoap/plugin/wsseapi.cpp
@@ -3956,9 +3956,12 @@ soap_wsse_verify_SignatureValue(struct s
if (att->name && att->text && !strcmp(att->name, "xmlns"))
{
soap_attribute(soap, att->name, att->text);
+ prt = NULL;
break;
}
}
+ if (!prt)
+ break;
}
}
else
@@ -4247,9 +4250,12 @@ soap_wsse_verify_digest(struct soap *soa
if (att->name && att->text && !strcmp(att->name, "xmlns"))
{
soap_attribute(soap, att->name, att->text);
+ prt = NULL;
break;
}
}
+ if (!prt)
+ break;
}
}
else
@@ -4984,7 +4990,7 @@ soap_wsse_add_EncryptedKey_encrypt_only(
if (soap_tagsearch(data->encid, "ds:Signature"))
{
/* support ds:Signature encryption only with HTTP chunking, otherwise content length is incorrect */
- if ((soap->omode & SOAP_IO) == SOAP_IO_BUFFER)
+ if ((soap->omode & SOAP_IO) == SOAP_IO_BUFFER || (soap->omode & SOAP_IO) == SOAP_IO_FLUSH)
soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_CHUNK;
}
}
@@ -7572,6 +7578,8 @@ soap_wsse_preparefinalsend(struct soap *
soap->c14ninclude = NULL; /* but do not render inclusive namespaces */
if ((soap->mode & SOAP_XML_INDENT))
soap->count += 5; /* correction for soap->ns = 0: add \n+indent */
+ if ((soap->mode & SOAP_XML_DEFAULTNS))
+ soap->count -= 2*(9 + strlen(ds_URI)); /* correct for xmlns="http://www.w3.org/2000/09/xmldsig#" added to SignedInfo and ds:SignatureValue */
}
soap_out_ds__SignedInfoType(soap, "ds:SignedInfo", 0, signature->SignedInfo, NULL);
soap_out__ds__SignatureValue(soap, "ds:SignatureValue", 0, &signature->SignatureValue, NULL);