/* Open idmap repository */
if (!(tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0644))) {
- DEBUG(0, ("idmap_init: Unable to open idmap database\n"));
+ DEBUG(0, ("idmap_init: Unable to open idmap database '%s'\n", fn));
return NT_STATUS_UNSUCCESSFUL;
}
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)
struct MprVar mprDataBlob(DATA_BLOB blob)
{
struct MprVar res;
- DATA_BLOB *pblob = talloc(mprMemCtx(), DATA_BLOB);
+ struct datablob *pblob = talloc(mprMemCtx(), struct datablob);
*pblob = data_blob_talloc(pblob, blob.data, blob.length);
res = mprObject("DATA_BLOB");
/*
return a data blob from a mpr var created using mprDataBlob
*/
-struct data_blob *mprToDataBlob(struct MprVar *v)
+struct datablob *mprToDataBlob(struct MprVar *v)
{
- return talloc_get_type(mprGetPtr(v, "blob"), struct data_blob);
+ return talloc_get_type(mprGetPtr(v, "blob"), struct datablob);
}
/*