Loading CHANGES +8 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,14 @@ Dan F (14 May 2007) - Added SFTP directory listing test case 613. - Added support for quote commands before a transfer using SFTP and test case 614. - Changed the post-quote commands to occur after the transferred file is closed. - Allow SFTP quote commands chmod, chown, chgrp to set a value of 0. Dan F (9 May 2007) - Kristian Gunstone fixed a problem where overwriting an uploaded file with sftp didn't truncate it first, which would corrupt the file if the new Loading RELEASE-NOTES +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ This release includes the following changes: o uses less memory in non-pipelined use cases o CURLOPT_HTTP200ALIASES matched transfers assume HTTP 1.0 compliance o more than one test harness can run at the same time without conflict o SFTP now supports quote commands before a transfer This release includes the following bugfixes: Loading @@ -41,6 +42,7 @@ This release includes the following bugfixes: o connection cache growth in multi handles o better handling of out of memory conditions o overwriting an uploaded file with sftp now truncates it first o SFTP quote commands chmod, chown, chgrp can now set a value of 0 This release includes the following known bugs: Loading docs/curl.1 +11 −11 Original line number Diff line number Diff line Loading @@ -897,17 +897,17 @@ file will not be read and used. See the \fI-K/--config\fP for details on the default config file search path. .IP "-Q/--quote <command>" (FTP/SFTP) Send an arbitrary command to the remote FTP or SFTP server. Quote commands are sent BEFORE the transfer is taking place (just after the initial PWD command to be exact). To make commands take place after a successful transfer, prefix them with a dash '-' (only the latter is supported with SFTP). To make commands get sent after libcurl has changed working directory, just before the transfer command(s), prefix the command with '+'. You may specify any amount of commands. If the server returns failure for one of the commands, the entire operation will be aborted. You must send syntactically correct FTP commands as RFC959 defines to FTP servers, or one of the following commands (with appropriate arguments) to SFTP servers: chgrp, chmod, chown, ln, mkdir, rename, rm, rmdir, symlink. commands are sent BEFORE the transfer is taking place (just after the initial PWD command in an FTP transfer, to be exact). To make commands take place after a successful transfer, prefix them with a dash '-'. To make commands get sent after libcurl has changed working directory, just before the transfer command(s), prefix the command with '+' (this is only supported for FTP). You may specify any number of commands. If the server returns failure for one of the commands, the entire operation will be aborted. You must send syntactically correct FTP commands as RFC959 defines to FTP servers, or one of the following commands (with appropriate arguments) to SFTP servers: chgrp, chmod, chown, ln, mkdir, rename, rm, rmdir, symlink. This option can be used multiple times. .IP "--random-file <file>" Loading docs/libcurl/curl_easy_setopt.3 +13 −12 Original line number Diff line number Diff line Loading @@ -839,19 +839,20 @@ address. Default FTP operations are passive, and thus won't use PORT. You disable PORT again and go back to using the passive version by setting this option to NULL. .IP CURLOPT_QUOTE Pass a pointer to a linked list of FTP commands to pass to the server prior to your ftp request. This will be done before any other FTP commands are issued (even before the CWD command). The linked list should be a fully valid list of 'struct curl_slist' structs properly filled in. Use \fIcurl_slist_append(3)\fP to append strings (commands) to the list, and clear the entire list afterwards with \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a NULL to this option. Pass a pointer to a linked list of FTP or SFTP commands to pass to the server prior to your ftp request. This will be done before any other commands are issued (even before the CWD command for FTP). The linked list should be a fully valid list of 'struct curl_slist' structs properly filled in with text strings. Use \fIcurl_slist_append(3)\fP to append strings (commands) to the list, and clear the entire list afterwards with \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a NULL to this option. .IP CURLOPT_POSTQUOTE Pass a pointer to a linked list of FTP commands to pass to the server after your ftp transfer request. The linked list should be a fully valid list of struct curl_slist structs properly filled in as described for \fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this option. Pass a pointer to a linked list of FTP or SFTP commands to pass to the server after your ftp transfer request. The linked list should be a fully valid list of struct curl_slist structs properly filled in as described for \fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this option. .IP CURLOPT_PREQUOTE Pass a pointer to a linked list of FTP commands to pass to the server after the transfer type is set. The linked list should be a fully valid list of Loading lib/ssh.c +18 −9 Original line number Diff line number Diff line Loading @@ -714,6 +714,14 @@ CURLcode Curl_sftp_do(struct connectdata *conn, bool *done) *done = TRUE; /* unconditionally */ /* Send any quote commands */ if(conn->data->set.quote) { infof(conn->data, "Sending quote commands\n"); res = sftp_sendquote(conn, conn->data->set.quote); if (res != CURLE_OK) return res; } if (data->set.upload) { /* * NOTE!!! libssh2 requires that the destination path is a full path Loading Loading @@ -980,17 +988,18 @@ CURLcode Curl_sftp_done(struct connectdata *conn, CURLcode status, Curl_safefree(sftp->homedir); sftp->homedir = NULL; /* Before we shut down, see if there are any post-quote commands to send: */ if(!status && !premature && conn->data->set.postquote) { rc = sftp_sendquote(conn, conn->data->set.postquote); } if (sftp->sftp_handle) { if (libssh2_sftp_close(sftp->sftp_handle) < 0) { infof(conn->data, "Failed to close libssh2 file\n"); } } /* Before we shut down, see if there are any post-quote commands to send: */ if(!status && !premature && conn->data->set.postquote) { infof(conn->data, "Sending postquote commands\n"); rc = sftp_sendquote(conn, conn->data->set.postquote); } if (sftp->sftp_session) { if (libssh2_sftp_shutdown(sftp->sftp_session) < 0) { infof(conn->data, "Failed to stop libssh2 sftp subsystem\n"); Loading Loading @@ -1060,7 +1069,7 @@ get_pathname(const char **cpp, char **path) const char *cp = *cpp, *end; char quot; u_int i, j; const char *WHITESPACE = " \t\r\n"; static const char * const WHITESPACE = " \t\r\n"; cp += strspn(cp, WHITESPACE); if (!*cp) { Loading Loading @@ -1239,7 +1248,7 @@ static CURLcode sftp_sendquote(struct connectdata *conn, /* Now set the new attributes... */ if (curl_strnequal(item->data, "chgrp", 5)) { attrs.gid = strtol(path1, NULL, 10); if (attrs.gid == 0) { if (attrs.gid == 0 && !ISDIGIT(path1[0])) { free(path1); free(path2); failf(data, "Syntax error: chgrp gid not a number"); Loading @@ -1248,7 +1257,7 @@ static CURLcode sftp_sendquote(struct connectdata *conn, } else if (curl_strnequal(item->data, "chmod", 5)) { attrs.permissions = strtol(path1, NULL, 8);/* permissions are octal */ if (attrs.permissions == 0) { if (attrs.permissions == 0 && !ISDIGIT(path1[0])) { free(path1); free(path2); failf(data, "Syntax error: chmod permissions not a number"); Loading @@ -1257,7 +1266,7 @@ static CURLcode sftp_sendquote(struct connectdata *conn, } else if (curl_strnequal(item->data, "chown", 5)) { attrs.uid = strtol(path1, NULL, 10); if (attrs.uid == 0) { if (attrs.uid == 0 && !ISDIGIT(path1[0])) { free(path1); free(path2); failf(data, "Syntax error: chown uid not a number"); Loading Loading
CHANGES +8 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,14 @@ Dan F (14 May 2007) - Added SFTP directory listing test case 613. - Added support for quote commands before a transfer using SFTP and test case 614. - Changed the post-quote commands to occur after the transferred file is closed. - Allow SFTP quote commands chmod, chown, chgrp to set a value of 0. Dan F (9 May 2007) - Kristian Gunstone fixed a problem where overwriting an uploaded file with sftp didn't truncate it first, which would corrupt the file if the new Loading
RELEASE-NOTES +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ This release includes the following changes: o uses less memory in non-pipelined use cases o CURLOPT_HTTP200ALIASES matched transfers assume HTTP 1.0 compliance o more than one test harness can run at the same time without conflict o SFTP now supports quote commands before a transfer This release includes the following bugfixes: Loading @@ -41,6 +42,7 @@ This release includes the following bugfixes: o connection cache growth in multi handles o better handling of out of memory conditions o overwriting an uploaded file with sftp now truncates it first o SFTP quote commands chmod, chown, chgrp can now set a value of 0 This release includes the following known bugs: Loading
docs/curl.1 +11 −11 Original line number Diff line number Diff line Loading @@ -897,17 +897,17 @@ file will not be read and used. See the \fI-K/--config\fP for details on the default config file search path. .IP "-Q/--quote <command>" (FTP/SFTP) Send an arbitrary command to the remote FTP or SFTP server. Quote commands are sent BEFORE the transfer is taking place (just after the initial PWD command to be exact). To make commands take place after a successful transfer, prefix them with a dash '-' (only the latter is supported with SFTP). To make commands get sent after libcurl has changed working directory, just before the transfer command(s), prefix the command with '+'. You may specify any amount of commands. If the server returns failure for one of the commands, the entire operation will be aborted. You must send syntactically correct FTP commands as RFC959 defines to FTP servers, or one of the following commands (with appropriate arguments) to SFTP servers: chgrp, chmod, chown, ln, mkdir, rename, rm, rmdir, symlink. commands are sent BEFORE the transfer is taking place (just after the initial PWD command in an FTP transfer, to be exact). To make commands take place after a successful transfer, prefix them with a dash '-'. To make commands get sent after libcurl has changed working directory, just before the transfer command(s), prefix the command with '+' (this is only supported for FTP). You may specify any number of commands. If the server returns failure for one of the commands, the entire operation will be aborted. You must send syntactically correct FTP commands as RFC959 defines to FTP servers, or one of the following commands (with appropriate arguments) to SFTP servers: chgrp, chmod, chown, ln, mkdir, rename, rm, rmdir, symlink. This option can be used multiple times. .IP "--random-file <file>" Loading
docs/libcurl/curl_easy_setopt.3 +13 −12 Original line number Diff line number Diff line Loading @@ -839,19 +839,20 @@ address. Default FTP operations are passive, and thus won't use PORT. You disable PORT again and go back to using the passive version by setting this option to NULL. .IP CURLOPT_QUOTE Pass a pointer to a linked list of FTP commands to pass to the server prior to your ftp request. This will be done before any other FTP commands are issued (even before the CWD command). The linked list should be a fully valid list of 'struct curl_slist' structs properly filled in. Use \fIcurl_slist_append(3)\fP to append strings (commands) to the list, and clear the entire list afterwards with \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a NULL to this option. Pass a pointer to a linked list of FTP or SFTP commands to pass to the server prior to your ftp request. This will be done before any other commands are issued (even before the CWD command for FTP). The linked list should be a fully valid list of 'struct curl_slist' structs properly filled in with text strings. Use \fIcurl_slist_append(3)\fP to append strings (commands) to the list, and clear the entire list afterwards with \fIcurl_slist_free_all(3)\fP. Disable this operation again by setting a NULL to this option. .IP CURLOPT_POSTQUOTE Pass a pointer to a linked list of FTP commands to pass to the server after your ftp transfer request. The linked list should be a fully valid list of struct curl_slist structs properly filled in as described for \fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this option. Pass a pointer to a linked list of FTP or SFTP commands to pass to the server after your ftp transfer request. The linked list should be a fully valid list of struct curl_slist structs properly filled in as described for \fICURLOPT_QUOTE\fP. Disable this operation again by setting a NULL to this option. .IP CURLOPT_PREQUOTE Pass a pointer to a linked list of FTP commands to pass to the server after the transfer type is set. The linked list should be a fully valid list of Loading
lib/ssh.c +18 −9 Original line number Diff line number Diff line Loading @@ -714,6 +714,14 @@ CURLcode Curl_sftp_do(struct connectdata *conn, bool *done) *done = TRUE; /* unconditionally */ /* Send any quote commands */ if(conn->data->set.quote) { infof(conn->data, "Sending quote commands\n"); res = sftp_sendquote(conn, conn->data->set.quote); if (res != CURLE_OK) return res; } if (data->set.upload) { /* * NOTE!!! libssh2 requires that the destination path is a full path Loading Loading @@ -980,17 +988,18 @@ CURLcode Curl_sftp_done(struct connectdata *conn, CURLcode status, Curl_safefree(sftp->homedir); sftp->homedir = NULL; /* Before we shut down, see if there are any post-quote commands to send: */ if(!status && !premature && conn->data->set.postquote) { rc = sftp_sendquote(conn, conn->data->set.postquote); } if (sftp->sftp_handle) { if (libssh2_sftp_close(sftp->sftp_handle) < 0) { infof(conn->data, "Failed to close libssh2 file\n"); } } /* Before we shut down, see if there are any post-quote commands to send: */ if(!status && !premature && conn->data->set.postquote) { infof(conn->data, "Sending postquote commands\n"); rc = sftp_sendquote(conn, conn->data->set.postquote); } if (sftp->sftp_session) { if (libssh2_sftp_shutdown(sftp->sftp_session) < 0) { infof(conn->data, "Failed to stop libssh2 sftp subsystem\n"); Loading Loading @@ -1060,7 +1069,7 @@ get_pathname(const char **cpp, char **path) const char *cp = *cpp, *end; char quot; u_int i, j; const char *WHITESPACE = " \t\r\n"; static const char * const WHITESPACE = " \t\r\n"; cp += strspn(cp, WHITESPACE); if (!*cp) { Loading Loading @@ -1239,7 +1248,7 @@ static CURLcode sftp_sendquote(struct connectdata *conn, /* Now set the new attributes... */ if (curl_strnequal(item->data, "chgrp", 5)) { attrs.gid = strtol(path1, NULL, 10); if (attrs.gid == 0) { if (attrs.gid == 0 && !ISDIGIT(path1[0])) { free(path1); free(path2); failf(data, "Syntax error: chgrp gid not a number"); Loading @@ -1248,7 +1257,7 @@ static CURLcode sftp_sendquote(struct connectdata *conn, } else if (curl_strnequal(item->data, "chmod", 5)) { attrs.permissions = strtol(path1, NULL, 8);/* permissions are octal */ if (attrs.permissions == 0) { if (attrs.permissions == 0 && !ISDIGIT(path1[0])) { free(path1); free(path2); failf(data, "Syntax error: chmod permissions not a number"); Loading @@ -1257,7 +1266,7 @@ static CURLcode sftp_sendquote(struct connectdata *conn, } else if (curl_strnequal(item->data, "chown", 5)) { attrs.uid = strtol(path1, NULL, 10); if (attrs.uid == 0) { if (attrs.uid == 0 && !ISDIGIT(path1[0])) { free(path1); free(path2); failf(data, "Syntax error: chown uid not a number"); Loading