Some more stack stuff.

This commit is contained in:
Ben Laurie 1999-05-03 19:55:00 +00:00
parent 0b3f827cf5
commit 661b361b4b
3 changed files with 15 additions and 11 deletions

View File

@ -76,7 +76,8 @@ int sk_##type##_find(STACK_OF(type) *sk,type *v); \
type *sk_##type##_delete(STACK_OF(type) *sk,int n); \
void sk_##type##_delete_ptr(STACK_OF(type) *sk,type *v); \
int sk_##type##_insert(STACK_OF(type) *sk,type *v,int n); \
void sk_##type##_set_cmp_func(STACK_OF(type) *sk,int (*cmp)(type **,type **)); \
int (*sk_##type##_set_cmp_func(STACK_OF(type) *sk, \
int (*cmp)(type **,type **)))(type **,type **); \
STACK_OF(type) *sk_##type##_dup(STACK_OF(type) *sk); \
void sk_##type##_pop_free(STACK_OF(type) *sk,void (*func)(type *)); \
type *sk_##type##_shift(STACK_OF(type) *sk); \
@ -107,8 +108,9 @@ void sk_##type##_delete_ptr(STACK_OF(type) *sk,type *v) \
{ sk_delete_ptr((STACK *)sk,(char *)v); } \
int sk_##type##_insert(STACK_OF(type) *sk,type *v,int n) \
{ return sk_insert((STACK *)sk,(char *)v,n); } \
void sk_##type##_set_cmp_func(STACK_OF(type) *sk,int (*cmp)(type **,type **)) \
{ sk_set_cmp_func((STACK *)sk,cmp); } \
int (*sk_##type##_set_cmp_func(STACK_OF(type) *sk, \
int (*cmp)(type **,type **)))(type **,type **) \
{ return (int (*)(type **,type **))sk_set_cmp_func((STACK *)sk,cmp); } \
STACK_OF(type) *sk_##type##_dup(STACK_OF(type) *sk) \
{ return (STACK_OF(type) *)sk_dup((STACK *)sk); } \
void sk_##type##_pop_free(STACK_OF(type) *sk,void (*func)(type *)) \

View File

@ -876,9 +876,9 @@ int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, char *file, int type);
int SSL_CTX_use_certificate_file(SSL_CTX *ctx, char *file, int type);
int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */
STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
int SSL_add_file_cert_subjects_to_stack(STACK *stackCAs,
int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
const char *file);
int SSL_add_dir_cert_subjects_to_stack(STACK *stackCAs,
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
const char *dir);
#endif

View File

@ -373,7 +373,8 @@ err:
* certs may have been added to \c stack.
*/
int SSL_add_file_cert_subjects_to_stack(STACK *stack,const char *file)
int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
const char *file)
{
BIO *in;
X509 *x=NULL;
@ -381,7 +382,7 @@ int SSL_add_file_cert_subjects_to_stack(STACK *stack,const char *file)
int ret=1;
int (*oldcmp)();
oldcmp=sk_set_cmp_func(stack,name_cmp);
oldcmp=sk_X509_NAME_set_cmp_func(stack,name_cmp);
in=BIO_new(BIO_s_file_internal());
@ -401,10 +402,10 @@ int SSL_add_file_cert_subjects_to_stack(STACK *stack,const char *file)
if ((xn=X509_get_subject_name(x)) == NULL) goto err;
xn=X509_NAME_dup(xn);
if (xn == NULL) goto err;
if (sk_find(stack,(char *)xn) >= 0)
if (sk_X509_NAME_find(stack,xn) >= 0)
X509_NAME_free(xn);
else
sk_push(stack,(char *)xn);
sk_X509_NAME_push(stack,xn);
}
if (0)
@ -417,7 +418,7 @@ err:
if(x != NULL)
X509_free(x);
sk_set_cmp_func(stack,oldcmp);
sk_X509_NAME_set_cmp_func(stack,oldcmp);
return ret;
}
@ -435,7 +436,8 @@ err:
#ifndef WIN32
int SSL_add_dir_cert_subjects_to_stack(STACK *stack,const char *dir)
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
const char *dir)
{
DIR *d=opendir(dir);
struct dirent *dstruct;