X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fbio%2Fbss_conn.c;h=22d00b369ecbc2ec0923b0d1212507e950948e6f;hb=c04949e97877c7e9e362ab3022b2e7d4988b3e37;hp=83ba60edfbb102ab8d3c64eed1f0dc9c2e509686;hpb=ec577822f95a8bca0023c5c77cef1a4916822d4a;p=oweals%2Fopenssl.git diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 83ba60edfb..22d00b369e 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -64,14 +64,18 @@ #include "cryptlib.h" #include -/* BIOerr(BIO_F_WSASTARTUP,BIO_R_WSASTARTUP ); */ - #ifdef WIN16 #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ #else #define SOCKET_PROTOCOL IPPROTO_TCP #endif +#if (defined(VMS) && __VMS_VER < 70000000) +/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */ +#undef FIONBIO +#endif + + typedef struct bio_connect_st { int state; @@ -86,46 +90,27 @@ typedef struct bio_connect_st struct sockaddr_in them; /* int socket; this will be kept in bio->num so that it is - * compatable with the bss_sock bio */ + * compatible with the bss_sock bio */ /* called when the connection is initially made * callback(BIO,state,ret); The callback should return - * 'ret'. state is for compatablity with the ssl info_callback */ + * 'ret'. state is for compatibility with the ssl info_callback */ int (*info_callback)(); } BIO_CONNECT; -#ifndef NOPROTO static int conn_write(BIO *h,char *buf,int num); static int conn_read(BIO *h,char *buf,int size); static int conn_puts(BIO *h,char *str); static long conn_ctrl(BIO *h,int cmd,long arg1,char *arg2); static int conn_new(BIO *h); static int conn_free(BIO *data); -#else -static int conn_write(); -static int conn_read(); -static int conn_puts(); -static long conn_ctrl(); -static int conn_new(); -static int conn_free(); -#endif - -#ifndef NOPROTO +static long conn_callback_ctrl(BIO *h,int cmd,void *(*fp)()); static int conn_state(BIO *b, BIO_CONNECT *c); static void conn_close_socket(BIO *data); BIO_CONNECT *BIO_CONNECT_new(void ); void BIO_CONNECT_free(BIO_CONNECT *a); -#else - -static int conn_state(); -static void conn_close_socket(); -BIO_CONNECT *BIO_CONNECT_new(); -void BIO_CONNECT_free(); - -#endif - static BIO_METHOD methods_connectp= { BIO_TYPE_CONNECT, @@ -137,6 +122,7 @@ static BIO_METHOD methods_connectp= conn_ctrl, conn_new, conn_free, + conn_callback_ctrl, }; static int conn_state(BIO *b, BIO_CONNECT *c) @@ -510,7 +496,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, char *ptr) *((int *)ptr)=data->port; } if ((!b->init) || (ptr == NULL)) - *pptr="not initalised"; + *pptr="not initialized"; ret=1; } break; @@ -580,16 +566,25 @@ static long conn_ctrl(BIO *b, int cmd, long num, char *ptr) case BIO_CTRL_FLUSH: break; case BIO_CTRL_DUP: + { dbio=(BIO *)ptr; if (data->param_port) BIO_set_conn_port(dbio,data->param_port); if (data->param_hostname) BIO_set_conn_hostname(dbio,data->param_hostname); BIO_set_nbio(dbio,data->nbio); - BIO_set_info_callback(dbio,data->info_callback); + (void)BIO_set_info_callback(dbio,(void *(*)())(data->info_callback)); + } break; case BIO_CTRL_SET_CALLBACK: - data->info_callback=(int (*)())ptr; + { +#if 0 /* FIXME: Should this be used? -- Richard Levitte */ + BIOerr(BIO_F_CONN_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); + ret = -1; +#else + ret=0; +#endif + } break; case BIO_CTRL_GET_CALLBACK: { @@ -606,6 +601,27 @@ static long conn_ctrl(BIO *b, int cmd, long num, char *ptr) return(ret); } +static long conn_callback_ctrl(BIO *b, int cmd, void *(*fp)()) + { + long ret=1; + BIO_CONNECT *data; + + data=(BIO_CONNECT *)b->ptr; + + switch (cmd) + { + case BIO_CTRL_SET_CALLBACK: + { + data->info_callback=(int (*)())fp; + } + break; + default: + ret=0; + break; + } + return(ret); + } + static int conn_puts(BIO *bp, char *str) { int n,ret;