mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
chore: refacorize setting of JIT related variables
This commit is contained in:
parent
bc500582a2
commit
1549132fb5
@ -37,6 +37,21 @@
|
||||
|
||||
#include "libinjection/libinjection.h"
|
||||
|
||||
/**
|
||||
* @brief Set the JIT compile return code and JIT compile status.
|
||||
* \param regex regex structure
|
||||
* \param rc return code of the JIT compile
|
||||
* \param jit JIT compile status
|
||||
* \return void
|
||||
*/
|
||||
static void msc_op_set_jitrc(msc_regex_t *regex, int *rc, int *jit) {
|
||||
*rc = regex->jit_compile_rc;
|
||||
if (*rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, jit);
|
||||
*jit = (*jit > 0) ? 1 : 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -724,11 +739,7 @@ static int msre_op_validateHash_param_init(msre_rule *rule, char **error_msg) {
|
||||
#ifdef WITH_PCRE_STUDY
|
||||
#ifdef WITH_PCRE_JIT
|
||||
#ifdef WITH_PCRE2
|
||||
rc = regex->jit_compile_rc;
|
||||
if (rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
|
||||
jit = (jit > 0) ? 1 : 0;
|
||||
}
|
||||
msc_op_set_jitrc(regex, &rc, &jit);
|
||||
#else
|
||||
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
||||
#endif
|
||||
@ -834,11 +845,7 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
|
||||
#ifdef WITH_PCRE_JIT
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
#ifdef WITH_PCRE2
|
||||
rc = regex->jit_compile_rc;
|
||||
if (rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
|
||||
jit = (jit > 0) ? 1 : 0;
|
||||
}
|
||||
msc_op_set_jitrc(regex, &rc, &jit);
|
||||
#else
|
||||
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
||||
#endif
|
||||
@ -1009,11 +1016,7 @@ static int msre_op_rx_param_init(msre_rule *rule, char **error_msg) {
|
||||
#ifdef WITH_PCRE_STUDY
|
||||
#ifdef WITH_PCRE_JIT
|
||||
#ifdef WITH_PCRE2
|
||||
rc = regex->jit_compile_rc;
|
||||
if (rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
|
||||
jit = (jit > 0) ? 1 : 0;
|
||||
}
|
||||
msc_op_set_jitrc(regex, &rc, &jit);
|
||||
#else
|
||||
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
||||
#endif
|
||||
@ -1111,11 +1114,7 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
|
||||
#ifdef WITH_PCRE_JIT
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
#ifdef WITH_PCRE2
|
||||
rc = regex->jit_compile_rc;
|
||||
if (rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
|
||||
jit = (jit > 0) ? 1 : 0;
|
||||
}
|
||||
msc_op_set_jitrc(regex, &rc, &jit);
|
||||
#else
|
||||
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
||||
#endif
|
||||
@ -3006,11 +3005,7 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
|
||||
#ifdef WITH_PCRE_JIT
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
#ifdef WITH_PCRE2
|
||||
rc = regex->jit_compile_rc;
|
||||
if (rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
|
||||
jit = (jit > 0) ? 1 : 0;
|
||||
}
|
||||
msc_op_set_jitrc(regex, &rc, &jit);
|
||||
#else
|
||||
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
||||
#endif
|
||||
@ -3349,11 +3344,7 @@ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
||||
#ifdef WITH_PCRE_JIT
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
#ifdef WITH_PCRE2
|
||||
rc = regex->jit_compile_rc;
|
||||
if (rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
|
||||
jit = (jit > 0) ? 1 : 0;
|
||||
}
|
||||
msc_op_set_jitrc(regex, &rc, &jit);
|
||||
#else
|
||||
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
||||
#endif
|
||||
@ -3678,11 +3669,7 @@ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
||||
#ifdef WITH_PCRE_JIT
|
||||
if (msr->txcfg->debuglog_level >= 4) {
|
||||
#ifdef WITH_PCRE2
|
||||
rc = regex->jit_compile_rc;
|
||||
if (rc == 0) {
|
||||
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, &jit);
|
||||
jit = (jit > 0) ? 1 : 0;
|
||||
}
|
||||
msc_op_set_jitrc(regex, &rc, &jit);
|
||||
#else
|
||||
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user