[stunnel-users] Public domain [PATCH] support environment variables in config file

Dmitry Bakshaev dab1818 at gmail.com
Wed Sep 28 20:26:17 CEST 2016


Hello Pierre!

2016-09-10 14:00 GMT+04:00 Pierre Delaage <delaage.pierre at free.fr>:

> Hi Dmitry,
> I reviewed our previous discussion on setting up stunnel by envvars...
>
> On WCE, if you really want to have a unic code to manage envvars...
> well ok, you have to write a stub for ExpandEnvironmentStrings,
> that either performs %XX% replacement from predefined values OR reads
> those values from a wce-specific "pseudo-env-txtfile".
>


1. https://msdn.microsoft.com/en-us/library/ee490554(v=winembedded.60).aspx
registry values under:
[HKEY_LOCAL_MACHINE\init\BootVars]
"name" = "value"
it's like "global","system","shared".

2. https://msdn.microsoft.com/en-us/library/aa453706.aspx
https://msdn.microsoft.com/en-us/library/aa516912.aspx
it's way to emulate :
getenv("APPDATA");
getenv("USERNAME");
....
something like (pseudocode):
if( !strcmp(name, "APPDATA") ){
 SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, ...);
 ...get "value"...
} else if(!strcmp(name, "USERNAME")){
 GetUserNameEx(NameWindowsCeLocal ...)
 ...get "value"...
} else ...

yes, syntax for "variables" must be %XX% - same as on windows.
I think is not necessary to substitute the contents of the config file
("pseudo-env-txtfile") to another config file (stunnel.conf).


> As there is only ONE user in WCE, it is quite straightforward to write
> such stub, that will be universal for any wce terminal:
>  the predefined values can be identical for any wce terminal.
>
>
I am not familiar with WCE developlemt tools. I read about it:
http://stackoverflow.com/questions/3463420/how-to-create-applications-for-windows-ce
https://en.wikipedia.org/wiki/Windows_CE#Development_tools
https://www.microsoft.com/en-us/download/details.aspx?id=17284
https://msdn.microsoft.com/en-us/library/ms905342.aspx
INSTALL.WCE
makew32.bat
and completely puzzled by the number of versions, variants & etc.
also I do not have the experience, tools and devices for building and
testing WCE apps.

currently patch done for win32 (using native ExpandEnvironmentStringsA) and
*nix (ExpandEnvironmentStringsA stub),
 it's tested and worked.


> NB : I already mentioned that (re)configuring stunnel through envars is
> not safe, at least on Win32 platforms:
> on those systems, env vars are stored in the registry (and synchronised
> with specific system calls): every malicious sw that can hack the registry
> can change env vars, it is of course very easy in we use "user" env vars,
> not system env vars.
>
>
"user" env vars values has no effect on "system" env vars.
to change "system"/"other user" env vars admin/owner privileges required.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stunnel.org/pipermail/stunnel-users/attachments/20160928/ab741163/attachment.html>


More information about the stunnel-users mailing list