THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#191 - bad sotket after re-register in location table
User who did this - David Kovarik (kovik)

----------
odorik.domain = "serz.odorik.cz" desc "nase_domena"
......


route[AUTH]{
$rd = $sel(cfg_get.odorik.domain); #musim mu nastavit ze vola na nas
        if (is_method("REGISTER")){

   #registrace pouze z CZ a SK
   route(ONLYCZ);
#auth limit
   #kdyz posle registraci vic nez 5* za 5minut
   if($sht(auth=>$au::auth_count)==10){
     $var(exp) = $Ts - 300; #zablokuje na 5 minut
     if($sht(auth=>$au::last_auth) > $var(exp)){
       sl_send_reply("403", "Try later");
       xlog("L_INFO","Prekrocil limit registraci  $var(exp) - 
$sht(auth=>$au::last_auth) - auth: $au, src ip: $si\n");
       exit;
     }else{
       $sht(auth=>$au::auth_count) = 0;
       sql_query("seru","UPDATE subscriber SET reg_expire=0 WHERE 
user='$au'","nic");
       sql_result_free("nic");
     }
} #/auth limit
                if (!www_authorize("$td", "subscriber")){
                #if (!www_authorize('$sel(cfg_get.odorik.domain)', 
"subscriber")){
#auth limit
     switch ($retcode) {
       case -1: #invalid user
         sl_send_reply("403", "Forbidden");
         $var(reg_mess)="INVALID USER";
         route(REGISTER_LOG);
         xlog("L_INFO","Invalid user: $au, src ip: $si");
         exit;
       case -2: #invalid password
         $var(reg_mess)="INVALID PASSWORD";
         route(REGISTER_LOG);
         if($sht(auth=>$au::auth_count) == $null){
            $sht(auth=>$au::auth_count) = 0;
         }
         xlog("L_INFO","Invalid password - auth: $au, src ip: $si -- 
count=$sht(auth=>$au::auth_count)");
         $sht(auth=>$au::auth_count) = $sht(auth=>$au::auth_count) + 1;
         if($sht(auth=>$au::auth_count) == 10){
            xlog("L_INFO","Prekrocil limit registraci - auth: $au, src ip: $si -- 
count=$sht(auth=>$au::auth_count) -- last:$sht(auth=>$au::last_auth) = $Ts \n");
            sql_query("seru","UPDATE subscriber SET 
datum_zmeny=NOW(),reg_expire=NOW(),reg_expire_ip='$si' WHERE user='$au'","nic");
            sql_result_free("nic");
         }
         $sht(auth=>$au::last_auth) = $Ts;
         sl_send_reply("403", "Forbidden");
         break;
       }
     #/auth limit

                        www_challenge("$td", "1");
                        #www_challenge('$sel(cfg_get.odorik.domain)', "1");
                        exit;
                }

#prosel smazu z sht $sht(auth=>$au::auth_count) = $null;
   $sht(auth=>$au::last_auth) = $null;

   xlog("L_INFO","AUTH-REGISTER prosel-$rm - $ci - $fU - $rU - $au=$tU");
                if ($au!=$tU)
                {
                        sl_send_reply("403","Forbidden");
     $var(reg_mess)="INVALID AUTH ID";
     route(REGISTER_LOG);
     xlog("L_INFO","AUTH FORBIDDEN $ci - $fU - $rU - $au != $tU");
                        exit;
                }

 $var(reg_mess)="OK";
 route(REGISTER_LOG);
 sql_query("seru","UPDATE subscriber SET datum_zmeny=NOW() WHERE 
user='$au'","nic");
 sql_result_free("nic");
}else{
.....


route[REGISTER_LOG]{
 sql_query("seru","insert into register_log set time_stamp=now(), 
src_ip='$si',auth_user='$au',from_user='$fU',from_uri='$fu',contact_header='$ct',user_agent='$ua',pozn='$var(reg_mess)',packet='$mb'
 ON DUPLICATE KEY UPDATE 
time_stamp=now(),auth_user='$au',from_user='$fU',from_uri='$fu',contact_header='$ct',user_agent='$ua',pozn='$var(reg_mess)',packet='$mb'","nil");
 sql_result_free("nil");
}

route[ONLYCZ]{
 #muze volat jenom z CZ nebo SK
 #pridat do hlavnidb atributy a potom je preposlat odoriku exe
 if($sht(set=>$au) & 2){
   if(geoip_match("$si", "src")){
if !($gip(src=>cc) =~ "CZ|SK"){ xlog("L_INFO","ONLYCZ -- $fU -- forbidden $ru -- $rm from:$si =$gip(src=>cc)-");
       sl_send_reply("403","CZ_ONLY");
       exit;
     }
   }
 }
}

.....
grep -i location ./kamailio.cfg
# *** To enable persistent user location execute:
# set paths to location of modules
modparam("usrloc", "preload", "location")
#/* uncomment the next line to disable parallel forking via location */
/* enable DB persistency for location entries */
 #lookup("location");
        # user location service
        route(LOCATION);
                if (!save("location"))
# USER location service
route[LOCATION]{
        if (!lookup("location")) {
       $var(tmp)="LOCATION 404";
       $var(tmp)="LOCATION 405";


......

grep \:5 ./kamailio.cfg
listen=udp:81.31.45.57:5060
listen=tcp:81.31.45.57:5060
#listen=udp: serz.odorik.cz:5060
#listen=tcp: serz.odorik.cz:5060
modparam("siptrace", "duplicate_uri","sip:81.31.45.55:5066")
----------

More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=191#comment482

You are receiving this message because you have requested it from the Flyspray 
bugtracking system.  If you did not expect this message or don't want to 
receive mails in future, you can change your notification settings at the URL 
shown above.

_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to