- (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@

This commit is contained in:
Darren Tucker 2008-06-08 09:25:28 +10:00
parent ce38d8234d
commit 5b2e2ba9e4
6 changed files with 39 additions and 4 deletions

View File

@ -1,5 +1,7 @@
20080607
- (dtucker) [mux.c] Include paths.h inside ifdef HAVE_PATHS_H.
- (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.
20080604
- (djm) [openbsd-compat/bsd-arc4random.c] Fix math bug that caused bias
@ -4031,4 +4033,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.4937 2008/06/06 20:25:15 dtucker Exp $
$Id: ChangeLog,v 1.4938 2008/06/07 23:25:28 dtucker Exp $

View File

@ -1,4 +1,4 @@
# $Id: configure.ac,v 1.399 2008/05/19 22:57:06 djm Exp $
# $Id: configure.ac,v 1.400 2008/06/07 23:25:28 dtucker Exp $
#
# Copyright (c) 1999-2004 Damien Miller
#
@ -15,7 +15,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
AC_REVISION($Revision: 1.399 $)
AC_REVISION($Revision: 1.400 $)
AC_CONFIG_SRCDIR([ssh.c])
AC_CONFIG_HEADER(config.h)
@ -267,6 +267,7 @@ AC_CHECK_HEADERS( \
sys/cdefs.h \
sys/dir.h \
sys/mman.h \
sys/mount.h \
sys/ndir.h \
sys/poll.h \
sys/prctl.h \
@ -276,6 +277,7 @@ AC_CHECK_HEADERS( \
sys/stream.h \
sys/stropts.h \
sys/strtio.h \
sys/statvfs.h \
sys/sysmacros.h \
sys/time.h \
sys/timers.h \
@ -1354,6 +1356,8 @@ AC_CHECK_FUNCS( \
sigvec \
snprintf \
socketpair \
statfs \
statvfs \
strdup \
strerror \
strlcat \

View File

@ -25,7 +25,7 @@
#ifndef _DEFINES_H
#define _DEFINES_H
/* $Id: defines.h,v 1.146 2008/02/28 08:22:04 dtucker Exp $ */
/* $Id: defines.h,v 1.147 2008/06/07 23:25:28 dtucker Exp $ */
/* Constants */
@ -567,6 +567,10 @@ struct winsize {
# define CUSTOM_SSH_AUDIT_EVENTS
#endif
#if defined(HAVE_STATVFS)
# define USE_STATVFS
#endif
#if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
# define __func__ __FUNCTION__
#elif !defined(HAVE___func__)

View File

@ -24,7 +24,9 @@
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
#include "openbsd-compat/sys-queue.h"
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
@ -241,6 +243,7 @@ get_decode_stat(int fd, u_int expected_id, int quiet)
return(a);
}
#ifdef USE_STATVFS
static int
get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
{
@ -290,6 +293,7 @@ get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
return 0;
}
#endif
struct sftp_conn *
do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests)
@ -809,6 +813,7 @@ do_readlink(struct sftp_conn *conn, char *path)
}
#endif
#ifdef USE_STATVFS
int
do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st,
int quiet)
@ -834,6 +839,7 @@ do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st,
return get_decode_statvfs(conn->fd_in, st, id, quiet);
}
#endif
#ifdef notyet
int

View File

@ -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);

7
sftp.c
View File

@ -25,7 +25,9 @@
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/wait.h>
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
#endif
#include <ctype.h>
#include <errno.h>
@ -840,6 +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)
{
#ifdef USE_STATVFS
struct statvfs st;
char s_used[FMT_SCALED_STRSIZE];
char s_avail[FMT_SCALED_STRSIZE];
@ -885,6 +888,10 @@ do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
st.f_blocks));
}
return 0;
#else
error("client does not support statvfs extension");
return -1;
#endif
}
/*