Compare commits

..

53 Commits

Author SHA1 Message Date
Daniel Stenberg
b8d006b9d7 7.16.3 2007-06-25 09:18:16 +00:00
Daniel Stenberg
af4edf10f5 As reported by "Tro" in http://curl.haxx.se/mail/lib-2007-06/0161.html and
http://curl.haxx.se/mail/lib-2007-06/0238.html, libcurl didn't properly do
no-body requests on FTP files on re-used connections properly, or at least
it didn't provide the info back in the header callback properly in the
subsequent requests.
2007-06-24 19:32:33 +00:00
Gunter Knauf
0f9e209534 added netware install target 2007-06-22 21:10:41 +00:00
Gunter Knauf
2aed8946b0 made debug flag settable from outside; add allways debug stuff when DB != NDEBUG 2007-06-22 21:10:17 +00:00
Daniel Stenberg
03b03f7b60 remove annoying debug output 2007-06-22 20:24:11 +00:00
Daniel Stenberg
a1b650ad7b Gerrit Bruchhuser pointed out a warning that the Intel(R) Thread Checker
tool reports and it was indeed a legitimate one and it is one fixed. It was
a use of a share without doing the proper locking first.
2007-06-21 14:23:38 +00:00
Daniel Stenberg
d978f85d55 Adam Piggott filed bug report #1740263
(http://curl.haxx.se/bug/view.cgi?id=1740263). Adam discovered that when
getting a large amount of URLs with curl, they were fetched slower and
slower... which turned out to be because the --libcurl data collecting which
wrongly always was enabled, but no longer is...
2007-06-20 21:57:28 +00:00
James Housley
6e7f47da5b If the creation of rsa and rsa_pub fail due to memory, don't try
other authentication methods.  Terminate with a memory error.
2007-06-20 11:30:35 +00:00
James Housley
277bab0c7b Check both variables, not the same one twice. Pointed out by Colin Hogben 2007-06-19 13:23:21 +00:00
Daniel Stenberg
fc3c5dae87 and fix another flaw in the singlecwd case when we get ftp://site.com/, also
from the #1739100 bug report
2007-06-19 12:33:28 +00:00
Daniel Stenberg
891dffb528 extra precaution to make PATH_MAX always be defined 2007-06-19 11:50:08 +00:00
James Housley
f0b361ecc1 Change rsa and rsa_pub from static arrays in ssh_conn to be dynamically
allocated when needed
2007-06-19 11:31:33 +00:00
James Housley
df7eed16dd If LIBSSH2DEBUG was defined "i" was undefined 2007-06-18 22:28:40 +00:00
Daniel Stenberg
61db4f3e2a Robson Braga Araujo filed bug report #1739100
(http://curl.haxx.se/bug/view.cgi?id=1739100) that mentioned that libcurl
could not actually list the contents of the root directory of a given FTP
server if the login directory isn't root. I fixed the problem and added three
test cases (one is disabled for now since I identified KNOWN_BUGS #44, we
cannot use --ftp-method nocwd and list ftp directories).
2007-06-18 21:09:32 +00:00
Daniel Stenberg
fe85ae15f3 make the ftp-method multicwd case possible to LIST the root directory of a
server!
2007-06-18 21:04:45 +00:00
Daniel Stenberg
cc26cc5dcd Test listing of root dir with the three ftp-methods. KNOWN_BUGS #44 make me
disable test 351 by default by I add the test case anyway to make it easier
to work on this problem in the future.
2007-06-18 21:04:05 +00:00
Daniel Stenberg
eb965e2a13 44. --ftp-method nocwd does not handle URLs ending with a slash properly (it
should list the contents of that directory). See test case 351.
2007-06-18 21:03:14 +00:00
Daniel Stenberg
4e35395d0e Daniel Johnson reported the tests now run fine on OS X! 2007-06-18 08:57:13 +00:00
James Housley
b61b420cb8 Curl_ssh_connect() was using an uninitialized variable in one location.
Caught by the auto-builds
2007-06-16 16:58:02 +00:00
Daniel Stenberg
b0aa11fde7 Tom Regner added /usr/lib/misc to the path to scan for sftp to make the
sftp tests run fine on gentoo
2007-06-14 21:16:08 +00:00
Daniel Stenberg
b691102ec7 Shmulik Regev fixed a flaw in the multi interface that occurred when doing
HTTP CONNECT over a proxy
2007-06-14 14:42:21 +00:00
Daniel Stenberg
2785fe7f61 s/HAVE_POLL/HAVE_SYS_POLL_H 2007-06-14 14:15:21 +00:00
James Housley
db5d4bd811 Remove duplicate code that was left in as part of 1.35. This code
only affected sftp_sendquote() for the "chgrp/chmod/chown" commands.

This also fixed failure of test 614 on a system that previously failed.
2007-06-14 13:22:00 +00:00
Daniel Stenberg
dc3b3c6916 Make our own definitions of the POLL* defiens and the pollfd struct only get
done if the sys/poll.h file is missing, as we have seen machines with poll()
present but without the header file and machines that don't get HAVE_POLL
defined but that do have the sys/poll.h header file...
2007-06-14 11:21:48 +00:00
James Housley
82d3f97659 BUG FIX: When reading a directory listing that contains symlinks
with the latest libssh2, the listing would be truncated at the symlink.
Fix by looping on LIBSSH2_ERROR_EAGAIN, like the rest of the calls.
2007-06-14 10:36:53 +00:00
Daniel Stenberg
235632ed2c Tom Regner provided a patch and worked together with James Housley, so now
CURLOPT_FTP_CREATE_MISSING_DIRS works for SFTP connections as well as FTP
ones.
2007-06-13 20:17:35 +00:00
Daniel Stenberg
68330c86e7 Rich Rauenzahn filed bug report #1733119
(http://curl.haxx.se/bug/view.cgi?id=1733119) and we collaborated on the fix.
The problem is that for 64bit HPUX builds, several socket-related functions
would still assume int (32 bit) arguments and not socklen_t (64 bit) ones.
2007-06-13 20:08:19 +00:00
James Housley
f37dc9168a Restore functionality mistakenly removed in the previous commit 2007-06-13 17:13:44 +00:00
James Housley
17798ed740 Update documentation to reflect SFTP's ability to create directories on
upload.  Some text provieded by Tom Regner
2007-06-13 15:02:34 +00:00
Gisle Vanem
05ba9f9fcd libssh2_session_free() returns void. Fix "#endif". 2007-06-13 14:01:48 +00:00
James Housley
96f4af4db9 Commit Tom Regner's code for SFTP create missing directories. This patch
uses the --ftp-create-dirs flag to control if cURL will try and create
directories that are specified in an upload path, but don't exist.
2007-06-13 12:15:23 +00:00
James Housley
3ec7f8a25a Add a define to protect the state machine from older versions of libssh2,
ie 0.14, that don't know about newer constants used in the state machine.
2007-06-13 11:27:41 +00:00
Daniel Stenberg
375cdf89ad With lots of help from Rich Rauenza(?) in bug #1733119, we introduce a fairly
complicated work-around for 64bit HPUX compiles. We do the fix using inline
static functions to make them follow the header file properly and thus get
used fine in the test suite too etc.
2007-06-12 21:39:21 +00:00
James Housley
ab7e7144ef * Updates for the latest version of libssh2, specifically
libssh2_sftp_shutdown() and libssh2_session_free() can now return
  LIBSSH2_ERROR_EAGAIN.

* Fix the _send() and _recv() return values so non-blocking works
2007-06-12 21:32:45 +00:00
James Housley
6f59e19b91 While connect and transfer works fine in non-blocking mode for the test
suite, transfer fails in the real world.  So after connect set to blocking
as full non-blocking is migrated out.
2007-06-12 16:15:20 +00:00
Daniel Stenberg
7800b56dc8 mention James current work on ssh 2007-06-12 13:51:57 +00:00
James Housley
73c13220ee Prevent the state machine from getting stuck in SSH_AUTH_HOST_INIT 2007-06-12 13:47:32 +00:00
James Housley
99e0597c7b Convert Curl_ssh_connect() to run in a state machine for
LIBSSH2_APINO >= 200706012030.  More to come...
2007-06-12 12:31:10 +00:00
Daniel Stenberg
3247ac1918 remove unused field in the state struct 2007-06-12 08:15:02 +00:00
Dan Fandrich
c45d44fee9 Wait longer for servers to start up since the ssh server needs to generate
keys the first time (which can take a while on a slow or loaded host).
Enforce a longer startup wait time for the ssh client SOCKS server, too.
Check for an error code from startnew() when starting any server.
2007-06-11 17:53:10 +00:00
Dan Fandrich
1e718a515a We do not use RSA keys in the test suite. 2007-06-11 17:49:25 +00:00
Daniel Stenberg
d23d686de2 restore the correct timeout time that my previous commit broke 2007-06-11 13:35:33 +00:00
Daniel Stenberg
c8677e9d3f Properly wait for the c-ares resolve to complete, hopefully the cure for
bug #1733955
2007-06-11 13:32:49 +00:00
Daniel Stenberg
a32eaffa77 Daniel Black's clarfication about the NTLM support 2007-06-11 07:27:02 +00:00
Gisle Vanem
1dcb99f0f7 constify 'hostname' in init_thread_sync_data(). Simply clear
the whole 'tsd' structure on exit in destroy_thread_sync_data().
2007-06-11 04:33:21 +00:00
Gisle Vanem
03bc2d34da Squelsh some warnings for libssh older than 0.1.5. 2007-06-11 04:07:51 +00:00
Dan Fandrich
477e27f99d Fixed the test harness so that it actually kills the ssh being used as
the SOCKS server.
2007-06-08 18:56:05 +00:00
Dan Fandrich
6a84d492f1 Improved compatibility with perl 5.0 on the 'open' calls. 2007-06-08 17:32:24 +00:00
Dan Fandrich
873d95a34c Incorporated Daniel Black's test706 and test707 SOCKS test cases. 2007-06-08 17:21:40 +00:00
Dan Fandrich
1500e95839 Improved compatibility with perl 5.0 on the 'open' calls. 2007-06-08 17:03:50 +00:00
James Housley
4f8ebd1673 Curl_scp_done() needs to call libssh2_channel_free() to prevent a
memory leak, and it is the right thing to do.
2007-06-08 16:19:21 +00:00
James Housley
cd4e6fbcac Fix to work with the latest CVS version of libssh2
* As of (LIBSSH2_APINO >= 200706012030) there are not *nb() functions
* As of (LIBSSH2_APINO >= 200706012030) most libssh2_*() functions
  can return LIBSSH2_ERROR_EAGAIN to indicate that the call would block.

To make the code work as previously, blocking, all the code has been
updated so that when (LIBSSH2_APINO >= 200706012030) it loops simulating
blocking.  This allows the existing code to function and not hold up
the upcoming release.
2007-06-08 16:02:57 +00:00
Daniel Stenberg
2fd2ca9dac start working on 1.4.1 2007-06-08 09:01:33 +00:00
36 changed files with 1915 additions and 381 deletions

89
CHANGES
View File

@@ -6,6 +6,95 @@
Changelog
Version 7.16.3 (25 June 2007)
Daniel S (23 June 2007)
- As reported by "Tro" in http://curl.haxx.se/mail/lib-2007-06/0161.html and
http://curl.haxx.se/mail/lib-2007-06/0238.html, libcurl didn't properly do
no-body requests on FTP files on re-used connections properly, or at least
it didn't provide the info back in the header callback properly in the
subsequent requests.
Daniel S (21 June 2007)
- Gerrit Bruchh<68>user pointed out a warning that the Intel(R) Thread Checker
tool reports and it was indeed a legitimate one and it is one fixed. It was
a use of a share without doing the proper locking first.
Daniel S (20 June 2007)
- Adam Piggott filed bug report #1740263
(http://curl.haxx.se/bug/view.cgi?id=1740263). Adam discovered that when
getting a large amount of URLs with curl, they were fetched slower and
slower... which turned out to be because the --libcurl data collecting which
wrongly always was enabled, but no longer is...
Daniel S (18 June 2007)
- Robson Braga Araujo filed bug report #1739100
(http://curl.haxx.se/bug/view.cgi?id=1739100) that mentioned that libcurl
could not actually list the contents of the root directory of a given FTP
server if the login directory isn't root. I fixed the problem and added
three test cases (one is disabled for now since I identified KNOWN_BUGS #44,
we cannot use --ftp-method nocwd and list ftp directories).
Daniel S (14 June 2007)
- Shmulik Regev:
I've encountered (and hopefully fixed) a problem involving proxy CONNECT
requests and easy handles state management. The problem isn't simple to
reproduce since it depends on socket state. It only manifests itself when
working with non-blocking sockets.
Here is the scenario:
1. in multi_runsingle the easy handle is in the CURLM_STATE_WAITCONNECT and
calls Curl_protocol_connect
2. in Curl_proxyCONNECT, line 1247, if the socket isn't ready the function
returns and conn->bits.tunnel_connecting is TRUE
3. when the call to Curl_protocol_connect returns the protocol_connect flag
is false and the easy state is changed to CURLM_STATE_PROTOCONNECT which
isn't correct if a proxy is used. Rather CURLM_STATE_WAITPROXYCONNECT
should be used.
I discovered this while performing an HTTPS request through a proxy (squid)
on my local network. The problem caused openssl to fail as it read the proxy
response to the CONNECT call ('HTTP/1.0 Established') rather than the SSL
handshake (the exact openssl error was 'wrong ssl version' but this isn't
very important)
- Dave Vasilevsky filed bug report #1736875
(http://curl.haxx.se/bug/view.cgi?id=1736875) almost simultanouesly as Dan
Fandrich mentioned a related build problem on the libcurl mailing list:
http://curl.haxx.se/mail/lib-2007-06/0131.html. Both problems had the same
reason: the definitions of the POLL* defines and the pollfd struct in the
libcurl code was depending on HAVE_POLL instead of HAVE_SYS_POLL_H.
Daniel S (13 June 2007)
- Tom Regner provided a patch and worked together with James Housley, so now
CURLOPT_FTP_CREATE_MISSING_DIRS works for SFTP connections as well as FTP
ones.
- Rich Rauenzahn filed bug report #1733119
(http://curl.haxx.se/bug/view.cgi?id=1733119) and we collaborated on the
fix. The problem is that for 64bit HPUX builds, several socket-related
functions would still assume int (32 bit) arguments and not socklen_t (64
bit) ones.
Daniel S (12 June 2007)
- James Housley brought his revamped SSH code that is state-machine driven to
really take advantage of the now totally non-blocking libssh2 (in CVS).
Dan F (8 June 2007)
- Incorporated Daniel Black's test706 and test707 SOCKS test cases.
- Fixed a few problems when starting the SOCKS server.
- Reverted some recent changes to runtests.pl that weren't compatible with
perl 5.0.
- Fixed the test harness so that it actually kills the ssh being used as
the SOCKS server.
Daniel S (6 June 2007)
- -s/--silent can now be used to toggle off the silence again if used a second
time.

View File

@@ -234,6 +234,10 @@ netware-clean:
$(MAKE) -C lib -f Makefile.netware clean
$(MAKE) -C src -f Makefile.netware clean
netware-install:
$(MAKE) -C lib -f Makefile.netware install
$(MAKE) -C src -f Makefile.netware install
unix: all
unix-ssl: ssl

View File

@@ -21,6 +21,8 @@ This release includes the following changes:
o upload resume works for file:// URLs
o asynchronous name resolves now require c-ares 1.4.0 or later
o added SOCKS test cases
o CURLOPT_FTP_CREATE_MISSING_DIRS and --ftp-create-dirs now work for SFTP
operations as well
This release includes the following bugfixes:
@@ -54,6 +56,12 @@ This release includes the following bugfixes:
o FPL-SSL when built with NSS
o out-of-boundary write in Curl_select()
o -s/--silent can now be used to toggle off the silence again
o builds fine on 64bit HP-UX
o multi interface HTTP CONNECT glitch
o list FTP root directories when login dir is not root
o no longer slows down when getting very many URLs on the same command line
o lock share before decreasing dirty counter
o no-body FTP requests on re-used connections
This release includes the following known bugs:
@@ -79,6 +87,8 @@ advice from friends like these:
James Housley, Daniel Black, Steve Little, Sonia Subramanian, Peter O'Gorman,
Frank Hempel, Michael Wallner, Jeff Pohlmeyer, Tobias Rundstr<74>m,
Anders Gustafsson, James Bursa, Kristian Gunstone, Feng Tu,
Andre Guibert de Bruet, Rob Crittenden
Andre Guibert de Bruet, Rob Crittenden, Rich Rauenzahn, Tom Regner,
Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott,
Gerrit Bruchh<68>user
Thanks! (and sorry if I forgot to mention someone)

View File

@@ -1,24 +1,9 @@
This is what's new and changed in the c-ares 1.4.0 release:
This is what's new and changed in the c-ares 1.4.1 release:
o fixed VS2005 compiler warnings due to time_t being 64bit
o introduced cryptographically secure transaction IDs
o added ares_save_options()
o added ares_destroy_options()
o added ares_process_fd()
o fixed undefined return value in init_by_resolv_conf() function for windows
o added ares_parse_ns_reply()
o fix failure to get the search sequence of /etc/hosts and DNS from
/etc/nsswitch.conf, /etc/host.conf or /etc/svc.conf when /etc/resolv.conf
did not exist
o when domains were sert in the options struct, and there were domain/search
entries in /etc/resolv.conf, the domains of the options struct would be
overridden
o removed a couple of potential zero size memory allocations
o fixed the line endings in areslib.dsp
o
Thanks go to these friendly people for their efforts and contributions:
Andreas Rieke, Yang Tse, Michael Wallner, Vlad Dinulescu, Ravi Pratap,
Brad House, Shmulik Regev, Brad Spencer
Have fun!

View File

@@ -5,11 +5,11 @@
#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 4
#define ARES_VERSION_PATCH 0
#define ARES_VERSION_PATCH 1
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.4.0-CVS"
#define ARES_VERSION_STR "1.4.1-CVS"
#ifdef __cplusplus
extern "C" {

View File

@@ -204,6 +204,9 @@ dnl The install stuff has already been taken care of by the automake stuff
dnl AC_PROG_INSTALL
AC_PROG_MAKE_SET
dnl check if there's a way to force code inline
AC_C_INLINE
dnl **********************************************************************
dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
dnl and ws2tcpip.h take precedence over any other further checks which

View File

@@ -755,7 +755,9 @@ FAQ
4.9 Curl can't authenticate to the server that requires NTLM?
This is supported in curl 7.10.6 or later. No earlier curl version knows
of this magic.
of this magic. Later versions require the OpenSSL or Microsoft Windows
libraries to provide this functionality. Using GnuTLS or NSS libraries will
not provide NTLM authentication functionality in curl.
NTLM is a Microsoft proprietary protocol. Proprietary formats are evil. You
should not use such ones.

View File

@@ -3,6 +3,9 @@ join in and help us correct one or more of these! Also be sure to check the
changelog of the current development status, as one or more of these problems
may have been fixed since this was written!
44. --ftp-method nocwd does not handle URLs ending with a slash properly (it
should list the contents of that directory). See test case 351.
43. There seems to be a problem when connecting to the Microsoft telnet server.
http://curl.haxx.se/bug/view.cgi?id=1720605
@@ -11,9 +14,6 @@ may have been fixed since this was written!
and thus fails to issue the correct command:
http://curl.haxx.se/bug/view.cgi?id=1693337
40. Mac OS X test failures (Daniel Johnson)
http://curl.haxx.se/mail/lib-2007-03/0095.html
39. Steffen Rumler's Race Condition in Curl_proxyCONNECT:
http://curl.haxx.se/mail/lib-2007-01/0045.html

View File

@@ -216,7 +216,8 @@ local directory hierarchy as needed. This option creates the dirs mentioned
with the -o option, nothing else. If the -o file name uses no dir or if the
dirs it mentions already exist, no dir will be created.
To create remote directories when using FTP, try \fI--ftp-create-dirs\fP.
To create remote directories when using FTP or SFTP, try
\fI--ftp-create-dirs\fP.
.IP "--crlf"
(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
@@ -382,7 +383,7 @@ has been provided, this data is sent off using the ACCT command. (Added in
If this option is used twice, the second will override the previous use.
.IP "--ftp-create-dirs"
(FTP) When an FTP URL/operation uses a path that doesn't currently exist on
(FTP) When an FTP or SFTP URL/operation uses a path that doesn't currently exist on
the server, the standard behavior of curl is to fail. Using this option, curl
will instead attempt to create missing directories.

View File

@@ -890,6 +890,11 @@ If the server is an IPv6 host, this option will have no effect as of 7.12.3.
Pass a long. If the value is non-zero, curl will attempt to create any remote
directory that it fails to CWD into. CWD is the command that changes working
directory. (Added in 7.10.7)
This setting also applies to SFTP-connections. curl will attempt to create
the remote directory if it can't obtain a handle to the target-location. The
creation will fail if a file of the same name as the directory to create
already exists or lack of permissions prevents creation. (Added in 7.16.3)
.IP CURLOPT_FTP_RESPONSE_TIMEOUT
Pass a long. Causes curl to set a timeout period (in seconds) on the amount
of time that the server is allowed to take in order to generate a response

View File

@@ -25,7 +25,7 @@ endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-0.14
LIBSSH2_PATH = ../../libssh2-0.15
endif
ifndef INSTDIR
@@ -47,10 +47,10 @@ ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to DEBUG or NDEBUG
# must be equal to NDEBUG or DEBUG, CURLDEBUG
ifndef DB
DB = NDEBUG
# DB = DEBUG
# DB = CURLDEBUG
endif
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
@@ -274,7 +274,7 @@ ifdef SCREEN
else
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
endif
ifeq ($(DB),DEBUG)
ifneq ($(DB),NDEBUG)
@echo $(DL)debug$(DL) >> $@
endif
@echo $(DL)threadname "$(TARGET)"$(DL) >> $@

View File

@@ -1253,9 +1253,8 @@ static CURLcode ftp_state_post_rest(struct connectdata *conn)
struct FTP *ftp = conn->data->reqdata.proto.ftp;
struct SessionHandle *data = conn->data;
if(ftp->no_transfer || conn->bits.no_body) {
if(ftp->no_transfer) {
/* doesn't transfer any data */
ftp->no_transfer = TRUE;
/* still possibly do PRE QUOTE jobs */
state(conn, FTP_RETR_PREQUOTE);
@@ -3351,7 +3350,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
DEBUGF(infof(data, "DO-MORE phase starts\n"));
if(!ftp->no_transfer && !conn->bits.no_body) {
if(!ftp->no_transfer) {
/* a transfer is about to take place */
if(data->set.upload) {
@@ -3415,6 +3414,13 @@ CURLcode ftp_perform(struct connectdata *conn,
DEBUGF(infof(conn->data, "DO phase starts\n"));
if(conn->bits.no_body) {
/* requested no body means no transfer... */
struct FTP *ftp = conn->data->reqdata.proto.ftp;
ftp->no_transfer = TRUE;
}
*dophase_done = FALSE; /* not done yet */
/* start the first command in the DO phase */
@@ -3691,6 +3697,12 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
case FTPFILE_SINGLECWD:
/* get the last slash */
if(!path_to_use[0]) {
/* no dir, no file */
ftpc->dirdepth = 0;
ftp->file = NULL;
break;
}
slash_pos=strrchr(cur_pos, '/');
if(slash_pos || !*cur_pos) {
ftpc->dirs = (char **)calloc(1, sizeof(ftpc->dirs[0]));
@@ -3719,6 +3731,13 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
if(!ftpc->dirs)
return CURLE_OUT_OF_MEMORY;
/* we have a special case for listing the root dir only */
if(strequal(path_to_use, "/")) {
cur_pos++; /* make it point to the zero byte */
ftpc->dirs[0] = strdup("/");
ftpc->dirdepth++;
}
else {
/* parse the URL path into separate path components */
while ((slash_pos = strchr(cur_pos, '/')) != NULL) {
/* 1 or 0 to indicate absolute directory */
@@ -3731,9 +3750,8 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
CWD requires a parameter and a non-existant parameter a) doesn't
work on many servers and b) has no effect on the others. */
int len = (int)(slash_pos - cur_pos + absolute_dir);
ftpc->dirs[ftpc->dirdepth] = curl_easy_unescape(conn->data,
cur_pos - absolute_dir,
len, NULL);
ftpc->dirs[ftpc->dirdepth] =
curl_easy_unescape(conn->data, cur_pos - absolute_dir, len, NULL);
if (!ftpc->dirs[ftpc->dirdepth]) { /* run out of memory ... */
failf(data, "no memory");
freedirs(conn);
@@ -3763,11 +3781,11 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
ftpc->dirs = (char **)bigger;
}
}
}
ftp->file = cur_pos; /* the rest is the file name */
}
if(*ftp->file) {
if(ftp->file && *ftp->file) {
ftp->file = curl_easy_unescape(conn->data, ftp->file, 0, NULL);
if(NULL == ftp->file) {
freedirs(conn);
@@ -3783,8 +3801,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
ftp->file=NULL; /* instead of point to a zero byte, we make it a NULL
pointer */
if(data->set.upload && !ftp->file &&
(!ftp->no_transfer || conn->bits.no_body)) {
if(data->set.upload && !ftp->file && !ftp->no_transfer) {
/* We need a file name when uploading. Return error! */
failf(data, "Uploading to a URL without a file name!");
return CURLE_URL_MALFORMAT;

View File

@@ -253,8 +253,10 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
tvp = ares_timeout(data->state.areschannel, &store, &tv);
if(!ares_waitperform(conn, tv.tv_sec * 1000 + tv.tv_usec/1000))
/* no sockets to wait on, get out of the loop */
/* use the timeout period ares returned to us above */
ares_waitperform(conn, tv.tv_sec * 1000 + tv.tv_usec/1000);
if(conn->async.done)
break;
timediff = Curl_tvdiff(Curl_tvnow(), now); /* spent time */

View File

@@ -179,28 +179,21 @@ struct thread_sync_data {
static
void destroy_thread_sync_data(struct thread_sync_data * tsd)
{
if (tsd->hostname) {
if (tsd->hostname)
free(tsd->hostname);
tsd->hostname = NULL;
}
if (tsd->event_terminate) {
if (tsd->event_terminate)
CloseHandle(tsd->event_terminate);
tsd->event_terminate = NULL;
}
if (tsd->mutex_terminate) {
if (tsd->mutex_terminate)
CloseHandle(tsd->mutex_terminate);
tsd->mutex_terminate = NULL;
}
if (tsd->mutex_waiting) {
if (tsd->mutex_waiting)
CloseHandle(tsd->mutex_waiting);
tsd->mutex_waiting = NULL;
}
memset(tsd,0,sizeof(*tsd));
}
/* Initialize resolver thread synchronization data */
static
BOOL init_thread_sync_data(struct thread_data * td,
char * hostname,
const char * hostname,
struct thread_sync_data * tsd)
{
HANDLE curr_proc = GetCurrentProcess();
@@ -293,6 +286,7 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
* due to a resolver timeout.
*/
struct thread_sync_data tsd = { 0,0,0,NULL };
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
/* thread synchronization data initialization failed */
return (unsigned)-1;
@@ -353,6 +347,7 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
* due to a resolver timeout.
*/
struct thread_sync_data tsd = { 0,0,0,NULL };
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
/* thread synchronization data initialization failed */
return -1;

View File

@@ -1007,7 +1007,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(!protocol_connect) {
/* We have a TCP connection, but 'protocol_connect' may be false
and then we continue to 'STATE_PROTOCONNECT'. If protocol
connect is TRUE, we move on to STATE_DO. */
connect is TRUE, we move on to STATE_DO.
BUT if we are using a proxy we must change to WAITPROXYCONNECT
*/
#ifndef CURL_DISABLE_HTTP
if (easy->easy_conn->bits.tunnel_connecting)
multistate(easy, CURLM_STATE_WAITPROXYCONNECT);
else
#endif
multistate(easy, CURLM_STATE_PROTOCONNECT);
}
else {

View File

@@ -46,7 +46,7 @@
* Definition of pollfd struct and constants for platforms lacking them.
*/
#ifndef HAVE_POLL
#ifndef HAVE_SYS_POLL_H
#define POLLIN 0x01
#define POLLPRI 0x02

View File

@@ -365,5 +365,87 @@ typedef int sig_atomic_t;
#endif
#if defined (__LP64__) && defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED)
#include <sys/socket.h>
/* HP-UX has this oddity where it features a few functions that don't work
with socklen_t so we need to convert to ints
This is due to socklen_t being a 64bit int under 64bit ABI, but the
pre-xopen (default) interfaces require an int, which is 32bits.
Therefore, Anytime socklen_t is passed by pointer, the libc function
truncates the 64bit socklen_t value by treating it as a 32bit value.
Note that some socket calls are allowed to have a NULL pointer for
the socklen arg.
*/
inline static int Curl_hp_getsockname(int s, struct sockaddr *name,
socklen_t *namelen)
{
int rc;
if(namelen) {
int len = *namelen;
rc = getsockname(s, name, &len);
*namelen = len;
}
else
rc = getsockname(s, name, 0);
return rc;
}
inline static int Curl_hp_getsockopt(int s, int level, int optname,
void *optval, socklen_t *optlen)
{
int rc;
if(optlen) {
int len = *optlen;
rc = getsockopt(s, level, optname, optval, &len);
*optlen = len;
}
else
rc = getsockopt(s, level, optname, optval, 0);
return rc;
}
inline static int Curl_hp_accept(int sockfd, struct sockaddr *addr,
socklen_t *addrlen)
{
int rc;
if(addrlen) {
int len = *addrlen;
rc = accept(sockfd, addr, &len);
*addrlen = len;
}
else
rc = accept(sockfd, addr, 0);
return rc;
}
inline static ssize_t Curl_hp_recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr *from,
socklen_t *fromlen)
{
ssize_t rc;
if(fromlen) {
int fromlen32 = *fromlen;
rc = recvfrom(s, buf, len, flags, from, &fromlen32);
*fromlen = fromlen32;
}
else {
rc = recvfrom(s, buf, len, flags, from, 0);
}
return rc;
}
#define getsockname(a,b,c) Curl_hp_getsockname((a),(b),(c))
#define getsockopt(a,b,c,d,e) Curl_hp_getsockopt((a),(b),(c),(d),(e))
#define accept(a,b,c) Curl_hp_accept((a),(b),(c))
#define recvfrom(a,b,c,d,e,f) Curl_hp_recvfrom((a),(b),(c),(d),(e),(f))
#endif /* HPUX work-around */
#endif /* __SETUP_ONCE_H */

1071
lib/ssh.c

File diff suppressed because it is too large Load Diff

View File

@@ -27,6 +27,7 @@
#ifdef USE_LIBSSH2
CURLcode Curl_ssh_connect(struct connectdata *conn, bool *done);
CURLcode Curl_ssh_multi_statemach(struct connectdata *conn, bool *done);
CURLcode Curl_scp_do(struct connectdata *conn, bool *done);
CURLcode Curl_scp_done(struct connectdata *conn, CURLcode, bool premature);

View File

@@ -136,7 +136,6 @@ typedef struct tftp_state_data {
time_t max_time;
unsigned short block;
struct Curl_sockaddr_storage local_addr;
socklen_t local_addrlen;
struct Curl_sockaddr_storage remote_addr;
socklen_t remote_addrlen;
int rbytes;

View File

@@ -379,7 +379,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* receive data from the network! */
readrc = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread);
DEBUGF(infof(data, "Read %ld bytes from stream (readrc = %d)\n", nread, readrc));
/* subzero, this would've blocked */
if(0 > readrc)
break; /* get out of loop */

View File

@@ -378,8 +378,11 @@ CURLcode Curl_close(struct SessionHandle *data)
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
/* No longer a dirty share, if it exists */
if (data->share)
if (data->share) {
Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
data->share->dirty--;
Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
}
free(data);
return CURLE_OK;

View File

@@ -406,6 +406,31 @@ struct ftp_conn {
ftpstate state; /* always use ftp.c:state() to change state! */
};
/****************************************************************************
* SSH unique setup
***************************************************************************/
typedef enum {
SSH_STOP, /* do nothing state, stops the state machine */
SSH_S_STARTUP, /* Session startup */
SSH_AUTHLIST,
SSH_AUTH_PKEY_INIT,
SSH_AUTH_PKEY,
SSH_AUTH_PASS_INIT,
SSH_AUTH_PASS,
SSH_AUTH_HOST_INIT,
SSH_AUTH_HOST,
SSH_AUTH_KEY_INIT,
SSH_AUTH_KEY,
SSH_AUTH_DONE,
SSH_SFTP_INIT,
SSH_SFTP_REALPATH,
SSH_GET_WORKINGPATH,
SSH_SFTP_SHUTDOWN,
SSH_SESSION_FREE,
SSH_QUIT,
SSH_LAST /* never used */
} sshstate;
struct SSHPROTO {
curl_off_t *bytecountp;
char *user;
@@ -421,6 +446,18 @@ struct SSHPROTO {
#endif /* USE_LIBSSH2 */
};
/* ssh_conn is used for struct connection-oriented data in the connectdata
struct */
struct ssh_conn {
const char *authlist; /* List of auth. methods, managed by libssh2 */
const char *passphrase;
char *rsa_pub;
char *rsa;
bool authed;
sshstate state; /* always use ssh.c:state() to change state! */
CURLcode actualCode; /* the actual error code */
};
/****************************************************************************
* FILE unique setup
@@ -900,6 +937,7 @@ struct connectdata {
union {
struct ftp_conn ftpc;
struct ssh_conn sshc;
} proto;
int cselect_bits; /* bitmask of socket events */

View File

@@ -25,7 +25,7 @@ endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-0.14
LIBSSH2_PATH = ../../libssh2-0.15
endif
ifndef INSTDIR
@@ -48,9 +48,10 @@ ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to DEBUG or NDEBUG
# must be equal to NDEBUG or DEBUG, CURLDEBUG
ifndef DB
DB = NDEBUG
# DB = DEBUG
endif
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
@@ -252,7 +253,7 @@ ifdef SCREEN
else
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
endif
ifeq ($(DB),DEBUG)
ifneq ($(DB),NDEBUG)
@echo $(DL)debug$(DL) >> $@
endif
@echo $(DL)threadname "$(TARGET)"$(DL) >> $@

View File

@@ -3354,13 +3354,15 @@ output_expected(const char* url, const char* uploadfile)
return FALSE; /* non-HTTP upload, probably no output should be expected */
}
#define my_setopt(x,y,z) _my_setopt(x, #y, y, z)
#define my_setopt(x,y,z) _my_setopt(x, config, #y, y, z)
static struct curl_slist *easycode;
CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...);
CURLcode _my_setopt(CURL *curl, struct Configurable *config, const char *name,
CURLoption tag, ...);
CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...)
CURLcode _my_setopt(CURL *curl, struct Configurable *config, const char *name,
CURLoption tag, ...)
{
va_list arg;
CURLcode ret;
@@ -3409,6 +3411,9 @@ CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...)
ret = curl_easy_setopt(curl, tag, oval);
}
if(config->libcurl) {
/* we only use this for real if --libcurl was used */
bufp = curl_maprintf("%scurl_easy_setopt(hnd, %s, %s);%s",
remark?"/* ":"", name, value,
remark?" [REMARK] */":"");
@@ -3417,6 +3422,7 @@ CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...)
ret = CURLE_OUT_OF_MEMORY;
if (bufp)
curl_free(bufp);
}
va_end(arg);
return ret;

View File

@@ -4,3 +4,4 @@
# per line.
# Lines starting with '#' letters are treated as comments.
#230
351

View File

@@ -41,4 +41,5 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test603 test401 test402 test290 test291 test292 test293 test403 test404 \
test405 test604 test605 test606 test607 test608 test609 test294 test295 \
test296 test297 test298 test610 test611 test612 test406 test407 test408 \
test409 test613 test614 test700 test701 test702 test704 test705 test703
test409 test613 test614 test700 test701 test702 test704 test705 test703 \
test706 test707 test350 test351 test352 test353

57
tests/data/test350 Normal file
View File

@@ -0,0 +1,57 @@
<testcase>
<info>
<keywords>
FTP
PASV
LIST
</keywords>
</info>
#
# Server-side
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
-r--r--r-- 1 0 1 35 Jul 16 1996 README
lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
</datacheck>
</reply>
#
# Client-side
<client>
<server>
ftp
</server>
<name>
FTP root dir list multicwd
</name>
<command>
ftp://%HOSTIP:%FTPPORT// --ftp-method multicwd
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
CWD /
EPSV
TYPE A
LIST
QUIT
</protocol>
</verify>
</testcase>

56
tests/data/test351 Normal file
View File

@@ -0,0 +1,56 @@
<testcase>
<info>
<keywords>
FTP
PASV
LIST
</keywords>
</info>
#
# Server-side
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
-r--r--r-- 1 0 1 35 Jul 16 1996 README
lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
</datacheck>
</reply>
#
# Client-side
<client>
<server>
ftp
</server>
<name>
FTP root dir list nocwd
</name>
<command>
ftp://%HOSTIP:%FTPPORT// --ftp-method nocwd
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
EPSV
TYPE A
LIST /
QUIT
</protocol>
</verify>
</testcase>

57
tests/data/test352 Normal file
View File

@@ -0,0 +1,57 @@
<testcase>
<info>
<keywords>
FTP
PASV
LIST
</keywords>
</info>
#
# Server-side
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
-r--r--r-- 1 0 1 35 Jul 16 1996 README
lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
</datacheck>
</reply>
#
# Client-side
<client>
<server>
ftp
</server>
<name>
FTP root dir list singlecwd
</name>
<command>
ftp://%HOSTIP:%FTPPORT// --ftp-method singlecwd
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
CWD /
EPSV
TYPE A
LIST
QUIT
</protocol>
</verify>
</testcase>

56
tests/data/test353 Normal file
View File

@@ -0,0 +1,56 @@
<testcase>
<info>
<keywords>
FTP
PASV
LIST
</keywords>
</info>
#
# Server-side
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
-r--r--r-- 1 0 1 35 Jul 16 1996 README
lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
</datacheck>
</reply>
#
# Client-side
<client>
<server>
ftp
</server>
<name>
FTP home dir list singlecwd
</name>
<command>
ftp://%HOSTIP:%FTPPORT/ --ftp-method singlecwd
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
EPSV
TYPE A
LIST
QUIT
</protocol>
</verify>
</testcase>

View File

@@ -90,60 +90,66 @@ lock: dns <Pigs in space>: 16
unlock: dns <Pigs in space>: 17
lock: cookie <Pigs in space>: 18
unlock: cookie <Pigs in space>: 19
*** run 2
CURLOPT_SHARE
lock: share <Pigs in space>: 20
unlock: share <Pigs in space>: 21
*** run 2
CURLOPT_SHARE
lock: share <Pigs in space>: 22
unlock: share <Pigs in space>: 23
PERFORM
lock: dns <Pigs in space>: 22
unlock: dns <Pigs in space>: 23
lock: dns <Pigs in space>: 24
unlock: dns <Pigs in space>: 25
lock: cookie <Pigs in space>: 26
unlock: cookie <Pigs in space>: 27
lock: dns <Pigs in space>: 26
unlock: dns <Pigs in space>: 27
lock: cookie <Pigs in space>: 28
unlock: cookie <Pigs in space>: 29
lock: cookie <Pigs in space>: 30
unlock: cookie <Pigs in space>: 31
lock: cookie <Pigs in space>: 32
unlock: cookie <Pigs in space>: 33
run 2: set cookie 4 and 5
lock: dns <Pigs in space>: 32
unlock: dns <Pigs in space>: 33
CLEANUP
lock: dns <Pigs in space>: 34
unlock: dns <Pigs in space>: 35
lock: cookie <Pigs in space>: 36
unlock: cookie <Pigs in space>: 37
CLEANUP
lock: dns <Pigs in space>: 36
unlock: dns <Pigs in space>: 37
lock: cookie <Pigs in space>: 38
unlock: cookie <Pigs in space>: 39
lock: share <Pigs in space>: 40
unlock: share <Pigs in space>: 41
*** run 3
CURLOPT_SHARE
lock: share <Pigs in space>: 38
unlock: share <Pigs in space>: 39
lock: share <Pigs in space>: 42
unlock: share <Pigs in space>: 43
CURLOPT_COOKIEJAR
PERFORM
lock: dns <Pigs in space>: 40
unlock: dns <Pigs in space>: 41
lock: dns <Pigs in space>: 42
unlock: dns <Pigs in space>: 43
lock: cookie <Pigs in space>: 44
unlock: cookie <Pigs in space>: 45
lock: cookie <Pigs in space>: 46
unlock: cookie <Pigs in space>: 47
lock: dns <Pigs in space>: 44
unlock: dns <Pigs in space>: 45
lock: dns <Pigs in space>: 46
unlock: dns <Pigs in space>: 47
lock: cookie <Pigs in space>: 48
unlock: cookie <Pigs in space>: 49
lock: cookie <Pigs in space>: 50
unlock: cookie <Pigs in space>: 51
lock: cookie <Pigs in space>: 52
unlock: cookie <Pigs in space>: 53
run 3: overwrite cookie 1 and 4
lock: dns <Pigs in space>: 50
unlock: dns <Pigs in space>: 51
try SHARE_CLEANUP...
lock: share <Pigs in space>: 52
unlock: share <Pigs in space>: 53
SHARE_CLEANUP failed, correct
CLEANUP
lock: dns <Pigs in space>: 54
unlock: dns <Pigs in space>: 55
lock: cookie <Pigs in space>: 56
unlock: cookie <Pigs in space>: 57
try SHARE_CLEANUP...
lock: share <Pigs in space>: 56
unlock: share <Pigs in space>: 57
SHARE_CLEANUP failed, correct
CLEANUP
lock: dns <Pigs in space>: 58
unlock: dns <Pigs in space>: 59
lock: cookie <Pigs in space>: 60
unlock: cookie <Pigs in space>: 61
lock: share <Pigs in space>: 62
unlock: share <Pigs in space>: 63
SHARE_CLEANUP
lock: share <Pigs in space>: 58
unlock: share <Pigs in space>: 59
lock: share <Pigs in space>: 64
unlock: share <Pigs in space>: 65
GLOBAL_CLEANUP
</stdout>
<stderr>

59
tests/data/test706 Normal file
View File

@@ -0,0 +1,59 @@
<testcase>
#based off test 100
<info>
<keywords>
FTP
PASV
LIST
SOCKS4
</keywords>
</info>
#
# Server-side
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
-r--r--r-- 1 0 1 35 Jul 16 1996 README
lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
</datacheck>
</reply>
#
# Client-side
<client>
<server>
ftp
socks4
</server>
<name>
FTP dir list PASV via SOCKS4
</name>
<command>
--socks4 %HOSTIP:%SOCKSPORT ftp://%HOSTIP:%FTPPORT/
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
EPSV
TYPE A
LIST
QUIT
</protocol>
</verify>
</testcase>

59
tests/data/test707 Normal file
View File

@@ -0,0 +1,59 @@
<testcase>
#based off test 100
<info>
<keywords>
FTP
PASV
LIST
SOCKS5
</keywords>
</info>
#
# Server-side
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
-r--r--r-- 1 0 1 35 Jul 16 1996 README
lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
</datacheck>
</reply>
#
# Client-side
<client>
<server>
ftp
socks5
</server>
<name>
FTP dir list PASV via SOCKS5
</name>
<command>
--socks5 %HOSTIP:%SOCKSPORT ftp://%HOSTIP:%FTPPORT/
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
EPSV
TYPE A
LIST
QUIT
</protocol>
</verify>
</testcase>

View File

@@ -113,7 +113,7 @@ if($valgrind) {
if (($? >> 8)==0) {
$valgrind_tool="--tool=memcheck ";
}
open(C, "<", $CURL);
open(C, "<$CURL");
my $l = <C>;
if($l =~ /^\#\!/) {
# The first line starts with "#!" which implies a shell-script.
@@ -273,17 +273,12 @@ sub startnew {
if(0 == $child) {
# Here we are the child. Run the given command.
# Calling exec() within a pseudo-process actually spawns the requested
# executable in a separate process and waits for it to complete before
# exiting with the same exit status as that process. This means that
# the process ID reported within the running executable will be
# different from what the earlier Perl fork() might have returned.
# Put an "exec" in front of the command so that the child process
# keeps this child's process ID.
exec("exec $cmd") || die "Can't exec() $cmd: $!";
# exec() should never return back here to this process. We protect
# ourselfs calling die() just in case something goes really bad.
exec($cmd) || die "Can't exec() $cmd: $!";
# ourselves by calling die() just in case something goes really bad.
die "error: exec() has returned";
}
@@ -291,11 +286,11 @@ sub startnew {
# Ugly hack but ssh doesn't support pid files
if ($fake) {
logmsg "$pidfile faked with pid=$child\n" if($verbose);
open(OUT, ">", $pidfile);
print OUT $child;
open(OUT, ">$pidfile");
print OUT $child . "\n";
close(OUT);
# could/should do a while connect fails sleep a bit and loop
sleep 1;
sleep 5;
if (checkdied($child)) {
logmsg "startnew: Warning: child process has failed to start\n" if($verbose);
return (-1,-1);
@@ -304,7 +299,7 @@ sub startnew {
my $count=12;
while($count--) {
if(-f $pidfile) {
open(PID, "<", $pidfile);
open(PID, "<$pidfile");
$pid2 = 0 + <PID>;
close(PID);
if($pid2 && kill(0, $pid2)) {
@@ -326,6 +321,9 @@ sub startnew {
sleep(1);
}
# Return two PIDs, the one for the child process we spawned and the one
# reported by the server itself (in case it forked again on its own).
# Both (potentially) need to be killed at the end of the test.
return ($child, $pid2);
}
@@ -521,7 +519,7 @@ sub verifyhttp {
}
}
}
open(FILE, "<", "log/verifiedserver");
open(FILE, "<log/verifiedserver");
my @file=<FILE>;
close(FILE);
$data=$file[0]; # first line
@@ -590,7 +588,7 @@ sub verifyftp {
sub verifyssh {
my ($proto, $ip, $port) = @_;
open(FILE, "<" . $SSHPIDFILE);
open(FILE, "<$SSHPIDFILE");
my $pid=0+<FILE>;
close(FILE);
return $pid;
@@ -601,7 +599,7 @@ sub verifyssh {
sub verifysocks {
my ($proto, $ip, $port) = @_;
open(FILE, "<" . $SOCKSPIDFILE);
open(FILE, "<$SOCKSPIDFILE");
my $pid=0+<FILE>;
close(FILE);
return $pid;
@@ -609,7 +607,9 @@ sub verifysocks {
#######################################################################
# Verify that the server that runs on $ip, $port is our server.
# Retry during 5 seconds before giving up.
# Retry over several seconds before giving up. The ssh server in
# particular can take a long time to start if it needs to generate
# keys on a slow or loaded host.
#
my %protofunc = ('http' => \&verifyhttp,
@@ -623,7 +623,7 @@ my %protofunc = ('http' => \&verifyhttp,
sub verifyserver {
my ($proto, $ip, $port) = @_;
my $count = 5; # try for this many seconds
my $count = 30; # try for this many seconds
my $pid;
while($count--) {
@@ -678,7 +678,7 @@ sub runhttpserver {
my ($httppid, $pid2) =
startnew($cmd, $pidfile,0); # start the server in a new process
if(!kill(0, $httppid)) {
if($httppid <= 0 || !kill(0, $httppid)) {
# it is NOT alive
logmsg "RUN: failed to start the HTTP server\n";
stopservers($verbose);
@@ -732,7 +732,7 @@ sub runhttpsserver {
my ($httpspid, $pid2) = startnew($cmd, $HTTPSPIDFILE,0);
if(!kill(0, $httpspid)) {
if($httpspid <= 0 || !kill(0, $httpspid)) {
# it is NOT alive
logmsg "RUN: failed to start the HTTPS server\n";
stopservers($verbose);
@@ -798,7 +798,7 @@ sub runftpserver {
my ($ftppid, $pid2) = startnew($cmd, $pidfile,0);
if(!$ftppid || !kill(0, $ftppid)) {
if($ftppid <= 0 || !kill(0, $ftppid)) {
# it is NOT alive
logmsg "RUN: failed to start the FTP$id$nameext server\n";
return -1;
@@ -851,7 +851,7 @@ sub runftpsserver {
my ($ftpspid, $pid2) = startnew($cmd, $FTPSPIDFILE,0);
if(!kill(0, $ftpspid)) {
if($ftpspid <= 0 || !kill(0, $ftpspid)) {
# it is NOT alive
logmsg "RUN: failed to start the FTPS server\n";
stopservers($verbose);
@@ -917,7 +917,7 @@ sub runtftpserver {
my ($tftppid, $pid2) = startnew($cmd, $pidfile,0);
if(!$tftppid || !kill(0, $tftppid)) {
if($tftppid <= 0 || !kill(0, $tftppid)) {
# it is NOT alive
logmsg "RUN: failed to start the FTP$id$nameext server\n";
return -1;
@@ -960,7 +960,7 @@ sub runsshserver {
my ($sshpid, $pid2) =
startnew($cmd, $pidfile,0); # start the server in a new process
if(!$sshpid || !kill(0, $sshpid)) {
if($sshpid <= 0 || !kill(0, $sshpid)) {
# it is NOT alive
logmsg "RUN: failed to start the SSH server\n";
# failed to talk to it properly. Kill the server and return failure
@@ -989,7 +989,7 @@ sub runsocksserver {
my $pidfile = $SOCKSPIDFILE;
my $flag=$debugprotocol?"-v ":"";
my $cmd="ssh -D ${HOSTIP}:$SOCKSPORT -N -F curl_ssh_config ${USER}\@${HOSTIP} -p ${SSHPORT} >log/ssh.log 2>&1";
my $cmd="ssh -D ${HOSTIP}:$SOCKSPORT -N -F curl_ssh_config ${USER}\@${HOSTIP} -p ${SSHPORT} -vv >log/ssh.log 2>&1";
my ($sshpid, $pid2) =
startnew($cmd, $pidfile,1); # start the server in a new process
@@ -1043,10 +1043,10 @@ sub filteroff {
my $filter=$_[1];
my $ofile=$_[2];
open(IN, "<", $infile)
open(IN, "<$infile")
|| return 1;
open(OUT, ">", $ofile)
open(OUT, ">$ofile")
|| return 1;
# logmsg "FILTER: off $filter from $infile to $ofile\n";
@@ -1107,7 +1107,7 @@ sub checksystem {
$versretval = system($versioncmd);
$versnoexec = $!;
open(VERSOUT, "<", $curlverout);
open(VERSOUT, "<$curlverout");
@version = <VERSOUT>;
close(VERSOUT);
@@ -1259,7 +1259,7 @@ sub checksystem {
}
if(-r "../lib/config.h") {
open(CONF, "<", "../lib/config.h");
open(CONF, "<../lib/config.h");
while(<CONF>) {
if($_ =~ /^\#define HAVE_GETRLIMIT/) {
$has_getrlimit = 1;
@@ -1634,7 +1634,7 @@ sub singletest {
my $fileContent = join('', @inputfile);
subVariables \$fileContent;
# logmsg "DEBUG: writing file " . $filename . "\n";
open(OUTFILE, ">", $filename);
open(OUTFILE, ">$filename");
binmode OUTFILE; # for crapage systems, use binary
print OUTFILE $fileContent;
close(OUTFILE);
@@ -1715,7 +1715,7 @@ sub singletest {
}
if($gdbthis) {
open(GDBCMD, ">", "log/gdbcmd");
open(GDBCMD, ">log/gdbcmd");
print GDBCMD "set args $cmdargs\n";
print GDBCMD "show args\n";
close(GDBCMD);
@@ -1752,7 +1752,7 @@ sub singletest {
logmsg "core dumped\n";
if(0 && $gdb) {
logmsg "running gdb for post-mortem analysis:\n";
open(GDBCMD, ">", "log/gdbcmd2");
open(GDBCMD, ">log/gdbcmd2");
print GDBCMD "bt\n";
close(GDBCMD);
system("$gdb --directory libtest -x log/gdbcmd2 -batch $DBGCURL core ");
@@ -2263,7 +2263,7 @@ sub startservers {
if (!checkcmd("ssh")) {
return "failed to find SSH client for socks support";
}
if ($what eq "socks5") {
if(!$run{'socks'}) {
my $sshversion=`ssh -V 2>&1`;
if ($sshversion =~ /SSH_(\d+)\.(\d+)/i) {
if ($1*10+$2 < 37) {
@@ -2273,8 +2273,7 @@ sub startservers {
} else {
return "Unsupported ssh client\n";
}
}
if(!$run{'socks'}) {
($pid, $pid2) = runsocksserver("", $verbose);
if($pid <= 0) {
return "failed starting socks server";
@@ -2466,7 +2465,7 @@ if($valgrind) {
}
# open the executable curl and read the first 4 bytes of it
open(CHECK, "<", $CURL);
open(CHECK, "<$CURL");
my $c;
sysread CHECK, $c, 4;
close(CHECK);
@@ -2514,7 +2513,7 @@ if ( $TESTCASES eq "all") {
my @cmds = grep { /^test([0-9]+)$/ && -f "$TESTDIR/$_" } readdir(DIR);
closedir(DIR);
open(D, "$TESTDIR/DISABLED");
open(D, "<$TESTDIR/DISABLED");
while(<D>) {
if(/^ *\#/) {
# allow comments
@@ -2549,7 +2548,7 @@ if ( $TESTCASES eq "all") {
#######################################################################
# Start the command line log
#
open(CMDLOG, ">", $CURLLOG) ||
open(CMDLOG, ">$CURLLOG") ||
logmsg "can't log command lines to $CURLLOG\n";
#######################################################################

View File

@@ -25,7 +25,7 @@ if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys' || $^O eq 'dos' || $^O
}
# Where to look for sftp-server
my @sftppath=qw(/usr/lib/openssh /usr/libexec/openssh /usr/libexec /usr/local/libexec /opt/local/libexec /usr/lib/ssh /usr/libexec/ssh /usr/sbin /usr/lib /usr/lib/ssh/openssh /usr/lib64/ssh /usr/lib64/misc);
my @sftppath=qw(/usr/lib/openssh /usr/libexec/openssh /usr/libexec /usr/local/libexec /opt/local/libexec /usr/lib/ssh /usr/libexec/ssh /usr/sbin /usr/lib /usr/lib/ssh/openssh /usr/lib64/ssh /usr/lib64/misc /usr/lib/misc);
my $username = $ENV{USER};
@@ -147,11 +147,11 @@ if (! -e "curl_client_key.pub") {
}
# Make sure all files are gone so ssh-keygen doesn't complain
unlink("curl_host_dsa_key", "curl_client_key","curl_host_dsa_key.pub", "curl_client_key.pub");
system "ssh-keygen -q -t dsa -f curl_host_dsa_key -C 'curl test server' -N ''" and die "Could not generate key";
system "ssh-keygen -q -t dsa -f curl_client_key -C 'curl test client' -N ''" and die "Could not generate key";
system "ssh-keygen -q -t dsa -f curl_host_dsa_key -C 'curl test server' -N ''" and die "Could not generate host key";
system "ssh-keygen -q -t dsa -f curl_client_key -C 'curl test client' -N ''" and die "Could not generate client key";
}
open(FILE, ">>", $conffile) || die "Could not write $conffile";
open(FILE, ">>$conffile") || die "Could not write $conffile";
print FILE <<EOFSSHD
AllowUsers $username
DenyUsers
@@ -205,20 +205,15 @@ if ($supports_ChReAu) {
# Now, set up some configuration files for the ssh client
open(DSAKEYFILE, "<", "curl_host_dsa_key.pub") || die 'Could not read curl_host_dsa_key.pub';
open(DSAKEYFILE, "<curl_host_dsa_key.pub") || die 'Could not read curl_host_dsa_key.pub';
my @dsahostkey = do { local $/ = ' '; <DSAKEYFILE> };
close DSAKEYFILE || die "Could not close RSAKEYFILE";
close DSAKEYFILE || die "Could not close DSAKEYFILE";
open(RSAKEYFILE, "<", "curl_host_dsa_key.pub") || die 'Could not read curl_host_dsa_key.pub';
my @rsahostkey = do { local $/ = ' '; <RSAKEYFILE> };
close RSAKEYFILE || die "Could not close RSAKEYFILE";
open(KNOWNHOSTS, ">", $knownhostsfile) || die "Could not write $knownhostsfile";
open(KNOWNHOSTS, ">$knownhostsfile") || die "Could not write $knownhostsfile";
print KNOWNHOSTS "[127.0.0.1]:$port ssh-dss $dsahostkey[1]\n" || die 'Could not write to KNOWNHOSTS';
print KNOWNHOSTS "[127.0.0.1]:$port ssh-rsa $rsahostkey[1]\n" || die 'Could not write to KNOWNHOSTS';
close KNOWNHOSTS || die "Could not close KNOWNHOSTS";
open(SSHFILE, ">", $conffile_ssh) || die "Could not write $conffile_ssh";
open(SSHFILE, ">$conffile_ssh") || die "Could not write $conffile_ssh";
print SSHFILE <<EOFSSH
IdentityFile $path/curl_client_key
UserKnownHostsFile $path/$knownhostsfile