diff --git a/lasso/Makefile.am b/lasso/Makefile.am index 63a9034d..1b6286e7 100644 --- a/lasso/Makefile.am +++ b/lasso/Makefile.am @@ -36,11 +36,15 @@ clean-local: EXTRA_DIST = extract_types.py extract_symbols.py +if WSF_ENABLED +WSF_LIB_FILE = $(top_builddir)/lasso/id-wsf/liblasso-id-wsf.la +endif + if MINGW liblasso_la_LIBADD = \ $(top_builddir)/lasso/xml/liblasso-xml.la \ $(top_builddir)/lasso/id-ff/liblasso-id-ff.la \ - $(top_builddir)/lasso/id-wsf/liblasso-id-wsf.la \ + $(WSF_LIB_FILE) \ $(LASSO_LIBS) \ lasso.rc.lo # Just make damn sure the ABI stays the same between @@ -52,7 +56,7 @@ else liblasso_la_LIBADD = \ $(top_builddir)/lasso/xml/liblasso-xml.la \ $(top_builddir)/lasso/id-ff/liblasso-id-ff.la \ - $(top_builddir)/lasso/id-wsf/liblasso-id-wsf.la \ + $(WSF_LIB_FILE) \ $(LASSO_LIBS) # Just make damn sure the ABI stays the same between # upgrades. diff --git a/lasso/extract_symbols.py b/lasso/extract_symbols.py index 5c3ff8ca..2239f9a7 100644 --- a/lasso/extract_symbols.py +++ b/lasso/extract_symbols.py @@ -20,8 +20,9 @@ symbols = [] for header_file in glob.glob('%s/*/*.h' % srcdir) + glob.glob('%s/*.h' % srcdir): symbols.extend(regex.findall(file(header_file).read().replace('\\\n', ''))) -wsf = ['lasso_disco', 'lasso_dst', 'lasso_is', 'lasso_profile_service', - 'lasso_discovery', 'lasso_wsf', 'lasso_interaction', 'lasso_utility' ] +wsf = ['lasso_disco_', 'lasso_dst_', 'lasso_is_', 'lasso_profile_service', + 'lasso_discovery', 'lasso_wsf', 'lasso_interaction', 'lasso_utility', + 'lasso_sa_', 'lasso_soap_', 'lasso_authentication' ] if enable_wsf: wsf = [] diff --git a/lasso/extract_types.py b/lasso/extract_types.py index 4c8eda08..f868b9ae 100644 --- a/lasso/extract_types.py +++ b/lasso/extract_types.py @@ -14,6 +14,12 @@ if len(sys.argv) == 2+enable_wsf: else: srcdir = '.' +wsf = ['lasso_disco_', 'lasso_dst_', 'lasso_is_', 'lasso_profile_service', + 'lasso_discovery', 'lasso_wsf', 'lasso_interaction', 'lasso_utility', + 'lasso_sa_', 'lasso_soap_', 'lasso_authentication' ] +if enable_wsf: + wsf = [] + fd = open('types.c', 'w') print >> fd, "/* This file has been autogenerated; changes will be lost */" @@ -30,7 +36,11 @@ for header_file in glob.glob('%s/*/*.h' % srcdir): type = re.findall('lasso_.*get_type', open(header_file).read())[0] except IndexError: continue - print >> fd, "extern GType %s();" % type + for t in wsf: + if type.startswith(t): + break + else: + print >> fd, "extern GType %s();" % type print >> fd, "" print >> fd, "type_function functions[] = {" @@ -39,7 +49,11 @@ for header_file in header_files: type = re.findall('lasso_.*get_type', open(header_file).read())[0] except IndexError: continue - print >> fd, "\t%s," % type + for t in wsf: + if type.startswith(t): + break + else: + print >> fd, "\t%s," % type print >> fd, "\tNULL" print >> fd, "};" diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c index e91bea4f..2087fbcc 100644 --- a/lasso/id-ff/login.c +++ b/lasso/id-ff/login.c @@ -24,15 +24,18 @@ #include -#include -#include -#include #include #include #include #include #include +#ifdef LASSO_WSF_ENABLED +#include +#include +#include +#endif + #include #include @@ -45,8 +48,10 @@ struct _LassoLoginPrivate { char *soap_request_msg; +#ifdef LASSO_WSF_ENABLED LassoDiscoResourceID *resourceId; LassoDiscoEncryptedResourceID *encryptedResourceId; +#endif }; @@ -69,6 +74,7 @@ static void lasso_login_build_assertion_artifact(LassoLogin *login); static void lasso_login_assertion_add_discovery(LassoLogin *login, LassoSamlAssertion *assertion) { +#ifdef LASSO_WSF_ENABLED LassoProfile *profile = LASSO_PROFILE(login); LassoDiscoResourceOffering *resourceOffering; LassoDiscoServiceInstance *serviceInstance; @@ -94,6 +100,7 @@ lasso_login_assertion_add_discovery(LassoLogin *login, LassoSamlAssertion *asser assertion->AttributeStatement = attributeStatement; } +#endif } @@ -844,8 +851,8 @@ lasso_login_build_response_msg(LassoLogin *login, gchar *remote_providerID) profile->response = lasso_samlp_response_new(); profile->response->InResponseTo = g_strdup(profile->request->RequestID); - if (profile->request->MajorVersion == 1 && profile->request->MinorVersion < 1) { - /* pre-saml 1.1, move accordingly */ + if (profile->request->MajorVersion == 1 && profile->request->MinorVersion == 0) { + /* this is a SAML 1.0 request, must create SAML 1.0 response */ profile->response->MinorVersion = 0; } @@ -1433,11 +1440,13 @@ int lasso_login_set_encryptedResourceId(LassoLogin *login, LassoDiscoEncryptedResourceID *encryptedResourceId) { +#ifdef LASSO_WSF_ENABLED g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); g_return_val_if_fail(LASSO_IS_DISCO_ENCRYPTED_RESOURCE_ID(encryptedResourceId), LASSO_PARAM_ERROR_INVALID_VALUE); login->private_data->encryptedResourceId = g_object_ref(encryptedResourceId); +#endif return 0; } @@ -1455,11 +1464,12 @@ lasso_login_set_encryptedResourceId(LassoLogin *login, int lasso_login_set_resourceId(LassoLogin *login, const char *content) { +#ifdef LASSO_WSF_ENABLED g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); g_return_val_if_fail(content != NULL, LASSO_PARAM_ERROR_INVALID_VALUE); login->private_data->resourceId = lasso_disco_resource_id_new(content); - +#endif return 0; } diff --git a/lasso/id-ff/login.h b/lasso/id-ff/login.h index 2eef0f69..e50f0400 100644 --- a/lasso/id-ff/login.h +++ b/lasso/id-ff/login.h @@ -30,8 +30,13 @@ extern "C" { #endif /* __cplusplus */ +#ifdef LASSO_WSF_ENABLED #include -#include +#else +typedef void LassoDiscoEncryptedResourceID; +typedef void LassoDiscoResourceID; +#endif + #include #include #include diff --git a/lasso/id-ff/server.c b/lasso/id-ff/server.c index 38752b6d..5225ce4a 100644 --- a/lasso/id-ff/server.c +++ b/lasso/id-ff/server.c @@ -81,12 +81,14 @@ lasso_server_add_provider(LassoServer *server, LassoProviderRole role, gint lasso_server_add_service(LassoServer *server, LassoDiscoServiceInstance *service) { +#ifdef LASSO_WSF_ENABLED g_return_val_if_fail(LASSO_IS_SERVER(server), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); g_return_val_if_fail(LASSO_IS_DISCO_SERVICE_INSTANCE(service), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); g_hash_table_insert(server->services, g_strdup(service->ServiceType), g_object_ref(service)); +#endif return 0; } @@ -186,8 +188,6 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode) t = xmlnode->children; while (t) { xmlNode *t2 = t->children; - LassoProvider *p; - LassoDiscoServiceInstance *s; if (t->type != XML_ELEMENT_NODE) { t = t->next; @@ -196,6 +196,7 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode) if (strcmp(t->name, "Providers") == 0) { while (t2) { + LassoProvider *p; if (t2->type != XML_ELEMENT_NODE) { t2 = t2->next; continue; @@ -207,8 +208,10 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode) } } +#ifdef LASSO_WSF_ENABLED if (strcmp(t->name, "Services") == 0) { while (t2) { + LassoDiscoServiceInstance *s; if (t2->type != XML_ELEMENT_NODE) { t2 = t2->next; continue; @@ -219,6 +222,7 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode) t2 = t2->next; } } +#endif t = t->next; } diff --git a/lasso/id-ff/server.h b/lasso/id-ff/server.h index 85d28718..10dc998d 100644 --- a/lasso/id-ff/server.h +++ b/lasso/id-ff/server.h @@ -29,7 +29,11 @@ extern "C" { #endif /* __cplusplus */ +#ifdef LASSO_WSF_ENABLED #include +#else +typedef void LassoDiscoServiceInstance; +#endif #include diff --git a/lasso/id-wsf/Makefile.am b/lasso/id-wsf/Makefile.am index d8f369cc..5cf6cf0c 100644 --- a/lasso/id-wsf/Makefile.am +++ b/lasso/id-wsf/Makefile.am @@ -8,6 +8,20 @@ INCLUDES = \ noinst_LTLIBRARIES = liblasso-id-wsf.la +if WSF_ENABLED +WSF_C_FILES = \ + discovery.c \ + interaction_profile_service.c \ + profile_service.c \ + wsf_profile.c + +WSF_H_FILES = \ + discovery.h \ + interaction_profile_service.h \ + profile_service.h \ + wsf_profile.h +endif + if WSF_AUTH_ENABLED WSF_AUTH_C_FILES = authentication.c WSF_AUTH_H_FILES = authentication.h @@ -15,17 +29,11 @@ endif liblasso_id_wsf_la_SOURCES = \ $(WSF_AUTH_C_FILES) \ - discovery.c \ - interaction_profile_service.c \ - profile_service.c \ - wsf_profile.c + $(WSF_C_FILES) liblassoinclude_HEADERS = \ $(WSF_AUTH_H_FILES) \ - discovery.h \ - interaction_profile_service.h \ - profile_service.h \ - wsf_profile.h + $(WSF_H_FILES) EXTRA_DIST = $(WSF_AUTH_C_FILES) $(WSF_AUTH_H_FILES) diff --git a/lasso/xml/Makefile.am b/lasso/xml/Makefile.am index f9f49161..a3c3f455 100644 --- a/lasso/xml/Makefile.am +++ b/lasso/xml/Makefile.am @@ -8,9 +8,8 @@ INCLUDES = \ noinst_LTLIBRARIES = liblasso-xml.la -liblasso_xml_la_SOURCES = \ - tools.c \ - xml.c \ +if WSF_ENABLED +WSF_C_FILES = \ disco_authenticate_requester.c \ disco_authenticate_session_context.c \ disco_authorize_requester.c \ @@ -51,57 +50,12 @@ liblasso_xml_la_SOURCES = \ is_select.c \ is_text.c \ is_user_interaction.c \ - lib_assertion.c \ - lib_authentication_statement.c \ - lib_authn_context.c \ - lib_authn_request.c \ - lib_authn_request_envelope.c \ - lib_authn_response.c \ - lib_authn_response_envelope.c \ - lib_federation_termination_notification.c \ - lib_idp_entries.c \ - lib_idp_entry.c \ - lib_idp_list.c \ - lib_logout_request.c \ - lib_logout_response.c \ - lib_name_identifier_mapping_request.c \ - lib_name_identifier_mapping_response.c \ - lib_register_name_identifier_request.c \ - lib_register_name_identifier_response.c \ - lib_request_authn_context.c \ - lib_scoping.c \ - lib_status_response.c \ - lib_subject.c \ sa_credentials.c \ sa_parameter.c \ sa_password_transforms.c \ sa_transform.c \ sa_sasl_request.c \ sa_sasl_response.c \ - saml_advice.c \ - saml_assertion.c \ - saml_attribute.c \ - saml_attribute_designator.c \ - saml_attribute_statement.c \ - saml_attribute_value.c \ - saml_audience_restriction_condition.c \ - saml_authentication_statement.c \ - saml_authority_binding.c \ - saml_condition_abstract.c \ - saml_conditions.c \ - saml_name_identifier.c \ - saml_statement_abstract.c \ - saml_subject.c \ - saml_subject_confirmation.c \ - saml_subject_locality.c \ - saml_subject_statement.c \ - saml_subject_statement_abstract.c \ - samlp_request.c \ - samlp_request_abstract.c \ - samlp_response.c \ - samlp_response_abstract.c \ - samlp_status.c \ - samlp_status_code.c \ soap_binding_consent.c \ soap_binding_correlation.c \ soap_binding_processing_context.c \ @@ -116,9 +70,7 @@ liblasso_xml_la_SOURCES = \ soap_header.c \ utility_status.c -liblassoinclude_HEADERS = \ - strings.h \ - xml.h \ +WSF_H_FILES = \ disco_authenticate_requester.h \ disco_authenticate_session_context.h \ disco_authorize_requester.h \ @@ -159,6 +111,80 @@ liblassoinclude_HEADERS = \ is_select.h \ is_text.h \ is_user_interaction.h \ + sa_credentials.h \ + sa_parameter.h \ + sa_password_transforms.h \ + sa_transform.h \ + sa_sasl_request.h \ + sa_sasl_response.h \ + soap_binding_consent.h \ + soap_binding_correlation.h \ + soap_binding_processing_context.h \ + soap_binding_provider.h \ + soap_binding_usage_directive.h \ + soap_binding_ext_credential.h \ + soap_binding_ext_credentials_context.h \ + soap_binding_ext_service_instance_update.h \ + soap_binding_ext_timeout.h \ + soap_body.h \ + soap_envelope.h \ + soap_header.h \ + utility_status.h +endif + +liblasso_xml_la_SOURCES = \ + tools.c \ + xml.c \ + lib_assertion.c \ + lib_authentication_statement.c \ + lib_authn_context.c \ + lib_authn_request.c \ + lib_authn_request_envelope.c \ + lib_authn_response.c \ + lib_authn_response_envelope.c \ + lib_federation_termination_notification.c \ + lib_idp_entries.c \ + lib_idp_entry.c \ + lib_idp_list.c \ + lib_logout_request.c \ + lib_logout_response.c \ + lib_name_identifier_mapping_request.c \ + lib_name_identifier_mapping_response.c \ + lib_register_name_identifier_request.c \ + lib_register_name_identifier_response.c \ + lib_request_authn_context.c \ + lib_scoping.c \ + lib_status_response.c \ + lib_subject.c \ + saml_advice.c \ + saml_assertion.c \ + saml_attribute.c \ + saml_attribute_designator.c \ + saml_attribute_statement.c \ + saml_attribute_value.c \ + saml_audience_restriction_condition.c \ + saml_authentication_statement.c \ + saml_authority_binding.c \ + saml_condition_abstract.c \ + saml_conditions.c \ + saml_name_identifier.c \ + saml_statement_abstract.c \ + saml_subject.c \ + saml_subject_confirmation.c \ + saml_subject_locality.c \ + saml_subject_statement.c \ + saml_subject_statement_abstract.c \ + samlp_request.c \ + samlp_request_abstract.c \ + samlp_response.c \ + samlp_response_abstract.c \ + samlp_status.c \ + samlp_status_code.c \ + $(WSF_C_FILES) + +liblassoinclude_HEADERS = \ + strings.h \ + xml.h \ lib_assertion.h \ lib_authentication_statement.h \ lib_authn_context.h \ @@ -180,12 +206,6 @@ liblassoinclude_HEADERS = \ lib_scoping.h \ lib_status_response.h \ lib_subject.h \ - sa_credentials.h \ - sa_parameter.h \ - sa_password_transforms.h \ - sa_transform.h \ - sa_sasl_request.h \ - sa_sasl_response.h \ saml_advice.h \ saml_assertion.h \ saml_attribute.h \ @@ -210,19 +230,7 @@ liblassoinclude_HEADERS = \ samlp_response_abstract.h \ samlp_status.h \ samlp_status_code.h \ - soap_binding_consent.h \ - soap_binding_correlation.h \ - soap_binding_processing_context.h \ - soap_binding_provider.h \ - soap_binding_usage_directive.h \ - soap_binding_ext_credential.h \ - soap_binding_ext_credentials_context.h \ - soap_binding_ext_service_instance_update.h \ - soap_binding_ext_timeout.h \ - soap_body.h \ - soap_envelope.h \ - soap_header.h \ - utility_status.h + $(WSF_H_FILES) lasso_private_h_sources = \ private.h diff --git a/swig/Lasso.i b/swig/Lasso.i index b2609239..40aef150 100644 --- a/swig/Lasso.i +++ b/swig/Lasso.i @@ -56,8 +56,10 @@ #include #include +#ifdef LASSO_WSF_ENABLED #include #include +#endif %} diff --git a/tests/Makefile.am b/tests/Makefile.am index 4cb1b628..e57a4d7c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,7 @@ if WITH_TESTS TESTS = tests -noinst_PROGRAMS = tests perfs +noinst_PROGRAMS = tests perfs m2 INCLUDES = \ -DPACKAGE=\"@PACKAGE@\" \ @@ -20,6 +20,9 @@ tests_LDADD = \ perfs_SOURCES = perfs.c perfs_LDADD = $(top_builddir)/lasso/liblasso.la $(LASSO_LIBS) +m2_SOURCES = m2.c +m2_LDADD = $(top_builddir)/lasso/liblasso.la $(LASSO_LIBS) + endif EXTRA_DIST = tests.c login_tests.c basic_tests.c random_tests.c