Commit Graph

611 Commits

Author SHA1 Message Date
Robey Pointer 1731d51b51 [project @ robey@master-shake.local-20060119072156-31241967db33d1d9]
john a meinel caught a typo in the previous sort() patch
2006-01-18 23:21:56 -08:00
Robey Pointer 6a145dea09 [project @ robey@master-shake.local-20060119065503-341b1f0c0d161e22]
add Transport.atfork to handle the case where a forked child needs to cleanly dispose of a Transport where the socket is shared with its parent
2006-01-18 22:55:03 -08:00
Robey Pointer be7d99886c [project @ robey@master-shake.local-20060115063338-50ebabff6276f500]
patch from jan hudec to fix a python 2.4-ism
2006-01-14 22:33:38 -08:00
Robey Pointer cb3008b402 [project @ robey@master-shake.local-20060115063008-4f68552398868788]
fix a bunch of pychecker warnings, some of which were actual (but unlikely) bugs
2006-01-14 22:30:08 -08:00
Robey Pointer 26397bff47 [project @ robey@lag.net-20051216180002-5661c935adb8262e]
ENOTDIR should be translated into NO_SUCH_FILE -- openssh does it, and there really isn't any better mapping for it
2005-12-16 10:00:02 -08:00
Robey Pointer 995343439a [project @ robey@lag.net-20051204092822-69155fa5abbc4637]
bump version to 1.5.2
2005-12-04 01:28:22 -08:00
Robey Pointer a8abbbecb8 [project @ robey@lag.net-20051204090414-7c8318ab735f6188]
experimental util functions for parsing/getting openssh host config, and unit tests (turned out to be pretty easy)
2005-12-04 01:04:14 -08:00
Robey Pointer 373e65dd97 [project @ robey@lag.net-20051204090235-431d6d71cee11f68]
don't call _send_user_message() while holding the channel lock.  the call may
block waiting for CTS (during rekey), and the feeder thread may be waiting on
the channel lock to clear out channel traffic before it gets to the kex-init.
instead, the 2 methods that wanted to send from inside the lock now just return
messages to send.  slightly hacky but functional. :)
2005-12-04 01:02:35 -08:00
Robey Pointer fdf927cffd [project @ robey@ralph.lag.net-20051204043251-efc5e0b9adee5403]
remember once a transport is authenticated, so that after rekeying when using openssh-style delayed zlib (zlib@openssh.com), we know it's okay to immediately start new compression
2005-12-03 20:32:51 -08:00
Robey Pointer 8aa2131e28 [project @ robey@ralph.lag.net-20051204042920-132f9184b775ffb1]
fix typo in doc
2005-12-03 20:29:20 -08:00
Robey Pointer 2de86653c7 [project @ robey@ralph.lag.net-20051204042853-ba804918019cbdba]
windows users who switch between cygwin and native mode may sometimes have an SSH_AUTH_SOCK environ var set from cygwin, even when in native mode there's no such thing as an AF_LOCAL socket -- check for native windows mode and avoid trying unix ssh agents in that case
2005-12-03 20:28:53 -08:00
Robey Pointer a8778ffe6f [project @ robey@ralph.lag.net-20051203043206-1a5ab28112642246]
when closing an sftp file because of __del__, don't wait for a response, just shoot off a request and leave (on linux, the GC is run from a devoted thread)
2005-12-02 20:32:06 -08:00
Robey Pointer 62a83e7d03 [project @ robey@ralph.lag.net-20051203043112-0091aa8e40980487]
serialize outgoing requests (duh) -- when prefetching multiple files, there may be several threads pumping out read requests
2005-12-02 20:31:12 -08:00
Robey Pointer 2d06308fd9 [project @ robey@ralph.lag.net-20051203042147-7e7a922aadc37bc2]
only create the log filter once, so it doesn't get applied more than once (tiny thing that bothered me during debugging)
2005-12-02 20:21:47 -08:00
Robey Pointer 35b5719dc2 [project @ robey@lag.net-20051203003250-030b7c160f13aca9]
oops, forgot to add this file -- guess friday really is hawaiian shirt day :)
2005-12-02 16:32:50 -08:00
Robey Pointer 568ddd963d [project @ robey@lag.net-20051202211544-900e02e2693d4a92]
add tentative compression support (off by default)
2005-12-02 13:15:44 -08:00
Robey Pointer e7a45fee60 [project @ robey@lag.net-20051202204242-1fb4a6438ba50969]
nail down select() on EOF: occasionally a channel would be closed remotely but select() wouldn't trigger.  when a channel gets EOF or is closed, set the pipe FOREVER.
2005-12-02 12:42:42 -08:00
Robey Pointer 76eafefcea [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-82]
convert_status is already called.  calling it again was breaking van dyke sftp servers, which add garbage to the end of their sftp packets
2005-11-25 19:09:59 +00:00
Robey Pointer ba6165a4aa [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-81]
copy from jaramiko: only check for rekey at the beginning of a packet
2005-11-12 01:38:27 +00:00
Robey Pointer 6de6dc72c6 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-80]
add 'x' flag to open to allow O_EXCL behavior
2005-11-12 01:10:41 +00:00
Robey Pointer 7e95e2afc8 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-79]
in Transport.__del__, don't try to clean up attributes that were never created
2005-11-11 17:43:01 +00:00
Robey Pointer 42867ded42 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-78]
oops, this file wasn't saved yet when i did the randpool.stir() commit
2005-10-31 19:09:46 +00:00
Robey Pointer b9106e4f21 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-77]
bump up version to 1.5.1
2005-10-31 03:28:54 +00:00
Robey Pointer b1d58c5ceb [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-76]
add a few more randpool.stir() calls
2005-10-31 03:27:13 +00:00
Robey Pointer 25d55e6089 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-75]
fix a few windows bugs (and broken str() on SFTPAttributes) reported by grzegorz makarewicz
2005-10-31 03:26:10 +00:00
Robey Pointer e57c4baab5 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-74]
raise the max packet size so that the max sftp packet will fit
2005-10-30 21:13:36 +00:00
Robey Pointer a355cf43d9 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-73]
packet read sizes were overestimated by 1 byte
2005-10-29 20:57:43 +00:00
Robey Pointer 66919286b6 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-72]
don't attempt to start a rekey negotiation from within send_message -- always do it from the feeder thread.  this prevents a situation where more than one thread may decide spontaneously to rekey, sending multiple kexinit messages, which confuses the hell out of the remote host :)  also, do some locking around the clear-to-send event, to avoid a race when we first go into rekeying.  add some tests for these things too
2005-10-29 20:47:04 +00:00
Robey Pointer 3c67e35b5f [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-71]
the window-adjust can be sent outside of the lock, as long as the window size tracking is done within the lock (ie: allocate window space within the lock, then send the ack later) -- helps avoid deadlocks
2005-10-29 20:41:14 +00:00
Robey Pointer f65edffbfb [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-70]
add SFTPFile.prefetch() to allow pre-fetching a file that will be downloaded in full -- quick testing showed this could speed up downloads 3x or more
2005-10-24 06:19:56 +00:00
Robey Pointer c986f92dc5 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-69]
i think seek_cur had a bug here
2005-10-22 06:38:43 +00:00
Robey Pointer d42d6af12b [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-68]
set errno for some errors
2005-10-22 06:35:57 +00:00
Robey Pointer 95bf2b0957 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-67]
oops, dont forget to export SFTPFile for docs :)
2005-10-20 04:42:10 +00:00
Robey Pointer 64d89583c7 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-66]
fix a test that failed once: the encoding of R or S in dss signatures might not always be exactly 20 bytes
2005-10-17 16:36:55 +00:00
Robey Pointer 6eab0b3b4d [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-65]
remove unnecessary shebangs, fix import lines to be explicit about imports from within paramiko, and a bit of whitespace cleanup
2005-10-13 18:52:59 +00:00
Robey Pointer 8bb5e65499 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-64]
track channels seen and throw away (without error) messages bound for nonexistent channels that *used* to exist -- fixes a bug found by gordon good
2005-10-13 18:51:18 +00:00
Robey Pointer 7f9677d5ab [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-63]
fix doc typo
2005-10-02 20:12:48 +00:00
Robey Pointer 65883e673b [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-62]
readme comments, bump version to 1.5 paras
2005-10-02 20:08:39 +00:00
Robey Pointer f2ec841a15 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-61]
add server-side support for keyboard-interactive auth, and a couple of unit tests
2005-09-27 04:03:27 +00:00
Robey Pointer fb73c0ef7f [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-60]
add file pipelining for writes
2005-09-25 09:11:23 +00:00
Robey Pointer 364479610e [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-59]
add auth_none and auth_interactive to support 'no auth' and 'keyboard-interactive auth'; for password auth, add a mode where it will try to fallback to keyboard-interactive in a pinch
2005-09-21 22:42:11 +00:00
Robey Pointer 24045332c5 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-58]
make the str form of BadAuthenticationType describe the allowed auth types
2005-09-21 22:37:23 +00:00
Robey Pointer 112b72511e [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-56]
patch from nathaniel smith: fix SFTPClient.open() 'a' flag, and guard against multiple close() of the same file
2005-09-18 07:25:54 +00:00
Robey Pointer 0f3bf86617 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-54]
smooth BaseTransport and Transport together, and move the auth stuff into AuthHandler -- an improvement i made in jaramiko and decided deserved to be backported
2005-08-09 07:40:07 +00:00
Robey Pointer 646db7c787 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-52]
rework init so classes all appear in the right package in docs (yaaaay)
2005-08-09 06:30:59 +00:00
Robey Pointer 7cd7841556 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-51]
rename 3 globals so they're not exposed in docs
2005-08-09 06:30:22 +00:00
Robey Pointer a4fc5bb8a7 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-50]
add docs to Message
2005-08-09 06:29:59 +00:00
Robey Pointer 7b4cd51b76 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-49]
dumb tiny tweaks
2005-08-03 06:57:51 +00:00
Robey Pointer eb60811594 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-48]
can use up to 32k buffers here
2005-08-03 06:57:30 +00:00
Robey Pointer 5a5cd201b7 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-47]
bump version number to 1.4 oddish
2005-07-18 06:40:30 +00:00
Robey Pointer d8ee5e2a4a [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-46]
add SFTPFile.check and server support (and test) -- it's an sftp extension that allows a client to retrieve the hash of part or all of a file without downloading it.  we're probably the only ones who implement it yet
2005-07-18 05:43:44 +00:00
Robey Pointer e9ccd7ea20 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-45]
yeah! figured out the last things that were causing GC cycles and got rid of them: Channels, Transports, SFTPClients, and SFTPFiles can all have __del__ methods now, which auto-close themselves :)
2005-07-17 20:06:29 +00:00
Robey Pointer f27e625926 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-44]
try to handle utf8 paths in a sane way in SFTPClient: assume incoming strings are already utf8, and encode incoming unicodes -- for return values, use str if an ascii encoding will work, otherwise return a unicode
2005-07-17 07:01:51 +00:00
Robey Pointer a22719c338 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-43]
allow start_client and start_server to be passed no event object for synchronous behavior
2005-07-16 16:41:39 +00:00
Robey Pointer 458a0de23f [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-42]
don't forget to export Agent
2005-07-16 16:35:25 +00:00
Robey Pointer 37f3775389 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-41]
pull in tiny changes from ralph
Patches applied:

 * robey@lag.net--2005/paramiko--dev--1--patch-2
   merge laptop work

 * robey@lag.net--2005/paramiko--dev--1--patch-3
   update from laptop

 * robey@lag.net--2005/paramiko--dev--1--patch-4
   integrate tons more laptop work

 * robey@lag.net--2005/paramiko--dev--1--patch-5
   thew has a good point: this is stable software now, not alpha

 * robey@lag.net--2005/paramiko--dev--1--patch-6
   roll up laptop changes
2005-07-14 02:51:31 +00:00
Robey Pointer a321fa026d [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-40]
anal tweak of docs
2005-07-14 02:46:35 +00:00
Robey Pointer 4c22409524 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-38]
fix util docs a bit
2005-07-14 02:36:30 +00:00
Robey Pointer b5f0b3c786 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-37]
remove debug print
2005-07-14 02:36:15 +00:00
Robey Pointer 1a6ba349da [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-36]
move load_host_keys into util where others can use it
2005-07-14 02:19:13 +00:00
Robey Pointer e12e16858e [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-35]
oooooops, didn't mean to leave posix commented out
2005-07-14 02:18:45 +00:00
Robey Pointer f565576321 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-34]
fix a comment claiming that channels are closed automatically when GC'd (they aren't and can't be); don't close the pipe until the app explicitly calls close(); signal EOF via the pipe
2005-07-14 02:17:38 +00:00
Robey Pointer 93f3cae64f [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-33]
add SFTPClient.put and SFTPClient.get, and make sftp file objects auto-close on del
2005-07-13 08:35:15 +00:00
Robey Pointer 1f88224239 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-32]
add the concept of a cwd to SFTPClient, and add a unit test for it
2005-07-13 07:59:35 +00:00
Robey Pointer e6e4c4bff7 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-31]
fix whitespace on a line that bugged me
2005-07-13 07:57:12 +00:00
Robey Pointer b3ec01f57e [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-30]
fix stupid line that broke dss's unit test... that'll teach me to fuss over pychecker warnings
2005-07-13 07:56:44 +00:00
Robey Pointer 0ac7b0dcbd [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-29]
a bunch of silly changes where i was trying to fix pychecker warnings before i decided it wasnt worth the effort
2005-07-10 09:56:00 +00:00
Robey Pointer 5ba8b47a45 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-28]
forgot to import server
2005-07-09 17:31:09 +00:00
Robey Pointer ae18228d07 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-26]
new ssh agent support!  from john rochester.  added a bunch of docs to it, and changed demo.py to use an Agent if it finds a working key there.
2005-07-07 01:35:31 +00:00
Robey Pointer e3ed1616d1 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-25]
cool optimization from john rochester: use cStringIO in Message (and also fix some unit test bugs revealed by the change)
2005-07-07 01:10:57 +00:00
Robey Pointer 0b093e49b4 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-24]
the previous windows pipe fix still didn't work.  replace it with a new pipe.py abstraction of pipes (one for posix, one for windows) which appears to finally work on windows.  for real this time.  also add some more documentation to Channel to explain that after exec_command, invoke_shell, or invoke_subsystem, a Channel can't be reused.
2005-07-07 01:03:49 +00:00
Robey Pointer de81b40e7d [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-23]
stupid little doc tweaks
2005-07-03 01:31:31 +00:00
Robey Pointer 9d27762720 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-22]
some doc changes; catch socket.error in the transport thread and log it as such instead of as an 'unknown exception'
2005-07-03 01:26:35 +00:00
Robey Pointer 401e37fa23 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-21]
oops, missed changing the version name to nidoran
2005-06-28 08:15:24 +00:00
Robey Pointer dff128c814 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-20]
fix docs and update version to 1.3.1
2005-06-28 08:00:12 +00:00
Robey Pointer 6ee7921d06 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-18]
tweak random stuff in transport that i forgot what it does
2005-06-28 07:23:41 +00:00
Robey Pointer 1fb38470aa [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-16]
forgot this one
2005-06-28 03:47:12 +00:00
Robey Pointer 81ba7dccef [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-15]
random doc/comment tweaks
2005-06-28 03:44:25 +00:00
Robey Pointer c0b22a3aec [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-14]
cute trick i saw openssh do in a network trace: if we're not encrypting, don't waste random bytes for the padding in packetizing
2005-06-28 03:42:57 +00:00
Robey Pointer c5d2e9904a [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-13]
change pipe method to something that probably works on windows (the old system did not); also fix a race in _unlink
2005-06-28 03:42:14 +00:00
Robey Pointer 44239ae077 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-10]
fix stupid bug in kex_group1 which luckily only affected unit tests
2005-05-21 20:35:29 +00:00
Robey Pointer cb5aa0671b [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-9]
oooh maybe i'll test things before checking them in next time: rekeying was a little bit overzealous.  now it's careful to only rekey once and reset the counters in sync
2005-05-14 06:21:36 +00:00
Robey Pointer 366f216e3f [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-8]
add unit tests for the packetizer, and fix a little locking bug where i think more of the packetizer write function should be inside a lock
2005-05-10 17:36:38 +00:00
Robey Pointer e8efe095a6 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-7]
don't close the socket until the destructor -- we may drop a session before the socket is actually finished
2005-05-04 02:44:00 +00:00
Robey Pointer 2c264c7df5 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-6]
when an auth method is rejected, log the list of acceptable auth methods
2005-05-04 02:43:14 +00:00
Robey Pointer 36055c5ac2 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-5]
split out Packetizer, fix banner detection bug, new unit test
split out a chunk of BaseTransport into a Packetizer class, which handles
the in/out packet data, ciphers, etc.  it didn't make the code any smaller
(transport.py is still close to 1500 lines, which is awful) but it did split
out a coherent chunk of functionality into a discrete unit.

in the process, fixed a bug that alain spineux pointed out: the banner
check was too forgiving and would block forever waiting for an SSH banner.
now it waits 5 seconds for the first line, and 2 seconds for each subsequent
line, before giving up.

added a unit test to test keepalive, since i wasn't sure that was still
working after pulling out Packetizer.
2005-05-01 08:04:59 +00:00
Robey Pointer 2f2d7bdee8 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-4]
add Transport.open_sftp_client
2005-04-30 19:21:43 +00:00
Robey Pointer bcf197d027 [project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-3]
make SFTPClient.file an alias for SFTPClient.open.
clean up docs a little, and make 'file' an alias for 'open'.
this is how python is heading in general.
2005-04-21 16:59:03 +00:00
Robey Pointer bd7911895b [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-164]
fix some docs
remove some epydoc comments about fileno() being non-portable.
2005-04-18 00:53:57 +00:00
Robey Pointer 89ccac6bfa [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-163]
add SFTPClient.close()
add SFTPClient.close() and add a simple little unit test for it.
2005-04-18 00:30:52 +00:00
Robey Pointer 18aaff8521 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-161]
integrated laptop work (test commit)
Patches applied:

 * robey@lag.net--2003-public-master-shake/secsh--dev--1.0--base-0
   tag of robey@lag.net--2003-public/secsh--dev--1.0--patch-160

 * robey@lag.net--2003-public-master-shake/secsh--dev--1.0--patch-1
   test commit

 * robey@lag.net--2003-public/secsh--dev--1.0--base-0
   initial import

 * robey@lag.net--2003-public/secsh--dev--1.0--patch-1
   no changes
2005-04-16 23:38:22 +00:00
Robey Pointer 2bdbe28234 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-160]
1.3 marowak
bump version to 1.3 / marowak
2005-04-10 00:46:41 +00:00
Robey Pointer 7e40c6f2be [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-159]
clean up SFTPAttributes.__repr__
clean up SFTPAttributes repr() a bit.
2005-04-10 00:39:18 +00:00
Robey Pointer 71a337ee08 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-157]
change SubsystemHandler/SFTPServerInterface API
change the API of SubsystemHandler to accept a reference to the
ServerInstance object during construction.  this will break all code
that currently creates subsystem handlers (like sftp servers) -- sorry!

lots of little doc fixups (mostly indenting).
2005-04-06 07:24:28 +00:00
Robey Pointer 5d8d1938fa [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-156]
rewrite channel pipes to work on windows
the pipe system i was using for simulating an os-level FD (for select) was
retarded.  i realized this week that i could just use a single byte in the
pipe to signal "data is ready" and not try to feed all incoming data thru
the pipe -- and then i don't have to try to make the pipe non-blocking (which
should make it work on windows).  a lot of duplicate code got removed and now
it's all going thru the same code-path on read.

there's still a slight penalty on incoming feeds and calling 'recv' when a
pipe has been opened (by calling 'fileno'), but it's tiny.

removed a bunch of documentation and comments about things not working on
windows, since i think they probably do now.
2005-03-26 05:53:00 +00:00
Robey Pointer 3e5bd84cc5 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-155]
fix sending of large sftp packet sizes
fix a bug where packets larger than about 12KB would cause the session to
die on platforms other than osx.  turns out that on most platforms, setting a
socket timeout also causes timeouts to occur on writes (but not on osx).  so
on a huge write, once the os buffers were full, paramiko would get a
socket.timeout exception when writing, and bail.

since the timeout is primarily so we can periodically poll to see if the
session has been killed from elsewhere, do that on a timeout but otherwise
continue trying to write.  large packet sizes (in sftp) should now work.
2005-03-25 20:06:56 +00:00
Robey Pointer fead211c5c [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-154]
even better 1.2 lapras
re-bump the version # to 1.2 (with a new date since i added more stuff).
add 2005 to the copyright date in a bunch of files.
2005-02-28 08:06:08 +00:00
Robey Pointer 7490172401 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-153]
tweak sftp_file write behavior on large blocks of data
BufferedFile.write() wasn't correctly dealing with the possibility that the
underlying write might not write the entire data block at once (even though
the docs said it would).  now that it's working, make sftp_file take
advantage of it in order to chop up blocks larger than 32kB (the max allowed
on sftp) and add a unit test for it.
2005-02-28 07:49:56 +00:00
Robey Pointer 2746d44906 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-152]
little doc fixes
stupid little doc fixups that didn't fit with the other patches.
2005-02-28 07:17:21 +00:00
Robey Pointer 246f3d46a2 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-151]
fix race in transport thread startup
set active=True from the methods that start the main transport thread, right
before actually starting the thread.  this avoids a race where the main
thread could be started, but the original thread could wake up from the
event.wait(0.1) before the new thread actually set the transport active.
impossible, you say?  no machines so slow exist?  au contraire, my sad
little linux box faced this problem earlier today.
2005-02-28 07:16:22 +00:00
Robey Pointer 4b8a9d3b7a [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-150]
when combining stderr with stdout on a channel, merge the buffers too
when turning on combine-stderr mode on a channel, grab the channel lock and
feed any existing stderr buffer into the normal buffer.  this should help
applications (and my unit tests) avoid races between data coming in over
stderr and setting combine-stderr.

_send_eof is now slightly safer too, although i don't think that really fixed
anything.  it just makes me feel better.
2005-02-28 07:14:11 +00:00
Robey Pointer 8ee26cd412 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-149]
add thread ids to logs
add a logging filter that reports the thread-id of the logger, and use
that for all paramiko logging.  since thread-local stuff didn't appear
until python 2.4, i hacked up my own little version to assign incrementing
numbers to threads as they log.
2005-02-28 07:09:02 +00:00
Robey Pointer b45a3a98a8 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-147]
1.2 (lapras)
bump version stuff to 1.2 / lapras.
2005-02-26 21:11:04 +00:00
Robey Pointer fb2d7bbddd [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-146]
raise better exception on empty key
raise a clearer exception when trying to create an empty key.
2005-02-15 15:48:47 +00:00
Robey Pointer c7d56a309d [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-145]
add methods for sending/receiving a channel's exit status
track a channel's exit status and provide a method (recv_exit_status) to
block waiting for it to arrive.  also provide a convenience method for
servers to send it (send_exit_status).  add shutdown_read and shutdown_write.
fix a bug in sending window change requests.
2005-02-15 15:47:02 +00:00
Robey Pointer f7b0a62e4b [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-144]
fix docs
clean up some of the docs.
2005-02-06 23:32:22 +00:00
Robey Pointer c1ed20c4af [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-141]
misc logging fixes
change the level of some log messages so interesting stuff gets logged at
info instead of debug.  fix an oops where channels defaulted to being in
ultra debug mode, and make this mode depend on a new Transport method:
"set_hexdump".
2005-01-25 05:17:55 +00:00
Robey Pointer 8878a5f3c2 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-140]
more flexible logging
some tweaks to make channels etc follow the logger setting of their parent
transport, so that setting the log channel for a paramiko transport will
cause all sub-logging to branch out from that channel.

also, close all open file handles when the sftp server ends.
2005-01-17 10:09:09 +00:00
Robey Pointer b89025d409 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-138]
doc fixups
little doc fixups that i did obsessively on the train one morning.
2005-01-16 20:14:07 +00:00
Robey Pointer 1eda9b051b [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-137]
added listdir_attr()
add SFTPClient.listdir_attr() to fetch a list of files & their attributes,
instead of just their filenames.  artur piwko would find this useful.
2005-01-09 05:27:07 +00:00
Robey Pointer 34f9df1536 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-135]
more sftp cleanup
oops, this should've been part of the last patch.
2004-12-19 19:50:00 +00:00
Robey Pointer 8d127ae8e1 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-134]
cleanup & docs in sftp
add some more docs to SFTPHandle, and give a default implementation for
close() that's usually right.  add a flush() to the default implementation
of write().  document that symlink's args in the sftp protocol are out of
order (the spec is wrong).
2004-12-19 19:43:27 +00:00
Robey Pointer 1cf0d33f1d [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-132]
oops (continued)
er, part 2 of that.
2004-12-13 07:31:01 +00:00
Robey Pointer caa8d4cf41 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-131]
move check_global_request
move check_global_request into the server interface -- i missed it during
the initial move (oops).
2004-12-13 07:29:38 +00:00
Robey Pointer 2d9ad663ba [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-130]
small fixups
move _wait_for_send_window into the right place in Channel.  remove outdated
note from auth_transport.  fix download url in setup.py.
2004-12-13 07:27:39 +00:00
Robey Pointer ee0d4ae68e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-129]
1.1 (kabuto)
edit various files to bump the version to 1.1.
also fix to point to the new url.
2004-12-12 09:58:40 +00:00
Robey Pointer 1a32d2b4ef [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-127]
doc fixups
fix some typos in sftp_client docs
2004-12-12 09:32:17 +00:00
Robey Pointer a3971274e8 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-126]
server support for stderr & exec_command
for the server side of my stderr blunder, add send_stderr & sendall_stderr,
and make the sending side of makefile_stderr work correctly.

also, call check_channel_exec_request on a server object for exec requests
on a channel.
2004-12-12 09:25:15 +00:00
Robey Pointer 83a932a1b3 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-125]
add client-side multi-part auth support
added support for multi-part authentication (even though nobody supports it
that i've seen).  on a successful "partial" auth, the auth_* method will
return a list of acceptable means to continue authenticating.
2004-12-12 09:16:03 +00:00
Robey Pointer 438673c11f [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-124]
docs fixup
fix a comment typo, and add @since designators to a couple of new methods.
2004-12-11 03:44:33 +00:00
Robey Pointer 767d739299 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-123]
clean up authentication
add new exception "BadAuthenticationType", which is raised when auth fails
because your auth type (password or public-key) isn't valid on the server.

used this as an excuse to clean up auth_password and auth_publickey so their
'event' arg is optional, and if missing, they block until auth is finished,
raising an exception on error.

also, don't close the session on failed auth -- the server may let you try
again.

added some test cases for failed auth.
2004-12-11 03:43:18 +00:00
Robey Pointer 73a0df1df3 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-122]
symlink, readlink
add support for symlink command, and finish support for readlink.  (i guess
i started readlink a while ago but forgot to add the right method to the
SFTPServerInterface class.)
2004-12-10 08:30:44 +00:00
Robey Pointer fa8c4e20bd [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-121]
other part of that last patch
oops, forgot this part.
2004-12-10 08:27:43 +00:00
Robey Pointer 37892fc0c7 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-120]
add stderr support methods
big embarrassment: i didn't read the ssh2 docs close enough, and all this
time paramiko wasn't handling "extended_data" packets, which contain stderr
output.

so now, several new functions: recv_stderr_ready() and recv_stderr() to
mirror recv_ready() and recv(), and set_combined_stderr() to force stderr
to be combined into stdout.  also, makefile_stderr() to create a fake file
object to represent stderr.
2004-12-10 08:25:28 +00:00
Robey Pointer ad87909720 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-118]
fix SFTPFile gettimeout/settimeout
i don't think the gettimeout/settimeout calls on SFTPFile ever worked.
also, simplify the implementation of _get_size() since it's nearly
identical to stat().
2004-12-09 04:15:12 +00:00
Robey Pointer ed8b376205 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-116]
doc fixups
explain "recv_ready" better, and add debug descriptions for the kex codes.
2004-11-26 22:07:31 +00:00
Robey Pointer df63dc4154 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-115]
fix CONNECTION_FAILED_CODE
oops, fix typo in channel request failed.
2004-11-25 19:39:34 +00:00
Robey Pointer 13f818f04f [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-114]
fix typo in channel
fix typo that alain found: pipd_wfd -> pipe_wfd.
2004-11-22 07:40:39 +00:00
Robey Pointer a8a023a243 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-113]
sftp server support!
finally check in sftp_handle (file handle abstraction), sftp_si (server
interface), and sftp_server (server implementation) -- all of which make
a roughly 90% implementation of server-side sftp.
2004-11-22 07:27:21 +00:00
Robey Pointer 611d66428e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-112]
add finish_subsystem()
when a SubsystemHandler is being decomissioned (the client has closed the
channel or transport, or the socket went away), make a callback to let the
handler do any shutdown it needs to.
2004-11-22 07:07:08 +00:00
Robey Pointer 961525f3d8 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-111]
fix extremely unlikely channel counter wrapping
Transport's channel counter can overflow after 4 billion some channels are
created.  make it wrap back around after 16 million instead.  also allow the
logging channel to be set manually.  fix some comments elsewhere.
2004-11-22 07:04:31 +00:00
Robey Pointer fda92c6f44 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-110]
fix Transport.get_username() to work in server mode too
whenever i split the 'username' field into username and auth_username,
i guess that made get_username() stop working for server mode (because the
username was stored in a different field).  this should fix it.
2004-11-22 07:01:43 +00:00
Robey Pointer 73e8a134ce [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-109]
v1.0 (jigglypuff)
bump all the version numbers up to 1.0 (jigglypuff).
2004-11-07 03:10:53 +00:00
Robey Pointer 920df7d0ae [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-108]
add filename to SFTPAttributes
add filename to the attributes stored in an SFTPAttributes object.
2004-11-07 02:51:42 +00:00
Robey Pointer 2f3228dd88 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-107]
fix kex_gex
fix kex_gex (group-exchange key exchange) to, *cough*, work again, and also
layout kex_group1 a little more sanely.
2004-11-07 02:31:48 +00:00
Robey Pointer 224f6e4747 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-104]
fix location of SFTPError
fix location of SFTPError.
2004-11-07 02:28:33 +00:00
Robey Pointer 1c32fcd99a [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-103]
rename sftp constants
replace oddly named sftp constants (FX_OK for example) with names that make
a bit more sense when sober (SFTP_OK).
2004-11-07 02:17:18 +00:00
Robey Pointer 6eb59a2b53 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-98]
don't unlink a Channel until the server closes it too
when close()'ing a Channel, don't immediately unlink it from the Transport.
instead, wait for the server to send a close message.

this should fix a bug where doing close() on an EOF'd channel would cause
the entire transport to be killed, because the server would send an
'exit-status' and 'close' message for a channel that we no longer had a
record of.
2004-11-01 03:54:01 +00:00
Robey Pointer d7caa20213 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-97]
better debugging, improve subsytem handler
add a list of ssh packet names for debugging.  improve the server-mode
subsystem handler so it can take extra parameters (list or keyword) and
pass them to the subsystem constructor.  remove a misleading comment
about rekeying (which was already implemented).
2004-11-01 03:43:28 +00:00
Robey Pointer 44d07583bb [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-96]
remove key.valid check
oops!  'key.valid' no longer works -- catch the SSHException instead, and log
it.
2004-11-01 03:37:42 +00:00
Robey Pointer a73413c588 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-95]
ivysaur 0.9
update ivysaur release date, and add the list of changes to the README
file.
2004-10-23 07:36:23 +00:00
Robey Pointer 6caf15b425 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-94]
start testing Transport
the beginnings of tests for Transport.  only the bare minimum is there right
now.

also started doc'ing things up to ivysaur.
2004-10-20 16:52:51 +00:00
Robey Pointer 2939b6936b [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-93]
switch Transport.connect() to using a Pkey object for the host key
i suddenly realized that passing "hostkeytype" and "hostkey" as strings to
Transport.connect() was pretty silly since i went to all the effort of making
a class specifically for holding keys.  so Transport.connect() now just takes
host-key argument: "hostkey" as a PKey object.

updated the demos to use PKey objects when reading the host key file, and to
use the new "hostkey" argument.
2004-10-18 04:54:27 +00:00
Robey Pointer a5f6a984ee [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-90]
fix __init__
fix __init__ to export BufferedFile and randpool, and to catch up with the
changes from a week or 2 ago where sftp_attr & friends were split off.
2004-09-25 21:58:11 +00:00
Robey Pointer 12269c0c9b [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-89]
fix some Transport docs
document that Transport also would like close() and settimeout() to exist
on the socket-like object passed to the constructor.
2004-09-25 21:47:19 +00:00
Robey Pointer 3e644a94f1 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-88]
add Message.rewind()
add rewind() method to Message, which just resets the pointer so you can
start reading from the beginning again.  this is useful for some tests.
2004-09-25 21:32:53 +00:00
Robey Pointer 12287b3e0e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-87]
clean up pkey interface
change the pkey interface so that it's no longer possible to have a pkey
that doesn't represent a valid key.  (ie: no more "blank" key objects.)
also add "get_bits" and "can_sign" methods to determine the key bit length
and whether it can sign things (contains the "private parts") respectively.
2004-09-25 21:28:23 +00:00
Robey Pointer 4cac30252a [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-85]
move SFTPFile and SFTPAttributes into their own files
move SFTPFile and SFTPAttributes into their own files.
2004-09-11 20:56:01 +00:00
Robey Pointer 3a4ca74e0a [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-84]
add sftp.normalize
kevin c. dorff pointed out that it would be nice to expose a way to
determine the server's "current working directory", so this new method
(normalize) directly maps to REALPATH.
2004-09-11 20:50:39 +00:00
Robey Pointer 5176b1ab85 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-83]
tweak Message.add() in the key exchanges
use the new Message.add() behavior to make a little code here much easier
to read.
2004-09-11 20:43:09 +00:00
Robey Pointer 0e66dd47ac [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-82]
doc fixes
fix "string" -> "str" in types when documenting BufferedFile.
2004-09-11 20:40:08 +00:00
Robey Pointer 8c9add1a6b [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-80]
move SubsystemHandler to server.py
move SubsystemHandler into server.py where it makes more sense (it's part of
the server interface).

also fix up paramiko's "version string" used in ssh2 negotiation to stop
saying "pyssh" and start saying "paramiko". :)
2004-09-11 20:36:49 +00:00
Robey Pointer 026425c117 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-79]
Message.add() can take many args
a bit of cleanup to Message:  add() can now take any number of params, and
will add them all in order (using type guessing).
2004-09-11 20:35:19 +00:00
Robey Pointer caa1f88105 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-78]
fix rbuffer -> _rbuffer in 3 places i missed
fix 3 places where "rbuffer" hadn't been converted to "_rbuffer".  thanks to
kevin c. dorff for the bug report.
2004-09-09 01:36:45 +00:00
Robey Pointer ff6ff88209 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-77]
docs for SubsystemHandler
add documentation to constructor for SubsystemHandler.
2004-09-07 06:56:49 +00:00
Robey Pointer 7946f33769 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-76]
add sftp_client.py
i retardedly forgot to import this file a few days ago: it's the split-out
client mode for sftp.  it now also has some changes to adapt it to the
improved SFTPAttributes object API.
2004-09-07 06:54:31 +00:00
Robey Pointer 574c0dd368 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-75]
clean up SFTPAttributes
add english descriptions to the FX_* error codes of sftp.  clean up (and
document) SFTPAttributes since it's exported now, and make it simple to
generate one from a python os.stat object.  make "_pythonize" the default --
that is, just use the same field names as python does for os.stat.  (i'm not
sure why i didn't do it that way in the first place; probably ignorance.)
also add str() method that converts the SFTPAttributes into a string suitable
for use in ls (used in an obscure way in sftp servers).
2004-09-07 06:51:03 +00:00
Robey Pointer 3973265264 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-73]
split sftp into sftp, sftp_client; renamed SFTP -> SFTPClient
add sftp_client file, and split out the common code (sftp) from stuff specific
to client mode (sftp_client).  renamed SFTP class to SFTPClient, but left an
alias so old code will still work.

renamed a bunch of sftp constants now that they're better hidden from epydoc.
2004-09-05 07:44:03 +00:00
Robey Pointer 8dbab50233 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-72]
some framework for adding subsystem handlers in server mode
you can now register a subsystem with a Transport by passing in the name
(like "sftp") and a class (like a hypothetical SFTPServer).  the default
ServerInterface.check_channel_request_subsystem now checks this table in
Transport, and if it finds a match, it creates a new thread for the handler
and calls into it.  a new class SubsystemHandler is added for this purpose
(to be subclassed).
2004-09-05 07:41:45 +00:00
Robey Pointer 6cef2f1259 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-71]
remove redundant 'auth_complete' member
remove the redundant 'auth_complete' field and just use 'authenticated' for
both client and server mode.  this makes the repr() string look correct in
server mode instead of always claiming that the transport is un-auth'd.
2004-09-05 07:37:40 +00:00
Robey Pointer aba7e37a38 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-70]
clean up server interface; no longer need to subclass Channel
- export AUTH_*, OPEN_FAILED_*, and the new OPEN_SUCCEEDED into the paramiko
  namespace instead of making people dig into paramiko.Transport.AUTH_* etc.
- move all of the check_* methods from Channel to ServerInterface so apps
  don't need to subclass Channel anymore just to run an ssh server
- ServerInterface.check_channel_request() returns an error code now, not a
  new Channel object
- fix demo_server.py to follow all these changes
- fix a bunch of places where i used "string" in docstrings but meant "str"
- added Channel.get_id()
2004-09-03 22:39:20 +00:00
Robey Pointer 440b3de06a [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-69]
clean up SecurityOptions
the preferences are now tuples in Transport, and passed as tuples out of
SecurityOptions, so that the options can't be modified without setting them
back to the options field again.  the algorithm lists in Transport are used
to validate the fields.
2004-08-31 02:44:56 +00:00
Robey Pointer aebe186c3e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-68]
added Transport.get_security_options()
just something i wanted to play with:
added Transport.get_security_options() which returns a SecurityOptions object.
this object is a kind of proxy for the 4 "preferred_*" fields in Transport,
and lets me avoid exposing those fields directly in case i change my mind
later about how they should be stored.

added some docs to Channel explaining that the request methods now return
True/False, and fixed up docs in a few other places.
2004-08-30 20:22:10 +00:00
Robey Pointer 5598a8f88f [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-67]
replay patch 63 (missing channel changes)
i'm still getting the hang of tla/arch, obviously.

replay patch 63, which was meant to be part of the later mega-patch, but
apparently when i reversed it, i lost it entirely.
2004-08-28 04:21:12 +00:00
Robey Pointer c86c4f3949 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-66]
new ServerInterface class, outbound rekey works, etc.
a bunch of changes that i'm too lazy to split out into individual patches:
* all the server overrides from transport.py have been moved into a separate
  class ServerInterface, so server code doesn't have to subclass the whole
  paramiko library
* updated demo_server to subclass ServerInterface
* when re-keying during a session, block other messages until the new keys
  are activated (openssh doensn't like any other traffic during a rekey)
* re-key when outbound limits are tripped too (was only counting inbound
  traffic)
* don't log scary things on EOF
2004-08-27 00:57:40 +00:00
Robey Pointer 34d975b972 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-65]
add settimeout/gettimeout/setblocking, some bugfixes.
hide the command and response codes in sftp so they aren't exported.
add settimeout/gettimeout/setblocking that just wrap calls to the underlying
socket or channel.  fix _read_all to not catch timeout exceptions.
2004-08-27 00:28:33 +00:00
Robey Pointer 32afce8d49 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-64]
reverse messed-up patch
Patches applied:

 * robey@lag.net--2003-public/secsh--dev--1.0--base-0
   initial import

 * robey@lag.net--2003-public/secsh--dev--1.0--patch-1
   no changes
2004-08-27 00:26:35 +00:00
Robey Pointer 3eb52a18ab [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-63]
add settimeout/gettimeout/setblocking, some bugfixes.
hide the command and response codes in sftp so they aren't exported.
add settimeout/gettimeout/setblocking that just wrap calls to the underlying
socket or channel.  fix _read_all to not catch timeout exceptions.
2004-08-27 00:06:42 +00:00
Robey Pointer c6a61c2a01 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-62]
version -> horsea
up version to horsea.
2004-06-27 20:14:15 +00:00
Robey Pointer 690a05fff8 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-61]
no more Foobar
fix "Foobar" to be "Paramiko" in the one place i missed it in all the gpl
headers.  sigh. :)
2004-06-10 18:12:00 +00:00
Robey Pointer 146417c56c [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-60]
limit read/write requests to 32KB, advertise 32KB max packet size
one of the unit tests was failing because the openssh sftp server was dropping
the connection without any error.  turns out they have a maximum allowed write
size (possibly around 64KB).  the sftp rfcs have a small hint that some servers
may drop read/write requests of greater than 32KB.

so, all reads are limited to 32KB, and all writes > 32KB are now chopped up
and sent in 32KB chunks.  this seems to keep openssh happy.

also, we now advertise 32KB max packet size instead of 8KB (the speed
improves a lot), and log when we read/write a packet.  and sftp files are
flushed on seek.
2004-06-10 18:08:50 +00:00
Robey Pointer f0ba3c482e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-59]
speed up parts of BufferedFile
BufferedFile uses cStringIO for the write buffer now (i don't actually notice
any speed difference so this might revert later) and the default buffer size
has been upped from 1KB to 8KB.

when scanning for linefeeds (when writing to a line-buffered file), only scan
the newly-written bytes, since we know all the previously buffered data is
linefeed-free.  this was the #1 slowdown on the 1MB-file unit test.

also, limit the buffering on line-buffered files to whatever the default
buffer size is.  there's no reason to buffer 1MB waiting for a linefeed.
2004-06-10 18:02:13 +00:00
Robey Pointer cba104ce3f [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-58]
some Channel fixes for max packet size & blocking on zero window
some clean-ups and fixes to channels:
* when send() is blocked on a zero-width window, check that the channel is
  still open.  this was causing some lockups.
* set a lower bound to the "maximum packet size" we accept from the remote
  host.  if they tell us anything less than 1KB, assume they meant 1KB.  (it's
  not reasonable to fragment below that.)
* leave a little padding instead of cutting right up to the maximum packet
  size: some space will be taken up by protocol overhead.
* turn off some of the debug log lines unless "ultra_debug" is on (nobody
  cares about the feed info)
2004-06-10 17:55:17 +00:00
Robey Pointer 9baa2b361e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-56]
add forward.py demo script; bump to gyarados
add a demo script to show how to do local port forwarding.

add gyarados to all the docs and bump the version number everywhere.
2004-05-31 23:48:10 +00:00
Robey Pointer af8cfeced9 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-54]
add direct-tcpip ability to open_channel
open_channel can now be given a dest_addr and src_addr, which are filled in
if the channel type is "forwarded-tcpip" or "direct-tcpip".  these channel
types are used in remote & local port forwarding, respectively.  i've only
tested "direct-tcpip" but i think if one works, they both should work.

also fixed a bug in connect where it was still assuming the old meaning for
get_remove_server_key() (oops!) and changed the sense of a send() failure
from <= 0 to < 0 since it may be possible for send() to return 0 and it not
be an EOF error.
2004-05-29 18:56:10 +00:00
Robey Pointer ed77581d7a [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-52]
fix deadlock in closing a channel
closing a channel would enter an odd codepath where the lock was grabbed,
some stuff was done, then another function was called where the lock was
grabbed again.  unfortunately python locks aren't monitors so this would
deadlock.  instead, make the smaller function lock-free with an explicit
notice that you must be holding the lock before calling.
2004-05-17 07:41:50 +00:00
Robey Pointer 36a867a017 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-51]
fix utf8, raise packet size, log exceptions, be more lax with sfp servers
explicitly import utf8 encodings for "freezing" (and also because not all
platforms come with utf8, apparently).  raise the max acceptable packet size
to 8kB, cuz 2kB was too low.  log exceptions at error level instead of debug
level.  and don't reject older sftp servers.
2004-05-17 00:43:43 +00:00
Robey Pointer 4d774d62a5 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-50]
fearow date and last-minute fixes
update release date of fearow to 23apr.  fix channel._set_closed() to grab
the lock before notifying the in/out buffers that the channel is closed.
try roger's trick for finding the home folder on windows.
2004-04-23 22:55:16 +00:00
Robey Pointer 2feddf8ef7 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-49]
fix doc typos
2004-04-08 06:31:08 +00:00
Robey Pointer 11799765e2 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-48]
set version number to fearow
set version number to fearow.
2004-04-08 05:48:16 +00:00
Robey Pointer 7a3323118e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-47]
add socket.timeout for py22
oops, forgot this vital part of the py22 patches.  roger binns sent me a
code patch that included this snip.
2004-04-08 05:12:20 +00:00
Robey Pointer 5691415af1 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-46]
README update notes
added notes on what's new, what to watch out for in py22.  added a "since:
fearow" to all the relevant API calls that are new.
2004-04-07 16:05:48 +00:00
Robey Pointer 17acfb5d28 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-45]
add set_keepalive()
add set_keepalive() to set an automatic keepalive mechanism.  (while waiting
for a packet on a connection, we periodically check if it's time to send a
keepalive packet.)
2004-04-07 15:52:07 +00:00
Robey Pointer 1af6360007 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-44]
add get_username() method for remembering who you auth'd as
add get_username() method for remembering who you auth'd as.  also, fix these
bugs:
* "continue" auth response counted as a failure (in server mode).
* try to import 'logging' in py22 before falling back to the fake logger,
  in case they have a backported version of 'logger'
* raise the right exception when told to read a private key from a file that
  isn't a private key file
* tell channels to close when the transport dies
2004-04-07 06:07:29 +00:00
Robey Pointer 68c8a9b2e6 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-43]
fix encrypted private key files
the random byte padding on private key files' BER data was confusing openssh,
so switch to null-byte padding, which is slightly less secure but works with
crappy old openssh.  also, enforce the mode when writing the private key
file.  we really really want it to be 0600.  (python seems to ignore the
mode normally.)
2004-04-06 22:03:21 +00:00
Robey Pointer 945a41dd3d [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-42]
support py22, more or less
add roger binns' patches for supporting python 2.2.  i hedged a bit on the
logging stuff and just added some trickery to let logging be stubbed out for
python 2.2.  this changed a lot of import statements but i managed to avoid
hacking at any of the existing logging.

socket timeouts are required for the threads to notice when they've been
deactivated.  worked around it by using the 'select' module on py22.

also fixed the sftp unit tests to cope with a password-protected private key.
2004-04-06 08:16:02 +00:00
Robey Pointer ed72847ad1 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-41]
make get_remote_server_key() return a PKey object
a good suggestion from roger binns: make get_remote_server_key() just return
a pkey object instead of a tuple of strings.  all the strings can be extracted
from the pkey object, as well as other potentially useful things.
2004-04-05 22:32:03 +00:00
Robey Pointer c6d5ba9c52 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-40]
add dss key generation too, and fix some bugs
added the ability to generate dss keys and write private dss key files,
similar to rsa.  in the process, fixed a couple of bugs with ber encoding
and writing password-encrypted key files.  the key has to be padded to the
iblock size of the cipher -- it's very difficult to determine how the others
do this, so i just add random bytes to the end.

fixed the simple demo to use Transport's (host, port) constructor for
simplicity, and fixed a bug where the standard demo's DSS login wouldn't
work.

also, move the common logfile setup crap into util so all the demos can just
call that one.
2004-04-05 19:36:40 +00:00
Robey Pointer 70faf02f3e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-39]
add global request mechanism
add transport.global_request() to make a global-style request (usually an
extension to the protocol -- like keepalives) and handle requests from the
remote host.  incoming requests are now handled and responded to correctly,
which should make openssh-style keepalives work.  (before, we would silently
ignore them, which was wrong.)
2004-04-05 10:37:18 +00:00
Robey Pointer c9d301b782 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-38]
add common.py file
missing from previous change because tla doesn't like to add files in some
situations. (frown)
2004-04-05 10:24:33 +00:00
Robey Pointer 01bf5477a0 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-37]
can now generate rsa keys (not dss yet)
added functionality to ber to create ber streams.  added some common methods
to PKey to allow dumping the key to base64 (the format used by openssh for
public key files and host key lists), and a factory for creating a key from
a private key file, and a common way to save private keys.  RSAKey luckily
didn't have to change that much.

also added a factory method to RSAKey to generate a new key.
2004-04-05 10:16:31 +00:00
Robey Pointer 8fafd1aa17 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-36]
add common.py for commonly used constants and globals
common.py now stores the constants and globals.
lots of renaming because of this.
2004-04-05 10:12:59 +00:00
Robey Pointer d757f90ac5 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-35]
add send_ignore
add send_ignore() call to allow for sending garbage ignored packets to the
remote side.
2004-04-02 02:41:43 +00:00
Robey Pointer f8a3a62136 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-34]
fix some arcana in unpacking private keys
"!= type([])" is a pretty obscure way to say it.  let's try "is not list"
which is a lot more readable.

(mostly this is a test to make sure tla is working okay on my laptop.)
2004-03-16 07:33:09 +00:00
Robey Pointer 7cd7fced6e [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-31]
bump version number to eevee
bump the version number to eevee in a few places and talk about the unit
tests.
2004-03-08 17:52:25 +00:00
Robey Pointer e5193fb23f [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-30]
finish up client sftp support
added 'stat' to SFTPFile and SFTP, documented 'open' and 'listdir', and added
'rmdir', 'lstat', 'symlink', 'chmod', 'chown', 'utime', 'readlink'.

turned off ultra debugging now that the unit tests are all working.
2004-03-08 17:50:49 +00:00
Robey Pointer 9f6bbb6519 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-29]
fix some docs and BufferedFile.readline
fix some documentation and fix readline()'s universal newline support to
always return strings ending with '\n', regardless of how they were in the
original file.  (this is an obvious feature of python's universal newline
support that i somehow missed before.)
2004-03-08 17:45:44 +00:00
Robey Pointer c565d66e39 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-28]
fix lingering thread bug
this bug has been in there forever and i could never figure out a workaround
till now.

when the python interpreter exits, it doesn't necessarily destroy the
remaining objects or call __del__ on anything, and it will lock up until all
threads finish running.  how the threads are supposed to notice the exiting
interpreter has always been sort of a mystery to me.

tonight i figured out how to use the 'atexit' module to register a handler
that runs when the interpreter exits.  now we keep a list of active threads
and ask them all to exit on shutdown.  no more going to another shell to
kill -9 python!  yeah!!
2004-03-08 09:47:47 +00:00
Robey Pointer 3e31771637 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-27]
add BufferedFile abstraction
SFTP client mode is mostly functional.  there are probably still some bugs
but most of the operations on "file" objects have survived my simple tests.

BufferedFile wraps a simpler stream in something that looks like a python
file (and can even handle seeking if the stream underneath supports it).
it's meant to be subclassed.  most of it is ripped out of what used to be
ChannelFile so i can reuse it for sftp -- ChannelFile is now tiny.

SFTP and Message are now exported.

fixed util.format_binary_line to not quote spaces.
2004-03-04 08:21:45 +00:00
Robey Pointer d599570905 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-26]
Transport constructor can take hostname or address tuple
part of an ongoing attempt to make "simple" versions of some of the API calls,
so you can do common-case operations with just a few calls:

Transport's constructor will now let you pass in a string or tuple instead
of a socket-like object.  if you pass in a string, it assumes the string is
a hostname (with optional ":port" segment) and turns that into an address
tuple.  if you pass in a tuple, it assumes it's an address tuple.  in both
cases, it then creates a socket, connects to the given address, and then
continues as if that was the socket passed in.

the idea being that you can call Transport('example.com') and it will do
the right thing.
2004-01-27 02:04:59 +00:00
Robey Pointer 27869f1d7a [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-25]
pkey no longer raises binascii.Error
catch binascii.Error in the private key decoder and convert it into an
SSHException.  there's no reason people should have to care that it was a
decoding error vs. any of the other million things that could be wrong in
a corrupt key file.
2004-01-27 02:00:19 +00:00
Robey Pointer ea8c1378e8 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-24]
document more of Message; add get_int64
all of the get_* methods are now documented, but there's a bit more to do.
get_int64 added for eventual sftp support.
2004-01-27 01:45:44 +00:00
Robey Pointer 35ed103572 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-23]
quick doc fix.
fix broken cross-link in kex_gex docs.
2004-01-04 10:33:05 +00:00
Robey Pointer 02322f6621 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-22]
fix MANIFEST.in, change version numbers to 0.9-doduo, fix LPGL notices
fixed MANIFEST.in to include the demo scripts, LICENSE, and ChangeLog.
upped everything to version 0.9-doduo.

fixed the copyright notice, and added the LGPL banner to the top of every
python file.
2004-01-04 10:26:00 +00:00
Robey Pointer 988c6abda0 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-20]
more docs, and password-protected key files can now be read
lots more documentation, some of it moved out of the README file, which is
now much smaller and less rambling.

repr(Transport) now reports the number of bits used in the cipher.

cleaned up BER to use util functions, and throw a proper exception (the new
BERException) on error.  it doesn't ever have to be a full BER decoder, but
it can at least comb its hair and tuck in its shirt.

lots of stuff added to PKey.read_private_key_file so it can try to decode
password-protected key files.  right now it only understands "DES-EDE3-CBC"
format, but this is the only format i've seen openssh make so far.  if the
key is password-protected, but no password was given, a new exception
(PasswordRequiredException) is raised so an outer layer can ask for a password
and try again.
2004-01-04 09:29:13 +00:00
Robey Pointer 3a8887a420 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-19]
renamed auth_key -> auth_publickey; more docs.
renamed Transport.auth_key to auth_publickey for consistency.  and lots more
documentation.
2003-12-31 06:31:43 +00:00
Robey Pointer daa8a2ec0d [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-18]
added public-key support to server mode, more docs
added public-key support to server mode (it can now verify a client signature)
and added a demo of that to the demo_server.py script (user_rsa_key).  in the
process, cleaned up the API of PKey so that now it only has to know about
signing and verifying ssh2 blobs, and can be hashed and compared with other
keys (comparing & hashing only the public parts of the key).  keys can also
be created from strings now too.

some more documentation and hiding private methods.
2003-12-30 22:24:21 +00:00
Robey Pointer 48c7d888a2 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-17]
lots more documentation, and added Transport.connect()
renamed demo_host_key to demo_rsa_key.  moved changelog to a separate file,
and indicated that future changelog entries should be fetched from tla.
tried to clean up "__all__" in a way that makes epydoc still work.

added lots more documentation, and renamed many methods and vars to hide
them as private non-exported API.

Transport's ModulusPack is now a static member, so it only has to be loaded
once, and can then be used by any future Transport object.

added Transport.connect(), which tries to wrap all the SSH2 negotiation and
authentication into one method.  you should be able to create a Transport,
call connect(), and then create channels.
2003-12-30 07:18:20 +00:00
Robey Pointer 36d6d95dc6 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-16]
hook up server-side kex-gex; add more documentation
group-exchange kex should work now on the server side.  it will only be
advertised if a "moduli" file has been loaded (see the -gasp- docs) so we
don't spend hours (literally. hours.) computing primes.  some of the logic
was previously wrong, too, since it had never been tested.

fixed repr() string for Transport/BaseTransport.  moved is_authenticated to
Transport where it belongs.

added lots of documentation (but still only about 10% documented).  lots of
methods were made private finally.
2003-12-28 03:20:42 +00:00
Robey Pointer eb4c279ec4 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-15]
fix up new paramiko/ folder.
moved SSHException to a new file (ssh_exception.py) and turned paramiko.py
into an __init__.py file.  i'm still not entirely sure how this normally
works, so i may have done something wrong, but it's supposed to work the
same as before.
2003-12-27 02:03:44 +00:00
Robey Pointer 877cd974b8 [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-14]
move the paramiko files into a paramiko/ folder.
just moving the files into a folder.  it won't build this way yet.
2003-12-27 01:49:19 +00:00