X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/d92624dccee63e8bee8653e8ae845ffad3490b67..68f9b3d9a6eccbfb006343ec7edc045e7d673973:/sftp.c diff --git a/sftp.c b/sftp.c index 9c14e745..832dd948 100644 --- a/sftp.c +++ b/sftp.c @@ -7,13 +7,10 @@ #include #include +#include "misc.h" #include "int64.h" #include "sftp.h" -#define smalloc malloc -#define srealloc realloc -#define sfree free - #define GET_32BIT(cp) \ (((unsigned long)(unsigned char)(cp)[0] << 24) | \ ((unsigned long)(unsigned char)(cp)[1] << 16) | \ @@ -676,6 +673,29 @@ int fxp_setstat(char *fname, struct fxp_attrs attrs) } return 1; } +int fxp_fsetstat(struct fxp_handle *handle, struct fxp_attrs attrs) +{ + struct sftp_packet *pktin, *pktout; + int id; + + pktout = sftp_pkt_init(SSH_FXP_FSETSTAT); + sftp_pkt_adduint32(pktout, 0x678); /* request id */ + sftp_pkt_addstring_start(pktout); + sftp_pkt_addstring_data(pktout, handle->hstring, handle->hlen); + sftp_pkt_addattrs(pktout, attrs); + sftp_send(pktout); + pktin = sftp_recv(); + id = sftp_pkt_getuint32(pktin); + if (id != 0x678) { + fxp_internal_error("request ID mismatch\n"); + return 0; + } + id = fxp_got_status(pktin); + if (id != 1) { + return 0; + } + return 1; +} /* * Read from a file. Returns the number of bytes read, or -1 on an