pyldb: Raise an exception if ldb_dn_get_parent() fails
commit5905a63307fd48d8c316178b92b9027165901048
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 6 Jun 2023 01:56:32 +0000 (6 13:56 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 14 Jun 2023 22:57:35 +0000 (14 22:57 +0000)
tree6b4585ffc6a15106f11b08f0f4d19c88bf6fe12c
parent49592b80f751e3ff19b5b86ae0a7841fabfb8cf1
pyldb: Raise an exception if ldb_dn_get_parent() fails

Such a failure could be caused by situations other than memory errors,
but a simple indication of failure is all that ldb_dn_get_parent() gives
us to work with.

We keep the old behaviour of returning None if the DN has no components,
which an existing test (ldb.python.api.DnTests.test_parent_nonexistent)
expects.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/pyldb.c