Ejemplo n.º 1
0
def connect(link):
    # Send the announce message - we only support protocol version 2.
    """

    :type link: SvnRequestHandler
    """
    link.send_msg(gen.success(2, 2, gen.list(),
                              gen.list(*server_capabilities)))
    msg = parse.msg(link.read_msg())

    proto_ver = int(msg[0])
    client_caps = msg[1]
    url = parse.string(msg[2])

    print "ver: %d" % proto_ver
    print "caps: %s" % client_caps
    print "url: %s" % url

    if proto_ver != 2:
        raise BadProtoVersion()

    repo, path, base_url = link.server.find_repo(url)

    if repo is None:
        link.send_msg(
            gen.failure(
                gen.list(210005,
                         gen.string("No repository found in '%s'" % url),
                         gen.string('message.py'), 0)))

    return path, client_caps, repo, base_url
Ejemplo n.º 2
0
def connect(link):
    # Send the announce message - we only support protocol version 2.
    """

    :type link: SvnRequestHandler
    """
    link.send_msg(gen.success(2, 2, gen.list(), gen.list(*server_capabilities)))
    msg = parse.msg(link.read_msg())

    proto_ver = int(msg[0])
    client_caps = msg[1]
    url = parse.string(msg[2])

    print "ver: %d" % proto_ver
    print "caps: %s" % client_caps
    print "url: %s" % url

    if proto_ver != 2:
        raise BadProtoVersion()

    repo, path, base_url = link.server.find_repo(url)

    if repo is None:
        link.send_msg(gen.failure(gen.list(210005,
                                           gen.string("No repository found in '%s'" % url),
                                           gen.string('message.py'), 0)))

    return path, client_caps, repo, base_url
Ejemplo n.º 3
0
 def do_auth(self):
     while True:
         try:
             return self.perform_auth()
         except AuthFailure as fail:
             self.link.send_msg(gen.failure(*fail.args))
             return False
Ejemplo n.º 4
0
 def do_auth(self):
     while True:
         try:
             return self.perform_auth()
         except AuthFailure as fail:
             self.link.send_msg(gen.failure(*fail.args))
             return False
Ejemplo n.º 5
0
def perform_auth(link, auth_db):
    """


    :type link: SvnRequestHandler
    :rtype : User
    """
    link.send_msg(gen.success(gen.list(*auths.keys()), gen.string(link.base_url)))

    while True:
        auth_type = parse.msg(link.read_msg())[0]

        if auth_type not in auths:
            link.send_msg(gen.failure(gen.string('unknown auth type: %s' % auth_type)))
            continue

        auth = auths[auth_type](link, auth_db)

        user = auth.do_auth()
        if user:
            return user
Ejemplo n.º 6
0
def perform_auth(link, auth_db):
    """


    :type link: SvnRequestHandler
    :rtype : User
    """
    link.send_msg(
        gen.success(gen.list(*auths.keys()), gen.string(link.base_url)))

    while True:
        auth_type = parse.msg(link.read_msg())[0]

        if auth_type not in auths:
            link.send_msg(
                gen.failure(gen.string('unknown auth type: %s' % auth_type)))
            continue

        auth = auths[auth_type](link, auth_db)

        user = auth.do_auth()
        if user:
            return user