diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2019-07-06 23:24:43 +1200 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2019-07-10 04:32:13 +0000 |
commit | 19a13cbe0681b3996c33f7449f69b0fb0dc5d640 (patch) | |
tree | 2bd8b38a5e17958eebf850006d9b561081c09943 /lib | |
parent | 09ddad6c14db6e3310b663f6203582104d85db45 (diff) | |
download | samba-19a13cbe0681b3996c33f7449f69b0fb0dc5d640.tar.gz |
ldb: do not allow adding a DN as a base to itself
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldb/common/ldb_dn.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c index 2e98f391467..eccb4a0ce4b 100644 --- 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; |