The branch, master has been updated via 977b3f6 python: Print the finddcs error message via 3022da1 libnet: Add NULL checks to py_net_finddc from e61e9e9 vfs_fruit: set delete-on-close for empty finderinfo
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 977b3f60cf0f504728f9b63343b9af1e8d6c359d Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 9 12:41:01 2018 +0100 python: Print the finddcs error message Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Tue Jan 9 22:41:28 CET 2018 on sn-devel-144 commit 3022da1a7267f9038f1f0de98d8d54baabd9c567 Author: Volker Lendecke <v...@samba.org> Date: Tue Jan 9 10:23:35 2018 +0100 libnet: Add NULL checks to py_net_finddc Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: python/samba/join.py | 3 +++ python/samba/netcmd/domain.py | 3 +++ source4/libnet/py_net.c | 10 ++++++++++ 3 files changed, 16 insertions(+) Changeset truncated at 500 lines: diff --git a/python/samba/join.py b/python/samba/join.py index 63e9b90..9782f53 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -336,6 +336,9 @@ class dc_join(object): """find a writeable DC for the given domain""" try: ctx.cldap_ret = ctx.net.finddc(domain=domain, flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE) + except NTSTATUSError as error: + raise Exception("Failed to find a writeable DC for domain '%s': %s" % + (domain, error[1])) except Exception: raise Exception("Failed to find a writeable DC for domain '%s'" % domain) if ctx.cldap_ret.client_site is not None and ctx.cldap_ret.client_site != "": diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py index ada7d6b..2cb14f1 100644 --- a/python/samba/netcmd/domain.py +++ b/python/samba/netcmd/domain.py @@ -1771,6 +1771,9 @@ class DomainTrustCommand(Command): if require_pdc: remote_flags |= nbt.NBT_SERVER_PDC remote_info = remote_net.finddc(flags=remote_flags, domain=domain, address=remote_server) + except NTSTATUSError as error: + raise CommandError("Failed to find a writeable DC for domain '%s': %s" % + (domain, error[1])) except Exception: raise CommandError("Failed to find a writeable DC for domain '%s'" % domain) flag_map = { diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c index 7ddee2d..0567dbd 100644 --- a/source4/libnet/py_net.c +++ b/source4/libnet/py_net.c @@ -697,8 +697,18 @@ static PyObject *py_net_finddc(py_net_Object *self, PyObject *args, PyObject *kw } mem_ctx = talloc_new(self->mem_ctx); + if (mem_ctx == NULL) { + PyErr_NoMemory(); + return NULL; + } io = talloc_zero(mem_ctx, struct finddcs); + if (io == NULL) { + TALLOC_FREE(mem_ctx); + PyErr_NoMemory(); + return NULL; + } + if (domain != NULL) { io->in.domain_name = domain; } -- Samba Shared Repository