- 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.
This commit is contained in:
parent
422c34c96d
commit
7b598892be
|
@ -3,6 +3,13 @@
|
|||
- dtucker@cvs.openbsd.org 2008/06/08 17:04:41
|
||||
[sftp-server.c]
|
||||
Add case for ENOSYS in errno_to_portable; ok deraadt
|
||||
- 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.
|
||||
|
||||
20080608
|
||||
- (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c
|
||||
|
@ -4069,4 +4076,4 @@
|
|||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||
|
||||
$Id: ChangeLog,v 1.4945 2008/06/09 12:48:31 dtucker Exp $
|
||||
$Id: ChangeLog,v 1.4946 2008/06/09 12:49:36 dtucker Exp $
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sftp-client.c,v 1.83 2008/06/07 21:52:46 djm Exp $ */
|
||||
/* $OpenBSD: sftp-client.c,v 1.84 2008/06/08 20:15:29 dtucker Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
||||
*
|
||||
|
@ -244,7 +244,8 @@ get_decode_stat(int fd, u_int expected_id, int quiet)
|
|||
}
|
||||
|
||||
static int
|
||||
get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
|
||||
get_decode_statvfs(int fd, struct sftp_statvfs *st, u_int expected_id,
|
||||
int quiet)
|
||||
{
|
||||
Buffer msg;
|
||||
u_int type, id, flag;
|
||||
|
@ -273,8 +274,8 @@ get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
|
|||
}
|
||||
|
||||
bzero(st, sizeof(*st));
|
||||
st->f_bsize = buffer_get_int(&msg);
|
||||
st->f_frsize = buffer_get_int(&msg);
|
||||
st->f_bsize = buffer_get_int64(&msg);
|
||||
st->f_frsize = buffer_get_int64(&msg);
|
||||
st->f_blocks = buffer_get_int64(&msg);
|
||||
st->f_bfree = buffer_get_int64(&msg);
|
||||
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)
|
|||
st->f_ffree = buffer_get_int64(&msg);
|
||||
st->f_favail = buffer_get_int64(&msg);
|
||||
st->f_fsid = buffer_get_int64(&msg);
|
||||
flag = buffer_get_int(&msg);
|
||||
st->f_namemax = buffer_get_int(&msg);
|
||||
flag = buffer_get_int64(&msg);
|
||||
st->f_namemax = buffer_get_int64(&msg);
|
||||
|
||||
st->f_flag = (flag & SSH2_FXE_STATVFS_ST_RDONLY) ? ST_RDONLY : 0;
|
||||
st->f_flag |= (flag & SSH2_FXE_STATVFS_ST_NOSUID) ? ST_NOSUID : 0;
|
||||
|
@ -812,7 +813,7 @@ do_readlink(struct sftp_conn *conn, char *path)
|
|||
#endif
|
||||
|
||||
int
|
||||
do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st,
|
||||
do_statvfs(struct sftp_conn *conn, const char *path, struct sftp_statvfs *st,
|
||||
int quiet)
|
||||
{
|
||||
Buffer msg;
|
||||
|
@ -840,7 +841,7 @@ do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st,
|
|||
#ifdef notyet
|
||||
int
|
||||
do_fstatvfs(struct sftp_conn *conn, const char *handle, u_int handle_len,
|
||||
struct statvfs *st, int quiet)
|
||||
struct sftp_statvfs *st, int quiet)
|
||||
{
|
||||
Buffer msg;
|
||||
u_int id;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sftp-client.h,v 1.16 2008/04/18 12:32:11 djm Exp $ */
|
||||
/* $OpenBSD: sftp-client.h,v 1.17 2008/06/08 20:15:29 dtucker Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
||||
|
@ -29,6 +29,24 @@ struct SFTP_DIRENT {
|
|||
Attrib a;
|
||||
};
|
||||
|
||||
/*
|
||||
* Used for statvfs responses on the wire from the server, because the
|
||||
* server's native format may be larger than the client's.
|
||||
*/
|
||||
struct sftp_statvfs {
|
||||
u_int64_t f_bsize;
|
||||
u_int64_t f_frsize;
|
||||
u_int64_t f_blocks;
|
||||
u_int64_t f_bfree;
|
||||
u_int64_t f_bavail;
|
||||
u_int64_t f_files;
|
||||
u_int64_t f_ffree;
|
||||
u_int64_t f_favail;
|
||||
u_int64_t f_fsid;
|
||||
u_int64_t f_flag;
|
||||
u_int64_t f_namemax;
|
||||
};
|
||||
|
||||
/*
|
||||
* Initialise a SSH filexfer connection. Returns NULL on error or
|
||||
* a pointer to a initialized sftp_conn struct on success.
|
||||
|
@ -71,8 +89,7 @@ int do_fsetstat(struct sftp_conn *, char *, u_int, Attrib *);
|
|||
char *do_realpath(struct sftp_conn *, char *);
|
||||
|
||||
/* Get statistics for filesystem hosting file at "path" */
|
||||
struct statvfs;
|
||||
int do_statvfs(struct sftp_conn *, const char *, struct statvfs *, int);
|
||||
int do_statvfs(struct sftp_conn *, const char *, struct sftp_statvfs *, int);
|
||||
|
||||
/* Rename 'oldpath' to 'newpath' */
|
||||
int do_rename(struct sftp_conn *, char *, char *);
|
||||
|
|
4
sftp.c
4
sftp.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: sftp.c,v 1.100 2008/04/18 12:32:11 djm Exp $ */
|
||||
/* $OpenBSD: sftp.c,v 1.101 2008/06/08 20:15:29 dtucker Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
|
||||
*
|
||||
|
@ -842,7 +842,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
|
|||
static int
|
||||
do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
|
||||
{
|
||||
struct statvfs st;
|
||||
struct sftp_statvfs st;
|
||||
char s_used[FMT_SCALED_STRSIZE];
|
||||
char s_avail[FMT_SCALED_STRSIZE];
|
||||
char s_root[FMT_SCALED_STRSIZE];
|
||||
|
|
Loading…
Reference in New Issue