[GB.NET.SMTP]

* BUG: Search openssl in '/usr/bin' or '/bin', and raise an error if it is
  not found.


git-svn-id: svn://localhost/gambas/trunk@3933 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-07-12 21:23:13 +00:00
parent 5b7b4e72ea
commit 610e0035b1
2 changed files with 22 additions and 6 deletions

View file

@ -1,11 +1,9 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2921)
# Compiled with Gambas 2.99.1
Title=gb.net.smtp
Startup=MMain
Version=2.99.0
Version=2.99.1
VersionProgram=gbx3 -V
Component=gb.net.smtp
TabSize=2
KeepDebugInfo=1
MakeComponent=1
State=1

View file

@ -14,6 +14,8 @@ Property Encrypt As Integer
Private $iCrypt As Integer
Private $hProcess As Process
Static Private $sOpenSSLPath As String
Private Function Encrypt_Read() As Integer
Return $iCrypt
@ -32,6 +34,22 @@ Public Sub _new()
End
Private Sub GetOpenSSLPath() As String
If Not $sOpenSSLPath Then
If Exist("/usr/bin/openssl") Then
$sOpenSSLPath = "/usr/bin/openssl"
Else If Exist("/bin/openssl") Then
$sOpenSSLPath = "/bin/openssl"
Else
Error.Raise("Unable to find openssl")
Endif
Endif
Return $sOpenSSLPath
End
Public Sub Send()
Dim bDefaultPort As Boolean
@ -41,11 +59,11 @@ Public Sub Send()
If $iCrypt = Net.SSL Then
If bDefaultPort Then Super.Port = 465
$hProcess = Exec ["openssl", "s_client", "-quiet", "-connect", Super.Host & ":" & Super.Port] For Read Write As "Process"
$hProcess = Exec [GetOpenSSLPath(), "s_client", "-quiet", "-connect", Super.Host & ":" & Super.Port] For Read Write As "Process"
Super._NoGreeting = False
Super._Stream = $hProcess
Else If $iCrypt = Net.TLS Then
$hProcess = Exec ["openssl", "s_client", "-quiet", "-starttls", "smtp", "-connect", Super.Host & ":" & Super.Port] For Read Write As "Process"
$hProcess = Exec [GetOpenSSLPath(), "s_client", "-quiet", "-starttls", "smtp", "-connect", Super.Host & ":" & Super.Port] For Read Write As "Process"
Super._NoGreeting = True
Super._Stream = $hProcess
Else