Great job<span></span><br><br>On Monday, December 17, 2012, Pierre DELAAGE wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear All,<br>
Please find enclosed a patch in "diff -cr orig patched" format, applying to stunnel v500b3 as found here <a href="https://www.stunnel.org/downloads.html" target="_blank">https://www.stunnel.org/<u></u>downloads.html</a><br>
<br>
This patch mainly addresses compilation and unicode issues for Windows CE targets + ONE issue preventing stunnel to display error logs in error Window on WCE.<br>
<br>
This code has been made common to WCE AND W32, by selecting proper win32 api calls common to both platforms.<br>
<br>
For example : InsertMenuItem does not exist on WCE, but InsertMenu can do the same job.<br>
ShellExecute does not exist on WCE, but...ShellExecuteEx does exist on both platforms and can do the job.<br>
<br>
<br>
I use MS EVC 4sp4 compiler with WCE 420 SDK, on a vista sp2 host platform.<br>
Once debugged the code works fine on WM6 HTC smartphones.<br>
Should work on WM5.<br>
It needs a windows CE openssl lib (I recompiled MY patched version of openssl 1.0.2snap20121213 successfully: I have sent a patch to those openssl gentlemen, hoping that they will integrate it one fine day..., something not so obvious ...).<br>
<br>
You will find my openssl "patch to port", by following carefully this thread at openssl diffusion list :<br>
<br>
<a href="http://marc.info/?l=openssl-dev&m=135574071824906&w=2" target="_blank">http://marc.info/?l=openssl-<u></u>dev&m=135574071824906&w=2</a><br>
two messages are more important than the others : one containing the patch on the code. Another one containing 2 useful scripts.<br>
<br>
The present stunnel patch addresses the following issues :<br>
<br>
*************<br>
I] COMPILATION FAILURES<br>
<br>
It is important to state that to detect more type mismatching (that can be error prone at runtime), I delibarately use /WX option on both WCE and W32 compilers: this flag takes each warning as an error. This is very useful for UNICODE clean coding as, without this option, the compiler will just warn when seeing a short* (unicode string) used as a char* (ansi string), which leads to big pb at run time.<br>
<br>
1/ orig/src/client.c<br>
just a warning on missing "return".<br>
<br>
2/ evc.mak<br>
new SSLDIR to openssl V102snap20121213<br>
Missing flag x86 needed to get inline function InterlockedExchange from winbase.h.<br>
Added dependency to evc.mak itself, as in vc.mak<br>
Added commctrl.lib for CommandBar routines (although, strangely, the program was running without that !)<br>
<br>
3/ gui.c :<br>
UNICODE port for W32/WCE.<br>
WM_WINDOWSPOSCHHANGED replaces WM_SHOWINDOW, as the latter is unsupported in WCE.<br>
some mismatch between prototype and function definition for service_install.<br>
Visible now is a BOOL, as it is more consistant with its value and usage.<br>
Some "return TRUE" have been replaced by "return 0" as stated in msdn doc.<br>
Trick to delete menuitems : itemcount does not exist in WCE, but the delete loop is using the return value of deletemenu.<br>
message_boxT created for Tchar vars such as section->help<br>
ShellExecute replaced by shellExecuteEx, common to WCE and W32<br>
<br>
4/ prototypes.h : declared message_boxT<br>
<br>
5/ resolver.c :<br>
UNICODE issue on LoadLibrary<br>
<br>
6/ stunnel.c<br>
type cast for time_t<br>
<br>
7/ vc.mak :<br>
inc32 for openssl includes<br>
/WX warning as error flag to see every potential casting problem around UNICODE<br>
<br>
<br>
<br>
<br>
<br>
*************<br>
II] OPERATIONAL ERRORS (at run-time)<br>
<br>
1/ error log windows is displayed empty :<br>
cause = WM_SHOWWINDOW does not exist on WCE, although the constant is declared !<br>
solution : use WM_WINDOWPOSCHANGED instead...<br>
<br>
2/ Unsolved, unfortunaltely :<br>
on WCE only, on start, there is an error message, but no real error behind :<br>
"CommandBar_InsertMenuBar : error 120 : this function is only valid in win32 mode"<br>
<br>
I am still searching...<br>
<br>
*************<br>
III] MINOR IMPROVMENT<br>
<br>
1/replaced some win3.1 ugly fonts<br>
See resources.rc :<br>
some nice FONT on About and Password dlgbox...to replace ugly windows3.1 style bold font...<br>
<br>
<br>
<br>
Note : I use stunnel to establish a simple "vpn" between smartphones and<br>
a corporate linux server mainly for HTTPS/POPS/SMTPS support.<br>
Stunnel is very relevant in that matter, over solutions based on SSH<br>
(although we use also ssh), from a communication cost point of view :<br>
ssh establishes permanent socket between client and server, so that the<br>
communication is charged by the mobile network provider : and these<br>
charges are very expensive.<br>
On the contrary stunnel only establishes ssl sockets on demand so that<br>
financial charges are limited to strict necessary.<br>
Please note that stunnel brings "client based certificate<br>
authentication" to POP/SMTP mobile mail user agents which only BASICALLY supports SSL with server authentication, but NO client authentication, such as M$ Outlook for Mobile (unless you pay for an exchange server and exchange client licence).<br>
Here again stunnel is very relevant.<br>
<br>
Note 2 : TODO list and Wish list :<br>
<br>
1/ there is a remaining runtime bug on WCE :<br>
On start there is a warning that is NOT causing any failure in the software.<br>
Very difficult to analyse...<br>
<br>
2/ find a notepad for WCE...<br>
<br>
3/ in log.c...I really it would be good to replace hard coded values for socket errors by symbolic constant.<br>
<br>
4/ fips openssl for WCE and then stunnel for WCE...<br>
<br>
I hope you will find this patch useful.<br>
Michal, thank you for your excellent work,<br>
Yours sincerely,<br>
<br>
Pierre Delaage<br>
<br>
<br>
</blockquote>