]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
WARN if the query strings look to be too long
authorAlan T. DeKok <aland@freeradius.org>
Tue, 22 May 2012 15:26:40 +0000 (17:26 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 22 May 2012 15:26:40 +0000 (17:26 +0200)
src/modules/rlm_sql/rlm_sql.c

index 6f75c13adff10cae40fa07a68223f85cda3605f2..d51857f22efaf159c550f73007776871a71705e8 100644 (file)
@@ -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;