mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-12-31 13:49:11 +03:00
Support PCRE2
This commit is contained in:
@@ -16,7 +16,14 @@
|
||||
#ifndef SRC_OPERATORS_VERIFY_CC_H_
|
||||
#define SRC_OPERATORS_VERIFY_CC_H_
|
||||
|
||||
#if WITH_PCRE2
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#include <pcre2.h>
|
||||
#else
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
@@ -32,7 +39,11 @@ class VerifyCC : public Operator {
|
||||
explicit VerifyCC(std::unique_ptr<RunTimeString> param)
|
||||
: Operator("VerifyCC", std::move(param)),
|
||||
m_pc(NULL),
|
||||
#if WITH_PCRE2
|
||||
m_match_data(NULL) { }
|
||||
#else
|
||||
m_pce(NULL) { }
|
||||
#endif
|
||||
~VerifyCC();
|
||||
|
||||
bool evaluate(Transaction *t, RuleWithActions *rule,
|
||||
@@ -40,8 +51,13 @@ class VerifyCC : public Operator {
|
||||
std::shared_ptr<RuleMessage> ruleMessage) override;
|
||||
bool init(const std::string ¶m, std::string *error) override;
|
||||
private:
|
||||
#if WITH_PCRE2
|
||||
pcre2_code *m_pc;
|
||||
pcre2_match_data *m_match_data;
|
||||
#else
|
||||
pcre *m_pc;
|
||||
pcre_extra *m_pce;
|
||||
#endif
|
||||
static int luhnVerify(const char *ccnumber, int len);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user