diff options
author | Damien Miller <djm@mindrot.org> | 2013-08-21 02:41:15 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-08-21 02:41:15 +1000 |
commit | c7dba12bf95eb1d69711881a153cc286c1987663 (patch) | |
tree | a91e31b8edac374ff5e1b9e671b8f411ae313ad0 /sftp-client.c | |
parent | 034f27a0c09e69fe3589045b41f03f6e345b63f5 (diff) |
- djm@cvs.openbsd.org 2013/08/08 05:04:03
[sftp-client.c sftp-client.h sftp.c]
add a "-l" flag for the rename command to force it to use the silly
standard SSH_FXP_RENAME command instead of the POSIX-rename- like
posix-rename@openssh.com extension.
intended for use in regress tests, so no documentation.
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); |