diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-28 01:37:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:49 -0500 |
commit | 37059d70d9ef905bbcea715e93f5057caf0759d1 (patch) | |
tree | 7d92d4ea6740fa93dd82b6b0b99eb75aa26aeaa6 /source4/lib/samba3/upgrade.c | |
parent | df384bfa25db741770627cb7b9cae0df5564d14f (diff) | |
download | samba-37059d70d9ef905bbcea715e93f5057caf0759d1.tar.gz samba-37059d70d9ef905bbcea715e93f5057caf0759d1.tar.bz2 samba-37059d70d9ef905bbcea715e93f5057caf0759d1.zip |
r9700: Change DATA_BLOB in ejs back to struct datablob
Support writing idmap mappings to winbind.ldif
(This used to be commit 3709def35303f1afed0f344628fe2c89250ee087)
Diffstat (limited to 'source4/lib/samba3/upgrade.c')
-rw-r--r-- | source4/lib/samba3/upgrade.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/source4/lib/samba3/upgrade.c b/source4/lib/samba3/upgrade.c index 941b0fe196..eeb77310ec 100644 --- a/source4/lib/samba3/upgrade.c +++ b/source4/lib/samba3/upgrade.c @@ -109,16 +109,48 @@ int samba3_upgrade_registry(struct samba3_regdb *regdb, const char *prefix, stru return count; } -int samba3_upgrade_sam(struct samba3 *samba3, struct ldb_context *ctx, struct ldb_message ***msgs) +int samba3_upgrade_sam(struct samba3 *samba3, struct ldb_context *ldb, struct ldb_message ***msgs) { + int count = 0; + struct ldb_message *msg; + struct ldb_dn *domaindn = NULL; + *msgs = NULL; + + /* Domain */ + msg = msg_array_add(ldb, msgs, &count); + + /* FIXME: Guess domain DN by taking ldap bind dn? */ + /* FIXME */ return -1; } -int samba3_upgrade_winbind(struct samba3 *samba3, struct ldb_context *ctx, struct ldb_message ***msgs) +int samba3_upgrade_winbind(struct samba3 *samba3, struct ldb_context *ldb, struct ldb_message ***msgs) { - /* FIXME */ - return -1; + int i; + int count = 0; + struct ldb_message *msg; + struct ldb_dn *basedn = NULL; + *msgs = NULL; + + msg = msg_array_add(ldb, msgs, &count); + + msg->dn = basedn; + + ldb_msg_add_fmt(ldb, msg, "userHwm", "%d", samba3->idmap.user_hwm); + ldb_msg_add_fmt(ldb, msg, "groupHwm", "%d", samba3->idmap.group_hwm); + + for (i = 0; i < samba3->idmap.mapping_count; i++) { + char *sid = dom_sid_string(msg, samba3->idmap.mappings[i].sid); + msg = msg_array_add(ldb, msgs, &count); + + msg->dn = ldb_dn_build_child(ldb, "SID", sid, basedn); + ldb_msg_add_string(ldb, msg, "SID", sid); + ldb_msg_add_fmt(ldb, msg, "type", "%d", samba3->idmap.mappings[i].type); + ldb_msg_add_fmt(ldb, msg, "unixID", "%u", samba3->idmap.mappings[i].unix_id); + } + + return count; } int samba3_upgrade_winsdb(struct samba3 *samba3, struct ldb_context *ldb, struct ldb_message ***msgs) |