[PATCH 1/3] extensions: Add member data to struct sftpextensions

Michel Kraus mkraus+sgo at demonsphere.de
Sat May 16 18:00:57 BST 2015


Extend the definition of extensions to include the data member defined in
extension-pair.

Used by OpenSSH extensions allow updates to the extension.

Signed-off-by: Michel Kraus <mkraus+sgo at demonsphere.de>
---
 types.h |  5 ++++-
 v3.c    |  6 +++---
 v4.c    |  8 ++++----
 v5.c    |  8 ++++----
 v6.c    | 10 +++++-----
 5 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/types.h b/types.h
index 1cfdec7..be2a484 100644
--- a/types.h
+++ b/types.h
@@ -262,9 +262,12 @@ struct sftpcmd {
 
 /** @brief An SFTP extension request */
 struct sftpextension {
-  /** @brief Extension request name */
+  /** @brief Extension name */
   const char *name;
 
+  /** @brief Extension data */
+  const char *data;
+
   /** @brief Extension request handler */
   uint32_t (*handler)(struct sftpjob *job);
 };
diff --git a/v3.c b/v3.c
index 97fbb8a..c62af57 100644
--- a/v3.c
+++ b/v3.c
@@ -775,9 +775,9 @@ static const struct sftpcmd sftpv3tab[] = {
 };
 
 static const struct sftpextension v3_extensions[] = {
-  { "posix-rename at openssh.org", sftp_vany_posix_rename },
-  { "space-available", sftp_vany_space_available },
-  { "statfs at openssh.org", sftp_vany_statfs },
+  { "posix-rename at openssh.org", "", sftp_vany_posix_rename },
+  { "space-available", "", sftp_vany_space_available },
+  { "statfs at openssh.org", "", sftp_vany_statfs },
 };
 
 const struct sftpprotocol sftp_v3 = {
diff --git a/v4.c b/v4.c
index 58abd7b..b6adf2c 100644
--- a/v4.c
+++ b/v4.c
@@ -284,10 +284,10 @@ static const struct sftpcmd sftpv4tab[] = {
 };
 
 static const struct sftpextension v4_extensions[] = {
-  { "posix-rename at openssh.org", sftp_vany_posix_rename },
-  { "space-available", sftp_vany_space_available },
-  { "statfs at openssh.org", sftp_vany_statfs },
-  { "text-seek", sftp_vany_text_seek },
+  { "posix-rename at openssh.org", "", sftp_vany_posix_rename },
+  { "space-available", "", sftp_vany_space_available },
+  { "statfs at openssh.org", "", sftp_vany_statfs },
+  { "text-seek", "", sftp_vany_text_seek },
 };
 
 const struct sftpprotocol sftp_v4 = {
diff --git a/v5.c b/v5.c
index 1cbea95..184df43 100644
--- a/v5.c
+++ b/v5.c
@@ -477,10 +477,10 @@ static const struct sftpcmd sftpv5tab[] = {
 };
 
 static const struct sftpextension sftp_v5_extensions[] = {
-  { "posix-rename at openssh.org", sftp_vany_posix_rename },
-  { "space-available", sftp_vany_space_available },
-  { "statfs at openssh.org", sftp_vany_statfs },
-  { "text-seek", sftp_vany_text_seek },
+  { "posix-rename at openssh.org", "", sftp_vany_posix_rename },
+  { "space-available", "", sftp_vany_space_available },
+  { "statfs at openssh.org", "", sftp_vany_statfs },
+  { "text-seek", "", sftp_vany_text_seek },
 };
 
 const struct sftpprotocol sftp_v5 = {
diff --git a/v6.c b/v6.c
index a027be6..40ffd91 100644
--- a/v6.c
+++ b/v6.c
@@ -184,11 +184,11 @@ static const struct sftpcmd sftpv6tab[] = {
 /* TODO: file locking */
 
 static const struct sftpextension sftp_v6_extensions[] = {
-  { "posix-rename at openssh.org", sftp_vany_posix_rename },
-  { "space-available", sftp_vany_space_available },
-  { "statfs at openssh.org", sftp_vany_statfs },
-  { "text-seek", sftp_vany_text_seek },
-  { "version-select", sftp_v6_version_select },
+  { "posix-rename at openssh.org", "", sftp_vany_posix_rename },
+  { "space-available", "", sftp_vany_space_available },
+  { "statfs at openssh.org", "", sftp_vany_statfs },
+  { "text-seek", "", sftp_vany_text_seek },
+  { "version-select", "", sftp_v6_version_select },
 };
 
 const struct sftpprotocol sftp_v6 = {
-- 
2.1.0




More information about the sgo-software-discuss mailing list