aboutsummaryrefslogtreecommitdiff
path: root/libssh/sftp.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-08-12 17:12:26 +0200
committerAndreas Schneider <mail@cynapses.org>2009-08-12 17:13:42 +0200
commit2dc3b5c67527b9403befb2d54c43a3fab23be4e2 (patch)
tree3ed03126c1f312ca47c2950a8d054a0a3dd83d08 /libssh/sftp.c
parent63011c29a0922a7fd57a14bb2b45695e716a9b00 (diff)
downloadlibssh-2dc3b5c67527b9403befb2d54c43a3fab23be4e2.tar.gz
libssh-2dc3b5c67527b9403befb2d54c43a3fab23be4e2.tar.xz
libssh-2dc3b5c67527b9403befb2d54c43a3fab23be4e2.zip
Add sftp_extension_supported() function.
Diffstat (limited to 'libssh/sftp.c')
-rw-r--r--libssh/sftp.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/libssh/sftp.c b/libssh/sftp.c
index 2595dba0..250b753e 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -45,12 +45,6 @@
#define sftp_leave_function() _leave_function(sftp->channel->session)
struct sftp_ext_struct {
- int rename_openssh;
- int rename_openssh_version;
- int statvfs_openssh;
- int statvfs_openssh_version;
- int fstatvfs_openssh;
- int fstatvfs_openssh_version;
unsigned int count;
char **name;
char **data;
@@ -536,17 +530,6 @@ int sftp_init(SFTP_SESSION *sftp) {
"SFTP server extension: %s, version: %s",
ext_name, ext_data);
- if (strcmp(ext_name, "posix-rename@openssh.com") == 0) {
- sftp->ext->rename_openssh = 1;
- sftp->ext->rename_openssh_version = strtol(ext_data, (char **) NULL, 10);
- } else if (strcmp(ext_name, "statvfs@openssh.com") == 0) {
- sftp->ext->statvfs_openssh = 1;
- sftp->ext->statvfs_openssh_version = strtol(ext_data, (char **) NULL, 10);
- } else if (strcmp(ext_name, "fstatvfs@openssh.com") == 0) {
- sftp->ext->fstatvfs_openssh = 1;
- sftp->ext->fstatvfs_openssh_version = strtol(ext_data, (char **) NULL, 10);
- }
-
count++;
tmp = realloc(sftp->ext->name, count * sizeof(char *));
if (tmp == NULL) {
@@ -619,6 +602,21 @@ const char *sftp_extensions_get_data(SFTP_SESSION *sftp, unsigned int index) {
return sftp->ext->data[index];
}
+int sftp_extension_supported(SFTP_SESSION *sftp, const char *name,
+ const char *data) {
+ int i, n;
+
+ n = sftp_extensions_get_count(sftp);
+ for (i = 0; i < n; i++) {
+ if (strcmp(sftp_extensions_get_name(sftp, i), name) == 0 &&
+ strcmp(sftp_extensions_get_data(sftp, i), data) == 0) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static REQUEST_QUEUE *request_queue_new(SFTP_MESSAGE *msg) {
REQUEST_QUEUE *queue = NULL;