android: Import excluded subnets from profile file
This commit is contained in:
+11
@@ -55,6 +55,7 @@ import org.strongswan.android.logic.TrustedCertificateManager;
|
||||
import org.strongswan.android.security.TrustedCertificateEntry;
|
||||
import org.strongswan.android.ui.widget.TextInputLayoutHelper;
|
||||
import org.strongswan.android.utils.Constants;
|
||||
import org.strongswan.android.utils.IPRangeSet;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -489,6 +490,16 @@ public class VpnProfileImportActivity extends AppCompatActivity
|
||||
JSONObject split = obj.optJSONObject("split-tunneling");
|
||||
if (split != null)
|
||||
{
|
||||
String excluded = split.optString("excluded", null);
|
||||
if (excluded != null && !excluded.isEmpty())
|
||||
{
|
||||
if (IPRangeSet.fromString(excluded) == null)
|
||||
{
|
||||
throw new JSONException(getString(R.string.profile_import_failed_value,
|
||||
"split-tunneling.excluded"));
|
||||
}
|
||||
profile.setExcludedSubnets(excluded);
|
||||
}
|
||||
int st = 0;
|
||||
st |= split.optBoolean("block-ipv4") ? VpnProfile.SPLIT_TUNNELING_BLOCK_IPV4 : 0;
|
||||
st |= split.optBoolean("block-ipv6") ? VpnProfile.SPLIT_TUNNELING_BLOCK_IPV6 : 0;
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<string name="profile_import_failed_not_found">Datei nicht gefunden</string>
|
||||
<string name="profile_import_failed_host">Host unbekannt</string>
|
||||
<string name="profile_import_failed_tls">TLS-Handshake fehlgeschlagen</string>
|
||||
<string name="profile_import_failed_value">Ungültiger Wert in \"%1$s\"</string>
|
||||
<string name="profile_import_exists">Dieses VPN Profil existiert bereits, die bestehenden Einstellungen werden ersetzt.</string>
|
||||
<string name="profile_cert_import">Zertifikat aus VPN Profil importieren</string>
|
||||
<string name="profile_cert_alias">Zertifikat für \"%1$s\"</string>
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<string name="profile_import_failed_not_found">File not found</string>
|
||||
<string name="profile_import_failed_host">Host unknown</string>
|
||||
<string name="profile_import_failed_tls">TLS handshake failed</string>
|
||||
<string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
|
||||
<string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
|
||||
<string name="profile_cert_import">Import certificate from VPN profile</string>
|
||||
<string name="profile_cert_alias">Certificate for \"%1$s\"</string>
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<string name="profile_import_failed_not_found">File not found</string>
|
||||
<string name="profile_import_failed_host">Host unknown</string>
|
||||
<string name="profile_import_failed_tls">TLS handshake failed</string>
|
||||
<string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
|
||||
<string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
|
||||
<string name="profile_cert_import">Import certificate from VPN profile</string>
|
||||
<string name="profile_cert_alias">Certificate for \"%1$s\"</string>
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
<string name="profile_import_failed_not_found">File not found</string>
|
||||
<string name="profile_import_failed_host">Host unknown</string>
|
||||
<string name="profile_import_failed_tls">TLS handshake failed</string>
|
||||
<string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
|
||||
<string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
|
||||
<string name="profile_cert_import">Import certificate from VPN profile</string>
|
||||
<string name="profile_cert_alias">Certificate for \"%1$s\"</string>
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<string name="profile_import_failed_not_found">文件未找到</string>
|
||||
<string name="profile_import_failed_host">未知主机</string>
|
||||
<string name="profile_import_failed_tls">TLS握手失败</string>
|
||||
<string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
|
||||
<string name="profile_import_exists">此VPN配置已经存在,当前设定将被覆盖。</string>
|
||||
<string name="profile_cert_import">从VPN配置导入证书</string>
|
||||
<string name="profile_cert_alias">\"%1$s\" 所对应的证书</string>
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<string name="profile_import_failed_not_found">沒有找到檔案</string>
|
||||
<string name="profile_import_failed_host">不明主機</string>
|
||||
<string name="profile_import_failed_tls">TLS連線失敗</string>
|
||||
<string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
|
||||
<string name="profile_import_exists">這個VPN設定檔已經存在,當前設定檔會被覆蓋。</string>
|
||||
<string name="profile_cert_import">從VPN設定檔匯入憑證</string>
|
||||
<string name="profile_cert_alias">\"%1$s\" 對應的憑證</string>
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
<string name="profile_import_failed_not_found">File not found</string>
|
||||
<string name="profile_import_failed_host">Host unknown</string>
|
||||
<string name="profile_import_failed_tls">TLS handshake failed</string>
|
||||
<string name="profile_import_failed_value">Invalid value in \"%1$s\"</string>
|
||||
<string name="profile_import_exists">This VPN profile already exists, its current settings will be replaced.</string>
|
||||
<string name="profile_cert_import">Import certificate from VPN profile</string>
|
||||
<string name="profile_cert_alias">Certificate for \"%1$s\"</string>
|
||||
|
||||
Reference in New Issue
Block a user