From ea069cb7c2731d54d20d41cd49936914ab78edb3 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 4 Jun 2000 22:59:38 +0000 Subject: [PATCH] New indexer/filter codes (test suite works) with cheats Updated NT Project files (with Cyrus SASL library depend) --- build/main.dsw | 81 ++-- clients/tools/ldapdelete.dsp | 8 +- clients/tools/ldapmodify.dsp | 8 +- clients/tools/ldapmodrdn.dsp | 8 +- clients/tools/ldappasswd.dsp | 8 +- clients/tools/ldapsearch.dsp | 8 +- clients/ud/ud.dsp | 8 +- doc/drafts/README | 3 +- include/ldap_defaults.h | 2 +- include/portable.nt | 5 +- libraries/libldap/apitest.dsp | 8 +- libraries/libldap/ltest.dsp | 8 +- libraries/libldap/test.c | 1 - libraries/libldap_r/apitest_r.dsp | 8 +- libraries/libldap_r/ltest_r.dsp | 12 +- libraries/liblunicode/Makefile.in | 3 - servers/slapd/Makefile.in | 4 +- servers/slapd/ad.c | 1 + servers/slapd/back-ldbm/Makefile.in | 4 +- servers/slapd/back-ldbm/add.c | 9 +- servers/slapd/back-ldbm/attr.c | 294 +++++++++------ servers/slapd/back-ldbm/back-ldbm.h | 22 +- servers/slapd/back-ldbm/backldbm.dsp | 8 +- servers/slapd/back-ldbm/config.c | 5 +- servers/slapd/back-ldbm/dbcache.c | 6 +- servers/slapd/back-ldbm/filterindex.c | 333 ++++++++++++++--- servers/slapd/back-ldbm/idl.c | 177 +++++++-- servers/slapd/back-ldbm/index.c | 426 ++++++++++++++++++---- servers/slapd/back-ldbm/init.c | 20 +- servers/slapd/back-ldbm/key.c | 80 ++++ servers/slapd/back-ldbm/modify.c | 80 +--- servers/slapd/back-ldbm/proto-back-ldbm.h | 62 +++- servers/slapd/back-ldbm/tools.c | 35 +- servers/slapd/entry.c | 2 +- servers/slapd/filterentry.c | 5 +- servers/slapd/index.c | 68 ++++ servers/slapd/libslapd.dsp | 8 + servers/slapd/proto-slap.h | 7 + servers/slapd/schema_init.c | 251 ++++++++++++- servers/slapd/slap.h | 57 ++- servers/slapd/slapd.dsp | 8 +- servers/slapd/tools/Makefile.in | 2 +- servers/slapd/tools/ldbmtest.dsp | 8 +- servers/slapd/tools/ldif.dsp | 8 +- servers/slapd/tools/slapadd.dsp | 8 +- servers/slapd/tools/slapcat.dsp | 8 +- servers/slapd/tools/slapindex.c | 31 +- servers/slapd/tools/slapindex.dsp | 8 +- tests/data/slapd-acl.conf | 3 +- tests/data/slapd-master.conf | 4 +- tests/data/slapd-pw.conf | 3 +- tests/data/slapd-ref-slave.conf | 4 +- tests/data/slapd-repl-master.conf | 4 +- tests/data/slapd-repl-slave.conf | 4 +- 54 files changed, 1665 insertions(+), 581 deletions(-) create mode 100644 servers/slapd/back-ldbm/key.c create mode 100644 servers/slapd/index.c diff --git a/build/main.dsw b/build/main.dsw index e666a012d3..0183427447 100644 --- a/build/main.dsw +++ b/build/main.dsw @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 5.00 ############################################################################### -Project: "apitest"="..\libraries\libldap\apitest.dsp" - Package Owner=<4> +Project: "apitest"=..\libraries\libldap\apitest.dsp - Package Owner=<4> Package=<5> {{{ @@ -21,7 +21,7 @@ Package=<4> ############################################################################### -Project: "apitest_r"="..\libraries\libldap_r\apitest_r.dsp" - Package Owner=<4> +Project: "apitest_r"=..\libraries\libldap_r\apitest_r.dsp - Package Owner=<4> Package=<5> {{{ @@ -51,19 +51,7 @@ Package=<4> ############################################################################### -Project: "backsql"="..\servers\slapd\back-sql\backsql.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "build"=".\build.dsp" - Package Owner=<4> +Project: "build"=.\build.dsp - Package Owner=<4> Package=<5> {{{ @@ -147,7 +135,7 @@ Package=<4> ############################################################################### -Project: "dtest"="..\libraries\liblber\dtest.dsp" - Package Owner=<4> +Project: "dtest"=..\libraries\liblber\dtest.dsp - Package Owner=<4> Package=<5> {{{ @@ -162,7 +150,7 @@ Package=<4> ############################################################################### -Project: "etest"="..\libraries\liblber\etest.dsp" - Package Owner=<4> +Project: "etest"=..\libraries\liblber\etest.dsp - Package Owner=<4> Package=<5> {{{ @@ -177,7 +165,7 @@ Package=<4> ############################################################################### -Project: "ldapdelete"="..\clients\tools\ldapdelete.dsp" - Package Owner=<4> +Project: "ldapdelete"=..\clients\tools\ldapdelete.dsp - Package Owner=<4> Package=<5> {{{ @@ -198,7 +186,7 @@ Package=<4> ############################################################################### -Project: "ldapmodify"="..\clients\tools\ldapmodify.dsp" - Package Owner=<4> +Project: "ldapmodify"=..\clients\tools\ldapmodify.dsp - Package Owner=<4> Package=<5> {{{ @@ -222,7 +210,7 @@ Package=<4> ############################################################################### -Project: "ldapmodrdn"="..\clients\tools\ldapmodrdn.dsp" - Package Owner=<4> +Project: "ldapmodrdn"=..\clients\tools\ldapmodrdn.dsp - Package Owner=<4> Package=<5> {{{ @@ -243,7 +231,7 @@ Package=<4> ############################################################################### -Project: "ldappasswd"="..\clients\tools\ldappasswd.dsp" - Package Owner=<4> +Project: "ldappasswd"=..\clients\tools\ldappasswd.dsp - Package Owner=<4> Package=<5> {{{ @@ -264,7 +252,7 @@ Package=<4> ############################################################################### -Project: "ldapsearch"="..\clients\tools\ldapsearch.dsp" - Package Owner=<4> +Project: "ldapsearch"=..\clients\tools\ldapsearch.dsp - Package Owner=<4> Package=<5> {{{ @@ -288,7 +276,7 @@ Package=<4> ############################################################################### -Project: "ldbmtest"="..\servers\slapd\tools\ldbmtest.dsp" - Package Owner=<4> +Project: "ldbmtest"=..\servers\slapd\tools\ldbmtest.dsp - Package Owner=<4> Package=<5> {{{ @@ -320,14 +308,11 @@ Package=<4> Begin Project Dependency Project_Dep_Name libldif End Project Dependency - Begin Project Dependency - Project_Dep_Name backsql - End Project Dependency }}} ############################################################################### -Project: "ldif"="..\servers\slapd\tools\ldif.dsp" - Package Owner=<4> +Project: "ldif"=..\servers\slapd\tools\ldif.dsp - Package Owner=<4> Package=<5> {{{ @@ -351,7 +336,7 @@ Package=<4> ############################################################################### -Project: "libavl"="..\libraries\libavl\libavl.dsp" - Package Owner=<4> +Project: "libavl"=..\libraries\libavl\libavl.dsp - Package Owner=<4> Package=<5> {{{ @@ -366,7 +351,7 @@ Package=<4> ############################################################################### -Project: "liblber"="..\libraries\liblber\liblber.dsp" - Package Owner=<4> +Project: "liblber"=..\libraries\liblber\liblber.dsp - Package Owner=<4> Package=<5> {{{ @@ -381,7 +366,7 @@ Package=<4> ############################################################################### -Project: "libldap"="..\libraries\libldap\libldap.dsp" - Package Owner=<4> +Project: "libldap"=..\libraries\libldap\libldap.dsp - Package Owner=<4> Package=<5> {{{ @@ -396,7 +381,7 @@ Package=<4> ############################################################################### -Project: "libldap_r"="..\libraries\libldap_r\libldap_r.dsp" - Package Owner=<4> +Project: "libldap_r"=..\libraries\libldap_r\libldap_r.dsp - Package Owner=<4> Package=<5> {{{ @@ -411,7 +396,7 @@ Package=<4> ############################################################################### -Project: "libldbm"="..\libraries\libldbm\libldbm.dsp" - Package Owner=<4> +Project: "libldbm"=..\libraries\libldbm\libldbm.dsp - Package Owner=<4> Package=<5> {{{ @@ -426,7 +411,7 @@ Package=<4> ############################################################################### -Project: "libldif"="..\libraries\libldif\libldif.dsp" - Package Owner=<4> +Project: "libldif"=..\libraries\libldif\libldif.dsp - Package Owner=<4> Package=<5> {{{ @@ -471,7 +456,7 @@ Package=<4> ############################################################################### -Project: "libslapd"="..\servers\slapd\libslapd.dsp" - Package Owner=<4> +Project: "libslapd"=..\servers\slapd\libslapd.dsp - Package Owner=<4> Package=<5> {{{ @@ -486,7 +471,7 @@ Package=<4> ############################################################################### -Project: "ltest"="..\libraries\libldap\ltest.dsp" - Package Owner=<4> +Project: "ltest"=..\libraries\libldap\ltest.dsp - Package Owner=<4> Package=<5> {{{ @@ -507,7 +492,7 @@ Package=<4> ############################################################################### -Project: "ltest_r"="..\libraries\libldap_r\ltest_r.dsp" - Package Owner=<4> +Project: "ltest_r"=..\libraries\libldap_r\ltest_r.dsp - Package Owner=<4> Package=<5> {{{ @@ -558,7 +543,7 @@ Package=<4> ############################################################################### -Project: "slapadd"="..\servers\slapd\tools\slapadd.dsp" - Package Owner=<4> +Project: "slapadd"=..\servers\slapd\tools\slapadd.dsp - Package Owner=<4> Package=<5> {{{ @@ -590,14 +575,11 @@ Package=<4> Begin Project Dependency Project_Dep_Name libslapd End Project Dependency - Begin Project Dependency - Project_Dep_Name backsql - End Project Dependency }}} ############################################################################### -Project: "slapcat"="..\servers\slapd\tools\slapcat.dsp" - Package Owner=<4> +Project: "slapcat"=..\servers\slapd\tools\slapcat.dsp - Package Owner=<4> Package=<5> {{{ @@ -629,14 +611,11 @@ Package=<4> Begin Project Dependency Project_Dep_Name backldbm End Project Dependency - Begin Project Dependency - Project_Dep_Name backsql - End Project Dependency }}} ############################################################################### -Project: "slapd"="..\servers\slapd\slapd.dsp" - Package Owner=<4> +Project: "slapd"=..\servers\slapd\slapd.dsp - Package Owner=<4> Package=<5> {{{ @@ -671,14 +650,11 @@ Package=<4> Begin Project Dependency Project_Dep_Name libslapd End Project Dependency - Begin Project Dependency - Project_Dep_Name backsql - End Project Dependency }}} ############################################################################### -Project: "slapindex"="..\servers\slapd\tools\slapindex.dsp" - Package Owner=<4> +Project: "slapindex"=..\servers\slapd\tools\slapindex.dsp - Package Owner=<4> Package=<5> {{{ @@ -710,14 +686,11 @@ Package=<4> Begin Project Dependency Project_Dep_Name libslapd End Project Dependency - Begin Project Dependency - Project_Dep_Name backsql - End Project Dependency }}} ############################################################################### -Project: "testavl"="..\libraries\libavl\testavl.dsp" - Package Owner=<4> +Project: "testavl"=..\libraries\libavl\testavl.dsp - Package Owner=<4> Package=<5> {{{ @@ -732,7 +705,7 @@ Package=<4> ############################################################################### -Project: "ud"="..\clients\ud\ud.dsp" - Package Owner=<4> +Project: "ud"=..\clients\ud\ud.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/clients/tools/ldapdelete.dsp b/clients/tools/ldapdelete.dsp index 562d0f0375..af7b4be030 100644 --- a/clients/tools/ldapdelete.dsp +++ b/clients/tools/ldapdelete.dsp @@ -56,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "ldapdelete - Win32 Single Release" @@ -81,7 +81,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" -# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 /out:"SRelease/ldapdelete.exe" /libpath:"..\..\SRelease" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"SRelease/ldapdelete.exe" /libpath:"..\..\SRelease" !ELSEIF "$(CFG)" == "ldapdelete - Win32 Debug" @@ -106,7 +106,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "ldapdelete - Win32 Release" @@ -131,7 +131,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapdelete.exe" /libpath:"..\..\libraries\Release" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapdelete.exe" /libpath:"..\..\Release" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapdelete.exe" /libpath:"..\..\Release" !ENDIF diff --git a/clients/tools/ldapmodify.dsp b/clients/tools/ldapmodify.dsp index 0211710226..9a58a7060f 100644 --- a/clients/tools/ldapmodify.dsp +++ b/clients/tools/ldapmodify.dsp @@ -56,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"SDebug/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"SDebug/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "ldapmodify - Win32 Single Release" @@ -81,7 +81,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"SRelease/ldapmodify.exe" /libpath:"..\..\SRelease" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"SRelease/ldapmodify.exe" /libpath:"..\..\SRelease" !ELSEIF "$(CFG)" == "ldapmodify - Win32 Debug" @@ -106,7 +106,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Release/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/ldapmodify.exe" /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "ldapmodify - Win32 Release" @@ -131,7 +131,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\libraries\Release" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\Release" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodify.exe" /libpath:"..\..\Release" !ENDIF diff --git a/clients/tools/ldapmodrdn.dsp b/clients/tools/ldapmodrdn.dsp index 08a0a0a746..bcf0cc01cc 100644 --- a/clients/tools/ldapmodrdn.dsp +++ b/clients/tools/ldapmodrdn.dsp @@ -56,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Single Release" @@ -81,7 +81,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\SRelease" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\SRelease" !ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Debug" @@ -106,7 +106,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "ldapmodrdn - Win32 Release" @@ -131,7 +131,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\libraries\Release" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\Release" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapmodrdn.exe" /libpath:"..\..\Release" !ENDIF diff --git a/clients/tools/ldappasswd.dsp b/clients/tools/ldappasswd.dsp index 4666a7d9b1..df406dfe5f 100644 --- a/clients/tools/ldappasswd.dsp +++ b/clients/tools/ldappasswd.dsp @@ -55,7 +55,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "ldappasswd - Win32 Debug" @@ -79,7 +79,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "ldappasswd - Win32 Single Debug" @@ -103,7 +103,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "ldappasswd - Win32 Single Release" @@ -127,7 +127,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ENDIF diff --git a/clients/tools/ldapsearch.dsp b/clients/tools/ldapsearch.dsp index 354d49849c..d3918c8e45 100644 --- a/clients/tools/ldapsearch.dsp +++ b/clients/tools/ldapsearch.dsp @@ -56,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "ldapsearch - Win32 Single Release" @@ -81,7 +81,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ELSEIF "$(CFG)" == "ldapsearch - Win32 Release" @@ -106,7 +106,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "ldapsearch - Win32 Debug" @@ -131,7 +131,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"Release/ldapsearch.exe" /libpath:"..\..\libraries\SRelease" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /incremental:yes /debug /machine:I386 /libpath:"..\..\Debug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /incremental:yes /debug /machine:I386 /libpath:"..\..\Debug" !ENDIF diff --git a/clients/ud/ud.dsp b/clients/ud/ud.dsp index 3c3cda5e4a..2513226ad6 100644 --- a/clients/ud/ud.dsp +++ b/clients/ud/ud.dsp @@ -52,7 +52,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib hs_regex.lib sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "ud - Win32 Debug" @@ -76,7 +76,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "ud - Win32 Single Release" @@ -101,7 +101,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release" -# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib hs_regex.lib sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ELSEIF "$(CFG)" == "ud - Win32 Single Debug" @@ -126,7 +126,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug" -# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ENDIF diff --git a/doc/drafts/README b/doc/drafts/README index 787c6e1e63..cfe85242af 100644 --- a/doc/drafts/README +++ b/doc/drafts/README @@ -9,7 +9,8 @@ or to cite them other than as "work in progress." OpenLDAP maintains copies of drafts for which we have and/or are planning "experimental" implementations of. The I-D -found in this directory may be stale. +found in this directory may be stale, expired, or otherwise +out of date. Please refer to http://www.ietf.org/ for latest revisions (and status). diff --git a/include/ldap_defaults.h b/include/ldap_defaults.h index 13d9d4fd93..dd1a9a2e4d 100644 --- a/include/ldap_defaults.h +++ b/include/ldap_defaults.h @@ -202,7 +202,7 @@ Please try again later.\r\n" /* default timelimit to spend on a search */ #define SLAPD_DEFAULT_TIMELIMIT 3600 /* minimum max ids that a single index entry can map to in ldbm */ -#define SLAPD_LDBM_MIN_MAXIDS 4000 +#define SLAPD_LDBM_MIN_MAXIDS (8192-4) /* the following DNs must be normalized! */ /* dn of the special "schema" entry */ diff --git a/include/portable.nt b/include/portable.nt index 208edae104..03d8cc395c 100644 --- a/include/portable.nt +++ b/include/portable.nt @@ -21,6 +21,9 @@ #define SLAPD_SCHEMA_NOT_COMPAT 1 #endif +/* comment this out if you don't have Cyrus SASL */ +#define HAVE_CYRUS_SASL 1 + /* --------------------------------------------------- */ /* begin of MSVC5 specific entries */ @@ -277,7 +280,7 @@ typedef signed int ssize_t; #define SLAPD_LDBM 1 /* define this to use SLAPD SQL backend */ -#define SLAPD_SQL 1 +/* #undef SLAPD_SQL */ /* define this to use SLAPD passwd backend */ /* #undef SLAPD_PASSWD */ diff --git a/libraries/libldap/apitest.dsp b/libraries/libldap/apitest.dsp index c1d7787b19..b191770b53 100644 --- a/libraries/libldap/apitest.dsp +++ b/libraries/libldap/apitest.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 oldap32.lib olber32.lib sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "apitest - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 oldap32.lib olber32.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "apitest - Win32 Single Debug" @@ -102,7 +102,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" -# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 oldap32.lib olber32.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "apitest - Win32 Single Release" @@ -127,7 +127,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" -# ADD LINK32 oldap32.lib olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 oldap32.lib olber32.lib sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ENDIF diff --git a/libraries/libldap/ltest.dsp b/libraries/libldap/ltest.dsp index 0c44a663a8..16e6f1444c 100644 --- a/libraries/libldap/ltest.dsp +++ b/libraries/libldap/ltest.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "ltest - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "ltest - Win32 Single Release" @@ -101,7 +101,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" -# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ELSEIF "$(CFG)" == "ltest - Win32 Single Debug" @@ -125,7 +125,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" -# ADD LINK32 hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ENDIF diff --git a/libraries/libldap/test.c b/libraries/libldap/test.c index cdcadc9fb2..80aa857011 100644 --- a/libraries/libldap/test.c +++ b/libraries/libldap/test.c @@ -232,7 +232,6 @@ static int bind_prompt( LDAP *ld, LDAP_CONST char *url, int request, ber_int_t msgid) { static char dn[256], passwd[256]; - char *dnp; int authmethod; printf("rebind for request=%d msgid=%ld url=%s\n", diff --git a/libraries/libldap_r/apitest_r.dsp b/libraries/libldap_r/apitest_r.dsp index f89b342e83..3dbf1866e8 100644 --- a/libraries/libldap_r/apitest_r.dsp +++ b/libraries/libldap_r/apitest_r.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "apitest_r - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "apitest_r - Win32 Single Debug" @@ -103,7 +103,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap_r.lib olber32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "apitest_r - Win32 Single Release" @@ -128,7 +128,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap_r.lib olber32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" -# ADD LINK32 ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 sasl.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ENDIF diff --git a/libraries/libldap_r/ltest_r.dsp b/libraries/libldap_r/ltest_r.dsp index 87d53dafab..6e5711b030 100644 --- a/libraries/libldap_r/ltest_r.dsp +++ b/libraries/libldap_r/ltest_r.dsp @@ -42,6 +42,7 @@ RSC=rc.exe # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\Release" # PROP Intermediate_Dir "..\..\Release\ltest_r" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -52,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 oldap32.lib olber32.lib olutil32.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "ltest_r - Win32 Debug" @@ -65,6 +66,7 @@ LINK32=link.exe # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\..\Debug" # PROP Intermediate_Dir "..\..\Debug\ltest_r" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c @@ -75,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 oldap32.lib olber32.lib olutil32.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "ltest_r - Win32 Single Debug" @@ -88,6 +90,7 @@ LINK32=link.exe # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\..\SDebug" # PROP Intermediate_Dir "..\..\SDebug\ltest_r" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c @@ -98,7 +101,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\Debug" -# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 oldap32.lib olber32.lib olutil32.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "ltest_r - Win32 Single Release" @@ -111,6 +114,7 @@ LINK32=link.exe # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\SRelease" # PROP Intermediate_Dir "..\..\SRelease\ltest_r" +# PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c @@ -121,7 +125,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\Release" -# ADD LINK32 oldap32.lib olber32.lib olutil32.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 oldap32.lib olber32.lib olutil32.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ENDIF diff --git a/libraries/liblunicode/Makefile.in b/libraries/liblunicode/Makefile.in index dae4846357..4f8b891b28 100644 --- a/libraries/liblunicode/Makefile.in +++ b/libraries/liblunicode/Makefile.in @@ -31,9 +31,6 @@ ucgendat: $(LIBRARY) ucgendat.o $(XXSRCS) : .links clean-local: FORCE - @for i in $(XXSRCS) $(XXHEADERS); do \ - $(RM) $$i ; \ - done @$(RM) .links depend-common: .links diff --git a/servers/slapd/Makefile.in b/servers/slapd/Makefile.in index a91605a7e2..c74463ef39 100644 --- a/servers/slapd/Makefile.in +++ b/servers/slapd/Makefile.in @@ -17,7 +17,7 @@ SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \ repl.c lock.c controls.c extended.c kerberos.c passwd.c \ schema.c schema_check.c schema_init.c schema_prep.c \ schemaparse.c ad.c at.c mr.c syntax.c oc.c \ - monitor.c configinfo.c starttls.c \ + monitor.c configinfo.c starttls.c index.c \ root_dse.c sasl.c module.c suffixalias.c $(@PLAT@_SRCS) OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \ @@ -28,7 +28,7 @@ OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \ repl.o lock.o controls.o extended.o kerberos.o passwd.o \ schema.o schema_check.o schema_init.o schema_prep.o \ schemaparse.o ad.o at.o mr.o syntax.o oc.o \ - monitor.o configinfo.o starttls.o \ + monitor.o configinfo.o starttls.o index.o \ root_dse.o sasl.o module.o suffixalias.o $(@PLAT@_OBJS) LDAP_INCDIR= ../../include diff --git a/servers/slapd/ad.c b/servers/slapd/ad.c index 0a6e04a3e7..f73f0f7ce9 100644 --- a/servers/slapd/ad.c +++ b/servers/slapd/ad.c @@ -149,6 +149,7 @@ int slap_bv2ad( *text = "multiple language tag options specified"; goto done; } + desc.ad_lang = tokens[i]; /* normalize to all lower case, it's easy */ diff --git a/servers/slapd/back-ldbm/Makefile.in b/servers/slapd/back-ldbm/Makefile.in index a8b827c9a6..8acb89f9e7 100644 --- a/servers/slapd/back-ldbm/Makefile.in +++ b/servers/slapd/back-ldbm/Makefile.in @@ -3,12 +3,12 @@ SRCS = idl.c add.c search.c cache.c dbcache.c dn2id.c entry.c id2entry.c \ index.c id2children.c nextid.c abandon.c compare.c group.c \ modify.c modrdn.c delete.c init.c config.c bind.c attr.c \ - filterindex.c unbind.c close.c alias.c tools.c \ + filterindex.c unbind.c close.c alias.c tools.c key.c \ extended.c passwd.c sasl.c OBJS = idl.lo add.lo search.lo cache.lo dbcache.lo dn2id.lo entry.lo id2entry.lo \ index.lo id2children.lo nextid.lo abandon.lo compare.lo group.lo \ modify.lo modrdn.lo delete.lo init.lo config.lo bind.lo attr.lo \ - filterindex.lo unbind.lo close.lo alias.lo tools.lo \ + filterindex.lo unbind.lo close.lo alias.lo tools.lo key.lo \ extended.lo passwd.lo sasl.lo LDAP_INCDIR= ../../../include diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 8ee12c53c3..9dcb616584 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -223,14 +223,9 @@ ldbm_back_add( rc = -1; - /* - * Add the entry to the attribute indexes, then add it to - * the id2children index, dn2id index, and the id2entry index. - */ - /* attribute indexes */ - if ( index_add_entry( be, e ) != 0 ) { - Debug( LDAP_DEBUG_TRACE, "index_add_entry failed\n", 0, + if ( index_entry_add( be, e, e->e_attrs ) != LDAP_SUCCESS ) { + Debug( LDAP_DEBUG_TRACE, "index_entry_add failed\n", 0, 0, 0 ); send_ldap_result( conn, op, LDAP_OTHER, NULL, "index generation failed", NULL, NULL ); diff --git a/servers/slapd/back-ldbm/attr.c b/servers/slapd/back-ldbm/attr.c index 220fd9b461..850c4650cf 100644 --- a/servers/slapd/back-ldbm/attr.c +++ b/servers/slapd/back-ldbm/attr.c @@ -15,19 +15,32 @@ #include "slap.h" #include "back-ldbm.h" + /* for the cache of attribute information (which are indexed, etc.) */ typedef struct ldbm_attrinfo { - char *ai_type; /* type name (cn, sn, ...) */ - int ai_indexmask; /* how the attr is indexed */ +#ifdef SLAPD_USE_AD + AttributeDescription *ai_desc; /* attribute description cn;lang-en */ +#else + char *ai_desc; +#endif + slap_index ai_indexmask; /* how the attr is indexed */ } AttrInfo; static int ainfo_type_cmp( - char *type, +#ifdef SLAPD_USE_AD + AttributeDescription *desc, +#else + char *desc, +#endif AttrInfo *a ) { - return( strcasecmp( type, a->ai_type ) ); +#ifdef SLAPD_USE_AD + return ad_cmp( desc, a->ai_desc ); +#else + return( strcasecmp( desc, a->ai_desc ) ); +#endif } static int @@ -36,150 +49,193 @@ ainfo_cmp( AttrInfo *b ) { - return( strcasecmp( a->ai_type, b->ai_type ) ); -} - -/* - * Called when a duplicate "index" line is encountered. - * - * returns 1 => original from init code, indexmask updated - * 2 => original not from init code, warn the user - */ - -static int -ainfo_dup( - AttrInfo *a, - AttrInfo *b -) -{ - /* - * if the duplicate definition is because we initialized the attr, - * just add what came from the config file. otherwise, complain. - */ - if ( a->ai_indexmask & SLAP_INDEX_FROMINIT ) { - a->ai_indexmask |= b->ai_indexmask; - - return( 1 ); - } - - return( 2 ); +#ifdef SLAPD_USE_AD + return ad_cmp( a->ai_desc, b->ai_desc ); +#else + return( strcasecmp( a->ai_desc, b->ai_desc ) ); +#endif } void attr_mask( struct ldbminfo *li, - const char *type, - int *indexmask ) +#ifdef SLAPD_USE_AD + AttributeDescription *desc, +#else + const char *desc, +#endif + slap_index *indexmask ) { AttrInfo *a; - *indexmask = 0; - if ( (a = (AttrInfo *) avl_find( li->li_attrs, type, - (AVL_CMP) ainfo_type_cmp )) == NULL ) { - if ( (a = (AttrInfo *) avl_find( li->li_attrs, "default", - (AVL_CMP) ainfo_type_cmp )) == NULL ) { - return; - } - } - *indexmask = a->ai_indexmask; + a = (AttrInfo *) avl_find( li->li_attrs, desc, + (AVL_CMP) ainfo_type_cmp ); + + *indexmask = a != NULL ? a->ai_indexmask : 0; } -void +int attr_index_config( struct ldbminfo *li, const char *fname, int lineno, int argc, char **argv, - int init -) + int init ) { - int i, j; - char **attrs, **indexes; - AttrInfo *a; + int rc; + int i; + slap_index mask; + char **attrs; + char **indexes = NULL; attrs = str2charray( argv[0], "," ); + + if( attrs == NULL ) { + fprintf( stderr, "%s: line %d: " + "no attributes specified: %s\n", + fname, lineno, argv[0] ); + return LDAP_PARAM_ERROR; + } + if ( argc > 1 ) { indexes = str2charray( argv[1], "," ); + + if( indexes == NULL ) { + fprintf( stderr, "%s: line %d: " + "no indexes specified: %s\n", + fname, lineno, argv[1] ); + return LDAP_PARAM_ERROR; + } } + + if( indexes == NULL ) { + mask = li->li_defaultmask; + + } else { + mask = 0; + + for ( i = 0; indexes[i] != NULL; i++ ) { + slap_index index; + rc = slap_str2index( indexes[i], &index ); + + if( rc != LDAP_SUCCESS ) { + fprintf( stderr, "%s: line %d: " + "index type \"%s\" undefined\n", + fname, lineno, indexes[i] ); + return LDAP_PARAM_ERROR; + } + + mask |= index; + } + } + + if( !mask ) { + fprintf( stderr, "%s: line %d: " + "no indexes selected\n", + fname, lineno ); + return LDAP_PARAM_ERROR; + } + for ( i = 0; attrs[i] != NULL; i++ ) { + AttrInfo *a; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + AttributeDescription *ad; + const char *text; +#endif + + if( strcasecmp( attrs[i], "default" ) == 0 ) { + li->li_defaultmask = mask; + continue; + } + a = (AttrInfo *) ch_malloc( sizeof(AttrInfo) ); - a->ai_type = ch_strdup( attrs[i] ); - - if ( argc == 1 ) { - a->ai_indexmask = ( - SLAP_INDEX_PRESENCE | SLAP_INDEX_EQUALITY | - SLAP_INDEX_APPROX | SLAP_INDEX_SUBSTR); - } else { - a->ai_indexmask = 0; - for ( j = 0; indexes[j] != NULL; j++ ) { - if ( strncasecmp( indexes[j], - "pres", sizeof("pres")-1 ) == 0 ) - { - a->ai_indexmask |= SLAP_INDEX_PRESENCE; - - } else if ( strncasecmp( indexes[j], - "eq", sizeof("eq")-1 ) == 0 ) - { - a->ai_indexmask |= SLAP_INDEX_EQUALITY; - - } else if ( strncasecmp( indexes[j], - "approx", sizeof("approx")-1 ) == 0 ) - { - a->ai_indexmask |= SLAP_INDEX_APPROX; - - } else if ( strncasecmp( indexes[j], - "sub", sizeof("sub")-1 ) == 0 ) - { - a->ai_indexmask |= SLAP_INDEX_SUBSTR; - - } else if ( strncasecmp( indexes[j], - "none", sizeof("none")-1 ) == 0 ) - { - if ( a->ai_indexmask != 0 ) { - fprintf( stderr, "%s: line %d: " - "index type \"none\" cannot be combined with other types\n", - fname, lineno ); - } - a->ai_indexmask = 0; - - } else { - fprintf( stderr, "%s: line %d: " - "unknown index type \"%s\" (ignored)\n", - fname, lineno, indexes[j] ); - fprintf( stderr, "\tvalid index types are " - "\"pres\", \"eq\", \"approx\", or \"sub\"\n" ); - } - } + +#ifdef SLAPD_SCHEMA_NOT_COMPAT + ad = NULL; + rc = slap_str2ad( attrs[i], &ad, &text ); + + if( rc != LDAP_SUCCESS ) { + fprintf( stderr, "%s: line %d: " + "index attribute \"%s\" undefined\n", + fname, lineno, attrs[i] ); + return rc; } - if ( init ) { - a->ai_indexmask |= SLAP_INDEX_FROMINIT; + if( slap_ad_is_binary( ad ) ) { + fprintf( stderr, "%s: line %d: " + "index of attribute \"%s\" disallowed\n", + fname, lineno, attrs[i] ); + return LDAP_UNWILLING_TO_PERFORM; } - switch (avl_insert( &li->li_attrs, (caddr_t) a, - (AVL_CMP) ainfo_cmp, (AVL_DUP) ainfo_dup )) + if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) && !( + ( ad->ad_type->sat_approx + && ad->ad_type->sat_approx->smr_indexer + && ad->ad_type->sat_approx->smr_filter ) + && ( ad->ad_type->sat_equality + && ad->ad_type->sat_equality->smr_indexer + && ad->ad_type->sat_equality->smr_filter ) ) ) { - case 1: /* duplicate - updating init version */ - free( a->ai_type ); - free( (char *) a ); - break; - - case 2: /* user duplicate - ignore and warn */ - fprintf( stderr, - "%s: line %d: duplicate index definition for attr \"%s\" (ignored)\n", - fname, lineno, a->ai_type ); - free( a->ai_type ); - free( (char *) a ); - break; - - default:; /* inserted ok */ - /* FALL */ + fprintf( stderr, "%s: line %d: " + "approx index of attribute \"%s\" disallowed\n", + fname, lineno, attrs[i] ); + return LDAP_INAPPROPRIATE_MATCHING; + } + + if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) && !( + ad->ad_type->sat_equality + && ad->ad_type->sat_equality->smr_indexer + && ad->ad_type->sat_equality->smr_filter ) ) + { + fprintf( stderr, "%s: line %d: " + "equality index of attribute \"%s\" disallowed\n", + fname, lineno, attrs[i] ); + return LDAP_INAPPROPRIATE_MATCHING; + } + + if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) && !( + ad->ad_type->sat_substr + && ad->ad_type->sat_substr->smr_indexer + && ad->ad_type->sat_substr->smr_filter ) ) + { + fprintf( stderr, "%s: line %d: " + "substr index of attribute \"%s\" disallowed\n", + fname, lineno, attrs[i] ); + return LDAP_INAPPROPRIATE_MATCHING; + } + + Debug( LDAP_DEBUG_CONFIG, "index %s 0x%04x\n", + ad->ad_cname->bv_val, mask, 0 ); + +#ifdef SLAPD_USE_AD + a->ai_desc = ad; +#else + a->ai_desc = ch_strdup( ad->ad_cname->bv_val ); + ad_free( ad, 1 ); +#endif +#else + a->ai_desc = ch_strdup( attrs[i] ); +#endif + + a->ai_indexmask = mask; + + rc = avl_insert( &li->li_attrs, (caddr_t) a, + (AVL_CMP) ainfo_cmp, (AVL_DUP) avl_dup_error ); + + if( rc && !init ) { + fprintf( stderr, "%s: line %d: duplicate index definition " + "for attr \"%s\" (ignored)\n", + fname, lineno, attrs[i] ); + + return LDAP_PARAM_ERROR; } } + charray_free( attrs ); - if ( argc > 1 ) - charray_free( indexes ); + if ( indexes != NULL ) charray_free( indexes ); + + return LDAP_SUCCESS; } @@ -187,7 +243,11 @@ static void ainfo_free( void *attr ) { AttrInfo *ai = attr; - free( ai->ai_type ); +#ifdef SLAPD_USE_AD + ad_free( ai->ai_desc, 1 ); +#else + free( ai->ai_desc ); +#endif free( ai ); } diff --git a/servers/slapd/back-ldbm/back-ldbm.h b/servers/slapd/back-ldbm/back-ldbm.h index b94507711d..efb524cda5 100644 --- a/servers/slapd/back-ldbm/back-ldbm.h +++ b/servers/slapd/back-ldbm/back-ldbm.h @@ -25,23 +25,17 @@ LDAP_BEGIN_DECL #define SUBLEN 3 -#define DN_BASE_PREFIX '=' -#define DN_ONE_PREFIX '@' -#define DN_SUBTREE_PREFIX '?' +#define DN_BASE_PREFIX SLAP_INDEX_EQUALITY_PREFIX +#define DN_ONE_PREFIX '%' +#define DN_SUBTREE_PREFIX '@' /* * there is a single index for each attribute. these prefixes ensure * that there is no collision among keys. */ -#define EQ_PREFIX '=' /* prefix for equality keys */ -#define APPROX_PREFIX '~' /* prefix for approx keys */ -#define SUB_PREFIX '*' /* prefix for substring keys */ -#define CONT_PREFIX '\\' /* prefix for continuation keys */ -/* allow 3 characters per byte + PREFIX + EOS */ -#define CONT_SIZE ( sizeof(long)*3 + 1 + 1 ) - -#define UNKNOWN_PREFIX '?' /* prefix for unknown keys */ +/* allow PREFIX + byte for continuate number */ +#define SLAP_INDEX_CONT_SIZE ( sizeof(SLAP_INDEX_CONT_PREFIX) + sizeof(unsigned char) ) #define DEFAULT_BLOCKSIZE 8192 @@ -113,6 +107,7 @@ struct ldbminfo { ldap_pvt_thread_mutex_t li_root_mutex; ldap_pvt_thread_mutex_t li_add_mutex; int li_mode; + slap_index li_defaultmask; char *li_directory; Cache li_cache; Avlnode *li_attrs; @@ -122,11 +117,6 @@ struct ldbminfo { DBCache li_dbcache[MAXDBCACHE]; ldap_pvt_thread_mutex_t li_dbcache_mutex; ldap_pvt_thread_cond_t li_dbcache_cv; -#if 0 -#if defined(HAVE_BERKELEY_DB) && DB_VERSION_MAJOR >= 2 - DB_ENV *li_db_env; -#endif -#endif }; LDAP_END_DECL diff --git a/servers/slapd/back-ldbm/backldbm.dsp b/servers/slapd/back-ldbm/backldbm.dsp index bc98271e4c..5aeb74523d 100644 --- a/servers/slapd/back-ldbm/backldbm.dsp +++ b/servers/slapd/back-ldbm/backldbm.dsp @@ -220,6 +220,10 @@ SOURCE=.\init.c # End Source File # Begin Source File +SOURCE=.\key.c +# End Source File +# Begin Source File + SOURCE=.\modify.c # End Source File # Begin Source File @@ -244,10 +248,6 @@ SOURCE=.\search.c # End Source File # Begin Source File -SOURCE=.\startup.c -# End Source File -# Begin Source File - SOURCE=.\tools.c # End Source File # Begin Source File diff --git a/servers/slapd/back-ldbm/config.c b/servers/slapd/back-ldbm/config.c index a5e4382752..352bc91561 100644 --- a/servers/slapd/back-ldbm/config.c +++ b/servers/slapd/back-ldbm/config.c @@ -25,6 +25,7 @@ ldbm_back_db_config( char **argv ) { + int rc; struct ldbminfo *li = (struct ldbminfo *) be->be_private; if ( li == NULL ) { @@ -67,7 +68,9 @@ ldbm_back_db_config( "%s: line %d: extra junk after \"index [pres,eq,approx,sub]\" line (ignored)\n", fname, lineno ); } - attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 ); + rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 ); + + if( rc != LDAP_SUCCESS ) return 1; /* size of the cache in entries */ } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) { diff --git a/servers/slapd/back-ldbm/dbcache.c b/servers/slapd/back-ldbm/dbcache.c index 401b78fc22..797af5370b 100644 --- a/servers/slapd/back-ldbm/dbcache.c +++ b/servers/slapd/back-ldbm/dbcache.c @@ -125,8 +125,10 @@ ldbm_cache_open( } li->li_dbcache[i].dbc_maxids = (li->li_dbcache[i].dbc_blksize / sizeof(ID)) - ID_BLOCK_IDS_OFFSET; - li->li_dbcache[i].dbc_maxindirect = (SLAPD_LDBM_MIN_MAXIDS / - li->li_dbcache[i].dbc_maxids) + 1; + li->li_dbcache[i].dbc_maxindirect = ( SLAPD_LDBM_MIN_MAXIDS / + li->li_dbcache[i].dbc_maxids ) + 1; + + assert( li->li_dbcache[i].dbc_maxindirect < 256 ); Debug( LDAP_DEBUG_ARGS, "ldbm_cache_open (blksize %ld) (maxids %d) (maxindirect %d)\n", diff --git a/servers/slapd/back-ldbm/filterindex.c b/servers/slapd/back-ldbm/filterindex.c index 9f8ce75594..57a760659a 100644 --- a/servers/slapd/back-ldbm/filterindex.c +++ b/servers/slapd/back-ldbm/filterindex.c @@ -16,23 +16,29 @@ #include "back-ldbm.h" #ifdef SLAPD_SCHEMA_NOT_COMPAT -ID_BLOCK * -filter_candidates( - Backend *be, - Filter *f ) -{ - return idl_allids( be ); -} - +static ID_BLOCK *presence_candidates( + Backend *be, + AttributeDescription *desc ); +static ID_BLOCK *equality_candidates( + Backend *be, AttributeAssertion *ava ); +static ID_BLOCK *approx_candidates( + Backend *be, AttributeAssertion *ava ); +static ID_BLOCK *substring_candidates( + Backend *be, + Filter *f ); +static ID_BLOCK *list_candidates( + Backend *be, + Filter *flist, + int ftype ); #else - -static ID_BLOCK *ava_candidates( Backend *be, Ava *ava, int type ); static ID_BLOCK *presence_candidates( Backend *be, char *type ); +static ID_BLOCK *equality_candidates( Backend *be, Ava *ava ); static ID_BLOCK *approx_candidates( Backend *be, Ava *ava ); static ID_BLOCK *list_candidates( Backend *be, Filter *flist, int ftype ); static ID_BLOCK *substring_candidates( Backend *be, Filter *f ); static ID_BLOCK *substring_comp_candidates( Backend *be, char *type, struct berval *val, int prepost ); +#endif ID_BLOCK * filter_candidates( @@ -56,9 +62,27 @@ filter_candidates( result = dn2idl( be, f->f_dn, DN_SUBTREE_PREFIX ); break; + case LDAP_FILTER_PRESENT: + Debug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 ); + result = presence_candidates( be, f->f_desc ); + break; + case LDAP_FILTER_EQUALITY: Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 ); - result = ava_candidates( be, &f->f_ava, LDAP_FILTER_EQUALITY ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + result = equality_candidates( be, f->f_ava ); +#else + result = equality_candidates( be, &f->f_ava ); +#endif + break; + + case LDAP_FILTER_APPROX: + Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + result = approx_candidates( be, f->f_ava ); +#else + result = approx_candidates( be, &f->f_ava ); +#endif break; case LDAP_FILTER_SUBSTRINGS: @@ -68,22 +92,12 @@ filter_candidates( case LDAP_FILTER_GE: Debug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 ); - result = ava_candidates( be, &f->f_ava, LDAP_FILTER_GE ); + result = idl_allids( be ); break; case LDAP_FILTER_LE: Debug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 ); - result = ava_candidates( be, &f->f_ava, LDAP_FILTER_LE ); - break; - - case LDAP_FILTER_PRESENT: - Debug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 ); - result = presence_candidates( be, f->f_type ); - break; - - case LDAP_FILTER_APPROX: - Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 ); - result = approx_candidates( be, &f->f_ava ); + result = idl_allids( be ); break; case LDAP_FILTER_AND: @@ -112,49 +126,145 @@ filter_candidates( } static ID_BLOCK * -ava_candidates( +presence_candidates( Backend *be, - Ava *ava, - int type +#ifdef SLAPD_SCHEMA_NOT_COMPAT + AttributeDescription *desc +#else + char *desc +#endif ) { ID_BLOCK *idl; - Debug( LDAP_DEBUG_TRACE, "=> ava_candidates 0x%x\n", type, 0, 0 ); - - switch ( type ) { - case LDAP_FILTER_EQUALITY: - idl = index_read( be, ava->ava_type, SLAP_INDEX_EQUALITY, - ava->ava_value.bv_val ); - break; - - case LDAP_FILTER_GE: - idl = idl_allids( be ); - break; + Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 ); - case LDAP_FILTER_LE: - idl = idl_allids( be ); - break; - } +#ifdef SLAPD_SCHEMA_NOT_COMPAT + idl = idl_allids( be ); +#else + idl = index_read( be, desc, SLAP_INDEX_PRESENT, NULL ); +#endif - Debug( LDAP_DEBUG_TRACE, "<= ava_candidates %ld\n", + Debug( LDAP_DEBUG_TRACE, "<= presence_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } static ID_BLOCK * -presence_candidates( +equality_candidates( Backend *be, - char *type +#ifdef SLAPD_SCHEMA_NOT_COMPAT + AttributeAssertion *ava +#else + Ava *ava +#endif ) { ID_BLOCK *idl; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + DBCache *db; + int i; + int rc; + char *dbname; + slap_index mask; + struct berval *prefix; + struct berval **keys = NULL; + MatchingRule *mr; +#endif - Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_TRACE, "=> equality_candidates\n", 0, 0, 0 ); - idl = index_read( be, type, SLAP_INDEX_PRESENCE, "*" ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + idl = idl_allids( be ); - Debug( LDAP_DEBUG_TRACE, "<= presence_candidates %ld\n", + rc = index_param( be, ava->aa_desc, LDAP_FILTER_EQUALITY, + &dbname, &mask, &prefix ); + + if( rc != LDAP_SUCCESS ) { + return idl; + } + + if( dbname == NULL ) { + /* not indexed */ + return idl; + } + + mr = ava->aa_desc->ad_type->sat_equality; + if( !mr ) { + /* return LDAP_INAPPROPRIATE_MATCHING; */ + return idl; + } + + if( !mr->smr_filter ) { + return idl; + } + + rc = (mr->smr_filter)( + LDAP_FILTER_EQUALITY, + ava->aa_desc->ad_type->sat_syntax, + mr, + prefix, + ava->aa_value, + &keys ); + + if( rc != LDAP_SUCCESS ) { + return idl; + } + + db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_READER ); + + if ( db == NULL ) { + Debug( LDAP_DEBUG_ANY, + "<= equality_candidates db open failed (%s%s)\n", + dbname, LDBM_SUFFIX, 0 ); + return idl; + } + + if( rc != LDAP_SUCCESS ) { + Debug( LDAP_DEBUG_TRACE, "<= equality_candidates open failed (%d)\n", + rc, 0, 0 ); + return idl; + } + + for ( i= 0; keys[i] != NULL; i++ ) { + ID_BLOCK *save; + ID_BLOCK *tmp; + + rc = key_read( be, db, keys[i], &tmp ); + + if( rc != LDAP_SUCCESS ) { + idl_free( idl ); + idl = NULL; + Debug( LDAP_DEBUG_TRACE, "<= equality_candidates key read failed (%d)\n", + rc, 0, 0 ); + break; + } + + if( tmp == NULL ) { + idl_free( idl ); + idl = NULL; + Debug( LDAP_DEBUG_TRACE, "<= equality_candidates NULL\n", + 0, 0, 0 ); + break; + } + + save = idl; + idl = idl_intersection( be, idl, tmp ); + idl_free( save ); + + if( idl == NULL ) break; + } + + ber_bvecfree( keys ); + + ldbm_cache_close( be, db ); + +#else + idl = index_read( be, ava->ava_type, SLAP_INDEX_EQUALITY, + ava->ava_value.bv_val ); +#endif + + Debug( LDAP_DEBUG_TRACE, "<= equality_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } @@ -162,17 +272,126 @@ presence_candidates( static ID_BLOCK * approx_candidates( Backend *be, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + AttributeAssertion *ava +#else Ava *ava +#endif ) { - char *w, *c; - ID_BLOCK *idl, *tmp; + ID_BLOCK *idl; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + DBCache *db; + int i; + int rc; + char *dbname; + slap_index mask; + struct berval *prefix; + struct berval **keys = NULL; + MatchingRule *mr; +#else + char *w, *c; + ID_BLOCK *tmp; +#endif Debug( LDAP_DEBUG_TRACE, "=> approx_candidates\n", 0, 0, 0 ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + idl = idl_allids( be ); + + rc = index_param( be, ava->aa_desc, LDAP_FILTER_EQUALITY, + &dbname, &mask, &prefix ); + + if( rc != LDAP_SUCCESS ) { + return idl; + } + + if( dbname == NULL ) { + /* not indexed */ + return idl; + } + + mr = ava->aa_desc->ad_type->sat_approx; + if( mr == NULL ) { + /* no approx matching rule, try equality matching rule */ + mr = ava->aa_desc->ad_type->sat_equality; + } + + if( !mr ) { + /* return LDAP_INAPPROPRIATE_MATCHING; */ + return idl; + } + + if( !mr->smr_filter ) { + return idl; + } + + rc = (mr->smr_filter)( + LDAP_FILTER_EQUALITY, + ava->aa_desc->ad_type->sat_syntax, + mr, + prefix, + ava->aa_value, + &keys ); + + if( rc != LDAP_SUCCESS ) { + return idl; + } + + db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_READER ); + + if ( db == NULL ) { + Debug( LDAP_DEBUG_ANY, + "<= approx_candidates db open failed (%s%s)\n", + dbname, LDBM_SUFFIX, 0 ); + return idl; + } + + if( rc != LDAP_SUCCESS ) { + Debug( LDAP_DEBUG_TRACE, "<= approx_candidates open failed (%d)\n", + rc, 0, 0 ); + return idl; + } + + for ( i= 0; keys[i] != NULL; i++ ) { + ID_BLOCK *save; + ID_BLOCK *tmp; + + rc = key_read( be, db, keys[i], &tmp ); + + if( rc != LDAP_SUCCESS ) { + idl_free( idl ); + idl = NULL; + Debug( LDAP_DEBUG_TRACE, "<= approx_candidates key read failed (%d)\n", + rc, 0, 0 ); + break; + } + + if( tmp == NULL ) { + idl_free( idl ); + idl = NULL; + Debug( LDAP_DEBUG_TRACE, "<= approx_candidates NULL\n", + 0, 0, 0 ); + break; + } + + save = idl; + idl = idl_intersection( be, idl, tmp ); + idl_free( save ); + + if( idl == NULL ) break; + } + + ber_bvecfree( keys ); + + ldbm_cache_close( be, db ); + +#else idl = NULL; - for ( w = first_word( ava->ava_value.bv_val ); w != NULL; - w = next_word( w ) ) { + for ( w = first_word( ava->ava_value.bv_val ); + w != NULL; + w = next_word( w ) ) + { c = phonetic( w ); if ( (tmp = index_read( be, ava->ava_type, SLAP_INDEX_APPROX, c )) == NULL ) { @@ -191,6 +410,7 @@ approx_candidates( } } +#endif Debug( LDAP_DEBUG_TRACE, "<= approx_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); @@ -243,11 +463,17 @@ substring_candidates( Filter *f ) { + ID_BLOCK *idl; +#ifndef SLAPD_SCHEMA_NOT_COMPAT int i; - ID_BLOCK *idl, *tmp, *tmp2; + ID_BLOCK *tmp, *tmp2; +#endif Debug( LDAP_DEBUG_TRACE, "=> substring_candidates\n", 0, 0, 0 ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + idl = idl_allids( be ); +#else idl = NULL; /* initial */ @@ -300,12 +526,13 @@ substring_candidates( } } } - +#endif Debug( LDAP_DEBUG_TRACE, "<= substring_candidates %ld\n", idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); return( idl ); } +#ifndef SLAPD_SCHEMA_NOT_COMPAT static ID_BLOCK * substring_comp_candidates( Backend *be, diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index 0301aa0750..3e4163d680 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -17,6 +17,34 @@ static ID_BLOCK* idl_dup( ID_BLOCK *idl ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT +static void cont_alloc( Datum cont, Datum key ) +{ + ldbm_datum_init( cont ); + cont.dsize = 1 + sizeof(ID) + key.dsize; + cont.dptr = ch_malloc( cont.dsize ); + + memcpy( &((unsigned char *)cont.dptr)[1 + sizeof(ID)], + key.dptr, key.dsize ); +} + +static void cont_id( Datum cont, ID id ) +{ + int i; + + for( i=1; i <= sizeof(id); i++) { + ((unsigned char *)cont.dptr)[i] = (unsigned char)(id & 0xFF); + id >>= 8; + } + +} + +static void cont_free( Datum cont ) +{ + ch_free( cont.dptr ); +} +#endif + /* Allocate an ID_BLOCK with room for nids ids */ ID_BLOCK * idl_alloc( unsigned int nids ) @@ -106,7 +134,6 @@ idl_fetch( Datum data; ID_BLOCK *idl; ID_BLOCK **tmp; - char *kstr; int i, nids; idl = idl_fetch_one( be, db, key ); @@ -141,16 +168,22 @@ idl_fetch( tmp = (ID_BLOCK **) ch_malloc( (i + 1) * sizeof(ID_BLOCK *) ); /* read in all the blocks */ - kstr = (char *) ch_malloc( key.dsize + CONT_SIZE ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_alloc( data, key ); +#else + kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE ); +#endif nids = 0; for ( i = 0; !ID_BLOCK_NOID(idl, i); i++ ) { - ldbm_datum_init( data ); - - sprintf( kstr, "%c%ld%s", CONT_PREFIX, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_id( data, ID_BLOCK_ID(idl, i) ); +#else + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(idl, i), key.dptr ); data.dptr = kstr; data.dsize = strlen( kstr ) + 1; +#endif if ( (tmp[i] = idl_fetch_one( be, db, data )) == NULL ) { Debug( LDAP_DEBUG_ANY, @@ -161,7 +194,11 @@ idl_fetch( nids += ID_BLOCK_NIDS(tmp[i]); } tmp[i] = NULL; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( data ); +#else free( kstr ); +#endif idl_free( idl ); /* allocate space for the big block */ @@ -300,10 +337,14 @@ idl_change_first( } /* write block with new key */ - sprintf( bkey.dptr, "%c%ld%s", CONT_PREFIX, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_id( bkey, ID_BLOCK_ID(b, 0) ); +#else + sprintf( bkey.dptr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(b, 0), hkey.dptr ); - bkey.dsize = strlen( bkey.dptr ) + 1; +#endif + if ( (rc = idl_store( be, db, bkey, b )) != 0 ) { Debug( LDAP_DEBUG_ANY, "idl_store of (%s) returns %d\n", bkey.dptr, rc, 0 ); @@ -332,10 +373,12 @@ idl_insert_key( { int i, j, first, rc; ID_BLOCK *idl, *tmp, *tmp2, *tmp3; - char *kstr; Datum k2; +#ifndef SLAPD_SCHEMA_NOT_COMPAT + char *kstr; ldbm_datum_init( k2 ); +#endif if ( (idl = idl_fetch_one( be, db, key )) == NULL ) { #ifdef LDBM_DEBUG @@ -392,23 +435,38 @@ idl_insert_key( /* store it */ rc = idl_store( be, db, key, idl ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_alloc( k2, key ); + cont_id( k2, ID_BLOCK_ID(tmp, 0) ); +#else /* store the first id block */ - kstr = (char *) ch_malloc( key.dsize + CONT_SIZE ); - sprintf( kstr, "%c%ld%s", CONT_PREFIX, + kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE ); + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(tmp, 0), key.dptr ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; +#endif + rc = idl_store( be, db, k2, tmp ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_id( k2, ID_BLOCK_ID(tmp2, 0) ); +#else /* store the second id block */ - sprintf( kstr, "%c%ld%s", CONT_PREFIX, + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(tmp2, 0), key.dptr ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; +#endif rc = idl_store( be, db, k2, tmp2 ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( k2 ); +#else free( kstr ); +#endif + idl_free( tmp ); idl_free( tmp2 ); break; @@ -429,6 +487,7 @@ idl_insert_key( /* select the block to try inserting into *//* XXX linear search XXX */ for ( i = 0; !ID_BLOCK_NOID(idl, i) && id > ID_BLOCK_ID(idl, i); i++ ) ; /* NULL */ + if ( i != 0 ) { i--; first = 0; @@ -437,15 +496,25 @@ idl_insert_key( } /* get the block */ - kstr = (char *) ch_malloc( key.dsize + CONT_SIZE ); - sprintf( kstr, "%c%ld%s", CONT_PREFIX, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_alloc( k2, key ); + cont_id( k2, ID_BLOCK_ID(idl, i) ); +#else + kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE ); + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(idl, i), key.dptr ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; +#endif + if ( (tmp = idl_fetch_one( be, db, k2 )) == NULL ) { Debug( LDAP_DEBUG_ANY, "nonexistent continuation block (%s)\n", k2.dptr, 0, 0 ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( k2 ); +#else free( kstr ); +#endif idl_free( idl ); return( -1 ); } @@ -484,16 +553,25 @@ idl_insert_key( /* is there a next block? */ if ( !first && !ID_BLOCK_NOID(idl, i + 1) ) { /* read it in */ - k2.dptr = (char *) ch_malloc( key.dsize + CONT_SIZE ); - sprintf( k2.dptr, "%c%ld%s", CONT_PREFIX, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_alloc( k2, key ); + cont_id( k2, ID_BLOCK_ID(idl, i) ); +#else + k2.dptr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE ); + sprintf( k2.dptr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(idl, i + 1), key.dptr ); k2.dsize = strlen( k2.dptr ) + 1; +#endif if ( (tmp2 = idl_fetch_one( be, db, k2 )) == NULL ) { Debug( LDAP_DEBUG_ANY, "idl_fetch_one (%s) returns NULL\n", k2.dptr, 0, 0 ); /* split the original block */ +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( k2 ); +#else free( k2.dptr ); +#endif goto split; } @@ -514,14 +592,26 @@ idl_insert_key( */ rc = idl_insert( &tmp, id, db->dbc_maxids ); assert( rc == 0 ); - k3.dptr = kstr; + +#ifdef SLAPD_SCHEMA_NOT_COMPAT + k3.dptr = ch_malloc(k2.dsize); + k3.dsize = k2.dsize; + memcpy(k3.dptr, k2.dptr, k3.dsize); +#else + k3.dptr = strdup( kstr ); k3.dsize = strlen( kstr ) + 1; +#endif if ( (rc = idl_store( be, db, k3, tmp )) != 0 ) { Debug( LDAP_DEBUG_ANY, "idl_store of (%s) returns %d\n", k3.dptr, rc, 0 ); } + +#ifdef SLAPD_SCHEMA_NOT_COMPAT + free( k3.dptr ); +#else free( kstr ); kstr = k2.dptr; +#endif id = id2; /* This new id will necessarily be inserted @@ -548,7 +638,12 @@ idl_insert_key( "id %ld already in next block\n", id, 0, 0 ); } + +#ifdef SLAPD_SCHEMA_NOT_COMPAT + assert( 0 ); /* not yet implemented */ +#else free( kstr ); +#endif idl_free( tmp ); idl_free( tmp2 ); idl_free( idl ); @@ -586,10 +681,14 @@ split: /* delete all indirect blocks */ for ( j = 0; !ID_BLOCK_NOID(idl, j); j++ ) { - sprintf( kstr, "%c%ld%s", CONT_PREFIX, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_id( k2, ID_BLOCK_ID(idl, j) ); +#else + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(idl, j), key.dptr ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; +#endif rc = ldbm_cache_delete( db, k2 ); } @@ -599,7 +698,11 @@ split: idl = idl_allids( be ); rc = idl_store( be, db, key, idl ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( k2 ); +#else free( kstr ); +#endif idl_free( idl ); idl_free( tmp ); return( rc ); @@ -629,17 +732,25 @@ split: rc = idl_store( be, db, key, tmp ); /* store the first id block */ - sprintf( kstr, "%c%ld%s", CONT_PREFIX, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_id( k2, ID_BLOCK_ID(tmp2, 0) ); +#else + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(tmp2, 0), key.dptr ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; +#endif rc = idl_store( be, db, k2, tmp2 ); /* store the second id block */ - sprintf( kstr, "%c%ld%s", CONT_PREFIX, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_id( k2, ID_BLOCK_ID(tmp3, 0) ); +#else + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(tmp3, 0), key.dptr ); k2.dptr = kstr; k2.dsize = strlen( kstr ) + 1; +#endif rc = idl_store( be, db, k2, tmp3 ); idl_free( tmp2 ); @@ -647,7 +758,11 @@ split: break; } +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( k2 ); +#else free( kstr ); +#endif idl_free( tmp ); idl_free( idl ); return( rc ); @@ -722,7 +837,9 @@ idl_delete_key ( ID_BLOCK *idl; unsigned i; int j, nids; +#ifndef SLAPD_SCHEMA_NOT_COMPAT char *kstr; +#endif if ( (idl = idl_fetch_one( be, db, key ) ) == NULL ) { @@ -766,16 +883,25 @@ idl_delete_key ( */ for ( nids = 0; !ID_BLOCK_NOID(idl, nids); nids++ ) ; /* NULL */ - kstr = (char *) ch_malloc( key.dsize + CONT_SIZE ); + +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_alloc( data, key ); +#else + kstr = (char *) ch_malloc( key.dsize + SLAP_INDEX_CONT_SIZE ); +#endif for ( j = 0; !ID_BLOCK_NOID(idl, j); j++ ) { ID_BLOCK *tmp; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_id( data, ID_BLOCK_ID(idl, j) ); +#else ldbm_datum_init( data ); - sprintf( kstr, "%c%ld%s", CONT_PREFIX, + sprintf( kstr, "%c%ld%s", SLAP_INDEX_CONT_PREFIX, ID_BLOCK_ID(idl, j), key.dptr ); data.dptr = kstr; data.dsize = strlen( kstr ) + 1; +#endif if ( (tmp = idl_fetch_one( be, db, data )) == NULL ) { Debug( LDAP_DEBUG_ANY, @@ -813,14 +939,23 @@ idl_delete_key ( idl_store( be, db, key, idl ); } idl_free( tmp ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( data ); +#else free( kstr ); +#endif idl_free( idl ); return 0; } } idl_free( tmp ); } + +#ifdef SLAPD_SCHEMA_NOT_COMPAT + cont_free( data ); +#else free( kstr ); +#endif idl_free( idl ); return -1; } diff --git a/servers/slapd/back-ldbm/index.c b/servers/slapd/back-ldbm/index.c index 96abe68b90..3bd4df9858 100644 --- a/servers/slapd/back-ldbm/index.c +++ b/servers/slapd/back-ldbm/index.c @@ -15,33 +15,338 @@ #include "slap.h" #include "back-ldbm.h" -#ifndef SLAPD_SCHEMA_NOT_COMPAT +#ifdef SLAPD_SCHEMA_NOT_COMPAT +static index_mask( + Backend *be, + AttributeDescription *desc, + char **dbname, + char **atname ) +{ + AttributeType *at; + slap_index mask = 0; + + /* we do support indexing of binary attributes */ + if( slap_ad_is_binary( desc ) ) return 0; + + attr_mask( be->be_private, desc->ad_cname->bv_val, &mask ); + + if( mask ) { + *atname = desc->ad_cname->bv_val; + *dbname = desc->ad_cname->bv_val; + return mask; + } + + if( slap_ad_is_lang( desc ) ) { + /* has language tag */ + attr_mask( be->be_private, desc->ad_type->sat_cname, &mask ); + + if( mask & SLAP_INDEX_AUTO_LANG ) { + *atname = desc->ad_cname->bv_val; + *dbname = desc->ad_type->sat_cname; + return mask; + } + if( mask & SLAP_INDEX_LANG ) { + *atname = desc->ad_type->sat_cname; + *dbname = desc->ad_type->sat_cname; + return mask; + } + } + + /* see if supertype defined mask for its subtypes */ + for( at = desc->ad_type; at != NULL ; at = at->sat_sup ) { + attr_mask( be->be_private, at->sat_cname, &mask ); + + if( mask & SLAP_INDEX_AUTO_SUBTYPES ) { + *atname = desc->ad_type->sat_cname; + *dbname = at->sat_cname; + return mask; + } + if( mask & SLAP_INDEX_SUBTYPES ) { + *atname = at->sat_cname; + *dbname = at->sat_cname; + return mask; + } + + if( mask ) break; + } + + return 0; +} + +int index_param( + Backend *be, + AttributeDescription *desc, + int ftype, + char **dbnamep, + slap_index *maskp, + struct berval **prefixp ) +{ + slap_index mask; + char *dbname; + char *atname; + + mask = index_mask( be, desc, &dbname, &atname ); + + if( mask == 0 ) { + return LDAP_INAPPROPRIATE_MATCHING; + } + + switch(ftype) { + case LDAP_FILTER_PRESENT: + if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) { + goto done; + } + break; + + case LDAP_FILTER_APPROX: + if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) { + goto done; + } + /* fall thru */ + + case LDAP_FILTER_EQUALITY: + if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) { + goto done; + } + break; + + case LDAP_FILTER_SUBSTRINGS: + if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) ) { + goto done; + } + break; + + default: + return LDAP_OTHER; + } + + return LDAP_INAPPROPRIATE_MATCHING; + +done: + *dbnamep = dbname; + *prefixp = ber_bvstrdup( atname ); + *maskp = mask; + return LDAP_SUCCESS; +} + +static int indexer( + Backend *be, + char *dbname, + char *atname, + struct berval **vals, + ID id, + int op, + slap_index mask ) +{ + int rc, i; + const char *text; + DBCache *db; + AttributeDescription *ad = NULL; + struct berval **keys; + struct berval prefix; + + assert( mask ); + + rc = slap_str2ad( atname, &ad, &text ); + + if( rc != LDAP_SUCCESS ) return rc; + + prefix.bv_val = atname; + prefix.bv_len = strlen( atname ); + + db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT ); + + if ( db == NULL ) { + Debug( LDAP_DEBUG_ANY, + "<= index_read NULL (could not open %s%s)\n", + dbname, LDBM_SUFFIX, 0 ); + ad_free( ad, 1 ); + return LDAP_OTHER; + } + + if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) { + key_change( be, db, &prefix, id, op ); + } + + if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) { + rc = ad->ad_type->sat_equality->smr_indexer( + mask, + ad->ad_type->sat_syntax, + ad->ad_type->sat_equality, + &prefix, vals, &keys ); + + if( rc == LDAP_SUCCESS ) { + for( i= 0; keys[i] != NULL; i++ ) { + key_change( be, db, keys[i], id, op ); + } + } + } + + if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) { + rc = ad->ad_type->sat_approx->smr_indexer( + mask, + ad->ad_type->sat_syntax, + ad->ad_type->sat_approx, + &prefix, vals, &keys ); + + if( rc == LDAP_SUCCESS ) { + for( i= 0; keys[i] != NULL; i++ ) { + key_change( be, db, keys[i], id, op ); + } + } + } + + if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) ) { + rc = ad->ad_type->sat_substr->smr_indexer( + mask, + ad->ad_type->sat_syntax, + ad->ad_type->sat_substr, + &prefix, vals, &keys ); + + if( rc == LDAP_SUCCESS ) { + for( i= 0; keys[i] != NULL; i++ ) { + key_change( be, db, keys[i], id, op ); + } + } + } + + ldbm_cache_close( be, db ); + ad_free( ad, 1 ); + return LDAP_SUCCESS; +} + +static int index_at_values( + Backend *be, + AttributeType *type, + const char *lang, + struct berval **vals, + ID id, + int op, + char ** dbnamep, + slap_index *maskp ) +{ + slap_index mask; + slap_index tmpmask = 0; + int lindex = 0; + + if( type->sat_sup ) { + /* recurse */ + (void) index_at_values( be, + type->sat_sup, lang, + vals, id, op, + dbnamep, &tmpmask ); + } + + attr_mask( be->be_private, type->sat_cname, &mask ); + + if( mask ) { + *dbnamep = type->sat_cname; + } else if ( tmpmask & SLAP_INDEX_AUTO_SUBTYPES ) { + mask = tmpmask; + } + + if( mask ) { + indexer( be, *dbnamep, + type->sat_cname, + vals, id, op, + mask ); + } + if( lang ) { + char *dbname = NULL; + size_t tlen = strlen( type->sat_cname ); + size_t llen = strlen( lang ); + char *lname = ch_malloc( tlen + llen + sizeof(";") ); + + sprintf( lname, "%s;%s", type->sat_cname, lang ); + + attr_mask( be->be_private, lname, &tmpmask ); + + if( tmpmask ) { + dbname = lname; + } else if ( mask & SLAP_INDEX_AUTO_LANG ) { + dbname = *dbnamep; + tmpmask = mask; + } + + if( dbname != NULL ) { + indexer( be, dbname, lname, + vals, id, op, + tmpmask ); + } + + ch_free( lname ); + } + + return LDAP_SUCCESS; +} + +int index_values( + Backend *be, + AttributeDescription *desc, + struct berval **vals, + ID id, + int op ) +{ + char *dbname = NULL; + slap_index mask; + + if( slap_ad_is_binary( desc ) ) { + /* binary attributes have no index capabilities */ + return LDAP_SUCCESS; + } + + (void) index_at_values( be, + desc->ad_type, desc->ad_lang, + vals, id, op, + &dbname, &mask ); + + return LDAP_SUCCESS; +} + +#else +int index_change_values( + Backend *be, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + AttributeDescription *desc, +#else + char *desc, +#endif + struct berval **vals, + ID id, + unsigned int op +); + +#ifndef SLAPD_SCHEMA_NOT_COMPAT static int change_value(Backend *be, - DBCache *db, - char *type, - int indextype, - char *val, - ID id, - int - (*idl_func)(Backend *, DBCache *, Datum, ID)); -static int index2prefix(int indextype); + DBCache *db, + char *type, + int indextype, + char *val, + ID id, + int + (*idl_func)(Backend *, DBCache *, Datum, ID)); +#endif #endif int -index_add_entry( +index_entry( Backend *be, - Entry *e + int op, + Entry *e, + Attribute *ap ) { #ifndef SLAPD_SCHEMA_NOT_COMPAT - Attribute *ap; struct berval bv; struct berval *bvals[2]; +#endif - Debug( LDAP_DEBUG_TRACE, "=> index_add( %ld, \"%s\" )\n", e->e_id, - e->e_dn, 0 ); + Debug( LDAP_DEBUG_TRACE, "=> index_entry_%s( %ld, \"%s\" )\n", + op == SLAP_INDEX_ADD_OP ? "add" : "del", + e->e_id, e->e_dn ); +#ifndef SLAPD_SCHEMA_NOT_COMPAT /* * dn index entry - make it look like an attribute so it works * with index_change_values() call @@ -55,39 +360,37 @@ index_add_entry( /* add the dn to the indexes */ { char *dn = ch_strdup("dn"); -#ifdef SLAPD_SCHEMA_NOT_COMPAT - /* not yet implemented */ -#else - index_change_values( be, dn, bvals, e->e_id, SLAP_INDEX_ADD_OP ); -#endif + index_change_values( be, dn, bvals, e->e_id, op ); free( dn ); } free( bv.bv_val ); +#endif /* add each attribute to the indexes */ - for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) { + for ( ap; ap != NULL; ap = ap->a_next ) { #ifdef SLAPD_SCHEMA_NOT_COMPAT - /* index_change_values( be, SLAP_INDEX_ADD_OP, e->e_id, ap ); */ + index_values( be, ap->a_desc, ap->a_vals, e->e_id, op ); #else - index_change_values( be, ap->a_type, ap->a_vals, e->e_id, - SLAP_INDEX_ADD_OP ); + index_change_values( be, ap->a_type, ap->a_vals, e->e_id, op ); #endif } - Debug( LDAP_DEBUG_TRACE, "<= index_add( %ld, \"%s\" ) 0\n", e->e_id, - e->e_ndn, 0 ); -#endif - return( 0 ); + Debug( LDAP_DEBUG_TRACE, "<= index_entry_%s( %ld, \"%s\" ) success\n", + op == SLAP_INDEX_ADD_OP ? "add" : "del", + e->e_id, e->e_dn ); + + return LDAP_SUCCESS; } #ifndef SLAPD_SCHEMA_NOT_COMPAT + ID_BLOCK * index_read( Backend *be, char *type, int indextype, - char *val + char *val ) { DBCache *db; @@ -102,7 +405,7 @@ index_read( ldbm_datum_init( key ); - prefix = index2prefix( indextype ); + prefix = slap_index2prefix( indextype ); Debug( LDAP_DEBUG_TRACE, "=> index_read(\"%c%s\"->\"%s\")\n", prefix, type, val ); @@ -188,7 +491,7 @@ change_value( char *realval = val; char buf[BUFSIZ]; - char prefix = index2prefix( indextype ); + char prefix = slap_index2prefix( indextype ); ldbm_datum_init( key ); @@ -226,18 +529,23 @@ change_value( return( rc ); } -#endif +#ifdef SLAPD_SCHEMA_NOT_COMPAT +static +#endif int index_change_values( Backend *be, - char *type, +#ifdef SLAPD_SCHEMA_NOT_COMPAT + AttributeDescription *desc, +#else + char *desc, +#endif struct berval **vals, ID id, unsigned int op ) { -#ifndef SLAPD_SCHEMA_NOT_COMPAT char *val, *p, *code, *w; unsigned i, j, len; int indexmask, syntax; @@ -252,6 +560,12 @@ index_change_values( char *at_cn; /* Attribute canonical name */ int mode; +#ifdef SLAPD_SCHEMA_NOT_COMPAT + char *type = desc->ad_cname->bv_val; +#else + char *type = desc; +#endif + if( vals == NULL ) { Debug( LDAP_DEBUG_TRACE, "=> index_change_values( %s, NULL, %ld, op=%s )\n", @@ -278,7 +592,7 @@ index_change_values( #ifndef SLAPD_SCHEMA_NOT_COMPAT attr_normalize(type); #endif - attr_mask( be->be_private, type, &indexmask ); + attr_mask( be->be_private, desc, &indexmask ); if ( indexmask == 0 ) { return( 0 ); @@ -307,20 +621,19 @@ index_change_values( return( -1 ); } -#ifdef SLAPD_SCHEMA_NOT_COMPAT - /* not yet implemented */ -#else /* * presence index entry */ - if ( indexmask & SLAP_INDEX_PRESENCE ) { - change_value( be, db, at_cn, SLAP_INDEX_PRESENCE, + if ( indexmask & SLAP_INDEX_PRESENT ) { + change_value( be, db, at_cn, SLAP_INDEX_PRESENT, "*", id, idl_funct ); } +#ifndef SLAPD_SCHEMA_NOT_COMPAT if ( syntax & SYNTAX_BIN ) { goto done; } +#endif for ( i = 0; vals[i] != NULL; i++ ) { Debug( LDAP_DEBUG_TRACE, @@ -340,7 +653,9 @@ index_change_values( (void) memcpy( val, vals[i]->bv_val, len ); val[len] = '\0'; +#ifndef SLAPD_SCHEMA_NOT_COMPAT value_normalize( val, syntax ); +#endif /* value_normalize could change the length of val */ len = strlen( val ); @@ -414,35 +729,10 @@ index_change_values( free( bigbuf ); } } -#endif - +#ifndef SLAPD_SCHEMA_NOT_COMPAT done: - ldbm_cache_close( be, db ); #endif - return( 0 ); -} - -#ifndef SLAPD_SCHEMA_NOT_COMPAT -static int -index2prefix( int indextype ) -{ - int prefix; - - switch ( indextype ) { - case SLAP_INDEX_EQUALITY: - prefix = EQ_PREFIX; - break; - case SLAP_INDEX_APPROX: - prefix = APPROX_PREFIX; - break; - case SLAP_INDEX_SUBSTR: - prefix = SUB_PREFIX; - break; - default: - prefix = UNKNOWN_PREFIX; - break; - } - - return( prefix ); + ldbm_cache_close( be, db ); + return LDAP_SUCCESS; } -#endif \ No newline at end of file +#endif diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c index 5ed9545ca8..5c7a3269bc 100644 --- a/servers/slapd/back-ldbm/init.c +++ b/servers/slapd/back-ldbm/init.c @@ -79,7 +79,9 @@ ldbm_back_initialize( bi->bi_tool_entry_get = ldbm_tool_entry_get; bi->bi_tool_entry_put = ldbm_tool_entry_put; bi->bi_tool_index_attr = ldbm_tool_index_attr; +#ifndef SLAPD_SCHEMA_NOT_COMPAT bi->bi_tool_index_change = ldbm_tool_index_change; +#endif bi->bi_tool_sync = ldbm_tool_sync; #ifdef HAVE_CYRUS_SASL @@ -132,7 +134,6 @@ ldbm_back_db_init( ) { struct ldbminfo *li; - char *argv[ 4 ]; /* allocate backend-database-specific stuff */ li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) ); @@ -158,12 +159,6 @@ ldbm_back_db_init( /* default database directory */ li->li_directory = ch_strdup( DEFAULT_DB_DIRECTORY ); - argv[ 0 ] = "objectclass"; - argv[ 1 ] = "eq"; - argv[ 2 ] = NULL; - attr_index_config( li, "ldbm objectclass initialization", - 0, 2, argv, 1 ); - /* initialize various mutex locks & condition variables */ ldap_pvt_thread_mutex_init( &li->li_root_mutex ); ldap_pvt_thread_mutex_init( &li->li_add_mutex ); @@ -182,6 +177,17 @@ ldbm_back_db_open( BackendDB *be ) { + struct ldbminfo *li = (struct ldbminfo *) be->be_private; + char *argv[ 4 ]; + + /* allocate backend-database-specific stuff */ + + argv[ 0 ] = "objectclass"; + argv[ 1 ] = "eq"; + argv[ 2 ] = NULL; + attr_index_config( li, "ldbm objectclass initialization", + 0, 2, argv, 1 ); + return 0; } diff --git a/servers/slapd/back-ldbm/key.c b/servers/slapd/back-ldbm/key.c new file mode 100644 index 0000000000..c8dc26e690 --- /dev/null +++ b/servers/slapd/back-ldbm/key.c @@ -0,0 +1,80 @@ +/* index.c - routines for dealing with attribute indexes */ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" + +#include + +#include +#include + +#include "slap.h" +#include "back-ldbm.h" + +/* read a key */ +int +key_read( + Backend *be, + DBCache *db, + struct berval *k, + ID_BLOCK **idout +) +{ + Datum key; + ID_BLOCK *idl; + + Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 ); + + ldbm_datum_init( key ); + key.dptr = k->bv_val; + key.dsize = k->bv_len; + + idl = idl_fetch( be, db, key ); + + Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n", + idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 ); + + *idout = idl; + return LDAP_SUCCESS; +} + +/* Add or remove stuff from index files */ +int +key_change( + Backend *be, + DBCache *db, + struct berval *k, + ID id, + int op +) +{ + int rc; + Datum key; + + Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n", + op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 ); + + ldbm_datum_init( key ); + key.dptr = k->bv_val; + key.dsize = k->bv_len; + + if (op == SLAP_INDEX_ADD_OP) { + /* Add values */ + rc = idl_insert_key( be, db, key, id ); + + } else { + /* Delete values */ + rc = idl_delete_key( be, db, key, id ); + } + + + Debug( LDAP_DEBUG_TRACE, "<= key_change %d\n", rc, 0, 0 ); + + ldap_pvt_thread_yield(); + + return rc; +} diff --git a/servers/slapd/back-ldbm/modify.c b/servers/slapd/back-ldbm/modify.c index 7b47a71d90..088b412d0c 100644 --- a/servers/slapd/back-ldbm/modify.c +++ b/servers/slapd/back-ldbm/modify.c @@ -154,86 +154,14 @@ int ldbm_modify_internal( } ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex ); - /* run through the attributes removing old indices */ - for ( ml = modlist; ml != NULL; ml = ml->sml_next ) { - mod = &ml->sml_mod; - - switch ( mod->sm_op ) { - case LDAP_MOD_REPLACE: { - /* Need to remove all values from indexes */ -#ifdef SLAPD_SCHEMA_NOT_COMPAT - /* not yet implemented */ -#else - Attribute *a = save_attrs - ? attr_find( save_attrs, mod->sm_desc ) - : NULL; + /* delete indices for old attributes */ + index_entry_del( be, e, save_attrs); - if( a != NULL ) { - (void) index_change_values( be, - mod->mod_type, - a->a_vals, - e->e_id, - SLAP_INDEX_DELETE_OP ); - } -#endif - } break; - - case LDAP_MOD_DELETE: -#ifdef SLAPD_SCHEMA_NOT_COMPAT - /* not yet implemented */ -#else - /* remove deleted values */ - (void) index_change_values( be, - mod->mod_type, - mod->mod_bvalues, - e->e_id, - SLAP_INDEX_DELETE_OP ); -#endif - break; - } - } + /* add indices for new attributes */ + index_entry_add( be, e, e->e_attrs); attrs_free( save_attrs ); - /* run through the attributes adding new indices */ - for ( ml = modlist; ml != NULL; ml = ml->sml_next ) { - mod = &ml->sml_mod; - - switch ( mod->sm_op ) { - case LDAP_MOD_REPLACE: - case LDAP_MOD_ADD: -#ifdef SLAPD_SCHEMA_NOT_COMPAT - /* not yet implemented */ -#else - (void) index_change_values( be, - mod->mod_type, - mod->mod_bvalues, - e->e_id, - SLAP_INDEX_ADD_OP ); -#endif - break; - - case LDAP_MOD_DELETE: { - /* Need to add all remaining values */ -#ifdef SLAPD_SCHEMA_NOT_COMPAT - /* not yet implemented */ -#else - Attribute *a = e->e_attrs - ? attr_find( e->e_attrs, mod->sm_desc ) - : NULL; - - if( a != NULL ) { - (void) index_change_values( be, - mod->mod_type, - a->a_vals, - e->e_id, - SLAP_INDEX_ADD_OP ); - } -#endif - } break; - } - } - return LDAP_SUCCESS; } diff --git a/servers/slapd/back-ldbm/proto-back-ldbm.h b/servers/slapd/back-ldbm/proto-back-ldbm.h index 888aeedb9d..3da9948d06 100644 --- a/servers/slapd/back-ldbm/proto-back-ldbm.h +++ b/servers/slapd/back-ldbm/proto-back-ldbm.h @@ -33,8 +33,11 @@ Entry *deref_internal_r LDAP_P(( * attr.c */ -void attr_mask LDAP_P(( struct ldbminfo *li, const char *type, int *indexmask )); -void attr_index_config LDAP_P(( struct ldbminfo *li, +void attr_mask LDAP_P(( struct ldbminfo *li, + const char *desc, + slap_index *indexmask )); + +int attr_index_config LDAP_P(( struct ldbminfo *li, const char *fname, int lineno, int argc, char **argv, int init )); void attr_index_destroy LDAP_P(( Avlnode *tree )); @@ -130,14 +133,57 @@ ID idl_nextid LDAP_P(( ID_BLOCK *idl, ID *cursor )); /* * index.c */ +#ifdef SLAPD_SCHEMA_NOT_COMPAT +extern int +index_param LDAP_P(( + Backend *be, + AttributeDescription *desc, + int ftype, + char **dbname, + slap_index *mask, + struct berval **prefix )); + +extern int +index_values LDAP_P(( + Backend *be, + AttributeDescription *desc, + struct berval **vals, + ID id, + int op )); +#endif -int index_add_entry LDAP_P(( Backend *be, Entry *e )); +int index_entry LDAP_P(( Backend *be, int r, Entry *e, Attribute *ap )); +#define index_entry_add(be,e,ap) index_entry((be),SLAP_INDEX_ADD_OP,(e),(ap)) +#define index_entry_del(be,e,ap) index_entry((be),SLAP_INDEX_DELETE_OP,(e),(ap)) + +#ifndef SLAPD_SCHEMA_NOT_COMPAT +int index_change_values LDAP_P(( + Backend *be, + char *desc, + struct berval **vals, + ID id, + unsigned int op +)); ID_BLOCK * index_read LDAP_P(( Backend *be, - char *type, int indextype, char *val )); -/* Possible operations supported (op) by index_change_values() */ -int index_change_values LDAP_P(( Backend *be, - char *type, struct berval **vals, - ID id, unsigned int op )); + char *desc, int indextype, char *val )); +#endif + +/* + * key.c + */ +extern int +key_change LDAP_P(( + Backend *be, + DBCache *db, + struct berval *k, + ID id, + int op )); +extern int +key_read LDAP_P(( + Backend *be, + DBCache *db, + struct berval *k, + ID_BLOCK **idout )); /* * passwd.c diff --git a/servers/slapd/back-ldbm/tools.c b/servers/slapd/back-ldbm/tools.c index 0d96f70049..5a91947ef1 100644 --- a/servers/slapd/back-ldbm/tools.c +++ b/servers/slapd/back-ldbm/tools.c @@ -160,7 +160,7 @@ ID ldbm_tool_entry_put( Debug( LDAP_DEBUG_TRACE, "=> ldbm_tool_entry_put( %ld, \"%s\" )\n", e->e_id, e->e_dn, 0 ); - rc = index_add_entry( be, e ); + rc = index_entry_add( be, e, e->e_attrs ); if( rc != 0 ) { return NOID; @@ -202,18 +202,21 @@ int ldbm_tool_index_attr( ) { static DBCache *db = NULL; - int indexmask; - char * at_cn; + slap_index indexmask; +#ifndef SLAPD_SCHEMA_NOT_COMPAT + char *desc; +#endif + char *at_cname; assert( slapMode & SLAP_TOOL_MODE ); #ifdef SLAPD_SCHEMA_NOT_COMPAT - at_cn = desc->ad_cname->bv_val; + at_cname = desc->ad_cname->bv_val; #else attr_normalize( type ); - at_cn = at_canonical_name( type ); + at_cname = desc = at_canonical_name( type ); - if( at_cn == NULL ) { + if( desc == NULL ) { Debug( LDAP_DEBUG_ANY, "<= index_attr NULL (attribute type %s has no canonical name)\n", type, 0, 0 ); @@ -221,14 +224,14 @@ int ldbm_tool_index_attr( } #endif - assert( at_cn != NULL ); - attr_mask( be->be_private, at_cn, &indexmask ); + assert( desc != NULL ); + attr_mask( be->be_private, desc, &indexmask ); - if ( (db = ldbm_cache_open( be, at_cn, LDBM_SUFFIX, LDBM_NEWDB )) + if ( (db = ldbm_cache_open( be, at_cname, LDBM_SUFFIX, LDBM_NEWDB )) == NULL ) { Debug( LDAP_DEBUG_ANY, - "<= index_attr NULL (could not open %s%s)\n", at_cn, + "<= index_attr NULL (could not open %s%s)\n", at_cname, LDBM_SUFFIX, 0 ); return 0; } @@ -243,22 +246,22 @@ int ldbm_tool_index_change( #ifdef SLAPD_SCHEMA_NOT_COMPAT AttributeDescription *desc, #else - char* type, + char* desc, #endif struct berval **bv, ID id, int op ) { -#ifdef SLAPD_SCHEMA_NOT_COMPAT - char *type = desc->ad_cname->bv_val; -#endif - assert( slapMode & SLAP_TOOL_MODE ); +#ifdef SLAPD_SCHEMA_NOT_COMPAT + index_values( be, desc, bv, id, op ); +#else index_change_values( be, - type, bv, id, op ); + desc, bv, id, op ); return 0; +#endif } int ldbm_tool_sync( BackendDB *be ) diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index 73dacaf485..dd9a95918e 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -110,8 +110,8 @@ str2entry( char *s ) maxvals = 0; a = NULL; } -#endif +#endif if ( strcasecmp( type, "dn" ) == 0 ) { free( type ); diff --git a/servers/slapd/filterentry.c b/servers/slapd/filterentry.c index a751cca054..87b011b1a0 100644 --- a/servers/slapd/filterentry.c +++ b/servers/slapd/filterentry.c @@ -229,8 +229,11 @@ test_ava_filter( MatchingRule *mr; switch ( type ) { - case LDAP_FILTER_EQUALITY: case LDAP_FILTER_APPROX: + mr = a->a_desc->ad_type->sat_approx; + if( mr != NULL ) break; + + case LDAP_FILTER_EQUALITY: mr = a->a_desc->ad_type->sat_equality; break; diff --git a/servers/slapd/index.c b/servers/slapd/index.c new file mode 100644 index 0000000000..153cff79a8 --- /dev/null +++ b/servers/slapd/index.c @@ -0,0 +1,68 @@ +/* index.c - index utilities */ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + +#include "portable.h" + +#include + +#include "slap.h" + +int +slap_index2prefix( int indextype ) +{ + int prefix; + + switch ( indextype ) { + case SLAP_INDEX_EQUALITY: + prefix = SLAP_INDEX_EQUALITY_PREFIX; + break; + case SLAP_INDEX_APPROX: + prefix = SLAP_INDEX_APPROX_PREFIX; + break; + case SLAP_INDEX_SUBSTR: + prefix = SLAP_INDEX_SUBSTR_PREFIX; + break; + default: + prefix = SLAP_INDEX_UNKNOWN_PREFIX; + break; + } + + return( prefix ); +} + +int slap_str2index( const char *str, slap_index *idx ) +{ + if ( strcasecmp( str, "pres" ) == 0 ) { + *idx = SLAP_INDEX_PRESENT; + } else if ( strcasecmp( str, "eq" ) == 0 ) { + *idx = SLAP_INDEX_EQUALITY; + } else if ( strcasecmp( str, "approx" ) == 0 ) { + *idx = SLAP_INDEX_APPROX; + } else if ( strcasecmp( str, "subinitial" ) == 0 ) { + *idx = SLAP_INDEX_SUBSTR_INITIAL; + } else if ( strcasecmp( str, "subany" ) == 0 ) { + *idx = SLAP_INDEX_SUBSTR_ANY; + } else if ( strcasecmp( str, "subfinal" ) == 0 ) { + *idx = SLAP_INDEX_SUBSTR_FINAL; + } else if ( strcasecmp( str, "substr" ) == 0 || + strcasecmp( str, "sub" ) == 0 ) + { + *idx = SLAP_INDEX_SUBSTR_DEFAULT; + } else if ( strcasecmp( str, "lang" ) == 0 ) { + *idx = SLAP_INDEX_LANG; + } else if ( strcasecmp( str, "autolang" ) == 0 ) { + *idx = SLAP_INDEX_AUTO_LANG; + } else if ( strcasecmp( str, "subtypes" ) == 0 ) { + *idx = SLAP_INDEX_SUBTYPES; + } else if ( strcasecmp( str, "autosubtypes" ) == 0 ) { + *idx = SLAP_INDEX_AUTO_SUBTYPES; + } else { + return LDAP_OTHER; + } + + return LDAP_SUCCESS; +} diff --git a/servers/slapd/libslapd.dsp b/servers/slapd/libslapd.dsp index 152c8525dc..da4167d05a 100644 --- a/servers/slapd/libslapd.dsp +++ b/servers/slapd/libslapd.dsp @@ -224,6 +224,10 @@ SOURCE=.\filterentry.c # End Source File # Begin Source File +SOURCE=.\index.c +# End Source File +# Begin Source File + SOURCE=.\init.c # End Source File # Begin Source File @@ -296,6 +300,10 @@ SOURCE=.\schema_init.c # End Source File # Begin Source File +SOURCE=.\schema_prep.c +# End Source File +# Begin Source File + SOURCE=.\schemaparse.c # End Source File # Begin Source File diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 0f883d16e1..b840de0009 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -267,6 +267,13 @@ LIBSLAPD_F (int) get_manageDSAit LDAP_P(( Operation *op )); LIBSLAPD_F (int) read_config LDAP_P(( const char *fname )); + +/* + * index.c + */ +LIBSLAPD_F (int) slap_index2prefix LDAP_P(( int indextype )); +LIBSLAPD_F (int) slap_str2index LDAP_P(( const char *str, slap_index *idx )); + /* * connection.c */ diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 4ad571a850..cc51408d3e 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -15,6 +15,125 @@ #include "slap.h" #include "ldap_pvt.h" +#include "lutil_md5.h" + +static int +octetStringMatch( + int *matchp, + unsigned use, + Syntax *syntax, + MatchingRule *mr, + struct berval *value, + void *assertedValue ) +{ + int match = value->bv_len - ((struct berval *) assertedValue)->bv_len; + + if( match == 0 ) { + match = memcmp( value->bv_val, + ((struct berval *) assertedValue)->bv_val, + value->bv_len ); + } + + *matchp = match; + return LDAP_SUCCESS; +} + +/* Index generation function */ +int octetStringIndexer( + unsigned use, + Syntax *syntax, + MatchingRule *mr, + struct berval *prefix, + struct berval **values, + struct berval ***keysp ) +{ + int i; + size_t slen, mlen; + struct berval **keys; + lutil_MD5_CTX MD5context; + unsigned char MD5digest[16]; + struct berval digest; + digest.bv_val = MD5digest; + digest.bv_len = sizeof(MD5digest); + + for( i=0; values[i] != NULL; i++ ) { + /* just count them */ + } + + assert( i > 0 ); + + keys = ch_malloc( sizeof( struct berval * ) * (i+1) ); + + slen = strlen( syntax->ssyn_oid ); + mlen = strlen( mr->smr_oid ); + + for( i=0; values[i] != NULL; i++ ) { + lutil_MD5Init( &MD5context ); + if( prefix != NULL && prefix->bv_len > 0 ) { + lutil_MD5Update( &MD5context, + prefix->bv_val, prefix->bv_len ); + } + lutil_MD5Update( &MD5context, + syntax->ssyn_oid, slen ); + lutil_MD5Update( &MD5context, + mr->smr_oid, mlen ); + lutil_MD5Update( &MD5context, + values[i]->bv_val, values[i]->bv_len ); + lutil_MD5Final( MD5digest, &MD5context ); + + keys[i] = ber_bvdup( &digest ); + } + + keys[i] = NULL; + + *keysp = keys; + + return LDAP_SUCCESS; +} + +/* Index generation function */ +int octetStringFilter( + unsigned use, + Syntax *syntax, + MatchingRule *mr, + struct berval *prefix, + void * assertValue, + struct berval ***keysp ) +{ + size_t slen, mlen; + struct berval **keys; + lutil_MD5_CTX MD5context; + unsigned char MD5digest[LUTIL_MD5_BYTES]; + struct berval *value = (struct berval *) assertValue; + struct berval digest; + digest.bv_val = MD5digest; + digest.bv_len = sizeof(MD5digest); + + slen = strlen( syntax->ssyn_oid ); + mlen = strlen( mr->smr_oid ); + + keys = ch_malloc( sizeof( struct berval * ) * 2 ); + + lutil_MD5Init( &MD5context ); + if( prefix != NULL && prefix->bv_len > 0 ) { + lutil_MD5Update( &MD5context, + prefix->bv_val, prefix->bv_len ); + } + lutil_MD5Update( &MD5context, + syntax->ssyn_oid, slen ); + lutil_MD5Update( &MD5context, + mr->smr_oid, mlen ); + lutil_MD5Update( &MD5context, + value->bv_val, value->bv_len ); + lutil_MD5Final( MD5digest, &MD5context ); + + keys[0] = ber_bvdup( &digest ); + keys[1] = NULL; + + *keysp = keys; + + return LDAP_SUCCESS; +} static int dnValidate( @@ -666,6 +785,110 @@ done: } #endif +/* Index generation function */ +int caseIgnoreIA5Indexer( + unsigned use, + Syntax *syntax, + MatchingRule *mr, + struct berval *prefix, + struct berval **values, + struct berval ***keysp ) +{ + int i; + size_t slen, mlen; + struct berval **keys; + lutil_MD5_CTX MD5context; + unsigned char MD5digest[16]; + struct berval digest; + digest.bv_val = MD5digest; + digest.bv_len = sizeof(MD5digest); + + for( i=0; values[i] != NULL; i++ ) { + /* just count them */ + } + + assert( i > 0 ); + + keys = ch_malloc( sizeof( struct berval * ) * (i+1) ); + + slen = strlen( syntax->ssyn_oid ); + mlen = strlen( mr->smr_oid ); + + for( i=0; values[i] != NULL; i++ ) { + struct berval *value = ber_bvdup( values[i] ); + ldap_pvt_str2upper( value->bv_val ); + + lutil_MD5Init( &MD5context ); + if( prefix != NULL && prefix->bv_len > 0 ) { + lutil_MD5Update( &MD5context, + prefix->bv_val, prefix->bv_len ); + } + lutil_MD5Update( &MD5context, + syntax->ssyn_oid, slen ); + lutil_MD5Update( &MD5context, + mr->smr_oid, mlen ); + lutil_MD5Update( &MD5context, + value->bv_val, value->bv_len ); + lutil_MD5Final( MD5digest, &MD5context ); + + ber_bvfree( value ); + + keys[i] = ber_bvdup( &digest ); + } + + keys[i] = NULL; + *keysp = keys; + return LDAP_SUCCESS; +} + +/* Index generation function */ +int caseIgnoreIA5Filter( + unsigned use, + Syntax *syntax, + MatchingRule *mr, + struct berval *prefix, + void * assertValue, + struct berval ***keysp ) +{ + size_t slen, mlen; + struct berval **keys; + lutil_MD5_CTX MD5context; + unsigned char MD5digest[LUTIL_MD5_BYTES]; + struct berval *value; + struct berval digest; + digest.bv_val = MD5digest; + digest.bv_len = sizeof(MD5digest); + + slen = strlen( syntax->ssyn_oid ); + mlen = strlen( mr->smr_oid ); + + value = ber_bvdup( (struct berval *) assertValue ); + ldap_pvt_str2upper( value->bv_val ); + + keys = ch_malloc( sizeof( struct berval * ) * 2 ); + + lutil_MD5Init( &MD5context ); + if( prefix != NULL && prefix->bv_len > 0 ) { + lutil_MD5Update( &MD5context, + prefix->bv_val, prefix->bv_len ); + } + lutil_MD5Update( &MD5context, + syntax->ssyn_oid, slen ); + lutil_MD5Update( &MD5context, + mr->smr_oid, mlen ); + lutil_MD5Update( &MD5context, + value->bv_val, value->bv_len ); + lutil_MD5Final( MD5digest, &MD5context ); + + keys[0] = ber_bvdup( &digest ); + keys[1] = NULL; + + ber_bvfree( value ); + + *keysp = keys; + return LDAP_SUCCESS; +} + static int NumericStringNormalize( Syntax *syntax, @@ -856,8 +1079,10 @@ struct syntax_defs_rec syntax_defs[] = { 0, NULL, NULL, NULL}, {"( 1.3.6.1.4.1.4203.666.2.3 DESC 'OpenLDAP void' " X_HIDE ")" , SLAP_SYNTAX_HIDE, inValidate, NULL, NULL}, +#if 0 /* not needed */ {"( 1.3.6.1.4.1.4203.666.2.4 DESC 'OpenLDAP DN' " X_HIDE ")" , SLAP_SYNTAX_HIDE, inValidate, NULL, NULL}, +#endif {NULL, 0, NULL, NULL, NULL} }; @@ -931,21 +1156,33 @@ struct mrule_defs_rec { #define OpenLDAPaciMatch NULL #define authPasswordMatch NULL +/* unimplied indexer/filter routines */ +#define dnIndexer NULL +#define dnFilter NULL + +#define caseIgnoreIndexer caseIgnoreIA5Indexer +#define caseIgnoreFilter caseIgnoreIA5Filter +#define caseExactIndexer caseExactIA5Indexer +#define caseExactFilter caseExactIA5Filter +#define caseExactIA5Indexer caseIgnoreIA5Indexer +#define caseExactIA5Filter caseIgnoreIA5Filter + struct mrule_defs_rec mrule_defs[] = { {"( 2.5.13.0 NAME 'objectIdentifierMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )", SLAP_MR_EQUALITY | SLAP_MR_EXT, - NULL, NULL, objectIdentifierMatch, NULL, NULL}, + NULL, NULL, objectIdentifierMatch, + caseIgnoreIA5Indexer, caseIgnoreIA5Filter}, {"( 2.5.13.1 NAME 'distinguishedNameMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )", SLAP_MR_EQUALITY | SLAP_MR_EXT, - NULL, NULL, dnMatch, NULL, NULL}, + NULL, NULL, dnMatch, dnIndexer, dnFilter}, {"( 2.5.13.2 NAME 'caseIgnoreMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )", SLAP_MR_EQUALITY | SLAP_MR_EXT, - NULL, NULL, caseIgnoreMatch, NULL, NULL}, + NULL, NULL, caseIgnoreMatch, caseIgnoreIndexer, caseIgnoreFilter}, {"( 2.5.13.3 NAME 'caseIgnoreOrderingMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )", @@ -961,7 +1198,7 @@ struct mrule_defs_rec mrule_defs[] = { {"( 2.5.13.5 NAME 'caseExactMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )", SLAP_MR_EQUALITY | SLAP_MR_EXT, - NULL, NULL, caseExactMatch, NULL, NULL}, + NULL, NULL, caseExactMatch, caseExactIndexer, caseExactFilter}, {"( 2.5.13.6 NAME 'caseExactOrderingMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )", @@ -1006,7 +1243,7 @@ struct mrule_defs_rec mrule_defs[] = { {"( 2.5.13.17 NAME 'octetStringMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )", SLAP_MR_EQUALITY | SLAP_MR_EXT, - NULL, NULL, octetStringMatch, NULL, NULL}, + NULL, NULL, octetStringMatch, octetStringIndexer, octetStringFilter}, {"( 2.5.13.20 NAME 'telephoneNumberMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )", @@ -1056,12 +1293,12 @@ struct mrule_defs_rec mrule_defs[] = { {"( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )", SLAP_MR_EQUALITY | SLAP_MR_EXT, - NULL, NULL, caseExactIA5Match, NULL, NULL}, + NULL, NULL, caseExactIA5Match, caseExactIA5Indexer, caseExactIA5Filter}, {"( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )", SLAP_MR_EQUALITY | SLAP_MR_EXT, - NULL, NULL, caseIgnoreIA5Match, NULL, NULL}, + NULL, NULL, caseIgnoreIA5Match, caseExactIA5Indexer, caseExactIA5Filter}, {"( 1.3.6.1.4.1.1466.109.114.3 NAME 'caseIgnoreIA5SubstringsMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )", diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index caa65db0f8..6dcef2c184 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -108,13 +108,43 @@ LIBSLAPD_F (int) slap_debug; /* * Index types */ -#define SLAP_INDEX_PRESENCE 0x0001U -#define SLAP_INDEX_EQUALITY 0x0002U -#define SLAP_INDEX_APPROX 0x0004U -#define SLAP_INDEX_SUBSTR 0x0008U -#define SLAP_INDEX_EXTENDED 0x0010U -#define SLAP_INDEX_UNDEFINED 0x1000U -#define SLAP_INDEX_FROMINIT 0x8000U /* psuedo type */ +#define SLAP_INDEX_TYPE 0x00FFUL +#define SLAP_INDEX_UNDEFINED 0x0001UL +#define SLAP_INDEX_PRESENT 0x0002UL +#define SLAP_INDEX_EQUALITY 0x0004UL +#define SLAP_INDEX_APPROX 0x0008UL +#define SLAP_INDEX_SUBSTR 0x0010UL +#define SLAP_INDEX_EXTENDED 0x0020UL + +#define SLAP_INDEX_DEFAULT SLAP_INDEX_EQUALITY + +#define IS_SLAP_INDEX(mask, type) (((mask) & (type)) == (type) ) + +#define SLAP_INDEX_SUBSTR_TYPE 0x0F00UL + +#define SLAP_INDEX_SUBSTR_INITIAL ( SLAP_INDEX_SUBSTR | 0x0100UL ) +#define SLAP_INDEX_SUBSTR_ANY ( SLAP_INDEX_SUBSTR | 0x0200UL ) +#define SLAP_INDEX_SUBSTR_FINAL ( SLAP_INDEX_SUBSTR | 0x0400UL ) +#define SLAP_INDEX_SUBSTR_DEFAULT ( SLAP_INDEX_SUBSTR \ + | SLAP_INDEX_SUBSTR_INITIAL | SLAP_INDEX_SUBSTR_FINAL ) + +#define SLAP_INDEX_FLAGS 0xF000UL +#define SLAP_INDEX_SUBTYPES 0x1000UL /* use index with subtypes */ +#define SLAP_INDEX_AUTO_SUBTYPES 0x2000UL /* use mask with subtypes */ +#define SLAP_INDEX_LANG 0x4000UL /* use index with lang subtypes */ +#define SLAP_INDEX_AUTO_LANG 0x8000UL /* use mask with lang subtypes */ + +typedef long slap_index; + +/* + * there is a single index for each attribute. these prefixes ensure + * that there is no collision among keys. + */ +#define SLAP_INDEX_EQUALITY_PREFIX '=' /* prefix for equality keys */ +#define SLAP_INDEX_APPROX_PREFIX '~' /* prefix for approx keys */ +#define SLAP_INDEX_SUBSTR_PREFIX '*' /* prefix for substring keys */ +#define SLAP_INDEX_CONT_PREFIX '.' /* prefix for continuation keys */ +#define SLAP_INDEX_UNKNOWN_PREFIX '?' /* prefix for unknown keys */ /* * represents schema information for a database @@ -211,18 +241,18 @@ typedef int slap_mr_indexer_func LDAP_P(( unsigned use, struct slap_syntax *syntax, /* syntax of stored value */ struct slap_matching_rule *mr, + struct berval *prefix, struct berval **values, - struct berval **keys )); - -struct slap_filter; /* forward declaration */ + struct berval ***keys )); /* Filter index function */ typedef int slap_mr_filter_func LDAP_P(( unsigned use, struct slap_syntax *syntax, /* syntax of stored value */ struct slap_matching_rule *mr, - struct slap_filter *filter, - struct berval **keys )); + struct berval *prefix, + void * assertValue, + struct berval ***keys )); typedef struct slap_matching_rule { LDAP_MATCHING_RULE smr_mrule; @@ -266,6 +296,7 @@ typedef struct slap_attribute_type { struct slap_attribute_type *sat_sup; struct slap_attribute_type **sat_subtypes; MatchingRule *sat_equality; + MatchingRule *sat_approx; MatchingRule *sat_ordering; MatchingRule *sat_substr; Syntax *sat_syntax; @@ -326,6 +357,7 @@ typedef struct slap_attr_desc { #define SLAP_DESC_BINARY 0x1U } AttributeDescription; +#define slap_ad_is_lang(ad) ( (ad)->ad_lang != NULL ) #define slap_ad_is_binary(ad) ( (int)((ad)->ad_flags & SLAP_DESC_BINARY) ? 1 : 0 ) /* @@ -492,6 +524,7 @@ typedef struct slap_filter { #define f_dn f_un.f_un_type /* used for DN indices */ #define f_type f_un.f_un_type +#define f_desc f_type #define f_ava f_un.f_un_ava #define f_avtype f_un.f_un_ava.ava_type #define f_avvalue f_un.f_un_ava.ava_value diff --git a/servers/slapd/slapd.dsp b/servers/slapd/slapd.dsp index fa8bfc63e7..c0b8dc9def 100644 --- a/servers/slapd/slapd.dsp +++ b/servers/slapd/slapd.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib advapi32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" +# ADD LINK32 advapi32.lib sasl.lib hs_regex.lib libdb.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\Release" !ELSEIF "$(CFG)" == "slapd - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib advapi32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" +# ADD LINK32 advapi32.lib hs_regex.lib libdb.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\Debug" !ELSEIF "$(CFG)" == "slapd - Win32 Single Debug" @@ -102,7 +102,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 hs_regexd.lib libdbs.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" +# ADD LINK32 hs_regex.lib libdb.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug" !ELSEIF "$(CFG)" == "slapd - Win32 Single Release" @@ -127,7 +127,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 hs_regex.lib libdb.lib wsock32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 sasl.lib hs_regex.lib libdb.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ENDIF diff --git a/servers/slapd/tools/Makefile.in b/servers/slapd/tools/Makefile.in index 11fe1c0a8d..6255a284b5 100644 --- a/servers/slapd/tools/Makefile.in +++ b/servers/slapd/tools/Makefile.in @@ -57,7 +57,7 @@ SLAPD_OBJS = ../config.o ../ch_malloc.o ../backend.o ../charray.o \ ../schemaparse.o ../ad.o ../at.o ../mr.o ../oc.o ../syntax.o \ ../acl.o ../phonetic.o ../attr.o ../value.o ../entry.o \ ../dn.o ../filter.o ../str2filter.o ../ava.o ../init.o \ - ../controls.o ../kerberos.o ../passwd.o \ + ../controls.o ../kerberos.o ../passwd.o ../index.o \ ../extended.o ../starttls.o SLAPOBJS = $(SLAPD_OBJS) slapcommon.o mimic.o diff --git a/servers/slapd/tools/ldbmtest.dsp b/servers/slapd/tools/ldbmtest.dsp index f67df7c2fd..3f83351506 100644 --- a/servers/slapd/tools/ldbmtest.dsp +++ b/servers/slapd/tools/ldbmtest.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libdb.lib hs_regex.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 libdb.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "ldbmtest - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libdb.lib hs_regex.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "ldbmtest - Win32 Single Debug" @@ -102,7 +102,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libdb.lib hs_regex.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" +# ADD LINK32 libdb.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" !ELSEIF "$(CFG)" == "ldbmtest - Win32 Single Release" @@ -126,7 +126,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libdbs.lib hs_regex.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" +# ADD LINK32 libdbs.lib libsasl.lib hs_regex.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" !ENDIF diff --git a/servers/slapd/tools/ldif.dsp b/servers/slapd/tools/ldif.dsp index 28f1f43d44..7b32bb1d41 100644 --- a/servers/slapd/tools/ldif.dsp +++ b/servers/slapd/tools/ldif.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "ldif - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "ldif - Win32 Single Debug" @@ -102,7 +102,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldif32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" -# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" +# ADD LINK32 libdbs.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" !ELSEIF "$(CFG)" == "ldif - Win32 Single Release" @@ -127,7 +127,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldif32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" -# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" +# ADD LINK32 libdbs.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" !ENDIF diff --git a/servers/slapd/tools/slapadd.dsp b/servers/slapd/tools/slapadd.dsp index 5c681944eb..bc5a39369a 100644 --- a/servers/slapd/tools/slapadd.dsp +++ b/servers/slapd/tools/slapadd.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 libdb.lib sasl.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "slapadd - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "slapadd - Win32 Single Debug" @@ -102,7 +102,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" !ELSEIF "$(CFG)" == "slapadd - Win32 Single Release" @@ -127,7 +127,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" +# ADD LINK32 libdbs.lib sasl.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" !ENDIF diff --git a/servers/slapd/tools/slapcat.dsp b/servers/slapd/tools/slapcat.dsp index 4d0e2ecd82..694beae96f 100644 --- a/servers/slapd/tools/slapcat.dsp +++ b/servers/slapd/tools/slapcat.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 libdb.lib sasl.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "slapcat - Win32 Debug" @@ -77,7 +77,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "slapcat - Win32 Single Debug" @@ -102,7 +102,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 oldbm32.lib libdb.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug" -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" !ELSEIF "$(CFG)" == "slapcat - Win32 Single Release" @@ -126,7 +126,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libdb.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release" -# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" +# ADD LINK32 libdbs.lib sasl.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease" !ENDIF diff --git a/servers/slapd/tools/slapindex.c b/servers/slapd/tools/slapindex.c index 1bff4b996b..eca11e2f1f 100644 --- a/servers/slapd/tools/slapindex.c +++ b/servers/slapd/tools/slapindex.c @@ -47,17 +47,12 @@ main( int argc, char **argv ) #ifdef SLAPD_SCHEMA_NOT_COMPAT type = argv[argc - 1]; - if( strcasecmp( type, "dn" ) == 0 ) { - desc = NULL; + rc = slap_str2ad( type, &desc, &text ); - } else { - rc = slap_str2ad( type, &desc, &text ); - - if( rc != LDAP_SUCCESS ) { - fprintf( stderr, "%s: unrecognized attribute type: %s\n", - progname, text ); - exit( EXIT_FAILURE ); - } + if( rc != LDAP_SUCCESS ) { + fprintf( stderr, "%s: unrecognized attribute type: %s\n", + progname, text ); + exit( EXIT_FAILURE ); } #else desc = type = attr_normalize( argv[argc - 1] ); @@ -79,10 +74,7 @@ main( int argc, char **argv ) id != NOID; id = be->be_entry_next( be ) ) { - struct berval **values; Entry* e = be->be_entry_get( be, id ); - struct berval bv; - struct berval *bvals[2]; if ( e == NULL ) { fprintf( stderr, @@ -97,12 +89,13 @@ main( int argc, char **argv ) id, e->e_dn ); } -#ifdef SLAPD_SCHEMA_NOT_COMPAT - if( desc == NULL ) -#else +#ifndef SLAPD_SCHEMA_NOT_COMPAT if( strcasecmp( type, "dn" ) == 0 ) -#endif { + struct berval **values; + struct berval bv; + struct berval *bvals[2]; + bv.bv_val = e->e_ndn; bv.bv_len = strlen( bv.bv_val ); bvals[0] = &bv; @@ -121,7 +114,9 @@ main( int argc, char **argv ) } } - } else { + } else +#endif + { Attribute *attr; #ifdef SLAPD_SCHEMA_NOT_COMPAT diff --git a/servers/slapd/tools/slapindex.dsp b/servers/slapd/tools/slapindex.dsp index e79fa2f466..f0e4e386c9 100644 --- a/servers/slapd/tools/slapindex.dsp +++ b/servers/slapd/tools/slapindex.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" +# ADD LINK32 libdb.lib sasl.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release" !ELSEIF "$(CFG)" == "slapindex - Win32 Debug" @@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug" !ELSEIF "$(CFG)" == "slapindex - Win32 Single Debug" @@ -103,7 +103,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib shell32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 hs_regex.lib libdb.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" +# ADD LINK32 libdb.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug" !ELSEIF "$(CFG)" == "slapindex - Win32 Single Release" @@ -128,7 +128,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 hs_regex.lib libdbs.lib ws2_32.lib odbc32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" +# ADD LINK32 libdbs.lib sasl.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease" !ENDIF diff --git a/tests/data/slapd-acl.conf b/tests/data/slapd-acl.conf index 6e82c4b15c..63df714c1b 100644 --- a/tests/data/slapd-acl.conf +++ b/tests/data/slapd-acl.conf @@ -21,8 +21,7 @@ suffix "o=University of Michigan, c=US" directory ./test-db rootdn "cn=Manager, o=University of Michigan, c=US" rootpw secret -index cn,sn,uid pres,eq,approx -index default none +index cn,sn,uid pres,eq lastmod on defaultaccess none diff --git a/tests/data/slapd-master.conf b/tests/data/slapd-master.conf index e62ea5f175..a192c426f0 100644 --- a/tests/data/slapd-master.conf +++ b/tests/data/slapd-master.conf @@ -20,8 +20,6 @@ suffix "o=University of Michigan, c=US" directory ./test-db rootdn "cn=Manager, o=University of Michigan, c=US" rootpw secret -index cn,sn,uid pres,eq,approx -index default none -lastmod on +index cn,sn,uid pres,eq dbnosync dbnolocking diff --git a/tests/data/slapd-pw.conf b/tests/data/slapd-pw.conf index 4c85e6b67a..29fa8e2824 100644 --- a/tests/data/slapd-pw.conf +++ b/tests/data/slapd-pw.conf @@ -23,8 +23,7 @@ suffix "o=University of Michigan, c=US" directory ./test-db rootdn "cn=Manager, o=University of Michigan, c=US" rootpw secret -index cn,sn,uid pres,eq,approx -index default none +index cn,sn,uid pres,eq lastmod on defaultaccess none diff --git a/tests/data/slapd-ref-slave.conf b/tests/data/slapd-ref-slave.conf index 9d1179ff99..9182fa48f6 100644 --- a/tests/data/slapd-ref-slave.conf +++ b/tests/data/slapd-ref-slave.conf @@ -25,7 +25,5 @@ suffix "o=University of Mich, c=US" directory ./test-repl rootdn "cn=Manager, o=University of Mich, c=US" rootpw secret -index cn,sn,uid pres,eq,approx -index default none -# index default pres,eq,approx +index cn,sn,uid pres,eq lastmod on diff --git a/tests/data/slapd-repl-master.conf b/tests/data/slapd-repl-master.conf index e0a57d2b48..76df58f818 100644 --- a/tests/data/slapd-repl-master.conf +++ b/tests/data/slapd-repl-master.conf @@ -23,9 +23,7 @@ suffix "o=University of Michigan, c=US" directory ./test-db rootdn "cn=Manager, o=University of Michigan, c=US" rootpw secret -index cn,sn,uid pres,eq,approx -index default none -# index default pres,eq,approx +index cn,sn,uid pres,eq lastmod on replogfile ./test-db/slapd.replog diff --git a/tests/data/slapd-repl-slave.conf b/tests/data/slapd-repl-slave.conf index d6da9ee3f8..bc35f46d78 100644 --- a/tests/data/slapd-repl-slave.conf +++ b/tests/data/slapd-repl-slave.conf @@ -26,7 +26,5 @@ rootdn "cn=Replica, o=University of Michigan, c=US" rootpw secret updatedn "cn=Replica, o=University of Michigan, c=US" updateref "ldap://localhost:9009/o=University%20of%20Michigan,c=US" -index cn,sn,uid pres,eq,approx -index default none -# index default pres,eq,approx +index cn,sn,uid pres,eq lastmod on -- 2.39.5