diff --git a/ChangeLog b/ChangeLog index c3c849c22..34cf9f2f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 $ diff --git a/configure.ac b/configure.ac index 858aeaf42..3005e21b5 100644 --- a/configure.ac +++ b/configure.ac @@ -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 \ diff --git a/defines.h b/defines.h index ac19095a2..a2cc28d98 100644 --- a/defines.h +++ b/defines.h @@ -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__) diff --git a/sftp-client.c b/sftp-client.c index 1e54348b7..8593cb8ce 100644 --- a/sftp-client.c +++ b/sftp-client.c @@ -24,7 +24,9 @@ #include #include +#ifdef HAVE_SYS_STATVFS_H #include +#endif #include "openbsd-compat/sys-queue.h" #ifdef HAVE_SYS_STAT_H # include @@ -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 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 @@ #ifdef HAVE_SYS_TIME_H # include #endif +#ifdef HAVE_SYS_MOUNT_H #include +#endif +#ifdef HAVE_SYS_STATVFS_H #include +#endif #include #include @@ -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); diff --git a/sftp.c b/sftp.c index ffc35cb83..c5c3b1443 100644 --- a/sftp.c +++ b/sftp.c @@ -25,7 +25,9 @@ #include #include #include +#ifdef HAVE_SYS_STATVFS_H #include +#endif #include #include @@ -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 } /*