diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-10-14 12:57:00 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:42:35 -0500 |
commit | 5ec6aa1476e1aa3730717c17c6a4232504155558 (patch) | |
tree | 45339ffae400fed198bd04e11d69e15613be5c79 /source4 | |
parent | 8aebec1be5bdd768b59d0f0d3a7c59ead9876eb1 (diff) | |
download | samba-5ec6aa1476e1aa3730717c17c6a4232504155558.tar.gz samba-5ec6aa1476e1aa3730717c17c6a4232504155558.tar.bz2 samba-5ec6aa1476e1aa3730717c17c6a4232504155558.zip |
r11044:
(This used to be commit 914e16f5676234862ebaf5d3c6e02bc1eb47ce51)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/nbt_server/wins/winsdb.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index ff3c787eb0..88a7ab64f9 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -561,6 +561,58 @@ failed: return status; } + rec = talloc(mem_ctx, struct winsdb_record); + if (rec == NULL) { + status = NT_STATUS_NO_MEMORY; + goto failed; + } + + if (!name) { + status = winsdb_nbt_name(rec, msg->dn, &name); + if (!NT_STATUS_IS_OK(status)) goto failed; + } + + /* parse it into a more convenient winsdb_record structure */ + rec->name = name; + rec->state = ldb_msg_find_int(msg, "state", WINS_REC_RELEASED); + rec->nb_flags = ldb_msg_find_int(msg, "nbFlags", 0); + rec->wins_owner = ldb_msg_find_string(msg, "winsOwner", NULL); + rec->expire_time = ldap_string_to_time(ldb_msg_find_string(msg, "expireTime", NULL)); + rec->registered_by = ldb_msg_find_string(msg, "registeredBy", NULL); + rec->version = ldb_msg_find_uint64(msg, "versionID", 0); + talloc_steal(rec, rec->wins_owner); + talloc_steal(rec, rec->registered_by); + + if (!rec->wins_owner) rec->wins_owner = WINSDB_OWNER_LOCAL; + + el = ldb_msg_find_element(msg, "address"); + if (el == NULL) { + status = NT_STATUS_INTERNAL_DB_CORRUPTION; + goto failed; + } + + rec->addresses = talloc_array(rec, struct winsdb_addr *, el->num_values+1); + if (rec->addresses == NULL) { + status = NT_STATUS_NO_MEMORY; + goto failed; + } + + for (i=0;i<el->num_values;i++) { + status = winsdb_addr_decode(rec, &el->values[i], rec->addresses, &rec->addresses[i]); + if (!NT_STATUS_IS_OK(status)) goto failed; + } + rec->addresses[i] = NULL; + + *_rec = rec; + return NT_STATUS_OK; +failed: + if (NT_STATUS_EQUAL(NT_STATUS_INTERNAL_DB_CORRUPTION, status)) { + DEBUG(1,("winsdb_record: corrupted record: %s\n", ldb_dn_linearize(rec, msg->dn))); + } + talloc_free(rec); + return status; +} + /* form a ldb_message from a winsdb_record */ |