Beispiel #1
0
 def setUp(self):
     self.root = inmemory.ReadOnlyInMemoryLDAPEntry(dn='dc=example,dc=com',
                                                    attributes={
                                                        'dc': 'example',
                                                    })
     self.stuff = self.root.addChild(rdn='ou=stuff',
                                     attributes={
                                         'objectClass': ['a', 'b'],
                                         'ou': ['stuff'],
                                     })
     self.thingie = self.stuff.addChild(rdn='cn=thingie',
                                        attributes={
                                            'objectClass': ['a', 'b'],
                                            'cn': ['thingie'],
                                        })
     self.another = self.stuff.addChild(rdn='cn=another',
                                        attributes={
                                            'objectClass': ['a', 'b'],
                                            'cn': ['another'],
                                        })
     server = ldapserver.LDAPServer()
     server.factory = self.root
     server.transport = proto_helpers.StringTransport()
     server.connectionMade()
     self.server = server
Beispiel #2
0
    def setUp(self):
        self.root = inmemory.ReadOnlyInMemoryLDAPEntry(
            dn='dc=example,dc=com', attributes={'dc': 'example'})
        self.stuff = self.root.addChild(rdn='ou=stuff',
                                        attributes={
                                            'objectClass': ['a', 'b'],
                                            'ou': ['stuff'],
                                        })
        self.thingie = self.stuff.addChild(rdn='cn=thingie',
                                           attributes={
                                               'objectClass': ['a', 'b'],
                                               'cn': ['thingie'],
                                           })
        self.another = self.stuff.addChild(rdn='cn=another',
                                           attributes={
                                               'objectClass': ['a', 'b'],
                                               'cn': ['another'],
                                           })

        # Add Users Subtree
        self.users = self.root.addChild(rdn='ou=People',
                                        attributes={
                                            'objectClass':
                                            ['top', 'organizationalunit'],
                                            'ou': ['People']
                                        })

        self.users.addChild(rdn='uid=kthompson',
                            attributes={
                                'objectClass': ['top', 'inetOrgPerson'],
                                'uid': ['kthompson']
                            })

        self.users.addChild(rdn='uid=bgates',
                            attributes={
                                'objectClass': ['top', 'inetOrgPerson'],
                                'uid': ['bgates']
                            })

        # Add Groups Subtree
        self.groups = self.root.addChild(rdn='ou=Groups',
                                         attributes={
                                             'objectClass':
                                             ['top', 'organizationalunit'],
                                             'ou': ['Groups']
                                         })

        self.groups.addChild(rdn='cn=unix',
                             attributes={
                                 'uniquemember':
                                 ['uid=kthompson,ou=People,dc=example,dc=com'],
                                 'objectClass': ['top', 'groupOfUniqueNames'],
                                 'cn': ['unix']
                             })

        server = ldapserver.LDAPServer()
        server.factory = self.root
        server.transport = proto_helpers.StringTransport()
        server.connectionMade()
        self.server = server
Beispiel #3
0
    def setUp(self):
        self.root = inmemory.ReadOnlyInMemoryLDAPEntry(
            dn="dc=example,dc=com", attributes={"dc": "example"})
        self.stuff = self.root.addChild(
            rdn="ou=stuff",
            attributes={
                b"objectClass": [b"a", b"b"],
                b"ou": [b"stuff"],
            },
        )
        self.thingie = self.stuff.addChild(
            rdn="cn=thingie",
            attributes={
                "objectClass": ["a", "b"],
                "cn": ["thingie"],
            },
        )
        self.another = self.stuff.addChild(
            rdn="cn=another",
            attributes={
                "objectClass": ["a", "b"],
                "cn": ["another"],
            },
        )

        # Add Users Subtree
        self.users = self.root.addChild(
            rdn="ou=People",
            attributes={
                "objectClass": ["top", "organizationalunit"],
                "ou": ["People"]
            },
        )

        self.users.addChild(
            rdn="uid=kthompson",
            attributes={
                "objectClass": ["top", "inetOrgPerson"],
                "uid": ["kthompson"]
            },
        )

        self.users.addChild(
            rdn="uid=bgates",
            attributes={
                "objectClass": ["top", "inetOrgPerson"],
                "uid": ["bgates"]
            },
        )

        # Add Groups Subtree
        self.groups = self.root.addChild(
            rdn="ou=Groups",
            attributes={
                "objectClass": ["top", "organizationalunit"],
                "ou": ["Groups"]
            },
        )

        self.groups.addChild(
            rdn="cn=unix",
            attributes={
                "uniquemember": ["uid=kthompson,ou=People,dc=example,dc=com"],
                "objectClass": ["top", "groupOfUniqueNames"],
                "cn": ["unix"],
            },
        )

        server = ldapserver.LDAPServer()
        server.factory = self.root
        server.transport = proto_helpers.StringTransport()
        server.connectionMade()
        self.server = server