|
Lines 63-68
struct sftp_conn {
Link Here
|
| 63 |
#define SFTP_EXT_POSIX_RENAME 0x00000001 |
63 |
#define SFTP_EXT_POSIX_RENAME 0x00000001 |
| 64 |
#define SFTP_EXT_STATVFS 0x00000002 |
64 |
#define SFTP_EXT_STATVFS 0x00000002 |
| 65 |
#define SFTP_EXT_FSTATVFS 0x00000004 |
65 |
#define SFTP_EXT_FSTATVFS 0x00000004 |
|
|
66 |
#define SFTP_EXT_LINK 0x00000008 |
| 66 |
u_int exts; |
67 |
u_int exts; |
| 67 |
}; |
68 |
}; |
| 68 |
|
69 |
|
|
Lines 328-337
do_init(int fd_in, int fd_out, u_int tra
Link Here
|
| 328 |
strcmp(value, "2") == 0) { |
329 |
strcmp(value, "2") == 0) { |
| 329 |
exts |= SFTP_EXT_STATVFS; |
330 |
exts |= SFTP_EXT_STATVFS; |
| 330 |
known = 1; |
331 |
known = 1; |
| 331 |
} if (strcmp(name, "fstatvfs@openssh.com") == 0 && |
332 |
} else if (strcmp(name, "fstatvfs@openssh.com") == 0 && |
| 332 |
strcmp(value, "2") == 0) { |
333 |
strcmp(value, "2") == 0) { |
| 333 |
exts |= SFTP_EXT_FSTATVFS; |
334 |
exts |= SFTP_EXT_FSTATVFS; |
| 334 |
known = 1; |
335 |
known = 1; |
|
|
336 |
} else if (strcmp(name, "link@openssh.com") == 0 && |
| 337 |
strcmp(value, "1") == 0) { |
| 338 |
exts |= SFTP_EXT_LINK; |
| 339 |
known = 1; |
| 335 |
} |
340 |
} |
| 336 |
if (known) { |
341 |
if (known) { |
| 337 |
debug2("Server supports extension \"%s\" revision %s", |
342 |
debug2("Server supports extension \"%s\" revision %s", |
|
Lines 731-736
do_rename(struct sftp_conn *conn, char *
Link Here
|
| 731 |
newpath, fx2txt(status)); |
736 |
newpath, fx2txt(status)); |
| 732 |
|
737 |
|
| 733 |
return(status); |
738 |
return(status); |
|
|
739 |
} |
| 740 |
|
| 741 |
int |
| 742 |
do_link(struct sftp_conn *conn, char *oldpath, char *newpath) |
| 743 |
{ |
| 744 |
Buffer msg; |
| 745 |
u_int status, id; |
| 746 |
|
| 747 |
buffer_init(&msg); |
| 748 |
|
| 749 |
/* Send link request */ |
| 750 |
id = conn->msg_id++; |
| 751 |
if ((conn->exts & SFTP_EXT_LINK) == 0) { |
| 752 |
error("Server does not support link@openssh.com extension"); |
| 753 |
return -1; |
| 754 |
} |
| 755 |
|
| 756 |
buffer_put_char(&msg, SSH2_FXP_EXTENDED); |
| 757 |
buffer_put_int(&msg, id); |
| 758 |
buffer_put_cstring(&msg, "link@openssh.com"); |
| 759 |
buffer_put_cstring(&msg, oldpath); |
| 760 |
buffer_put_cstring(&msg, newpath); |
| 761 |
send_msg(conn->fd_out, &msg); |
| 762 |
debug3("Sent message link@openssh.com \"%s\" -> \"%s\"", |
| 763 |
oldpath, newpath); |
| 764 |
buffer_free(&msg); |
| 765 |
|
| 766 |
status = get_status(conn->fd_in, id); |
| 767 |
if (status != SSH2_FX_OK) |
| 768 |
error("Couldn't link file \"%s\" to \"%s\": %s", oldpath, |
| 769 |
newpath, fx2txt(status)); |
| 770 |
|
| 771 |
return(status); |
| 734 |
} |
772 |
} |
| 735 |
|
773 |
|
| 736 |
int |
774 |
int |