~ubuntu-branches/ubuntu/dapper/lasso/dapper

« back to all changes in this revision

Viewing changes to lasso/id-ff/login.c

  • Committer: Bazaar Package Importer
  • Author(s): Loic Pefferkorn
  • Date: 2005-11-25 19:20:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051125192059-m4894lhpynmkrmwr
Tags: 0.6.3-4ubuntu1
Resynchronise with Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: login.c,v 1.253 2005/05/17 19:38:47 fpeters Exp $
 
1
/* $Id: login.c,v 1.255 2005/08/10 11:29:52 fpeters Exp $
2
2
 *
3
3
 * Lasso - A free implementation of the Liberty Alliance specifications.
4
4
 *
321
321
static gboolean
322
322
lasso_login_must_ask_for_consent_private(LassoLogin *login)
323
323
{
324
 
        xmlChar *nameIDPolicy, *consent;
 
324
        char *nameIDPolicy, *consent;
325
325
        LassoProfile *profile = LASSO_PROFILE(login);
326
326
        LassoFederation *federation = NULL;
327
327
 
501
501
                                        LASSO_LIB_STATUS_CODE_FEDERATION_DOES_NOT_EXIST) == 0) {
502
502
                                        return LASSO_LOGIN_ERROR_FEDERATION_NOT_FOUND;
503
503
                                }
 
504
                                if (strcmp(status_value,
 
505
                                                LASSO_LIB_STATUS_CODE_UNKNOWN_PRINCIPAL) == 0) {
 
506
                                        return LASSO_LOGIN_ERROR_UNKNOWN_PRINCIPAL;
 
507
                                }
504
508
                        }
505
509
                }
506
510
                return LASSO_LOGIN_ERROR_STATUS_NOT_SUCCESS;
611
615
lasso_login_build_assertion_artifact(LassoLogin *login)
612
616
{
613
617
        xmlSecByte samlArt[42], *b64_samlArt;
614
 
        xmlChar *identityProviderSuccinctID;
 
618
        char *identityProviderSuccinctID;
615
619
 
616
620
        identityProviderSuccinctID = lasso_sha1(
617
621
                        LASSO_PROVIDER(LASSO_PROFILE(login)->server)->ProviderID);
619
623
        /* Artifact Format is described in "Binding Profiles", 3.2.2.2. */
620
624
        memcpy(samlArt, "\000\003", 2); /* type code */
621
625
        memcpy(samlArt+2, identityProviderSuccinctID, 20);
622
 
        lasso_build_random_sequence(samlArt+22, 20);
 
626
        lasso_build_random_sequence((char*)samlArt+22, 20);
623
627
 
624
628
        xmlFree(identityProviderSuccinctID);
625
629
        b64_samlArt = xmlSecBase64Encode(samlArt, 42, 0);
626
630
 
627
 
        login->assertionArtifact = g_strdup(b64_samlArt);
 
631
        login->assertionArtifact = g_strdup((char*)b64_samlArt);
628
632
        xmlFree(b64_samlArt);
629
633
}
630
634
 
645
649
        LassoProvider *remote_provider;
646
650
        LassoProfile *profile;
647
651
        gchar *url;
648
 
        xmlSecByte *b64_samlArt, *relayState;
 
652
        xmlChar *b64_samlArt;
 
653
        char *relayState;
649
654
        gint ret = 0;
650
655
 
651
656
        g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
708
713
                }
709
714
        }
710
715
 
711
 
        b64_samlArt = xmlStrdup(login->assertionArtifact);
712
 
        relayState = xmlURIEscapeStr(LASSO_LIB_AUTHN_REQUEST(profile->request)->RelayState, NULL);
 
716
        b64_samlArt = xmlStrdup((xmlChar*)login->assertionArtifact);
 
717
        relayState = (char*)xmlURIEscapeStr(
 
718
                        (xmlChar*)LASSO_LIB_AUTHN_REQUEST(profile->request)->RelayState, NULL);
713
719
 
714
720
        if (http_method == LASSO_HTTP_METHOD_REDIRECT) {
715
721
                xmlChar *escaped_artifact = xmlURIEscapeStr(b64_samlArt, NULL);
725
731
 
726
732
        if (http_method == LASSO_HTTP_METHOD_POST) {
727
733
                profile->msg_url = g_strdup(url);
728
 
                profile->msg_body = g_strdup(b64_samlArt);
 
734
                profile->msg_body = g_strdup((char*)b64_samlArt);
729
735
                if (relayState != NULL) {
730
736
                        profile->msg_relayState = g_strdup(relayState);
731
737
                }
1168
1174
                artifact_b64 = g_strdup(response_msg);
1169
1175
        }
1170
1176
 
1171
 
        i = xmlSecBase64Decode(artifact_b64, artifact, 43);
 
1177
        i = xmlSecBase64Decode((xmlChar*)artifact_b64, (xmlChar*)artifact, 43);
1172
1178
        if (i < 0 || i > 42) {
1173
1179
                g_free(artifact_b64);
1174
1180
                return LASSO_ERROR_UNDEFINED;
1182
1188
        memcpy(provider_succinct_id, artifact+2, 20);
1183
1189
        provider_succinct_id[20] = 0;
1184
1190
 
1185
 
        provider_succinct_id_b64 = xmlSecBase64Encode(provider_succinct_id, 20, 0);
 
1191
        provider_succinct_id_b64 = (char*)xmlSecBase64Encode((xmlChar*)provider_succinct_id, 20, 0);
1186
1192
 
1187
1193
        LASSO_PROFILE(login)->remote_providerID = lasso_server_get_providerID_from_hash(
1188
1194
                        LASSO_PROFILE(login)->server, provider_succinct_id_b64);
1611
1617
        LassoLogin *login = LASSO_LOGIN(node);
1612
1618
 
1613
1619
        xmlnode = parent_class->get_xmlNode(node, lasso_dump);
1614
 
        xmlSetProp(xmlnode, "LoginDumpVersion", "2");
 
1620
        xmlSetProp(xmlnode, (xmlChar*)"LoginDumpVersion", (xmlChar*)"2");
1615
1621
 
1616
1622
        if (login->protocolProfile == LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_ART)
1617
 
                xmlNewTextChild(xmlnode, NULL, "ProtocolProfile", "Artifact");
 
1623
                xmlNewTextChild(xmlnode, NULL, (xmlChar*)"ProtocolProfile", (xmlChar*)"Artifact");
1618
1624
        if (login->protocolProfile == LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_POST)
1619
 
                xmlNewTextChild(xmlnode, NULL, "ProtocolProfile", "POST");
 
1625
                xmlNewTextChild(xmlnode, NULL, (xmlChar*)"ProtocolProfile", (xmlChar*)"POST");
1620
1626
 
1621
1627
        return xmlnode;
1622
1628
}
1637
1643
                        t = t->next;
1638
1644
                        continue;
1639
1645
                }
1640
 
                if (strcmp(t->name, "ProtocolProfile") == 0) {
 
1646
                if (strcmp((char*)t->name, "ProtocolProfile") == 0) {
1641
1647
                        char *s;
1642
 
                        s = xmlNodeGetContent(t);
 
1648
                        s = (char*)xmlNodeGetContent(t);
1643
1649
                        if (strcmp(s, "Artifact") == 0)
1644
1650
                                login->protocolProfile = LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_ART;
1645
1651
                        if (strcmp(s, "POST") == 0)