Hi Dmitry,
Shortly speaking : per user envvars are meaningless for WCE
..phones, as there is no way to switch from a user to another on
those devices. At a time WCE was used on "handeld PC", where things
could be slightly different.
So I recommend that, when your customized stunnel is loading conf
file, and after you have "tokenized" the file to get env-vars name,
you mimic system calls with a stub that always return the same
values RELATIVE to "." folder,
ie where the stunnel executable has been installed on the phone.
This is the SOLE path that is reliable on a WCE phone.
Clearly, your envars will be "path to something" I guess : typically
path to the cert file.
for this example your cert file on a phone will always be in
"./mycert.crt".
For a win32 platform, there will be either a system wide stunnel
running (so who will set up envvars to give to the stunnel env ?
another system script ? with the risk that this script be modified
by malicious code ?),
or a "one user at a time"- wide stunnel running : it will not be
possible to get many processes running stunnel at the same time
(just because, whatever envvar you use, all your processes may
conflict when listening to "accept" sockets) unless ... you
customize "accept" port through envvars ?
for me this is quite dangerous : customizing accept or -even more
dangerous- connect ports through envars is really easy in user space
for any malicious code (to redirect the trafic..).
So I still do not see clearly the interest for stunnel to decode
envvars on the fly in conf file.
If you are looking for conf file automated generation on large
sites, I already gave the trick in a 1-line sed command :
cat stunnel_template.conf | sed -r -e "s/^(.*)$/C\:\\Progra~2\\GnuWin32\\bin\\echo.EXE \1/e" > stunnel.conf
You may argue that this trick can lead to same security breach than
explained above ...but ... NOT for system-wide stunnel for which
-normally- the stunnel.conf file can NOT be modified.
Even for system-wide stunnel, any malicious sw that can tweak the
system registry will be able to redirect stunnel trafic...
So this is why I do not encourage this patch.
Apart from that, technically speaking, you can go forward by
creating a stub for getenv or expandstring w32 functions.
To setup a wce dev environment, see this page :
http://delaage.pierre.free.fr
The link for evc4 is now broken : use this instead :
http://download.microsoft.com/download/C/3/F/C3F8B58B-9753-4C2E-8B96-2DFE3476A2F7/eVC4.exe
I will refresh this web page later with more recent stunnel
codebase.
Yours sincerely
Pierre
Le 28/09/2016 20:26, Dmitry Bakshaev a
écrit :
Hello Pierre!