~tieto/+junk/openldap

« back to all changes in this revision

Viewing changes to libraries/libldap/tls_g.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-09-07 13:41:10 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090907134110-rsnlhy8b0r21p9bg
Tags: 2.4.18-0ubuntu1
* New upstream release: (LP: #419515):
  + pcache overlay supports disconnected mode.
* Fix nss overlay load (LP: #417163).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* tls_g.c - Handle tls/ssl using GNUTLS. */
2
 
/* $OpenLDAP: pkg/ldap/libraries/libldap/tls_g.c,v 1.6.2.5 2009/04/29 01:25:43 quanah Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/libraries/libldap/tls_g.c,v 1.6.2.6 2009/08/13 00:52:04 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
5
 * Copyright 2008-2009 The OpenLDAP Foundation.
722
722
        if ( ret >= 0 ) {
723
723
                ret = LDAP_SUCCESS;
724
724
        } else {
725
 
                altnamesize = sizeof(altname);
726
 
                ret = gnutls_x509_crt_get_dn_by_oid( cert, CN_OID,
727
 
                        0, 0, altname, &altnamesize );
 
725
                /* find the last CN */
 
726
                i=0;
 
727
                do {
 
728
                        altnamesize = 0;
 
729
                        ret = gnutls_x509_crt_get_dn_by_oid( cert, CN_OID,
 
730
                                i, 1, altname, &altnamesize );
 
731
                        if ( ret == GNUTLS_E_SHORT_MEMORY_BUFFER )
 
732
                                i++;
 
733
                        else
 
734
                                break;
 
735
                } while ( 1 );
 
736
 
 
737
                if ( i ) {
 
738
                        altnamesize = sizeof(altname);
 
739
                        ret = gnutls_x509_crt_get_dn_by_oid( cert, CN_OID,
 
740
                                i-1, 0, altname, &altnamesize );
 
741
                }
 
742
 
728
743
                if ( ret < 0 ) {
729
744
                        Debug( LDAP_DEBUG_ANY,
730
745
                                "TLS: unable to get common name from peer certificate.\n",