diff options
Diffstat (limited to 'sftp-client.c')
-rw-r--r-- | sftp-client.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sftp-client.c b/sftp-client.c index f4f1970b6..0eeb73c8b 100644 --- a/sftp-client.c +++ b/sftp-client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-client.c,v 1.101 2013/07/25 00:56:51 djm Exp $ */ | 1 | /* $OpenBSD: sftp-client.c,v 1.102 2013/08/08 05:04:03 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -768,16 +768,18 @@ do_realpath(struct sftp_conn *conn, char *path) | |||
768 | } | 768 | } |
769 | 769 | ||
770 | int | 770 | int |
771 | do_rename(struct sftp_conn *conn, char *oldpath, char *newpath) | 771 | do_rename(struct sftp_conn *conn, char *oldpath, char *newpath, |
772 | int force_legacy) | ||
772 | { | 773 | { |
773 | Buffer msg; | 774 | Buffer msg; |
774 | u_int status, id; | 775 | u_int status, id; |
776 | int use_ext = (conn->exts & SFTP_EXT_POSIX_RENAME) && !force_legacy; | ||
775 | 777 | ||
776 | buffer_init(&msg); | 778 | buffer_init(&msg); |
777 | 779 | ||
778 | /* Send rename request */ | 780 | /* Send rename request */ |
779 | id = conn->msg_id++; | 781 | id = conn->msg_id++; |
780 | if ((conn->exts & SFTP_EXT_POSIX_RENAME)) { | 782 | if (use_ext) { |
781 | buffer_put_char(&msg, SSH2_FXP_EXTENDED); | 783 | buffer_put_char(&msg, SSH2_FXP_EXTENDED); |
782 | buffer_put_int(&msg, id); | 784 | buffer_put_int(&msg, id); |
783 | buffer_put_cstring(&msg, "posix-rename@openssh.com"); | 785 | buffer_put_cstring(&msg, "posix-rename@openssh.com"); |
@@ -789,8 +791,8 @@ do_rename(struct sftp_conn *conn, char *oldpath, char *newpath) | |||
789 | buffer_put_cstring(&msg, newpath); | 791 | buffer_put_cstring(&msg, newpath); |
790 | send_msg(conn, &msg); | 792 | send_msg(conn, &msg); |
791 | debug3("Sent message %s \"%s\" -> \"%s\"", | 793 | debug3("Sent message %s \"%s\" -> \"%s\"", |
792 | (conn->exts & SFTP_EXT_POSIX_RENAME) ? "posix-rename@openssh.com" : | 794 | use_ext ? "posix-rename@openssh.com" : "SSH2_FXP_RENAME", |
793 | "SSH2_FXP_RENAME", oldpath, newpath); | 795 | oldpath, newpath); |
794 | buffer_free(&msg); | 796 | buffer_free(&msg); |
795 | 797 | ||
796 | status = get_status(conn, id); | 798 | status = get_status(conn, id); |