diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h index f4dd6b74..767cff76 100644 --- a/include/libssh/sftp.h +++ b/include/libssh/sftp.h @@ -891,50 +891,6 @@ LIBSSH_API int sftp_server_init(sftp_session sftp); * @param sftp The sftp session handle to free. */ 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 */ /* sftpserver.c */ diff --git a/include/libssh/sftp_priv.h b/include/libssh/sftp_priv.h index 005bf85f..54c90d85 100644 --- a/include/libssh/sftp_priv.h +++ b/include/libssh/sftp_priv.h @@ -32,6 +32,27 @@ int buffer_add_attributes(ssh_buffer buffer, sftp_attributes attr); sftp_attributes sftp_parse_attr(sftp_session session, ssh_buffer buf, 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 } diff --git a/src/libssh.map b/src/libssh.map index eeb625c5..f81d8abe 100644 --- a/src/libssh.map +++ b/src/libssh.map @@ -459,3 +459,10 @@ LIBSSH_4_9_0 # Released ssh_vlog; } LIBSSH_4_8_1; +LIBSSH_AFTER_4_9_0 +{ + global: + sftp_channel_default_data_callback; + sftp_channel_default_subsystem_request; +} LIBSSH_4_9_0; + diff --git a/src/sftpserver.c b/src/sftpserver.c index 2b974905..cbdfcc88 100644 --- a/src/sftpserver.c +++ b/src/sftpserver.c @@ -258,7 +258,15 @@ sftp_client_message sftp_get_client_message(sftp_session sftp) 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; @@ -505,7 +513,19 @@ int sftp_reply_data(sftp_client_message msg, const void *data, int len) { 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; ssh_buffer out;