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

s3:pdb_samba_dsdb: make use of dsdb_trust_search_tdo()

dsdb_trust_search_tdo() is almost the same as sam_get_results_trust(),
so we can remove sam_get_results_trust() later.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2015-03-30 10:17:51 +02:00
parent 839645d238
commit 347d54047f

View File

@ -2157,15 +2157,16 @@ static bool pdb_samba_dsdb_get_trusteddom_pw(struct pdb_methods *m,
const char *netbios_domain = NULL; const char *netbios_domain = NULL;
const struct dom_sid *domain_sid = NULL; const struct dom_sid *domain_sid = NULL;
status = sam_get_results_trust(state->ldb, tmp_ctx, domain, status = dsdb_trust_search_tdo(state->ldb, domain, NULL,
NULL, attrs, &msg); attrs, tmp_ctx, &msg);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
/* /*
* This can be called to work out of a domain is * This can be called to work out of a domain is
* trusted, rather than just to get the password * trusted, rather than just to get the password
*/ */
DEBUG(2, ("Failed to get trusted domain password for %s. " DEBUG(2, ("Failed to get trusted domain password for %s - %s. "
"It may not be a trusted domain.\n", domain)); "It may not be a trusted domain.\n", domain,
nt_errstr(status)));
TALLOC_FREE(tmp_ctx); TALLOC_FREE(tmp_ctx);
return false; return false;
} }
@ -2317,17 +2318,18 @@ static NTSTATUS pdb_samba_dsdb_get_trusteddom_creds(struct pdb_methods *m,
char *principal_name = NULL; char *principal_name = NULL;
const char *dns_domain = NULL; const char *dns_domain = NULL;
status = sam_get_results_trust(state->ldb, tmp_ctx, domain, status = dsdb_trust_search_tdo(state->ldb, domain, NULL,
NULL, attrs, &msg); attrs, tmp_ctx, &msg);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
/* /*
* This can be called to work out of a domain is * This can be called to work out of a domain is
* trusted, rather than just to get the password * trusted, rather than just to get the password
*/ */
DEBUG(2, ("Failed to get trusted domain password for %s. " DEBUG(2, ("Failed to get trusted domain password for %s - %s "
"It may not be a trusted domain.\n", domain)); "It may not be a trusted domain.\n", domain,
nt_errstr(status)));
TALLOC_FREE(tmp_ctx); TALLOC_FREE(tmp_ctx);
return status; return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
} }
netbios_domain = ldb_msg_find_attr_as_string(msg, "flatName", NULL); netbios_domain = ldb_msg_find_attr_as_string(msg, "flatName", NULL);
@ -2612,15 +2614,16 @@ static bool pdb_samba_dsdb_set_trusteddom_pw(struct pdb_methods *m,
return false; return false;
} }
status = sam_get_results_trust(state->ldb, tmp_ctx, domain, status = dsdb_trust_search_tdo(state->ldb, domain, NULL,
NULL, attrs, &msg); attrs, tmp_ctx, &msg);
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
/* /*
* This can be called to work out of a domain is * This can be called to work out of a domain is
* trusted, rather than just to get the password * trusted, rather than just to get the password
*/ */
DEBUG(2, ("Failed to get trusted domain password for %s. " DEBUG(2, ("Failed to get trusted domain password for %s - %s. "
"It may not be a trusted domain.\n", domain)); "It may not be a trusted domain.\n", domain,
nt_errstr(status)));
TALLOC_FREE(tmp_ctx); TALLOC_FREE(tmp_ctx);
ldb_transaction_cancel(state->ldb); ldb_transaction_cancel(state->ldb);
return false; return false;