summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-25 22:57:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:35 -0500
commita16c390fe07cb5908b042cc88b0928a92d8326b6 (patch)
treef0a2a065f622abd39a8e22cbdf6782fcecaafa83 /source4/lib
parentc9d3763bfc92b7e99565065fb44b03c47f1f1a0d (diff)
downloadsamba-a16c390fe07cb5908b042cc88b0928a92d8326b6.tar.gz
samba-a16c390fe07cb5908b042cc88b0928a92d8326b6.tar.bz2
samba-a16c390fe07cb5908b042cc88b0928a92d8326b6.zip
r9624: Support writing wins.ldif
(This used to be commit b0595d238bbcc4a3927914d1fd6032e9293da5cc)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/samba3/upgrade.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/source4/lib/samba3/upgrade.c b/source4/lib/samba3/upgrade.c
index 907df75c2e..941b0fe196 100644
--- a/source4/lib/samba3/upgrade.c
+++ b/source4/lib/samba3/upgrade.c
@@ -121,8 +121,29 @@ int samba3_upgrade_winbind(struct samba3 *samba3, struct ldb_context *ctx, struc
return -1;
}
-int samba3_upgrade_winsdb(struct samba3 *samba3, struct ldb_context *ctx, struct ldb_message ***msgs)
+int samba3_upgrade_winsdb(struct samba3 *samba3, struct ldb_context *ldb, struct ldb_message ***msgs)
{
- /* FIXME */
- return -1;
+ int i;
+ int count = 0;
+
+ for (i = 0; i < samba3->winsdb_count; i++) {
+ struct samba3_winsdb_entry *e = &samba3->winsdb_entries[i];
+ int j;
+ struct ldb_message *msg = msg_array_add(ldb, msgs, &count);
+
+ msg->dn = ldb_dn_string_compose(ldb, NULL, "type=%d,name=%s", e->type, e->name);
+
+ ldb_msg_add_string(ldb, msg, "name", e->name);
+ ldb_msg_add_fmt(ldb, msg, "type", "%d", e->type);
+ ldb_msg_add_string(ldb, msg, "objectClass", "wins");
+ ldb_msg_add_fmt(ldb, msg, "nbFlags", "%x", e->nb_flags);
+ ldb_msg_add_string(ldb, msg, "expires",
+ ldap_timestring(msg, e->ttl));
+
+ for (j = 0; j < e->ip_count; j++) {
+ ldb_msg_add_string(ldb, msg, "address", sys_inet_ntoa(e->ips[j]));
+ }
+ }
+
+ return count;
}