summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-06-09 22:49:36 +1000
committerDarren Tucker <dtucker@zip.com.au>2008-06-09 22:49:36 +1000
commit7b598892be09a9da2855b57086dddce502a150dc (patch)
treede3a5563691daa606ddd936538574f4ea2b510dd /sftp-client.c
parent422c34c96dd7e6dcb507747bdbb499e96000aa5f (diff)
- dtucker@cvs.openbsd.org 2008/06/08 20:15:29
[sftp.c sftp-client.c sftp-client.h] Have the sftp client store the statvfs replies in wire format, which prevents problems when the server's native sizes exceed the client's. Also extends the sizes of the remaining 32bit wire format to 64bit, they're specified as unsigned long in the standard.
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sftp-client.c b/sftp-client.c
index 1fda576b4..8d0666b85 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.83 2008/06/07 21:52:46 djm Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.84 2008/06/08 20:15:29 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -244,7 +244,8 @@ get_decode_stat(int fd, u_int expected_id, int quiet)
244} 244}
245 245
246static int 246static int
247get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet) 247get_decode_statvfs(int fd, struct sftp_statvfs *st, u_int expected_id,
248 int quiet)
248{ 249{
249 Buffer msg; 250 Buffer msg;
250 u_int type, id, flag; 251 u_int type, id, flag;
@@ -273,8 +274,8 @@ get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
273 } 274 }
274 275
275 bzero(st, sizeof(*st)); 276 bzero(st, sizeof(*st));
276 st->f_bsize = buffer_get_int(&msg); 277 st->f_bsize = buffer_get_int64(&msg);
277 st->f_frsize = buffer_get_int(&msg); 278 st->f_frsize = buffer_get_int64(&msg);
278 st->f_blocks = buffer_get_int64(&msg); 279 st->f_blocks = buffer_get_int64(&msg);
279 st->f_bfree = buffer_get_int64(&msg); 280 st->f_bfree = buffer_get_int64(&msg);
280 st->f_bavail = buffer_get_int64(&msg); 281 st->f_bavail = buffer_get_int64(&msg);
@@ -282,8 +283,8 @@ get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
282 st->f_ffree = buffer_get_int64(&msg); 283 st->f_ffree = buffer_get_int64(&msg);
283 st->f_favail = buffer_get_int64(&msg); 284 st->f_favail = buffer_get_int64(&msg);
284 st->f_fsid = buffer_get_int64(&msg); 285 st->f_fsid = buffer_get_int64(&msg);
285 flag = buffer_get_int(&msg); 286 flag = buffer_get_int64(&msg);
286 st->f_namemax = buffer_get_int(&msg); 287 st->f_namemax = buffer_get_int64(&msg);
287 288
288 st->f_flag = (flag & SSH2_FXE_STATVFS_ST_RDONLY) ? ST_RDONLY : 0; 289 st->f_flag = (flag & SSH2_FXE_STATVFS_ST_RDONLY) ? ST_RDONLY : 0;
289 st->f_flag |= (flag & SSH2_FXE_STATVFS_ST_NOSUID) ? ST_NOSUID : 0; 290 st->f_flag |= (flag & SSH2_FXE_STATVFS_ST_NOSUID) ? ST_NOSUID : 0;
@@ -812,7 +813,7 @@ do_readlink(struct sftp_conn *conn, char *path)
812#endif 813#endif
813 814
814int 815int
815do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st, 816do_statvfs(struct sftp_conn *conn, const char *path, struct sftp_statvfs *st,
816 int quiet) 817 int quiet)
817{ 818{
818 Buffer msg; 819 Buffer msg;
@@ -840,7 +841,7 @@ do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st,
840#ifdef notyet 841#ifdef notyet
841int 842int
842do_fstatvfs(struct sftp_conn *conn, const char *handle, u_int handle_len, 843do_fstatvfs(struct sftp_conn *conn, const char *handle, u_int handle_len,
843 struct statvfs *st, int quiet) 844 struct sftp_statvfs *st, int quiet)
844{ 845{
845 Buffer msg; 846 Buffer msg;
846 u_int id; 847 u_int id;