Parcourir la source

- extend permissions test, check also allow_trusted (related to #1925738),
some small cleanups


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4479 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt il y a 17 ans
Parent
commit
464deb002a
2 fichiers modifiés avec 11 ajouts et 17 suppressions
  1. 9 17
      test/unit/35.cfg
  2. 2 0
      test/unit/35.sh

+ 9 - 17
test/unit/35.cfg

@@ -35,29 +35,21 @@ if (!mf_process_maxfwd_header("10")) {
 }
 
 if (!allow_address("0", "$si", "$sp") || !allow_source_address("0")) {
-	#xlog("permissions");
-        sl_send_reply("403", "Forbidden");
+	#xlog("permissions allow_address");
+	sl_send_reply("403", "Forbidden");
+}
+
+if (!allow_trusted())  {
+	xlog("permissions allow_trusted");
+	sl_send_reply("403", "Forbidden");
 }
 
 if(!lookup ("location")){
 	sl_send_reply("404", "Not Found");
 }
 
-if(method==INVITE){
-	if (!t_relay()) {
-		sl_reply_error();
-	}
-}
-if (method== ACK) {
-	if (!t_relay()) {
-		sl_reply_error();
+if (!t_relay()) {
+	sl_reply_error();
 	}
 }
-if (method==BYE){
-	if (!t_relay("0x04")) {
-		sl_reply_error();
-	}
-}
-exit();
-}
 

+ 2 - 0
test/unit/35.sh

@@ -34,6 +34,7 @@ MASK=27
 
 # add an registrar entry to the db;
 mysql --show-warnings -B -u openser --password=openserrw -D openser -e "INSERT INTO location (username,contact,socket,user_agent,cseq,q) VALUES (\"foo\",\"sip:foo@localhost:$UAS\",\"udp:127.0.0.1:$UAS\",\"ser_test\",1,-1);"
+mysql --show-warnings -B -u openser --password=openserrw -D openser -e "INSERT INTO trusted (src_ip, proto) VALUES (\"127.0.0.1\",\"any\");"
 
 mysql --show-warnings -B -u openser --password=openserrw -D openser -e "INSERT INTO address (ip_addr, mask) VALUES ('$IP', '$MASK');"
 
@@ -64,5 +65,6 @@ killall -9 sipp > /dev/null 2>&1
 killall -9 openser > /dev/null 2>&1
 
 mysql  --show-warnings -B -u openser --password=openserrw -D openser -e "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"ser_test\"));"
+mysql --show-warnings -B -u openser --password=openserrw -D openser -e "DELETE FROM trusted WHERE (src_ip=\"127.0.0.1\");"
 
 exit $ret;