]> git.sur5r.net Git - openldap/commitdiff
Tweak prev commit
authorHoward Chu <hyc@openldap.org>
Thu, 5 Mar 2009 09:13:26 +0000 (09:13 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 5 Mar 2009 09:13:26 +0000 (09:13 +0000)
libraries/libldap/tls_g.c

index 6283db2ad794c076f0afd1dbbc1d28b29b0f0599..5bef8ee1a24ad3e8d108a5b6cb422e1b3c1f785c 100644 (file)
@@ -385,15 +385,17 @@ tlsg_ctx_init( struct ldapoptions *lo, struct ldaptls *lt, int is_server )
                                for ( j = 0; j<ncas; j++ ) {
                                        if ( gnutls_x509_crt_check_issuer( certs[i-1], cas[j] )) {
                                                certs[i] = cas[j];
+                                               max++;
+                                               /* If this CA is self-signed, we're done */
                                                if ( gnutls_x509_crt_check_issuer( cas[j], cas[j] ))
                                                        j = ncas;
                                                break;
                                        }
                                }
+                               /* only continue if we found a CA and it was not self-signed */
                                if ( j == ncas )
                                        break;
                        }
-                       max = i+1;
                }
                rc = gnutls_certificate_set_x509_key( ctx->cred, certs, max, key );
                if ( rc ) return -1;