static NTSTATUS pdb_samba_dsdb_getsampwfilter(struct pdb_methods *m,
					  struct pdb_samba_dsdb_state *state,
					  struct samu *sam_acct,
					  const char *exp_fmt, ...)
{
	struct ldb_message *priv;
	NTSTATUS status;
	va_list ap;
	char *expression = NULL;
	TALLOC_CTX *tmp_ctx = talloc_new(state);
	NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);

	va_start(ap, exp_fmt);
	expression = talloc_vasprintf(tmp_ctx, exp_fmt, ap);
	va_end(ap);

	if (!expression) {
		talloc_free(tmp_ctx);
		return NT_STATUS_NO_MEMORY;
	}

	status = pdb_samba_dsdb_getsamupriv(state, expression, sam_acct, &priv);
	talloc_free(tmp_ctx);
	if (!NT_STATUS_IS_OK(status)) {
		DEBUG(10, ("pdb_samba_dsdb_getsamupriv failed: %s\n",
			   nt_errstr(status)));
		return status;
	}

	status = pdb_samba_dsdb_init_sam_from_priv(m, sam_acct, priv);
	if (!NT_STATUS_IS_OK(status)) {
		DEBUG(10, ("pdb_samba_dsdb_init_sam_from_priv failed: %s\n",
			   nt_errstr(status)));
		TALLOC_FREE(priv);
		return status;
	}

	pdb_set_backend_private_data(sam_acct, priv, NULL, m, PDB_SET);
	return NT_STATUS_OK;
}
static NTSTATUS pdb_samba_dsdb_getsampwfilter(struct pdb_methods *m,
					  struct pdb_samba_dsdb_state *state,
					  struct samu *sam_acct,
					  const char *exp_fmt, ...)
{
	struct ldb_message *priv;
	NTSTATUS status;
	va_list ap;
	char *expression = NULL;
	TALLOC_CTX *tmp_ctx = talloc_new(state);
	NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);

	va_start(ap, exp_fmt);
	expression = talloc_vasprintf(tmp_ctx, exp_fmt, ap);
	va_end(ap);

	if (!expression) {
		talloc_free(tmp_ctx);
		return NT_STATUS_NO_MEMORY;
	}

	status = pdb_samba_dsdb_getsamupriv(state, expression, sam_acct, &priv);
	talloc_free(tmp_ctx);
	if (!NT_STATUS_IS_OK(status)) {
		DEBUG(10, ("pdb_samba_dsdb_getsamupriv failed: %s\n",
			   nt_errstr(status)));
		return status;
	}

	status = pdb_samba_dsdb_init_sam_from_priv(m, sam_acct, priv);
	if (!NT_STATUS_IS_OK(status)) {
		DEBUG(10, ("pdb_samba_dsdb_init_sam_from_priv failed: %s\n",
			   nt_errstr(status)));
		TALLOC_FREE(priv);
		return status;
	}

	pdb_set_backend_private_data(sam_acct, priv, NULL, m, PDB_SET);
	return NT_STATUS_OK;
}