Skip to content

Commit 15780c6

Browse files
authored
Merge pull request #7 from cubesql/feature/SSL-Libraries
SSL Libraries
2 parents 41cc96c + 037df99 commit 15780c6

File tree

12 files changed

+163
-38
lines changed

12 files changed

+163
-38
lines changed

App.rbbas

Lines changed: 102 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,32 +92,114 @@ Inherits Application
9292
End Function
9393
#tag EndMethod
9494

95+
#tag Method, Flags = &h21
96+
Private Function GetLinuxLibrary(psName As String) As FolderItem
97+
#If TargetLinux Then
98+
Dim systemLibs_Folders() As String
99+
Dim systemLibs_Filenames() As String
100+
101+
systemLibs_Filenames.Append(psName + ".so.1.1")
102+
systemLibs_Filenames.Append(psName + ".so.1.0.2")
103+
systemLibs_Filenames.Append(psName + ".so.1.0.0")
104+
systemLibs_Filenames.Append(psName + ".so.0.9.8")
105+
systemLibs_Filenames.Append(psName + ".so") 'is usually a symlink, but might point to non supported version by CubeSQLPlugin
106+
107+
#If Target32Bit Then
108+
#If TargetARM Then
109+
systemLibs_Folders.Append("/lib/arm-linux-gnueabihf/")
110+
systemLibs_Folders.Append("/usr/lib/arm-linux-gnueabihf/")
111+
#EndIf
112+
systemLibs_Folders.Append("/lib/i386-linux-gnu/")
113+
systemLibs_Folders.Append("/usr/lib/i386-linux-gnu/")
114+
systemLibs_Folders.Append("/lib32/")
115+
systemLibs_Folders.Append("/usr/lib32/")
116+
#EndIf
117+
#If Target64Bit Then
118+
#If TargetARM Then
119+
#Pragma Error "SSL Library locations has not been implemented yet for this BuildTarget"
120+
#EndIf
121+
systemLibs_Folders.Append("/lib/x86_64-linux-gnu/")
122+
systemLibs_Folders.Append("/usr/lib/x86_64-linux-gnu/")
123+
systemLibs_Folders.Append("/lib64/")
124+
systemLibs_Folders.Append("/usr/lib64/")
125+
#EndIf
126+
127+
systemLibs_Folders.Append("/lib/")
128+
systemLibs_Folders.Append("/usr/lib/")
129+
130+
Dim oFile As FolderItem
131+
For Each sSystemLibsFolder As String In systemLibs_Folders
132+
For Each sSystemLibsFilename As String In systemLibs_Filenames
133+
oFile = GetFolderItem(sSystemLibsFolder + sSystemLibsFilename, FolderItem.PathTypeShell)
134+
If (oFile <> Nil) And (Not oFile.Directory) And oFile.Exists Then Return oFile
135+
Next
136+
Next
137+
138+
#EndIf
139+
140+
Return Nil
141+
142+
End Function
143+
#tag EndMethod
144+
95145
#tag Method, Flags = &h21
96146
Private Sub SSLStartupCheck()
97-
Dim f As FolderItem = Prefs.SSLAdminPath
98-
if (f = nil) then return
147+
Dim SSLLibFile As FolderItem
148+
Dim CryptoLibFile As FolderItem
99149

100-
Dim SSLLib As String
101-
Dim CryptoLib As String
150+
#If TargetMacOS Then
151+
'SSL Library is included in CubeSQLPlugin
152+
return
153+
154+
#ElseIf TargetWindows Then
155+
'Try to locate the SSL Library in these folders
156+
Dim locateSSLLibsInFolders() As FolderItem = Array(Prefs.SSLAdminPath)
157+
locateSSLLibsInFolders.Append(App.ExecutableFile.Parent)
158+
159+
Dim libsFoldername As String = App.ExecutableFile.Name 'remove .exe
160+
libsFoldername = Left(libsFoldername, Len(libsFoldername) - 4) + " Libs"
161+
locateSSLLibsInFolders.Append(App.ExecutableFile.Parent.Child(libsFoldername))
162+
locateSSLLibsInFolders.Append(App.ExecutableFile.Parent.Child("Libs"))
163+
164+
Dim SSLLib As String
165+
Dim CryptoLib As String
166+
167+
#If Target64Bit Then
168+
SSLLib = "libssl-1_1-x64.dll"
169+
CryptoLib = "libcrypto-1_1-x64.dll"
170+
#Else
171+
SSLLib = "libssl-1_1.dll"
172+
CryptoLib = "libcrypto-1_1.dll"
173+
#EndIf
174+
175+
For Each folder As FolderItem In locateSSLLibsInFolders
176+
If (folder = Nil) Or (Not folder.Exists) Or (Not folder.Directory) Then Continue
177+
178+
SSLLibFile = folder.Child(SSLLib)
179+
CryptoLibFile = folder.Child(CryptoLib)
180+
181+
If (SSLLibFile = Nil) Or (CryptoLibFile = Nil) Then Continue
182+
If (Not SSLLibFile.Exists) Or (Not CryptoLibFile.Exists) Then Continue
183+
184+
'Libs found
185+
Exit 'Loop
186+
Next
187+
188+
#ElseIf TargetLinux Then
189+
SSLLibFile = Me.GetLinuxLibrary("libssl")
190+
CryptoLibFile = Me.GetLinuxLibrary("libcrypto")
191+
192+
#Else
193+
#Pragma Error "SSL Library locations has not been implemented yet for this BuildTarget"
194+
#EndIf
102195

103-
#if TargetMacOS
104-
SSLLib = "libssl.dylib"
105-
CryptoLib = "libcrypto.dylib"
106-
#elseif TargetWindows
107-
SSLLib = "libssl32.dll"
108-
CryptoLib = "libeay32.dll"
109-
#else
110-
SSLLib = "libssl.so"
111-
CryptoLib = "libcrypto.so"
112-
#endif
196+
If (SSLLibFile = Nil) Or (CryptoLibFile = Nil) Then Return
197+
If (Not SSLLibFile.Exists) Or (Not CryptoLibFile.Exists) Then Return
113198

114-
Dim SSLLibPath As FolderItem = f.Child(SSLLib)
115-
Dim CryptoLibPath As FolderItem = f.Child(CryptoLib)
116-
if (SSLLibPath = nil) or (CryptoLibPath = nil) then return
117-
if (SSLLibPath.Exists = false) or (CryptoLibPath.Exists = False) then return
199+
'set SSL Library for CubeSQLPlugin
200+
CubeSQLPlugin.SSLLibrary = SSLLibFile
201+
CubeSQLPlugin.CryptoLibrary = CryptoLibFile
118202

119-
CubeSQLPlugin.SSLLibrary = SSLLibPath
120-
CubeSQLPlugin.CryptoLibrary = CryptoLibPath
121203
End Sub
122204
#tag EndMethod
123205

CubeSQLAdmin.rbvcp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Type=Desktop
2-
RBProjectVersion=2019.031
2+
RBProjectVersion=2021.031
33
MinIDEVersion=20150400
44
OrigIDEVersion=00000000
55
Class=App;App.rbbas;&h0000000053B9B0EB;&h0000000000000000;false
@@ -74,18 +74,18 @@ DefaultWindow=ConnectWindow
7474
AppMenuBar=MenuBar1
7575
MajorVersion=5
7676
MinorVersion=7
77-
SubVersion=6
77+
SubVersion=7
7878
NonRelease=0
7979
Release=3
8080
InfoVersion=
81-
LongVersion=@2019 SQLabs srl
82-
ShortVersion=5.7.6
81+
LongVersion=@2022 SQLabs srl
82+
ShortVersion=5.7.7
8383
WinCompanyName=SQLabs
8484
WinInternalName=
8585
WinProductName=cubeSQLAdmin
8686
WinFileDescription=
8787
AutoIncrementVersionInformation=False
88-
BuildFlags=&h1900
88+
BuildFlags=&h4900
8989
BuildLanguage=&h0
9090
DebugLanguage=&h0
9191
Region=
@@ -106,7 +106,7 @@ DarkMode=True
106106
CopyRedistNextToWindowsEXE=False
107107
IsWebProject=False
108108
LinuxBuildArchitecture=1
109-
MacBuildArchitecture=1
109+
MacBuildArchitecture=4
110110
OptimizationLevel=6
111111
WindowsVersions={35138b9a-5d96-4fbd-8e2d-a2440225f93a}|{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}|{1f676c76-80e1-4239-95bb-83d0f6d0da78}|{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}
112112
WindowsRunAs=0

Others/Build Automation.rbbas

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,41 @@
88
End
99
End
1010
Begin BuildStepList Windows
11+
Begin IDEScriptBuildStep CopySSLLibs_Windows_Setup , AppliesTo = 0, Architecture = 0
12+
Select Case CurrentBuildTarget
13+
14+
Case 3 'Windows 32Bit
15+
PropertyValue("CopySSLLibs_Windows_32Bit.Applies To") = "0" 'Both: Debug and Release
16+
PropertyValue("CopySSLLibs_Windows_64Bit.Applies To") = "3" 'None
17+
18+
Case 19 'Windows 64Bit
19+
PropertyValue("CopySSLLibs_Windows_32Bit.Applies To") = "3" 'None
20+
PropertyValue("CopySSLLibs_Windows_64Bit.Applies To") = "0" 'Both: Debug and Release
21+
22+
End Select
23+
End
1124
Begin BuildProjectStep Build
1225
End
26+
Begin CopyFilesBuildStep CopySSLLibs_Windows_32Bit
27+
AppliesTo = 3
28+
Architecture = 0
29+
Destination = 2
30+
Subdirectory =
31+
FolderItem = Li4vUmVzb3VyY2VzL1NTTC1MaWJyYXJpZXMvV2luZG93c18zMkJpdC9saWJjcnlwdG8tMV8xLmRsbA==
32+
FolderItem = Li4vUmVzb3VyY2VzL1NTTC1MaWJyYXJpZXMvV2luZG93c18zMkJpdC9saWJzc2wtMV8xLmRsbA==
33+
End
34+
Begin CopyFilesBuildStep CopySSLLibs_Windows_64Bit
35+
AppliesTo = 3
36+
Architecture = 0
37+
Destination = 0
38+
Subdirectory =
39+
FolderItem = Li4vUmVzb3VyY2VzL1NTTC1MaWJyYXJpZXMvV2luZG93c182NEJpdC9saWJjcnlwdG8tMV8xLXg2NC5kbGw=
40+
FolderItem = Li4vUmVzb3VyY2VzL1NTTC1MaWJyYXJpZXMvV2luZG93c182NEJpdC9saWJzc2wtMV8xLXg2NC5kbGw=
41+
End
42+
Begin IDEScriptBuildStep CopySSLLibs_Windows_Reset , AppliesTo = 0, Architecture = 0
43+
PropertyValue("CopySSLLibs_Windows_32Bit.Applies To") = "3" 'None
44+
PropertyValue("CopySSLLibs_Windows_64Bit.Applies To") = "3" 'None
45+
46+
End
1347
End
1448
#tag EndBuildAutomation

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Marco Bambini ([email protected])
2626
```
2727
The MIT License (MIT)
2828
29-
Copyright (c) 2019 SQLabs
29+
Copyright (c) 2022 SQLabs
3030
3131
Permission is hereby granted, free of charge, to any person obtaining a copy
3232
of this software and associated documentation files (the "Software"), to deal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
http://wiki.overbyte.eu/wiki/index.php/ICS_Download
2.27 MB
Binary file not shown.
700 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
http://wiki.overbyte.eu/wiki/index.php/ICS_Download
3.1 MB
Binary file not shown.
906 KB
Binary file not shown.

0 commit comments

Comments
 (0)