| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- Index: lib/ftp.c
- --- lib/ftp.c.orig 2007-07-02 00:01:19 +0200
- +++ lib/ftp.c 2007-08-29 10:07:14 +0200
- @@ -2371,8 +2371,7 @@
- struct ftp_conn *ftpc = &conn->proto.ftpc;
- (void)instate; /* no use for this yet */
-
- - /* some need password anyway, and others just return 2xx ignored */
- - if((ftpcode == 331 || ftpcode/100 == 2) && (ftpc->state == FTP_USER)) {
- + if((ftpcode == 331) && (ftpc->state == FTP_USER)) {
- /* 331 Password required for ...
- (the server requires to send the user's password too) */
- NBFTPSENDF(conn, "PASS %s", ftp->passwd?ftp->passwd:"");
- Index: lib/ssh.c
- --- lib/ssh.c.orig 2007-07-06 22:13:24 +0200
- +++ lib/ssh.c 2007-08-29 10:07:14 +0200
- @@ -70,6 +70,24 @@
- #endif
- #endif /* !WIN32 */
-
- +#if defined(LIBSSH2_VERSION_NUM)
- +# if LIBSSH2_VERSION_NUM >= 0x001000
- +# define HAVE_LIBSSH2_NBLOCK 1
- +# else
- +# define HAVE_LIBSSH2_NBLOCK 0
- +# endif
- +#else /* !defined(LIBSSH2_VERSION_NUM) */
- +# if defined(LIBSSH2_APINO)
- +# if LIBSSH2_APINO >= 200706012030
- +# define HAVE_LIBSSH2_NBLOCK 1
- +# else
- +# define HAVE_LIBSSH2_NBLOCK 0
- +# endif
- +# else /* !defined(LIBSSH2_APINO) */
- +# define HAVE_LIBSSH2_NBLOCK 0
- +# endif /* defined(LIBSSH2_APINO) */
- +#endif /* defined(LIBSSH2_VERSION_NUM) */
- +
- #if (defined(NETWARE) && defined(__NOVELL_LIBC__))
- #undef in_addr_t
- #define in_addr_t unsigned long
- @@ -239,7 +257,7 @@
- (void)abstract;
- }
-
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- /*
- * SSH State machine related code
- */
- @@ -854,7 +872,7 @@
- infof(data, "SSH socket: %d\n", sock);
- #endif /* CURL_LIBSSH2_DEBUG */
-
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- state(conn, SSH_S_STARTUP);
-
- if (data->state.used_interface == Curl_if_multi)
- @@ -1134,7 +1152,7 @@
- * the destination file will be named the same name as the last directory
- * in the path.
- */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- do {
- scp->ssh_channel = libssh2_scp_send_ex(scp->ssh_session, scp->path,
- conn->data->set.new_file_perms,
- @@ -1169,7 +1187,7 @@
- */
- curl_off_t bytecount;
- memset(&sb, 0, sizeof(struct stat));
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- do {
- scp->ssh_channel = libssh2_scp_recv(scp->ssh_session, scp->path, &sb);
- if (!scp->ssh_channel &&
- @@ -1217,7 +1235,7 @@
- scp->path = NULL;
-
- if (scp->ssh_channel) {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- if (conn->data->set.upload) {
- while ((rc = libssh2_channel_send_eof(scp->ssh_channel)) ==
- LIBSSH2_ERROR_EAGAIN);
- @@ -1248,7 +1266,7 @@
- }
-
- if (scp->ssh_session) {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while (libssh2_session_disconnect(scp->ssh_session, "Shutdown") ==
- LIBSSH2_ERROR_EAGAIN);
- #else /* !(LIBSSH2_APINO >= 200706012030) */
- @@ -1279,7 +1297,7 @@
- * NOTE: we should not store nor rely on connection-related data to be
- * in the SessionHandle struct
- */
- -#if defined(LIBSSH2CHANNEL_EAGAIN) && (LIBSSH2_APINO < 200706012030)
- +#if defined(LIBSSH2CHANNEL_EAGAIN) && defined(LIBSSH2_APINO) && (LIBSSH2_APINO < 200706012030)
- nwrite = (ssize_t)
- libssh2_channel_writenb(conn->data->reqdata.proto.ssh->ssh_channel,
- mem, len);
- @@ -1287,7 +1305,7 @@
- nwrite = (ssize_t)
- libssh2_channel_write(conn->data->reqdata.proto.ssh->ssh_channel,
- mem, len);
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- if (nwrite == LIBSSH2_ERROR_EAGAIN) {
- return 0;
- }
- @@ -1313,7 +1331,7 @@
- * in the SessionHandle struct
- */
-
- -#if defined(LIBSSH2CHANNEL_EAGAIN) && (LIBSSH2_APINO < 200706012030)
- +#if defined(LIBSSH2CHANNEL_EAGAIN) && defined(LIBSSH2_APINO) && (LIBSSH2_APINO < 200706012030)
- /* we prefer the non-blocking API but that didn't exist previously */
- nread = (ssize_t)
- libssh2_channel_readnb(conn->data->reqdata.proto.ssh->ssh_channel,
- @@ -1358,7 +1376,7 @@
- * If this is not done the destination file will be named the
- * same name as the last directory in the path.
- */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- do {
- sftp->sftp_handle =
- libssh2_sftp_open(sftp->sftp_session, sftp->path,
- @@ -1446,7 +1464,7 @@
- int len, totalLen, currLen;
- char *line;
-
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- do {
- sftp->sftp_handle =
- libssh2_sftp_opendir(sftp->sftp_session, sftp->path);
- @@ -1471,7 +1489,7 @@
- #endif /* !(LIBSSH2_APINO >= 200706012030) */
-
- do {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((len = libssh2_sftp_readdir(sftp->sftp_handle, filename,
- PATH_MAX, &attrs)) ==
- LIBSSH2_ERROR_EAGAIN);
- @@ -1589,7 +1607,7 @@
- char linkPath[PATH_MAX + 1];
-
- snprintf(linkPath, PATH_MAX, "%s%s", sftp->path, filename);
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((len = libssh2_sftp_readlink(sftp->sftp_session, linkPath,
- filename, PATH_MAX)) ==
- LIBSSH2_ERROR_EAGAIN);
- @@ -1614,7 +1632,7 @@
- break;
- }
- } while (1);
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while (libssh2_sftp_closedir(sftp->sftp_handle) == LIBSSH2_ERROR_EAGAIN);
- #else /* !(LIBSSH2_APINO >= 200706012030) */
- libssh2_sftp_closedir(sftp->sftp_handle);
- @@ -1628,7 +1646,7 @@
- /*
- * Work on getting the specified file
- */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- do {
- sftp->sftp_handle =
- libssh2_sftp_open(sftp->sftp_session, sftp->path, LIBSSH2_FXF_READ,
- @@ -1654,7 +1672,7 @@
- }
- #endif /* !(LIBSSH2_APINO >= 200706012030) */
-
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((rc = libssh2_sftp_stat(sftp->sftp_session, sftp->path, &attrs))
- == LIBSSH2_ERROR_EAGAIN);
- #else /* !(LIBSSH2_APINO >= 200706012030) */
- @@ -1686,7 +1704,7 @@
- bytecount, FALSE, NULL, -1, NULL);
- #endif
- while (res == CURLE_OK) {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- ssize_t nread;
-
- while ((nread = libssh2_sftp_read(data->reqdata.proto.ssh->sftp_handle,
- @@ -1702,7 +1720,7 @@
- if (nread > 0)
- buf[nread] = 0;
-
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- if (nread <= 0)
- break;
- #else /* !(LIBSSH2_APINO >= 200706012030) */
- @@ -1753,7 +1771,7 @@
- sftp->homedir = NULL;
-
- if (sftp->sftp_handle) {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_close(sftp->sftp_handle)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret < 0) {
- @@ -1773,7 +1791,7 @@
- }
-
- if (sftp->sftp_session) {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_shutdown(sftp->sftp_session)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret < 0) {
- @@ -1787,7 +1805,7 @@
- }
-
- if (sftp->ssh_channel) {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_channel_close(sftp->ssh_channel)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret < 0) {
- @@ -1801,7 +1819,7 @@
- }
-
- if (sftp->ssh_session) {
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while (libssh2_session_disconnect(sftp->ssh_session, "Shutdown") ==
- LIBSSH2_ERROR_EAGAIN);
- #else /* !(LIBSSH2_APINO >= 200706012030) */
- @@ -1828,14 +1846,14 @@
- ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14
- but is changed to ssize_t in 0.15! */
-
- -#if defined(LIBSSH2SFTP_EAGAIN) && (LIBSSH2_APINO < 200706012030)
- +#if defined(LIBSSH2SFTP_EAGAIN) && defined(LIBSSH2_APINO) && (LIBSSH2_APINO < 200706012030)
- /* we prefer the non-blocking API but that didn't exist previously */
- nwrite = (ssize_t)
- libssh2_sftp_writenb(conn->data->reqdata.proto.ssh->sftp_handle, mem, len);
- #else
- nwrite = (ssize_t)
- libssh2_sftp_write(conn->data->reqdata.proto.ssh->sftp_handle, mem, len);
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- if (nwrite == LIBSSH2_ERROR_EAGAIN) {
- return 0;
- }
- @@ -1857,7 +1875,7 @@
-
- /* libssh2_sftp_read() returns size_t !*/
-
- -#if defined(LIBSSH2SFTP_EAGAIN) && (LIBSSH2_APINO < 200706012030)
- +#if defined(LIBSSH2SFTP_EAGAIN) && defined(LIBSSH2_APINO) && (LIBSSH2_APINO < 200706012030)
- /* we prefer the non-blocking API but that didn't exist previously */
- nread = (ssize_t)
- libssh2_sftp_readnb(conn->data->reqdata.proto.ssh->sftp_handle, mem, len);
- @@ -2058,7 +2076,7 @@
- return err;
- }
- memset(&attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_stat(sftp_session,
- path2, &attrs)) ==
- LIBSSH2_ERROR_EAGAIN);
- @@ -2112,7 +2130,7 @@
- }
-
- /* Now send the completed structure... */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_setstat(sftp_session, path2, &attrs)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret != 0) {
- @@ -2148,7 +2166,7 @@
- free(path1);
- return err;
- }
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_symlink(sftp_session, path1, path2)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret != 0) {
- @@ -2171,7 +2189,7 @@
- #endif /* !(LIBSSH2_APINO >= 200706012030) */
- }
- else if (curl_strnequal(item->data, "mkdir ", 6)) { /* create dir */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_mkdir(sftp_session, path1, 0744)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret != 0) {
- @@ -2202,7 +2220,7 @@
- free(path1);
- return err;
- }
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_rename(sftp_session, path1, path2)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret != 0) {
- @@ -2225,7 +2243,7 @@
- #endif /* !(LIBSSH2_APINO >= 200706012030) */
- }
- else if (curl_strnequal(item->data, "rmdir ", 6)) { /* delete dir */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_rmdir(sftp_session, path1)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret != 0) {
- @@ -2246,7 +2264,7 @@
- #endif /* !(LIBSSH2_APINO >= 200706012030) */
- }
- else if (curl_strnequal(item->data, "rm ", 3)) { /* delete file */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((ret = libssh2_sftp_unlink(sftp_session, path1)) ==
- LIBSSH2_ERROR_EAGAIN);
- if (ret != 0) {
- @@ -2296,7 +2314,7 @@
-
- infof(conn->data, "Creating directory '%s'\n", sftp->path);
- /* 'mode' - parameter is preliminary - default to 0644 */
- -#if (LIBSSH2_APINO >= 200706012030)
- +#if HAVE_LIBSSH2_NBLOCK
- while ((rc = libssh2_sftp_mkdir(sftp->sftp_session, sftp->path,
- conn->data->set.new_directory_perms)) ==
- LIBSSH2_ERROR_EAGAIN);
|