<p></p>
<h3 dir="auto">Description</h3>
<p dir="auto">With the latest master, I am trying to register UE in the IMS core. In the S-CSCF Diameter MAR message Authentication scheme is sent as 'unknown".<br>
With Kamailio 5.5.1 works fine.<br>
What I see the problem appears because of the following commits:<br>
<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/kamailio/kamailio/commit/6eb67eaa4fc27d1eb7da7b2b674ffe8e7f86ecbc/hovercard" href="https://github.com/kamailio/kamailio/commit/6eb67eaa4fc27d1eb7da7b2b674ffe8e7f86ecbc"><tt>6eb67ea</tt></a> pv: handle case when var value ha flag str but null pointer<br>
<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/kamailio/kamailio/commit/ffe311939ebf58e7418940ec6c71bfaf9b21afad/hovercard" href="https://github.com/kamailio/kamailio/commit/ffe311939ebf58e7418940ec6c71bfaf9b21afad"><tt>ffe3119</tt></a> pv: fix condition in detecting the null string value when setting $var(...) - issue introduced in previous commit</p>
<p dir="auto">Check the log messages below for detailed debug data.<br>
pv $aa is empty but after line 711 $var(alg) is with len=1 and printed value '0'.</p>
<h4 dir="auto">Reproduction</h4>
<p dir="auto">Try to Register UE to the IMS core with the latest master. Check MAR message AVP 612->avp 608 3GPP-SIP-Authentication-Scheme: unknown</p>
<h4 dir="auto">Log Messages</h4>
<p dir="auto">In s-cscf kamailio.cfg route[REGISTER] I have the following code:<br>
709 route[REGISTER] {<br>
710         xlog("ALGORITHM IS [$aa] and User-Agent is [$ua]\n");<br>
711         $var(alg) = $aa;<br>
712         xlog("ALGORITHM IS [$var(alg)] and User-Agent is [$ua]\n");</p>
<p dir="auto">733                         #user has not been authenticated. Lets send a challenge via 401 Unauthorized<br>
734                         xlog("L_DBG","About to challenge! auth_ims\n");<br>
735                         ims_www_challenge("REG_MAR_REPLY", "$td", "$var(alg)");<br>
736                         exit;</p>
<p dir="auto"><strong>LOG from master branch:</strong><br>
Log output for lines 710 and 712:<br>
Nov 11 14:50:30 kamailio_scscf[31798]:  1(31851) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=710 a=25 n=xlog<br>
Nov 11 14:50:30 kamailio_scscf[31798]:  1(31851) ERROR: <script>: ALGORITHM IS [] and User-Agent is [EE VOLTE]<br>
Nov 11 14:50:30 kamailio_scscf[31798]:  1(31851) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=711 a=63 n=assign<br>
Nov 11 14:50:30 kamailio_scscf[31798]:  1(31851) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=712 a=25 n=xlog<br>
Nov 11 14:50:30 kamailio_scscf[31798]:  1(31851) ERROR: <script>: ALGORITHM IS [0] and User-Agent is [EE VOLTE]</p>
<p dir="auto">Added and debug log into authorize.c:356 file:<br>
...<br>
LM_DBG(" #################### Sending MAR - 0, algo.len=%d algo[%.*s]\n", algo.len, algo.len, algo.s);<br>
....<br>
Log output:<br>
Nov 11 14:50:30 kamailio_scscf[31798]:  1(31851) DEBUG: ims_auth [authorize.c:356]: challenge():  #################### Sending MAR - 0, algo.len=1 algo[0]</p>
<p dir="auto"><strong>LOG from Kamailio 5.5.1:</strong><br>
117528 Nov 11 14:43:53 kamailio_scscf[19016]:  1(19060) ERROR: <script>: ALGORITHM IS [] and User-Agent is [EE VOLTE]<br>
117529 Nov 11 14:43:53 kamailio_scscf[19016]:  1(19060) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=711 a=63 n=assign<br>
117530 Nov 11 14:43:53 kamailio_scscf[19016]:  1(19060) ERROR: *** cfgtrace:dbg_cfg_trace(): request_route=[REGISTER] c=[/etc/kamailio_scscf/kamailio.cfg] l=712 a=25 n=xlog<br>
117531 Nov 11 14:43:53 kamailio_scscf[19016]:  1(19060) ERROR: <script>: ALGORITHM IS [] and User-Agent is [EE VOLTE]</p>
<p dir="auto">Nov 11 14:43:53 mnc234 kamailio_scscf[19016]:  1(19060) DEBUG: ims_auth [authorize.c:356]: challenge():  #################### Sending MAR - 0, algo.len=0 algo[]]</p>
<h4 dir="auto">SIP Traffic</h4>
<h3 dir="auto">Possible Solutions</h3>

<h3 dir="auto">Additional Information</h3>
<ul dir="auto">
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<p dir="auto">version: kamailio 5.6.0-dev2 (x86_64/linux) ffe311-dirty<br>
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<br>
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
id: ffe311 -dirty<br>
compiled on 14:44:53 Nov 11 2021 with gcc 7.4.0</p>
<ul dir="auto">
<li><strong>Operating System</strong>:</li>
</ul>
<p dir="auto">DISTRIB_ID=Ubuntu<br>
DISTRIB_RELEASE=18.04<br>
DISTRIB_CODENAME=bionic<br>
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2928">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZIMH77N5Y3M3QQLCCTULPKBFANCNFSM5H2USIAQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/ABO7UZJHLI44ZKFO5I7UODLULPKBFA5CNFSM5H2USIA2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4PVF43UA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2928",
"url": "https://github.com/kamailio/kamailio/issues/2928",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>