summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bss_conn.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bio/bss_conn.c')
-rw-r--r--src/lib/libcrypto/bio/bss_conn.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c
index 22d00b369e..a6b77a2cb9 100644
--- a/src/lib/libcrypto/bio/bss_conn.c
+++ b/src/lib/libcrypto/bio/bss_conn.c
@@ -98,13 +98,13 @@ typedef struct bio_connect_st
98 int (*info_callback)(); 98 int (*info_callback)();
99 } BIO_CONNECT; 99 } BIO_CONNECT;
100 100
101static int conn_write(BIO *h,char *buf,int num); 101static int conn_write(BIO *h, const char *buf, int num);
102static int conn_read(BIO *h,char *buf,int size); 102static int conn_read(BIO *h, char *buf, int size);
103static int conn_puts(BIO *h,char *str); 103static int conn_puts(BIO *h, const char *str);
104static long conn_ctrl(BIO *h,int cmd,long arg1,char *arg2); 104static long conn_ctrl(BIO *h, int cmd, long arg1, void *arg2);
105static int conn_new(BIO *h); 105static int conn_new(BIO *h);
106static int conn_free(BIO *data); 106static int conn_free(BIO *data);
107static long conn_callback_ctrl(BIO *h,int cmd,void *(*fp)()); 107static long conn_callback_ctrl(BIO *h, int cmd, bio_info_cb *);
108 108
109static int conn_state(BIO *b, BIO_CONNECT *c); 109static int conn_state(BIO *b, BIO_CONNECT *c);
110static void conn_close_socket(BIO *data); 110static void conn_close_socket(BIO *data);
@@ -165,7 +165,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
165 break; 165 break;
166 } 166 }
167 if (c->param_port != NULL) 167 if (c->param_port != NULL)
168 Free(c->param_port); 168 OPENSSL_free(c->param_port);
169 c->param_port=BUF_strdup(p); 169 c->param_port=BUF_strdup(p);
170 } 170 }
171 } 171 }
@@ -188,7 +188,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
188 case BIO_CONN_S_GET_PORT: 188 case BIO_CONN_S_GET_PORT:
189 if (c->param_port == NULL) 189 if (c->param_port == NULL)
190 { 190 {
191 abort(); 191 /* abort(); */
192 goto exit_loop; 192 goto exit_loop;
193 } 193 }
194 else if (BIO_get_port(c->param_port,&c->port) <= 0) 194 else if (BIO_get_port(c->param_port,&c->port) <= 0)
@@ -236,7 +236,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
236 } 236 }
237 c->state=BIO_CONN_S_CONNECT; 237 c->state=BIO_CONN_S_CONNECT;
238 238
239#ifdef SO_KEEPALIVE 239#if defined(SO_KEEPALIVE) && !defined(MPE)
240 i=1; 240 i=1;
241 i=setsockopt(b->num,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); 241 i=setsockopt(b->num,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
242 if (i < 0) 242 if (i < 0)
@@ -299,7 +299,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
299 ret=1; 299 ret=1;
300 goto exit_loop; 300 goto exit_loop;
301 default: 301 default:
302 abort(); 302 /* abort(); */
303 goto exit_loop; 303 goto exit_loop;
304 } 304 }
305 305
@@ -322,7 +322,7 @@ BIO_CONNECT *BIO_CONNECT_new(void)
322 { 322 {
323 BIO_CONNECT *ret; 323 BIO_CONNECT *ret;
324 324
325 if ((ret=(BIO_CONNECT *)Malloc(sizeof(BIO_CONNECT))) == NULL) 325 if ((ret=(BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL)
326 return(NULL); 326 return(NULL);
327 ret->state=BIO_CONN_S_BEFORE; 327 ret->state=BIO_CONN_S_BEFORE;
328 ret->param_hostname=NULL; 328 ret->param_hostname=NULL;
@@ -344,10 +344,10 @@ void BIO_CONNECT_free(BIO_CONNECT *a)
344 return; 344 return;
345 345
346 if (a->param_hostname != NULL) 346 if (a->param_hostname != NULL)
347 Free(a->param_hostname); 347 OPENSSL_free(a->param_hostname);
348 if (a->param_port != NULL) 348 if (a->param_port != NULL)
349 Free(a->param_port); 349 OPENSSL_free(a->param_port);
350 Free(a); 350 OPENSSL_free(a);
351 } 351 }
352 352
353BIO_METHOD *BIO_s_connect(void) 353BIO_METHOD *BIO_s_connect(void)
@@ -426,7 +426,7 @@ static int conn_read(BIO *b, char *out, int outl)
426 return(ret); 426 return(ret);
427 } 427 }
428 428
429static int conn_write(BIO *b, char *in, int inl) 429static int conn_write(BIO *b, const char *in, int inl)
430 { 430 {
431 int ret; 431 int ret;
432 BIO_CONNECT *data; 432 BIO_CONNECT *data;
@@ -449,7 +449,7 @@ static int conn_write(BIO *b, char *in, int inl)
449 return(ret); 449 return(ret);
450 } 450 }
451 451
452static long conn_ctrl(BIO *b, int cmd, long num, char *ptr) 452static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
453 { 453 {
454 BIO *dbio; 454 BIO *dbio;
455 int *ip; 455 int *ip;
@@ -507,23 +507,24 @@ static long conn_ctrl(BIO *b, int cmd, long num, char *ptr)
507 if (num == 0) 507 if (num == 0)
508 { 508 {
509 if (data->param_hostname != NULL) 509 if (data->param_hostname != NULL)
510 Free(data->param_hostname); 510 OPENSSL_free(data->param_hostname);
511 data->param_hostname=BUF_strdup(ptr); 511 data->param_hostname=BUF_strdup(ptr);
512 } 512 }
513 else if (num == 1) 513 else if (num == 1)
514 { 514 {
515 if (data->param_port != NULL) 515 if (data->param_port != NULL)
516 Free(data->param_port); 516 OPENSSL_free(data->param_port);
517 data->param_port=BUF_strdup(ptr); 517 data->param_port=BUF_strdup(ptr);
518 } 518 }
519 else if (num == 2) 519 else if (num == 2)
520 { 520 {
521 char buf[16]; 521 char buf[16];
522 char *p = ptr;
522 523
523 sprintf(buf,"%d.%d.%d.%d", 524 sprintf(buf,"%d.%d.%d.%d",
524 ptr[0],ptr[1],ptr[2],ptr[3]); 525 p[0],p[1],p[2],p[3]);
525 if (data->param_hostname != NULL) 526 if (data->param_hostname != NULL)
526 Free(data->param_hostname); 527 OPENSSL_free(data->param_hostname);
527 data->param_hostname=BUF_strdup(buf); 528 data->param_hostname=BUF_strdup(buf);
528 memcpy(&(data->ip[0]),ptr,4); 529 memcpy(&(data->ip[0]),ptr,4);
529 } 530 }
@@ -533,7 +534,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, char *ptr)
533 534
534 sprintf(buf,"%d",*(int *)ptr); 535 sprintf(buf,"%d",*(int *)ptr);
535 if (data->param_port != NULL) 536 if (data->param_port != NULL)
536 Free(data->param_port); 537 OPENSSL_free(data->param_port);
537 data->param_port=BUF_strdup(buf); 538 data->param_port=BUF_strdup(buf);
538 data->port= *(int *)ptr; 539 data->port= *(int *)ptr;
539 } 540 }
@@ -573,7 +574,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, char *ptr)
573 if (data->param_hostname) 574 if (data->param_hostname)
574 BIO_set_conn_hostname(dbio,data->param_hostname); 575 BIO_set_conn_hostname(dbio,data->param_hostname);
575 BIO_set_nbio(dbio,data->nbio); 576 BIO_set_nbio(dbio,data->nbio);
576 (void)BIO_set_info_callback(dbio,(void *(*)())(data->info_callback)); 577 (void)BIO_set_info_callback(dbio,data->info_callback);
577 } 578 }
578 break; 579 break;
579 case BIO_CTRL_SET_CALLBACK: 580 case BIO_CTRL_SET_CALLBACK:
@@ -601,7 +602,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, char *ptr)
601 return(ret); 602 return(ret);
602 } 603 }
603 604
604static long conn_callback_ctrl(BIO *b, int cmd, void *(*fp)()) 605static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
605 { 606 {
606 long ret=1; 607 long ret=1;
607 BIO_CONNECT *data; 608 BIO_CONNECT *data;
@@ -622,7 +623,7 @@ static long conn_callback_ctrl(BIO *b, int cmd, void *(*fp)())
622 return(ret); 623 return(ret);
623 } 624 }
624 625
625static int conn_puts(BIO *bp, char *str) 626static int conn_puts(BIO *bp, const char *str)
626 { 627 {
627 int n,ret; 628 int n,ret;
628 629