]> granicus.if.org Git - ejabberd/commitdiff
* src/mod_offline.erl: Added entire table locking on large message
authorAlexey Shchepin <alexey@process-one.net>
Sun, 22 Aug 2004 21:54:14 +0000 (21:54 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Sun, 22 Aug 2004 21:54:14 +0000 (21:54 +0000)
queue

* src/ejabberd_sm.erl: Added offline_subscription_hook
* src/mod_offline.erl: Use offline_subscription_hook

* src/configure.erl: Updated (thanks to Sergei Golovan)
* src/Makefile.win32: Likewise
* src/tls/Makefile.win32: Likewise
* src/win32/: Likewise

* src/mod_announce.erl: Added announce to all users (thanks to
Sergei Golovan)
* doc/guide.tex: Updated (thanks to Sergei Golovan)

SVN Revision: 259

14 files changed:
ChangeLog
doc/guide.html
doc/guide.tex
src/Makefile.win32
src/configure.erl
src/ejabberd_sm.erl
src/mod_announce.erl
src/mod_offline.erl
src/win32/CheckReqs.ini
src/win32/CheckReqs1.ini [new file with mode: 0644]
src/win32/CheckReqs1H.ini [new file with mode: 0644]
src/win32/CheckUserH.ini
src/win32/ejabberd.cfg
src/win32/ejabberd.nsi

index 12688b70f25143b7e6dd1f07f047d3c5cf71d5f8..8adc9856990c5a30bdb8f92f5f9eca67a660cd07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2004-08-23  Alexey Shchepin  <alexey@sevcom.net>
+
+       * src/mod_offline.erl: Added entire table locking on large message
+       queue
+
+       * src/ejabberd_sm.erl: Added offline_subscription_hook
+       * src/mod_offline.erl: Use offline_subscription_hook
+
+       * src/configure.erl: Updated (thanks to Sergei Golovan)
+       * src/Makefile.win32: Likewise
+       * src/tls/Makefile.win32: Likewise
+       * src/win32/: Likewise
+
+       * src/mod_announce.erl: Added announce to all users (thanks to
+       Sergei Golovan)
+       * doc/guide.tex: Updated (thanks to Sergei Golovan)
+
 2004-08-14  Alexey Shchepin  <alexey@sevcom.net>
 
        * src/msgs/nl.msg: Updated (thanks to Sander Devrieze)
index 1d0927ac83e59c9b972f56f752692ce0ae0b4fc0..9090e5b9b0eba3e5df2f6e142a5a111b7da38c2a 100644 (file)
@@ -824,8 +824,27 @@ Example:
 <H3><A NAME="htoc32">A.2</A>&nbsp;&nbsp;<TT>mod_announce</TT></H3><!--SEC END -->
 
 <A NAME="sec:modannounce"></A>
-This module adds support for broadcast announce messages and MOTD.<BR>
-<BR>
+This module adds support for broadcast announce messages and MOTD.
+When the module is loaded, it handles messages sent to the following JID's
+(suppose that main server has address <TT>example.org</TT>):
+<DL COMPACT=compact><DT>
+<B><TT>example.org/announce/all</TT></B><DD> Message is sent to all registered users.
+If the user is online and connected to several resources, only resource with
+the highest priority will receive the message. If the registered user is
+not connected, the message will be stored offline (if oflline storage is
+available).
+<DT><B><TT>example.org/announce/online</TT></B><DD> Message is sent to all connected users.
+If the user is online and connected to several resources, all resources
+will receive the message.
+<DT><B><TT>example.org/announce/motd</TT></B><DD> Message is set as MOTD (Message of the Day)
+and will be sent to users as they login. In addition the message is sent to
+all connected users (similar to <TT>announce/online</TT> resource).
+<DT><B><TT>example.org/announce/motd/update</TT></B><DD> Message is set as MOTD (Message of the Day)
+and will be sent to users as they login. The message is <EM>not sent</EM> to
+all connected users.
+<DT><B><TT>example.org/announce/motd/delete</TT></B><DD> Any message sent to this JID
+removes existing MOTD.
+</DL>
 Options:
 <DL COMPACT=compact><DT>
 <B><TT>access</TT></B><DD> Specifies who is allowed to send announce messages
index 5e12c70db4c56cddf78cbc345373127ba58ab497..573fdfd6d1bc79b771e709a87ce6090f8141a5e8 100644 (file)
@@ -817,6 +817,26 @@ Example:
 \label{sec:modannounce}
 
 This module adds support for broadcast announce messages and MOTD.
+When the module is loaded, it handles messages sent to the following JID's
+(suppose that main server has address \jid{example.org}):
+\begin{description}
+\titem{example.org/announce/all} Message is sent to all registered users.
+If the user is online and connected to several resources, only resource with
+the highest priority will receive the message. If the registered user is
+not connected, the message will be stored offline (if oflline storage is
+available).
+\titem{example.org/announce/online} Message is sent to all connected users.
+If the user is online and connected to several resources, all resources
+will receive the message.
+\titem{example.org/announce/motd} Message is set as MOTD (Message of the Day)
+and will be sent to users as they login. In addition the message is sent to
+all connected users (similar to \term{announce/online} resource).
+\titem{example.org/announce/motd/update} Message is set as MOTD (Message of the Day)
+and will be sent to users as they login. The message is \emph{not sent} to
+all connected users.
+\titem{example.org/announce/motd/delete} Any message sent to this JID
+removes existing MOTD.
+\end{description}
 
 Options:
 \begin{description}
index 57fd239be32dcbd96117f6626faa57c526523983..692641c5a25f60e75840665191a338e66d806f5f 100644 (file)
@@ -45,8 +45,6 @@ release : build release_clean
        copy $(SYSTEMROOT)\system32\libeay32.dll $(EREL)
        copy $(SYSTEMROOT)\system32\ssleay32.dll $(EREL)
        copy win32\ejabberd.ico $(WIN32_DIR)
-       mkdir $(WIN32_DIR)\5.3
-       copy win32\5.3\*.beam $(WIN32_DIR)\5.3
        mkdir $(SRC_DIR)
        copy *.app $(SRC_DIR)
        copy *.erl $(SRC_DIR)
@@ -66,11 +64,10 @@ release : build release_clean
        copy stringprep\*.erl $(SRC_DIR)\stringprep
        copy stringprep\*.c $(SRC_DIR)\stringprep
        copy stringprep\*.tcl $(SRC_DIR)\stringprep
+       mkdir $(SRC_DIR)\tls
+       copy tls\*.erl $(SRC_DIR)\tls
        mkdir $(SRC_DIR)\web
        copy web\*.erl $(SRC_DIR)\web
-       mkdir $(SRC_DIR)\win32
-       mkdir $(SRC_DIR)\win32\5.3
-       copy win32\5.3\*.erl $(SRC_DIR)\win32\5.3
        mkdir $(DOC_DIR)
        copy ..\doc\*.html $(DOC_DIR)
        copy ..\doc\*.png $(DOC_DIR)
@@ -92,11 +89,11 @@ all-recursive :
        nmake -nologo -f Makefile.win32
        cd ..\stringprep
        nmake -nologo -f Makefile.win32
-       cd ..\web
+       cd ..\tls
        nmake -nologo -f Makefile.win32
-       cd ..\win32\5.3
+       cd ..\web
        nmake -nologo -f Makefile.win32
-       cd ..\..
+       cd ..
 
 compile-beam : 
        erl -s make all report -noinput -s erlang halt
@@ -121,11 +118,11 @@ clean-recursive :
        nmake -nologo -f Makefile.win32 clean
        cd ..\stringprep
        nmake -nologo -f Makefile.win32 clean
-       cd ..\web
+       cd ..\tls
        nmake -nologo -f Makefile.win32 clean
-       cd ..\win32\5.3
+       cd ..\web
        nmake -nologo -f Makefile.win32 clean
-       cd ..\..
+       cd ..
 
 distclean : release_clean clean
        -@erase $(NSIS_HEADER)
index e7736a76e4d95484ea2a9f7fd820477bb1092b84..069f191651279a44ef090510aa0afe0b31f0497b 100644 (file)
@@ -40,6 +40,7 @@ start() ->
     RootDirS = "ERLANG_DIR = " ++ code:root_dir() ++ "\n",
     Version  = "EJABBERD_VERSION = " ++ ?VERSION ++ "\n",
     ExpatDir = "EXPAT_DIR = c:\\progra~1\\expat-1.95.7\n",
+    OpenSSLDir = "OPENSSL_DIR = c:\\progra~1\\OpenSSL\n",
 
     SSLDir    = "SSLDIR = " ++ code:lib_dir("ssl") ++ "\n",
     StdLibDir = "STDLIBDIR = " ++ code:lib_dir("stdlib") ++ "\n",
@@ -50,6 +51,7 @@ start() ->
                                   Version ++
                                   SSLDir ++
                                   StdLibDir ++
+                                  OpenSSLDir ++
                                   ExpatDir ++
                                   ExpatLib ++
                                   ExpatFlag ++
index d4a972518f6fb277d81b003eb9eb8b6f4d1de81b..90bec9b67dedfdf5a1a88eb74aa1a16b4acb0026 100644 (file)
@@ -200,8 +200,9 @@ do_route(From, To, Packet) ->
                                        Subsc ->
                                            case ejabberd_auth:is_user_exists(LUser) of
                                                true ->
-                                                   catch mod_offline:store_packet(
-                                                           From, To, Packet);
+                                                   ejabberd_hooks:run(
+                                                     offline_subscription_hook,
+                                                     [From, To, Packet]);
                                                _ ->
                                                    Err = jlib:make_error_reply(
                                                            Packet, ?ERR_SERVICE_UNAVAILABLE),
index 29ac65e8720e35caa761f1e1e7817fd30205ff3a..b8164aab089ab1c8b131bd202b06618314384b12 100644 (file)
@@ -41,6 +41,9 @@ init() ->
 
 loop() ->
     receive
+       {announce_all, From, To, Packet} ->
+           announce_all(From, To, Packet),
+           loop();
        {announce_online, From, To, Packet} ->
            announce_online(From, To, Packet),
            loop();
@@ -70,6 +73,9 @@ announce(From, To, Packet) ->
        #jid{luser = "", lresource = Res} ->
            {xmlelement, Name, _Attrs, _Els} = Packet,
                case {Res, Name} of
+                   {"announce/all", "message"} ->
+                       ?PROCNAME ! {announce_all, From, To, Packet},
+                       stop;
                    {"announce/online", "message"} ->
                        ?PROCNAME ! {announce_online, From, To, Packet},
                        stop;
@@ -89,6 +95,22 @@ announce(From, To, Packet) ->
            ok
     end.
 
+announce_all(From, To, Packet) ->
+    Access = gen_mod:get_module_opt(?MODULE, access, none),
+    case acl:match_rule(Access, From) of
+       deny ->
+           Err = jlib:make_error_reply(Packet, ?ERR_NOT_ALLOWED),
+           ejabberd_router:route(To, From, Err);
+       allow ->
+           Server = ?MYNAME,
+           Local = jlib:make_jid("", Server, ""),
+           lists:foreach(
+               fun(U) ->
+                       Dest = jlib:make_jid(U, Server, ""),
+                       ejabberd_router:route(Local, Dest, Packet)
+               end, ejabberd_auth:dirty_get_registered_users())
+    end.
+
 announce_online(From, To, Packet) ->
     Access = gen_mod:get_module_opt(?MODULE, access, none),
     case acl:match_rule(Access, From) of
index 22e9b85ee13fd89eb08fae4802578eb3c71c595c..e96b8f371af224518133feb55d9b32b2d74c6856 100644 (file)
@@ -25,6 +25,7 @@
 -record(offline_msg, {user, timestamp, from, to, packet}).
 
 -define(PROCNAME, ejabberd_offline).
+-define(OFFLINE_TABLE_LOCK_THRESHOLD, 1000).
 
 start(_) ->
     mnesia:create_table(offline_msg,
@@ -33,6 +34,8 @@ start(_) ->
                         {attributes, record_info(fields, offline_msg)}]),
     ejabberd_hooks:add(offline_message_hook,
                       ?MODULE, store_packet, 50),
+    ejabberd_hooks:add(offline_subscription_hook,
+                      ?MODULE, store_packet, 50),
     ejabberd_hooks:add(resend_offline_messages_hook,
                       ?MODULE, pop_offline_messages, 50),
     register(?PROCNAME, spawn(?MODULE, init, [])).
@@ -44,7 +47,14 @@ loop() ->
     receive
        #offline_msg{} = Msg ->
            Msgs = receive_all([Msg]),
+           Len = length(Msgs),
            F = fun() ->
+                       if
+                           Len >= ?OFFLINE_TABLE_LOCK_THRESHOLD ->
+                               mnesia:write_lock_table(offline_msg);
+                           true ->
+                               ok
+                       end,
                        lists:foreach(fun(M) ->
                                              mnesia:write(M)
                                      end, Msgs)
index 0b573c826ce80020ebfd70cf9a42034bdeda7069..74b193de74921342fff7e848b5b17f2d11bcf8c8 100644 (file)
@@ -1,11 +1,20 @@
 [Settings]
-NumFields=1
+NumFields=2
 
 [Field 1]
 Type=label
 Left=0
 Right=-1
 Top=10
-Bottom=-10
-Text="Erlang OTP R9C (version 5.3) is required to install Ejabberd.\r\n\r\nIt is not found on your computer.\r\n\r\nPlease install Erlang OTP R9C before installing Ejabberd.\r\n\r\nIt can be downloaded from http://www.erlang.org/download/otp_win32_R9C-0.exe."
+Bottom=70
+Text="Erlang OTP R9C-1 (version 5.3.6.2) or newer is required to install Ejabberd.\r\n\r\nIt is not found on your computer.\r\n\r\nPlease install Erlang OTP R9C-1 or newer before installing Ejabberd.\r\n\r\nIt can be downloaded from"
+
+[Field 2]
+Type=link
+Left=0
+Right=-1
+Top=74
+Bottom=88
+State=http://www.erlang.org/download.html
+Text=http://www.erlang.org/download.html
 
diff --git a/src/win32/CheckReqs1.ini b/src/win32/CheckReqs1.ini
new file mode 100644 (file)
index 0000000..d475ede
--- /dev/null
@@ -0,0 +1,28 @@
+[Settings]
+NumFields=3
+
+[Field 1]
+Type=label
+Left=0
+Right=-1
+Top=10
+Bottom=70
+Text="OpenSLL 0.9.7c or newer is not found on your computer.\r\n\r\nEjabberd includes required SSL libraries but if you don't have SSL certificate then without installed OpenSSL you will not be able to create your own SSL certificate and use SSL-enabled connections.\r\n\r\nOpenSLL can be downloaded from"
+
+[Field 2]
+Type=link
+Left=0
+Right=-1
+Top=74
+Bottom=88
+State=http://www.slproweb.com/products/Win32OpenSSL.html
+Text=http://www.slproweb.com/products/Win32OpenSSL.html
+
+[Field 3]
+Type=label
+Left=0
+Right=-1
+Top=93
+Bottom=-10
+Text="If you want to continue installation anyway, click Next."
+
diff --git a/src/win32/CheckReqs1H.ini b/src/win32/CheckReqs1H.ini
new file mode 100644 (file)
index 0000000..15c4ecf
--- /dev/null
@@ -0,0 +1,29 @@
+[Settings]
+NumFields=3
+
+[Field 1]
+Type=label
+Left=0
+Right=-1
+Top=10
+Bottom=70
+Text="OpenSLL 0.9.7c or newer is not found on your computer.\r\n\r\nEjabberd includes required SSL libraries but if you don't have SSL certificate then without installed OpenSSL you will not be able to create your own SSL certificate and use SSL-enabled connections.\r\n\r\nOpenSLL can be downloaded from"
+
+[Field 2]
+Type=link
+Left=0
+Right=-1
+Top=74
+Bottom=88
+State=http://www.slproweb.com/products/Win32OpenSSL.html
+Text=http://www.slproweb.com/products/Win32OpenSSL.html
+
+[Field 3]
+Type=checkbox
+Left=0
+Right=-1
+Top=93
+Bottom=105
+Text="Proceed with install"
+State=0
+Flags=NOTIFY
index 63b2589b5a441349cbadb6931c29df503013bf1a..8cd9ffc4204ec6bd807c2e5bc889e981c5cc9422 100644 (file)
@@ -14,7 +14,7 @@ Type=checkbox
 Left=0
 Right=-1
 Top=50
-Bottom=-10
+Bottom=62
 Text="Proceed with install"
 State=0
 Flags=NOTIFY
index b4fdeb0d858264d02fb3a226b7d42107d03ee4d7..237761e5ff20c4839537ccf374b3f3a31fcaef5f 100644 (file)
 % Host name:
 {host, "localhost"}.
 
+% Default language:
+{language, "en"}.
 
 % Listened ports:
 {listen,
- [{5222, ejabberd_c2s,     [{access, c2s}, {shaper, c2s_shaper}]},
-%  {5223, ejabberd_c2s,     [{access, c2s}, ssl, {certfile, "./ssl.pem"}]},
+ [
+  {5222, ejabberd_c2s,     [{access, c2s},
+                            {shaper, c2s_shaper}]},
+
+% To create selfsigned certificate run the following command form the
+% command prompt:
+%
+% openssl req -new -x509 -days 365 -nodes -out ejabberd.pem -keyout ejabberd.pem
+%
+% and answer the questions.
+%  {5222, ejabberd_c2s,     [{access, c2s},
+%                            starttls, {certfile, "./ejabberd.pem"}
+%                            {shaper, c2s_shaper}]},
+
+% When using SSL/TLS ssl option is not recommended (it requires patching
+% erlang ssl application). Use tls option instead (as shown below).
+%  {5223, ejabberd_c2s,     [{access, c2s},
+%                            tls, {certfile, "./ejabberd.pem"}]},
+
   {5269, ejabberd_s2s_in,  [{shaper, s2s_shaper}]},
+
 %  {5555, ejabberd_service, [{access, all},
 %                          {host, "icq.localhost", [{password, "secret"}]}]},
+
   {5280, ejabberd_http,    [http_poll, web_admin]}
  ]}.
 
   {mod_stats,     []},
   {mod_vcard,     []},
   {mod_offline,   []},
+  {mod_announce,  [{access, announce}]},
   {mod_private,   []},
   {mod_irc,       []},
   {mod_muc,       []},
index e0b23c97872a43568239e4d7427d8472e1529363..8c7d3fe597308cc510194ff09894028390c3c336 100644 (file)
   
     !ifdef HACKED_INSTALLOPTIONS
        ReserveFile "CheckUserH.ini"
+       ReserveFile "CheckReqs1H.ini"
     !else
        ReserveFile "CheckUser.ini"
+       ReserveFile "CheckReqs1.ini"
     !endif
     ReserveFile "CheckReqs.ini"
     !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
@@ -45,6 +47,9 @@
     Var ERLANG_PATH
     Var ERLANG_VERSION
     Var REQUIRED_ERLANG_VERSION
+    Var OPENSSL_PATH
+    Var OPENSSL_VERSION
+    Var REQUIRED_OPENSSL_VERSION
     Var ERLSRV
 
 ;----------------------------------------------------------
@@ -52,7 +57,8 @@
 
 Function .onInit
 
-    StrCpy $REQUIRED_ERLANG_VERSION "5.3"
+    StrCpy $REQUIRED_ERLANG_VERSION "5.3.6.2"
+    StrCpy $REQUIRED_OPENSSL_VERSION "0.9.7c"
 
     ;Default installation folder
     StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT}"
@@ -70,8 +76,10 @@ Function .onInit
     ;Extract InstallOptions INI files
     !ifdef HACKED_INSTALLOPTIONS
        !insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckUserH.ini"
+       !insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckReqs1H.ini"
     !else
        !insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckUser.ini"
+       !insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckReqs1.ini"
     !endif
     !insertmacro MUI_INSTALLOPTIONS_EXTRACT "CheckReqs.ini"
   
@@ -106,6 +114,7 @@ FunctionEnd
     Page custom CheckUser LeaveCheckUser
     !insertmacro MUI_PAGE_LICENSE "..\..\COPYING"
     Page custom CheckReqs LeaveCheckReqs
+    Page custom CheckReqs1 LeaveCheckReqs1
     ;!insertmacro MUI_PAGE_COMPONENTS
     !insertmacro MUI_PAGE_DIRECTORY
 
@@ -142,6 +151,7 @@ SectionIn 1 RO
     File /r "${TESTDIR}\win32"
     File "${TESTDIR}\libeay32.dll"
     File "${TESTDIR}\ssleay32.dll"
+    File /oname=ejabberd.cfg.example "${TESTDIR}\ejabberd.cfg"
     SetOverwrite off
     File "${TESTDIR}\ejabberd.cfg"
     SetOverwrite on
@@ -155,10 +165,11 @@ SectionIn 1 RO
     StrCpy $0 "$SMPROGRAMS\$STARTMENU_FOLDER"
     CreateDirectory "$0"
     CreateShortCut "$0\Start Ejabberd.lnk" "$ERLANG_PATH\bin\werl.exe" \
-       '-sname ejabberd -pa ebin -pa win32/$ERLANG_VERSION \
+       '-sname ejabberd -pa ebin \
        -env EJABBERD_SO_PATH priv/lib -env EJABBERD_MSGS_PATH msgs \
        -env EJABBERD_LOG_PATH log/ejabberd.log \
-       -s ejabberd -ejabberd config \"ejabberd.cfg\" -mnesia dir \"spool\"' \
+       -s ejabberd -ejabberd config \"ejabberd.cfg\" -mnesia dir \"spool\" \
+       -sasl sasl_error_logger {file,\"log/sasl.log\"}' \
        $INSTDIR\win32\ejabberd.ico
     CreateShortCut "$0\Edit Config.lnk" "%SystemRoot%\system32\notepad.exe" \
        "$INSTDIR\ejabberd.cfg"
@@ -190,7 +201,7 @@ SectionIn 1 RO
     installsrv:
     nsExec::ExecToLog '"$ERLSRV" add ejabberd -stopaction "init:stop()." \
        -onfail reboot -workdir "$INSTDIR" \
-       -args "-s ejabberd -pa ebin -pa win32/$ERLANG_VERSION \
+       -args "-s ejabberd -pa ebin \
        -ejabberd config \\\"ejabberd.cfg\\\" \
        -env EJABBERD_SO_PATH priv/lib -env EJABBERD_MSGS_PATH msgs \
        -env EJABBERD_LOG_PATH log/ejabberd.log \
@@ -394,6 +405,56 @@ Function LeaveCheckReqs
 
 FunctionEnd
 
+Function CheckReqs1
+
+    Push "HKLM"
+    Call FindOpenSSL
+    Pop $OPENSSL_PATH
+    Pop $OPENSSL_VERSION
+    StrCmp $OPENSSL_PATH "" 0 abort
+    Push "HKCU"
+    Call FindOpenSSL
+    Pop $OPENSSL_PATH
+    Pop $OPENSSL_VERSION
+    StrCmp $OPENSSL_PATH "" 0 abort
+
+    !insertmacro MUI_HEADER_TEXT $(TEXT_CR_TITLE) $(TEXT_CR_SUBTITLE)
+    
+    !ifdef HACKED_INSTALLOPTIONS
+       !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CheckReqs1H.ini"
+       !insertmacro MUI_INSTALLOPTIONS_READ $0 "CheckReqs1H.ini" "Field 3" "State"
+       GetDlgItem $1 $HWNDPARENT 1
+       EnableWindow $1 $0
+    !else
+       !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CheckReqs1.ini"
+    !endif
+
+    !insertmacro MUI_INSTALLOPTIONS_SHOW
+
+    abort:
+       Abort
+
+FunctionEnd
+
+Function LeaveCheckReqs1
+
+    !ifdef HACKED_INSTALLOPTIONS
+       !insertmacro MUI_INSTALLOPTIONS_READ $0 "CheckReqs1H.ini" "Settings" "State"
+       StrCmp $0 0 validate  ;Next button?
+       StrCmp $0 3 checkbox  ;checkbox?
+       Abort                 ;Return to the page
+
+       checkbox:
+           !insertmacro MUI_INSTALLOPTIONS_READ $0 "CheckReqs1H.ini" "Field 3" "State"
+           GetDlgItem $1 $HWNDPARENT 1
+           EnableWindow $1 $0
+           Abort
+
+       validate:
+    !endif
+
+FunctionEnd
+
 Function FindErlang
 
     Exch $R0
@@ -447,6 +508,53 @@ Function FindErlang
 
 FunctionEnd
 
+Function FindOpenSSL
+
+    Exch $R0
+    Push $R1
+    Push $R2
+    Push $R3
+    Push $R4
+    Push $R5
+    
+    StrCpy $R1 0
+    StrCpy $R2 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenSSL_is1"
+
+    StrCmp $R0 HKLM h1
+       ReadRegStr $R3 HKCU "$R2" "DisplayName"
+       ReadRegStr $R4 HKCU "$R2" "Inno Setup: App Path"
+       Goto l1
+    h1:
+       ReadRegStr $R3 HKLM "$R2" "DisplayName"
+       ReadRegStr $R4 HKLM "$R2" "Inno Setup: App Path"
+    l1:
+
+    IfFileExists "$R4\bin\openssl.exe" 0 notfound
+       Goto get
+       ; TODO check version
+       ;Push $REQUIRED_OPENSSL_VERSION
+       ;Push $R3
+       ;Call CompareVersions
+       ;Pop $R5
+       ;StrCmp $R5 1 get
+
+    notfound:
+       StrCpy $R4 ""
+
+    get:
+       StrCpy $R0 $R4
+       StrCpy $R1 $R3
+
+       Pop $R5
+       Pop $R4
+       Pop $R3
+       Pop $R2
+       Exch $R1
+       Exch
+       Exch $R0
+
+FunctionEnd
+
 ;----------------------------------------------------------------------
 ; CompareVersions
 ; input: