Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/cvs/cvsclient.py
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | def connect_pserver(self, hostname, port, auth): | ||||
"a pserver connection: %s" % EXAMPLE_PSERVER_URL) | "a pserver connection: %s" % EXAMPLE_PSERVER_URL) | ||||
try: | try: | ||||
self.socket = socket.create_connection((hostname, port)) | self.socket = socket.create_connection((hostname, port)) | ||||
except ConnectionRefusedError: | except ConnectionRefusedError: | ||||
raise NotFound("Could not connect to %s:%s", hostname, port) | raise NotFound("Could not connect to %s:%s", hostname, port) | ||||
scrambled_password = scramble_password(password) | scrambled_password = scramble_password(password) | ||||
request = "BEGIN AUTH REQUEST\n%s/%s\n%s\n%s\nEND AUTH REQUEST\n" \ | request = "BEGIN AUTH REQUEST\n%s\n%s\n%s\nEND AUTH REQUEST\n" \ | ||||
% (self.cvsroot_path, self.cvs_module_name, user, scrambled_password) | % (self.cvsroot_path, user, scrambled_password) | ||||
vlorentz: forgot to remove this | |||||
print("Request: %s\n" % request) | |||||
self.socket.sendall(request.encode('UTF-8')) | self.socket.sendall(request.encode('UTF-8')) | ||||
response = self.socket.recv(11) | response = self.conn_read_line() | ||||
if response != b"I LOVE YOU\n": | if response != b"I LOVE YOU\n": | ||||
raise NotFound("pserver authentication failed for %s:%s" % (hostname, port)) | raise NotFound("pserver authentication failed for %s:%s: %s" % | ||||
(hostname, port, response)) | |||||
def connect_ssh(self, hostname, port, auth): | def connect_ssh(self, hostname, port, auth): | ||||
command = ['ssh'] | command = ['ssh'] | ||||
if auth is not None: | if auth is not None: | ||||
# Assume 'auth' contains only a user name. | # Assume 'auth' contains only a user name. | ||||
# We do not support password authentication with SSH since the | # We do not support password authentication with SSH since the | ||||
# anoncvs user is usually granted access without a password. | # anoncvs user is usually granted access without a password. | ||||
command += ['-l' , '%s' % auth] | command += ['-l' , '%s' % auth] | ||||
▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines |
forgot to remove this