summaryrefslogtreecommitdiff
path: root/ext/ftp
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:59 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:59 -0400
commitce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (patch)
treeacdb9a8816483652a9db1a47db71df5df43707c5 /ext/ftp
parent10f5b47dc7c1cf2b9a00991629f43652710322d3 (diff)
downloadphp-ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61.tar.gz
Imported Upstream version 5.1.1upstream/5.1.1
Diffstat (limited to 'ext/ftp')
-rw-r--r--ext/ftp/config.m413
-rw-r--r--ext/ftp/ftp.c34
-rw-r--r--ext/ftp/ftp.h4
-rw-r--r--ext/ftp/php_ftp.c4
-rw-r--r--ext/ftp/php_ftp.h4
5 files changed, 37 insertions, 22 deletions
diff --git a/ext/ftp/config.m4 b/ext/ftp/config.m4
index 1e600a14f..3a7bf0794 100644
--- a/ext/ftp/config.m4
+++ b/ext/ftp/config.m4
@@ -1,11 +1,22 @@
dnl
-dnl $Id: config.m4,v 1.7 2002/03/12 16:18:33 sas Exp $
+dnl $Id: config.m4,v 1.7.20.3 2005/11/01 00:32:21 bfrance Exp $
dnl
PHP_ARG_ENABLE(ftp,whether to enable FTP support,
[ --enable-ftp Enable FTP support])
+PHP_ARG_WITH(openssl-dir,OpenSSL dir for FTP,
+[ --with-openssl-dir[=DIR] FTP: openssl install prefix], no, no)
+
if test "$PHP_FTP" = "yes"; then
AC_DEFINE(HAVE_FTP,1,[Whether you want FTP support])
PHP_NEW_EXTENSION(ftp, php_ftp.c ftp.c, $ext_shared)
+
+ dnl Empty variable means 'no'
+ test -z "$PHP_OPENSSL" && PHP_OPENSSL=no
+
+ if test "$PHP_OPENSSL" != "no" || test "$PHP_OPENSSL_DIR" != "no"; then
+ PHP_SETUP_OPENSSL(FTP_SHARED_LIBADD)
+ PHP_SUBST(FTP_SHARED_LIBADD)
+ fi
fi
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 1c4511543..903aa8ba0 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftp.c,v 1.103.2.7 2005/03/17 17:16:49 iliaa Exp $ */
+/* $Id: ftp.c,v 1.112.2.2 2005/11/05 22:02:15 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -136,7 +136,7 @@ ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC)
ftp->fd = php_network_connect_socket_to_host(host,
(unsigned short) (port ? port : 21), SOCK_STREAM,
- 0, &tv, NULL, NULL TSRMLS_CC);
+ 0, &tv, NULL, NULL, NULL, 0 TSRMLS_CC);
if (ftp->fd == -1) {
goto bail;
}
@@ -148,7 +148,7 @@ ftp_open(const char *host, short port, long timeout_sec TSRMLS_DC)
size = sizeof(ftp->localaddr);
memset(&ftp->localaddr, 0, size);
if (getsockname(ftp->fd, (struct sockaddr*) &ftp->localaddr, &size) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "getsockname failed: %s (%d)\n", strerror(errno), errno);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "getsockname failed: %s (%d)", strerror(errno), errno);
goto bail;
}
@@ -280,7 +280,9 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL context");
return 0;
}
-
+
+ SSL_CTX_set_options(ctx, SSL_OP_ALL);
+
ftp->ssl_handle = SSL_new(ctx);
if (ftp->ssl_handle == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL handle");
@@ -808,7 +810,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
if (resumepos > 0) {
if (resumepos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483647 bytes.\n");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483647 bytes.");
goto bail;
}
sprintf(arg, "%u", resumepos);
@@ -905,7 +907,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
if (startpos > 0) {
if (startpos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.\n");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.");
goto bail;
}
sprintf(arg, "%u", startpos);
@@ -1384,7 +1386,7 @@ ftp_getdata(ftpbuf_t *ftp TSRMLS_DC)
sa = (struct sockaddr *) &ftp->localaddr;
/* bind/listen */
if ((fd = socket(sa->sa_family, SOCK_STREAM, 0)) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "socket() failed: %s (%d)\n", strerror(errno), errno);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "socket() failed: %s (%d)", strerror(errno), errno);
goto bail;
}
@@ -1399,7 +1401,7 @@ ftp_getdata(ftpbuf_t *ftp TSRMLS_DC)
tv.tv_sec = ftp->timeout_sec;
tv.tv_usec = 0;
if (php_connect_nonb(fd, (struct sockaddr*) &ftp->pasvaddr, size, &tv) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_connect_nonb() failed: %s (%d)\n", strerror(errno), errno);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_connect_nonb() failed: %s (%d)", strerror(errno), errno);
goto bail;
}
@@ -1417,17 +1419,17 @@ ftp_getdata(ftpbuf_t *ftp TSRMLS_DC)
size = php_sockaddr_size(&addr);
if (bind(fd, (struct sockaddr*) &addr, size) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "bind() failed: %s (%d)\n", strerror(errno), errno);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "bind() failed: %s (%d)", strerror(errno), errno);
goto bail;
}
if (getsockname(fd, (struct sockaddr*) &addr, &size) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "getsockname() failed: %s (%d)\n", strerror(errno), errno);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "getsockname() failed: %s (%d)", strerror(errno), errno);
goto bail;
}
if (listen(fd, 5) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "listen() failed: %s (%d)\n", strerror(errno), errno);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "listen() failed: %s (%d)", strerror(errno), errno);
goto bail;
}
@@ -1513,7 +1515,9 @@ data_accepted:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: failed to create the SSL context");
return 0;
}
-
+
+ SSL_CTX_set_options(ctx, SSL_OP_ALL);
+
data->ssl_handle = SSL_new(ctx);
if (data->ssl_handle == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: failed to create the SSL handle");
@@ -1702,7 +1706,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
* since php is 32 bit by design, we bail out with warning
*/
if (resumepos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483648 bytes.\n");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483648 bytes.");
goto bail;
}
sprintf(arg, "%u", resumepos);
@@ -1820,7 +1824,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
}
if (startpos > 0) {
if (startpos > 2147483647) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.\n");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.");
goto bail;
}
sprintf(arg, "%u", startpos);
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
index f0a5c3f5a..69033c892 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ftp.h,v 1.42 2004/01/08 17:32:08 sniper Exp $ */
+/* $Id: ftp.h,v 1.43 2005/08/03 14:07:11 sniper Exp $ */
#ifndef FTP_H
#define FTP_H
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index c0a01bfbe..6c8b8ebdd 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ftp.c,v 1.100.2.2 2005/03/10 23:38:01 iliaa Exp $ */
+/* $Id: php_ftp.c,v 1.103 2005/08/03 14:07:11 sniper Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h
index 7fa43d3fd..f41f62494 100644
--- a/ext/ftp/php_ftp.h
+++ b/ext/ftp/php_ftp.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ftp.h,v 1.28 2004/01/08 17:32:08 sniper Exp $ */
+/* $Id: php_ftp.h,v 1.29 2005/08/03 14:07:12 sniper Exp $ */
#ifndef _INCLUDED_FTP_H
#define _INCLUDED_FTP_H