From: Andrew Bartlett Date: Mon, 27 Feb 2017 04:09:56 +0000 (+1300) Subject: pydns: Also return the DN of the LDB object when finding a DNS record X-Git-Tag: ldb-1.1.31~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7bc97433377daaf9cb8fde7fdea79f5848ec535;p=thirdparty%2Fsamba.git pydns: Also return the DN of the LDB object when finding a DNS record Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/python/samba/remove_dc.py b/python/samba/remove_dc.py index 61b5937ba7a..4c8ee892464 100644 --- a/python/samba/remove_dc.py +++ b/python/samba/remove_dc.py @@ -97,7 +97,7 @@ def remove_dns_references(samdb, logger, dnsHostName): dnsHostNameUpper = dnsHostName.upper() try: - primary_recs = samdb.dns_lookup(dnsHostName) + (dn, primary_recs) = samdb.dns_lookup(dnsHostName) except RuntimeError as (enum, estr): if enum == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: return @@ -140,7 +140,7 @@ def remove_dns_references(samdb, logger, dnsHostName): for a_name in a_names_to_remove_from: try: logger.debug("checking for DNS records to remove on %s" % a_name) - a_recs = samdb.dns_lookup(a_name) + (a_rec_dn, a_recs) = samdb.dns_lookup(a_name) except RuntimeError as (enum, estr): if enum == werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: return diff --git a/source4/dns_server/pydns.c b/source4/dns_server/pydns.c index 18c3c2953d9..3de9739f1f1 100644 --- a/source4/dns_server/pydns.c +++ b/source4/dns_server/pydns.c @@ -105,7 +105,7 @@ static int py_dnsp_DnssrvRpcRecord_get_array(PyObject *value, static PyObject *py_dsdb_dns_lookup(PyObject *self, PyObject *args) { struct ldb_context *samdb; - PyObject *py_ldb; + PyObject *py_ldb, *ret, *pydn; char *dns_name; TALLOC_CTX *frame; NTSTATUS status; @@ -149,8 +149,9 @@ static PyObject *py_dsdb_dns_lookup(PyObject *self, PyObject *args) } ret = py_dnsp_DnssrvRpcRecord_get_list(records, num_records); + pydn = pyldb_Dn_FromDn(dn); talloc_free(frame); - return ret; + return Py_BuildValue("(OO)", pydn, ret); } static PyObject *py_dsdb_dns_extract(PyObject *self, PyObject *args)