summaryrefslogtreecommitdiff
path: root/sftp-server.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-06-08 09:25:28 +1000
committerDarren Tucker <dtucker@zip.com.au>2008-06-08 09:25:28 +1000
commit5b2e2ba9e40d77d5876a96b248f9c526f8611b7c (patch)
treed1ad158c99f8bec56956508971a8c4b69ee19a5f /sftp-server.c
parentce38d8234d6969e4c222a0110e80357c2a61162c (diff)
- (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c] Do not enable statvfs extensions on platforms that do not have statvfs. ok djm@
Diffstat (limited to 'sftp-server.c')
-rw-r--r--sftp-server.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sftp-server.c b/sftp-server.c
index a2df09f5..a9cc9408 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -23,8 +23,12 @@
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
+#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
+#endif
#include <dirent.h>
#include <errno.h>
@@ -477,6 +481,7 @@ send_attrib(u_int32_t id, const Attrib *a)
buffer_free(&msg);
}
+#ifdef USE_STATVFS
static void
send_statvfs(u_int32_t id, struct statvfs *st)
{
@@ -503,6 +508,7 @@ send_statvfs(u_int32_t id, struct statvfs *st)
send_msg(&msg);
buffer_free(&msg);
}
+#endif
/* parse incoming */
@@ -519,12 +525,14 @@ process_init(void)
/* POSIX rename extension */
buffer_put_cstring(&msg, "posix-rename@openssh.com");
buffer_put_cstring(&msg, "1"); /* version */
+#ifdef USEE_STATVFS
/* statvfs extension */
buffer_put_cstring(&msg, "statvfs@openssh.com");
buffer_put_cstring(&msg, "1"); /* version */
/* fstatvfs extension */
buffer_put_cstring(&msg, "fstatvfs@openssh.com");
buffer_put_cstring(&msg, "1"); /* version */
+#endif
send_msg(&msg);
buffer_free(&msg);
}
@@ -1134,6 +1142,7 @@ process_extended_posix_rename(u_int32_t id)
xfree(newpath);
}
+#ifdef USE_STATVFS
static void
process_extended_statvfs(u_int32_t id)
{
@@ -1169,6 +1178,7 @@ process_extended_fstatvfs(u_int32_t id)
else
send_statvfs(id, &st);
}
+#endif
static void
process_extended(void)
@@ -1180,10 +1190,12 @@ process_extended(void)
request = get_string(NULL);
if (strcmp(request, "posix-rename@openssh.com") == 0)
process_extended_posix_rename(id);
+#ifdef USE_STATVFS
else if (strcmp(request, "statvfs@openssh.com") == 0)
process_extended_statvfs(id);
else if (strcmp(request, "fstatvfs@openssh.com") == 0)
process_extended_fstatvfs(id);
+#endif
else
send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */
xfree(request);