From: Michael R Sweet Date: Thu, 31 Mar 2022 11:31:11 +0000 (-0400) Subject: Fix remaining OpenSSL BIO issues. X-Git-Tag: v2.4.2~29^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06d2e290a8dabafdfc260dadd714986875cb5bde;p=thirdparty%2Fcups.git Fix remaining OpenSSL BIO issues. --- diff --git a/cups/tls-openssl.c b/cups/tls-openssl.c index 524789f956..b0615bfb9d 100644 --- a/cups/tls-openssl.c +++ b/cups/tls-openssl.c @@ -1181,18 +1181,18 @@ http_bio_ctrl(BIO *h, // I - BIO data return (0); case BIO_CTRL_RESET : - h->ptr = NULL; + BIO_set_data(h, NULL); return (0); case BIO_C_SET_FILE_PTR : - h->ptr = arg2; - h->init = 1; + BIO_set_data(h, arg2); + BIO_set_init(h, 1); return (1); case BIO_C_GET_FILE_PTR : if (arg2) { - *((void **)arg2) = h->ptr; + *((void **)arg2) = BIO_get_data(h); return (1); } else @@ -1215,11 +1215,8 @@ http_bio_free(BIO *h) // I - BIO data if (!h) return (0); - if (h->shutdown) - { - h->init = 0; - h->flags = 0; - } + if (BIO_get_shutdown(h)) + BIO_set_init(h, 0); return (1); } @@ -1235,10 +1232,8 @@ http_bio_new(BIO *h) // I - BIO data if (!h) return (0); - h->init = 0; - h->num = 0; - h->ptr = NULL; - h->flags = 0; + BIO_set_init(h, 0); + BIO_set_data(h, NULL); return (1); } @@ -1253,9 +1248,9 @@ http_bio_puts(BIO *h, // I - BIO data const char *str) // I - String to write { #ifdef WIN32 - return (send(((http_t *)h->ptr)->fd, str, (int)strlen(str), 0)); + return (send(((http_t *)BIO_get_data(h))->fd, str, (int)strlen(str), 0)); #else - return ((int)send(((http_t *)h->ptr)->fd, str, strlen(str), 0)); + return ((int)send(((http_t *)BIO_get_data(h))->fd, str, strlen(str), 0)); #endif // WIN32 } @@ -1272,7 +1267,7 @@ http_bio_read(BIO *h, // I - BIO data http_t *http; // HTTP connection - http = (http_t *)h->ptr; + http = (http_t *)BIO_get_data(h); if (!http->blocking) { @@ -1305,7 +1300,7 @@ http_bio_write(BIO *h, // I - BIO data const char *buf, // I - Buffer to write int num) // I - Number of bytes to write { - return (send(((http_t *)h->ptr)->fd, buf, num, 0)); + return (send(((http_t *)BIO_get_data(h))->fd, buf, num, 0)); }