Add a stress test for serializing/deserializing code

* Makefile.am:
   add targets
 * tests2.c:
   this simple makes lots of serializing, deserializing.
 * data/response-1:
 * data/response-2:
 * data/response-3:
   data test files
This commit is contained in:
Benjamin Dauvergne 2009-04-30 14:58:13 +00:00
parent c5f5f84329
commit be2825415e
5 changed files with 201 additions and 2 deletions

View File

@ -1,8 +1,8 @@
MAINTAINERCLEANFILES = Makefile.in
if WITH_TESTS
TESTS = tests
noinst_PROGRAMS = tests perfs
TESTS = tests tests2
noinst_PROGRAMS = tests perfs tests2
INCLUDES = \
-DPACKAGE=\"@PACKAGE@\" \
@ -20,6 +20,13 @@ tests_LDADD = \
$(CHECK_LIBS)
tests_LDFLAGS = -rpath `cd $(top_srcdir)/lasso/.libs/; pwd`
tests2_SOURCES = tests2.c
tests2_LDADD = \
$(top_builddir)/lasso/liblasso.la \
$(LASSO_LIBS) \
$(CHECK_LIBS)
tests2_LDFLAGS = -rpath `cd $(top_srcdir)/lasso/.libs/; pwd`
perfs_SOURCES = perfs.c
perfs_LDADD = $(top_builddir)/lasso/liblasso.la $(LASSO_LIBS)
perfs_LDFLAGS = -rpath `cd $(top_srcdir)/lasso/.libs/; pwd`

57
tests/data/response-1 Normal file
View File

@ -0,0 +1,57 @@
<samlp:Response IssueInstant="2009-04-20T14:31:31.917Z" ID="dzzfpt4zXBljkK2pummN8Ro2zo-" Version="2.0" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"><saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">gefssstg</saml:Issuer><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status><saml:Assertion Version="2.0" IssueInstant="2009-04-20T14:31:31.972Z" ID="Zm9SHCgSkcP34HQTbn5ZOp6dQeB" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"><saml:Issuer>gefssstg</saml:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#Zm9SHCgSkcP34HQTbn5ZOp6dQeB">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>AuvPOsEPfXxMD4Je7W3W9Qk34/g=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
qO+/JLyIspZUvOCtp0tsf+8NTL9mSFZyhuzWnflQnG8MaGJ6RUwXtMeupfwsjmfJPJ7lMxV45abT
TN1UWASzfhPWH+rWbi3lqzut3vPTxZyj8i+nGDdkIMpxLpf9WXT+LTLgiQZsK9IU27sJuM7CuyEN
9Kyr2076DF6pz/w0/20=
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
MIIE1DCCA7ygAwIBAgIRALvyUuiiVghKTPVWuO9rkJMwDQYJKoZIhvcNAQEFBQAwazELMAkGA1UE
BhMCVVMxLTArBgNVBAoTJFRydXN0ZWQgU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTEtMCsG
A1UEAxMkVHJ1c3RlZCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTA4MTEwNjAwMDAw
MFoXDTEwMTEwNjIzNTk1OVowgdUxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDVDESMBAGA1UEBxMJ
RmFpcmZpZWxkMSEwHwYDVQQKExhHZW5lcmFsIEVsZWN0cmljIENvbXBhbnkxGDAWBgNVBAsTD0dF
IEdJUyBDb3JwdDUwODEtMCsGA1UECxMkUHJvdmlkZWQgYnkgR2VuZXJhbCBFbGVjdHJpYyBDb21w
YW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m0292fQ8tiFcZZ6S
Pt+GiSi4+PatACeb0wXK/lTeus3dWJ5m1pRYt6tGp5Q+h/uTA2094uKxEpjZ+TYFBadLxNvNcRQb
/06AaxVLZFuFpJwfFzyQYE1CyRNgjl6prucUWQ1e/OMn15BGSnY4Ft3c8w==
</ds:X509Certificate>
</ds:X509Data>
<ds:KeyValue>
<ds:RSAKeyValue>
<ds:Modulus>
zsI/0WU10s9ih/UG3InXby5h4UdZzQ/x7Jdl7oAc7aeYvZmpenOkO3bF4saq77uNqQTkiOv148uD
JD7ZSnuBSUxWauSVT+LklThXQdgWR0MVBAfNwAcjRj9RK1/iJnVIRhWo8ckQLKtdKfxr03hShlu+
oKYPjJxpj5sK9iB5yW8=
</ds:Modulus>
<ds:Exponent>AQAB</ds:Exponent>
</ds:RSAKeyValue>
</ds:KeyValue>
</ds:KeyInfo>
</ds:Signature><saml:Subject><saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">999999500</saml:NameID><saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData NotOnOrAfter="2009-04-20T14:36:31.973Z" Recipient="https://wg.us.wrproxy.com/idpsso.php"/></saml:SubjectConfirmation></saml:Subject><saml:Conditions NotOnOrAfter="2009-04-20T14:36:31.972Z" NotBefore="2009-04-20T14:26:31.972Z"><saml:AudienceRestriction><saml:Audience>Webroot</saml:Audience></saml:AudienceRestriction></saml:Conditions><saml:AuthnStatement AuthnInstant="2009-04-20T14:31:31.971Z" SessionIndex="Zm9SHCgSkcP34HQTbn5ZOp6dQeB"><saml:AuthnContext><saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef></saml:AuthnContext></saml:AuthnStatement><saml:AttributeStatement xmlns:xs="http://www.w3.org/2001/XMLSchema"><saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" Name="lastname"><saml:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">User</saml:AttributeValue></saml:Attribute><saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" Name="uid"><saml:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">999999500</saml:AttributeValue></saml:Attribute><saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" Name="firstname"><saml:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Test</saml:AttributeValue></saml:Attribute><saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" Name="mail"><saml:AttributeValue xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">999999500@apctest.ge.com</saml:AttributeValue></saml:Attribute></saml:AttributeStatement></saml:Assertion></samlp:Response>

39
tests/data/response-2 Normal file
View File

@ -0,0 +1,39 @@
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><samlp:ArtifactResponse xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_4CA30953B0EB4751E59BA239A1F58BEE" InResponseTo="_34B09583D8AD90E6B1345B27B2CA7DD2" Version="2.0" IssueInstant="2009-04-29T22:27:50Z"><saml:Issuer>http://idp5/metadata</saml:Issuer><Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_4CA30953B0EB4751E59BA239A1F58BEE">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>qMli6MfowrcVD5sX9qx5nvZe0lI=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>elUruTbgjvLHOWnIhphsVxBe2YS6I3+vfafeFYZuVFG0vTsllOlEA7wLx9KOL9mS
6fH85wZX9MhjIInRvGYII8mF0/44Znzs2oja/Fya8RLSYGpLG+ApCycifOrDWzug
JsA61l1KjQjb+FBjZDiUoQQPuIPGHjb37DPYo76VMsokmBiMxzmwzoDF9BPutOan
86aKbnisJj1nJELI0ByNYHQ6S7sG37CqyQCOZS4ejLzKLZiabi1kprqvAUNWudJd
823Z3aGeTmAfEqSaAQdN6Xe6Jm2yhKHQViAjWVUHNy3Sv+r8QUeZ2EyrMoLzSchf
WbWtCZv1likzLE7wmk774A==</SignatureValue>
</Signature><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status><samlp:Response ID="_7B2794BBDB00FFF0AE081819A9885B21" InResponseTo="_419A9FE32E90F7708AB7A92C9ADD8D55" Version="2.0" IssueInstant="2009-04-29T22:27:48Z"><saml:Issuer>http://idp5/metadata</saml:Issuer><samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status><saml:Assertion Version="2.0" ID="_CE34ABBDD29EDCCE9052BAB4E7171900" IssueInstant="2009-04-29T22:27:48Z"><saml:Issuer>http://idp5/metadata</saml:Issuer><Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_CE34ABBDD29EDCCE9052BAB4E7171900">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>eybLGqaQGyA4dHn/XVeISNH+52A=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>sMhV5ZxdTWgIzEOAgUlh5T8vBJMmhDYBXqvDNgCZZ14mhn8ZZAnzmlzuXY6KycRm
Ko8RPCcbhkVnTzhDG0osMe9NGhnRSJ0Ra1mO/6lyPJP62z+GSHkQvnkH944nqDEs
wFp7NbqwccvbVslCQUf0Dm4leOhWZV6dZFBIR6W755W1nFpgM+AWiIBIUxu9k7TO
kq7wXhaXZCKtzpvh60g17ezOR9XuovUf79igPbsR1d7cFaTbhfPknoC2/WDYS+dy
JGqf73erEE/oEXCFuUYulZkcUAAtFa/T7CF2nQ2GM82F+p1gogOK3U3f11YZPovD
ZBG6A4U7T+8RC3tTemLnWA==</SignatureValue>
</Signature><saml:Subject><saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" NameQualifier="http://idp5/metadata" SPNameQualifier="http://sp5/metadata">_E7799BC7D0C299FABBB7367100656120</saml:NameID><saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData NotOnOrAfter="FIXME: notOnOrAfter" Recipient="http://sp5/singleSignOnArtifact" InResponseTo="_419A9FE32E90F7708AB7A92C9ADD8D55"/></saml:SubjectConfirmation></saml:Subject><saml:Conditions><saml:AudienceRestriction><saml:Audience>http://sp5/metadata</saml:Audience></saml:AudienceRestriction></saml:Conditions><saml:AuthnStatement AuthnInstant="FIXME: authenticationInstant" SessionNotOnOrAfter="FIXME: notOnOrAfter"><saml:AuthnContext><saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:1.0:am:password</saml:AuthnContextClassRef></saml:AuthnContext></saml:AuthnStatement></saml:Assertion></samlp:Response></samlp:ArtifactResponse></s:Body></s:Envelope>

63
tests/data/response-3 Normal file
View File

@ -0,0 +1,63 @@
<samlp:ArtifactResponse xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_4CA30953B0EB4751E59BA239A1F58BEE" InResponseTo="_34B09583D8AD90E6B1345B27B2CA7DD2" Version="2.0" IssueInstant="2009-04-29T22:27:50Z" SignType="1" SignMethod="1">
<saml:Issuer>http://idp5/metadata</saml:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_4CA30953B0EB4751E59BA239A1F58BEE">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue/>
</Reference>
</SignedInfo>
<SignatureValue/>
</Signature>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<samlp:PrivateKeyFile>./data//idp5-saml2/private-key.pem</samlp:PrivateKeyFile>
<samlp:Response ID="_7B2794BBDB00FFF0AE081819A9885B21" InResponseTo="_419A9FE32E90F7708AB7A92C9ADD8D55" Version="2.0" IssueInstant="2009-04-29T22:27:48Z" SignType="0" SignMethod="0">
<saml:Issuer>http://idp5/metadata</saml:Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<saml:Assertion Version="2.0" ID="_CE34ABBDD29EDCCE9052BAB4E7171900" IssueInstant="2009-04-29T22:27:48Z" SignType="1" SignMethod="1" EncryptionActivated="false" EncryptionSymKeyType="0">
<saml:Issuer>http://idp5/metadata</saml:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_CE34ABBDD29EDCCE9052BAB4E7171900">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue/>
</Reference>
</SignedInfo>
<SignatureValue/>
</Signature>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" NameQualifier="http://idp5/metadata" SPNameQualifier="http://sp5/metadata">_E7799BC7D0C299FABBB7367100656120</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData NotOnOrAfter="FIXME: notOnOrAfter" Recipient="http://sp5/singleSignOnArtifact" InResponseTo="_419A9FE32E90F7708AB7A92C9ADD8D55"/>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions>
<saml:AudienceRestriction>
<saml:Audience>http://sp5/metadata</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="FIXME: authenticationInstant" SessionNotOnOrAfter="FIXME: notOnOrAfter">
<saml:AuthnContext>
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:1.0:am:password</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:PrivateKeyFile>./data//idp5-saml2/private-key.pem</saml:PrivateKeyFile>
</saml:Assertion>
</samlp:Response>
</samlp:ArtifactResponse>

33
tests/tests2.c Normal file
View File

@ -0,0 +1,33 @@
#include <lasso/lasso.h>
#include <lasso/xml/xml.h>
#include <glib.h>
#include <libxml/tree.h>
void load(char *file) {
LassoNode *node = NULL;
char *content;
guint len;
xmlNode *xmlnode;
g_file_get_contents(file, &content, &len, NULL);
node = lasso_node_new_from_dump(content);
g_free(content);
xmlnode = lasso_node_get_xmlNode(node, TRUE);
content = lasso_node_dump(node);
g_free(content);
content = lasso_node_export_to_soap(node);
g_free(content);
g_object_unref(node);
xmlFreeNode(xmlnode);
}
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
lasso_init();
load("data/response-1");
load("data/response-2");
load("data/response-3");
lasso_shutdown();
return 0;
}