def start(self, iomap, backlog):
"""Prompts for the password, creates a socket, and starts listening.
The specified backlog should be the max number of clients connecting
at once.
"""
message = ('Warning: do not enter your password if anyone else has'
' superuser privileges or access to your account.')
print(textwrap.fill(message))
self.password = getpass.getpass()
# Note that according to the docs for mkdtemp, "The directory is
# readable, writable, and searchable only by the creating user."
self.tempdir = tempfile.mkdtemp(prefix='pssh.')
self.address = os.path.join(self.tempdir, 'pssh_askpass_socket')
self.sock = socket.socket(socket.AF_UNIX)
psshutil.set_cloexec(self.sock)
self.sock.bind(self.address)
self.sock.listen(backlog)
iomap.register_read(self.sock.fileno(), self.handle_listen)
评论列表
文章目录