1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-26 01:03:15 +03:00

Remove needless new symbols and add required to API

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
Jakub Jelen
2023-01-23 15:13:58 +01:00
parent 5ea54c8159
commit 691105e93b
4 changed files with 50 additions and 46 deletions

View File

@@ -891,50 +891,6 @@ LIBSSH_API int sftp_server_init(sftp_session sftp);
* @param sftp The sftp session handle to free. * @param sftp The sftp session handle to free.
*/ */
LIBSSH_API void sftp_server_free(sftp_session sftp); LIBSSH_API void sftp_server_free(sftp_session sftp);
/**
* @brief Decode the data from channel buffer into sftp read_packet.
*
* @param sftp The sftp session handle.
*
* @param data The pointer to the data buffer of channel.
*
* @return Length of data decoded.
*/
LIBSSH_API int sftp_decode_channel_data_to_packet(sftp_session sftp, void *data);
/**
* @brief Get the client message from a sftp packet.
*
* @param sftp The sftp session handle.
*
* @return The pointer to the generated sftp client message.
*/
LIBSSH_API sftp_client_message sftp_get_client_message_from_packet(sftp_session sftp);
/**
* @brief Handle the sftp_init request from client.
*
* @param client_msg The pointer to client message.
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*
* @see sftp_get_error()
*/
LIBSSH_API int sftp_process_init_packet(sftp_client_message client_msg);
/**
* @brief Handle the statvfs request, return information the mounted file system.
*
* @param msg The sftp client message.
*
* @param st The statvfs state of target file.
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*
* @see sftp_get_error()
*/
LIBSSH_API int sftp_reply_statvfs(sftp_client_message msg, sftp_statvfs_t st);
#endif /* WITH_SERVER */ #endif /* WITH_SERVER */
/* sftpserver.c */ /* sftpserver.c */

View File

@@ -32,6 +32,27 @@ int buffer_add_attributes(ssh_buffer buffer, sftp_attributes attr);
sftp_attributes sftp_parse_attr(sftp_session session, sftp_attributes sftp_parse_attr(sftp_session session,
ssh_buffer buf, ssh_buffer buf,
int expectname); int expectname);
/**
* @brief Handle the sftp_init request from client.
*
* @param client_msg The pointer to client message.
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*
* @see sftp_get_error()
*/
int sftp_process_init_packet(sftp_client_message client_msg);
/**
* @brief Decode the data from channel buffer into sftp read_packet.
*
* @param sftp The sftp session handle.
*
* @param data The pointer to the data buffer of channel.
* @param len The data buffer length
*
* @return Length of data decoded.
*/
int sftp_decode_channel_data_to_packet(sftp_session sftp, void *data);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -459,3 +459,10 @@ LIBSSH_4_9_0 # Released
ssh_vlog; ssh_vlog;
} LIBSSH_4_8_1; } LIBSSH_4_8_1;
LIBSSH_AFTER_4_9_0
{
global:
sftp_channel_default_data_callback;
sftp_channel_default_subsystem_request;
} LIBSSH_4_9_0;

View File

@@ -258,7 +258,15 @@ sftp_client_message sftp_get_client_message(sftp_session sftp)
return sftp_make_client_message(sftp, packet); return sftp_make_client_message(sftp, packet);
} }
sftp_client_message sftp_get_client_message_from_packet(sftp_session sftp) /**
* @brief Get the client message from a sftp packet.
*
* @param sftp The sftp session handle.
*
* @return The pointer to the generated sftp client message.
*/
static sftp_client_message
sftp_get_client_message_from_packet(sftp_session sftp)
{ {
sftp_packet packet = NULL; sftp_packet packet = NULL;
@@ -505,7 +513,19 @@ int sftp_reply_data(sftp_client_message msg, const void *data, int len) {
return 0; return 0;
} }
int sftp_reply_statvfs(sftp_client_message msg, sftp_statvfs_t st) /**
* @brief Handle the statvfs request, return information the mounted file system.
*
* @param msg The sftp client message.
*
* @param st The statvfs state of target file.
*
* @return 0 on success, < 0 on error with ssh and sftp error set.
*
* @see sftp_get_error()
*/
static int
sftp_reply_statvfs(sftp_client_message msg, sftp_statvfs_t st)
{ {
int ret = 0; int ret = 0;
ssh_buffer out; ssh_buffer out;