Merge lp:~ahasenack/serverguide/samba-indexes-1603540 into lp:serverguide/trunk

Proposed by Andreas Hasenack
Status: Merged
Approved by: Doug Smythies
Approved revision: 322
Merged at revision: 320
Proposed branch: lp:~ahasenack/serverguide/samba-indexes-1603540
Merge into: lp:serverguide/trunk
Diff against target: 42 lines (+9/-9)
1 file modified
serverguide/C/network-auth.xml (+9/-9)
To merge this branch: bzr merge lp:~ahasenack/serverguide/samba-indexes-1603540
Reviewer Review Type Date Requested Status
Doug Smythies Approve
Review via email:

Commit message

Fix proposed samba indexes to avoid duplication errors.

Description of the change

Fix proposed samba indexes to avoid duplication errors.

If you follow the step "Samba indices", and after you change the backend to mdb (that needs to be fixed all over the place and I will open a separate bug about that), you will get duplicate index errors.

That's because out of the box the package already gives you a few:
olcDbIndex: objectClass eq
olcDbIndex: cn,uid eq
olcDbIndex: uidNumber,gidNumber eq
olcDbIndex: member,memberUid eq

We should only add the indexes we need, but that's a bit complicated because you can't modify an existing "cn,uid eq" to "cn,uid eq,sub" (i.e., add "sub") without removing the index first.

An ldapmodify command to do that can be easily constructed, but I think that could get brittle with time because it would depend on the existing indexes the package gives you: if the maintainer decided to change that set, the instructions in the guide would start failing again.

Therefore I propose here to do a bulk index replacement via a "changetype: modify" followed by "replace: olcDbIndex". If this were done on a populated DIT, that would be a very expensive operation, because everything would be reindexed (I'm not sure if openldap knows that an index is being replaced by itself), but this guide assumes a fresh install of slapd, so I think we are good. I took care to merge the existing indexes you get after package installation with the ones we need for samba.

Other changes I did:
- I removed the "pres" index as the openldap admin guide basically says it's seldom useful ( indexing).
- I added "eq" to the default index type, I think it's the most basic and used one
- grouped indexes of the same type in the same line to make this excerpt a bit shorter

To post a comment you must log in.
Revision history for this message
Doug Smythies (dsmythies) wrote :

O.K. thanks.

(in general, I'll have to take your word for it on the actual content changes, as I do not know.)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'serverguide/C/network-auth.xml'
2--- serverguide/C/network-auth.xml 2017-05-09 14:13:52 +0000
3+++ serverguide/C/network-auth.xml 2017-05-09 19:24:01 +0000
4@@ -2412,21 +2412,21 @@
5 </para>
7 <programlisting>
8-dn: olcDatabase={1}hdb,cn=config
9+dn: olcDatabase={1}mdb,cn=config
10 changetype: modify
11-add: olcDbIndex
12-olcDbIndex: uidNumber eq
13-olcDbIndex: gidNumber eq
14+replace: olcDbIndex
15+olcDbIndex: objectClass eq
16+olcDbIndex: uidNumber,gidNumber eq
17 olcDbIndex: loginShell eq
18-olcDbIndex: uid eq,pres,sub
19-olcDbIndex: memberUid eq,pres,sub
20-olcDbIndex: uniqueMember eq,pres
21+olcDbIndex: uid,cn eq,sub
22+olcDbIndex: memberUid eq,sub
23+olcDbIndex: member,uniqueMember eq
24 olcDbIndex: sambaSID eq
25 olcDbIndex: sambaPrimaryGroupSID eq
26 olcDbIndex: sambaGroupType eq
27 olcDbIndex: sambaSIDList eq
28 olcDbIndex: sambaDomainName eq
29-olcDbIndex: default sub
30+olcDbIndex: default sub,eq
31 </programlisting>
33 <para>
34@@ -2443,7 +2443,7 @@
36 <screen>
37 <command>sudo ldapsearch -Q -LLL -Y EXTERNAL -H \
38-ldapi:/// -b cn=config olcDatabase={1}hdb olcDbIndex</command>
39+ldapi:/// -b cn=config olcDatabase={1}mdb olcDbIndex</command>
40 </screen>
42 </sect3>


People subscribed via source and target branches