summaryrefslogtreecommitdiff
path: root/source4/nbt_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-10-14 12:49:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:42:16 -0500
commit1d55354663bfacad2128ca39201c4917c6f82d64 (patch)
tree40b6c2bbef0e926bbd4c16f5d220ebe2919ddfaa /source4/nbt_server
parent0f6791edc62f71876218e97d6f325490899d41de (diff)
downloadsamba-1d55354663bfacad2128ca39201c4917c6f82d64.tar.gz
samba-1d55354663bfacad2128ca39201c4917c6f82d64.tar.bz2
samba-1d55354663bfacad2128ca39201c4917c6f82d64.zip
r11025: r10313@SERNOX: metze | 2005-09-19 12:19:27 +0200
add wrapper functions for the "address" attribute in the winsdb, the goal is to store the expiry time and the wins owner per address, which is needed for wins replication metze (This used to be commit 2fd3bbd0449af3702bf473f97474bc1343f7a502)
Diffstat (limited to 'source4/nbt_server')
-rw-r--r--source4/nbt_server/wins/winsdb.c21
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;