Skip to content

Commit c3afbf9

Browse files
committed
Merge branch '3.4-genesys' into TELECOM-11229
2 parents 48cbe2c + bca5525 commit c3afbf9

64 files changed

Lines changed: 247 additions & 192 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

blacklists.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "context.h"
4141
#include "timer.h"
4242
#include "ut.h"
43+
#include "redact_pii.h"
4344

4445
static struct bl_head *blst_heads;
4546
static unsigned int bl_default_marker;
@@ -1065,7 +1066,7 @@ static mi_response_t *mi_check_all_blacklists(const mi_params_t *params,
10651066
if (add_mi_string(resp_arr, NULL, 0, blst_heads[i].name.s,
10661067
blst_heads[i].name.len) < 0) {
10671068
LM_ERR("cannot add blacklist %.*s\n",
1068-
blst_heads[i].name.len, blst_heads[i].name.s);
1069+
blst_heads[i].name.len, redact_pii(blst_heads[i].name.s));
10691070
free_mi_response(resp);
10701071
resp = NULL;
10711072
goto end;

core_cmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
/* needed by tcpconn_add_alias() */
4343
#include "net/tcp_conn_defs.h"
4444
#include "net/net_tcp.h"
45+
#include "redact_pii.h"
4546

4647
static int fixup_forward_dest(void** param);
4748
static int fixup_destination(void** param);
@@ -479,7 +480,7 @@ static int fixup_f_send_sock(void** param)
479480

480481
he=resolvehost(host_nt.s,0);
481482
if (he==0){
482-
LM_ERR(" could not resolve %s\n", host_nt.s);
483+
LM_ERR(" could not resolve %s\n", redact_pii(host_nt.s));
483484
goto error;
484485
}
485486
hostent2ip_addr(&ip, he, 0);

dset.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "dset.h"
3737
#include "mem/mem.h"
3838
#include "ip_addr.h"
39+
#include "redact_pii.h"
3940

4041
#define CONTACT "Contact: "
4142
#define CONTACT_LEN (sizeof(CONTACT) - 1)
@@ -329,7 +330,7 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
329330
}
330331

331332
if (luri.len > MAX_URI_SIZE - 1) {
332-
LM_ERR("too long uri: %.*s\n", luri.len, luri.s);
333+
LM_ERR("too long uri: %.*s\n", luri.len, redact_pii(luri.s));
333334
return -1;
334335
}
335336

@@ -341,7 +342,7 @@ int append_branch(struct sip_msg* msg, str* uri, str* dst_uri, str* path,
341342
branches[nr_branches].dst_uri_len = 0;
342343
} else {
343344
if (dst_uri->len > MAX_URI_SIZE - 1) {
344-
LM_ERR("too long dst_uri: %.*s\n", dst_uri->len, dst_uri->s);
345+
LM_ERR("too long dst_uri: %.*s\n", dst_uri->len, redact_pii(dst_uri->s));
345346
return -1;
346347
}
347348
memcpy(branches[nr_branches].dst_uri, dst_uri->s, dst_uri->len);
@@ -412,7 +413,7 @@ int update_branch(unsigned int idx, str** uri, str** dst_uri, str** path,
412413
} else {
413414
if ((*dst_uri)->len > MAX_URI_SIZE - 1) {
414415
LM_ERR("too long dst_uri: %.*s\n",
415-
(*dst_uri)->len, (*dst_uri)->s);
416+
(*dst_uri)->len, redact_pii((*dst_uri)->s));
416417
return -1;
417418
}
418419
memcpy(branches[idx].dst_uri, (*dst_uri)->s, (*dst_uri)->len);

forward.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#include "blacklists.h"
8080
#include "msg_callbacks.h"
8181
#include "md5utils.h"
82+
#include "redact_pii.h"
8283

8384

8485

@@ -486,7 +487,7 @@ int forward_reply(struct sip_msg* msg)
486487
msg->via1->port?msg->via1->port:SIP_PORT,
487488
msg->via1->proto)!=1){
488489
LM_ERR("host in first via!=me : %.*s:%d\n",
489-
msg->via1->host.len, msg->via1->host.s, msg->via1->port);
490+
msg->via1->host.len, redact_pii(msg->via1->host.s), msg->via1->port);
490491
/* send error msg back? */
491492
goto error;
492493
}

lib/reg/path.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "../../parser/parse_uri.h"
2727
#include "../../ut.h"
2828
#include "../../strcommon.h"
29+
#include "../../redact_pii.h"
2930

3031
#include "path.h"
3132
#include "config.h"
@@ -122,7 +123,7 @@ int build_path_vector(struct sip_msg *_m, str *path, str *received,
122123
&unescape_buf) != 0)
123124
LM_ERR("failed to unescape received=%.*s\n",
124125
hooks.contact.received->body.len,
125-
hooks.contact.received->body.s);
126+
redact_pii(hooks.contact.received->body.s));
126127
else
127128
*received = unescape_buf;
128129
}

lib/reg/pn.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "../../usr_avp.h"
2929
#include "../../data_lump.h"
3030
#include "../../data_lump_rpl.h"
31+
#include "../../redact_pii.h"
3132

3233
#include "../../modules/usrloc/ul_evi.h"
3334
#include "../../modules/event_routing/api.h"
@@ -280,7 +281,7 @@ enum pn_action pn_inspect_ct_params(struct sip_msg *req, const str *ct_uri)
280281
int i, is_cap_query = 1, is_handled_upstream = 0;
281282

282283
if (parse_uri(ct_uri->s, ct_uri->len, &puri) != 0) {
283-
LM_ERR("failed to parse Contact URI '%.*s'\n", ct_uri->len, ct_uri->s);
284+
LM_ERR("failed to parse Contact URI '%.*s'\n", ct_uri->len, redact_pii(ct_uri->s));
284285
return -1;
285286
}
286287

@@ -551,7 +552,7 @@ static struct usr_avp *pn_trim_pn_params(evi_params_t *params)
551552
pn_has_uri_params(&p->val.s, &puri)) {
552553
if (pn_remove_uri_params(&puri, p->val.s.len, &_sval) != 0) {
553554
LM_ERR("failed to remove PN params from Contact '%.*s'\n",
554-
p->val.s.len, p->val.s.s);
555+
p->val.s.len, redact_pii(p->val.s.s));
555556
sval = &p->val.s;
556557
} else {
557558
sval = &_sval;
@@ -631,13 +632,13 @@ int pn_awake_pn_contacts(struct sip_msg *req, ucontact_t **cts, int sz)
631632
for (end = cts + sz; cts < end; cts++) {
632633
if (parse_uri((*cts)->c.s, (*cts)->c.len, &puri) != 0) {
633634
LM_ERR("failed to parse Contact '%.*s'\n",
634-
(*cts)->c.len, (*cts)->c.s);
635+
(*cts)->c.len, redact_pii((*cts)->c.s));
635636
continue;
636637
}
637638

638639
if (pn_trigger_pn(req, *cts, &puri) != 0) {
639640
LM_ERR("failed to trigger PN for Contact: '%.*s'\n",
640-
(*cts)->c.len, (*cts)->c.s);
641+
(*cts)->c.len, redact_pii((*cts)->c.s));
641642
continue;
642643
}
643644

@@ -660,15 +661,15 @@ int pn_trigger_pn(struct sip_msg *req, const ucontact_t *ct,
660661
if (get_uri_param_val(ct_uri, &f->uri_param_key, &f->val) != 0) {
661662
LM_ERR("failed to locate '%.*s' URI param in Contact '%.*s'\n",
662663
f->uri_param_key.len, f->uri_param_key.s,
663-
ct->c.len, ct->c.s);
664+
ct->c.len, redact_pii(ct->c.s));
664665
return -1;
665666
}
666667
}
667668

668669
if (ebr.notify_on_event(req, ev_ct_update, pn_ebr_filters,
669670
pn_trim_pn_params, pn_inject_branch, pn_refresh_timeout) != 0) {
670671
LM_ERR("failed to EBR-subscribe to "UL_EV_CT_UPDATE", Contact: %.*s\n",
671-
ct->c.len, ct->c.s);
672+
ct->c.len, redact_pii(ct->c.s));
672673
return -1;
673674
}
674675

@@ -693,7 +694,7 @@ int pn_has_uri_params(const str *ct, struct sip_uri *puri)
693694
puri = &_puri;
694695

695696
if (parse_uri(ct->s, ct->len, puri) != 0) {
696-
LM_ERR("failed to parse contact: '%.*s'\n", ct->len, ct->s);
697+
LM_ERR("failed to parse contact: '%.*s'\n", ct->len, redact_pii(ct->s));
697698
return 0;
698699
}
699700

@@ -791,7 +792,7 @@ int pn_async_process_purr(struct sip_msg *req, async_ctx *ctx, udomain_t *d)
791792
/* locate "pn-purr" in the R-URI */
792793
if (parse_sip_msg_uri(req) < 0) {
793794
LM_ERR("failed to parse R-URI: '%.*s'\n",
794-
GET_RURI(req)->len, GET_RURI(req)->s);
795+
GET_RURI(req)->len, redact_pii(GET_RURI(req)->s));
795796
return -1;
796797
}
797798

@@ -814,7 +815,7 @@ int pn_async_process_purr(struct sip_msg *req, async_ctx *ctx, udomain_t *d)
814815

815816
rt_uri = &((rr_t *)req->route->parsed)->nameaddr.uri;
816817
if (parse_uri(rt_uri->s, rt_uri->len, &puri) != 0) {
817-
LM_ERR("failed to parse Route URI: '%.*s'\n", rt_uri->len, rt_uri->s);
818+
LM_ERR("failed to parse Route URI: '%.*s'\n", rt_uri->len, redact_pii(rt_uri->s));
818819
return -1;
819820
}
820821

@@ -843,7 +844,7 @@ int pn_async_process_purr(struct sip_msg *req, async_ctx *ctx, udomain_t *d)
843844
purr->len, purr->s);
844845

845846
if (parse_uri(c->c.s, c->c.len, &puri) != 0) {
846-
LM_ERR("failed to parse Contact: '%.*s'\n", c->c.len, c->c.s);
847+
LM_ERR("failed to parse Contact: '%.*s'\n", c->c.len, redact_pii(c->c.s));
847848
goto err_unlock;
848849
}
849850

@@ -852,7 +853,7 @@ int pn_async_process_purr(struct sip_msg *req, async_ctx *ctx, udomain_t *d)
852853
if (get_uri_param_val(&puri, &f->uri_param_key, &f->val) != 0) {
853854
LM_ERR("failed to locate '%.*s' URI param in Contact '%.*s'\n",
854855
f->uri_param_key.len, f->uri_param_key.s,
855-
c->c.len, c->c.s);
856+
c->c.len, redact_pii(c->c.s));
856857
goto err_unlock;
857858
}
858859
}
@@ -861,7 +862,7 @@ int pn_async_process_purr(struct sip_msg *req, async_ctx *ctx, udomain_t *d)
861862
if (ebr.async_wait_for_event(req, ctx, ev_ct_update, pn_ebr_filters,
862863
pn_trim_pn_params, pn_refresh_timeout) != 0) {
863864
LM_ERR("failed to EBR-subscribe to "UL_EV_CT_UPDATE", ct: '%.*s'\n",
864-
c->c.len, c->c.s);
865+
c->c.len, redact_pii(c->c.s));
865866
goto err_unlock;
866867
}
867868

@@ -892,7 +893,7 @@ int pn_add_reply_purr(const ucontact_t *ct)
892893
return 0;
893894

894895
if (parse_uri(ct->c.s, ct->c.len, &puri) != 0) {
895-
LM_ERR("failed to parse Contact URI: '%.*s'\n", ct->c.len, ct->c.s);
896+
LM_ERR("failed to parse Contact URI: '%.*s'\n", ct->c.len, redact_pii(ct->c.s));
896897
return -1;
897898
}
898899

lib/reg/sip_msg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include "../../parser/contact/parse_contact.h"
2525
#include "../../parser/parse_uri.h"
26+
#include "../../redact_pii.h"
2627

2728
#include "common.h"
2829

@@ -420,7 +421,7 @@ int calc_contact_q(param_t* _q, qvalue_t* _r)
420421
if (rc < 0) {
421422
rerrno = R_INV_Q; /* Invalid q parameter */
422423
LM_ERR("invalid qvalue (%.*s): %s\n",
423-
_q->body.len, _q->body.s, qverr2str(rc));
424+
_q->body.len, redact_pii(_q->body.s), qverr2str(rc));
424425
return -1;
425426
}
426427
}

lib/url.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "../mem/mem.h"
2727
#include "../ut.h"
28+
#include "../redact_pii.h"
2829

2930
#include "csv.h"
3031

@@ -52,7 +53,7 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
5253
#define ENSURE_N_LEFT(n) \
5354
do { \
5455
if (st.len < n) { \
55-
LM_ERR("incomplete URL: '%.*s'\n", in->len, in->s); \
56+
LM_ERR("incomplete URL: '%.*s'\n", in->len, redact_pii(in->s)); \
5657
goto out_err; \
5758
} \
5859
} while (0)
@@ -96,14 +97,14 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
9697
if (opts & (URL_REQ_SCHEME|URL_REQ_SCHEME_GROUP)) {
9798
if (!url->scheme.s || url->scheme.len <= 0) {
9899
LM_ERR("incomplete \"scheme://\" part in URL %.*s\n",
99-
in->len, in->s);
100+
in->len, redact_pii(in->s));
100101
goto out_err;
101102
}
102103

103104
if ((opts & URL_REQ_SCHEME_GROUP) &&
104105
(!url->group_name.s || url->group_name.len <= 0)) {
105106
LM_ERR("bad or missing \"scheme:group://\" part in URL %.*s\n",
106-
in->len, in->s);
107+
in->len, redact_pii(in->s));
107108
goto out_err;
108109
}
109110
}
@@ -130,14 +131,14 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
130131

131132
if (opts & URL_REQ_USER) {
132133
if (!url->username.s || url->username.len <= 0) {
133-
LM_ERR("missing \"username\" part in URL %.*s\n", in->len, in->s);
134+
LM_ERR("missing \"username\" part in URL %.*s\n", in->len, redact_pii(in->s));
134135
goto out_err;
135136
}
136137
}
137138

138139
if (opts & URL_REQ_PASS) {
139140
if (!url->password.s || url->password.len <= 0) {
140-
LM_ERR("missing \"password\" part in URL %.*s\n", in->len, in->s);
141+
LM_ERR("missing \"password\" part in URL %.*s\n", in->len, redact_pii(in->s));
141142
goto out_err;
142143
}
143144
}
@@ -149,14 +150,14 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
149150
hosts_chunk = __parse_csv_record(&hosts_db->s, 0, '/');
150151

151152
if (!hosts_chunk->s.s || hosts_chunk->s.len <= 0) {
152-
LM_ERR("empty/missing \"host\" part in URL %.*s\n", in->len, in->s);
153+
LM_ERR("empty/missing \"host\" part in URL %.*s\n", in->len, redact_pii(in->s));
153154
goto out_err;
154155
}
155156

156157
/* host1[:port1][,host2[:port2]...]] */
157158
hosts = parse_csv_record(&hosts_chunk->s);
158159
if (hosts->next && !(opts & URL_ALLOW_EXTRA_HOSTS)) {
159-
LM_ERR("multiple hosts not allowed in URL %.*s\n", in->len, in->s);
160+
LM_ERR("multiple hosts not allowed in URL %.*s\n", in->len, redact_pii(in->s));
160161
goto out_err;
161162
}
162163

@@ -180,18 +181,18 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
180181
ch = memchr(rec->s.s, ':', rec->s.len);
181182
if (ch) {
182183
if (ch == rec->s.s) {
183-
LM_ERR("empty \"host\" in URL %.*s\n", in->len, in->s);
184+
LM_ERR("empty \"host\" in URL %.*s\n", in->len, redact_pii(in->s));
184185
goto out_err;
185186
}
186187

187188
port.len = rec->s.len - (ch + 1 - rec->s.s);
188189
port.s = ch + 1;
189190
if (port.len <= 0 && (opts & URL_REQ_PORT)) {
190-
LM_ERR("empty \"port\" in URL %.*s\n", in->len, in->s);
191+
LM_ERR("empty \"port\" in URL %.*s\n", in->len, redact_pii(in->s));
191192
goto out_err;
192193
}
193194
if (str2short(&port, &hostlist->port) != 0) {
194-
LM_ERR("bad \"port\" in URL %.*s\n", in->len, in->s);
195+
LM_ERR("bad \"port\" in URL %.*s\n", in->len, redact_pii(in->s));
195196
goto out_err;
196197
}
197198

@@ -208,7 +209,7 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
208209
url->database = hosts_chunk->next->s;
209210

210211
if (!url->database.s && (opts & URL_REQ_DB)) {
211-
LM_ERR("missing \"database\" part in URL %.*s\n", in->len, in->s);
212+
LM_ERR("missing \"database\" part in URL %.*s\n", in->len, redact_pii(in->s));
212213
goto out_err;
213214
}
214215

@@ -237,7 +238,7 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
237238
if (ch) {
238239
if (ch == rec->s.s) {
239240
LM_ERR("empty \"key\" parameter part in URL %.*s\n",
240-
in->len, in->s);
241+
in->len, redact_pii(in->s));
241242
goto out_err;
242243
}
243244

@@ -254,7 +255,7 @@ struct url *parse_url(const str *in, enum url_parse_flags opts, int pkg_dup)
254255
}
255256

256257
if (!url->params && (opts & URL_REQ_PARAMS)) {
257-
LM_ERR("missing \"parameters\" part in URL %.*s\n", in->len, in->s);
258+
LM_ERR("missing \"parameters\" part in URL %.*s\n", in->len, redact_pii(in->s));
258259
goto out_err;
259260
}
260261

modules/auth_db/checks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "../../pvar.h"
4242
#include "../../script_var.h"
4343
#include "../../mod_fix.h"
44+
#include "../../redact_pii.h"
4445
#include "authdb_mod.h"
4546
#include "checks.h"
4647

@@ -296,7 +297,7 @@ int get_auth_id(struct sip_msg* _msg, str *_table, str* uri,
296297
if (parse_uri(uri->s, uri->len, &sip_uri) < 0
297298
&& (sip_uri.user.s == NULL || sip_uri.user.len <= 0)) {
298299
LM_ERR("First parameter must be a URI with username (val = '%.*s').",
299-
uri->len, uri->s);
300+
uri->len, redact_pii(uri->s));
300301
return -1;
301302
}
302303

0 commit comments

Comments
 (0)