static NTSTATUS dcesrv_lsa_SetTrustedDomainInfoByName(struct dcesrv_call_state *dce_call,
					       TALLOC_CTX *mem_ctx,
					       struct lsa_SetTrustedDomainInfoByName *r)
{
	struct dcesrv_handle *policy_handle;
	struct lsa_policy_state *policy_state;
	struct ldb_message **msgs;
	NTSTATUS nt_status;

	DCESRV_PULL_HANDLE(policy_handle, r->in.handle, LSA_HANDLE_POLICY);
	policy_state = policy_handle->data;

	/* get the trusted domain object */
	nt_status = get_tdo(policy_state->sam_ldb, mem_ctx,
			    policy_state->domain_dn,
			    r->in.trusted_domain->string,
			    r->in.trusted_domain->string,
			    NULL, &msgs);
	if (!NT_STATUS_IS_OK(nt_status)) {
		if (NT_STATUS_EQUAL(nt_status,
				    NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
			return nt_status;
		}
		return NT_STATUS_INTERNAL_DB_CORRUPTION;
	}

	return setInfoTrustedDomain_base(dce_call, policy_state, mem_ctx,
					 msgs[0], r->in.level, r->in.info);
}
static NTSTATUS dcesrv_lsa_SetTrustedDomainInfoByName(struct dcesrv_call_state *dce_call,
					       TALLOC_CTX *mem_ctx,
					       struct lsa_SetTrustedDomainInfoByName *r)
{
	struct dcesrv_handle *policy_handle;
	struct lsa_policy_state *policy_state;
	struct ldb_message **msgs;
	NTSTATUS nt_status;

	DCESRV_PULL_HANDLE(policy_handle, r->in.handle, LSA_HANDLE_POLICY);
	policy_state = policy_handle->data;

	 
	nt_status = get_tdo(policy_state->sam_ldb, mem_ctx,
			    policy_state->domain_dn,
			    r->in.trusted_domain->string,
			    r->in.trusted_domain->string,
			    NULL, &msgs);
	if (!NT_STATUS_IS_OK(nt_status)) {
		if (NT_STATUS_EQUAL(nt_status,
				    NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
			return nt_status;
		}
		return NT_STATUS_INTERNAL_DB_CORRUPTION;
	}

	return setInfoTrustedDomain_base(dce_call, policy_state, mem_ctx,
					 msgs[0], r->in.level, r->in.info);
}