1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

s3:pdb_samba_dsdb: return the domain sid in pdb_samba_dsdb_get_trusteddom_pw()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
Stefan Metzmacher 2015-02-05 10:07:46 +00:00 committed by Günther Deschner
parent 2a2cec6f9c
commit e0a4f438d1

View File

@ -2155,6 +2155,7 @@ static bool pdb_samba_dsdb_get_trusteddom_pw(struct pdb_methods *m,
enum ndr_err_code ndr_err;
NTSTATUS status;
const char *netbios_domain = NULL;
const struct dom_sid *domain_sid = NULL;
status = sam_get_results_trust(state->ldb, tmp_ctx, domain,
NULL, attrs, &msg);
@ -2177,6 +2178,14 @@ static bool pdb_samba_dsdb_get_trusteddom_pw(struct pdb_methods *m,
return false;
}
domain_sid = samdb_result_dom_sid(tmp_ctx, msg, "securityIdentifier");
if (domain_sid == NULL) {
DEBUG(2, ("Trusted domain %s has no securityIdentifier defined.\n",
domain));
TALLOC_FREE(tmp_ctx);
return false;
}
trust_direction_flags = ldb_msg_find_attr_as_int(msg, "trustDirection", 0);
if (!(trust_direction_flags & LSA_TRUST_DIRECTION_OUTBOUND)) {
DEBUG(2, ("Trusted domain %s is is not an outbound trust.\n",
@ -2256,6 +2265,10 @@ static bool pdb_samba_dsdb_get_trusteddom_pw(struct pdb_methods *m,
*pass_last_set_time = nt_time_to_unix(auth_array->array[i].LastUpdateTime);
}
if (sid != NULL) {
sid_copy(sid, domain_sid);
}
TALLOC_FREE(tmp_ctx);
return true;
}