summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--sftp-client.c17
-rw-r--r--sftp-client.h23
-rw-r--r--sftp.c4
4 files changed, 39 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index f183a83e6..88be1a8fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
3 - dtucker@cvs.openbsd.org 2008/06/08 17:04:41 3 - dtucker@cvs.openbsd.org 2008/06/08 17:04:41
4 [sftp-server.c] 4 [sftp-server.c]
5 Add case for ENOSYS in errno_to_portable; ok deraadt 5 Add case for ENOSYS in errno_to_portable; ok deraadt
6 - dtucker@cvs.openbsd.org 2008/06/08 20:15:29
7 [sftp.c sftp-client.c sftp-client.h]
8 Have the sftp client store the statvfs replies in wire format,
9 which prevents problems when the server's native sizes exceed the
10 client's.
11 Also extends the sizes of the remaining 32bit wire format to 64bit,
12 they're specified as unsigned long in the standard.
6 13
720080608 1420080608
8 - (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c 15 - (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c
@@ -4069,4 +4076,4 @@
4069 OpenServer 6 and add osr5bigcrypt support so when someone migrates 4076 OpenServer 6 and add osr5bigcrypt support so when someone migrates
4070 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 4077 passwords between UnixWare and OpenServer they will still work. OK dtucker@
4071 4078
4072$Id: ChangeLog,v 1.4945 2008/06/09 12:48:31 dtucker Exp $ 4079$Id: ChangeLog,v 1.4946 2008/06/09 12:49:36 dtucker Exp $
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;
diff --git a/sftp-client.h b/sftp-client.h
index b102e1180..edb46790f 100644
--- a/sftp-client.h
+++ b/sftp-client.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.h,v 1.16 2008/04/18 12:32:11 djm Exp $ */ 1/* $OpenBSD: sftp-client.h,v 1.17 2008/06/08 20:15:29 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 4 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
@@ -30,6 +30,24 @@ struct SFTP_DIRENT {
30}; 30};
31 31
32/* 32/*
33 * Used for statvfs responses on the wire from the server, because the
34 * server's native format may be larger than the client's.
35 */
36struct sftp_statvfs {
37 u_int64_t f_bsize;
38 u_int64_t f_frsize;
39 u_int64_t f_blocks;
40 u_int64_t f_bfree;
41 u_int64_t f_bavail;
42 u_int64_t f_files;
43 u_int64_t f_ffree;
44 u_int64_t f_favail;
45 u_int64_t f_fsid;
46 u_int64_t f_flag;
47 u_int64_t f_namemax;
48};
49
50/*
33 * Initialise a SSH filexfer connection. Returns NULL on error or 51 * Initialise a SSH filexfer connection. Returns NULL on error or
34 * a pointer to a initialized sftp_conn struct on success. 52 * a pointer to a initialized sftp_conn struct on success.
35 */ 53 */
@@ -71,8 +89,7 @@ int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
71char *do_realpath(struct sftp_conn *, char *); 89char *do_realpath(struct sftp_conn *, char *);
72 90
73/* Get statistics for filesystem hosting file at "path" */ 91/* Get statistics for filesystem hosting file at "path" */
74struct statvfs; 92int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
75int do_statvfs(struct sftp_conn *, const char *, struct statvfs *, int);
76 93
77/* Rename 'oldpath' to 'newpath' */ 94/* Rename 'oldpath' to 'newpath' */
78int do_rename(struct sftp_conn *, char *, char *); 95int do_rename(struct sftp_conn *, char *, char *);
diff --git a/sftp.c b/sftp.c
index 50ac03798..9b8bf389c 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.100 2008/04/18 12:32:11 djm Exp $ */ 1/* $OpenBSD: sftp.c,v 1.101 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 *
@@ -842,7 +842,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
842static int 842static int
843do_df(struct sftp_conn *conn, char *path, int hflag, int iflag) 843do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
844{ 844{
845 struct statvfs st; 845 struct sftp_statvfs st;
846 char s_used[FMT_SCALED_STRSIZE]; 846 char s_used[FMT_SCALED_STRSIZE];
847 char s_avail[FMT_SCALED_STRSIZE]; 847 char s_avail[FMT_SCALED_STRSIZE];
848 char s_root[FMT_SCALED_STRSIZE]; 848 char s_root[FMT_SCALED_STRSIZE];