From b7774527faf095f612eb1de48efacec6bd710a87 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 1 Nov 2006 23:31:26 +0000 Subject: r19531: Make struct ldb_dn opaque and local to ldb_dn.c (This used to be commit 889fb983ba1cf8a11424a8b3dc3a5ef76e780082) --- source4/nbt_server/wins/winsdb.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'source4/nbt_server') diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 798663eb8b..bc518233ab 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -179,6 +179,7 @@ static NTSTATUS winsdb_nbt_name(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, struct n { NTSTATUS status; struct nbt_name *name; + unsigned int comp_num; uint32_t cur = 0; name = talloc(mem_ctx, struct nbt_name); @@ -187,20 +188,22 @@ static NTSTATUS winsdb_nbt_name(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, struct n goto failed; } - if (dn->comp_num > 3) { + comp_num = ldb_dn_get_comp_num(dn); + + if (comp_num > 3) { status = NT_STATUS_INTERNAL_DB_CORRUPTION; goto failed; } - if (dn->comp_num > cur && strcasecmp("scope", dn->components[cur].name) == 0) { - name->scope = (const char *)talloc_steal(name, dn->components[cur].value.data); + if (comp_num > cur && strcasecmp("scope", ldb_dn_get_component_name(dn, cur)) == 0) { + name->scope = (const char *)talloc_strdup(name, (char *)ldb_dn_get_component_val(dn, cur)->data); cur++; } else { name->scope = NULL; } - if (dn->comp_num > cur && strcasecmp("name", dn->components[cur].name) == 0) { - name->name = (const char *)talloc_steal(name, dn->components[cur].value.data); + if (comp_num > cur && strcasecmp("name", ldb_dn_get_component_name(dn, cur)) == 0) { + name->name = (const char *)talloc_strdup(name, (char *)ldb_dn_get_component_val(dn, cur)->data); cur++; } else { name->name = talloc_strdup(name, ""); @@ -210,8 +213,8 @@ static NTSTATUS winsdb_nbt_name(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, struct n } } - if (dn->comp_num > cur && strcasecmp("type", dn->components[cur].name) == 0) { - name->type = strtoul((char *)dn->components[cur].value.data, NULL, 0); + if (comp_num > cur && strcasecmp("type", ldb_dn_get_component_name(dn, cur)) == 0) { + name->type = strtoul((char *)ldb_dn_get_component_val(dn, cur)->data, NULL, 0); cur++; } else { status = NT_STATUS_INTERNAL_DB_CORRUPTION; -- cgit