iliaa Mon Jan 6 22:53:57 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/ftp ftp.c ftp.h php_ftp.c Log: MFH
Index: php4/ext/ftp/ftp.c diff -u php4/ext/ftp/ftp.c:1.68.2.2 php4/ext/ftp/ftp.c:1.68.2.3 --- php4/ext/ftp/ftp.c:1.68.2.2 Mon Jan 6 21:21:57 2003 +++ php4/ext/ftp/ftp.c Mon Jan 6 22:53:56 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ftp.c,v 1.68.2.2 2003/01/07 02:21:57 iliaa Exp $ */ +/* $Id: ftp.c,v 1.68.2.3 2003/01/07 03:53:56 iliaa Exp $ */ #include "php.h" @@ -92,7 +92,7 @@ static int ftp_type(ftpbuf_t *ftp, ftptype_t type); /* opens up a data stream */ -static databuf_t* ftp_getdata(ftpbuf_t *ftp); +static databuf_t* ftp_getdata(ftpbuf_t *ftp TSRMLS_DC); /* accepts the data connection, returns updated data buffer */ static databuf_t* data_accept(databuf_t *data, ftpbuf_t *ftp); @@ -101,8 +101,7 @@ static databuf_t* data_close(ftpbuf_t *ftp, databuf_t *data); /* generic file lister */ -static char** ftp_genlist(ftpbuf_t *ftp, - const char *cmd, const char *path); +static char** ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path +TSRMLS_DC); /* IP and port conversion box */ union ipbox { @@ -221,12 +220,10 @@ /* {{{ ftp_login */ int -ftp_login(ftpbuf_t *ftp, const char *user, const char *pass) +ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC) { #if HAVE_OPENSSL_EXT SSL_CTX *ctx = NULL; - - TSRMLS_FETCH(); #endif if (ftp == NULL) return 0; @@ -508,18 +505,18 @@ /* {{{ ftp_nlist */ char** -ftp_nlist(ftpbuf_t *ftp, const char *path) +ftp_nlist(ftpbuf_t *ftp, const char *path TSRMLS_DC) { - return ftp_genlist(ftp, "NLST", path); + return ftp_genlist(ftp, "NLST", path TSRMLS_CC); } /* }}} */ /* {{{ ftp_list */ char** -ftp_list(ftpbuf_t *ftp, const char *path, int recursive) +ftp_list(ftpbuf_t *ftp, const char *path, int recursive TSRMLS_DC) { - return ftp_genlist(ftp, ((recursive) ? "LIST -R" : "LIST"), path); + return ftp_genlist(ftp, ((recursive) ? "LIST -R" : "LIST"), path TSRMLS_CC); } /* }}} */ @@ -662,7 +659,7 @@ goto bail; } - if ((data = ftp_getdata(ftp)) == NULL) { + if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { goto bail; } @@ -750,7 +747,7 @@ if (!ftp_type(ftp, type)) goto bail; - if ((data = ftp_getdata(ftp)) == NULL) + if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) goto bail; ftp->data = data; @@ -1232,7 +1229,7 @@ /* {{{ ftp_getdata */ databuf_t* -ftp_getdata(ftpbuf_t *ftp) +ftp_getdata(ftpbuf_t *ftp TSRMLS_DC) { int fd = -1; databuf_t *data; @@ -1450,7 +1447,7 @@ /* {{{ ftp_genlist */ char** -ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path) +ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC) { FILE *tmpfp = NULL; databuf_t *data = NULL; @@ -1469,7 +1466,7 @@ if (!ftp_type(ftp, FTPTYPE_ASCII)) goto bail; - if ((data = ftp_getdata(ftp)) == NULL) + if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) goto bail; ftp->data = data; @@ -1550,7 +1547,7 @@ /* {{{ ftp_nb_get */ int -ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, int resumepos) +ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type, +int resumepos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; @@ -1562,7 +1559,7 @@ goto bail; } - if ((data = ftp_getdata(ftp)) == NULL) { + if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) { goto bail; } @@ -1666,7 +1663,7 @@ /* {{{ ftp_nb_put */ int -ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos) +ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int +startpos TSRMLS_DC) { databuf_t *data = NULL; char arg[11]; @@ -1677,7 +1674,7 @@ if (!ftp_type(ftp, type)) goto bail; - if ((data = ftp_getdata(ftp)) == NULL) + if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) goto bail; if (startpos>0) { Index: php4/ext/ftp/ftp.h diff -u php4/ext/ftp/ftp.h:1.30.2.1 php4/ext/ftp/ftp.h:1.30.2.2 --- php4/ext/ftp/ftp.h:1.30.2.1 Tue Dec 31 11:34:34 2002 +++ php4/ext/ftp/ftp.h Mon Jan 6 22:53:56 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ftp.h,v 1.30.2.1 2002/12/31 16:34:34 sebastian Exp $ */ +/* $Id: ftp.h,v 1.30.2.2 2003/01/07 03:53:56 iliaa Exp $ */ #ifndef FTP_H #define FTP_H @@ -107,7 +107,7 @@ ftpbuf_t* ftp_close(ftpbuf_t *ftp); /* logs into the FTP server, returns true on success, false on error */ -int ftp_login(ftpbuf_t *ftp, const char *user, const char *pass); +int ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC); /* reinitializes the connection, returns true on success, false on error */ int ftp_reinit(ftpbuf_t *ftp); @@ -139,14 +139,14 @@ * or NULL on error. the return array must be freed (but don't * free the array elements) */ -char** ftp_nlist(ftpbuf_t *ftp, const char *path); +char** ftp_nlist(ftpbuf_t *ftp, const char *path TSRMLS_DC); /* returns a NULL-terminated array of lines returned by the ftp * LIST command for the given path or NULL on error. the return * array must be freed (but don't * free the array elements) */ -char** ftp_list(ftpbuf_t *ftp, const char *path, int recursive); +char** ftp_list(ftpbuf_t *ftp, const char *path, int recursive TSRMLS_DC); /* switches passive mode on or off * returns true on success, false on error @@ -182,13 +182,12 @@ /* retrieves part of a file and saves its contents to outfp * returns true on success, false on error */ -int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, - ftptype_t type, int resumepos); +int ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, +ftptype_t type, int resumepos TSRMLS_DC); /* stores the data from a file, socket, or process as a file on the remote server * returns true on success, false on error */ -int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, int startpos); +int ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, +ftptype_t type, int startpos TSRMLS_DC); /* continues a previous nb_(f)get command */ Index: php4/ext/ftp/php_ftp.c diff -u php4/ext/ftp/php_ftp.c:1.74.2.3 php4/ext/ftp/php_ftp.c:1.74.2.4 --- php4/ext/ftp/php_ftp.c:1.74.2.3 Mon Jan 6 21:21:58 2003 +++ php4/ext/ftp/php_ftp.c Mon Jan 6 22:53:56 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ftp.c,v 1.74.2.3 2003/01/07 02:21:58 iliaa Exp $ */ +/* $Id: php_ftp.c,v 1.74.2.4 2003/01/07 03:53:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -225,7 +225,7 @@ ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* log in */ - if (!ftp_login(ftp, user, pass)) { + if (!ftp_login(ftp, user, pass TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); RETURN_FALSE; } @@ -396,7 +396,7 @@ ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get list of files */ - if (NULL == (nlist = ftp_nlist(ftp, dir))) { + if (NULL == (nlist = ftp_nlist(ftp, dir TSRMLS_CC))) { RETURN_FALSE; } @@ -424,7 +424,7 @@ ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); /* get raw directory listing */ - if (NULL == (llist = ftp_list(ftp, dir, recursive))) { + if (NULL == (llist = ftp_list(ftp, dir, recursive TSRMLS_CC))) { RETURN_FALSE; } @@ -539,7 +539,7 @@ ftp->direction = 0; /* recv */ ftp->closestream = 0; /* do not close */ - if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos)) == PHP_FTP_FAILED) { + if ((ret = ftp_nb_get(ftp, stream, file, xtype, resumepos TSRMLS_CC)) == +PHP_FTP_FAILED) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); RETURN_LONG(ret); } @@ -677,7 +677,7 @@ ftp->direction = 0; /* recv */ ftp->closestream = 1; /* do close */ - if ((ret = ftp_nb_get(ftp, outstream, remote, xtype, resumepos)) == PHP_FTP_FAILED) { + if ((ret = ftp_nb_get(ftp, outstream, remote, xtype, resumepos TSRMLS_CC)) == +PHP_FTP_FAILED) { php_stream_close(outstream); php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); RETURN_LONG(PHP_FTP_FAILED); @@ -815,7 +815,7 @@ ftp->direction = 1; /* send */ ftp->closestream = 0; /* do not close */ - if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos)) == PHP_FTP_FAILED)) { + if (((ret = ftp_nb_put(ftp, remote, stream, xtype, startpos TSRMLS_CC)) == +PHP_FTP_FAILED)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); RETURN_LONG(ret); } @@ -925,7 +925,7 @@ ftp->direction = 1; /* send */ ftp->closestream = 1; /* do close */ - ret = ftp_nb_put(ftp, remote, instream, xtype, startpos); + ret = ftp_nb_put(ftp, remote, instream, xtype, startpos TSRMLS_CC); if (ret != PHP_FTP_MOREDATA) { php_stream_close(instream); @@ -1136,6 +1136,7 @@ break; case PHP_FTP_OPT_AUTOSEEK: RETURN_BOOL(ftp->autoseek); + break; default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option '%d'", option); RETURN_FALSE;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php