~ubuntu-branches/ubuntu/trusty/globus-gssapi-gsi/trusty

« back to all changes in this revision

Viewing changes to library/globus_i_gsi_gss_utils.c

  • Committer: Bazaar Package Importer
  • Author(s): Mattias Ellert
  • Date: 2011-02-26 06:07:56 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110226060756-qd7c91nf440ebhvk
Tags: 7.6-1
Update to Globus Toolkit 5.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 * @author Sam Lang, Sam Meder
21
21
 * 
22
22
 * $RCSfile: globus_i_gsi_gss_utils.c,v $
23
 
 * $Revision: 1.55.2.5 $
24
 
 * $Date: 2010/03/26 16:11:03 $
 
23
 * $Revision: 1.55.2.6 $
 
24
 * $Date: 2011/01/28 02:13:05 $
25
25
 */
26
26
 
27
 
static char *rcsid = "$Id: globus_i_gsi_gss_utils.c,v 1.55.2.5 2010/03/26 16:11:03 bester Exp $";
 
27
static char *rcsid = "$Id: globus_i_gsi_gss_utils.c,v 1.55.2.6 2011/01/28 02:13:05 bester Exp $";
28
28
 
29
29
#include "gssapi_openssl.h"
30
30
#include "globus_i_gsi_gss_utils.h"
1097
1097
    globus_result_t                     local_result = GLOBUS_SUCCESS;
1098
1098
    gss_buffer_desc                     peer_buffer;
1099
1099
    X509 *                              peer_cert = NULL;
1100
 
    X509 *                              eec = NULL;
 
1100
    X509 *                              identity_cert = NULL;
1101
1101
    STACK_OF(X509) *                    peer_cert_chain = NULL;
1102
1102
    static char *                       _function_name_ =
1103
1103
        "globus_i_gsi_gss_retrieve_peer";
1151
1151
            goto exit;
1152
1152
        }
1153
1153
        
1154
 
        local_result = globus_gsi_cert_utils_get_eec(
 
1154
        local_result = globus_gsi_cert_utils_get_identity_cert(
1155
1155
            peer_cert_chain,
1156
 
            &eec);
1157
 
        if(local_result != GLOBUS_SUCCESS || eec == NULL)
 
1156
            &identity_cert);
 
1157
        if(local_result != GLOBUS_SUCCESS || identity_cert == NULL)
1158
1158
        {
1159
1159
            GLOBUS_GSI_GSSAPI_ERROR_CHAIN_RESULT(
1160
1160
                minor_status, local_result,
1163
1163
            goto exit;
1164
1164
        }
1165
1165
 
1166
 
        peer_buffer.value = eec;
 
1166
        peer_buffer.value = identity_cert;
1167
1167
        peer_buffer.length = sizeof(X509);
1168
1168
 
1169
1169
        major_status = gss_import_name(
1477
1477
    gss_cred_id_desc *                  newcred = NULL;
1478
1478
    globus_gsi_cert_utils_cert_type_t   cert_type;
1479
1479
    gss_buffer_desc                     name_buffer;
1480
 
    X509 *                              eec;
 
1480
    X509 *                              identity_cert;
1481
1481
    STACK_OF(X509) *                    cert_chain = NULL;
1482
 
    globus_bool_t                       free_eec = GLOBUS_FALSE;
 
1482
    globus_bool_t                       free_identity_cert = GLOBUS_FALSE;
1483
1483
    
1484
1484
    static char *                       _function_name_ =
1485
1485
        "globus_i_gsi_gss_create_cred";
1539
1539
        goto error_exit;
1540
1540
    }
1541
1541
 
1542
 
    if(GLOBUS_GSI_CERT_UTILS_IS_PROXY(cert_type))
 
1542
    if(GLOBUS_GSI_CERT_UTILS_IS_PROXY(cert_type) && 
 
1543
        !(cert_type & GLOBUS_GSI_CERT_UTILS_TYPE_INDEPENDENT_PROXY))
1543
1544
    {
1544
1545
        local_result = globus_gsi_cred_get_cert_chain(
1545
1546
            newcred->cred_handle, 
1552
1553
            major_status = GSS_S_FAILURE;
1553
1554
            goto error_exit;
1554
1555
        }
1555
 
        local_result = globus_gsi_cert_utils_get_eec(
 
1556
        local_result = globus_gsi_cert_utils_get_identity_cert(
1556
1557
            cert_chain,
1557
 
            &eec);
 
1558
            &identity_cert);
1558
1559
        if (local_result != GLOBUS_SUCCESS)
1559
1560
        {
1560
1561
            GLOBUS_GSI_GSSAPI_ERROR_CHAIN_RESULT(
1570
1571
    {
1571
1572
        local_result = globus_gsi_cred_get_cert(
1572
1573
            newcred->cred_handle, 
1573
 
            &eec);
 
1574
            &identity_cert);
1574
1575
        if (local_result != GLOBUS_SUCCESS)
1575
1576
        {
1576
1577
            GLOBUS_GSI_GSSAPI_ERROR_CHAIN_RESULT(
1579
1580
            major_status = GSS_S_FAILURE;
1580
1581
            goto error_exit;
1581
1582
        }
1582
 
        free_eec = GLOBUS_TRUE;
 
1583
        free_identity_cert = GLOBUS_TRUE;
1583
1584
    }
1584
 
    name_buffer.value = eec;
 
1585
    name_buffer.value = identity_cert;
1585
1586
    name_buffer.length = sizeof(X509);
1586
1587
 
1587
1588
    major_status = gss_import_name(
1611
1612
    }
1612
1613
 
1613
1614
 exit:
1614
 
    if (free_eec)
 
1615
    if (free_identity_cert)
1615
1616
    {
1616
 
        X509_free(eec);
 
1617
        X509_free(identity_cert);
1617
1618
    }
1618
1619
    if (cert_chain != NULL)
1619
1620
    {