git.samba.org
/
garming
/
samba-autobuild
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
09ddad6
)
ldb: do not allow adding a DN as a base to itself
author
Douglas Bagnall
<douglas.bagnall@catalyst.net.nz>
Sat, 6 Jul 2019 11:24:43 +0000
(23:24 +1200)
committer
Douglas Bagnall
<dbagnall@samba.org>
Wed, 10 Jul 2019 04:32:13 +0000
(
04:32
+0000)
If you try to add a dn to itself, it expands as it goes. The resulting
loop cannot end well.
It looks like this in Python:
dn = ldb.Dn(ldb.Ldb(), 'CN=y,DC=x')
dn.add_base(dn)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
lib/ldb/common/ldb_dn.c
patch
|
blob
|
history
diff --git
a/lib/ldb/common/ldb_dn.c
b/lib/ldb/common/ldb_dn.c
index 2e98f3914673bf2b605f50f19bdcd0196efd2812..eccb4a0ce4b510501253108541f03967fd37c68a 100644
(file)
--- a/
lib/ldb/common/ldb_dn.c
+++ b/
lib/ldb/common/ldb_dn.c
@@
-1357,6
+1357,10
@@
bool ldb_dn_add_base(struct ldb_dn *dn, struct ldb_dn *base)
return false;
}
+ if (dn == base) {
+ return false; /* or we will visit infinity */
+ }
+
if (dn->components) {
unsigned int i;