Skip to content

rootdn can add schemas #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Added
*****

- Added `ldapsearch` command. :pr:`4`
- The root DN can add schemas. :pr:`5`

[0.1.0] - 2021-04-02
====================
Expand Down
5 changes: 5 additions & 0 deletions slapd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
cn: module
olcModuleLoad: back_%(database)s

dn: olcDatabase=config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: config
olcRootDN: %(rootdn)s

dn: olcDatabase=%(database)s,cn=config
objectClass: olcDatabaseConfig
objectClass: olcMdbConfig
Expand Down
36 changes: 36 additions & 0 deletions tests/test_slapdobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,42 @@ def test_commands():
server.stop()


def test_ldapadd_config_database():
server = slapd.Slapd()
server.start()

assert "dn: cn={1}myschema,cn=schema,cn=config" not in server.slapcat(
["-n0"]
).stdout.decode("utf-8")

ldif = (
"dn: cn=myschema,cn=schema,cn=config\n"
"objectClass: olcSchemaConfig\n"
"cn: myschema\n"
"olcAttributeTypes: ( 1.3.6.1.4.1.56207.1.1.1 NAME 'myAttribute'\n"
" EQUALITY caseExactMatch\n"
" ORDERING caseExactOrderingMatch\n"
" SUBSTR caseExactSubstringsMatch\n"
" SYNTAX 1.3.6.1.4.1.1466.115.121.1.15\n"
" SINGLE-VALUE\n"
" USAGE userApplications\n"
" X-ORIGIN 'mySchema1' )\n"
"olcObjectClasses: ( 1.3.6.1.4.1.56207.1.1.2 NAME 'myObject'\n"
" SUP top\n"
" STRUCTURAL\n"
" MUST (\n"
" cn $\n"
" myAttribute\n"
" )\n"
" X-ORIGIN 'mySchema2' )\n"
)
server.ldapadd(ldif)

assert "dn: cn={1}myschema,cn=schema,cn=config" in server.slapcat(
["-n0"]
).stdout.decode("utf-8")


def test_return_codes():
server = slapd.Slapd()
server.start()
Expand Down