Fix setting libhtp personality.

remotes/origin/master-1.1.x
Victor Julien 14 years ago
parent 6aa551c558
commit c88630639e

@ -83,7 +83,6 @@ static uint64_t htp_state_memcnt = 0;
static uint8_t need_htp_request_body = 0; static uint8_t need_htp_request_body = 0;
#if 0 /* Not used yet */
/** /**
* \internal * \internal
* *
@ -113,7 +112,6 @@ static const char *HTPLookupPersonalityString(int p)
return NULL; return NULL;
} }
#endif /* Not used yet */
/** /**
* \internal * \internal
@ -879,36 +877,36 @@ static void HTPConfigure(void)
/* Default Parameters */ /* Default Parameters */
TAILQ_FOREACH(p, &default_config->head, next) { TAILQ_FOREACH(p, &default_config->head, next) {
ConfNode *pval; //ConfNode *pval;
if (strcasecmp("personality", p->name) == 0) { if (strcasecmp("personality", p->name) == 0) {
/* Personalities */ /* Personalities */
TAILQ_FOREACH(pval, &p->head, next) { int personality = HTPLookupPersonality(p->val);
int personality = HTPLookupPersonality(pval->val);
SCLogDebug("LIBHTP default: %s=%s", SCLogDebug("LIBHTP default: %s=%s",
p->name, pval->val); p->name, p->val);
if (personality >= 0) { if (personality >= 0) {
SCLogDebug("LIBHTP default: %s=%s (%d)", SCLogDebug("LIBHTP default: %s=%s (%d)",
p->name, pval->val, p->name, p->val,
personality); personality);
if (htp_config_set_server_personality(cfglist.cfg, if (htp_config_set_server_personality(cfglist.cfg,
personality) == HTP_ERROR) personality) == HTP_ERROR)
{ {
SCLogWarning(SC_ERR_INVALID_VALUE, SCLogWarning(SC_ERR_INVALID_VALUE,
"LIBHTP Failed adding personality " "LIBHTP Failed adding personality "
"\"%s\", ignoring", pval->val); "\"%s\", ignoring", p->val);
} } else {
SCLogDebug("LIBHTP personality set to %s",
HTPLookupPersonalityString(personality));
} }
else { }
SCLogWarning(SC_ERR_UNKNOWN_VALUE, else {
"LIBHTP Unknown personality " SCLogWarning(SC_ERR_UNKNOWN_VALUE,
"\"%s\", ignoring", pval->val); "LIBHTP Unknown personality "
continue; "\"%s\", ignoring", p->val);
} continue;
} }
} else if (strcasecmp("request-body-limit", p->name) == 0 || } else if (strcasecmp("request-body-limit", p->name) == 0 ||
strcasecmp("request_body_limit", p->name) == 0) { strcasecmp("request_body_limit", p->name) == 0) {
@ -1028,34 +1026,35 @@ static void HTPConfigure(void)
} }
} }
} else if (strcasecmp("personality", p->name) == 0) { } else if (strcasecmp("personality", p->name) == 0) {
/* Personalities */ /* Personalitie */
TAILQ_FOREACH(pval, &p->head, next) { int personality = HTPLookupPersonality(p->val);
int personality = HTPLookupPersonality(pval->val);
SCLogDebug("LIBHTP server %s: %s=%s", SCLogDebug("LIBHTP server %s: %s=%s",
s->name, p->name, pval->val); s->name, p->name, p->val);
if (personality >= 0) { if (personality >= 0) {
SCLogDebug("LIBHTP %s: %s=%s (%d)", SCLogDebug("LIBHTP %s: %s=%s (%d)",
s->name, p->name, pval->val, s->name, p->name, p->val,
personality); personality);
if (htp_config_set_server_personality(htp, if (htp_config_set_server_personality(htp,
personality) == HTP_ERROR) personality) == HTP_ERROR)
{ {
SCLogWarning(SC_ERR_INVALID_VALUE, SCLogWarning(SC_ERR_INVALID_VALUE,
"LIBHTP Failed adding personality " "LIBHTP Failed adding personality "
"\"%s\", ignoring", pval->val); "\"%s\", ignoring", p->val);
} } else {
} SCLogDebug("LIBHTP personality set to %s",
else { HTPLookupPersonalityString(personality));
SCLogWarning(SC_ERR_UNKNOWN_VALUE,
"LIBHTP Unknown personality "
"\"%s\", ignoring", pval->val);
continue;
} }
} }
else {
SCLogWarning(SC_ERR_UNKNOWN_VALUE,
"LIBHTP Unknown personality "
"\"%s\", ignoring", p->val);
continue;
}
/* VJ the non underscore version was a typo but keeping it for /* VJ the non underscore version was a typo but keeping it for
* compatibility with existing installs */ * compatibility with existing installs */
} else if (strcasecmp("request-body-limit", p->name) == 0 || } else if (strcasecmp("request-body-limit", p->name) == 0 ||

Loading…
Cancel
Save