plugin_stripheaders: deal with mode header field
This commit is contained in:
parent
9d4c1ef172
commit
9e05d8cba5
@ -1,8 +1,10 @@
|
|||||||
0.8.4dev
|
0.8.4dev
|
||||||
========
|
========
|
||||||
|
27-Dec-2020: - plugin_stripheaders: deal with mode header field
|
||||||
17-Sep-2020: - fix: buffer overflow in process_aclist if a
|
17-Sep-2020: - fix: buffer overflow in process_aclist if a
|
||||||
wrong syntax in config file was used for ACLs.
|
wrong syntax in config file was used for ACLs.
|
||||||
- Improved string handling on some more places.
|
- Improved string handling on some more places.
|
||||||
|
|
||||||
0.8.3
|
0.8.3
|
||||||
=====
|
=====
|
||||||
25-Aug-2020: - Released 0.8.3
|
25-Aug-2020: - Released 0.8.3
|
||||||
|
|||||||
@ -448,16 +448,21 @@ plugin_regex_replace = \1:001
|
|||||||
#
|
#
|
||||||
# unconditionally strip the specified SIP header from the packet.
|
# unconditionally strip the specified SIP header from the packet.
|
||||||
# May be used to workaround IP fragmentation by removing "unimportant"
|
# May be used to workaround IP fragmentation by removing "unimportant"
|
||||||
# SIP headers - this is clearly a ugly hack but sometimes saves on
|
# SIP headers - this is clearly a ugly hack but sometimes saves one
|
||||||
# from headache.
|
# from headache.
|
||||||
# Format is <header>[:<value>], the :<value> part is optional - if not
|
# Format is <header>[:<value>], the :<value> part is optional - if not
|
||||||
# present the full header will be removed.
|
# present the full header will be removed.
|
||||||
|
# NOTE: not all headers are surrently supported due to how libosip
|
||||||
|
# does store them internally.
|
||||||
#
|
#
|
||||||
# remove entire header (all values attached to this header)
|
# remove entire header (all values attached to this header)
|
||||||
plugin_stripheader_remove = Allow
|
plugin_stripheader_remove = Allow
|
||||||
plugin_stripheader_remove = User-Agent
|
plugin_stripheader_remove = User-Agent
|
||||||
# remove only a particular value from a header (no spaces allowed)
|
# remove only a particular value from a header (no spaces allowed)
|
||||||
plugin_stripheader_remove = Supported:100rel
|
plugin_stripheader_remove = Supported:100rel
|
||||||
|
# remove all Record-Route headers (only full removal is supported)
|
||||||
|
plugin_stripheader_remove = Record-Route
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Plugin_codecfilter
|
# Plugin_codecfilter
|
||||||
|
|||||||
@ -112,6 +112,12 @@ int PLUGIN_PROCESS(int stage, sip_ticket_t *ticket){
|
|||||||
header_remove = strdup(plugin_cfg.header_remove.string[i]);
|
header_remove = strdup(plugin_cfg.header_remove.string[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* some headers are stored in their own struncture in the SIP message structure
|
||||||
|
* -> special cases
|
||||||
|
* and other headers are stored in a generic header structure
|
||||||
|
* -> generic headers
|
||||||
|
*/
|
||||||
|
|
||||||
/* special case Allow header */
|
/* special case Allow header */
|
||||||
if (strcasecmp(header_remove, "allow") == 0) {
|
if (strcasecmp(header_remove, "allow") == 0) {
|
||||||
@ -121,7 +127,7 @@ int PLUGIN_PROCESS(int stage, sip_ticket_t *ticket){
|
|||||||
pos, &allow)) != -1) {
|
pos, &allow)) != -1) {
|
||||||
if (--dlc <= 0) { ERROR("deadlock counter has triggered. Likely a bug in code."); return STS_FAILURE;}
|
if (--dlc <= 0) { ERROR("deadlock counter has triggered. Likely a bug in code."); return STS_FAILURE;}
|
||||||
if (header_remove_args == NULL) {
|
if (header_remove_args == NULL) {
|
||||||
/* remova all values for header */
|
/* remove all values for header */
|
||||||
DEBUGC(DBCLASS_PLUGIN, "%s: removing Allow header pos=%i, val=%s", name,
|
DEBUGC(DBCLASS_PLUGIN, "%s: removing Allow header pos=%i, val=%s", name,
|
||||||
pos, allow->value);
|
pos, allow->value);
|
||||||
osip_list_remove(&ticket->sipmsg->allows, pos);
|
osip_list_remove(&ticket->sipmsg->allows, pos);
|
||||||
@ -141,6 +147,24 @@ int PLUGIN_PROCESS(int stage, sip_ticket_t *ticket){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* special case: Record-Route headers */
|
||||||
|
} else if (strcasecmp(header_remove, "record-route") == 0) {
|
||||||
|
osip_record_route_t *rroute=NULL;
|
||||||
|
pos=0;
|
||||||
|
while ((pos = osip_message_get_record_route(ticket->sipmsg,
|
||||||
|
pos, &rroute)) != -1) {
|
||||||
|
if (--dlc <= 0) { ERROR("deadlock counter has triggered. Likely a bug in code."); return STS_FAILURE;}
|
||||||
|
/* remove all values for header */
|
||||||
|
char *tmpstr=NULL;
|
||||||
|
osip_record_route_to_str(rroute, &tmpstr);
|
||||||
|
DEBUGC(DBCLASS_PLUGIN, "%s: removing Record-Route header pos=%i, val=%s", name,
|
||||||
|
pos, tmpstr);
|
||||||
|
osip_free(tmpstr);
|
||||||
|
osip_list_remove(&ticket->sipmsg->record_routes, pos);
|
||||||
|
osip_record_route_free(rroute);
|
||||||
|
rroute=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* generic headers */
|
/* generic headers */
|
||||||
} else {
|
} else {
|
||||||
osip_header_t *h=NULL;
|
osip_header_t *h=NULL;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user