Issue 5344 - Wrong check for bad Modify DN
Summary: Wrong check for bad Modify DN
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: Normal normal
Target Milestone: 2.6.0
Assignee: Ondřej Kuzník
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-30 10:48 UTC by Hallvard Furuseth
Modified: 2021-10-25 22:07 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Hallvard Furuseth 2008-01-30 10:48:55 UTC
Full_Name: Hallvard B Furuseth
Version: HEAD
OS: 
URL: http://folk.uio.no/hbf/OpenLDAP/modrdn.diff
Submission from: (NULL) (129.240.6.233)
Submitted by: hallvard


The slapd/modrdn.c check for affectsMultipleDSAs is insufficient, it
requires newSuperior to be in the same backend.  That does not catch
moving "cn=x,cn=y" to another database's suffix "cn=z,cn=y".  Also
if a database has multiple suffixes it prevents moving an entry
to one of the suffixes.

slapd/modrdn.c can catch attempts to place an entry above/below itself.
It doesn't need to send those to the database and hope that catches it.
This patch puts it in the frontend (fe_op_modrdn); that needed to
generate the destination DN anyway for the affectsMultipleDSAs check.
Not sure if that's right or if it should go in do_modrdn() instead.
(I'm thinking of DN rewriting in rwm, vs. global overlays.)

In test005-modrdn, the "modrdn with newSuperior as child of target" check
would not catch anything: It expects failure, but the newSuperior did
not exist and would fail with noSuchObject in any case.  This patch uses
newSuperior=target instead, and expects unwillingToPerform.

I'll apply the patch later, unless someone thinks it should be done
differently.

Comment 1 Howard Chu 2008-01-30 11:10:55 UTC
h.b.furuseth@usit.uio.no wrote:
> Full_Name: Hallvard B Furuseth
> Version: HEAD
> OS:
> URL: http://folk.uio.no/hbf/OpenLDAP/modrdn.diff
> Submission from: (NULL) (129.240.6.233)
> Submitted by: hallvard
>
>
> The slapd/modrdn.c check for affectsMultipleDSAs is insufficient, it
> requires newSuperior to be in the same backend.  That does not catch
> moving "cn=x,cn=y" to another database's suffix "cn=z,cn=y".

I don't see how it can miss this.

> Also
> if a database has multiple suffixes it prevents moving an entry
> to one of the suffixes.

OK, I see that.

> slapd/modrdn.c can catch attempts to place an entry above/below itself.
> It doesn't need to send those to the database and hope that catches it.
> This patch puts it in the frontend (fe_op_modrdn); that needed to
> generate the destination DN anyway for the affectsMultipleDSAs check.
> Not sure if that's right or if it should go in do_modrdn() instead.
> (I'm thinking of DN rewriting in rwm, vs. global overlays.)

Probably should look at adding the dest_dn to the op struct, so each backend 
doesn't have to rebuild it.

> In test005-modrdn, the "modrdn with newSuperior as child of target" check
> would not catch anything: It expects failure, but the newSuperior did
> not exist and would fail with noSuchObject in any case.  This patch uses
> newSuperior=target instead, and expects unwillingToPerform.

> I'll apply the patch later, unless someone thinks it should be done
> differently.


-- 
   -- Howard Chu
   Chief Architect, Symas Corp.  http://www.symas.com
   Director, Highland Sun        http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP     http://www.openldap.org/project/

Comment 2 Hallvard Furuseth 2008-01-30 11:25:54 UTC
hyc@symas.com writes:
>> The slapd/modrdn.c check for affectsMultipleDSAs is insufficient, it
>> requires newSuperior to be in the same backend.  That does not catch
>> moving "cn=x,cn=y" to another database's suffix "cn=z,cn=y".
>
> I don't see how it can miss this.

It checks if newSuperior is in another backend, but that move doesn't
need a newSuperior.  It keeps the same parent:

database 1: suffix      cn=y
database 2: suffix cn=z,cn=y
modify rdn: dn "cn=x,cn=y"; newrdn cn=z; newSuperior (if any) cn=y.

> Probably should look at adding the dest_dn to the op struct, so each
> backend doesn't have to rebuild it.

Indeed.  And dest_ndn.

-- 
Hallvard

Comment 3 Hallvard Furuseth 2008-01-30 11:47:28 UTC
hyc@symas.com writes:
> Probably should look at adding the dest_dn to the op struct, so each
> backend doesn't have to rebuild it.

Third-party overlays which modify newrdn or newSuperior would become
incorrect, so maybe this change should wait for OpenLDAP 2.5.

-- 
Hallvard

Comment 4 ando@openldap.org 2008-02-09 11:00:37 UTC
moved from Incoming to Software Bugs
Comment 5 ando@openldap.org 2008-02-09 11:00:41 UTC
h.b.furuseth@usit.uio.no wrote:
> hyc@symas.com writes:
>>> The slapd/modrdn.c check for affectsMultipleDSAs is insufficient, it
>>> requires newSuperior to be in the same backend.  That does not catch
>>> moving "cn=x,cn=y" to another database's suffix "cn=z,cn=y".
>> I don't see how it can miss this.
> 
> It checks if newSuperior is in another backend, but that move doesn't
> need a newSuperior.  It keeps the same parent:
> 
> database 1: suffix      cn=y
> database 2: suffix cn=z,cn=y
> modify rdn: dn "cn=x,cn=y"; newrdn cn=z; newSuperior (if any) cn=y.
> 
>> Probably should look at adding the dest_dn to the op struct, so each
>> backend doesn't have to rebuild it.
> 
> Indeed.  And dest_ndn.

You should apply your initial patch (to HEAD, 2.4), then modify HEAD to
pass dest_dn/dest_ndn

p.



Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
---------------------------------------
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Email:   pierangelo.masarati@sys-net.it
---------------------------------------


Comment 6 Hallvard Furuseth 2008-02-11 17:48:22 UTC
changed notes
changed state Open to Test
Comment 7 Hallvard Furuseth 2008-02-11 21:11:46 UTC
Pierangelo Masarati writes:
> You should apply your initial patch (to HEAD, 2.4),

Done.

> then modify HEAD to pass dest_dn/dest_ndn

Later.

-- 
Hallvard

Comment 8 Howard Chu 2009-02-11 00:42:49 UTC
moved from Software Bugs to Development
Comment 9 ando@openldap.org 2009-02-14 16:40:49 UTC
changed notes
changed state Test to Open
Comment 10 OpenLDAP project 2014-08-01 21:04:58 UTC
Fixed in HEAD, RE24.
Todo (HEAD): add newDN field.
Comment 12 Ondřej Kuzník 2021-08-06 12:51:13 UTC
Do we document API changes for people maintaining external modules?
Comment 13 Howard Chu 2021-08-06 13:01:40 UTC
(In reply to Ondřej Kuzník from comment #12)
> Do we document API changes for people maintaining external modules?

slap.h is the documentation.
Comment 14 Quanah Gibson-Mount 2021-08-06 18:53:18 UTC
Commits: 
  • 1cf39a85 
by Ondřej Kuzník at 2021-08-06T15:30:47+01:00 
ITS#5344 Record and maintain new DN on ModRDN ops
Comment 15 Quanah Gibson-Mount 2021-08-16 16:43:13 UTC
Commits: 
  • 49ee5d9b 
by Howard Chu at 2021-08-13T21:09:28+01:00 
ITS#5344 slapo-rwm: fix prev commit