Commit Graph

33 Commits

Author SHA1 Message Date
Scott Maxwell 9662a7f779 Changes inspired by the nischu7 branch 2013-11-01 09:49:52 -07:00
Scott Maxwell d26bf3e63e More type conversion 2013-10-31 16:19:11 -07:00
Scott Maxwell 0b7d0cf0a2 Convert and detect types properly, use helper constants, use StringIO and range 2013-10-30 17:14:52 -07:00
Scott Maxwell 0e4ce3762a Fix message sending
Create constants for byte messages, implement asbytes so many methods can take Message and key objects directly and split get_string into get_text and get_binary. Also, change int handling to use mpint with a flag whenever the int is greater than 32 bits.
2013-10-30 17:09:34 -07:00
Jeff Forcier 83f44878ea Fixed a typo in the license header of most files
Conflicts:
	paramiko/proxy.py
2013-09-27 21:29:18 -07:00
Robey Pointer 60c6e94e7d fix my email address to be the current one. 2009-07-19 19:45:02 -07:00
Robey Pointer e8748645a3 [project @ robey@lag.net-20080706225842-25rg9uk9ksyxxbyf]
fix convoluted logging method
2008-07-06 15:58:42 -07:00
Robey Pointer 50d63690ee [project @ robey@lag.net-20080323023616-fpo17kr0qxxbgthv]
bug 200416:
don't create a new logger for every channel and every sftp client or server.
it causes python to leak lots of useless logger objects, because they never
go away. instead, log the channel # in the message, and use only a couple of
standard log nodes.
2008-03-22 19:36:16 -07:00
Robey Pointer 83b335e10f [project @ robey@lag.net-20070213191706-v8djxd4jiunb3his]
bump copyright year to 2007
2007-02-13 11:17:06 -08:00
Robey Pointer 7058f5ead2 [project @ robey@lag.net-20061215211936-rgc3uzy5ai9h6qho]
bug 75370: notice garbage sftp packets
since sftp packets shouldn't be larger than about 32k, if the first length
byte is non-zero (ie, the packet size > 16M), raise an exception.
2006-12-15 13:19:36 -08:00
Robey Pointer a9c51b23ce [project @ robey@lag.net-20061113041742-e24468a63d31b8bd]
sometimes the sftp module is used with raw sockets, not just paramiko
Channels.  in this case, calling recv() will never return.  so notice
this and use select() to give python a chance to notice a closed socket.
this kind of thing is especially useful for unit tests.
2006-11-12 20:17:42 -08:00
Robey Pointer 1d2bd214c3 [project @ robey@lag.net-20060508002214-0403d95f73b152f5]
couple of doc fixes
2006-05-07 17:22:14 -07:00
Robey Pointer 8446c0bda1 [project @ robey@lag.net-20060220005934-58d0df2920e799b5]
update copyright year
2006-02-19 16:59:34 -08:00
Robey Pointer d44035e716 [project @ robey@master-shake.local-20060126204925-3cc14de36a8c5c1f]
winscp doesn't like it if the server sends version info before the client does
2006-01-26 12:49:25 -08: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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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