o bɔ@s&ddlZddlZddlZddlZddlmZddlmZddlm Z m Z ddl m Z m Z ddlmZmZmZddlmZddlmZdd lmZmZGd d d ejZGd d d eZGdddeZee GdddZGdddZGdddeZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*d Z+d!Z,d"Z-d#Z.d$Z/d%Z0d&Z1d'Z2d(Z3d)Z4d*Z5d+Z6d,Z7d-Z8d.Z9d/Z:d0Z;dZdZ?dZ@d1ZAdZBdZCdZDdZEdZFdZGdZHdZIdZJd%ZKd2ZLd3ZMdZNdZOdZPdZQdZRdZSdZTdZUdZVd ZWeRZXeRZYeZZ[e\e[]D]Z^e^_d4r e[e^Z`e^ddejae`<q[[[^[`dS)5N)Dict) implementer) ISFTPFile ISFTPServer)NSgetNS)defererrorprotocol)Logger)failure) nativeString networkStringcsdeZdZUeZdZiZeee fe d<ddZ ddZ ddZ d d Zd d Zfd dZZS)FileTransferBase) packetTypescCsd|_d|_dSN)buf otherVersionselfr@/usr/lib/python3/dist-packages/twisted/conch/ssh/filetransfer.py__init__s zFileTransferBase.__init__cCs&|jtdt|d||dS)Nz!LB) transportwritestructpacklen)rkinddatarrr sendPacket"s&zFileTransferBase.sendPacketcCs<|j|7_t|jdkr|jdd}td|\}}}t|jd|kr)dS|jdd||jd|d}|_|j|d}|sO|jjd|dqt|d|d}|sr|jjd||ddd | |t d |q|jjd ||d z||Wnt y|jj d |dYqwt|jdksdSdS)N z!LBLzno packet type for {kind})r!packet_z+not implemented: {packetType} data={data!r}) packetTyper"zdon't understand z+dispatching: {packetType} requestId={reqId})r(reqIdz,Failed to handle packet of type {packetType})r() rr runpackrget_loginfogetattr _sendStatusFX_OP_UNSUPPORTED Exceptionr )rr"headerlengthr!r)r(frrr dataReceived%sJ (    zFileTransferBase.dataReceivedcCstd|dd\}i}|dd}|t@tkr.td|dd\}||d<|dd}|t@tkrNtd|dd\}}||d<||d<|dd}|t@tkritd|dd\}||d <|dd}|t@tkrtd|dd\}} ||d <| |d <|dd}|t@tkrtd|dd\} |dd}t| D]} t|\} }t|\} }| |d t | <q||fS) N!Lr%!Qsize!2Luidgid permissionsatimemtimeext_) rr*FILEXFER_ATTR_SIZEFILEXFER_ATTR_OWNERGROUPFILEXFER_ATTR_PERMISSIONSFILEXFER_ATTR_ACMODTIMEFILEXFER_ATTR_EXTENDEDrangerr )rr"flagsattrsr9r;r<permsr>r? extendedCounti extendedType extendedDatarrr_parseAttributes`s:              z!FileTransferBase._parseAttributescCs8d}d}d|vr|td|d7}|tO}d|vr/d|vr/|td|d|d7}|tO}d|vrA|td |d7}|tO}d |vrZd |vrZ|td|d |d 7}|tO}g}|D]}|d r|tt|d d}t||}| ||q^|r|td t |7}|d |7}|t O}td ||S)Nrrr9r7r;r<r:r=r6r>r?r@r%) rrrArBrCrD startswithrrappendr joinrE)rrHrGr"extendedkextTypeextDatarrr_packAttributess4  z FileTransferBase._packAttributescst|d|_dS)zJ Called when connection to the remote subsystem was lost. FN)superconnectionLost connectedrreason __class__rrrXs  zFileTransferBase.connectionLost)__name__ __module__ __qualname__r r,versionsrrintstr__annotations__rr#r5rNrVrX __classcell__rrr\rrs ;rc@s0eZdZdMddZddZddZdd Zd d ZdNd dZddZ ddZ ddZ ddZ ddZ ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(ZdOd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z d@dAZ!dPdCdDZ"dQdFdGZ#dRdIdJZ$dKdLZ%dS)SFileTransferServerNcCs$t|t||_i|_i|_dSN)rrrclient openFilesopenDirs)rr"avatarrrrrs   zFileTransferServer.__init__c Cstd|dd\}tt|j|g|_|dd}i}|r2t|\}}t|\}}|||<|s |j||}d}| D]\}} |t |t | 7}q?| t t d|j|dSNr6r%r)rr*minlistraversionrrh gotVersionitemsrr# FXP_VERSIONr) rr"roextextNamerUourExt ourExtDatarSvrrr packet_INITs   zFileTransferServer.packet_INITcCs|dd}|dd}t|\}}td|dd\}|dd}||\}}|dks5Jd|t|jj|||}||j || |j |ddS)Nr%r6rzstill have data in OPEN: s open failed) rrr*rNr maybeDeferredrhopenFile addCallback _cbOpenFile addErrback _ebStatus)rr" requestIdfilenamerGrHdrrr packet_OPENs    zFileTransferServer.packet_OPENcCsDttt|}||jvrtd||j|<|t|t|dS)Nzid already open)rrchashriKeyErrorr# FXP_HANDLEr)rfileObjrfileIdrrrr|s   zFileTransferServer._cbOpenFilec Cs |dd}|dd}t|\}}|jjd||d|dks&Jd|||jvrH|j|}t|j}||j||| |j |ddS||j vrm|j |d}t|j}||j||d| |j |ddSt j }t|}t||} | t| |dS) Nr%z!closing: {requestId!r} {handle!r})rhandlerzstill have data in CLOSE: s close failedrr)rr,r-rirrycloser{_cbCloser}r~rjerrnoENOENTosstrerrorOSErrorr Failure) rr"rrrrdirObjcodetexterrrrr packet_CLOSEs.          zFileTransferServer.packet_CLOSErcCs(|r|j|=n|j|=||tddS)Ns file closed)rjrir/FX_OK)rresultrrisDirrrrrs zFileTransferServer._cbClosecCs|dd}|dd}t|\}}td|dd|dd\}}}|dks0Jd|||jvrA|tt|dS|j|}t |j ||}| |j || |j|ddS)Nr%!QL rzstill have data in READ: s read failed)rrr*ri_ebReadr rrrry readChunkr{_cbReadr}r~)rr"rroffsetr3rrrrr packet_READs   &  zFileTransferServer.packet_READcCs&|dkrt|t|t|dSr)EOFErrorr#FXP_DATArrrrrrrrszFileTransferServer._cbReadcCs|dd}|dd}t|\}}td|dd\}|dd}t|\}}|dks4Jd|||jvrE|tt|dS|j|}t |j ||}| |j |d| |j|ddS)Nr%r7r8rzstill have data in WRITE: swrite succeededs write failed)rrr*ri_ebWriter rrrry writeChunkr{ _cbStatusr}r~)rr"rrr writeDatarrrrr packet_WRITEs       zFileTransferServer.packet_WRITEcCn|dd}|dd}t|\}}|dksJd|t|jj|}||j|d||j|ddS)Nr%rzstill have data in REMOVE: sremove succeededs remove failed) rrryrh removeFiler{rr}r~)rr"rrrrrr packet_REMOVE   z FileTransferServer.packet_REMOVEcCs||dd}|dd}t|\}}t|\}}|dks#Jd|t|jj||}||j|d||j|ddS)Nr%rzstill have data in RENAME: srename succeededs rename failed) rrryrh renameFiler{rr}r~)rr"roldPathnewPathrrrr packet_RENAMEs    z FileTransferServer.packet_RENAMEcCs~|dd}|dd}t|\}}||\}}|dks$Jd|t|jj||}||j|d||j |ddS)Nr%rzstill have data in MKDIR: smkdir succeededs mkdir failed) rrNrryrh makeDirectoryr{rr}r~rr"rpathrHrrrr packet_MKDIR#s   zFileTransferServer.packet_MKDIRcCr)Nr%rzstill have data in RMDIR: srmdir succeededs rmdir failed) rrryrhremoveDirectoryr{rr}r~rr"rrrrrr packet_RMDIR-rzFileTransferServer.packet_RMDIRcCl|dd}|dd}t|\}}|dksJd|t|jj|}||j|||j|ddS)Nr%rzstill have data in OPENDIR: sopendir failed) rrryrh openDirectoryr{_cbOpenDirectoryr}r~rrrrpacket_OPENDIR6   z!FileTransferServer.packet_OPENDIRcCsLttt|}||jvrtd|t|g|j|<|t|t|dS)Nzalready opened this directory) rrcrrjriterr#rr)rrrrrrrr?s  z#FileTransferServer._cbOpenDirectorycCs|dd}|dd}t|\}}|dksJd|||jvr.|tt|dS|j|\}}t|j|g}| |j || |j|ddS)Nr%rzstill have data in READDIR: sscan directory failed) rrjr~r rrrry_scanDirectoryr{_cbSendDirectoryr})rr"rrrdirIterrrrrpacket_READDIRFs    z!FileTransferServer.packet_READDIRcCsrt|dkr7zt|}Wnty|st|YSwt|tjr,||j||dS| |t|dks|S)N) r next StopIterationr isinstancerDeferredr{_cbScanDirectoryrP)rrr4r-rrrrSs       z!FileTransferServer._scanDirectorycCs|||||Srg)rPr)rrrr4rrrrbs  z#FileTransferServer._cbScanDirectoryc Cs^d}|D]\}}}|t|7}|t|7}|||7}q|t|tdt||dS)Nrr6)rrVr#FXP_NAMErrr )rrrr"rlongnamerHrrrrfs   $z#FileTransferServer._cbSendDirectoryrcCsn|dd}|dd}t|\}}|dksJd|t|jj||}||j|||j|ddS)Nr%rzstill have data in STAT/LSTAT: sstat/lstat failed) rrryrhgetAttrsr{_cbStatr}r~)rr" followLinksrrrrrr packet_STATns   zFileTransferServer.packet_STATcCs||ddSNr)r)rr"rrr packet_LSTATwzFileTransferServer.packet_LSTATcCs|dd}|dd}t|\}}|dksJd|||jvr2|tt|d|dS|j|}t|j}| |j || |j|ddS)Nr%rzstill have data in FSTAT: z not in self.openFiless fstat failed) rrir~r rrrryrr{rr})rr"rrrrrrr packet_FSTATzs      zFileTransferServer.packet_FSTATcCs|||}|t|dSrg)rVr# FXP_ATTRS)rrrr"rrrrszFileTransferServer._cbStatcCs|dd}|dd}t|\}}||\}}|dkr%|jjd|dt|jj||}||j |d| |j |ddS)Nr%rz$Still have data in SETSTAT: {data!r})r"ssetstat succeededssetstat failed) rrNr,warnrryrhsetAttrsr{rr}r~rrrrpacket_SETSTATs   z!FileTransferServer.packet_SETSTATcCs|dd}|dd}t|\}}||\}}|dks$Jd|||jvr5|tt|dS|j|}t|j |}| |j |d| |j|ddS)Nr%rzstill have data in FSETSTAT: sfsetstat succeededsfsetstat failed) rrNrir~r rrrryrr{rr})rr"rrrHrrrrrpacket_FSETSTATs     z"FileTransferServer.packet_FSETSTATcCr)Nr%rzstill have data in READLINK: sreadlink failed) rrryrhreadLinkr{ _cbReadLinkr}r~rrrrpacket_READLINKrz"FileTransferServer.packet_READLINKcCs||difg|dSr)rrrrrrszFileTransferServer._cbReadLinkcCsf|dd}|dd}t|\}}t|\}}t|jj||}||j|d||j|ddS)Nr%ssymlink succeededssymlink failed) rrryrhmakeLinkr{rr}r~)rr"rlinkPath targetPathrrrrpacket_SYMLINKs    z!FileTransferServer.packet_SYMLINKcCr)Nr%rzstill have data in REALPATH: srealpath failed) rrryrhrealPathr{rr}r~rrrrpacket_REALPATHrz"FileTransferServer.packet_REALPATHcCs`|dd}|dd}t|\}}t|jj||}||j|||j|d|ddS)Nr%s extended s failed) rrryrhextendedRequestr{ _cbExtendedr}r~)rr"rrtrUrrrrpacket_EXTENDEDs   z"FileTransferServer.packet_EXTENDEDcCs|t||dSrg)r#FXP_EXTENDED_REPLY)rr"rrrrrzFileTransferServer._cbExtendedrequest succeededcCs||t|dSrg)r/r)rrrmsgrrrrszFileTransferServer._cbStatusrequest failedcCst}|}t|jttfrA|jjtjkrt}t|jj }nj|jjtj kr,t }t|jj }nZ|jjtj kr6t }nP|jjd|||dnEt|jtrVt}|jjrUt|jjd}n0t|jtrkt}|jjrjt|jjd}nt|jtr||jj}t|jj}n |jjd|||d||||dS)Nz%Request {requestId} failed: {message})r rmessagerz8Request {requestId} failed with unknown error: {message}) FX_FAILURErvalueIOErrorrrrFX_NO_SUCH_FILErrEACCESFX_PERMISSION_DENIEDEEXISTFX_FILE_ALREADY_EXISTSr,r rFX_EOFargsNotImplementedErrorr0 SFTPErrorrrr/)rr[rrrrrrrr~sJ   zFileTransferServer._ebStatusrcCs8|td|}|t|7}|t|7}|t|dS)z= Helper method to send a FXP_STATUS message. r6N)rrrr# FXP_STATUS)rrrrlangr"rrrr/s  zFileTransferServer._sendStatuscCsPt|||jD]}|q i|_|jD]\}}|qi|_dS)z{ Called when connection to the remote subsystem was lost. Clean all opened files and directories. N)rrXrivaluesrrj)rr[rrrrrrrXs    z!FileTransferServer.connectionLost)NNr)r)r)r)r)&r^r_r`rrxrr|rrrrrrrrrrrrrrrrrrrrrrrrrrrrr~r/rXrrrrrfsH                  ' rfc@seZdZifddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZd9ddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8S):FileTransferClientcCs t|i|_d|_i|_dS)zq @param extData: a dict of extended_name : extended_data items to be sent to the server. rN)rrrUcounter openRequests)rrUrrrrs  zFileTransferClient.__init__cCsJtdt|j}|jD]\}}|t|t|7}q|t|dS)Nr6) rrmaxrarUrrr#FXP_INIT)rr"rSrwrrrconnectionMadesz!FileTransferClient.connectionMadecCs\t|||jr*t}|j|_t|}|jr,|j \}}| ||jsdSdSdS)zu Called when connection to the remote subsystem was lost. Any pending requests are aborted. N) rrXrr ConnectionLostr __cause__r rpopitemerrback)rr[ requestErrorrequestFailure_deferredrrrrX%s    z!FileTransferClient.connectionLostcCsX|js ttStd|j|}t}||j |j<|jd7_| |||S)z Send a request and return a deferred which waits for the result. @type msg: L{int} @param msg: The request type (e.g., C{FXP_READ}). @type data: L{bytes} @param data: The body of the request. r6r) rYrfailr rrrrrrr#)rrr"rrrr _sendRequest;s   zFileTransferClient._sendRequestcCs8td|dd\}|j|}|j|=||ddfSNr6r%)rr*r)rr"idrrrr _parseRequestOs z FileTransferClient._parseRequestcCs>t|td|||}|t|}||jt||S)a Open a file. This method returns a L{Deferred} that is called back with an object that provides the L{ISFTPFile} interface. @type filename: L{bytes} @param filename: a string representing the file to open. @param flags: an integer of the flags to open the file with, ORed together. The flags and their values are listed at the bottom of this file. @param attrs: a list of attributes to open the file with. It is a dictionary, consisting of 0 or more keys. The possible keys are:: size: the size of the file in bytes uid: the user ID of the file as an integer gid: the group ID of the file as an integer permissions: the permissions of the file with as an integer. the bit representation of this field is defined by POSIX. atime: the access time of the file as seconds since the epoch. mtime: the modification time of the file as seconds since the epoch. ext_*: extended attributes. The server is not required to understand this, but it may. NOTE: there is no way to indicate text or binary files. it is up to the SFTP client to deal with this. r6) rrrrVrFXP_OPENr{ _cbOpenHandle ClientFile)rrrGrHr"rrrrrzUs zFileTransferClient.openFilecCs|||}||_|S)a Callback invoked when an OPEN or OPENDIR request succeeds. @param handle: The handle returned by the server @type handle: L{bytes} @param handleClass: The class that will represent the newly-opened file or directory to the user (either L{ClientFile} or L{ClientDirectory}). @param name: The name of the file or directory represented by C{handle}. @type name: L{bytes} )name)rr handleClassrcbrrrr ws z FileTransferClient._cbOpenHandlecC|tt|S)z Remove the given file. This method returns a Deferred that is called back when it succeeds. @type filename: L{bytes} @param filename: the name of the file as a string. )r FXP_REMOVEr)rrrrrrs zFileTransferClient.removeFilecC|tt|t|S)a Rename the given file. This method returns a Deferred that is called back when it succeeds. @type oldpath: L{bytes} @param oldpath: the current location of the file. @type newpath: L{bytes} @param newpath: the new file name. )r FXP_RENAMEr)roldpathnewpathrrrrs zFileTransferClient.renameFilecCs|tt|||S)au Make a directory. This method returns a Deferred that is called back when it is created. @type path: L{bytes} @param path: the name of the directory to create as a string. @param attrs: a dictionary of attributes to create the directory with. Its meaning is the same as the attrs in the openFile method. )r FXP_MKDIRrrV)rrrHrrrrs z FileTransferClient.makeDirectorycCr)a- Remove a directory (non-recursively) It is an error to remove a directory that has files or directories in it. This method returns a Deferred that is called back when it is removed. @type path: L{bytes} @param path: the directory to remove. )r FXP_RMDIRr)rrrrrrs z"FileTransferClient.removeDirectorycCs$|tt|}||jt||S)a Open a directory for scanning. This method returns a Deferred that is called back with an iterable object that has a close() method. The close() method is called when the client is finished reading from the directory. At this point, the iterable will no longer be used. The iterable returns triples of the form (filename, longname, attrs) or a Deferred that returns the same. The sequence must support __getitem__, but otherwise may be any 'sequence-like' object. filename is the name of the file relative to the directory. logname is an expanded format of the filename. The recommended format is: -rwxr-xr-x 1 mjos staff 348911 Mar 25 14:29 t-filexfer 1234567890 123 12345678 12345678 12345678 123456789012 The first line is sample output, the second is the length of the field. The fields are: permissions, link count, user owner, group owner, size in bytes, modification time. attrs is a dictionary in the format of the attrs argument to openFile. @type path: L{bytes} @param path: the directory to open. )r FXP_OPENDIRrr{r ClientDirectoryrrrrrrrsz FileTransferClient.openDirectoryrcCs|rt}nt}||t|S)a Return the attributes for the given path. This method returns a dictionary in the same format as the attrs argument to openFile or a Deferred that is called back with same. @type path: L{bytes} @param path: the path to return attributes for as a string. @param followLinks: a boolean. if it is True, follow symbolic links and return attributes for the real path at the base. if it is False, return attributes for the specified path. )FXP_STAT FXP_LSTATrr)rrrmrrrrs zFileTransferClient.getAttrscCst|||}|t|S)ad Set the attributes for the path. This method returns when the attributes are set or a Deferred that is called back when they are. @type path: L{bytes} @param path: the path to set attributes for as a string. @param attrs: a dictionary in the same format as the attrs argument to openFile. )rrVr FXP_SETSTAT)rrrHr"rrrrs zFileTransferClient.setAttrscC|tt|}||jS)z Find the root of a set of symbolic links. This method returns the target of the link, or a Deferred that returns the same. @type path: L{bytes} @param path: the path of the symlink to read. )r FXP_READLINKrr{ _cbRealPathrrrrr zFileTransferClient.readLinkcCr)a[ Create a symbolic link. This method returns when the link is made, or a Deferred that returns the same. @type linkPath: L{bytes} @param linkPath: the pathname of the symlink as a string @type targetPath: L{bytes} @param targetPath: the path of the target of the link as a string. )r FXP_SYMLINKr)rrrrrrrs zFileTransferClient.makeLinkcCr )z Convert any path to an absolute path. This method returns the absolute path as a string, or a Deferred that returns the same. @type path: L{bytes} @param path: the path to convert as a string. )r FXP_REALPATHrr{r"rrrrrr#zFileTransferClient.realPathcCs|d\}}}|d}|S)Nrzutf-8)decode)rrrrrHrrrr")s zFileTransferClient._cbRealPathcCs|tt||S)ak Make an extended request of the server. The method returns a Deferred that is called back with the result of the extended request. @type request: L{bytes} @param request: the name of the extended request to make. @type data: L{bytes} @param data: any other data that goes along with the request. )r FXP_EXTENDEDr)rrequestr"rrrr.s z"FileTransferClient.extendedRequestcCsdtd|dd\}|dd}i}|r't|\}}t|\}}|||<|s||_|||dSr)rr*rrogotServerVersion)rr"rorrSrwrrrpacket_VERSION<s   z!FileTransferClient.packet_VERSIONcCs||\}}td|dd\}|dd}t|dkr4t|\}}t|dkr1t|\}}nd}nd}d}|tkrE|||fdS|tkrR|t |dS|t kr_|t |dS|t |t ||dSrl)r rr*r rrcallbackrrrr0rrr )rr"rrrrrrr packet_STATUSGs"    z FileTransferClient.packet_STATUScCs(||\}}t|\}}||dSrg)r rr+)rr"rrrrrr packet_HANDLE]s z FileTransferClient.packet_HANDLEcCs$||\}}|t|ddSr)r r+rrr"rrrr packet_DATAbszFileTransferClient.packet_DATAc Cs||\}}td|dd\}|dd}g}t|D]}t|\}}t|\}}||\}}||||fq||dSr)r rr*rFrrNrPr+) rr"rcountfilesrKrrrHrrr packet_NAMEfs    zFileTransferClient.packet_NAMEcCs&||\}}|||ddSr)r r+rNr.rrr packet_ATTRSrszFileTransferClient.packet_ATTRScCs||\}}||dSrg)r r+r.rrrpacket_EXTENDED_REPLYvsz(FileTransferClient.packet_EXTENDED_REPLYcCsdS)aN Called when the client sends their version info. @param serverVersion: an integer representing the version of the SFTP protocol they are claiming. @param extData: a dictionary of extended_name : extended_data items. These items are sent by the client to indicate additional features. Nr)r serverVersionrUrrrr)zsz#FileTransferClient.gotServerVersionNr)r^r_r`rrrXrr rzr rrrrrrrrrrr"rr*r,r-r/r2r3r4r)rrrrrs8  "   "     rc@s<eZdZddZddZddZddZd d Zd d Zd S)r cCs||_t||_dSrg)parentrrrr6rrrrrszClientFile.__init__cC|jt|jSrg)r6r FXP_CLOSErrrrrrrzClientFile.closecCs"|jtd||}|jt|S)Nr)rrrr6rFXP_READ)rrr3r"rrrrszClientFile.readChunkcCs(|jtd|t|}|jt|S)Nr7)rrrrr6r FXP_WRITE)rrchunkr"rrrrszClientFile.writeChunkcCr8rg)r6r FXP_FSTATrrrrrrrzClientFile.getAttrscCs |j|j|}|jt|Srg)rr6rVrr=)rrHr"rrrrszClientFile.setAttrsN) r^r_r`rrrrrrrrrrr s r c@sHeZdZddZddZddZddZd d ZeZd d Z d dZ dS)rcCs||_t||_g|_dSrg)r6rr filesCacher7rrrrs  zClientDirectory.__init__cCr8rg)r6r FXP_READDIRrrrrrreadrzClientDirectory.readcCs.|jdur tdS|jt|j}d|_|Srg)rrsucceedr6rr9rrrrrrs  zClientDirectory.closecCs|Srgrrrrr__iter__szClientDirectory.__iter__cCsNtjdtdd|jr|jdS|jdurt|}||j|j |S)NzeUsing twisted.conch.ssh.filetransfer.ClientDirectory as an iterator was deprecated in Twisted 18.9.0.)category stacklevelr) warningsrDeprecationWarningr>poprr@ addCallbacks _cbReadDir _ebReadDirrBrrr__next__s  zClientDirectory.__next__cCs|dd|_|dS)Nrr)r>)rnamesrrrrKszClientDirectory._cbReadDircCs|td|_ttSrg)traprr>r rrrZrrrrLs  zClientDirectory._ebReadDirN) r^r_r`rr@rrCrMrrKrLrrrrrs rc@s0eZdZd ddZeddZdefddZd S) rcCs t|||_||_||_dSrg)r1rr_messager)r errorCode errorMessagerrrrrs  zSFTPError.__init__cCs|jS)zX A string received over the network that explains the error to a human. )rQrrrrrs zSFTPError.messagereturncCsd|jd|jS)Nz SFTPError z: )rrrrrr__str__rzSFTPError.__str__N)rP)r^r_r`rpropertyrrcrUrrrrrs    rrrDrr%r&r8r$ r efghil @FXP_)brrrrGtypingrzope.interfacertwisted.conch.interfacesrrtwisted.conch.ssh.commonrrtwisted.internetrr r twisted.loggerr twisted.pythonr twisted.python.compatr rProtocolrrfrr rr1rrrrr r9r:r;rr=r FXP_FSETSTATrr?rrrr%rrr!r$rrrrrr'rrAFILEXFER_ATTR_UIDGIDrBrCrDrEFILEXFER_TYPE_REGULARFILEXFER_TYPE_DIRECTORYFILEXFER_TYPE_SYMLINKFILEXFER_TYPE_SPECIALFILEXFER_TYPE_UNKNOWNFXF_READ FXF_WRITE FXF_APPEND FXF_CREAT FXF_TRUNCFXF_EXCLFXF_TEXTrrrrrFX_BAD_MESSAGEFX_NO_CONNECTIONFX_CONNECTION_LOSTr0rFX_NOT_A_DIRECTORYFX_FILE_IS_A_DIRECTORYglobalsgrnkeysrrOrrrrrrs     ss0