sftp: Handle read/write limits in the old low-level SFTP API

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2024-01-15 11:05:59 +01:00
parent 172f6bfb47
commit 4172752b4b
2 changed files with 27 additions and 8 deletions

View File

@@ -489,6 +489,11 @@ LIBSSH_API void sftp_file_set_blocking(sftp_file handle);
/**
* @brief Read from a file using an opened sftp file handle.
*
* This function caps the length a user is allowed to read from an sftp file.
*
* The value used for the cap is same as the value of the max_read_length
* field of the sftp_limits_t returned by sftp_limits().
*
* @param file The opened sftp file handle to be read from.
*
* @param buf Pointer to buffer to receive read data.
@@ -567,9 +572,10 @@ SSH_DEPRECATED LIBSSH_API int sftp_async_read(sftp_file file,
/**
* @brief Write to a file using an opened sftp file handle.
*
* The maximum size of the SFTP packet payload is 32768 bytes so the count
* parameter is capped at this value. This is low-level function so it does not
* try to send more than this amount of data.
* This function caps the length a user is allowed to write to an sftp file.
*
* The value used for the cap is same as the value of the max_write_length
* field of the sftp_limits_t returned by sftp_limits().
*
* @param file Open sftp file handle to write to.
*