Browse Source

use $vn for password

initialize password variable as
variables persist in the sip process

use $vn for password which supports $null value
master
lazedo 6 years ago
parent
commit
02e28b0f08
2 changed files with 6 additions and 8 deletions
  1. +0
    -3
      kamailio/pusher-role.cfg
  2. +6
    -5
      kamailio/registrar-role.cfg

+ 0
- 3
kamailio/pusher-role.cfg View File

@ -126,7 +126,6 @@ route[PUSHER_ATTEMPT_REGISTRATION]
if($hdr(X-Token-Reg) != $null) {
if($sht(push_cache=>$hdr(X-Token-Reg)) != $null) {
$var(password) = $null;
$sht(push_cache=>$hdr(X-Token-Reg)) = $null;
xlog("L_INFO", "$ci|pusher|registration with x-token-reg $hdr(X-Token-Reg)\n");
$xavp(ulattrs=>custom_channel_vars) = "{}";
@ -140,7 +139,6 @@ route[PUSHER_ATTEMPT_REGISTRATION]
if($(sel(contact.uri){uri.param,x-token-reg}) != "") {
if($sht(push_cache=>$(sel(contact.uri){uri.param,x-token-reg})) != $null) {
$var(password) = $null;
$sht(push_cache=>$(sel(contact.uri){uri.param,x-token-reg})) = $null;
xlog("L_INFO", "$ci|pusher|registration with x-token-reg $(sel(contact.uri){uri.param,x-token-reg})\n");
$xavp(ulattrs=>custom_channel_vars) = "{}";
@ -154,7 +152,6 @@ route[PUSHER_ATTEMPT_REGISTRATION]
if($(sel(contact){tobody.params}{param.value,x-token-reg}) != "") {
if($sht(push_cache=>$(sel(contact){tobody.params}{param.value,x-token-reg})) != $null) {
$var(password) = $null;
$sht(push_cache=>$(sel(contact){tobody.params}{param.value,x-token-reg})) = $null;
xlog("L_INFO", "$ci|pusher|registration with x-token-reg $(sel(contact){tobody.params}{param.value,x-token-reg})\n");
$xavp(ulattrs=>custom_channel_vars) = "{}";


+ 6
- 5
kamailio/registrar-role.cfg View File

@ -177,6 +177,7 @@ route[HANDLE_REGISTER]
return;
}
$vn(password) = $null;
route_if_exists("CUSTOM_HANDLER_REGISTER");
#!ifdef PUSHER_ROLE
@ -203,7 +204,7 @@ route[HANDLE_REGISTER]
$xavp(regcfg=>match_received) = $su;
if(registered("location", "$rz:$Au", 2, 1) == 1) {
if($(xavp(ulattrs=>custom_channel_vars){s.len}) > 1) {
$var(password) = $sht(auth_cache=>$Au);
$vn(password) = $sht(auth_cache=>$Au);
update_stat("registrar:cached", "+1");
route(SAVE_LOCATION);
exit;
@ -283,7 +284,7 @@ onreply_route[KZ_AUTHORIZATION_REPLY]
$var(delta_to_start) = $var(StartRoute) - $(kzR{kz.json,AMQP-Received});
$var(delta_from_query) = $(kzR{kz.json,AMQP-Received}) - $xavp(deltas=>query);
xlog("L_INFO", "$ci|log|received $(kzR{kz.json,Event-Category}) $(kzR{kz.json,Event-Name}) reply from $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version}) (Δ1 $(kzR{kz.json,AMQP-Elapsed-Micro}) μs , Δ2 $var(delta_to_start) μs, Δ3 $var(delta_from_query) μs)\n");
$var(password) = $(kzR{kz.json,Auth-Password});
$vn(password) = $(kzR{kz.json,Auth-Password});
$var(nonce) = $adn;
if( $(kzR{kz.json,Event-Name}) == "authn_err" ) {
if($(kzR{kz.json,Permanent-Error}) == "true") {
@ -316,7 +317,7 @@ onreply_route[KZ_AUTHORIZATION_REPLY]
route[CHECK_AUTHORIZATION]
{
if (!pv_auth_check("$fd", "$var(password)", "0", "0")) {
if (!pv_auth_check("$fd", "$vn(password)", "0", "0")) {
#!ifdef ANTIFLOOD_ROLE
route(ANITFLOOD_FAILED_AUTH);
#!endif
@ -349,10 +350,10 @@ route[SUCCESS_AUTHORIZATION]
route[SAVE_LOCATION]
{
if ($sht(auth_cache=>$Au) == $null && $var(password) != $null) {
if ($sht(auth_cache=>$Au) == $null && $vn(password) != $null) {
xlog("L_INFO", "$ci|log|caching sip credentials for $Au\n");
};
$sht(auth_cache=>$Au) = $var(password);
$sht(auth_cache=>$Au) = $vn(password);
route(REGISTRAR_NAT_FLAGS);


Loading…
Cancel
Save