SCP warning request
Этот коммит содержится в:
родитель
929f5ca25b
Коммит
4b363928f6
@ -111,8 +111,9 @@ static int fetch_files(ssh_session session){
|
||||
break;
|
||||
case SSH_ERROR:
|
||||
fprintf(stderr,"Error: %s\n",ssh_get_error(session));
|
||||
if(ssh_get_error_code(session)!=SSH_REQUEST_DENIED)
|
||||
return -1;
|
||||
case SSH_SCP_REQUEST_WARNING:
|
||||
fprintf(stderr,"Warning: %s\n",ssh_scp_request_get_warning(scp));
|
||||
break;
|
||||
case SSH_SCP_REQUEST_NEWDIR:
|
||||
filename=strdup(ssh_scp_request_get_filename(scp));
|
||||
|
@ -499,6 +499,7 @@ LIBSSH_API int ssh_scp_read(ssh_scp scp, void *buffer, size_t size);
|
||||
LIBSSH_API const char *ssh_scp_request_get_filename(ssh_scp scp);
|
||||
LIBSSH_API int ssh_scp_request_get_permissions(ssh_scp scp);
|
||||
LIBSSH_API size_t ssh_scp_request_get_size(ssh_scp scp);
|
||||
LIBSSH_API const char *ssh_scp_request_get_warning(ssh_scp scp);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -373,6 +373,7 @@ struct ssh_scp_struct {
|
||||
size_t processed;
|
||||
enum ssh_scp_request_types request_type;
|
||||
char *request_name;
|
||||
char *warning;
|
||||
int request_mode;
|
||||
};
|
||||
|
||||
|
11
libssh/scp.c
11
libssh/scp.c
@ -132,6 +132,7 @@ void ssh_scp_free(ssh_scp scp){
|
||||
channel_free(scp->channel);
|
||||
SAFE_FREE(scp->location);
|
||||
SAFE_FREE(scp->request_name);
|
||||
SAFE_FREE(scp->warning);
|
||||
SAFE_FREE(scp);
|
||||
}
|
||||
|
||||
@ -429,6 +430,8 @@ int ssh_scp_pull_request(ssh_scp scp){
|
||||
case 0x1:
|
||||
ssh_set_error(scp->session,SSH_REQUEST_DENIED,"SCP: Warning: %s",&buffer[1]);
|
||||
scp->request_type=SSH_SCP_REQUEST_WARNING;
|
||||
SAFE_FREE(scp->warning);
|
||||
scp->warning=strdup(&buffer[1]);
|
||||
return scp->request_type;
|
||||
case 0x2:
|
||||
ssh_set_error(scp->session,SSH_FATAL,"SCP: Error: %s",&buffer[1]);
|
||||
@ -589,3 +592,11 @@ char *ssh_scp_string_mode(int mode){
|
||||
snprintf(buffer,sizeof(buffer),"%.4o",mode);
|
||||
return strdup(buffer);
|
||||
}
|
||||
|
||||
/** @brief Gets the warning string
|
||||
* @returns Warning string. Should not be freed.
|
||||
*/
|
||||
|
||||
const char *ssh_scp_request_get_warning(ssh_scp scp){
|
||||
return scp->warning;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user