diff --git a/doc/siproxd.conf.example b/doc/siproxd.conf.example index 9e65344..88b411e 100644 --- a/doc/siproxd.conf.example +++ b/doc/siproxd.conf.example @@ -530,15 +530,15 @@ plugin_fix_fbox_anoncall_networks = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/20 # # This plugin maintains count of failed REGISTER attempts of # individual local UACs (clients) and does block outgoing requests -# from such a UAC once a limit /hitcount) has been reached. The +# from such a UAC once a limit (hitcount) has been reached. The # duration of the block is configurable. It is required that a blocked # UAC does *not* send any packets that are going to be blocked -# during the duration to recover (the UAC must remain silent during -# this period) +# during the recovery duration the UAC must remain silent during +# this period). # # ...dbpath: path where the database is located # ...mode: 0: no block, 1: IP based, 2: IP and SIP-user based -# ...simulate: 0: block UACs once the failure count limit has been reached +# ...simulate: 0: block UACs once the failure limit is reached # 1: simulate, only log but don't block # ...duration: block duration in seconds, 0: forever # ...hitcount: required failed REGISTER attempts until blocked. diff --git a/src/plugin_blacklist.c b/src/plugin_blacklist.c index dc4d654..b977a0b 100644 --- a/src/plugin_blacklist.c +++ b/src/plugin_blacklist.c @@ -254,6 +254,7 @@ static int blacklist_check(sip_ticket_t *ticket) { osip_uri_t *from_url = NULL; char *from=NULL; char *call_id=ticket->sipmsg->call_id->number; + osip_authorization_t *auth=NULL; DEBUGC(DBCLASS_BABBLE, "entering blacklist_check"); @@ -293,6 +294,13 @@ static int blacklist_check(sip_ticket_t *ticket) { sql_stmt = NULL; if (MSG_IS_REGISTER(ticket->sipmsg)) { + /* Disarm initial REGISTER requests that carry no Authentication header data. */ + /* So if no Auth Header is present, then set CALL-Id= */ + if (osip_message_get_authorization(ticket->sipmsg, 0, &auth) < 0) { + DEBUGC(DBCLASS_BABBLE, "REGISTER without Auth data"); + call_id=""; + } + /* Query 3: UPDATE OR IGNORE REGISTER request into requests DB */ /* bind */ sql_stmt = &sql_statement[SQL_CHECK_3]; @@ -328,7 +336,7 @@ static int blacklist_check(sip_ticket_t *ticket) { /* free resources */ osip_free(from); - DEBUGC(DBCLASS_BABBLE, "leaving blacklist_check, UAC is permittet"); + DEBUGC(DBCLASS_BABBLE, "leaving blacklist_check, UAC is permitted"); return STS_SUCCESS; }