- Fixed checking of Configuration DNS Servers.
This commit is contained in:
@ -8,8 +8,8 @@ android {
|
|||||||
applicationId = 'com.tutpro.baresip'
|
applicationId = 'com.tutpro.baresip'
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode = 80
|
versionCode = 81
|
||||||
versionName = '8.5.1'
|
versionName = '8.5.2'
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
cFlags '-DHAVE_INTTYPES_H'
|
cFlags '-DHAVE_INTTYPES_H'
|
||||||
|
|||||||
@ -286,7 +286,7 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
if (mediaNat != "") {
|
if (mediaNat != "") {
|
||||||
val newStunServer = stunServer.text.toString().trim()
|
val newStunServer = stunServer.text.toString().trim()
|
||||||
if (acc.stunServer != newStunServer) {
|
if (acc.stunServer != newStunServer) {
|
||||||
if (!Utils.checkHostPort(newStunServer, false)) {
|
if (!Utils.checkHostPort(newStunServer)) {
|
||||||
Utils.alertView(this, "Notice",
|
Utils.alertView(this, "Notice",
|
||||||
"Invalid STUN Server '$newStunServer'")
|
"Invalid STUN Server '$newStunServer'")
|
||||||
return false
|
return false
|
||||||
|
|||||||
@ -309,7 +309,7 @@ class ConfigActivity : AppCompatActivity() {
|
|||||||
private fun checkDnsServers(dnsServers: String): Boolean {
|
private fun checkDnsServers(dnsServers: String): Boolean {
|
||||||
if (dnsServers.length == 0) return true
|
if (dnsServers.length == 0) return true
|
||||||
for (server in dnsServers.split(","))
|
for (server in dnsServers.split(","))
|
||||||
if (!Utils.checkHostPort(server.trim(), true)) return false
|
if (!Utils.checkIpPort(server.trim())) return false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,6 @@ object Utils {
|
|||||||
Log.e("Baresip", "Failed to read asset " + asset + ": " +
|
Log.e("Baresip", "Failed to read asset " + asset + ": " +
|
||||||
e.toString())
|
e.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun alertView(context: Context, title: String, message: String) {
|
fun alertView(context: Context, title: String, message: String) {
|
||||||
@ -201,22 +200,6 @@ object Utils {
|
|||||||
return (number > 0) && (number < 65536)
|
return (number > 0) && (number < 65536)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkHost(host: String): Boolean {
|
|
||||||
return checkIp(host) || checkDomain(host)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun checkHostPort(hostPort: String, portMandatory: Boolean): Boolean {
|
|
||||||
if (portMandatory) {
|
|
||||||
return checkHost(hostPort.substringBeforeLast(":")) &&
|
|
||||||
checkPort(hostPort.substringAfterLast(":"))
|
|
||||||
} else {
|
|
||||||
if (hostPort.substringAfterLast(":").contains(Regex("^[0-9]+\$")))
|
|
||||||
return checkHostPort(hostPort, true)
|
|
||||||
else
|
|
||||||
return checkHost(hostPort)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun checkIpPort(ipPort: String): Boolean {
|
fun checkIpPort(ipPort: String): Boolean {
|
||||||
if (ipPort.startsWith("["))
|
if (ipPort.startsWith("["))
|
||||||
return checkIpv6InBrackets(ipPort.substringBeforeLast(":")) &&
|
return checkIpv6InBrackets(ipPort.substringBeforeLast(":")) &&
|
||||||
@ -226,6 +209,16 @@ object Utils {
|
|||||||
checkPort(ipPort.substringAfterLast(":"))
|
checkPort(ipPort.substringAfterLast(":"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun checkDomainPort(domainPort: String): Boolean {
|
||||||
|
return checkDomain(domainPort.substringBeforeLast(":")) &&
|
||||||
|
checkPort(domainPort.substringAfterLast(":"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkHostPort(hostPort: String): Boolean {
|
||||||
|
return checkIp(hostPort) || checkDomain(hostPort) ||
|
||||||
|
checkIpPort(hostPort) || checkDomainPort(hostPort)
|
||||||
|
}
|
||||||
|
|
||||||
fun checkParams(params: String): Boolean {
|
fun checkParams(params: String): Boolean {
|
||||||
for (param in params.split(";"))
|
for (param in params.split(";"))
|
||||||
if (!checkParam(param)) return false
|
if (!checkParam(param)) return false
|
||||||
@ -246,9 +239,9 @@ object Utils {
|
|||||||
fun checkHostPortParams(hpp: String) : Boolean {
|
fun checkHostPortParams(hpp: String) : Boolean {
|
||||||
val restParams = hpp.split(";", limit = 2)
|
val restParams = hpp.split(";", limit = 2)
|
||||||
if (restParams.size == 1)
|
if (restParams.size == 1)
|
||||||
return checkHostPort(restParams[0], false)
|
return checkHostPort(restParams[0])
|
||||||
else
|
else
|
||||||
return checkHostPort(restParams[0], false) && checkParams(restParams[1])
|
return checkHostPort(restParams[0]) && checkParams(restParams[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkSipUri(uri: String): Boolean {
|
fun checkSipUri(uri: String): Boolean {
|
||||||
|
|||||||
1
fastlane/metadata/android/en-US/changelogs/8.5.2.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/8.5.2.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
- Fixed checking of Configuration DNS Servers.
|
||||||
Reference in New Issue
Block a user