status = od.out.result;
}
if (!NT_STATUS_IS_OK(status)) {
- r->out.error_string = talloc_asprintf(mem_ctx,
- "samr_OpenDomain for [%s] failed: %s",
- dom_sid_string(tmp_ctx, connect_with_info->out.domain_sid),
- nt_errstr(status));
+ struct dom_sid_buf buf;
+ r->out.error_string = talloc_asprintf(
+ mem_ctx,
+ "samr_OpenDomain for [%s] failed: %s",
+ dom_sid_str_buf(connect_with_info->out.domain_sid,
+ &buf),
+ nt_errstr(status));
talloc_free(tmp_ctx);
return status;
}
for (s=samdump_state->secrets; s; s=s->next) {
size_t converted_size = 0;
char *secret_string;
+ struct dom_sid_buf buf;
if (strcasecmp_m(s->name, secret_name) != 0) {
continue;
}
return NT_STATUS_INVALID_PARAMETER;
}
printf("%s\t%s\t%s\n",
- t->name, dom_sid_string(mem_ctx, t->sid),
+ t->name,
+ dom_sid_str_buf(t->sid, &buf),
secret_string);
}
}
struct ldb_dn **fsp_dn,
char **error_string)
{
- const char *sidstr = dom_sid_string(mem_ctx, sid);
+ struct dom_sid_buf buf;
/* We assume that ForeignSecurityPrincipals are under the BASEDN of the main domain */
struct ldb_dn *basedn = samdb_search_dn(state->sam_ldb, mem_ctx,
state->base_dn[SAM_DATABASE_DOMAIN],
struct ldb_message *msg;
int ret;
- if (!sidstr) {
- return NT_STATUS_NO_MEMORY;
- }
-
if (basedn == NULL) {
*error_string = talloc_asprintf(mem_ctx,
"Failed to find DN for "
/* add core elements to the ldb_message for the alias */
msg->dn = basedn;
- if ( ! ldb_dn_add_child_fmt(msg->dn, "CN=%s", sidstr))
+ if ( ! ldb_dn_add_child_fmt(
+ msg->dn, "CN=%s", dom_sid_str_buf(sid, &buf)))
return NT_STATUS_UNSUCCESSFUL;
ldb_msg_add_string(msg, "objectClass", "foreignSecurityPrincipal");
struct ldb_message *msg;
int ret;
uint32_t i;
- char *dnstr, *sidstr;
+ char *dnstr;
+ struct dom_sid_buf buf;
msg = ldb_msg_new(mem_ctx);
if (msg == NULL) {
return NT_STATUS_NO_MEMORY;
}
- sidstr = dom_sid_string(msg, sid);
- if (sidstr == NULL) {
- TALLOC_FREE(msg);
- return NT_STATUS_NO_MEMORY;
- }
-
- dnstr = talloc_asprintf(msg, "sid=%s", sidstr);
+ dnstr = talloc_asprintf(msg, "sid=%s", dom_sid_str_buf(sid, &buf));
if (dnstr == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
} else if (ret == 0) {
return NT_STATUS_NO_SUCH_USER;
} else if (ret > 1) {
- *error_string = talloc_asprintf(mem_ctx, "More than one account with SID: %s",
- dom_sid_string(mem_ctx, sid));
+ struct dom_sid_buf buf;
+ *error_string = talloc_asprintf(
+ mem_ctx,
+ "More than one account with SID: %s",
+ dom_sid_str_buf(sid, &buf));
return NT_STATUS_INTERNAL_DB_CORRUPTION;
} else {
msg->dn = talloc_steal(msg, msgs[0]->dn);