Skip to content

Commit b674346

Browse files
committed
rootdn can add schemas
1 parent 071a2b7 commit b674346

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Added
1010
*****
1111

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

1415
[0.1.0] - 2021-04-02
1516
====================

slapd/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
cn: module
3030
olcModuleLoad: back_%(database)s
3131
32+
dn: olcDatabase=config,cn=config
33+
objectClass: olcDatabaseConfig
34+
olcDatabase: config
35+
olcRootDN: %(rootdn)s
36+
3237
dn: olcDatabase=%(database)s,cn=config
3338
objectClass: olcDatabaseConfig
3439
objectClass: olcMdbConfig

tests/test_slapdobject.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,42 @@ def test_commands():
7878
server.stop()
7979

8080

81+
def test_ldapadd_config_database():
82+
server = slapd.Slapd()
83+
server.start()
84+
85+
assert "dn: cn={1}myschema,cn=schema,cn=config" not in server.slapcat(
86+
["-n0"]
87+
).stdout.decode("utf-8")
88+
89+
ldif = (
90+
"dn: cn=myschema,cn=schema,cn=config\n"
91+
"objectClass: olcSchemaConfig\n"
92+
"cn: myschema\n"
93+
"olcAttributeTypes: ( 1.3.6.1.4.1.56207.1.1.1 NAME 'myAttribute'\n"
94+
" EQUALITY caseExactMatch\n"
95+
" ORDERING caseExactOrderingMatch\n"
96+
" SUBSTR caseExactSubstringsMatch\n"
97+
" SYNTAX 1.3.6.1.4.1.1466.115.121.1.15\n"
98+
" SINGLE-VALUE\n"
99+
" USAGE userApplications\n"
100+
" X-ORIGIN 'mySchema1' )\n"
101+
"olcObjectClasses: ( 1.3.6.1.4.1.56207.1.1.2 NAME 'myObject'\n"
102+
" SUP top\n"
103+
" STRUCTURAL\n"
104+
" MUST (\n"
105+
" cn $\n"
106+
" myAttribute\n"
107+
" )\n"
108+
" X-ORIGIN 'mySchema2' )\n"
109+
)
110+
server.ldapadd(ldif)
111+
112+
assert "dn: cn={1}myschema,cn=schema,cn=config" in server.slapcat(
113+
["-n0"]
114+
).stdout.decode("utf-8")
115+
116+
81117
def test_return_codes():
82118
server = slapd.Slapd()
83119
server.start()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy