History of sftp.c of 373c05b772c32028

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

History of file sftp.c at check-in 373c05b772c32028

2013-07-14
05:45
Tighten up a lot of casts from unsigned to int which are read by one of the GET_32BIT macros and then used as length fields. Missing bounds checks against zero have been added, and also I've introduced a helper function toint() which casts from unsigned to int in such a way as to avoid C undefined behaviour, since I'm not sure I trust compilers any more to do the obviously sensible thing. file: [6eaba51d1f] check-in: [845f59bde8] user: simon branch: trunk, size: 34968
2013-07-11
12:24
xfer_{up,down}load_gotpkt free their input sftp_packet as a side effect of handling it, but they do not free it if it isn't a packet they recognise as part of their upload/download. Invent a return value that specifically signals this, and consistently free pktin at every call site if that return value comes back. Also, ensure that that return value also always comes with something meaningful in fxp_error. file: [01175426be] check-in: [1129bffc22] user: simon branch: trunk, size: 34961
2013-07-06
15:43
Clean up handling of the return value from sftp_find_request. In many places we simply enforce by assertion that it will match the request we sent out a moment ago: in fact it can also return NULL, so it makes more sense to report a proper error message if it doesn't return the expected value, and while we're at it, have that error message whatever message was helpfully left in fxp_error() by sftp_find_request when it failed. To do this, I've written a centralised function in psftp.c called sftp_wait_for_reply, which is handed a request that's just been sent out and deals with the mechanics of waiting for its reply, returning the reply when it arrives, and aborting with a sensible error if anything else arrives instead. The numerous sites in psftp.c which called sftp_find_request have all been rewritten to do this instead, and as a side effect they now look more sensible. The only other uses of sftp_find_request were in xfer_*load_gotpkt, which had to be tweaked in its own way. While I'm here, also fix memory management in sftp_find_request, which was freeing its input packet on some but not all error return paths. file: [a04afbb955] check-in: [14608d0542] user: simon branch: trunk, size: 34526
2012-08-12
15:17
Use a single sftp_senddata() to send each SFTP packet, rather than using one for the length field and one for the rest of the packet contents. Since sftp_senddata() has no queuing or deferral mechanism but instead constructs and sends an SSH2_MSG_CHANNEL_DATA message immediately, this change has the effect of ceasing to split every SFTP packet across two SSH messages. file: [41dc2d84c9] check-in: [46ddd55b12] user: simon branch: trunk, size: 34384
2011-08-11
12:59
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. file: [fea4ccc93d] check-in: [797da58367] user: simon branch: trunk, size: 34337
2007-01-09
12:24
Get rid of all the MSVC warnings. file: [20a24720cc] check-in: [1ef7a9aa1d] user: simon branch: trunk, size: 34218
2006-06-02
03:46
Lionel Fourquaux offers this very simple patch to speed up SFTP, simply by upping the packet sizes and maximum in-flight packet count. Got to be worth a try, I think! file: [b2cd900fa5] check-in: [2cb25a46b3] user: simon branch: trunk, size: 34191
2005-04-12
15:04
Unify GET_32BIT()/PUT_32BIT() et al from numerous source files into misc.h. I've done a bit of testing (not exhaustive), and I don't _think_ I've broken anything... file: [6d83149e76] check-in: [a434996c3e] user: jacob branch: trunk, size: 34188
2005-02-25
03:59
Per Gunnar Floe spotted a reversed test in sftp_cleanup_requests(). file: [e1fb09c36a] check-in: [a640094153] user: simon branch: trunk, size: 34637
2005-02-20
04:30
Additional robustness to SFTP packet parsing and memory allocation. file: [1bca5ba01a] check-in: [6e1691ecfd] user: simon branch: trunk, size: 34637
2004-12-17
07:39
The xfer mechanism wasn't gracefully terminating when an error was encountered part way through transfer. In particular, this caused psftp to hang (waiting for FXP_READ replies which had already arrived) if you try `get' (without -r) on a remote directory. file: [825569ae81] check-in: [9b4c7b154a] user: simon branch: trunk, size: 32725
2003-12-19
06:44
Joe Yates's memory leak patches. file: [bc574cb644] check-in: [e9b1098ae1] user: simon branch: trunk, size: 32664
2003-09-28
09:24
Uploads turn out to be much easier than downloads, so here's faster upload support in PSFTP as well. file: [db693f8f5f] check-in: [f977cd8508] user: simon branch: trunk, size: 32536
2003-09-27
12:52
First cut at speeding up SFTP. Generic download-management code in sftp.c, and psftp.c now uses that instead of going it alone. Should in principle be easily installed in PSCP as well, but I haven't done it yet; also it only handles downloads, not uploads, and finally it doesn't yet properly calculate the correct number of parallel requests to queue. Still, it's a start, and in my own tests it seemed to perform as expected (download speed suddenly became roughly what you'd expect from the available bandwidth, and decreased by roughly the expected number of round-trip times). file: [7bd025a5aa] check-in: [98245922c2] user: simon branch: trunk, size: 30330
2003-08-24
08:22
And just to prove that psftp.c really is now platform-independent ... here's a Unix port of PSFTP. Woo. (Oddly PSCP looks to be somewhat harder; there's more Windows code interleaved than there was in PSFTP.) file: [82b077fac9] check-in: [a9746849d8] user: simon branch: trunk, size: 24636
2003-06-29
09:47
Phase 1a of SFTP re-engineering: fix the glaring memory and request ID leak in the previous checkin. Oops :-) file: [1cd1fe7cc2] check-in: [0180a6b327] user: simon branch: trunk, size: 24683
09:26
First phase of SFTP re-engineering. Each base-level fxp_* function has been split into a send half and a receive half, so that callers can set several requests in motion at a time and deal with the responses in whatever order they arrive. file: [864234c23d] check-in: [b9024f3254] user: simon branch: trunk, size: 23942
2003-03-29
10:14
Introduced wrapper macros snew(), snewn() and sresize() for the malloc functions, which automatically cast to the same type they're allocating the size of. Should prevent any future errors involving mallocing the size of the wrong structure type, and will also make life easier if we ever need to turn the PuTTY core code from real C into C++-friendly C. I haven't touched the Mac frontend in this checkin because I couldn't compile or test it. file: [6d03a6a77f] check-in: [48c3c19745] user: simon branch: trunk, size: 23664
2002-10-26
07:58
Yet more global-removal. The static variables in logging.c are now absent, and also (I think) all the frontend request functions (such as request_resize) take a context pointer, so that multiple windows can be handled sensibly. I wouldn't swear to this, but I _think_ that only leaves the Unicode stuff as the last stubborn holdout. file: [a77ec9ed25] check-in: [8fba443d8c] user: simon branch: trunk, size: 23728
2002-03-31
10:26
Fix major memory leak in sftp_cmd_ls (thanks to Hans-Juergen Petrich for pointing it out). file: [aebe7b3dfb] check-in: [d8cae6eb26] user: simon branch: trunk, size: 23740
2002-03-01
07:16
Memory leak fix: repair endemic failure to call sftp_pkt_free(). file: [0dd768e3ea] check-in: [053caa622c] user: simon branch: trunk, size: 23236
2001-12-14
04:12
Remove ghastly hack involving fxp_error_message. file: [3f3db45959] check-in: [8a0237bb44] user: simon branch: trunk, size: 22033
2001-12-11
14:08
Fix error handling in sftp (the sftp_recv return value was being checked for NULL almost nowhere). file: [17d0315884] check-in: [94042e50d4] user: simon branch: trunk, size: 22063
2001-11-14
06:58
Yikes! sftp.c wasn't using the misc.h wrappered malloc functions, meaning that PSFTP couldn't meaningfully be debugged using Minefield. That's what I get for developing it under Unix and forgetting to port it properly :-/ file: [24e9c63e06] check-in: [21dd6de37e] user: simon branch: trunk, size: 20597
2001-08-26
13:32
PSCP now uses the modern SFTP protocol if it can, and falls back to scp1 if it can't. Currently not very tested - I checked it in as soon as it completed a successful recursive copy in both directions. Also, one known bug: you can't specify a remote wildcard, because by the nature of SFTP we'll need to implement the wildcard engine on the client side. I do intend to do this (and use the same wildcard engine in PSFTP as well) but I haven't got round to it yet. file: [53041b9dfe] check-in: [0d8a92d58d] user: simon branch: trunk, size: 20647
06:35
More upgrades to psftp: it now supports mv, chmod, reget and reput. file: [2240aa297a] check-in: [eb0b3ce73c] user: simon branch: trunk, size: 20020
2001-08-04
09:19
Patch to PSFTP: implement mkdir, rmdir, rm and scripting. Still to do: wildcards, chmod, mv, probably other things. file: [9bdc2e2dfe] check-in: [4277930ada] user: simon branch: trunk, size: 16951
2001-05-06
09:35
Run entire source base through GNU indent to tidy up the varying coding styles of the various contributors! Woohoo! file: [18c73d24a7] check-in: [18fcbbf5a2] user: simon branch: trunk, size: 15243
2001-03-05
11:31
Fix various trivial compiler warnings file: [03722c0889] check-in: [585485e79e] user: simon branch: trunk, size: 15292
2001-02-27
03:11
Patches to prevent a couple of silly crashes file: [e5a9a50a19] check-in: [373c05b772] user: simon branch: trunk, size: 15335
2001-02-24
10:08
psftp now works as part of the PuTTY suite file: [28ddf91e89] check-in: [4ce457b44f] user: simon branch: trunk, size: 15258
06:02
SFTP client now successfully handles cd, ls, get and put. file: [af30ac46b6] check-in: [952f067aa8] user: simon branch: trunk, size: 16292
2001-02-23
12:21
Added: First stab at an SFTP client. Currently a Unixland testing app, not integrated into PuTTY. file: [ce120196bb] check-in: [5c89fa98d9] user: simon branch: trunk, size: 16090