Opened 9 years ago
Last modified 9 years ago
#501 new Feature Wish
environment variables don't pass to windows up script
Reported by: | jktseug | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Generic / unclassified | Version: | OpenVPN git master branch (Community Ed) |
Severity: | Not set (select this one, unless your'e a OpenVPN developer) | Keywords: | |
Cc: |
Description
in windows up script none of the environment variables that were set by the command that calls openvpn are set. It would be nice to keep or copy all the variables over to the script so that they can be used, or define a way to get these variables.
Change History (5)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Type: | Bug / Defect → Feature Wish |
---|---|
Version: | 2.2.2 → git master branch |
comment:3 Changed 9 years ago by
If you have a complex need I could see that as being very complex to manage
--setenv value1 %value1% --setenv value2 %value2%
a quick fix to get around this
in a command script that calls openvpn.exe
set> variables.cmd
in the up/down script
call variables.cmd
comment:4 Changed 9 years ago by
I'm inclined to just closing this unless the change to OpenVPN code would be trivial. Thoughts from the developers?
comment:5 Changed 9 years ago by
I think it should be trivial to call
GetEnvironmentStrings?(); and copy the whole block of memory to the new memory location.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683187%28v=vs.85%29.aspx
You could even make this an extra option. The option would likely be harder but I doubt it would be that difficult.
I don't know if there is a security reason for removing the variables or if it is an unintended consequence of the way CreateProcessW works in windows.
I also haven't looked into this for linux.
If you are looking for a universal way, i believe you can add a third option to main for getting the entire environment variable block.
It should work by calling OpenVPN's --setenv command ("--setenv MYENV foo").