static LIBSSH2_REALLOC_FUNC(libssh2_realloc);
static LIBSSH2_FREE_FUNC(libssh2_free);
-static int get_pathname(const char **cpp, char **path);
+static CURLcode get_pathname(const char **cpp, char **path);
static CURLcode ssh_connect(struct connectdata *conn, bool *done);
static CURLcode ssh_multi_statemach(struct connectdata *conn, bool *done);
* also, every command takes at least one argument so we get that
* first argument right now
*/
- err = get_pathname(&cp, &sshc->quote_path1);
- if(err) {
- if(err == CURLE_OUT_OF_MEMORY)
+ result = get_pathname(&cp, &sshc->quote_path1);
+ if(result) {
+ if(result == CURLE_OUT_OF_MEMORY)
failf(data, "Out of memory");
else
failf(data, "Syntax error: Bad first parameter");
state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = err;
+ sshc->actualcode = result;
break;
}
/* sshc->quote_path1 contains the mode to set */
/* get the destination */
- err = get_pathname(&cp, &sshc->quote_path2);
- if(err) {
- if(err == CURLE_OUT_OF_MEMORY)
+ result = get_pathname(&cp, &sshc->quote_path2);
+ if(result) {
+ if(result == CURLE_OUT_OF_MEMORY)
failf(data, "Out of memory");
else
failf(data, "Syntax error in chgrp/chmod/chown: "
Curl_safefree(sshc->quote_path1);
sshc->quote_path1 = NULL;
state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = err;
+ sshc->actualcode = result;
break;
}
memset(&sshc->quote_attrs, 0, sizeof(LIBSSH2_SFTP_ATTRIBUTES));
/* symbolic linking */
/* sshc->quote_path1 is the source */
/* get the destination */
- err = get_pathname(&cp, &sshc->quote_path2);
- if(err) {
- if(err == CURLE_OUT_OF_MEMORY)
+ result = get_pathname(&cp, &sshc->quote_path2);
+ if(result) {
+ if(result == CURLE_OUT_OF_MEMORY)
failf(data, "Out of memory");
else
failf(data,
Curl_safefree(sshc->quote_path1);
sshc->quote_path1 = NULL;
state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = err;
+ sshc->actualcode = result;
break;
}
state(conn, SSH_SFTP_QUOTE_SYMLINK);
/* rename file */
/* first param is the source path */
/* second param is the dest. path */
- err = get_pathname(&cp, &sshc->quote_path2);
- if(err) {
- if(err == CURLE_OUT_OF_MEMORY)
+ result = get_pathname(&cp, &sshc->quote_path2);
+ if(result) {
+ if(result == CURLE_OUT_OF_MEMORY)
failf(data, "Out of memory");
else
failf(data, "Syntax error in rename: Bad second parameter");
Curl_safefree(sshc->quote_path1);
sshc->quote_path1 = NULL;
state(conn, SSH_SFTP_CLOSE);
- sshc->actualcode = err;
+ sshc->actualcode = result;
break;
}
state(conn, SSH_SFTP_QUOTE_RENAME);
*/
static CURLcode ssh_connect(struct connectdata *conn, bool *done)
{
- struct ssh_conn *ssh;
+#ifdef CURL_LIBSSH2_DEBUG
curl_socket_t sock;
+#endif
+ struct ssh_conn *ssh;
CURLcode result;
struct SessionHandle *data = conn->data;
if(conn->passwd) {
infof(data, "Password: %s\n", conn->passwd);
}
-#endif /* CURL_LIBSSH2_DEBUG */
sock = conn->sock[FIRSTSOCKET];
+#endif /* CURL_LIBSSH2_DEBUG */
+
ssh->ssh_session = libssh2_session_init_ex(libssh2_malloc, libssh2_free,
libssh2_realloc, conn);
if(ssh->ssh_session == NULL) {
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-static int
+static CURLcode
get_pathname(const char **cpp, char **path)
{
const char *cp = *cpp, *end;
memcpy(*path, cp, end - cp);
(*path)[end - cp] = '\0';
}
- return (0);
+ return CURLE_OK;
fail:
Curl_safefree(*path);