summaryrefslogtreecommitdiffhomepage
path: root/openvpn_ffi
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-05-19 08:03:55 +0200
committerLinus Färnstrand <linus@mullvad.net>2017-05-19 08:03:55 +0200
commit5a29ec07f4d0bc41da0b64435ff156ff37e88c22 (patch)
treed406200f56af2118901d657b7efa26886fed3e38 /openvpn_ffi
parent2f2c5b853ab376948e61e9f371cc724ac07ab5bb (diff)
parent927888f8767f814f98c666af854ba03a09909897 (diff)
downloadmullvadvpn-5a29ec07f4d0bc41da0b64435ff156ff37e88c22.tar.xz
mullvadvpn-5a29ec07f4d0bc41da0b64435ff156ff37e88c22.zip
Merge branch 'openvpn-event-dispatcher'
Diffstat (limited to 'openvpn_ffi')
-rw-r--r--openvpn_ffi/src/lib.rs5
-rw-r--r--openvpn_ffi/src/parse.rs2
2 files changed, 6 insertions, 1 deletions
diff --git a/openvpn_ffi/src/lib.rs b/openvpn_ffi/src/lib.rs
index 00e0d58031..934eb091df 100644
--- a/openvpn_ffi/src/lib.rs
+++ b/openvpn_ffi/src/lib.rs
@@ -12,6 +12,7 @@ extern crate serde_derive;
extern crate assert_matches;
+use std::collections::HashMap;
use std::os::raw::c_int;
mod structs;
@@ -29,6 +30,10 @@ error_chain!{
}
+/// Type definition for environment variables from OpenVPN
+pub type OpenVpnEnv = HashMap<String, String>;
+
+
// Return values. Returned from the plugin to OpenVPN to indicate success or failure. Can also
// Accept (success) or decline (error) an operation, such as incoming client connection attempt.
pub const OPENVPN_PLUGIN_FUNC_SUCCESS: c_int = 0;
diff --git a/openvpn_ffi/src/parse.rs b/openvpn_ffi/src/parse.rs
index 787883fd70..6d0c42c06f 100644
--- a/openvpn_ffi/src/parse.rs
+++ b/openvpn_ffi/src/parse.rs
@@ -52,7 +52,7 @@ pub unsafe fn string_array(mut ptr: *const *const c_char) -> Result<Vec<String>>
/// # Segfaults
///
/// Uses `string_array` internally and will segfault for the same reasons as that function.
-pub unsafe fn env(envptr: *const *const c_char) -> Result<HashMap<String, String>> {
+pub unsafe fn env(envptr: *const *const c_char) -> Result<::OpenVpnEnv> {
let mut map = HashMap::new();
for string in string_array(envptr)? {
let mut iter = string.splitn(2, '=');