ldap_server.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:synapse-ldap-password-provider 作者: slipeer 项目源码 文件源码
def get_reactor():
    """
    :returns: the twisted reactor and the port number for the LDAP server
    :rtype: tuple
    """
    from twisted.internet import reactor
    # We initialize our tree
    tree = Tree()
    # When the LDAP Server protocol wants to manipulate the DIT, it invokes
    # `root = interfaces.IConnectedLDAPEntry(self.factory)` to get the root
    # of the DIT.  The factory that creates the protocol must therefore
    # be adapted to the IConnectedLDAPEntry interface.
    registerAdapter(
        lambda x: x.root,
        LDAPServerFactory,
        IConnectedLDAPEntry)
    factory = LDAPServerFactory(tree.db)
    factory.debug = False
    listener = reactor.listenTCP(0, factory)
    port = listener.getHost().port
    return reactor, port
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号