summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac8
-rw-r--r--defines.h6
-rw-r--r--sftp-client.c6
-rw-r--r--sftp-server.c12
-rw-r--r--sftp.c7
6 files changed, 39 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index c3c849c22..34cf9f2f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
120080607 120080607
2 - (dtucker) [mux.c] Include paths.h inside ifdef HAVE_PATHS_H. 2 - (dtucker) [mux.c] Include paths.h inside ifdef HAVE_PATHS_H.
3 - (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c]
4 Do not enable statvfs extensions on platforms that do not have statvfs.
3 5
420080604 620080604
5 - (djm) [openbsd-compat/bsd-arc4random.c] Fix math bug that caused bias 7 - (djm) [openbsd-compat/bsd-arc4random.c] Fix math bug that caused bias
@@ -4031,4 +4033,4 @@
4031 OpenServer 6 and add osr5bigcrypt support so when someone migrates 4033 OpenServer 6 and add osr5bigcrypt support so when someone migrates
4032 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 4034 passwords between UnixWare and OpenServer they will still work. OK dtucker@
4033 4035
4034$Id: ChangeLog,v 1.4937 2008/06/06 20:25:15 dtucker Exp $ 4036$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 @@
1# $Id: configure.ac,v 1.399 2008/05/19 22:57:06 djm Exp $ 1# $Id: configure.ac,v 1.400 2008/06/07 23:25:28 dtucker Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -15,7 +15,7 @@
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 16
17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) 17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18AC_REVISION($Revision: 1.399 $) 18AC_REVISION($Revision: 1.400 $)
19AC_CONFIG_SRCDIR([ssh.c]) 19AC_CONFIG_SRCDIR([ssh.c])
20 20
21AC_CONFIG_HEADER(config.h) 21AC_CONFIG_HEADER(config.h)
@@ -267,6 +267,7 @@ AC_CHECK_HEADERS( \
267 sys/cdefs.h \ 267 sys/cdefs.h \
268 sys/dir.h \ 268 sys/dir.h \
269 sys/mman.h \ 269 sys/mman.h \
270 sys/mount.h \
270 sys/ndir.h \ 271 sys/ndir.h \
271 sys/poll.h \ 272 sys/poll.h \
272 sys/prctl.h \ 273 sys/prctl.h \
@@ -276,6 +277,7 @@ AC_CHECK_HEADERS( \
276 sys/stream.h \ 277 sys/stream.h \
277 sys/stropts.h \ 278 sys/stropts.h \
278 sys/strtio.h \ 279 sys/strtio.h \
280 sys/statvfs.h \
279 sys/sysmacros.h \ 281 sys/sysmacros.h \
280 sys/time.h \ 282 sys/time.h \
281 sys/timers.h \ 283 sys/timers.h \
@@ -1354,6 +1356,8 @@ AC_CHECK_FUNCS( \
1354 sigvec \ 1356 sigvec \
1355 snprintf \ 1357 snprintf \
1356 socketpair \ 1358 socketpair \
1359 statfs \
1360 statvfs \
1357 strdup \ 1361 strdup \
1358 strerror \ 1362 strerror \
1359 strlcat \ 1363 strlcat \
diff --git a/defines.h b/defines.h
index ac19095a2..a2cc28d98 100644
--- a/defines.h
+++ b/defines.h
@@ -25,7 +25,7 @@
25#ifndef _DEFINES_H 25#ifndef _DEFINES_H
26#define _DEFINES_H 26#define _DEFINES_H
27 27
28/* $Id: defines.h,v 1.146 2008/02/28 08:22:04 dtucker Exp $ */ 28/* $Id: defines.h,v 1.147 2008/06/07 23:25:28 dtucker Exp $ */
29 29
30 30
31/* Constants */ 31/* Constants */
@@ -567,6 +567,10 @@ struct winsize {
567# define CUSTOM_SSH_AUDIT_EVENTS 567# define CUSTOM_SSH_AUDIT_EVENTS
568#endif 568#endif
569 569
570#if defined(HAVE_STATVFS)
571# define USE_STATVFS
572#endif
573
570#if !defined(HAVE___func__) && defined(HAVE___FUNCTION__) 574#if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
571# define __func__ __FUNCTION__ 575# define __func__ __FUNCTION__
572#elif !defined(HAVE___func__) 576#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 @@
24 24
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/param.h> 26#include <sys/param.h>
27#ifdef HAVE_SYS_STATVFS_H
27#include <sys/statvfs.h> 28#include <sys/statvfs.h>
29#endif
28#include "openbsd-compat/sys-queue.h" 30#include "openbsd-compat/sys-queue.h"
29#ifdef HAVE_SYS_STAT_H 31#ifdef HAVE_SYS_STAT_H
30# include <sys/stat.h> 32# include <sys/stat.h>
@@ -241,6 +243,7 @@ get_decode_stat(int fd, u_int expected_id, int quiet)
241 return(a); 243 return(a);
242} 244}
243 245
246#ifdef USE_STATVFS
244static int 247static int
245get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet) 248get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
246{ 249{
@@ -290,6 +293,7 @@ get_decode_statvfs(int fd, struct statvfs *st, u_int expected_id, int quiet)
290 293
291 return 0; 294 return 0;
292} 295}
296#endif
293 297
294struct sftp_conn * 298struct sftp_conn *
295do_init(int fd_in, int fd_out, u_int transfer_buflen, u_int num_requests) 299do_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)
809} 813}
810#endif 814#endif
811 815
816#ifdef USE_STATVFS
812int 817int
813do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st, 818do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st,
814 int quiet) 819 int quiet)
@@ -834,6 +839,7 @@ do_statvfs(struct sftp_conn *conn, const char *path, struct statvfs *st,
834 839
835 return get_decode_statvfs(conn->fd_in, st, id, quiet); 840 return get_decode_statvfs(conn->fd_in, st, id, quiet);
836} 841}
842#endif
837 843
838#ifdef notyet 844#ifdef notyet
839int 845int
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 @@
23#ifdef HAVE_SYS_TIME_H 23#ifdef HAVE_SYS_TIME_H
24# include <sys/time.h> 24# include <sys/time.h>
25#endif 25#endif
26#ifdef HAVE_SYS_MOUNT_H
26#include <sys/mount.h> 27#include <sys/mount.h>
28#endif
29#ifdef HAVE_SYS_STATVFS_H
27#include <sys/statvfs.h> 30#include <sys/statvfs.h>
31#endif
28 32
29#include <dirent.h> 33#include <dirent.h>
30#include <errno.h> 34#include <errno.h>
@@ -477,6 +481,7 @@ send_attrib(u_int32_t id, const Attrib *a)
477 buffer_free(&msg); 481 buffer_free(&msg);
478} 482}
479 483
484#ifdef USE_STATVFS
480static void 485static void
481send_statvfs(u_int32_t id, struct statvfs *st) 486send_statvfs(u_int32_t id, struct statvfs *st)
482{ 487{
@@ -503,6 +508,7 @@ send_statvfs(u_int32_t id, struct statvfs *st)
503 send_msg(&msg); 508 send_msg(&msg);
504 buffer_free(&msg); 509 buffer_free(&msg);
505} 510}
511#endif
506 512
507/* parse incoming */ 513/* parse incoming */
508 514
@@ -519,12 +525,14 @@ process_init(void)
519 /* POSIX rename extension */ 525 /* POSIX rename extension */
520 buffer_put_cstring(&msg, "posix-rename@openssh.com"); 526 buffer_put_cstring(&msg, "posix-rename@openssh.com");
521 buffer_put_cstring(&msg, "1"); /* version */ 527 buffer_put_cstring(&msg, "1"); /* version */
528#ifdef USEE_STATVFS
522 /* statvfs extension */ 529 /* statvfs extension */
523 buffer_put_cstring(&msg, "statvfs@openssh.com"); 530 buffer_put_cstring(&msg, "statvfs@openssh.com");
524 buffer_put_cstring(&msg, "1"); /* version */ 531 buffer_put_cstring(&msg, "1"); /* version */
525 /* fstatvfs extension */ 532 /* fstatvfs extension */
526 buffer_put_cstring(&msg, "fstatvfs@openssh.com"); 533 buffer_put_cstring(&msg, "fstatvfs@openssh.com");
527 buffer_put_cstring(&msg, "1"); /* version */ 534 buffer_put_cstring(&msg, "1"); /* version */
535#endif
528 send_msg(&msg); 536 send_msg(&msg);
529 buffer_free(&msg); 537 buffer_free(&msg);
530} 538}
@@ -1134,6 +1142,7 @@ process_extended_posix_rename(u_int32_t id)
1134 xfree(newpath); 1142 xfree(newpath);
1135} 1143}
1136 1144
1145#ifdef USE_STATVFS
1137static void 1146static void
1138process_extended_statvfs(u_int32_t id) 1147process_extended_statvfs(u_int32_t id)
1139{ 1148{
@@ -1169,6 +1178,7 @@ process_extended_fstatvfs(u_int32_t id)
1169 else 1178 else
1170 send_statvfs(id, &st); 1179 send_statvfs(id, &st);
1171} 1180}
1181#endif
1172 1182
1173static void 1183static void
1174process_extended(void) 1184process_extended(void)
@@ -1180,10 +1190,12 @@ process_extended(void)
1180 request = get_string(NULL); 1190 request = get_string(NULL);
1181 if (strcmp(request, "posix-rename@openssh.com") == 0) 1191 if (strcmp(request, "posix-rename@openssh.com") == 0)
1182 process_extended_posix_rename(id); 1192 process_extended_posix_rename(id);
1193#ifdef USE_STATVFS
1183 else if (strcmp(request, "statvfs@openssh.com") == 0) 1194 else if (strcmp(request, "statvfs@openssh.com") == 0)
1184 process_extended_statvfs(id); 1195 process_extended_statvfs(id);
1185 else if (strcmp(request, "fstatvfs@openssh.com") == 0) 1196 else if (strcmp(request, "fstatvfs@openssh.com") == 0)
1186 process_extended_fstatvfs(id); 1197 process_extended_fstatvfs(id);
1198#endif
1187 else 1199 else
1188 send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ 1200 send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */
1189 xfree(request); 1201 xfree(request);
diff --git a/sftp.c b/sftp.c
index ffc35cb83..c5c3b1443 100644
--- a/sftp.c
+++ b/sftp.c
@@ -25,7 +25,9 @@
25#include <sys/param.h> 25#include <sys/param.h>
26#include <sys/socket.h> 26#include <sys/socket.h>
27#include <sys/wait.h> 27#include <sys/wait.h>
28#ifdef HAVE_SYS_STATVFS_H
28#include <sys/statvfs.h> 29#include <sys/statvfs.h>
30#endif
29 31
30#include <ctype.h> 32#include <ctype.h>
31#include <errno.h> 33#include <errno.h>
@@ -840,6 +842,7 @@ do_globbed_ls(struct sftp_conn *conn, char *path, char *strip_path,
840static int 842static int
841do_df(struct sftp_conn *conn, char *path, int hflag, int iflag) 843do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
842{ 844{
845#ifdef USE_STATVFS
843 struct statvfs st; 846 struct statvfs st;
844 char s_used[FMT_SCALED_STRSIZE]; 847 char s_used[FMT_SCALED_STRSIZE];
845 char s_avail[FMT_SCALED_STRSIZE]; 848 char s_avail[FMT_SCALED_STRSIZE];
@@ -885,6 +888,10 @@ do_df(struct sftp_conn *conn, char *path, int hflag, int iflag)
885 st.f_blocks)); 888 st.f_blocks));
886 } 889 }
887 return 0; 890 return 0;
891#else
892 error("client does not support statvfs extension");
893 return -1;
894#endif
888} 895}
889 896
890/* 897/*