[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] sftp_client_message getters


I added some getters that were missing from the sftp_client_message
interface

From 422c9cca6d91362bfb56ca76151ec3899aaffe47 Mon Sep 17 00:00:00 2001
From: Valerio De Benedetto <valerio@xxxxxxxxxxxxx>
Date: Tue, 6 Jun 2017 17:56:11 +0200
Subject: [PATCH 1/2] Added missing sftp_client_message getters

Signed-off-by: Valerio De Benedetto <valerio@xxxxxxxxxxxxx>
---
 include/libssh/sftp.h | 2 ++
 src/sftpserver.c      | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index 63673ca..f2d743d 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -862,6 +862,8 @@ LIBSSH_API const char *sftp_client_message_get_filename(sftp_client_message msg)
 LIBSSH_API void sftp_client_message_set_filename(sftp_client_message msg, const char *newname);
 LIBSSH_API const char *sftp_client_message_get_data(sftp_client_message msg);
 LIBSSH_API uint32_t sftp_client_message_get_flags(sftp_client_message msg);
+LIBSSH_API ssh_string sftp_client_message_get_handle(sftp_client_message msg);
+LIBSSH_API uint64_t sftp_client_message_get_offset(sftp_client_message msg);
 LIBSSH_API int sftp_send_client_message(sftp_session sftp, sftp_client_message msg);
 int sftp_reply_name(sftp_client_message msg, const char *name,
     sftp_attributes attr);
diff --git a/src/sftpserver.c b/src/sftpserver.c
index 659a688..80c52ba 100644
--- a/src/sftpserver.c
+++ b/src/sftpserver.c
@@ -242,6 +242,14 @@ uint32_t sftp_client_message_get_flags(sftp_client_message msg){
 	return msg->flags;
 }
 
+ssh_string sftp_client_message_get_handle(sftp_client_message msg){
+    return msg->handle;
+}
+
+uint64_t sftp_client_message_get_offset(sftp_client_message msg){
+    return msg->offset;
+}
+
 void sftp_client_message_free(sftp_client_message msg) {
   if (msg == NULL) {
     return;
-- 
2.7.4


From 41d88fd822e16f0abbd4b725e85b14fb3d6b6931 Mon Sep 17 00:00:00 2001
From: Valerio De Benedetto <valerio@xxxxxxxxxxxxx>
Date: Tue, 6 Jun 2017 20:02:12 +0200
Subject: [PATCH 2/2] Added sftp_client_message getter for data in ssh_string
 format

Signed-off-by: Valerio De Benedetto <valerio@xxxxxxxxxxxxx>
---
 include/libssh/sftp.h | 1 +
 src/sftpserver.c      | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index f2d743d..d3f8171 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -861,6 +861,7 @@ LIBSSH_API uint8_t sftp_client_message_get_type(sftp_client_message msg);
 LIBSSH_API const char *sftp_client_message_get_filename(sftp_client_message msg);
 LIBSSH_API void sftp_client_message_set_filename(sftp_client_message msg, const char *newname);
 LIBSSH_API const char *sftp_client_message_get_data(sftp_client_message msg);
+LIBSSH_API ssh_string sftp_client_message_get_data_ssh_string(sftp_client_message msg);
 LIBSSH_API uint32_t sftp_client_message_get_flags(sftp_client_message msg);
 LIBSSH_API ssh_string sftp_client_message_get_handle(sftp_client_message msg);
 LIBSSH_API uint64_t sftp_client_message_get_offset(sftp_client_message msg);
diff --git a/src/sftpserver.c b/src/sftpserver.c
index 80c52ba..2fb22dd 100644
--- a/src/sftpserver.c
+++ b/src/sftpserver.c
@@ -238,6 +238,10 @@ const char *sftp_client_message_get_data(sftp_client_message msg){
 	return msg->str_data;
 }
 
+ssh_string sftp_client_message_get_data_ssh_string(sftp_client_message msg){
+    return msg->data;
+}
+
 uint32_t sftp_client_message_get_flags(sftp_client_message msg){
 	return msg->flags;
 }
-- 
2.7.4



References:
[PATH] sftp_client_message gettersValerio De Benedetto <valerio@xxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org