mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 00:28:48 -05:00
parent
219d9f8620
commit
e71542a9d9
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -31,12 +31,11 @@
|
|||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
|
|
||||||
/* figure out the path to work with in this particular request */
|
/* figure out the path to work with in this particular request */
|
||||||
CURLcode Curl_getworkingpath(struct connectdata *conn,
|
CURLcode Curl_getworkingpath(struct Curl_easy *data,
|
||||||
char *homedir, /* when SFTP is used */
|
char *homedir, /* when SFTP is used */
|
||||||
char **path) /* returns the allocated
|
char **path) /* returns the allocated
|
||||||
real path to work with */
|
real path to work with */
|
||||||
{
|
{
|
||||||
struct Curl_easy *data = conn->data;
|
|
||||||
char *real_path = NULL;
|
char *real_path = NULL;
|
||||||
char *working_path;
|
char *working_path;
|
||||||
size_t working_path_len;
|
size_t working_path_len;
|
||||||
@ -47,7 +46,7 @@ CURLcode Curl_getworkingpath(struct connectdata *conn,
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* Check for /~/, indicating relative to the user's home directory */
|
/* Check for /~/, indicating relative to the user's home directory */
|
||||||
if(conn->handler->protocol & CURLPROTO_SCP) {
|
if(data->conn->handler->protocol & CURLPROTO_SCP) {
|
||||||
real_path = malloc(working_path_len + 1);
|
real_path = malloc(working_path_len + 1);
|
||||||
if(real_path == NULL) {
|
if(real_path == NULL) {
|
||||||
free(working_path);
|
free(working_path);
|
||||||
@ -59,7 +58,7 @@ CURLcode Curl_getworkingpath(struct connectdata *conn,
|
|||||||
else
|
else
|
||||||
memcpy(real_path, working_path, 1 + working_path_len);
|
memcpy(real_path, working_path, 1 + working_path_len);
|
||||||
}
|
}
|
||||||
else if(conn->handler->protocol & CURLPROTO_SFTP) {
|
else if(data->conn->handler->protocol & CURLPROTO_SFTP) {
|
||||||
if((working_path_len > 1) && (working_path[1] == '~')) {
|
if((working_path_len > 1) && (working_path[1] == '~')) {
|
||||||
size_t homelen = strlen(homedir);
|
size_t homelen = strlen(homedir);
|
||||||
real_path = malloc(homelen + working_path_len + 1);
|
real_path = malloc(homelen + working_path_len + 1);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -39,7 +39,7 @@
|
|||||||
have their definition hidden well */
|
have their definition hidden well */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CURLcode Curl_getworkingpath(struct connectdata *conn,
|
CURLcode Curl_getworkingpath(struct Curl_easy *data,
|
||||||
char *homedir,
|
char *homedir,
|
||||||
char **path);
|
char **path);
|
||||||
|
|
||||||
|
@ -965,8 +965,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SSH_SFTP_QUOTE_INIT:
|
case SSH_SFTP_QUOTE_INIT:
|
||||||
|
result = Curl_getworkingpath(data, sshc->homedir, &protop->path);
|
||||||
result = Curl_getworkingpath(conn, sshc->homedir, &protop->path);
|
|
||||||
if(result) {
|
if(result) {
|
||||||
sshc->actualcode = result;
|
sshc->actualcode = result;
|
||||||
state(data, SSH_STOP);
|
state(data, SSH_STOP);
|
||||||
@ -1781,9 +1780,8 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
state(data, SSH_SESSION_DISCONNECT);
|
state(data, SSH_SESSION_DISCONNECT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case SSH_SCP_TRANS_INIT:
|
case SSH_SCP_TRANS_INIT:
|
||||||
result = Curl_getworkingpath(conn, sshc->homedir, &protop->path);
|
result = Curl_getworkingpath(data, sshc->homedir, &protop->path);
|
||||||
if(result) {
|
if(result) {
|
||||||
sshc->actualcode = result;
|
sshc->actualcode = result;
|
||||||
state(data, SSH_STOP);
|
state(data, SSH_STOP);
|
||||||
|
@ -1275,7 +1275,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
|
|
||||||
case SSH_SFTP_QUOTE_INIT:
|
case SSH_SFTP_QUOTE_INIT:
|
||||||
|
|
||||||
result = Curl_getworkingpath(conn, sshc->homedir, &sftp_scp->path);
|
result = Curl_getworkingpath(data, sshc->homedir, &sftp_scp->path);
|
||||||
if(result) {
|
if(result) {
|
||||||
sshc->actualcode = result;
|
sshc->actualcode = result;
|
||||||
state(data, SSH_STOP);
|
state(data, SSH_STOP);
|
||||||
@ -2503,7 +2503,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SSH_SCP_TRANS_INIT:
|
case SSH_SCP_TRANS_INIT:
|
||||||
result = Curl_getworkingpath(conn, sshc->homedir, &sftp_scp->path);
|
result = Curl_getworkingpath(data, sshc->homedir, &sftp_scp->path);
|
||||||
if(result) {
|
if(result) {
|
||||||
sshc->actualcode = result;
|
sshc->actualcode = result;
|
||||||
state(data, SSH_STOP);
|
state(data, SSH_STOP);
|
||||||
|
Loading…
Reference in New Issue
Block a user