Skip to content

Add a custom schema to SlapdObject with a slapadd method? #373

Closed
@azmeuk

Description

@azmeuk

Operating system: Archlinux
Python version: 3.8.5
python-ldap version: 3.3.0

I wrote a custom schema and I would like to write some tests using this schema.

I can manage to do this by copying or linking my schema files in SlapdObject.SCHEMA_DIR before the process is launched. However this is not convenient at all (see next comment).

The ldapadd command cannot add schemas:

RuntimeError: ['/usr/bin/ldapadd', '-H', 'ldapi://%2Fhome%2Feloi%2Fdev%2Fyaal%2Foidc-ldap-bridge%2Fpython-ldap-test-52629%2Fldapi', '-Y', 'EXTERNAL', '-Q'] process failed:
b'adding new entry "cn=oauth,cn=schema,cn=config"\n\n'
b'ldap_add: Insufficient access (50)\n'

However, the slapadd command could. I suggest to implement a SlapdObject.slapadd method, similar to SlapdObject.ldapadd. This would allow to call slapadd -l myschema.ldif -n0 (-n0 being an option, that could be used to add the schema in the config database). This way, one could add a schema to the slapd server test after it is started.

If ldapadd seems too much, maybe we can just find a mechanism to simply add custom schemas by configuring or passing parameters to SlapdObject?

If you are ok with this, I can provide a patch.
What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions