[sr-dev] [kamailio/kamailio] second auth via uac_reg_request_to (Issue #3166)

Alberto bebbo Capponi notifications at github.com
Mon Jun 27 18:49:25 CEST 2022


When using uac_reg_request_to and the first trunk fails (as invalid credentials) try a second trunk, but there is something not cleaned or just doesn't get the new trunk auth params.

code example
```
failure_route[RETRY_OUTBOUND] {

	if (t_check_status("401|407")) {
		if(uac_reg_request_to("$rd", 0)) {
			t_on_failure("RETRY_OUTBOUND");
			xinfo("[RETRY_OUTBOUND] <$ci> | Doing authentication with $dd");
			uac_auth();
			t_relay();
			exit;
		}
	}

	if (next_routing()) {
		$avp(out_trunk) = $rd;
		# t_relay();
		t_on_failure("RETRY_OUTBOUND");
		t_relay();
		exit;
	}
	
}

```

running this code to those targets:
- TRUNK 10.3.3.11 (invalid user/pass)
- TRUNK 10.3.3.12 (correct user/pass)

produce this output in logs:
```
INFO:  [RETRY_OUTBOUND] <xxxx1xxx at 10.3.3.11:5060> | Doing authentication with 10.3.3.10
INFO: uac [auth.c:450]: uac_auth_mode(): no credential for realm "10.3.3.11"
INFO:  [RETRY_OUTBOUND] <xxxx1yyyy at 10.3.3.12:5060> | Doing authentication with 10.3.3.10
```

but if I simply remove the first trunk those credential works on the second trunk. is like some stuff (like the $dd) is not cleaned up / refreshed?


version:
```
version: kamailio 5.5.4 (x86_64/linux) 
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled with gcc 8.3.0
```
running with drouting module to get next trunk


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3166
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/3166 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220627/32929c54/attachment.htm>


More information about the sr-dev mailing list