Ben Laurie wrote: > > francoise lacambre wrote: > > > > Don't you think, in the X509_STORE_get_by_subject function, that the following > > line > > vs->current_method=j; > > would be replaced by : > > vs->current_method=i; > > Yes!
Hmm ... still looks wrong to me ... I suspect it should do this, but it isn't my code - Steve? Index: crypto/x509/x509_lu.c =================================================================== RCS file: /e/openssl/cvs/openssl/crypto/x509/x509_lu.c,v retrieving revision 1.24 diff -u -r1.24 x509_lu.c --- crypto/x509/x509_lu.c 2001/09/01 20:01:58 1.24 +++ crypto/x509/x509_lu.c 2001/11/20 13:58:10 @@ -285,19 +285,21 @@ X509_STORE *ctx=vs->ctx; X509_LOOKUP *lu; X509_OBJECT stmp,*tmp; - int i,j; + int i,j,k; tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); if (tmp == NULL) { - for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) + for (i=vs->current_method,k=0; k<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++,k++) { + if(k == sk_X509_LOOKUP_num(ctx->get_cert_methods)) + k=0; lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); j=X509_LOOKUP_by_subject(lu,type,name,&stmp); if (j < 0) { - vs->current_method=j; + vs->current_method=k; return j; } else if (j) @@ -306,7 +308,6 @@ break; } } - vs->current_method=0; if (tmp == NULL) return 0; } > > Cheers, > > Ben. > > > in the case where j<0 , i.e. j==X509_LU_RETRY ? i is a LOOKUP method, not j. > > ------------------------------------------------------------------------------ > > int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name, > > X509_OBJECT *ret) > > { > > X509_STORE *ctx=vs->ctx; > > X509_LOOKUP *lu; > > X509_OBJECT stmp,*tmp; > > int i,j; > > > > tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name); > > > > if (tmp == NULL) > > { > > for (i=vs->current_method; > > i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) > > { > > lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i); > > j=X509_LOOKUP_by_subject(lu,type,name,&stmp); > > if (j < 0) > > { > > // vs->current_method=j; > > vs->current_method=i; > > return j; > > } > > else if (j) > > { > > tmp= &stmp; > > break; > > } > > } > > vs->current_method=0; > > if (tmp == NULL) > > return 0; > > } > > > > /* if (ret->data.ptr != NULL) > > X509_OBJECT_free_contents(ret); */ > > > > ret->type=tmp->type; > > ret->data.ptr=tmp->data.ptr; > > > > X509_OBJECT_up_ref_count(ret); > > > > return 1; > > } > > > > -- > > ------- Francoise LACAMBRE ------------ BULL I&S ------ > > Tel : 01 30 80 77 51 (237 7751) Rue Jean Jaures > > Fax : 01 30 80 65 40 (237 6540) 78340 Les Clayes-sous-Bois > > mailto:[EMAIL PROTECTED] Poste Courrier : FRCL P2/130 > > ______________________________________________________________________ > > OpenSSL Project http://www.openssl.org > > Development Mailing List [EMAIL PROTECTED] > > Automated List Manager [EMAIL PROTECTED] > > -- > http://www.apache-ssl.org/ben.html http://www.thebunker.net/ > > "There is no limit to what a man can do or how far he can go if he > doesn't mind who gets the credit." - Robert Woodruff > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > Development Mailing List [EMAIL PROTECTED] > Automated List Manager [EMAIL PROTECTED] -- http://www.apache-ssl.org/ben.html http://www.thebunker.net/ "There is no limit to what a man can do or how far he can go if he doesn't mind who gets the credit." - Robert Woodruff ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]