summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2020-04-22 02:45:52 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2020-04-22 02:45:52 (GMT)
commit92d12b995459c01ccba48d8b99bd69b09f00f5b1 (patch)
treeb45d71bd353cc4c52641018d21c9659db7ad2cc4
parent55feba5762d78cdbbad8b738eb975b791537a004 (diff)
downloadlasso-92d12b995459c01ccba48d8b99bd69b09f00f5b1.zip
lasso-92d12b995459c01ccba48d8b99bd69b09f00f5b1.tar.gz
lasso-92d12b995459c01ccba48d8b99bd69b09f00f5b1.tar.bz2
Keep order of SessionIndexes
-rwxr-xr-xbindings/python/tests/binding_tests.py9
-rw-r--r--lasso/xml/saml-2.0/samlp2_logout_request.c12
2 files changed, 14 insertions, 7 deletions
diff --git a/bindings/python/tests/binding_tests.py b/bindings/python/tests/binding_tests.py
index 90df3ad..936e8b3 100755
--- a/bindings/python/tests/binding_tests.py
+++ b/bindings/python/tests/binding_tests.py
@@ -322,6 +322,15 @@ class BindingTestCase(unittest.TestCase):
# on reparse non namespaces attributes are ignore, they should not exist
assert node.attributes == {}
+ def test13(self):
+ node = lasso.Samlp2LogoutRequest()
+ node.sessionIndexes = ('1', '2')
+ assert node.sessionIndexes == ('1', '2'), node.sessionIndexes
+ node.sessionIndexes = ()
+ assert node.sessionIndexes == (), node.sessionIndexes
+
+
+
bindingSuite = unittest.makeSuite(BindingTestCase, 'test')
diff --git a/lasso/xml/saml-2.0/samlp2_logout_request.c b/lasso/xml/saml-2.0/samlp2_logout_request.c
index e1f20d4..bb0c9d6 100644
--- a/lasso/xml/saml-2.0/samlp2_logout_request.c
+++ b/lasso/xml/saml-2.0/samlp2_logout_request.c
@@ -268,14 +268,12 @@ lasso_samlp2_logout_request_set_session_indexes(LassoSamlp2LogoutRequest *logout
/* assign rest of the list to the new private field */
pv = GET_PRIVATE(logout_request);
- lasso_assign_list_of_strings(pv->SessionIndex, session_index);
- /* extract last element and assign it to old field */
- if (pv->SessionIndex && pv->SessionIndex->next) {
- GList *last = g_list_last(pv->SessionIndex);
- lasso_assign_new_string(logout_request->SessionIndex, (char*) last->data);
- pv->SessionIndex = g_list_delete_link(pv->SessionIndex, last);
- } else {
+ if (! session_index) {
lasso_release_string(logout_request->SessionIndex);
+ lasso_release_list_of_strings(pv->SessionIndex);
+ } else {
+ lasso_assign_string(logout_request->SessionIndex, (char*) session_index->data);
+ lasso_assign_list_of_strings(pv->SessionIndex, session_index->next);
}
}