diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-11-25 10:46:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:46:44 -0500 |
commit | dd47d5f93f28c958dc91d3258e557cb743b70156 (patch) | |
tree | 1a96dd4afdf7780709bcc0247f2901bdb6e9a73c /source4 | |
parent | 7746a144cd148a32604e768f878acff65c55a897 (diff) | |
download | samba-dd47d5f93f28c958dc91d3258e557cb743b70156.tar.gz samba-dd47d5f93f28c958dc91d3258e557cb743b70156.tar.bz2 samba-dd47d5f93f28c958dc91d3258e557cb743b70156.zip |
r11900: - make sure address and registered_by are replaced when they're not present
- make sure we don't add active records with 0 addresses
metze
(This used to be commit 5e7324efb338f4c4e390e4930d7ea21056db3a57)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/nbt_server/wins/winsdb.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 94e47b00b1..7916d139bb 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -513,9 +513,16 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb, struct winsdb_record *rec, TALLOC_CTX *mem_ctx) { int i, ret=0; + size_t addr_count; struct ldb_message *msg = ldb_msg_new(mem_ctx); if (msg == NULL) goto failed; + /* make sure we don't put in corrupted records */ + addr_count = winsdb_addr_list_length(rec->addresses); + if (rec->state == WREPL_STATE_ACTIVE && addr_count == 0) { + rec->state = WREPL_STATE_RELEASED; + } + msg->dn = winsdb_dn(msg, rec->name); if (msg->dn == NULL) goto failed; ret |= ldb_msg_add_fmt(msg, "type", "0x%02X", rec->name->type); @@ -534,9 +541,11 @@ struct ldb_message *winsdb_message(struct ldb_context *ldb, ldb_timestring(msg, rec->expire_time)); ret |= ldb_msg_add_fmt(msg, "versionID", "%llu", rec->version); ret |= ldb_msg_add_string(msg, "winsOwner", rec->wins_owner); + ret |= ldb_msg_add_empty(msg, "address", 0); for (i=0;rec->addresses[i];i++) { ret |= ldb_msg_add_winsdb_addr(msg, "address", rec->addresses[i]); } + ret |= ldb_msg_add_empty(msg, "registeredBy", 0); if (rec->registered_by) { ret |= ldb_msg_add_string(msg, "registeredBy", rec->registered_by); if (ret != 0) goto failed; |