diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-10-14 12:54:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:42:33 -0500 |
commit | 2f54bab9514bf9af898a12173d0871684c94fa2e (patch) | |
tree | 583843568729bf10aab15c28676817fe2e326135 /source4/nbt_server/wins | |
parent | 681ba379e4d8cd45eab60996f8428f2c232582f3 (diff) | |
download | samba-2f54bab9514bf9af898a12173d0871684c94fa2e.tar.gz samba-2f54bab9514bf9af898a12173d0871684c94fa2e.tar.bz2 samba-2f54bab9514bf9af898a12173d0871684c94fa2e.zip |
r11036: r10349@SERNOX: metze | 2005-09-20 15:38:31 +0200
we know answer send_requests correctly
metze
(This used to be commit aecc9ca1cc78ce5ea766954629c03ea866c36bc1)
Diffstat (limited to 'source4/nbt_server/wins')
-rw-r--r-- | source4/nbt_server/wins/winsdb.c | 40 |
1 files changed, 40 insertions, 0 deletions
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 |