summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-05-19 06:32:08 +0200
committerLinus Färnstrand <linus@mullvad.net>2017-05-19 06:37:28 +0200
commitee20435c2128b7ba2364c37954d5f02f7c30c4ab (patch)
treee9f4c80f398a4d060b20e71d84a46f1478a3434e
parent2f2c5b853ab376948e61e9f371cc724ac07ab5bb (diff)
downloadmullvadvpn-ee20435c2128b7ba2364c37954d5f02f7c30c4ab.tar.xz
mullvadvpn-ee20435c2128b7ba2364c37954d5f02f7c30c4ab.zip
Expose OpenVpnEnv type from 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, '=');