summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-14 12:57:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:42:35 -0500
commit4c6fb8de2f0c97bed6105a616768a6088274c041 (patch)
tree6adcd4b97e0169ae85dbae835bec49f34896b82f
parent5ec6aa1476e1aa3730717c17c6a4232504155558 (diff)
downloadsamba-4c6fb8de2f0c97bed6105a616768a6088274c041.tar.gz
samba-4c6fb8de2f0c97bed6105a616768a6088274c041.tar.bz2
samba-4c6fb8de2f0c97bed6105a616768a6088274c041.zip
r11045:
(This used to be commit a2c6969306a18b0bb9629b3eae8a5e4a1aeae285)
-rw-r--r--source4/nbt_server/wins/winsdb.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c
index 88a7ab64f9..7a4afd9b3b 100644
--- a/source4/nbt_server/wins/winsdb.c
+++ b/source4/nbt_server/wins/winsdb.c
@@ -613,6 +613,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
*/