From 2f54bab9514bf9af898a12173d0871684c94fa2e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 14 Oct 2005 12:54:26 +0000 Subject: r11036: r10349@SERNOX: metze | 2005-09-20 15:38:31 +0200 we know answer send_requests correctly metze (This used to be commit aecc9ca1cc78ce5ea766954629c03ea866c36bc1) --- source4/nbt_server/wins/winsdb.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'source4/nbt_server/wins/winsdb.c') diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 0b7d16b532..551bc85727 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -93,6 +93,46 @@ static struct ldb_dn *winsdb_dn(TALLOC_CTX *mem_ctx, struct nbt_name *name) return dn; } +struct nbt_name *winsdb_nbt_name(TALLOC_CTX *mem_ctx, struct ldb_dn *dn) +{ + struct nbt_name *name; + uint32_t cur = 0; + + name = talloc(mem_ctx, struct nbt_name); + if (!name) goto failed; + + if (dn->comp_num > 3) { + goto failed; + } + + if (dn->comp_num > cur && strcasecmp("scope", dn->components[cur].name) == 0) { + name->scope = talloc_steal(name, dn->components[cur].value.data); + cur++; + } else { + name->scope = NULL; + } + + if (dn->comp_num > cur && strcasecmp("name", dn->components[cur].name) == 0) { + name->name = talloc_steal(name, dn->components[cur].value.data); + cur++; + } else { + name->name = talloc_strdup(name, ""); + if (!name->name) goto failed; + } + + if (dn->comp_num > cur && strcasecmp("type", dn->components[cur].name) == 0) { + name->type = strtoul((char *)dn->components[cur].value.data, NULL, 16); + cur++; + } else { + goto failed; + } + + return name; +failed: + talloc_free(name); + return NULL; +} + /* decode the winsdb_addr("address") attribute: "172.31.1.1" or -- cgit