static struct ldb_result *lookup_user_pso(struct ldb_context *sam_ldb,
					  TALLOC_CTX *mem_ctx,
					  const struct ldb_message *user_msg,
					  const char * const *attrs)
{
	struct ldb_result *res = NULL;
	struct ldb_dn *pso_dn = NULL;
	int ret;

	/* if the user has a PSO that applies, then use the PSO's setting */
	pso_dn = ldb_msg_find_attr_as_dn(sam_ldb, mem_ctx, user_msg,
					 "msDS-ResultantPSO");

	if (pso_dn != NULL) {

		ret = dsdb_search_dn(sam_ldb, mem_ctx, &res, pso_dn, attrs, 0);
		if (ret != LDB_SUCCESS) {

			/*
			 * log the error. The caller should fallback to using
			 * the default domain password settings
			 */
			DBG_ERR("Error retrieving msDS-ResultantPSO %s for %s",
				ldb_dn_get_linearized(pso_dn),
				ldb_dn_get_linearized(user_msg->dn));
		}
		talloc_free(pso_dn);
	}
	return res;
}
static struct ldb_result *lookup_user_pso(struct ldb_context *sam_ldb,
					  TALLOC_CTX *mem_ctx,
					  const struct ldb_message *user_msg,
					  const char * const *attrs)
{
	struct ldb_result *res = NULL;
	struct ldb_dn *pso_dn = NULL;
	int ret;

	 
	pso_dn = ldb_msg_find_attr_as_dn(sam_ldb, mem_ctx, user_msg,
					 "msDS-ResultantPSO");

	if (pso_dn != NULL) {

		ret = dsdb_search_dn(sam_ldb, mem_ctx, &res, pso_dn, attrs, 0);
		if (ret != LDB_SUCCESS) {

			 
			DBG_ERR("Error retrieving msDS-ResultantPSO %s for %s",
				ldb_dn_get_linearized(pso_dn),
				ldb_dn_get_linearized(user_msg->dn));
		}
		talloc_free(pso_dn);
	}
	return res;
}