diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sftp-server.c | 14 |
2 files changed, 16 insertions, 3 deletions
@@ -24,6 +24,9 @@ | |||
24 | [sftp-client.c] | 24 | [sftp-client.c] |
25 | Let overlapped upload path handle servers which reorder ACKs. This may be | 25 | Let overlapped upload path handle servers which reorder ACKs. This may be |
26 | permitted by the protocol spec; ok markus@ | 26 | permitted by the protocol spec; ok markus@ |
27 | - markus@cvs.openbsd.org 2002/02/13 00:28:13 | ||
28 | [sftp-server.c] | ||
29 | handle SSH2_FILEXFER_ATTR_SIZE in SSH2_FXP_(F)SETSTAT; ok djm@ | ||
27 | 30 | ||
28 | 20020210 | 31 | 20020210 |
29 | - (djm) OpenBSD CVS Sync | 32 | - (djm) OpenBSD CVS Sync |
@@ -7571,4 +7574,4 @@ | |||
7571 | - Wrote replacements for strlcpy and mkdtemp | 7574 | - Wrote replacements for strlcpy and mkdtemp |
7572 | - Released 1.0pre1 | 7575 | - Released 1.0pre1 |
7573 | 7576 | ||
7574 | $Id: ChangeLog,v 1.1845 2002/02/13 03:04:37 djm Exp $ | 7577 | $Id: ChangeLog,v 1.1846 2002/02/13 03:05:00 djm Exp $ |
diff --git a/sftp-server.c b/sftp-server.c index 6d6658614..117e6cc15 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 2 | * Copyright (c) 2000, 2001, 2002 Markus Friedl. All rights reserved. |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions | 5 | * modification, are permitted provided that the following conditions |
@@ -22,7 +22,7 @@ | |||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #include "includes.h" | 24 | #include "includes.h" |
25 | RCSID("$OpenBSD: sftp-server.c,v 1.32 2001/12/29 21:56:01 stevesk Exp $"); | 25 | RCSID("$OpenBSD: sftp-server.c,v 1.33 2002/02/13 00:28:13 markus Exp $"); |
26 | 26 | ||
27 | #include "buffer.h" | 27 | #include "buffer.h" |
28 | #include "bufaux.h" | 28 | #include "bufaux.h" |
@@ -589,6 +589,11 @@ process_setstat(void) | |||
589 | name = get_string(NULL); | 589 | name = get_string(NULL); |
590 | a = get_attrib(); | 590 | a = get_attrib(); |
591 | TRACE("setstat id %d name %s", id, name); | 591 | TRACE("setstat id %d name %s", id, name); |
592 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { | ||
593 | ret = truncate(name, a->size); | ||
594 | if (ret == -1) | ||
595 | status = errno_to_portable(errno); | ||
596 | } | ||
592 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { | 597 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { |
593 | ret = chmod(name, a->perm & 0777); | 598 | ret = chmod(name, a->perm & 0777); |
594 | if (ret == -1) | 599 | if (ret == -1) |
@@ -626,6 +631,11 @@ process_fsetstat(void) | |||
626 | if (fd < 0 || name == NULL) { | 631 | if (fd < 0 || name == NULL) { |
627 | status = SSH2_FX_FAILURE; | 632 | status = SSH2_FX_FAILURE; |
628 | } else { | 633 | } else { |
634 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { | ||
635 | ret = ftruncate(fd, a->size); | ||
636 | if (ret == -1) | ||
637 | status = errno_to_portable(errno); | ||
638 | } | ||
629 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { | 639 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { |
630 | #ifdef HAVE_FCHMOD | 640 | #ifdef HAVE_FCHMOD |
631 | ret = fchmod(fd, a->perm & 0777); | 641 | ret = fchmod(fd, a->perm & 0777); |