From: Alan T. DeKok Date: Tue, 22 May 2012 15:26:40 +0000 (+0200) Subject: WARN if the query strings look to be too long X-Git-Tag: release_2_2_0~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3827fd513788c989e923bf7ca975ba7df0151772;p=thirdparty%2Ffreeradius-server.git WARN if the query strings look to be too long --- diff --git a/src/modules/rlm_sql/rlm_sql.c b/src/modules/rlm_sql/rlm_sql.c index 6f75c13adff..d51857f22ef 100644 --- a/src/modules/rlm_sql/rlm_sql.c +++ b/src/modules/rlm_sql/rlm_sql.c @@ -860,6 +860,7 @@ static int rlm_sql_detach(void *instance) } static int rlm_sql_instantiate(CONF_SECTION * conf, void **instance) { + int i; SQL_INST *inst; const char *xlat_name; @@ -990,6 +991,23 @@ static int rlm_sql_instantiate(CONF_SECTION * conf, void **instance) } allowed_chars = inst->config->allowed_chars; + for (i = 0; module_config[i].name != NULL; i++) { + char **p; + + if (module_config[i].type != PW_TYPE_STRING_PTR) continue; + if (strstr(module_config[i].name, "_query") != NULL) continue; + + p = (char **) (((char *)inst->config) + module_config[i].offset); + + if (!*p) continue; + + if (strlen(*p) > ((2 * MAX_QUERY_LEN) / 3)) { + DEBUG("%s: WARNING Query '%s' is probably too long!", + inst->config->xlat_name, module_config[i].name); + } + } + + *instance = inst; return RLM_MODULE_OK;