diff options
| author | 2013-08-08 05:04:03 +0000 | |
|---|---|---|
| committer | 2013-08-08 05:04:03 +0000 | |
| commit | 0d99a68c32b995a97201c587948a404aeedd3fd9 (patch) | |
| tree | 40002276671a20f9be9ee23e3aa86e0c861d0c35 /usr.bin/ssh/sftp-client.c | |
| parent | fix two year old regression: symlinking a file would incorrectly (diff) | |
| download | wireguard-openbsd-0d99a68c32b995a97201c587948a404aeedd3fd9.tar.xz wireguard-openbsd-0d99a68c32b995a97201c587948a404aeedd3fd9.zip | |
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 'usr.bin/ssh/sftp-client.c')
| -rw-r--r-- | usr.bin/ssh/sftp-client.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c index b335e261b49..c905d8f5e29 100644 --- a/usr.bin/ssh/sftp-client.c +++ b/usr.bin/ssh/sftp-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-client.c,v 1.101 2013/07/25 00:56:51 djm Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.102 2013/08/08 05:04:03 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * @@ -761,16 +761,18 @@ do_realpath(struct sftp_conn *conn, char *path) } int -do_rename(struct sftp_conn *conn, char *oldpath, char *newpath) +do_rename(struct sftp_conn *conn, char *oldpath, char *newpath, + int force_legacy) { Buffer msg; u_int status, id; + int use_ext = (conn->exts & SFTP_EXT_POSIX_RENAME) && !force_legacy; buffer_init(&msg); /* Send rename request */ id = conn->msg_id++; - if ((conn->exts & SFTP_EXT_POSIX_RENAME)) { + if (use_ext) { buffer_put_char(&msg, SSH2_FXP_EXTENDED); buffer_put_int(&msg, id); buffer_put_cstring(&msg, "posix-rename@openssh.com"); @@ -782,8 +784,8 @@ do_rename(struct sftp_conn *conn, char *oldpath, char *newpath) buffer_put_cstring(&msg, newpath); send_msg(conn, &msg); debug3("Sent message %s \"%s\" -> \"%s\"", - (conn->exts & SFTP_EXT_POSIX_RENAME) ? "posix-rename@openssh.com" : - "SSH2_FXP_RENAME", oldpath, newpath); + use_ext ? "posix-rename@openssh.com" : "SSH2_FXP_RENAME", + oldpath, newpath); buffer_free(&msg); status = get_status(conn, id); |
