summaryrefslogtreecommitdiff
path: root/sftp-server.c
diff options
context:
space:
mode:
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 a2df09f53..a9cc9408a 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -23,8 +23,12 @@
23#ifdef HAVE_SYS_TIME_H 23#ifdef HAVE_SYS_TIME_H
24# include <sys/time.h> 24# include <sys/time.h>
25#endif 25#endif
26#ifdef HAVE_SYS_MOUNT_H
26#include <sys/mount.h> 27#include <sys/mount.h>
28#endif
29#ifdef HAVE_SYS_STATVFS_H
27#include <sys/statvfs.h> 30#include <sys/statvfs.h>
31#endif
28 32
29#include <dirent.h> 33#include <dirent.h>
30#include <errno.h> 34#include <errno.h>
@@ -477,6 +481,7 @@ send_attrib(u_int32_t id, const Attrib *a)
477 buffer_free(&msg); 481 buffer_free(&msg);
478} 482}
479 483
484#ifdef USE_STATVFS
480static void 485static void
481send_statvfs(u_int32_t id, struct statvfs *st) 486send_statvfs(u_int32_t id, struct statvfs *st)
482{ 487{
@@ -503,6 +508,7 @@ send_statvfs(u_int32_t id, struct statvfs *st)
503 send_msg(&msg); 508 send_msg(&msg);
504 buffer_free(&msg); 509 buffer_free(&msg);
505} 510}
511#endif
506 512
507/* parse incoming */ 513/* parse incoming */
508 514
@@ -519,12 +525,14 @@ process_init(void)
519 /* POSIX rename extension */ 525 /* POSIX rename extension */
520 buffer_put_cstring(&msg, "posix-rename@openssh.com"); 526 buffer_put_cstring(&msg, "posix-rename@openssh.com");
521 buffer_put_cstring(&msg, "1"); /* version */ 527 buffer_put_cstring(&msg, "1"); /* version */
528#ifdef USEE_STATVFS
522 /* statvfs extension */ 529 /* statvfs extension */
523 buffer_put_cstring(&msg, "statvfs@openssh.com"); 530 buffer_put_cstring(&msg, "statvfs@openssh.com");
524 buffer_put_cstring(&msg, "1"); /* version */ 531 buffer_put_cstring(&msg, "1"); /* version */
525 /* fstatvfs extension */ 532 /* fstatvfs extension */
526 buffer_put_cstring(&msg, "fstatvfs@openssh.com"); 533 buffer_put_cstring(&msg, "fstatvfs@openssh.com");
527 buffer_put_cstring(&msg, "1"); /* version */ 534 buffer_put_cstring(&msg, "1"); /* version */
535#endif
528 send_msg(&msg); 536 send_msg(&msg);
529 buffer_free(&msg); 537 buffer_free(&msg);
530} 538}
@@ -1134,6 +1142,7 @@ process_extended_posix_rename(u_int32_t id)
1134 xfree(newpath); 1142 xfree(newpath);
1135} 1143}
1136 1144
1145#ifdef USE_STATVFS
1137static void 1146static void
1138process_extended_statvfs(u_int32_t id) 1147process_extended_statvfs(u_int32_t id)
1139{ 1148{
@@ -1169,6 +1178,7 @@ process_extended_fstatvfs(u_int32_t id)
1169 else 1178 else
1170 send_statvfs(id, &st); 1179 send_statvfs(id, &st);
1171} 1180}
1181#endif
1172 1182
1173static void 1183static void
1174process_extended(void) 1184process_extended(void)
@@ -1180,10 +1190,12 @@ process_extended(void)
1180 request = get_string(NULL); 1190 request = get_string(NULL);
1181 if (strcmp(request, "posix-rename@openssh.com") == 0) 1191 if (strcmp(request, "posix-rename@openssh.com") == 0)
1182 process_extended_posix_rename(id); 1192 process_extended_posix_rename(id);
1193#ifdef USE_STATVFS
1183 else if (strcmp(request, "statvfs@openssh.com") == 0) 1194 else if (strcmp(request, "statvfs@openssh.com") == 0)
1184 process_extended_statvfs(id); 1195 process_extended_statvfs(id);
1185 else if (strcmp(request, "fstatvfs@openssh.com") == 0) 1196 else if (strcmp(request, "fstatvfs@openssh.com") == 0)
1186 process_extended_fstatvfs(id); 1197 process_extended_fstatvfs(id);
1198#endif
1187 else 1199 else
1188 send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ 1200 send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */
1189 xfree(request); 1201 xfree(request);