diff options
Diffstat (limited to 'source4/nbt_server/wins')
-rw-r--r-- | source4/nbt_server/wins/winsdb.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 72531e4c62..2b17104b9d 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -119,6 +119,24 @@ static struct ldb_dn *winsdb_dn(TALLOC_CTX *mem_ctx, struct nbt_name *name) return dn; } +static const char *winsdb_addr_decode(TALLOC_CTX *mem_ctx, struct ldb_val *val) +{ + const char *addr; + addr = talloc_steal(mem_ctx, val->data); + return addr; +} + +static int ldb_msg_add_winsdb_addr(struct ldb_context *ldb, struct ldb_message *msg, + const char *attr_name, const char *addr) +{ + struct ldb_val val; + + val.data = discard_const_p(uint8_t, addr); + val.length = strlen(addr); + + return ldb_msg_add_value(ldb, msg, attr_name, &val); +} + /* load a WINS entry from the database */ @@ -159,7 +177,8 @@ struct winsdb_record *winsdb_load(struct wins_server *winssrv, if (rec->addresses == NULL) goto failed; for (i=0;i<el->num_values;i++) { - rec->addresses[i] = talloc_steal(rec->addresses, el->values[i].data); + rec->addresses[i] = winsdb_addr_decode(rec->addresses, &el->values[i]); + if (rec->addresses[i] == NULL) goto failed; } rec->addresses[i] = NULL; |