Raise exception on external file in .ovpn

- ca
- cert
- key
- tls-auth
- tls-crypt
This commit is contained in:
Davide De Rosa 2018-10-23 18:59:53 +02:00
parent 8fe29cf924
commit d026004db3
1 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,8 @@ extension TunnelKitProvider.Configuration {
static let keyDirection = Utils.regex("^key-direction +\\d") static let keyDirection = Utils.regex("^key-direction +\\d")
static let externalFiles = Utils.regex("^(ca|cert|key|tls-auth|tls-crypt)")
static let blockBegin = Utils.regex("^<[\\w\\-]+>") static let blockBegin = Utils.regex("^<[\\w\\-]+>")
static let blockEnd = Utils.regex("^<\\/[\\w\\-]+>") static let blockEnd = Utils.regex("^<\\/[\\w\\-]+>")
@ -209,6 +211,9 @@ extension TunnelKitProvider.Configuration {
Regex.fragment.enumerateArguments(in: line) { (_) in Regex.fragment.enumerateArguments(in: line) { (_) in
unsupportedError = ApplicationError.unsupportedConfiguration(option: "fragment") unsupportedError = ApplicationError.unsupportedConfiguration(option: "fragment")
} }
Regex.externalFiles.enumerateArguments(in: line) { (_) in
unsupportedError = ApplicationError.unsupportedConfiguration(option: "external file: \"\(line)\"")
}
if let error = unsupportedError { if let error = unsupportedError {
throw error throw error