Project

General

Profile

Bug #772

Bearerbox black list regex feature not working as expected (rejecting all messages except the ones in black list regex)

Added by Little Martian over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
General SMSC
Target version:
Start date:
11/22/2017
Due date:
% Done:

0%

Estimated time:
Affected version:
1.5.0

Description

Hi,
I found a problem with the regex blacklist feature in bearerbox. If configuring a regular expression in black-list-sender-regex or black-list-receiver-regex all messages are rejected (i had to anonymize the MSISDN). The parameter is set in group=core as 'black-list-regex=000000000' (is a valid regex, should exclude only MSISDN 000000000)

2017-11-22 16:13:57 [25139] [6] INFO: Number <+00000000001> is not in black-list, message discarded
2017-11-22 16:13:57 [25139] [6] INFO: Number <+00000000002> is not in black-list, message discarded
2017-11-22 16:13:57 [25139] [6] INFO: Number <+00000000003> is not in black-list, message discarded
2017-11-22 16:13:57 [25139] [6] INFO: Number <+00000000004> is not in black-list, message discarded
2017-11-22 16:13:57 [25139] [6] INFO: Number <+00000000005> is not in black-list, message discarded
2017-11-22 16:13:57 [25139] [6] INFO: Number <+00000000006> is not in black-list, message discarded
2017-11-22 16:13:57 [25139] [6] INFO: Number <+00000000007> is not in black-list, message discarded

I traced the problem to bb_smscconn.c rev 5171 (trunk rev 5190) (lines 538 - 546 and 578 - 586). It seems it is a copy/paste from the white list condition:
AS IS (lines 538 - 546):
if (black_list_sender_regex &&
gw_regex_match_pre(black_list_sender_regex, sms->sms.sender) == 0) {
gw_rwlock_unlock(&white_black_list_lock);
info(0, "Number <%s> is not in black-list, message discarded",
octstr_get_cstr(sms->sms.sender));
bb_alog_sms(conn, sms, "REJECTED Receive SMS - black-regex-listed SMS");
msg_destroy(sms);
return SMSCCONN_FAILED_REJECTED;
}

CORRECTED (lines 538 - 546):
if (black_list_sender_regex &&
gw_regex_match_pre(black_list_sender_regex, sms->sms.sender) != 0) {
gw_rwlock_unlock(&white_black_list_lock);
info(0, "Number <%s> is in black-list, message discarded",
octstr_get_cstr(sms->sms.sender));
bb_alog_sms(conn, sms, "REJECTED Receive SMS - black-regex-listed SMS");
msg_destroy(sms);
return SMSCCONN_FAILED_REJECTED;
}

AS IS (lines 578 - 586):
if (black_list_receiver_regex &&
gw_regex_match_pre(black_list_receiver_regex, sms->sms.receiver) == 0) {
gw_rwlock_unlock(&white_black_list_lock);
info(0, "Number <%s> is not in black-list-receiver, message discarded",
octstr_get_cstr(sms->sms.receiver));
bb_alog_sms(conn, sms, "REJECTED Receive SMS - black-regex-listed SMS");
msg_destroy(sms);
return SMSCCONN_FAILED_REJECTED;
}

CORRECTED (lines 578 - 586):
if (black_list_receiver_regex &&
gw_regex_match_pre(black_list_receiver_regex, sms->sms.receiver) != 0) {
gw_rwlock_unlock(&white_black_list_lock);
info(0, "Number <%s> is in black-list-receiver, message discarded",
octstr_get_cstr(sms->sms.receiver));
bb_alog_sms(conn, sms, "REJECTED Receive SMS - black-regex-listed SMS");
msg_destroy(sms);
return SMSCCONN_FAILED_REJECTED;
}

Associated revisions

Revision 5192 (diff)
Added by Alexander Malysh over 2 years ago

  • gw/bb_smscconn.c: fixed copy & paste error. This fixes #772.

History

#1 Updated by Alexander Malysh over 2 years ago

  • Status changed from New to Resolved

Hi,

fixed in SVN. Thanks for reporting!

#2 Updated by Alexander Malysh over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF