curl-users
A couple curl fixes/changes
Date: Wed, 7 Feb 2007 17:06:41 -0500 (EST)
In trying to get curl 7.16.1 working on QNX4, I ran into an issue
with the libssh2 support... Namely, it fails to seed the SSL PRNG for
"scp:"/"sftp:" URLs (as it properly does for "https:"/"ftps:")... On
systems where OpenSSL handles the seeding itself, that's no problem,
but on QNX it can't do so, because there's no "/dev/random" or other
suitable source of randomness... So, the manual seeding is necessary...
All that's required to fix the problem is adding a "Curl_ossl_seed(data);"
call near the start of Curl_ssh_connect()...
Another unrelated issue encountered when trying to connect to a
really weird FTP server behind some sort of proxy is that it improperly
sends back a bogus extra "200 Command Okay." response after the expected
227 response to "PASV"... So, that response gets read for the next
command (in curl's case "TYPE", which is happy enough to accept it),
and its proper response (another "200") is then read for the next
command (the "LIST"/"NLST"/"RETR", which expects a 150 instead), which
isn't happy with it... I've found no FTP client which handles this
properly, and it's obviously a completely out-of-spec FTP server...
(I think it's something to do with their proxy messing things up...)
But, I was able to modify libcurl to work around the problem easily
enough by simply ignoring that bogus 200 response in ftp_state_get_resp(),
and calling "ftp_respinit(conn);" to reset things to read the proper
response... This is such a wacky thing, I'm not sure if you want to
incorporate the behavior into the standard curl distro, but it probably
couldn't hurt... *shrug* Anyway, if you care, here's the simply patch
for both this and the above SSL seeding issue:
*******************************************************************************
diff -ur curl-7.16.1.orig/lib/ftp.c curl-7.16.1/lib/ftp.c
--- curl-7.16.1.orig/lib/ftp.c 2007-01-25 06:05:45.000000000 -0500
+++ curl-7.16.1/lib/ftp.c 2007-02-07 17:01:47.000000000 -0500
@@ -2241,6 +2241,10 @@
ftp->no_transfer = TRUE; /* don't download anything */
state(conn, FTP_STOP); /* this phase is over */
}
+ else if (ftpcode == 200) {
+ infof (data, "Skipping bogus 200 response...\n");
+ ftp_respinit(conn);
+ }
else {
failf(data, "RETR response: %03d", ftpcode);
return CURLE_FTP_COULDNT_RETR_FILE;
diff -ur curl-7.16.1.orig/lib/ssh.c curl-7.16.1/lib/ssh.c
--- curl-7.16.1.orig/lib/ssh.c 2007-01-28 17:36:23.000000000 -0500
+++ curl-7.16.1/lib/ssh.c 2007-02-07 17:05:38.000000000 -0500
@@ -303,6 +303,8 @@
if (!working_path)
return CURLE_OUT_OF_MEMORY;
+ Curl_ossl_seed (data);
+
#ifdef CURL_LIBSSH2_DEBUG
if (ssh->user) {
infof(data, "User: %s\n", ssh->user);
*******************************************************************************
-- ||========================================================================|| || Rob Seace || URL || ras_at_magrathea.com || || AKA: Agrajag || http://www.magrathea.com/~ras/ || rob@wordstock.com || ||========================================================================|| "The people of Krikkit are, well, you know, they're just a bunch of real sweet guys, you know, who just happen to want to kill everybody." - Life, the Universe and EverythingReceived on 2007-02-07