wez Sat Dec 6 11:12:10 2003 EDT
Modified files:
/php-src/ext/ftp ftp.c ftp.h php_ftp.c
Log:
Fix ftp build when openssl is built as a shared extension.
Index: php-src/ext/ftp/ftp.c
diff -u php-src/ext/ftp/ftp.c:1.94 php-src/ext/ftp/ftp.c:1.95
--- php-src/ext/ftp/ftp.c:1.94 Fri Dec 5 19:00:28 2003
+++ php-src/ext/ftp/ftp.c Sat Dec 6 11:12:10 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftp.c,v 1.94 2003/12/06 00:00:28 wez Exp $ */
+/* $Id: ftp.c,v 1.95 2003/12/06 16:12:10 wez Exp $ */
#include "php.h"
@@ -65,7 +65,7 @@
#include <sys/select.h>
#endif
-#ifdef HAVE_OPENSSL_EXT
+#if HAVE_OPENSSL_EXT
#include <openssl/ssl.h>
#endif
@@ -179,7 +179,7 @@
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 @@
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 @@
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 @@
} else {
#endif
sent = send(s, buf, size, 0);
-#ifdef HAVE_OPENSSL_EXT
+#if HAVE_OPENSSL_EXT
}
#endif
if (sent == -1) {
@@ -1279,7 +1279,7 @@
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 @@
} 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 @@
php_sockaddr_storage addr;
socklen_t size;
-#ifdef HAVE_OPENSSL_EXT
+#if HAVE_OPENSSL_EXT
SSL_CTX *ctx;
#endif
@@ -1525,7 +1525,7 @@
}
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 @@
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 @@
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;
Index: php-src/ext/ftp/ftp.h
diff -u php-src/ext/ftp/ftp.h:1.40 php-src/ext/ftp/ftp.h:1.41
--- php-src/ext/ftp/ftp.h:1.40 Thu Sep 18 13:36:08 2003
+++ php-src/ext/ftp/ftp.h Sat Dec 6 11:12:10 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftp.h,v 1.40 2003/09/18 17:36:08 pollita Exp $ */
+/* $Id: ftp.h,v 1.41 2003/12/06 16:12:10 wez Exp $ */
#ifndef FTP_H
#define FTP_H
@@ -49,7 +49,7 @@
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 @@
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 */
Index: php-src/ext/ftp/php_ftp.c
diff -u php-src/ext/ftp/php_ftp.c:1.97 php-src/ext/ftp/php_ftp.c:1.98
--- php-src/ext/ftp/php_ftp.c:1.97 Tue Nov 4 15:56:47 2003
+++ php-src/ext/ftp/php_ftp.c Sat Dec 6 11:12:10 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ftp.c,v 1.97 2003/11/04 20:56:47 iliaa Exp $ */
+/* $Id: php_ftp.c,v 1.98 2003/12/06 16:12:10 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -35,8 +35,8 @@
#endif
#endif
-#ifdef HAVE_OPENSSL_EXT
-#include <openssl/ssl.h>
+#if HAVE_OPENSSL_EXT
+# include <openssl/ssl.h>
#endif
#if HAVE_FTP
@@ -59,7 +59,7 @@
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 @@
STANDARD_MODULE_PROPERTIES
};
-#ifdef COMPILE_DL_FTP
+#if COMPILE_DL_FTP
ZEND_GET_MODULE(php_ftp)
#endif
@@ -179,7 +179,7 @@
/* 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 @@
}
/* }}} */
-#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)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php