diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-05-16 13:52:51 +1000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-05-28 16:20:08 +0200 |
commit | 54e092bb31001879f4d7a49e36a226c27b4d9843 (patch) | |
tree | 50290584eaff1b2a8e4461a0b498e7b44f4d7b09 | |
parent | 3bd686c5ad4756af1033ac14ba09a40156cc6d47 (diff) | |
download | samba-54e092bb31001879f4d7a49e36a226c27b4d9843.tar.gz samba-54e092bb31001879f4d7a49e36a226c27b4d9843.tar.bz2 samba-54e092bb31001879f4d7a49e36a226c27b4d9843.zip |
dsdb-linked_attributes: Do not crash if the target GUID can not be found
Note that we must not give an error when we cannot find the object
that should hold the backlink, there really isn't anything we can do
in this case.
Andrew Bartlett
Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/linked_attributes.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c index a55ec87f0f..eb57f91e6d 100644 --- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c +++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c @@ -4,6 +4,7 @@ Copyright (C) Andrew Bartlett <abartlet@samba.org> 2007 Copyright (C) Simo Sorce <idra@samba.org> 2008 Copyright (C) Matthieu Patou <mat@matws.net> 2011 + Copyright (C) Andrew Tridgell 2009 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -729,6 +730,20 @@ static int linked_attributes_fix_links(struct ldb_module *module, talloc_free(tmp_ctx); return ret; } + if (res->count == 0) { + /* Forward link without backlink object remaining - nothing to do here */ + continue; + } + if (res->count != 1) { + ldb_asprintf_errstring(ldb, "Linked attribute %s->%s between %s and %s - target GUID %s found more than once!", + el->name, target->lDAPDisplayName, + ldb_dn_get_linearized(old_dn), + ldb_dn_get_linearized(dsdb_dn->dn), + GUID_string(tmp_ctx, &link_guid)); + talloc_free(tmp_ctx); + return LDB_ERR_OPERATIONS_ERROR; + } + msg = res->msgs[0]; if (msg->num_elements == 0) { |