summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-06-28 16:01:19 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-06-28 16:01:19 +1000
commite59b50879819db3bbb189ba7e069950a8991ea05 (patch)
tree0c771262fb0f74ef43283c26c71ec8fdb0c5ee3d
parentf9eb2b013510ef35372560e673d0bf80b1b4dd2c (diff)
- (dtucker) [acconfig.h configure.ac sftp-server.c] Bug #823: add sftp
rename handling for Linux which returns EPERM for link() on (at least some) filesystems that do not support hard links. sftp-server will fall back to stat+rename() in such cases.
-rw-r--r--ChangeLog6
-rw-r--r--acconfig.h8
-rw-r--r--configure.ac3
-rw-r--r--sftp-server.c6
4 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e17a57595..ac1145056 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
2 - (tim) update README files. 2 - (tim) update README files.
3 - (dtucker) [mdoc2man.awk] Bug #883: correctly recognise .Pa and .Ev macros. 3 - (dtucker) [mdoc2man.awk] Bug #883: correctly recognise .Pa and .Ev macros.
4 - (dtucker) [regress/README.regress] Document new variables. 4 - (dtucker) [regress/README.regress] Document new variables.
5 - (dtucker) [acconfig.h configure.ac sftp-server.c] Bug #823: add sftp
6 rename handling for Linux which returns EPERM for link() on (at least some)
7 filesystems that do not support hard links. sftp-server will fall back to
8 stat+rename() in such cases.
5 9
620040626 1020040626
7 - (djm) OpenBSD CVS Sync 11 - (djm) OpenBSD CVS Sync
@@ -1438,4 +1442,4 @@
1438 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1442 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1439 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1443 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1440 1444
1441$Id: ChangeLog,v 1.3455 2004/06/28 05:52:50 dtucker Exp $ 1445$Id: ChangeLog,v 1.3456 2004/06/28 06:01:19 dtucker Exp $
diff --git a/acconfig.h b/acconfig.h
index f14353519..4c655823f 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,4 +1,4 @@
1/* $Id: acconfig.h,v 1.177 2004/04/15 23:22:40 dtucker Exp $ */ 1/* $Id: acconfig.h,v 1.178 2004/06/28 06:01:20 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@@ -434,6 +434,12 @@
434/* Define if cmsg_type is not passed correctly */ 434/* Define if cmsg_type is not passed correctly */
435#undef BROKEN_CMSG_TYPE 435#undef BROKEN_CMSG_TYPE
436 436
437/*
438 * Define to whatever link() returns for "not supported" if it doesn't
439 * return EOPNOTSUPP.
440 */
441#undef LINK_OPNOTSUPP_ERRNO
442
437/* Strings used in /etc/passwd to denote locked account */ 443/* Strings used in /etc/passwd to denote locked account */
438#undef LOCKED_PASSWD_STRING 444#undef LOCKED_PASSWD_STRING
439#undef LOCKED_PASSWD_PREFIX 445#undef LOCKED_PASSWD_PREFIX
diff --git a/configure.ac b/configure.ac
index 1bf3ca66f..3f27bf9a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.222 2004/06/25 04:03:34 dtucker Exp $ 1# $Id: configure.ac,v 1.223 2004/06/28 06:01:20 dtucker Exp $
2# 2#
3# Copyright (c) 1999-2004 Damien Miller 3# Copyright (c) 1999-2004 Damien Miller
4# 4#
@@ -254,6 +254,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
254 AC_DEFINE(PAM_TTY_KLUDGE) 254 AC_DEFINE(PAM_TTY_KLUDGE)
255 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!") 255 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
256 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV) 256 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
257 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
257 inet6_default_4in6=yes 258 inet6_default_4in6=yes
258 case `uname -r` in 259 case `uname -r` in
259 1.*|2.0.*) 260 1.*|2.0.*)
diff --git a/sftp-server.c b/sftp-server.c
index 39a6bdab4..1ff4750ea 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -840,7 +840,11 @@ process_rename(void)
840 else if (S_ISREG(sb.st_mode)) { 840 else if (S_ISREG(sb.st_mode)) {
841 /* Race-free rename of regular files */ 841 /* Race-free rename of regular files */
842 if (link(oldpath, newpath) == -1) { 842 if (link(oldpath, newpath) == -1) {
843 if (errno == EOPNOTSUPP) { 843 if (errno == EOPNOTSUPP
844#ifdef LINK_OPNOTSUPP_ERRNO
845 || errno == LINK_OPNOTSUPP_ERRNO
846#endif
847 ) {
844 struct stat st; 848 struct stat st;
845 849
846 /* 850 /*