return r;
}
-static void apply_limit(struct session_database *sdb,
- facet_limits_t facet_limits,
- WRBUF w_pqf, WRBUF w_ccl)
+static int apply_limit(struct session_database *sdb,
+ facet_limits_t facet_limits,
+ WRBUF w_pqf, WRBUF w_ccl)
{
+ int ret = 0;
int i = 0;
const char *name;
const char *value;
wrbuf_puts(w_ccl, ")");
}
+ else if (!strncmp(s->value, "local:", 6))
+ ;
+ else
+ {
+ yaz_log(YLOG_WARN, "Target %s: Bad limitmap '%s'",
+ sdb->database->id, s->value);
+ ret = -1; /* bad limitmap */
+ }
break;
}
}
}
}
nmem_destroy(nmem_tmp);
+ return ret;
}
// Parse the query given the settings specific to this client
wrbuf_puts(w_pqf, " ");
}
- apply_limit(sdb, facet_limits, w_pqf, w_ccl);
+ if (apply_limit(sdb, facet_limits, w_pqf, w_ccl))
+ return -2;
yaz_log(YLOG_LOG, "CCL query: %s", wrbuf_cstr(w_ccl));
cn = ccl_find_str(ccl_map, wrbuf_cstr(w_ccl), &cerror, &cpos);
{
int live_channels = 0;
int no_working = 0;
- int no_failed = 0;
+ int no_failed_query = 0;
+ int no_failed_limit = 0;
struct client_list *l, *l0;
struct timeval tval;
facet_limits_t facet_limits;
parse_ret = client_parse_query(cl, query, facet_limits, startrecs,
maxrecs);
- if (parse_ret < 0)
- no_failed++;
+ if (parse_ret == -1)
+ no_failed_query++;
+ else if (parse_ret == -2)
+ no_failed_limit++;
else if (parse_ret == 0)
{
session_log(se, YLOG_LOG, "client NEW %s", client_get_id(cl));
if (no_working == 0)
{
- if (no_failed > 0)
+ if (no_failed_query > 0)
{
*addinfo = "query";
return PAZPAR2_MALFORMED_PARAMETER_VALUE;
}
+ else if (no_failed_limit > 0)
+ {
+ *addinfo = "limit";
+ return PAZPAR2_MALFORMED_PARAMETER_VALUE;
+ }
else
return PAZPAR2_NO_TARGETS;
}