diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2019-01-10 12:55:19 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-02-13 04:15:14 +0100 |
commit | c874b62556b711082b62451f937f6102abdc3761 (patch) | |
tree | 71166d0ad638ea3e0729cd010d7c6f9beb3c4bec /source4 | |
parent | a086a6457b421c36562275a425ce2bbd32336f8f (diff) | |
download | samba-c874b62556b711082b62451f937f6102abdc3761.tar.gz |
dsdb: check NULL guid strings in la_fix_links
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/linked_attributes.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c index 816968584b5..a88cd173442 100644 --- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c +++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c @@ -721,6 +721,7 @@ static int linked_attributes_fix_links(struct ldb_module *module, struct ldb_message *msg; struct ldb_message_element *el2; struct GUID link_guid; + char *link_guid_str = NULL; dsdb_dn = dsdb_dn_parse(tmp_ctx, ldb, &el->values[i], schema_attr->syntax->ldap_oid); if (dsdb_dn == NULL) { @@ -739,11 +740,18 @@ static int linked_attributes_fix_links(struct ldb_module *module, return ret; } + link_guid_str = GUID_string(tmp_ctx, &link_guid); + if (link_guid_str == NULL) { + talloc_free(tmp_ctx); + return LDB_ERR_OPERATIONS_ERROR; + } + /* * get the existing message from the db for the object with * this GUID, returning attribute being modified. We will then * use this msg as the basis for a modify call */ + ret = dsdb_module_search(module, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE, attrs, DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SEARCH_ALL_PARTITIONS | @@ -751,13 +759,13 @@ static int linked_attributes_fix_links(struct ldb_module *module, DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT | DSDB_SEARCH_REVEAL_INTERNALS, parent, - "objectGUID=%s", GUID_string(tmp_ctx, &link_guid)); + "objectGUID=%s", link_guid_str); if (ret != LDB_SUCCESS) { ldb_asprintf_errstring(ldb, "Linked attribute %s->%s between %s and %s - target GUID %s not found - %s", el->name, target->lDAPDisplayName, ldb_dn_get_linearized(old_dn), ldb_dn_get_linearized(dsdb_dn->dn), - GUID_string(tmp_ctx, &link_guid), + link_guid_str, ldb_errstring(ldb)); talloc_free(tmp_ctx); return ret; @@ -771,7 +779,7 @@ static int linked_attributes_fix_links(struct ldb_module *module, el->name, target->lDAPDisplayName, ldb_dn_get_linearized(old_dn), ldb_dn_get_linearized(dsdb_dn->dn), - GUID_string(tmp_ctx, &link_guid)); + link_guid_str); talloc_free(tmp_ctx); return LDB_ERR_OPERATIONS_ERROR; } |