struct ldb_result *res = NULL;
int trans = -1;
uint32_t low, high, hwm, new_xid;
- char *sid_string, *unixid_string, *hwm_string;
+ struct dom_sid_buf sid_string;
+ char *unixid_string, *hwm_string;
bool hwm_entry_exists;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
const char *sam_attrs[] = {"uidNumber", "gidNumber", "samAccountType", NULL};
*/
if (lpcfg_parm_bool(idmap_ctx->lp_ctx, NULL, "idmap_ldb", "use rfc2307", false)) {
+ struct dom_sid_buf buf;
ret = dsdb_search_one(idmap_ctx->samdb, tmp_ctx, &sam_msg,
ldb_get_default_basedn(idmap_ctx->samdb),
LDB_SCOPE_SUBTREE, sam_attrs, 0,
"(|(sAMaccountType=%u)(sAMaccountType=%u)(sAMaccountType=%u)"
"(sAMaccountType=%u)(sAMaccountType=%u))"
"(|(uidNumber=*)(gidNumber=*)))",
- dom_sid_string(tmp_ctx, sid),
+ dom_sid_str_buf(sid, &buf),
ATYPE_ACCOUNT, ATYPE_WORKSTATION_TRUST, ATYPE_INTERDOMAIN_TRUST,
ATYPE_SECURITY_GLOBAL_GROUP, ATYPE_SECURITY_LOCAL_GROUP);
} else {
}
if (ret == LDB_ERR_CONSTRAINT_VIOLATION) {
+ struct dom_sid_buf buf;
DEBUG(1, ("Search for objectSid=%s gave duplicate results, failing to map to a unix ID!\n",
- dom_sid_string(tmp_ctx, sid)));
+ dom_sid_str_buf(sid, &buf)));
status = NT_STATUS_NONE_MAPPED;
goto failed;
} else if (ret == LDB_SUCCESS) {
}
}
} else if (ret != LDB_ERR_NO_SUCH_OBJECT) {
+ struct dom_sid_buf buf;
DEBUG(1, ("Search for objectSid=%s gave '%s', failing to map to a SID!\n",
- dom_sid_string(tmp_ctx, sid), ldb_errstring(idmap_ctx->samdb)));
+ dom_sid_str_buf(sid, &buf),
+ ldb_errstring(idmap_ctx->samdb)));
status = NT_STATUS_NONE_MAPPED;
goto failed;
goto failed;
}
- sid_string = dom_sid_string(tmp_ctx, sid);
- if (sid_string == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto failed;
- }
+ dom_sid_str_buf(sid, &sid_string);
unixid_string = talloc_asprintf(tmp_ctx, "%u", new_xid);
if (unixid_string == NULL) {
goto failed;
}
- map_msg->dn = ldb_dn_new_fmt(tmp_ctx, ldb, "CN=%s", sid_string);
+ map_msg->dn = ldb_dn_new_fmt(tmp_ctx, ldb, "CN=%s", sid_string.buf);
if (map_msg->dn == NULL) {
status = NT_STATUS_NO_MEMORY;
goto failed;
goto failed;
}
- ret = ldb_msg_add_string(map_msg, "cn", sid_string);
+ ret = ldb_msg_add_string(map_msg, "cn", sid_string.buf);
if (ret != LDB_SUCCESS) {
status = NT_STATUS_NONE_MAPPED;
goto failed;
&id[i]->xid);
}
if (!NT_STATUS_IS_OK(status)) {
- char *str = dom_sid_string(mem_ctx, id[i]->sid);
+ struct dom_sid_buf buf;
DEBUG(1, ("idmapping sid_to_xid failed for id[%d]=%s: %s\n",
- i, str, nt_errstr(status)));
- talloc_free(str);
+ i,
+ dom_sid_str_buf(id[i]->sid, &buf),
+ nt_errstr(status)));
error_count++;
id[i]->status = ID_UNMAPPED;
} else {