Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure pcre 2 compatibility #1867

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -6206,7 +6206,7 @@ manage_read_info (gchar *type, gchar *uid, gchar *name, gchar **result)
int
validate_username (const gchar * name)
{
if (g_regex_match_simple ("^[[:alnum:]-_.]+$", name, 0, 0))
if (g_regex_match_simple ("^[[:alnum:]_.-]+$", name, 0, 0))
return 0;
else
return 1;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ should_sync_config_from_path (const char *path, gboolean rebuild,

split = g_regex_split_simple
(/* Full-and-Fast--daba56c8-73ec-11df-a475-002264764cea.xml */
"^.*([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12}).xml$",
"^.*([0-9a-f]{8})\\-([0-9a-f]{4})\\-([0-9a-f]{4})\\-([0-9a-f]{4})\\-([0-9a-f]{12}).xml$",
path, 0, 0);

if (split == NULL || g_strv_length (split) != 7)
Expand Down
2 changes: 1 addition & 1 deletion src/manage_port_lists.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ should_sync_port_list_from_path (const char *path, gboolean rebuild,

split = g_regex_split_simple
(/* Full-and-Fast--daba56c8-73ec-11df-a475-002264764cea.xml */
"^.*([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12}).xml$",
"^.*([0-9a-f]{8})\\-([0-9a-f]{4})\\-([0-9a-f]{4})\\-([0-9a-f]{4})\\-([0-9a-f]{12}).xml$",
path, 0, 0);

if (split == NULL || g_strv_length (split) != 7)
Expand Down
2 changes: 1 addition & 1 deletion src/manage_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ should_sync_report_format_from_path (const char *path,

split = g_regex_split_simple
(/* Full-and-Fast--daba56c8-73ec-11df-a475-002264764cea.xml */
"^.*([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12}).xml$",
"^.*([0-9a-f]{8})\\-([0-9a-f]{4})\\-([0-9a-f]{4})\\-([0-9a-f]{4})\\-([0-9a-f]{12}).xml$",
path, 0, 0);

if (split == NULL || g_strv_length (split) != 7)
Expand Down
8 changes: 4 additions & 4 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -7001,7 +7001,7 @@ validate_tippingpoint_data (alert_method_t method, const gchar *name,

if (strcmp (name, "tp_sms_hostname") == 0)
{
if (g_regex_match_simple ("^[0-9A-Za-z][0-9A-Za-z.-]*$",
if (g_regex_match_simple ("^[0-9A-Za-z][0-9A-Za-z.\\-]*$",
*data, 0, 0)
== FALSE)
{
Expand Down Expand Up @@ -50012,8 +50012,8 @@ modify_setting (const gchar *uuid, const gchar *name,
*/
languages_regex
= g_regex_new ("^(Browser Language|"
"([a-z]{2,3})(_[A-Z]{2})?(@[[:alnum:]_-]+)?"
"(:([a-z]{2,3})(_[A-Z]{2})?(@[[:alnum:]_-]+)?)*)$",
"([a-z]{2,3})(_[A-Z]{2})?(@[[:alnum:]_\\-]+)?"
"(:([a-z]{2,3})(_[A-Z]{2})?(@[[:alnum:]_\\-]+)?)*)$",
0, 0, NULL);
match = g_regex_match (languages_regex, value, 0, NULL);
g_regex_unref (languages_regex);
Expand Down Expand Up @@ -50597,7 +50597,7 @@ setting_verify (const gchar *uuid, const gchar *value, const gchar *user)
if (strcmp (uuid, SETTING_UUID_LSC_DEB_MAINTAINER) == 0)
{
if (g_regex_match_simple
("^([[:alnum:]-_]*@[[:alnum:]-_][[:alnum:]-_.]*)?$",
("^([[:alnum:]\\-_]*@[[:alnum:]\\-_][[:alnum:]\\-_.]*)?$",
value, 0, 0) == FALSE)
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,7 @@ validate_param_value (report_format_t report_format,
case REPORT_FORMAT_PARAM_TYPE_REPORT_FORMAT_LIST:
{
if (g_regex_match_simple
("^(?:[[:alnum:]-_]+)?(?:,(?:[[:alnum:]-_])+)*$", value, 0, 0)
("^(?:[[:alnum:]\\-_]+)?(?:,(?:[[:alnum:]\\-_])+)*$", value, 0, 0)
== FALSE)
return 1;
else
Expand Down
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ parse_iso_time_tz (const char *text_time, const char *fallback_tz)
epoch_time = 0;

if (regex == NULL)
regex = g_regex_new ("^([0-9]{4}-[0-9]{2}-[0-9]{2})"
regex = g_regex_new ("^([0-9]{4}\\-[0-9]{2}\\-[0-9]{2})"
"[T ]([0-9]{2}:[0-9]{2})"
"(:[0-9]{2})?(?:\\.[0-9]+)?"
"(Z|[+-][0-9]{2}:?[0-9]{2})?$",
Expand Down