1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

Propagate file permissions in both directions in Unix pscp and psftp.

I think I have to consider this to be a separate but related change to
the wishlist item 'pscp-filemodes'; that was written before the Unix
port existed, and referred to the ability to configure the permissions
used for files copied from Windows to Unix - which is still not done.

[originally from svn r9260]
This commit is contained in:
Simon Tatham
2011-08-11 17:59:30 +00:00
parent f14953d9e9
commit 5c00b581c8
7 changed files with 81 additions and 31 deletions

19
sftp.h
View File

@ -82,6 +82,19 @@ struct fxp_attrs {
unsigned long mtime;
};
/*
* Copy between the possibly-unused permissions field in an fxp_attrs
* and a possibly-negative integer containing the same permissions.
*/
#define PUT_PERMISSIONS(attrs, perms) \
((perms) >= 0 ? \
((attrs).flags |= SSH_FILEXFER_ATTR_PERMISSIONS, \
(attrs).permissions = (perms)) : \
((attrs).flags &= ~SSH_FILEXFER_ATTR_PERMISSIONS))
#define GET_PERMISSIONS(attrs) \
((attrs).flags & SSH_FILEXFER_ATTR_PERMISSIONS ? \
(attrs).permissions : -1)
struct fxp_handle {
char *hstring;
int hlen;
@ -116,9 +129,11 @@ struct sftp_request *fxp_realpath_send(char *path);
char *fxp_realpath_recv(struct sftp_packet *pktin, struct sftp_request *req);
/*
* Open a file.
* Open a file. 'attrs' contains attributes to be applied to the file
* if it's being created.
*/
struct sftp_request *fxp_open_send(char *path, int type);
struct sftp_request *fxp_open_send(char *path, int type,
struct fxp_attrs *attrs);
struct fxp_handle *fxp_open_recv(struct sftp_packet *pktin,
struct sftp_request *req);