From bf033aa5a8d210615fcef0e5fdb0f6ac4bd5a258 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 6 Dec 2003 16:12:10 +0000 Subject: [PATCH] Fix ftp build when openssl is built as a shared extension. --- ext/ftp/ftp.c | 24 ++++++++++++------------ ext/ftp/ftp.h | 4 ++-- ext/ftp/php_ftp.c | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index d10e079ab9..a1c632acde 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -65,7 +65,7 @@ #include #endif -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT #include #endif @@ -179,7 +179,7 @@ ftp_close(ftpbuf_t *ftp) data_close(ftp, ftp->data); } if (ftp->fd != -1) { -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT if (ftp->ssl_active) { SSL_shutdown(ftp->ssl_handle); } @@ -241,14 +241,14 @@ ftp_quit(ftpbuf_t *ftp) int ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC) { -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT SSL_CTX *ctx = NULL; #endif if (ftp == NULL) { return 0; } -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT if (ftp->use_ssl && !ftp->ssl_active) { if (!ftp_putcmd(ftp, "AUTH", "TLS")) { return 0; @@ -1231,7 +1231,7 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) return -1; } -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) { sent = SSL_write(ftp->ssl_handle, buf, size); } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { @@ -1239,7 +1239,7 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) } else { #endif sent = send(s, buf, size, 0); -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT } #endif if (sent == -1) { @@ -1279,7 +1279,7 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) return -1; } -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) { nr_bytes = SSL_read(ftp->ssl_handle, buf, len); } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { @@ -1287,7 +1287,7 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) } else { #endif nr_bytes = recv(s, buf, len, 0); -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT } #endif return (nr_bytes); @@ -1507,7 +1507,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) php_sockaddr_storage addr; socklen_t size; -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT SSL_CTX *ctx; #endif @@ -1525,7 +1525,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC) } data_accepted: -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT /* now enable ssl if we need to */ if (ftp->use_ssl && ftp->use_ssl_for_data) { @@ -1573,7 +1573,7 @@ data_close(ftpbuf_t *ftp, databuf_t *data) return NULL; } if (data->listener != -1) { -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT if (data->ssl_active) { SSL_shutdown(data->ssl_handle); data->ssl_active = 0; @@ -1582,7 +1582,7 @@ data_close(ftpbuf_t *ftp, databuf_t *data) closesocket(data->listener); } if (data->fd != -1) { -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT if (data->ssl_active) { SSL_shutdown(data->ssl_handle); data->ssl_active = 0; diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h index 35eb376ac4..3c5722d4aa 100644 --- a/ext/ftp/ftp.h +++ b/ext/ftp/ftp.h @@ -49,7 +49,7 @@ typedef struct databuf php_socket_t fd; /* data connection */ ftptype_t type; /* transfer type */ char buf[FTP_BUFSIZE]; /* data buffer */ -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT SSL *ssl_handle; /* ssl handle */ int ssl_active; /* flag if ssl is active or not */ #endif @@ -78,7 +78,7 @@ typedef struct ftpbuf int lastch; /* last char of previous call */ int direction; /* recv = 0 / send = 1 */ int closestream;/* close or not close stream */ -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT int use_ssl; /* enable(1) or disable(0) ssl */ int use_ssl_for_data; /* en/disable ssl for the dataconnection */ int old_ssl; /* old mode = forced data encryption */ diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 21a0cf52a5..a88bea31c8 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -35,8 +35,8 @@ #endif #endif -#ifdef HAVE_OPENSSL_EXT -#include +#if HAVE_OPENSSL_EXT +# include #endif #if HAVE_FTP @@ -59,7 +59,7 @@ static function_entry php_ftp_functions[] = { PHP_FE(ftp_connect, NULL) -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT PHP_FE(ftp_ssl_connect, NULL) #endif PHP_FE(ftp_login, NULL) @@ -110,7 +110,7 @@ zend_module_entry php_ftp_module_entry = { STANDARD_MODULE_PROPERTIES }; -#ifdef COMPILE_DL_FTP +#if COMPILE_DL_FTP ZEND_GET_MODULE(php_ftp) #endif @@ -179,7 +179,7 @@ PHP_FUNCTION(ftp_connect) /* autoseek for resuming */ ftp->autoseek = FTP_DEFAULT_AUTOSEEK; -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT /* disable ssl */ ftp->use_ssl = 0; #endif @@ -188,7 +188,7 @@ PHP_FUNCTION(ftp_connect) } /* }}} */ -#ifdef HAVE_OPENSSL_EXT +#if HAVE_OPENSSL_EXT /* {{{ proto resource ftp_ssl_connect(string host [, int port [, int timeout]]) Opens a FTP-SSL stream */ PHP_FUNCTION(ftp_ssl_connect) -- 2.50.1