Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Side by Side Diff: third_party/twisted_8_1/twisted/conch/client/agent.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 #
5 """
6 Accesses the key agent for user authentication.
7
8 Maintainer: U{Paul Swartz<mailto:z3p@twistedmatrix.com>}
9 """
10
11 from twisted.conch.ssh import agent, channel
12 from twisted.internet import protocol
13 from twisted.python import log
14
15 class SSHAgentClient(agent.SSHAgentClient):
16
17 def __init__(self):
18 agent.SSHAgentClient.__init__(self)
19 self.blobs = []
20
21 def getPublicKeys(self):
22 return self.requestIdentities().addCallback(self._cbPublicKeys)
23
24 def _cbPublicKeys(self, blobcomm):
25 log.msg('got %i public keys' % len(blobcomm))
26 self.blobs = [x[0] for x in blobcomm]
27
28 def getPublicKey(self):
29 if self.blobs:
30 return self.blobs.pop(0)
31 return None
32
33 class SSHAgentForwardingChannel(channel.SSHChannel):
34
35 def channelOpen(self, specificData):
36 cc = protocol.ClientCreator(reactor, SSHAgentForwardingLocal)
37 d = cc.connectUNIX(os.environ['SSH_AUTH_SOCK'])
38 d.addCallback(self._cbGotLocal)
39 d.addErrback(lambda x:self.loseConnection())
40 self.buf = ''
41
42 def _cbGotLocal(self, local):
43 self.local = local
44 self.dataReceived = self.local.transport.write
45 self.local.dataReceived = self.write
46
47 def dataReceived(self, data):
48 self.buf += data
49
50 def closed(self):
51 if self.local:
52 self.local.loseConnection()
53 self.local = None
54
55 class SSHAgentForwardingLocal(protocol.Protocol): pass
56
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/conch/client/__init__.py ('k') | third_party/twisted_8_1/twisted/conch/client/connect.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698