Compare commits

...

221 Commits

Author SHA1 Message Date
Nick Bolton
366f813a2c ChangeLog for v1.7.1-stable 2015-04-21 18:46:32 +01:00
XinyuHou
363dc78ca8 Updated local fingerprint after wizard is finished #4557 2015-04-21 17:56:01 +01:00
XinyuHou
018480412a Stopped retry when fatal error happened in secure socket #4553 2015-04-21 16:54:49 +01:00
Xinyu Hou
423d698436 Fixed secure socket using old trusted fingerprint path #4525 2015-04-21 16:46:05 +01:00
Nick Bolton
f56d06d95d Disabled auto-hide feature #4390 2015-04-21 16:25:55 +01:00
Nick Bolton
d184be31b5 Fixed: SSL dir not created on Mac #4551 2015-04-21 14:48:28 +01:00
Nick Bolton
dbc5da7a48 Refactored certificate class (part 2) #4549 2015-04-21 12:55:45 +01:00
Nick Bolton
7e239c6f71 Refactored certificate class
Split `generateCertificate` into separtate `generateFingerprint`
function, renamed a few functions, removed some unused functions.
2015-04-20 19:26:41 +01:00
Nick Bolton
a894615ca7 Fixed ns plugin using old certificate path #4525 2015-04-20 19:08:03 +01:00
Nick Bolton
f997aea8e7 Moved SSL generate code as is into new class #4549 2015-04-20 18:51:22 +01:00
Nick Bolton
2a2d095527 Merge branch 'master' of https://github.com/synergy/synergy 2015-04-20 16:53:34 +01:00
Nick Bolton
aa9504f43e Changed filenames in app data directory #4525
- Changed `ssl` to `SSL`
- Moved pem file to `SSL`
2015-04-20 16:40:50 +01:00
Nick Bolton
97060d9698 Removed unused SSL download code #4546 2015-04-20 16:31:36 +01:00
Nick Bolton
a649a0e3df Reduced code duplication in fingerprint logic #4548 2015-04-20 16:28:26 +01:00
XinyuHou
5e2b8a5048 Fixed #4537 by add file error checking 2015-04-20 16:16:53 +01:00
Nick Bolton
80fd3cc01b Refactored fingerprint file path logic #4525 2015-04-20 15:58:11 +01:00
Nick Bolton
36a6bb9218 Removed OpenSSL download from plugin manager #4546 2015-04-20 15:27:24 +01:00
XinyuHou
cf6a6bcd48 Removed dead code #4527 2015-04-20 14:57:59 +01:00
Xinyu Hou
e6e3eae0a9 Disabled reconnect after fingerprint failed #4527 2015-04-20 14:43:39 +01:00
Nick Bolton
453638fa39 Added OpenSSL component to installer #4546 2015-04-20 14:35:52 +01:00
Nick Bolton
05b833d1b6 Added OpenSSL config file #4546 2015-04-20 14:35:29 +01:00
XinyuHou
365d16c94b Added more status details #4537 2015-04-17 16:33:43 +01:00
XinyuHou
586a893201 Made retry secure write/read use the exactly last parameters #4539 2015-04-17 14:01:35 +01:00
XinyuHou
951cbe9a62 Enable network security checkbox only when ns plugin exists #4540 2015-04-16 17:15:58 +01:00
XinyuHou
59d013ac6a Show fingerprint only when file exists #4526 2015-04-16 17:12:42 +01:00
XinyuHou
88538e5ee6 Resolve #4526 added local fingerprint in server GUI 2015-04-16 15:10:33 +01:00
XinyuHou
7ab1081b3f Fixed server crash caused by double delete a socket #4535 2015-04-16 11:55:05 +01:00
Nick Bolton
7c6561b3da Fixed #4528 - invalid/misleading log line 2015-04-15 15:17:30 +01:00
Nick Bolton
14bf90264e Renamed function, was reserved keyword on Mac #4522 2015-04-15 14:49:05 +01:00
Nick Bolton
c7de2da062 Comment out unused fingerprint filename consts #4522
Causing compile to fail on Mac (fails on warnings)
2015-04-15 14:33:26 +01:00
Nick Bolton
407f92e9d4 Removed --certificate-fingerprint argument #4522
Used profile dir for fingerprint file path instead
2015-04-15 14:16:28 +01:00
Nick Bolton
6580ad0015 Merge branch 'master' of https://github.com/synergy/synergy 2015-04-15 13:40:55 +01:00
XinyuHou
2752d24dc4 Merge branch 'jerry-sandbox' 2015-04-15 13:33:39 +01:00
Xinyu Hou
e405ec25e3 Always log out server fingerprint #4522 2015-04-15 13:25:18 +01:00
Nick Bolton
689737ee7a Fingerprint file check and trust logic #4522
Also refactored the 'get profile dir' code to use the core interface
(reduce code duplication)
2015-04-15 13:09:22 +01:00
Xinyu Hou
52d9b1beed Logged out new fingerprint when not match #4522 2015-04-15 13:06:49 +01:00
Xinyu Hou
1e2b822226 Removed unused variable 2015-04-14 17:52:24 +01:00
XinyuHou
fa1ea0022b Fixed code style 2015-04-14 17:52:15 +01:00
XinyuHou
f60e98c8cd Fixed error from merge 2015-04-14 17:52:08 +01:00
XinyuHou
916a4c75af Refactored no or wrong ssl certificate error handling #4410
Conflicts:
	src/lib/net/TCPListenSocket.cpp
	src/lib/plugin/ns/SecureListenSocket.cpp
	src/lib/plugin/ns/SecureSocket.cpp
	src/lib/plugin/ns/SecureSocket.h
2015-04-14 17:52:00 +01:00
XinyuHou
dd574c4f2c Added unit tests for string operations 2015-04-14 17:51:50 +01:00
XinyuHou
28eb85660f Fixed error from merge 2015-04-14 17:51:41 +01:00
XinyuHou
b4665b9cd5 Passed args into client and socket
Conflicts:
	src/lib/client/Client.cpp
	src/lib/client/Client.h
	src/lib/synergy/ClientApp.cpp
	src/test/integtests/net/NetworkTests.cpp
2015-04-14 17:51:31 +01:00
Xinyu Hou
39e183da3e Refactored string operations
Conflicts:
	src/lib/base/String.cpp
2015-04-14 17:51:19 +01:00
XinyuHou
cb0f0dd06d Improved fingerprint verification #4522
Conflicts:
	src/lib/plugin/ns/SecureSocket.cpp
	src/lib/plugin/ns/SecureSocket.h
	src/lib/synergy/ClientApp.cpp
2015-04-14 17:50:49 +01:00
XinyuHou
b24eb2b724 Removed test string #4522 2015-04-14 17:50:36 +01:00
XinyuHou
71dc472a64 Fixed code style 2015-04-14 17:49:56 +01:00
XinyuHou
b8ba37b4f4 Made callback function global #4522 2015-04-14 17:49:33 +01:00
Xinyu Hou
5dfe4aa0b5 Added verification of server certificate fingerprint #4522
Conflicts:
	src/lib/mt/Thread.cpp
	src/lib/plugin/ns/SecureSocket.cpp
	src/lib/synergy/ClientArgs.cpp
2015-04-14 17:46:58 +01:00
Nick Bolton
07b1ea203f Message box asking user to verify fingerprint #4522 2015-04-14 17:29:08 +01:00
Nick Bolton
6e2ccb8f8d Merge pull request #4422 from legonigel/shortcut_fix
Changed server shortcut on GUI main window
Fixes #4367
2015-03-28 08:56:36 +00:00
Nick Bolton
0008ad2778 Merge pull request #4462 from synergy/pr-jpmcmu-tripple-click-fix
Double click breaks dragging and tripple click on Mac #3784
2015-03-28 08:53:40 +00:00
Nick Bolton
f80050bea4 Merge remote-tracking branch 'origin/master' into pr-jpmcmu-tripple-click-fix 2015-03-22 00:22:16 +00:00
Nick Bolton
be06c198d4 Merge branch '1.6.3-stable' 2015-03-21 23:51:27 +00:00
Nick Bolton
9706252fb9 Only trust errors for macdeployqt 5+ #4464 2015-03-21 22:01:49 +00:00
Nick Bolton
162ed1fef5 Disabled code signing for old Qt versions #4464 2015-03-21 21:15:53 +00:00
Nick Bolton
a833611804 Updated ChangeLog for 1.6.3 2015-03-21 20:01:13 +00:00
Nick Bolton
0edb3a74b3 Fixed #4465 - Added syntool sign call 2015-03-21 19:59:07 +00:00
Nick Bolton
2e060cc2f3 ChangeLog for 1.6.3 2015-03-21 19:35:59 +00:00
Nick Bolton
dcf8a9f5f0 Changed use of popen to getstatusoutput #4464
The getstatusoutput function seems easier to use
2015-03-21 19:05:43 +00:00
Nick Bolton
88d85204db Fixed distftp source file path #4464 2015-03-21 18:57:09 +00:00
Nick Bolton
ccaf4a8ef3 Removed toolchain code to skip packages #4407 2015-03-21 18:39:06 +00:00
Nick Bolton
e0cb5bda6e Separated post back build into release and debug #4464
Also related to #4463
2015-03-21 18:38:25 +00:00
Nick Bolton
9b2fd85f58 Merge branch '1.6.3-stable'
Conflicts:
	ext/toolchain/commands1.py
	src/lib/plugin/ns/SecureListenSocket.h
2015-03-21 15:57:48 +00:00
James McMullan
1bbd086a17 MacOSX Double / Triple Click Fix
This patch corrects issues with double click and adds triple click to
MacOSX. Double click was functioning but double clicking and then
dragging would not work.
2015-03-21 13:41:00 +00:00
Nick Bolton
ecd51d231b Revert "Revert "Revert "Merge branch 'bug3784-MacOSXDoubleTripleClickFix' of https://github.com/jpmcmu/synergy into jpmcmu-tripple-click-fix"""
This reverts commit 7f721ee7b1.
2015-03-21 13:38:20 +00:00
Nick Bolton
7f721ee7b1 Revert "Revert "Merge branch 'bug3784-MacOSXDoubleTripleClickFix' of https://github.com/jpmcmu/synergy into jpmcmu-tripple-click-fix""
This reverts commit 32323bc0d1.
2015-03-21 11:42:37 +00:00
Nick Bolton
32323bc0d1 Revert "Merge branch 'bug3784-MacOSXDoubleTripleClickFix' of https://github.com/jpmcmu/synergy into jpmcmu-tripple-click-fix"
This reverts commit b5effc0591, reversing
changes made to 297100c88a.
2015-03-21 11:36:38 +00:00
Nick Bolton
b5effc0591 Merge branch 'bug3784-MacOSXDoubleTripleClickFix' of https://github.com/jpmcmu/synergy into jpmcmu-tripple-click-fix 2015-03-21 11:08:53 +00:00
Nick Bolton
0b4d480bcc Removed remnants of synmacph tool (part 3) #4398 2015-03-20 15:11:22 +00:00
Nick Bolton
3deb5492d6 Removed remnants of synmacph tool (part 2) #4398 2015-03-20 15:11:22 +00:00
Nick Bolton
c05d7fad36 Removed remnants of synmacph tool #4398 2015-03-20 15:11:22 +00:00
Nick Bolton
f5cac2846e Removed obsolete code and used Qt to codesign #4397 2015-03-20 14:43:27 +00:00
Nick Bolton
3b44f9d6c5 Added ignore for OpenSSL
This is to stop buildbot from wiping out the openssl dir when switching.
2015-03-20 14:06:48 +00:00
Nick Bolton
297100c88a Merge remote-tracking branch 'origin/1.6.3-stable' 2015-03-20 13:01:12 +00:00
Nick Bolton
14241362ca Removed legacy file remover script 2015-03-20 13:00:21 +00:00
Nick Bolton
69f4a444fd Merge remote-tracking branch 'origin/1.6.3-stable' 2015-03-20 12:59:54 +00:00
Nick Bolton
cf21deb29c Removed test file 2015-03-20 12:59:13 +00:00
Nick Bolton
c2b1674977 Merge 1.6.3-stable 2015-03-20 12:51:56 +00:00
XinyuHou
d3b3513f4b Resolve #4455 replaced version with branch name 2015-03-20 12:24:37 +00:00
XinyuHou
486bea0d02 Resolve #4455 replaced version with branch name 2015-03-20 12:22:56 +00:00
XinyuHou
acb4442259 Version to 1.6.3 2015-03-20 12:18:49 +00:00
legonigel
3c89d60ccb Fix #4349
Fixes issue #4349 in MSWindowsDesks.cpp by using HWND_TOP instead of HWND_TOPMOST. All credit for this fix goes to @gitscrubz and @dubuaych.
2015-03-20 11:41:37 +00:00
XinyuHou
5aaaa784ab Merge branch 'legonigel-focus_fix_gitscrubz' 2015-03-20 11:39:34 +00:00
legonigel
447169df32 Fix #4349
Fixes issue #4349 in MSWindowsDesks.cpp by using HWND_TOP instead of HWND_TOPMOST. All credit for this fix goes to @gitscrubz and @dubuaych.
2015-03-20 03:12:50 -04:00
legonigel
393ac100c8 Changed shortcut on main window gui for server
The shortcut for the server checkbox on the main gui is now Alt-V. This deconflicts the start/stop button.
Fixes #4367
2015-03-09 11:47:13 -04:00
Nick Bolton
702d79570d Merge pull request #4414 from JoshMcCullough/4389
Fixed #4389 - removed unused include from platform/MSWindowsScreen.
2015-03-09 10:55:43 +00:00
Josh McCullough
4ac8f61a54 Fixed #4389 - removed unused include from platform/MSWindowsScreen. 2015-03-06 18:10:39 -05:00
Nick Bolton
3dcd36b10e Removed toolchain code to skip packages #4407 2015-03-05 17:30:08 +00:00
Nick Bolton
4fc46a17ef Version to 1.7.1 2015-03-04 17:09:23 +00:00
Nick Bolton
0da87304a5 ChangeLog for 1.7.0 2015-03-04 17:07:11 +00:00
Nick Bolton
2feb916f2f Unfucked --enable-drag-drop arg parse #4168 2015-03-04 15:10:03 +00:00
Nick Bolton
3364d38498 Removed unused retry variables #4313 2015-03-04 14:07:43 +00:00
Nick Bolton
b4a1c3627f Improved SSL error handling for accept/connect socket #4313 2015-03-04 13:59:53 +00:00
Nick Bolton
501dc6c886 More user-friendly SSL errors, and rate limited failure #4313 2015-03-04 13:42:19 +00:00
Nick Bolton
9cdff4a910 Removed throw from checkResult (causes client to freeze) #4313 2015-03-04 12:26:54 +00:00
Nick Bolton
87a81adeb4 Improved SLL error messages and throw on cert error #4313 2015-03-04 12:15:56 +00:00
Nick Bolton
55de0746dc Copy all plugin files to bin dir (including symbols) #4168 2015-03-04 12:03:38 +00:00
Nick Bolton
a2524d9f57 Make profile dir hack Windows only #4168 2015-03-04 11:51:56 +00:00
Nick Bolton
719e8f6b56 Revert "More robust secure socket error handling #4313"
This reverts commit 40fa58de8c.
2015-03-04 11:43:52 +00:00
Nick Bolton
1c2576b8d7 Revert "Rephrased "crypto disabled" log, changed to error #4313"
This reverts commit a6b5c872f5.
2015-03-04 11:43:45 +00:00
Nick Bolton
6ef41522b7 Revert "Fixed: Exception was not thrown on secure accept/connect #4313"
This reverts commit c5ed03a8a0.
2015-03-04 11:43:42 +00:00
Nick Bolton
cfd21216cd Fixed: Plugins dir may change depending on user #4168 2015-03-04 11:15:07 +00:00
Nick Bolton
c5ed03a8a0 Fixed: Exception was not thrown on secure accept/connect #4313 2015-03-04 10:14:21 +00:00
Nick Bolton
a6b5c872f5 Rephrased "crypto disabled" log, changed to error #4313 2015-03-04 09:00:01 +00:00
Nick Bolton
065960926c Made OpenSSL config file location Windows-only #4313 2015-03-03 19:51:41 +00:00
Nick Bolton
40fa58de8c More robust secure socket error handling #4313 2015-03-03 19:21:14 +00:00
Nick Bolton
b6a3788fea Removed remnants of synmacph tool (part 3) #4398 2015-03-03 18:06:02 +00:00
Nick Bolton
7add4f4d3f Fixed: Compile errors on Linux #4168 2015-03-03 17:29:52 +00:00
Nick Bolton
b8a5abc19f Download and extract OpenSSL dependencies #4313 2015-03-03 11:42:26 +00:00
Nick Bolton
c181d5f480 Fixed #4358 - Corrected typo 2015-03-03 09:23:06 +00:00
Nick Bolton
68a49e0a3a Fixed: Code style for "OpenSSL" should be "OpenSsl" #4313 2015-03-03 08:38:27 +00:00
Nick Bolton
f8847bfde8 Changed OpenSSL to SSL in GUI settings #4313 2015-03-03 08:36:01 +00:00
Nick Bolton
bce1d5be64 Fixed: Plugin manager doesn't download openssl.exe #4313
Refactored use of DataDownloader in PluginManager
2015-03-03 08:27:39 +00:00
Nick Bolton
450435d062 Removed remnants of synmacph tool (part 2) #4398 2015-03-02 18:06:23 +00:00
Nick Bolton
5767790e1e Removed remnants of synmacph tool #4398 2015-03-02 17:50:42 +00:00
Nick Bolton
3f3d452821 Removed obsolete symlink and move functions #4397 2015-03-02 17:44:54 +00:00
Nick Bolton
24aa95a1d5 Removed obsolete code and used Qt to codesign #4397 2015-03-02 17:31:43 +00:00
Nick Bolton
6e7b9491d4 Fixed: Incorrect log level used #4168 2015-02-26 16:44:15 +00:00
Nick Bolton
6971f4551d Merge branch 'master' of https://github.com/synergy/synergy 2015-02-26 12:31:19 +00:00
Nick Bolton
454c2ff826 Added openssl 1.0.1 dependency to deb installer #4313 2015-02-26 12:30:58 +00:00
Nick Bolton
dd57a93345 Added OpenSSL DLLs to Windows installer #4313
libeay32.dll
ssleay32.dll
2015-02-26 00:04:17 +00:00
Nick Bolton
bcf1a1c4d4 Added extra logging to plugin loaders #4168 2015-02-26 00:03:24 +00:00
Nick Bolton
64c350fd96 Fixed: Plugin manager doesn't detect wow64 #4168 2015-02-25 21:22:43 +00:00
Nick Bolton
e4199b976e Improved wording for enable OpenSSL setting #4313 2015-02-25 18:15:38 +00:00
Nick Bolton
eb1083ec45 Fixed: Missing 'else if' on arg parsing #4168 2015-02-25 17:44:17 +00:00
Nick Bolton
a1bfddeb5b Changed plugin manager to use installed arch #4168
Using the processor arch to figure out which plugin to downloa is not
the best idea, since a user could install 32-bit Synergy on 64-bit
Windows.
2015-02-25 17:43:48 +00:00
Nick Bolton
40d304dc24 Refactored "syntool" usage into CoreInterface #4168 2015-02-25 17:19:33 +00:00
Nick Bolton
595e403c87 Fixed: Spinner doesn't stop when no plugins #4168
Also refactored duplicate code
2015-02-25 08:35:07 +00:00
Nick Bolton
c300b65662 Fixed: Plugin downloader freezes if no plugins #4168 2015-02-25 08:17:16 +00:00
Nick Bolton
a30a685ed2 Improved wording on plugin downloader #4168
Also used translate function on strings
2015-02-25 08:16:24 +00:00
Nick Bolton
3a0068ec2e Fixed: Plugin downloader fails if no plugins #4168 2015-02-24 21:19:52 +00:00
Nick Bolton
9de8e42e1b upgraded openssl to 1.0.2 2015-02-23 15:47:39 +00:00
Nick Bolton
5e580e5266 Improved use of English on activate screen #4168 2015-02-20 19:58:37 -05:00
Adam Potolsky
bca57674d0 Added patch that will better detect which Linux distribution is used when determining which plugins to URL to generate. 2015-02-14 19:25:22 -08:00
Adam Potolsky
b9e178a9ee Fixed compiler warning on non-windows systems. 2015-02-14 19:22:08 -08:00
XinyuHou
226f2c966a assigned arch static instance instead of create a new one #4313 2015-02-13 15:58:54 +00:00
Xinyu Hou
4014176d8e Revert "created new instance of arch in plugin #4313"
This reverts commit 8e4f758cb1.
2015-02-13 14:26:03 +00:00
Xinyu Hou
9f1255d986 Revert "did not pass arch into plugins #4313"
This reverts commit 0f686ff308.
2015-02-13 14:25:29 +00:00
XinyuHou
0f686ff308 did not pass arch into plugins #4313 2015-02-13 12:42:23 +00:00
XinyuHou
8e4f758cb1 created new instance of arch in plugin #4313 2015-02-13 12:35:12 +00:00
XinyuHou
d642714fe8 add padlock icon when use secure connection #4313 2015-02-13 10:14:11 +00:00
XinyuHou
629f4b1781 used live url for openssl binary #4168 2015-02-12 17:40:38 +00:00
XinyuHou
4cd20d97ea changed profile directory on mac #4168 2015-02-12 16:52:34 +00:00
XinyuHou
81bb74a24b greyed out network security group when no plugin available #4168 2015-02-12 16:49:18 +00:00
XinyuHou
6cf40afcd7 added copyright #4168 2015-02-12 16:20:03 +00:00
XinyuHou
14bd991b24 productized setting dialog #4168 2015-02-12 16:18:44 +00:00
XinyuHou
c4c0fc8a08 added enable crypto argument to synergys/c #4313 2015-02-12 15:50:08 +00:00
XinyuHou
bbcca144f5 hacked avoid syntool sigsegv on linux #4168 2015-02-11 17:32:18 +00:00
XinyuHou
b9c5eb2e6f added certificate generate #4168 2015-02-11 17:28:56 +00:00
XinyuHou
03ee40891e Merge branch 'master' of github.com:synergy/synergy 2015-02-11 11:13:17 +00:00
XinyuHou
80343c41eb deleted old home brew crypto #4313 2015-02-11 11:12:54 +00:00
Xinyu Hou
028757e4e0 fixed compile warning on Mac 10.6 and below #4313 2015-02-10 17:48:30 +00:00
XinyuHou
4fcec1d217 limited ns pluging to Mac 10.8 and above #4168 2015-02-10 16:20:49 +00:00
XinyuHou
7d5df54bd0 fixed copy command for libns on Linux #4168 2015-02-10 13:07:52 +00:00
XinyuHou
31440b1a8a added const cast #4168 2015-02-10 12:22:30 +00:00
XinyuHou
98716f4e78 fixed compile error on ubuntu64 #4168 2015-02-10 12:13:59 +00:00
XinyuHou
3c4b6163e3 Merge remote-tracking branch 'origin/jerry-sandbox' 2015-02-10 10:28:45 +00:00
XinyuHou
b178d33d62 added plugin downloading from servere #4168 2015-02-09 15:37:47 +00:00
XinyuHou
05e6cb6254 queried plugin list from server #4168 2015-02-06 10:39:58 +00:00
XinyuHou
82b932b1c4 added download plugin page in wizard #4168 2015-02-05 15:52:50 +00:00
XinyuHou
aa46fe91a7 added activate page in wizard #4168 2015-02-05 14:17:34 +00:00
XinyuHou
097f4c4c1f Revert "added login window #4168"
This reverts commit ccc5834757.
2015-02-05 11:44:33 +00:00
XinyuHou
c25b6a8bf6 Revert "stored user email, token and type in settings #4168"
This reverts commit 319de60286.
2015-02-05 11:44:31 +00:00
XinyuHou
f4f7315a54 Revert "added copy right #4168"
This reverts commit e2fb03b8ce.
2015-02-05 11:44:28 +00:00
XinyuHou
fc04901cda Revert "moved gui into main subfolder #4168"
This reverts commit 39f98d8133.
2015-02-05 11:44:23 +00:00
XinyuHou
26fb6b77db Revert "updated ignore list #4168"
This reverts commit afc2a4d1a0.
2015-02-05 11:44:19 +00:00
XinyuHou
db1a611171 Revert "added plugin manager gui #4168"
This reverts commit bfa9bab78d.
2015-02-05 11:44:14 +00:00
XinyuHou
c34928b7c8 Revert "seperated login result and edition type #4168"
This reverts commit da68664bda.
2015-02-05 11:44:10 +00:00
XinyuHou
c81fa7db52 Revert "changed login window to dialog #4168"
This reverts commit d1c1d79453.
2015-02-05 11:44:04 +00:00
XinyuHou
52005f0905 Revert "changed plugin manager gui from window to dialog #4168"
This reverts commit 1132da4598.
2015-02-05 11:43:54 +00:00
XinyuHou
a0090c69ba wq
Revert "fixed plugin gui compile error on mac #4168"

This reverts commit f6d4cf1c38.
2015-02-05 11:42:08 +00:00
Xinyu Hou
f6d4cf1c38 fixed plugin gui compile error on mac #4168 2015-02-04 19:11:54 +00:00
XinyuHou
1132da4598 changed plugin manager gui from window to dialog #4168 2015-02-04 18:17:06 +00:00
XinyuHou
d1c1d79453 changed login window to dialog #4168 2015-02-04 17:30:06 +00:00
XinyuHou
da68664bda seperated login result and edition type #4168 2015-02-04 15:07:52 +00:00
XinyuHou
bfa9bab78d added plugin manager gui #4168 2015-02-04 14:09:03 +00:00
XinyuHou
afc2a4d1a0 updated ignore list #4168 2015-02-04 14:05:02 +00:00
XinyuHou
39f98d8133 moved gui into main subfolder #4168 2015-02-04 14:04:30 +00:00
XinyuHou
5f33a21878 deleted secure socket when close client time out #4313 2015-02-02 16:06:51 +00:00
XinyuHou
3aa6bed669 handled SSL connect failed on client side #4313 2015-02-02 15:33:40 +00:00
XinyuHou
10e6b5ad63 removed client connection when SSL handshake failed #4313 2015-02-02 14:18:34 +00:00
XinyuHou
e2fb03b8ce added copy right #4168 2015-02-02 10:52:40 +00:00
XinyuHou
319de60286 stored user email, token and type in settings #4168 2015-01-30 17:38:12 +00:00
XinyuHou
ccc5834757 added login window #4168 2015-01-30 16:04:27 +00:00
XinyuHou
ad230d46e6 handled secure socket exception #4313 2015-01-29 16:16:45 +00:00
XinyuHou
767802f111 removed loop accept and connect and added more debug info #4313 2015-01-29 15:40:30 +00:00
XinyuHou
d15c99f41d rearranged the deletion orders of clientlistener and server #4313 2015-01-28 17:34:19 +00:00
XinyuHou
4e42b9fdbd fixed memory leak and validate ssl #4313 2015-01-28 17:33:10 +00:00
XinyuHou
622e40e5d7 managed secure socket allocation and deallocation #4313 2015-01-28 13:07:03 +00:00
XinyuHou
d80aa7c938 resolve #4337 removed IStreamFilterFactory dead code 2015-01-27 11:33:06 +00:00
XinyuHou
a53dae9be3 added assersions before lib func invoking and adjust log level #4313 2015-01-27 11:04:23 +00:00
XinyuHou
85813fd49b added plugin unload and cleanup #4313 2015-01-27 10:42:10 +00:00
XinyuHou
10cddb97a8 fixed misused read and write #4313 2015-01-26 13:23:11 +00:00
XinyuHou
06253c965b resolve #4328 by moving plugin into lib folder 2015-01-20 16:18:51 +00:00
XinyuHou
a98c4bd02a made init function signature consistent #4313 2015-01-20 16:00:15 +00:00
Xinyu Hou
141b778477 refactored SecureSocket to use interface #4313 2015-01-14 17:25:53 +00:00
XinyuHou
be2b87fd39 fixed code style 2015-01-12 10:51:16 +00:00
XinyuHou
f973d1498d dropped prefix C 2015-01-12 10:33:29 +00:00
XinyuHou
7bff958422 added pluging loader for unix #4313 2015-01-09 13:47:35 +00:00
XinyuHou
1d7eb3f5cb updated pluging loader for Windows #4313 2015-01-09 13:46:35 +00:00
XinyuHou
9835c7206d Version to 1.7.0 2015-01-07 11:56:28 +00:00
XinyuHou
de8fe7e2a5 fixed compiler cast warning in drag info class 2015-01-06 14:51:37 +00:00
XinyuHou
95a1752396 ported secure socket class from enterprise to ns plugin #4313 2015-01-06 14:20:05 +00:00
XinyuHou
12c2acf37a ignored openssl output dir 2015-01-06 14:15:13 +00:00
XinyuHou
2c14967552 added openssl library for windows and mac 2015-01-06 14:14:20 +00:00
XinyuHou
a0f2261931 added new ns plugin #4313 2015-01-06 13:52:11 +00:00
Xinyu Hou
1f41b92693 Fixed client detected dialog not shown when Synergy is minimized #4307 2015-01-05 13:32:58 +00:00
Nick Bolton
d7fb7b0330 Clarified "free as in free speech" 2015-01-03 12:23:47 +00:00
the-wes
dab4914027 Merge pull request #4301 from the-wes/master
Update locked-to-screen messages
2015-01-01 09:33:59 -08:00
the-wes
5703a41489 Update Server.cpp
clarified "cursor is locked" messages, moved the "scroll lock is on upon startup" message to NOTE level instead of DEBUG.
2014-12-30 13:33:21 -08:00
the-wes
25903182e9 Merge pull request #4284 from the-wes/master
Update --help output in App.h
2014-12-17 15:41:48 -08:00
the-wes
d62c4a842b Update App.h
update --help output.
2014-12-16 18:04:00 -08:00
Nick Bolton
d3b62e1041 Update README 2014-12-14 18:26:23 +00:00
Nick Bolton
3875339b58 Update README 2014-12-14 18:25:08 +00:00
Nick Bolton
98f05d7bb6 Update README 2014-12-14 18:24:46 +00:00
Nick Bolton
7fdf4c1e2b Update README 2014-12-14 18:23:09 +00:00
the-wes
f148ff0bb3 Merge pull request #4264 from the-wes/master
clarify protocol error message
2014-12-08 10:42:16 -08:00
the-wes
a99bea9d3b clarify protocol error message 2014-12-05 16:59:39 -08:00
James McMullan
56b54da915 MacOSX Double / Triple Click Fix
This patch corrects issues with double click and adds triple click to
MacOSX. Double click was functioning but double clicking and then
dragging would not work.
2014-12-04 15:15:38 -05:00
Nick Bolton
4caaa08ade Version to 1.6.3 2014-12-03 09:04:19 +00:00
159 changed files with 4910 additions and 3327 deletions

2
.gitignore vendored
View File

@@ -6,10 +6,12 @@ config.h
/ext/cryptopp562
/ext/gmock-1.6.0
/ext/gtest-1.6.0
/ext/openssl
/src/gui/Makefile*
/src/gui/object_script*
/src/gui/tmp
/src/gui/ui_*
src/gui/gui.pro.user
src/gui/.qmake.stash
src/gui/.rnd
src/setup/win32/synergy.suo

View File

@@ -16,8 +16,8 @@
# Version number for Synergy
set(VERSION_MAJOR 1)
set(VERSION_MINOR 6)
set(VERSION_REV 2)
set(VERSION_MINOR 7)
set(VERSION_REV 1)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}")
cmake_minimum_required(VERSION 2.6)
@@ -78,6 +78,10 @@ if (UNIX)
# we have a problem with people checking in code with warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
if (NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
# For config.h, detect the libraries, functions, etc.
include(CheckIncludeFiles)
include(CheckLibraryExists)
@@ -174,7 +178,7 @@ if (UNIX)
CACHE STRING "" FORCE)
else()
# >= 10.6: Intel only
set(CMAKE_OSX_ARCHITECTURES "i386;x86_64"
set(CMAKE_OSX_ARCHITECTURES "i386"
CACHE STRING "" FORCE)
endif()
@@ -319,7 +323,6 @@ else() # not-unix
endif()
add_subdirectory(src)
add_subdirectory(ext)
if (WIN32)
# TODO: consider using /analyze to uncover potential bugs in the source code.

View File

@@ -1,3 +1,47 @@
v1.7.1
======
Bug #3784 - Double click & drag doesn't select words on client
Bug #3052 - Triple-click (select line) does not work
Bug #4367 - Duplicate Alt-S Keyboard Shortcuts on Gui
Bug #4554 - Server unable to accept new SSL connection
Bug #4553 - SSL handshake failure error causes GUI to crash
Bug #4551 - Plugin wizard doesn't create SSL directory
Bug #4548 - Severe code duplication in fingerprint logic
Bug #4547 - Windows server crashes when client fingerprint dialog open
Bug #4539 - Mac client dies when server has SSL_ERROR_SSL
Bug #4537 - Plugin wizard doesn't complete but finish button enabled
Bug #4535 - Server crashes on shut down after multiple connections failed
Bug #4528 - Error SSL_ERROR_SSL is logged on unknown error
Bug #4527 - Server fingerprint dialog on client GUI keeps showing
Bug #4469 - GUI crashes on Windows when generating certificate
Bug #4410 - SSL_ERROR_SSL (unknown protocol) on Mac client
Bug #4409 - SSL_ERROR_SSL (unknown alert type) on Windows 8.1 client
Bug #4557 - GUI doesn't show local fingerprint on fresh install
Enhancement #4522 - SSL server fingerprint verification from client
Enhancement #4526 - Display local fingerprint on server GUI
Enhancement #4549 - Extract SSL certificate and fingerprint generate function
Enhancement #4546 - Redistribute OpenSSL on Windows with installer
Enhancement #4540 - Enable Network Security checkbox only when ns plugin exists
Enhancement #4525 - Reorganize app data directory
Enhancement #4390 - Disable GUI auto-hide by default
1.7.0
=====
Enhancement #4313 - SSL encrypted secure connection
Enhancement #4168 - Plugin manager for GUI
Enhancement #4307 - Always show client auto-detect dialog
Enhancement #4397 - Modernize Mac build script (deployment and signing)
Enhancement #4398 - Remove obsolete Mac database cleaner
Enhancement #4337 - Remove IStreamFilterFactory dead code
1.6.3
=====
Bug #4349 - Mouse click does not always bring window to front
Bug #4463 - Unidentified developer error on Mac OS X
Bug #4464 - Code signing verify failure not reported on Mac build
Bug #4465 - Binary (syntool) is not code signed on Windows
Enhancement #4455 - Replace version with branch name in package filename
1.6.2
=====
Bug #4227 - Helper tool crashes when service checks elevation state

31
README
View File

@@ -1,25 +1,16 @@
About
=====
Synergy
=======
Synergy brings your computers together in one cohesive experience; its
software for sharing one mouse and keyboard between multiple computers
on your desk. It works on Windows, Mac OS X and Linux allowing you to
seamlessly move your mouse cursor between all computers on your desk.
Share one mouse and keyboard between multiple computers.
Users
=====
Synergy is free and open source (free as in free speech),
meaning you are free to run it and redistribute it with
or without changes.
Synergy is easy to download and configure.
Get it here: http://synergy-project.org/
Just use "hm conf" and "hm build" to compile (./hm.sh on
Linux and Mac).
Developers
==========
For detailed compile instructions:
http://synergy-project.org/wiki/Compiling
Synergy is free and open source, so you are free to run the program,
change the program, and redistribute the program with or without changes.
Once you've got the source code, just use "hm conf" and "hm build" to
compile (./hm.sh on Linux and Mac).
For detailed compile instructions and a list of dependencies, check
out our wiki: http://synergy-project.org/wiki/Compiling
Happy hacking!

View File

@@ -1,96 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2013 Synergy Si Ltd.
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file COPYING that should have accompanied this file.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set(cryptopp_dir cryptopp562)
# only compile the crypto++ files we need.
set(cryptopp_src
${cryptopp_dir}/3way.cpp
${cryptopp_dir}/algparam.cpp
${cryptopp_dir}/asn.cpp
${cryptopp_dir}/authenc.cpp
${cryptopp_dir}/basecode.cpp
${cryptopp_dir}/cpu.cpp
${cryptopp_dir}/cryptlib.cpp
${cryptopp_dir}/des.cpp
${cryptopp_dir}/dessp.cpp
${cryptopp_dir}/dll.cpp
${cryptopp_dir}/ec2n.cpp
${cryptopp_dir}/ecp.cpp
${cryptopp_dir}/filters.cpp
${cryptopp_dir}/fips140.cpp
${cryptopp_dir}/gcm.cpp
${cryptopp_dir}/gf2n.cpp
${cryptopp_dir}/gfpcrypt.cpp
${cryptopp_dir}/hex.cpp
${cryptopp_dir}/hmac.cpp
${cryptopp_dir}/hrtimer.cpp
${cryptopp_dir}/integer.cpp
${cryptopp_dir}/iterhash.cpp
${cryptopp_dir}/misc.cpp
${cryptopp_dir}/modes.cpp
${cryptopp_dir}/mqueue.cpp
${cryptopp_dir}/nbtheory.cpp
${cryptopp_dir}/oaep.cpp
${cryptopp_dir}/osrng.cpp
${cryptopp_dir}/pubkey.cpp
${cryptopp_dir}/queue.cpp
${cryptopp_dir}/randpool.cpp
${cryptopp_dir}/rdtables.cpp
${cryptopp_dir}/rijndael.cpp
${cryptopp_dir}/rng.cpp
${cryptopp_dir}/sha.cpp
)
# if 64-bit windows, compile asm file.
if (CMAKE_CL_64)
list(APPEND cryptopp_src ${cryptopp_dir}/x64dll.asm ${cryptopp_dir}/x64masm.asm)
add_custom_command(OUTPUT $(IntDir)x64dll.obj
COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64dll.obj /Zi
"${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64dll.asm"
MAIN_DEPENDENCY ${cryptopp_dir}/x64dll.asm
VERBATIM)
add_custom_command(OUTPUT $(IntDir)x64masm.obj
COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64masm.obj /Zi
"${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64masm.asm"
MAIN_DEPENDENCY ${cryptopp_dir}/x64masm.asm
VERBATIM)
endif()
if (UNIX)
add_definitions(-DCRYPTOPP_DISABLE_ASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -pipe")
if (APPLE)
if (DARWIN_VERSION GREATER 10)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-compare")
endif()
else()
set(CRYPTOPP_ARCH "native")
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "^arm.*")
set(CRYPTOPP_ARCH "armv6zk")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${CRYPTOPP_ARCH}")
endif()
endif()
add_library(cryptopp STATIC ${cryptopp_src})
if (UNIX)
# ignore warnings in crypto++
set_target_properties(cryptopp PROPERTIES COMPILE_FLAGS "-w")
endif()

Binary file not shown.

BIN
ext/openssl-1.0.2.tar.gz Normal file

Binary file not shown.

View File

@@ -247,9 +247,6 @@ class InternalCommands:
# by default, unknown
macIdentity = None
# cryptoPP dir with version number
cryptoPPDir = 'cryptopp562'
# gtest dir with version number
gtestDir = 'gtest-1.6.0'
@@ -320,22 +317,6 @@ class InternalCommands:
for target in targets:
self.configure(target)
def checkCryptoPP(self):
dir = self.extDir + '/' + self.cryptoPPDir
if (os.path.isdir(dir)):
return
zipFilename = dir + '.zip'
if (not os.path.exists(zipFilename)):
raise Exception('Crypto++ zip not found at: ' + zipFilename)
if not os.path.exists(dir):
os.mkdir(dir)
zip = zipfile.ZipFile(zipFilename)
self.zipExtractAll(zip, dir)
def checkGTest(self):
dir = self.extDir + '/' + self.gtestDir
@@ -464,8 +445,6 @@ class InternalCommands:
# if not visual studio, use parent dir
sourceDir = generator.getSourceDir()
# ensure that the cryptopp source exists
self.checkCryptoPP()
self.checkGTest()
self.checkGMock()
@@ -484,12 +463,6 @@ class InternalCommands:
if generator.cmakeName.find('Eclipse') != -1:
self.fixCmakeEclipseBug()
# only on osx 10.9 mavericks.
# manually change .xcodeproj to add code sign for
# synmacph project and specify its info.plist
if self.macSdk == "10.9" and generator.cmakeName.find('Xcode') != -1:
self.fixXcodeProject(target)
if err != 0:
raise Exception('CMake encountered error: ' + str(err))
@@ -591,59 +564,6 @@ class InternalCommands:
file.write(content)
file.truncate()
file.close()
def fixXcodeProject(self, target):
print "Fixing Xcode project..."
insertContent = (
"CODE_SIGN_IDENTITY = '%s';\n"
"INFOPLIST_FILE = %s/src/cmd/synmacph/Info.plist;\n") % (
self.macIdentity,
os.getcwd()
)
dir = self.getBuildDir(target)
file = open(dir + '/synergy.xcodeproj/project.pbxproj', 'r+')
contents = file.readlines()
buildConfigurationsFound = None
releaseConfigRefFound = None
releaseBuildSettingsFound = None
fixed = None
releaseConfigRef = "";
for line in contents:
if buildConfigurationsFound:
matchObj = re.search(r'\s*(.*)\s*\/\*\s*Release\s*\*\/,', line, re.I)
if matchObj:
releaseConfigRef = matchObj.group(1)
releaseConfigRefFound = True
break
elif buildConfigurationsFound == None:
if 'PBXNativeTarget "synmacph" */ = {' in line:
buildConfigurationsFound = True
if not releaseConfigRefFound:
raise Exception("Release config ref not found.")
for n, line in enumerate(contents):
if releaseBuildSettingsFound == None:
if releaseConfigRef + '/* Release */ = {' in line:
releaseBuildSettingsFound = True
elif fixed == None:
if 'buildSettings = {' in line:
contents[n] = line + insertContent
fixed = True
if not fixed:
raise Exception("Xcode project was not fixed.")
file.seek(0)
for line in contents:
file.write(line)
file.truncate()
file.close()
return
def persist_cmake(self):
# even though we're running `cmake --version`, we're only doing this for the 0 return
@@ -757,148 +677,94 @@ class InternalCommands:
raise Exception('Build command not supported with generator: ' + generator)
def makeGui(self, targets, args=""):
name = "Synergy.app"
self.try_chdir(self.getGenerator().binDir)
if os.path.exists(name):
print "removing exisiting bundle"
shutil.rmtree(name)
self.restore_chdir()
for target in targets:
if sys.platform == 'win32':
gui_make_cmd = self.w32_make_cmd + ' ' + target + args
print 'Make GUI command: ' + gui_make_cmd
if sys.platform == 'win32':
gui_make_cmd = self.w32_make_cmd
elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']:
gui_make_cmd = self.make_cmd + " -w"
else:
raise Exception('Unsupported platform: ' + sys.platform)
gui_make_cmd += args
print 'Make GUI command: ' + gui_make_cmd
if sys.platform == 'win32':
for target in targets:
self.try_chdir(self.gui_dir)
err = os.system(gui_make_cmd + ' ' + target)
err = os.system(gui_make_cmd)
self.restore_chdir()
if err != 0:
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
else:
self.try_chdir(self.gui_dir)
err = os.system(gui_make_cmd)
self.restore_chdir()
if err != 0:
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
elif sys.platform in ['linux2', 'sunos5', 'freebsd7', 'darwin']:
if sys.platform == 'darwin' and not "clean" in args:
for target in targets:
self.macPostMake(target)
gui_make_cmd = self.make_cmd + " -w" + args
print 'Make GUI command: ' + gui_make_cmd
self.fixQtFrameworksLayout()
# start with a clean app bundle
targetDir = self.getGenerator().getBinDir(target)
bundleTargetDir = targetDir + '/Synergy.app'
if os.path.exists(bundleTargetDir):
shutil.rmtree(bundleTargetDir)
def symlink(self, source, target):
if not os.path.exists(target):
os.symlink(source, target)
def move(self, source, target):
if os.path.exists(source):
shutil.move(source, target)
binDir = self.getGenerator().binDir
bundleTempDir = binDir + '/Synergy.app'
if os.path.exists(bundleTempDir):
shutil.rmtree(bundleTempDir)
def fixQtFrameworksLayout(self):
# reorganize Qt frameworks layout on Mac 10.9.5 or later
# http://goo.gl/BFnQ8l
# QtCore example:
# QtCore.framework/
# QtCore -> Versions/Current/QtCore
# Resources -> Versions/Current/Resources
# Versions/
# Current -> 5
# 5/
# QtCore
# Resources/
# Info.plist
dir = self.getGenerator().binDir
target = dir + "/Synergy.app/Contents/Frameworks"
(major, minor) = self.getMacVersion()
if major == 10:
if minor >= 9:
for root, dirs, files in os.walk(target):
for dir in dirs:
if dir.startswith("Qt"):
self.try_chdir(target + "/" + dir +"/Versions")
self.symlink("5", "Current")
self.move("../Resources", "5")
self.restore_chdir()
self.try_chdir(self.gui_dir)
err = os.system(gui_make_cmd)
self.restore_chdir()
self.try_chdir(target + "/" + dir)
dot = dir.find('.')
frameworkName = dir[:dot]
self.symlink("Versions/Current/" + frameworkName, frameworkName)
self.symlink("Versions/Current/Resources", "Resources")
self.restore_chdir()
if err != 0:
raise Exception(gui_make_cmd + ' failed with error: ' + str(err))
def macPostMake(self, target):
if sys.platform == 'darwin' and not "clean" in args:
self.macPostGuiMake(target)
else:
raise Exception('Unsupported platform: ' + sys.platform)
dir = self.getGenerator().binDir
def macPostGuiMake(self, target):
bundle = 'Synergy.app'
binDir = self.getGenerator().binDir
targetDir = self.getGenerator().getBinDir(target)
bundleTempDir = binDir + '/' + bundle
bundleTargetDir = targetDir + '/' + bundle
if os.path.exists(bundleTempDir):
shutil.move(bundleTempDir, bundleTargetDir)
if self.enableMakeCore:
# copy core binaries into the bundle, since the gui
# now looks for the binaries in the current app dir.
targetDir = self.getGenerator().getBinDir(target)
bundleBinDir = dir + "/Synergy.app/Contents/MacOS/"
bundleBinDir = bundleTargetDir + "/Contents/MacOS/"
shutil.copy(targetDir + "/synergyc", bundleBinDir)
shutil.copy(targetDir + "/synergys", bundleBinDir)
shutil.copy(targetDir + "/syntool", bundleBinDir)
if self.macSdk == "10.9":
launchServicesDir = dir + "/Synergy.app/Contents/Library/LaunchServices/"
if not os.path.exists(launchServicesDir):
os.makedirs(launchServicesDir)
shutil.copy(targetDir + "/synmacph", launchServicesDir)
if self.enableMakeGui:
# use qt to copy libs to bundle so no dependencies are needed. do not create a
# dmg at this point, since we need to sign it first, and then create our own
# after signing (so that qt does not affect the signed app bundle).
bin = "macdeployqt Synergy.app -verbose=2"
self.try_chdir(dir)
err = os.system(bin)
self.restore_chdir()
if err != 0:
raise Exception(bin + " failed with error: " + str(err))
(qMajor, qMinor, qRev) = self.getQmakeVersion()
if qMajor <= 4:
frameworkRootDir = "/Library/Frameworks"
else:
# TODO: auto-detect, qt can now be installed anywhere.
frameworkRootDir = "/Developer/Qt5.2.1/5.2.1/clang_64/lib"
target = dir + "/Synergy.app/Contents/Frameworks"
# copy the missing Info.plist files for the frameworks.
for root, dirs, files in os.walk(target):
for dir in dirs:
if dir.startswith("Qt"):
shutil.copy(
frameworkRootDir + "/" + dir + "/Contents/Info.plist",
target + "/" + dir + "/Resources/")
def signmac(self):
self.loadConfig()
if not self.macIdentity:
raise Exception("run config with --mac-identity")
self.try_chdir("bin")
err = os.system(
'codesign --deep -fs "' + self.macIdentity + '" Synergy.app')
self.restore_chdir()
if err != 0:
raise Exception("codesign failed with error: " + str(err))
if sys.version_info < (2, 4):
raise Exception("Python 2.4 or greater required.")
(qMajor, qMinor, qRev) = self.getQmakeVersion()
if qMajor >= 5:
output = commands.getstatusoutput(
"macdeployqt %s/Synergy.app -verbose=2 -codesign='%s'" % (
targetDir, self.macIdentity))
else:
# no code signing available in old versions
output = commands.getstatusoutput(
"macdeployqt %s/Synergy.app -verbose=2" % (
targetDir))
print output[1]
if "ERROR" in output[1]:
(qMajor, qMinor, qRev) = self.getQmakeVersion()
if qMajor >= 5:
# only listen to errors in qt 5+
raise Exception("macdeployqt failed")
def signmac(self):
print "signmac is now obsolete"
def signwin(self, pfx, pwdFile, dist):
generator = self.getGeneratorFromConfig().cmakeName
@@ -917,6 +783,7 @@ class InternalCommands:
self.signFile(pfx, pwd, 'bin/Release', 'synergyc.exe')
self.signFile(pfx, pwd, 'bin/Release', 'synergys.exe')
self.signFile(pfx, pwd, 'bin/Release', 'synergyd.exe')
self.signFile(pfx, pwd, 'bin/Release', 'syntool.exe')
self.signFile(pfx, pwd, 'bin/Release', 'synwinhk.dll')
def signFile(self, pfx, pwd, dir, file):
@@ -1305,16 +1172,16 @@ class InternalCommands:
def distMac(self):
self.loadConfig()
dir = self.getGenerator().binDir
binDir = self.getGenerator().getBinDir('Release')
name = "Synergy"
dist = dir + "/" + name
dist = binDir + "/" + name
# ensure dist dir is clean
if os.path.exists(dist):
shutil.rmtree(dist)
os.makedirs(dist)
shutil.move(dir + "/" + name + ".app", dist + "/" + name + ".app")
shutil.move(binDir + "/" + name + ".app", dist + "/" + name + ".app")
self.try_chdir(dist)
err = os.system("ln -s /Applications")
@@ -1327,7 +1194,7 @@ class InternalCommands:
cmd = "hdiutil create " + fileName + " -srcfolder ./" + name + "/ -ov"
self.try_chdir(dir)
self.try_chdir(binDir)
err = os.system(cmd)
self.restore_chdir()
@@ -1426,12 +1293,8 @@ class InternalCommands:
dest = self.dist_name_rev(type)
print 'Uploading %s to FTP server %s...' % (dest, ftp.host)
srcDir = 'bin/'
generator = self.getGeneratorFromConfig().cmakeName
#if not generator.startswith('Visual Studio'):
# srcDir += 'release/'
ftp.run(srcDir + src, dest)
binDir = self.getGenerator().getBinDir('Release')
ftp.run(binDir + '/' + src, dest)
print 'Done'
def getDebianArch(self):
@@ -1498,8 +1361,9 @@ class InternalCommands:
pattern = re.escape(self.project + '-') + '\d+\.\d+\.\d+' + re.escape('-' + platform + '.' + ext)
# only use release dir if not windows
target = ''
if type == 'mac':
target = 'Release'
for filename in os.listdir(self.getBinDir(target)):
if re.search(pattern, filename):
@@ -1510,8 +1374,8 @@ class InternalCommands:
def dist_name_rev(self, type):
# find the version number (we're puting the rev in after this)
pattern = '(.*\d+\.\d+\.\d+)(.*)'
replace = "\g<1>-%s-%s\g<2>" % (
pattern = '(\d+\.\d+\.\d+)'
replace = "%s-%s" % (
self.getGitBranchName(), self.getGitRevision())
return re.sub(pattern, replace, self.dist_name(type))

View File

@@ -27,14 +27,6 @@ class FtpUploader:
ftp = FTP(self.host, self.user, self.password)
ftp.cwd(self.dir)
# check to see if we should stop here
if not replace:
files = ftp.nlst()
if dest in files:
print 'Already exists, skipping.'
ftp.close()
return
f = open(src, 'rb')
ftp.storbinary('STOR ' + dest, f)

View File

@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Nick Bolton <nick@synergy-project.org>
Version: ${in:version}
Architecture: ${in:arch}
Depends: libc6 (>= 2.11), libstdc++6 (>= 4.4.3), libx11-6 (>= 1.3.2), libxext6 (>= 1.1.1), libxi6 (>= 1.3), libxinerama1 (>= 1.1), libxtst6 (>= 1.1), libqtcore4 (>= 4.6.2), libqtgui4 (>= 4.6.2), libqt4-network (>= 4.6.2), libcurl3 (>= 7.19.7), libavahi-compat-libdnssd1 (>= 0.6.25)
Depends: libc6 (>= 2.11), libstdc++6 (>= 4.4.3), libx11-6 (>= 1.3.2), libxext6 (>= 1.1.1), libxi6 (>= 1.3), libxinerama1 (>= 1.1), libxtst6 (>= 1.1), libqtcore4 (>= 4.6.2), libqtgui4 (>= 4.6.2), libqt4-network (>= 4.6.2), libcurl3 (>= 7.19.7), libavahi-compat-libdnssd1 (>= 0.6.25), openssl (>= 1.0.1)
Installed-Size: 30
Description: Keyboard and mouse sharing utility
Synergy is free and open source software for sharing one mouse and keyboard

65
res/openssl/synergy.conf Normal file
View File

@@ -0,0 +1,65 @@
#
# Synergy OpenSSL configuration file.
# Used for generation of certificate requests.
#
dir = .
[ca]
default_ca = CA_default
[CA_default]
serial = $dir/serial
database = $dir/certindex.txt
new_certs_dir = $dir/certs
certificate = $dir/cacert.pem
private_key = $dir/private/cakey.pem
default_days = 365
default_md = md5
preserve = no
email_in_dn = no
nameopt = default_ca
certopt = default_ca
policy = policy_match
[policy_match]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
[req]
default_bits = 1024 # Size of keys
default_keyfile = key.pem # name of generated keys
default_md = md5 # message digest algorithm
string_mask = nombstr # permitted characters
distinguished_name = req_distinguished_name
req_extensions = v3_req
[req_distinguished_name]
0.organizationName = Organization Name (company)
organizationalUnitName = Organizational Unit Name (department, division)
emailAddress = Email Address
emailAddress_max = 40
localityName = Locality Name (city, district)
stateOrProvinceName = State or Province Name (full name)
countryName = Country Name (2 letter code)
countryName_min = 2
countryName_max = 2
commonName = Common Name (hostname, IP, or your name)
commonName_max = 64
0.organizationName_default = My Company
localityName_default = My Town
stateOrProvinceName_default = State or Providence
countryName_default = US
[v3_ca]
basicConstraints = CA:TRUE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always
[v3_req]
basicConstraints = CA:FALSE
subjectKeyIdentifier = hash

View File

@@ -1,425 +0,0 @@
git rm AUTHORS
git rm Makefile.am
git rm Makefile.win
git rm NEWS
git rm acinclude.m4
git rm cmd/Makefile.am
git rm cmd/launcher/CAddScreen.cpp
git rm cmd/launcher/CAddScreen.h
git rm cmd/launcher/CAdvancedOptions.cpp
git rm cmd/launcher/CAdvancedOptions.h
git rm cmd/launcher/CAutoStart.cpp
git rm cmd/launcher/CAutoStart.h
git rm cmd/launcher/CGlobalOptions.cpp
git rm cmd/launcher/CGlobalOptions.h
git rm cmd/launcher/CHotkeyOptions.cpp
git rm cmd/launcher/CHotkeyOptions.h
git rm cmd/launcher/CInfo.cpp
git rm cmd/launcher/CInfo.h
git rm cmd/launcher/CScreensLinks.cpp
git rm cmd/launcher/CScreensLinks.h
git rm cmd/launcher/LaunchUtil.cpp
git rm cmd/launcher/LaunchUtil.h
git rm cmd/launcher/Makefile.am
git rm cmd/launcher/Makefile.win
git rm cmd/launcher/launcher.cpp
git rm cmd/launcher/launcher.rc
git rm cmd/launcher/resource.h
git rm cmd/launcher/synergy.ico
git rm cmd/synergyc/CClientTaskBarReceiver.cpp
git rm cmd/synergyc/CClientTaskBarReceiver.h
git rm cmd/synergyc/CMSWindowsClientTaskBarReceiver.cpp
git rm cmd/synergyc/CMSWindowsClientTaskBarReceiver.h
git rm cmd/synergyc/COSXClientTaskBarReceiver.cpp
git rm cmd/synergyc/COSXClientTaskBarReceiver.h
git rm cmd/synergyc/CXWindowsClientTaskBarReceiver.cpp
git rm cmd/synergyc/CXWindowsClientTaskBarReceiver.h
git rm cmd/synergyc/Makefile.am
git rm cmd/synergyc/Makefile.win
git rm cmd/synergyc/resource.h
git rm cmd/synergyc/synergyc.cpp
git rm cmd/synergyc/synergyc.ico
git rm cmd/synergyc/synergyc.rc
git rm cmd/synergyc/tb_error.ico
git rm cmd/synergyc/tb_idle.ico
git rm cmd/synergyc/tb_run.ico
git rm cmd/synergyc/tb_wait.ico
git rm cmd/synergys/CMSWindowsServerTaskBarReceiver.cpp
git rm cmd/synergys/CMSWindowsServerTaskBarReceiver.h
git rm cmd/synergys/COSXServerTaskBarReceiver.cpp
git rm cmd/synergys/COSXServerTaskBarReceiver.h
git rm cmd/synergys/CServerTaskBarReceiver.cpp
git rm cmd/synergys/CServerTaskBarReceiver.h
git rm cmd/synergys/CXWindowsServerTaskBarReceiver.cpp
git rm cmd/synergys/CXWindowsServerTaskBarReceiver.h
git rm cmd/synergys/Makefile.am
git rm cmd/synergys/Makefile.win
git rm cmd/synergys/resource.h
git rm cmd/synergys/synergys.cpp
git rm cmd/synergys/synergys.ico
git rm cmd/synergys/synergys.rc
git rm cmd/synergys/tb_error.ico
git rm cmd/synergys/tb_idle.ico
git rm cmd/synergys/tb_run.ico
git rm cmd/synergys/tb_wait.ico
git rm config/config.guess
git rm config/config.sub
git rm config/depcomp
git rm config/install-sh
git rm config/missing
git rm config/mkinstalldirs
git rm configure.in
git rm dist/Makefile.am
git rm dist/nullsoft/Makefile.am
git rm dist/nullsoft/Makefile.win
git rm dist/nullsoft/dosify.c
git rm dist/nullsoft/synergy.nsi
git rm dist/rpm/Makefile.am
git rm dist/rpm/synergy.spec.in
git rm doc/Makefile.am
git rm doc/PORTING
git rm doc/about.html
git rm doc/authors.html
git rm doc/autostart.html
git rm doc/banner.html
git rm doc/border.html
git rm doc/compiling.html
git rm doc/configuration.html
git rm doc/contact.html
git rm doc/developer.html
git rm doc/doxygen.cfg.in
git rm doc/faq.html
git rm doc/history.html
git rm doc/home.html
git rm doc/images/logo.gif
git rm doc/images/warp.gif
git rm doc/index.html
git rm doc/license.html
git rm doc/news.html
git rm doc/roadmap.html
git rm doc/running.html
git rm doc/security.html
git rm doc/synergy.css
git rm doc/tips.html
git rm doc/toc.html
git rm doc/todo.html
git rm doc/trouble.html
git rm examples/synergy.conf
git rm lib/Makefile.am
git rm lib/arch/CArch.cpp
git rm lib/arch/CArch.h
git rm lib/arch/CArchConsoleUnix.cpp
git rm lib/arch/CArchConsoleUnix.h
git rm lib/arch/CArchConsoleWindows.cpp
git rm lib/arch/CArchConsoleWindows.h
git rm lib/arch/CArchDaemonNone.cpp
git rm lib/arch/CArchDaemonNone.h
git rm lib/arch/CArchDaemonUnix.cpp
git rm lib/arch/CArchDaemonUnix.h
git rm lib/arch/CArchDaemonWindows.cpp
git rm lib/arch/CArchDaemonWindows.h
git rm lib/arch/CArchFileUnix.cpp
git rm lib/arch/CArchFileUnix.h
git rm lib/arch/CArchFileWindows.cpp
git rm lib/arch/CArchFileWindows.h
git rm lib/arch/CArchLogUnix.cpp
git rm lib/arch/CArchLogUnix.h
git rm lib/arch/CArchLogWindows.cpp
git rm lib/arch/CArchLogWindows.h
git rm lib/arch/CArchMiscWindows.cpp
git rm lib/arch/CArchMiscWindows.h
git rm lib/arch/CArchMultithreadPosix.cpp
git rm lib/arch/CArchMultithreadPosix.h
git rm lib/arch/CArchMultithreadWindows.cpp
git rm lib/arch/CArchMultithreadWindows.h
git rm lib/arch/CArchNetworkBSD.cpp
git rm lib/arch/CArchNetworkBSD.h
git rm lib/arch/CArchNetworkWinsock.cpp
git rm lib/arch/CArchNetworkWinsock.h
git rm lib/arch/CArchSleepUnix.cpp
git rm lib/arch/CArchSleepUnix.h
git rm lib/arch/CArchSleepWindows.cpp
git rm lib/arch/CArchSleepWindows.h
git rm lib/arch/CArchStringUnix.cpp
git rm lib/arch/CArchStringUnix.h
git rm lib/arch/CArchStringWindows.cpp
git rm lib/arch/CArchStringWindows.h
git rm lib/arch/CArchSystemUnix.cpp
git rm lib/arch/CArchSystemUnix.h
git rm lib/arch/CArchSystemWindows.cpp
git rm lib/arch/CArchSystemWindows.h
git rm lib/arch/CArchTaskBarWindows.cpp
git rm lib/arch/CArchTaskBarWindows.h
git rm lib/arch/CArchTaskBarXWindows.cpp
git rm lib/arch/CArchTaskBarXWindows.h
git rm lib/arch/CArchTimeUnix.cpp
git rm lib/arch/CArchTimeUnix.h
git rm lib/arch/CArchTimeWindows.cpp
git rm lib/arch/CArchTimeWindows.h
git rm lib/arch/CMultibyte.cpp
git rm lib/arch/IArchConsole.h
git rm lib/arch/IArchDaemon.h
git rm lib/arch/IArchFile.h
git rm lib/arch/IArchLog.h
git rm lib/arch/IArchMultithread.h
git rm lib/arch/IArchNetwork.h
git rm lib/arch/IArchSleep.h
git rm lib/arch/IArchString.h
git rm lib/arch/IArchSystem.h
git rm lib/arch/IArchTaskBar.h
git rm lib/arch/IArchTaskBarReceiver.h
git rm lib/arch/IArchTime.h
git rm lib/arch/Makefile.am
git rm lib/arch/Makefile.win
git rm lib/arch/XArch.cpp
git rm lib/arch/XArch.h
git rm lib/arch/XArchUnix.cpp
git rm lib/arch/XArchUnix.h
git rm lib/arch/XArchWindows.cpp
git rm lib/arch/XArchWindows.h
git rm lib/arch/vsnprintf.cpp
git rm lib/base/CEvent.cpp
git rm lib/base/CEvent.h
git rm lib/base/CEventQueue.cpp
git rm lib/base/CEventQueue.h
git rm lib/base/CFunctionEventJob.cpp
git rm lib/base/CFunctionEventJob.h
git rm lib/base/CFunctionJob.cpp
git rm lib/base/CFunctionJob.h
git rm lib/base/CLog.cpp
git rm lib/base/CLog.h
git rm lib/base/CPriorityQueue.h
git rm lib/base/CSimpleEventQueueBuffer.cpp
git rm lib/base/CSimpleEventQueueBuffer.h
git rm lib/base/CStopwatch.cpp
git rm lib/base/CStopwatch.h
git rm lib/base/CString.h
git rm lib/base/CStringUtil.cpp
git rm lib/base/CStringUtil.h
git rm lib/base/CUnicode.cpp
git rm lib/base/CUnicode.h
git rm lib/base/IEventJob.h
git rm lib/base/IEventQueue.cpp
git rm lib/base/IEventQueue.h
git rm lib/base/IEventQueueBuffer.h
git rm lib/base/IJob.h
git rm lib/base/ILogOutputter.h
git rm lib/base/LogOutputters.cpp
git rm lib/base/LogOutputters.h
git rm lib/base/Makefile.am
git rm lib/base/Makefile.win
git rm lib/base/TMethodEventJob.h
git rm lib/base/TMethodJob.h
git rm lib/base/XBase.cpp
git rm lib/base/XBase.h
git rm lib/client/CClient.cpp
git rm lib/client/CClient.h
git rm lib/client/CServerProxy.cpp
git rm lib/client/CServerProxy.h
git rm lib/client/Makefile.am
git rm lib/client/Makefile.win
git rm lib/common/BasicTypes.h
git rm lib/common/IInterface.h
git rm lib/common/MacOSXPrecomp.h
git rm lib/common/Makefile.am
git rm lib/common/Makefile.win
git rm lib/common/Version.cpp
git rm lib/common/Version.h
git rm lib/common/common.h
git rm lib/common/stdbitset.h
git rm lib/common/stddeque.h
git rm lib/common/stdfstream.h
git rm lib/common/stdistream.h
git rm lib/common/stdlist.h
git rm lib/common/stdmap.h
git rm lib/common/stdostream.h
git rm lib/common/stdpost.h
git rm lib/common/stdpre.h
git rm lib/common/stdset.h
git rm lib/common/stdsstream.h
git rm lib/common/stdstring.h
git rm lib/common/stdvector.h
git rm lib/io/CStreamBuffer.cpp
git rm lib/io/CStreamBuffer.h
git rm lib/io/CStreamFilter.cpp
git rm lib/io/CStreamFilter.h
git rm lib/io/IStream.cpp
git rm lib/io/IStream.h
git rm lib/io/IStreamFilterFactory.h
git rm lib/io/Makefile.am
git rm lib/io/Makefile.win
git rm lib/io/XIO.cpp
git rm lib/io/XIO.h
git rm lib/mt/CCondVar.cpp
git rm lib/mt/CCondVar.h
git rm lib/mt/CLock.cpp
git rm lib/mt/CLock.h
git rm lib/mt/CMutex.cpp
git rm lib/mt/CMutex.h
git rm lib/mt/CThread.cpp
git rm lib/mt/CThread.h
git rm lib/mt/Makefile.am
git rm lib/mt/Makefile.win
git rm lib/mt/XMT.cpp
git rm lib/mt/XMT.h
git rm lib/mt/XThread.h
git rm lib/net/CNetworkAddress.cpp
git rm lib/net/CNetworkAddress.h
git rm lib/net/CSocketMultiplexer.cpp
git rm lib/net/CSocketMultiplexer.h
git rm lib/net/CTCPListenSocket.cpp
git rm lib/net/CTCPListenSocket.h
git rm lib/net/CTCPSocket.cpp
git rm lib/net/CTCPSocket.h
git rm lib/net/CTCPSocketFactory.cpp
git rm lib/net/CTCPSocketFactory.h
git rm lib/net/IDataSocket.cpp
git rm lib/net/IDataSocket.h
git rm lib/net/IListenSocket.cpp
git rm lib/net/IListenSocket.h
git rm lib/net/ISocket.cpp
git rm lib/net/ISocket.h
git rm lib/net/ISocketFactory.h
git rm lib/net/ISocketMultiplexerJob.h
git rm lib/net/Makefile.am
git rm lib/net/Makefile.win
git rm lib/net/TSocketMultiplexerMethodJob.h
git rm lib/net/XSocket.cpp
git rm lib/net/XSocket.h
git rm lib/platform/CMSWindowsClipboard.cpp
git rm lib/platform/CMSWindowsClipboard.h
git rm lib/platform/CMSWindowsClipboardAnyTextConverter.cpp
git rm lib/platform/CMSWindowsClipboardAnyTextConverter.h
git rm lib/platform/CMSWindowsClipboardBitmapConverter.cpp
git rm lib/platform/CMSWindowsClipboardBitmapConverter.h
git rm lib/platform/CMSWindowsClipboardHTMLConverter.cpp
git rm lib/platform/CMSWindowsClipboardHTMLConverter.h
git rm lib/platform/CMSWindowsClipboardTextConverter.cpp
git rm lib/platform/CMSWindowsClipboardTextConverter.h
git rm lib/platform/CMSWindowsClipboardUTF16Converter.cpp
git rm lib/platform/CMSWindowsClipboardUTF16Converter.h
git rm lib/platform/CMSWindowsDesks.cpp
git rm lib/platform/CMSWindowsDesks.h
git rm lib/platform/CMSWindowsEventQueueBuffer.cpp
git rm lib/platform/CMSWindowsEventQueueBuffer.h
git rm lib/platform/CMSWindowsKeyState.cpp
git rm lib/platform/CMSWindowsKeyState.h
git rm lib/platform/CMSWindowsScreen.cpp
git rm lib/platform/CMSWindowsScreen.h
git rm lib/platform/CMSWindowsScreenSaver.cpp
git rm lib/platform/CMSWindowsScreenSaver.h
git rm lib/platform/CMSWindowsUtil.cpp
git rm lib/platform/CMSWindowsUtil.h
git rm lib/platform/COSXClipboard.cpp
git rm lib/platform/COSXClipboard.h
git rm lib/platform/COSXClipboardAnyTextConverter.cpp
git rm lib/platform/COSXClipboardAnyTextConverter.h
git rm lib/platform/COSXClipboardTextConverter.cpp
git rm lib/platform/COSXClipboardTextConverter.h
git rm lib/platform/COSXClipboardUTF16Converter.cpp
git rm lib/platform/COSXClipboardUTF16Converter.h
git rm lib/platform/COSXEventQueueBuffer.cpp
git rm lib/platform/COSXEventQueueBuffer.h
git rm lib/platform/COSXKeyState.cpp
git rm lib/platform/COSXKeyState.h
git rm lib/platform/COSXScreen.cpp
git rm lib/platform/COSXScreen.h
git rm lib/platform/COSXScreenSaver.cpp
git rm lib/platform/COSXScreenSaver.h
git rm lib/platform/COSXScreenSaverUtil.h
git rm lib/platform/COSXScreenSaverUtil.m
git rm lib/platform/CSynergyHook.cpp
git rm lib/platform/CSynergyHook.h
git rm lib/platform/CXWindowsClipboard.cpp
git rm lib/platform/CXWindowsClipboard.h
git rm lib/platform/CXWindowsClipboardAnyBitmapConverter.cpp
git rm lib/platform/CXWindowsClipboardAnyBitmapConverter.h
git rm lib/platform/CXWindowsClipboardBMPConverter.cpp
git rm lib/platform/CXWindowsClipboardBMPConverter.h
git rm lib/platform/CXWindowsClipboardHTMLConverter.cpp
git rm lib/platform/CXWindowsClipboardHTMLConverter.h
git rm lib/platform/CXWindowsClipboardTextConverter.cpp
git rm lib/platform/CXWindowsClipboardTextConverter.h
git rm lib/platform/CXWindowsClipboardUCS2Converter.cpp
git rm lib/platform/CXWindowsClipboardUCS2Converter.h
git rm lib/platform/CXWindowsClipboardUTF8Converter.cpp
git rm lib/platform/CXWindowsClipboardUTF8Converter.h
git rm lib/platform/CXWindowsEventQueueBuffer.cpp
git rm lib/platform/CXWindowsEventQueueBuffer.h
git rm lib/platform/CXWindowsKeyState.cpp
git rm lib/platform/CXWindowsKeyState.h
git rm lib/platform/CXWindowsScreen.cpp
git rm lib/platform/CXWindowsScreen.h
git rm lib/platform/CXWindowsScreenSaver.cpp
git rm lib/platform/CXWindowsScreenSaver.h
git rm lib/platform/CXWindowsUtil.cpp
git rm lib/platform/CXWindowsUtil.h
git rm lib/platform/Makefile.am
git rm lib/platform/Makefile.win
git rm lib/platform/OSXScreenSaverControl.h
git rm lib/server/CBaseClientProxy.cpp
git rm lib/server/CBaseClientProxy.h
git rm lib/server/CClientListener.cpp
git rm lib/server/CClientListener.h
git rm lib/server/CClientProxy.cpp
git rm lib/server/CClientProxy.h
git rm lib/server/CClientProxy1_0.cpp
git rm lib/server/CClientProxy1_0.h
git rm lib/server/CClientProxy1_1.cpp
git rm lib/server/CClientProxy1_1.h
git rm lib/server/CClientProxy1_2.cpp
git rm lib/server/CClientProxy1_2.h
git rm lib/server/CClientProxy1_3.cpp
git rm lib/server/CClientProxy1_3.h
git rm lib/server/CClientProxyUnknown.cpp
git rm lib/server/CClientProxyUnknown.h
git rm lib/server/CConfig.cpp
git rm lib/server/CConfig.h
git rm lib/server/CInputFilter.cpp
git rm lib/server/CInputFilter.h
git rm lib/server/CPrimaryClient.cpp
git rm lib/server/CPrimaryClient.h
git rm lib/server/CServer.cpp
git rm lib/server/CServer.h
git rm lib/server/Makefile.am
git rm lib/server/Makefile.win
git rm lib/synergy/CClipboard.cpp
git rm lib/synergy/CClipboard.h
git rm lib/synergy/CKeyMap.cpp
git rm lib/synergy/CKeyMap.h
git rm lib/synergy/CKeyState.cpp
git rm lib/synergy/CKeyState.h
git rm lib/synergy/CPacketStreamFilter.cpp
git rm lib/synergy/CPacketStreamFilter.h
git rm lib/synergy/CPlatformScreen.cpp
git rm lib/synergy/CPlatformScreen.h
git rm lib/synergy/CProtocolUtil.cpp
git rm lib/synergy/CProtocolUtil.h
git rm lib/synergy/CScreen.cpp
git rm lib/synergy/CScreen.h
git rm lib/synergy/ClipboardTypes.h
git rm lib/synergy/IClient.h
git rm lib/synergy/IClipboard.cpp
git rm lib/synergy/IClipboard.h
git rm lib/synergy/IKeyState.cpp
git rm lib/synergy/IKeyState.h
git rm lib/synergy/IPlatformScreen.h
git rm lib/synergy/IPrimaryScreen.cpp
git rm lib/synergy/IPrimaryScreen.h
git rm lib/synergy/IScreen.cpp
git rm lib/synergy/IScreen.h
git rm lib/synergy/IScreenSaver.h
git rm lib/synergy/ISecondaryScreen.h
git rm lib/synergy/KeyTypes.cpp
git rm lib/synergy/KeyTypes.h
git rm lib/synergy/Makefile.am
git rm lib/synergy/Makefile.win
git rm lib/synergy/MouseTypes.h
git rm lib/synergy/OptionTypes.h
git rm lib/synergy/ProtocolTypes.cpp
git rm lib/synergy/ProtocolTypes.h
git rm lib/synergy/XScreen.cpp
git rm lib/synergy/XScreen.h
git rm lib/synergy/XSynergy.cpp
git rm lib/synergy/XSynergy.h
git rm win32util/autodep.cpp

View File

@@ -16,7 +16,6 @@
add_subdirectory(lib)
add_subdirectory(cmd)
add_subdirectory(plugin)
add_subdirectory(micro)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "IRIX")

View File

@@ -23,9 +23,3 @@ add_subdirectory(syntool)
if (WIN32)
add_subdirectory(synergyp)
endif()
if (APPLE)
if (OSX_TARGET_MINOR GREATER 8)
add_subdirectory(synmacph)
endif()
endif()

View File

@@ -58,7 +58,7 @@ endif()
add_executable(synergyc ${sources})
target_link_libraries(synergyc
arch base client common io mt net ipc platform server synergy cryptopp ${libs})
arch base client common io mt net ipc platform server synergy ${libs})
if (CONF_CPACK)
install(TARGETS

View File

@@ -35,7 +35,7 @@ else()
endif()
target_link_libraries(synergyd
arch base common io ipc mt net platform synergy cryptopp ${libs})
arch base common io ipc mt net platform synergy ${libs})
if (CONF_CPACK)
install(TARGETS

View File

@@ -63,7 +63,7 @@ else()
endif()
target_link_libraries(synergyp
arch base client common io mt net ipc platform server synergy client cryptopp ${libs})
arch base client common io mt net ipc platform server synergy client ${libs})
if (CONF_CPACK)
install(TARGETS

View File

@@ -58,7 +58,7 @@ endif()
add_executable(synergys ${sources})
target_link_libraries(synergys
arch base client common io mt net ipc platform server synergy cryptopp ${libs})
arch base client common io mt net ipc platform server synergy ${libs})
if (CONF_CPACK)
install(TARGETS

View File

@@ -1,39 +0,0 @@
# synergy -- mouse and keyboard sharing utility
# Copyright (C) 2014 Synergy Si Ltd.
#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file COPYING that should have accompanied this file.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
file(GLOB sources "*.c" "*.plist")
include_directories(
../
)
add_executable(synmacph ${sources})
get_target_property(current_property synmacph LINK_FLAGS)
set(OTHER_LINK_FLAGS "-sectcreate __TEXT __info_plist ${root_dir}/src/cmd/synmacph/Info.plist -sectcreate __TEXT __launchd_plist ${root_dir}/src/cmd/synmacph/Launchd.plist")
if (NOT ${current_property})
set_target_properties(synmacph PROPERTIES LINK_FLAGS ${OTHER_LINK_FLAGS})
endif()
target_link_libraries(synmacph)
if (CONF_CPACK)
install(TARGETS
synmacph
COMPONENT core
DESTINATION bin)
endif()

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>synmacph</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>synmacph</string>
<key>CFBundleVersion</key>
<string>1.5</string>
<key>SMAuthorizedClients</key>
<array>
<string>anchor apple generic and identifier &quot;synergy&quot; and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = SP58PFWX5L)</string>
</array>
</dict>
</plist>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>synmacph</string>
<key>MachServices</key>
<dict>
<key>synmacph</key>
<true/>
</dict></dict>
</plist>

View File

@@ -1,99 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <syslog.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <xpc/xpc.h>
const char* const label = "synmacph";
static void xpcEventHandler(xpc_connection_t connection, xpc_object_t event);
static void xpcConnectionHandler(xpc_connection_t connection);
static void xpcEventHandler(xpc_connection_t connection, xpc_object_t event)
{
syslog(LOG_NOTICE, "received event in helper");
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR) {
if (event == XPC_ERROR_CONNECTION_INVALID) {
// the client process on the other end of the connection has either
// crashed or cancelled the connection. After receiving this error,
// the connection is in an invalid state, and you do not need to
// call xpc_connection_cancel(). Just tear down any associated state
// here.
}
else if (event == XPC_ERROR_TERMINATION_IMMINENT) {
// handle per-connection termination cleanup.
}
}
else {
xpc_connection_t remote = xpc_dictionary_get_remote_connection(event);
const char* command = xpc_dictionary_get_string(event, "request");
syslog(LOG_NOTICE, "received command in helper: %s", command);
system(command);
xpc_object_t reply = xpc_dictionary_create_reply(event);
xpc_dictionary_set_string(reply, "reply", "command has been executed");
xpc_connection_send_message(remote, reply);
xpc_release(reply);
}
}
static void xpcConnectionHandler(xpc_connection_t connection)
{
syslog(LOG_NOTICE, "configuring message event handler for helper");
xpc_connection_set_event_handler(connection, ^(xpc_object_t event) {
xpcEventHandler(connection, event);
});
xpc_connection_resume(connection);
}
int main(int argc, const char * argv[])
{
#pragma unused(argc)
#pragma unused(argv)
xpc_connection_t service = xpc_connection_create_mach_service(
label,
dispatch_get_main_queue(),
XPC_CONNECTION_MACH_SERVICE_LISTENER);
if (!service) {
syslog(LOG_NOTICE, "failed to create service");
exit(EXIT_FAILURE);
}
syslog(LOG_NOTICE, "configuring connection event handler for helper");
xpc_connection_set_event_handler(service, ^(xpc_object_t connection) {
xpcConnectionHandler(connection);
});
xpc_connection_resume(service);
dispatch_main();
xpc_release(service);
return EXIT_SUCCESS;
}

View File

@@ -29,7 +29,7 @@ endif()
add_executable(syntool ${sources})
target_link_libraries(syntool
synergy arch base client common io ipc mt net platform server cryptopp ${libs})
synergy arch base client common io ipc mt net platform server ${libs})
if (CONF_CPACK)
install(TARGETS

View File

@@ -14,7 +14,8 @@ FORMS += res/MainWindowBase.ui \
res/HotkeyDialogBase.ui \
res/SettingsDialogBase.ui \
res/SetupWizardBase.ui \
res/AddClientDialogBase.ui
res/AddClientDialogBase.ui \
res/PluginWizardPageBase.ui
SOURCES += src/main.cpp \
src/MainWindow.cpp \
src/AboutDialog.cpp \
@@ -50,7 +51,13 @@ SOURCES += src/main.cpp \
src/ZeroconfService.cpp \
src/DataDownloader.cpp \
src/AddClientDialog.cpp \
src/CommandProcess.cpp
src/CommandProcess.cpp \
src/WebClient.cpp \
src/PluginWizardPage.cpp \
src/PluginManager.cpp \
src/CoreInterface.cpp \
src/Fingerprint.cpp \
src/SslCertificate.cpp
HEADERS += src/MainWindow.h \
src/AboutDialog.h \
src/ServerConfig.h \
@@ -86,12 +93,18 @@ HEADERS += src/MainWindow.h \
src/ZeroconfService.h \
src/DataDownloader.h \
src/AddClientDialog.h \
src/CommandProcess.h
src/CommandProcess.h \
src/WebClient.h \
src/EditionType.h \
src/PluginWizardPage.h \
src/ProcessorArch.h \
src/PluginManager.h \
src/CoreInterface.h \
src/Fingerprint.h \
src/SslCertificate.h
RESOURCES += res/Synergy.qrc
RC_FILE = res/win/Synergy.rc
macx {
HEADERS += src/AXDatabaseCleaner.h
OBJECTIVE_SOURCES += src/AXDatabaseCleaner.mm
QMAKE_INFO_PLIST = res/mac/Info.plist
TARGET = Synergy
QSYNERGY_ICON.files = res/mac/Synergy.icns

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<ui version="4.0">
<class>MainWindowBase</class>
<widget class="QMainWindow" name="MainWindowBase">
@@ -87,7 +87,7 @@
</sizepolicy>
</property>
<property name="title">
<string>&amp;Server (share this computer's mouse and keyboard):</string>
<string>Ser&amp;ver (share this computer's mouse and keyboard):</string>
</property>
<property name="checkable">
<bool>true</bool>
@@ -117,6 +117,30 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="m_pLabelFingerprint">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Fingerprint:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelLocalFingerprint">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioInternalConfig">
<property name="text">
@@ -128,7 +152,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="m_pButtonConfigureServer">
<property name="text">
@@ -307,6 +331,19 @@
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="m_pLabelPadlock">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="Synergy.qrc">:/res/icons/16x16/padlock.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pStatusLabel">
<property name="text">

View File

@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluginWizardPage</class>
<widget class="QWizardPage" name="PluginWizardPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Setup Synergy</string>
</property>
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelSpinning">
<property name="text">
<string> </string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelStatus">
<property name="text">
<string>Please wait...</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -1,353 +1,339 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialogBase</class>
<widget class="QDialog" name="SettingsDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>368</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="m_pGroupAdvanced">
<property name="title">
<string>&amp;Miscellaneous</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_19">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Sc&amp;reen name:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditScreenName</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditScreenName">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_pLabel_20">
<property name="text">
<string>P&amp;ort:</string>
</property>
<property name="buddy">
<cstring>m_pSpinBoxPort</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="m_pSpinBoxPort">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>24800</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="m_pLabel_21">
<property name="text">
<string>&amp;Interface:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="m_pLineEditInterface">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="m_pLabel_27">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&amp;Language:</string>
</property>
<property name="buddy">
<cstring>m_pComboLanguage</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_pComboLanguage"/>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxElevateMode">
<property name="text">
<string>Elevate mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupCrypto">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>&amp;Encryption</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_23">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Pass&amp;word:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditCryptoPass</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditCryptoPass">
<property name="enabled">
<bool>false</bool>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupLog">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Logging</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="m_pLabel_3">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&amp;Logging level:</string>
</property>
<property name="buddy">
<cstring>m_pComboLogLevel</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="m_pComboLogLevel">
<item>
<property name="text">
<string>Error</string>
</property>
</item>
<item>
<property name="text">
<string>Warning</string>
</property>
</item>
<item>
<property name="text">
<string>Note</string>
</property>
</item>
<item>
<property name="text">
<string>Info</string>
</property>
</item>
<item>
<property name="text">
<string>Debug</string>
</property>
</item>
<item>
<property name="text">
<string>Debug1</string>
</property>
</item>
<item>
<property name="text">
<string>Debug2</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxLogToFile">
<property name="text">
<string>Log to file:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditLogFilename">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="m_pButtonBrowseLog">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_pComboLanguage</tabstop>
<tabstop>m_pLineEditScreenName</tabstop>
<tabstop>m_pSpinBoxPort</tabstop>
<tabstop>m_pLineEditInterface</tabstop>
<tabstop>m_pLineEditCryptoPass</tabstop>
<tabstop>m_pComboLogLevel</tabstop>
<tabstop>m_pCheckBoxLogToFile</tabstop>
<tabstop>m_pLineEditLogFilename</tabstop>
<tabstop>m_pButtonBrowseLog</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>266</x>
<y>340</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>334</x>
<y>340</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialogBase</class>
<widget class="QDialog" name="SettingsDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>368</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="m_pGroupAdvanced">
<property name="title">
<string>&amp;Miscellaneous</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_19">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Sc&amp;reen name:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditScreenName</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditScreenName">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_pLabel_20">
<property name="text">
<string>P&amp;ort:</string>
</property>
<property name="buddy">
<cstring>m_pSpinBoxPort</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="m_pSpinBoxPort">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>24800</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="m_pLabel_21">
<property name="text">
<string>&amp;Interface:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="m_pLineEditInterface">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="m_pLabel_27">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&amp;Language:</string>
</property>
<property name="buddy">
<cstring>m_pComboLanguage</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_pComboLanguage"/>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxElevateMode">
<property name="text">
<string>Elevate mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupNetworkSecurity">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>&amp;Network Security</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="m_pCheckBoxEnableCrypto">
<property name="text">
<string>Use &amp;SSL encryption (unique certificate)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="m_pGroupLog">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Logging</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="m_pLabel_3">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&amp;Logging level:</string>
</property>
<property name="buddy">
<cstring>m_pComboLogLevel</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="m_pComboLogLevel">
<item>
<property name="text">
<string>Error</string>
</property>
</item>
<item>
<property name="text">
<string>Warning</string>
</property>
</item>
<item>
<property name="text">
<string>Note</string>
</property>
</item>
<item>
<property name="text">
<string>Info</string>
</property>
</item>
<item>
<property name="text">
<string>Debug</string>
</property>
</item>
<item>
<property name="text">
<string>Debug1</string>
</property>
</item>
<item>
<property name="text">
<string>Debug2</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_pCheckBoxLogToFile">
<property name="text">
<string>Log to file:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditLogFilename">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="m_pButtonBrowseLog">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_pComboLanguage</tabstop>
<tabstop>m_pLineEditScreenName</tabstop>
<tabstop>m_pSpinBoxPort</tabstop>
<tabstop>m_pLineEditInterface</tabstop>
<tabstop>m_pComboLogLevel</tabstop>
<tabstop>m_pCheckBoxLogToFile</tabstop>
<tabstop>m_pLineEditLogFilename</tabstop>
<tabstop>m_pButtonBrowseLog</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>266</x>
<y>340</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>334</x>
<y>340</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -120,6 +120,137 @@
</item>
</layout>
</widget>
<widget class="QWizardPage" name="m_pActivatePage">
<property name="title">
<string>Activate</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="m_pRadioButtonActivate">
<property name="text">
<string>&amp;Activate now...</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>20</number>
</property>
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="m_pLabelEmail">
<property name="text">
<string>Email:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="m_pLineEditEmail">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_pLineEditPassword">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;a href=&quot;https://synergy-project.org/account/reset/&quot;&gt;Forgot password&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="m_pRadioButtonSkip">
<property name="text">
<string>&amp;Skip activation</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>500</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="m_pNodePage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">

View File

@@ -51,5 +51,7 @@
<file>lang/gui_zh-TW.qm</file>
<file>lang/Languages.xml</file>
<file>icons/16x16/money.png</file>
<file>image/spinning-wheel.gif</file>
<file>icons/16x16/padlock.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -16,10 +16,5 @@
<string>Synergy</string>
<key>CFBundleIdentifier</key>
<string>synergy</string>
<key>SMPrivilegedExecutables</key>
<dict>
<key>synmacph</key>
<string>anchor apple generic and identifier &quot;synmacph&quot; and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = SP58PFWX5L)</string>
</dict>
</dict>
</plist>

View File

@@ -1,166 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import "AXDatabaseCleaner.h"
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
#import <Cocoa/Cocoa.h>
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
#import <ServiceManagement/ServiceManagement.h>
#endif
#import <Security/Authorization.h>
#import <QMessageBox>
#import <QTime>
const NSString* const label = @"synmacph";
class AXDatabaseCleaner::Private {
public:
NSAutoreleasePool* autoReleasePool;
AuthorizationRef authRef;
xpc_connection_t xpcConnection;
};
AXDatabaseCleaner::AXDatabaseCleaner()
{
m_private = new Private;
m_private->autoReleasePool = [[NSAutoreleasePool alloc] init];
m_waitForResponse = false;
}
AXDatabaseCleaner::~AXDatabaseCleaner()
{
[m_private->autoReleasePool release];
delete m_private;
}
bool AXDatabaseCleaner::loadPrivilegeHelper()
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 // mavericks
OSStatus status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &m_private->authRef);
if (status != errAuthorizationSuccess) {
assert(NO);
m_private->authRef = NULL;
}
AuthorizationItem authItem = {kSMRightBlessPrivilegedHelper, 0, NULL, 0};
AuthorizationRights authRights = {1, &authItem};
AuthorizationFlags flags = kAuthorizationFlagDefaults
| kAuthorizationFlagInteractionAllowed
| kAuthorizationFlagPreAuthorize
| kAuthorizationFlagExtendRights;
BOOL result = NO;
NSError* error = nil;
status = AuthorizationCopyRights(m_private->authRef, &authRights, kAuthorizationEmptyEnvironment, flags, NULL);
if (status != errAuthorizationSuccess) {
error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
}
else {
CFErrorRef cfError;
result = (BOOL)SMJobBless(kSMDomainSystemLaunchd, (CFStringRef)label, m_private->authRef, &cfError);
if (!result) {
error = CFBridgingRelease(cfError);
}
}
if (!result) {
assert(error != nil);
NSLog(@"bless error: domain= %@ / code= %d", [error domain], (int) [error code]);
return false;
}
return true;
}
bool AXDatabaseCleaner::xpcConnect()
{
const char *cStr = [label cStringUsingEncoding:NSASCIIStringEncoding];
m_private->xpcConnection = xpc_connection_create_mach_service(
cStr,
NULL,
XPC_CONNECTION_MACH_SERVICE_PRIVILEGED);
if (!m_private->xpcConnection) {
NSLog(@"failed to create xpc connection");
return false;
}
xpc_connection_set_event_handler(m_private->xpcConnection, ^(xpc_object_t event) {
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR) {
if (event == XPC_ERROR_CONNECTION_INTERRUPTED) {
NSLog(@"xpc connection interupted");
}
else if (event == XPC_ERROR_CONNECTION_INVALID) {
NSLog(@"xpc connection invalid, releasing");
xpc_release(m_private->xpcConnection);
}
else {
NSLog(@"unexpected xpc connection error");
}
}
else {
NSLog(@"unexpected xpc connection event");
}
});
xpc_connection_resume(m_private->xpcConnection);
return true;
}
bool AXDatabaseCleaner::privilegeCommand(const char* command)
{
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_string(message, "request", command);
m_waitForResponse = true;
xpc_connection_send_message_with_reply(
m_private->xpcConnection,
message,
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),
^(xpc_object_t event) {
const char* response = xpc_dictionary_get_string(event, "reply");
NSLog(@"reply from helper tool: %s", response);
m_waitForResponse = false;
});
QTime time = QTime::currentTime();
time.start();
while (m_waitForResponse) {
sleep(1);
if (time.elapsed() > 10000) {
QMessageBox::critical(NULL, "Synergy",
QObject::tr("No response from helper tool.Restart Synergy may solve this problem."));
return false;
}
}
#endif
return true;
}
#endif

View File

@@ -17,6 +17,7 @@
*/
#include "AppConfig.h"
#include "EditionType.h"
#include "QUtility.h"
#include <QtCore>
@@ -52,11 +53,11 @@ AppConfig::AppConfig(QSettings* settings) :
m_Interface(),
m_LogLevel(0),
m_WizardLastRun(0),
m_CryptoPass(),
m_ProcessMode(DEFAULT_PROCESS_MODE),
m_AutoConfig(true),
m_ElevateMode(false),
m_AutoConfigPrompted(false)
m_AutoConfigPrompted(false),
m_CryptoEnabled(false)
{
Q_ASSERT(m_pSettings);
@@ -120,13 +121,15 @@ void AppConfig::loadSettings()
m_LogToFile = settings().value("logToFile", false).toBool();
m_LogFilename = settings().value("logFilename", synergyLogDir() + "synergy.log").toString();
m_WizardLastRun = settings().value("wizardLastRun", 0).toInt();
m_CryptoPass = settings().value("cryptoPass", "").toString();
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
m_Language = settings().value("language", QLocale::system().name()).toString();
m_StartedBefore = settings().value("startedBefore", false).toBool();
m_AutoConfig = settings().value("autoConfig", true).toBool();
m_ElevateMode = settings().value("elevateMode", false).toBool();
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
m_Edition = settings().value("edition", Unknown).toInt();
m_ActivateEmail = settings().value("activateEmail", "").toString();
m_UserToken = settings().value("userToken", "").toString();
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
}
void AppConfig::saveSettings()
@@ -138,29 +141,15 @@ void AppConfig::saveSettings()
settings().setValue("logToFile", m_LogToFile);
settings().setValue("logFilename", m_LogFilename);
settings().setValue("wizardLastRun", kWizardVersion);
settings().setValue("cryptoPass", m_CryptoPass);
settings().setValue("cryptoEnabled", m_CryptoEnabled);
settings().setValue("language", m_Language);
settings().setValue("startedBefore", m_StartedBefore);
settings().setValue("autoConfig", m_AutoConfig);
settings().setValue("elevateMode", m_ElevateMode);
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
}
void AppConfig::setCryptoPass(const QString &s)
{
// clear field to user doesn't get confused.
if (s.isEmpty())
{
m_CryptoPass.clear();
return;
}
// only hash if password changes -- don't re-hash the hash.
if (m_CryptoPass != s)
{
m_CryptoPass = hash(s);
}
settings().setValue("edition", m_Edition);
settings().setValue("activateEmail", m_ActivateEmail);
settings().setValue("userToken", m_UserToken);
settings().setValue("cryptoEnabled", m_CryptoEnabled);
}
void AppConfig::setAutoConfig(bool autoConfig)

View File

@@ -32,7 +32,7 @@
// 2: added language page
// 3: added premium page and removed
//
const int kWizardVersion = 3;
const int kWizardVersion = 4;
class QSettings;
class SettingsDialog;
@@ -61,9 +61,6 @@ class AppConfig
const QString& logFilename() const { return m_LogFilename; }
const QString logFilenameCmd() const;
QString logLevelText() const;
const QString& cryptoPass() const { return m_CryptoPass; }
bool cryptoEnabled() const { return m_CryptoEnabled; }
QString cryptoModeString() const;
ProcessMode processMode() const { return m_ProcessMode; }
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
const QString& language() const { return m_Language; }
@@ -72,6 +69,12 @@ class AppConfig
void setAutoConfig(bool autoConfig);
bool autoConfigPrompted() { return m_AutoConfigPrompted; }
void setAutoConfigPrompted(bool prompted);
void setEdition(int e) { m_Edition = e; }
int edition() { return m_Edition; }
void setActivateEmail(QString e) { m_ActivateEmail = e; }
QString activateEmail() { return m_ActivateEmail; }
void setUserToken(QString t) { m_UserToken = t; }
QString userToken() { return m_UserToken; }
QString synergysName() const { return m_SynergysName; }
QString synergycName() const { return m_SynergycName; }
@@ -82,6 +85,9 @@ class AppConfig
void persistLogDir();
bool elevateMode();
void setCryptoEnabled(bool e) { m_CryptoEnabled = e; }
bool getCryptoEnabled() { return m_CryptoEnabled; }
protected:
QSettings& settings() { return *m_pSettings; }
void setScreenName(const QString& s) { m_ScreenName = s; }
@@ -90,7 +96,6 @@ class AppConfig
void setLogLevel(int i) { m_LogLevel = i; }
void setLogToFile(bool b) { m_LogToFile = b; }
void setLogFilename(const QString& s) { m_LogFilename = s; }
void setCryptoEnabled(bool b) { m_CryptoEnabled = b; }
void setWizardHasRun() { m_WizardLastRun = kWizardVersion; }
void setLanguage(const QString language) { m_Language = language; }
void setStartedBefore(bool b) { m_StartedBefore = b; }
@@ -99,8 +104,6 @@ class AppConfig
void loadSettings();
void saveSettings();
void setCryptoPass(const QString& s);
private:
QSettings* m_pSettings;
QString m_ScreenName;
@@ -110,14 +113,16 @@ class AppConfig
bool m_LogToFile;
QString m_LogFilename;
int m_WizardLastRun;
bool m_CryptoEnabled;
QString m_CryptoPass;
ProcessMode m_ProcessMode;
QString m_Language;
bool m_StartedBefore;
bool m_AutoConfig;
bool m_ElevateMode;
bool m_AutoConfigPrompted;
int m_Edition;
QString m_ActivateEmail;
QString m_UserToken;
bool m_CryptoEnabled;
static const char m_SynergysName[];
static const char m_SynergycName[];

View File

@@ -0,0 +1,83 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CoreInterface.h"
#include <QCoreApplication>
#include <QProcess>
#include <stdexcept>
static const char kCoreBinary[] = "syntool";
CoreInterface::CoreInterface()
{
}
QString CoreInterface::getPluginDir()
{
QStringList args("--get-plugin-dir");
return run(args);
}
QString CoreInterface::getProfileDir()
{
QStringList args("--get-profile-dir");
return run(args);
}
QString CoreInterface::getArch()
{
QStringList args("--get-arch");
return run(args);
}
QString CoreInterface::run(const QStringList& args, const QString& input)
{
QString program(
QCoreApplication::applicationDirPath()
+ "/" + kCoreBinary);
QProcess process;
process.setReadChannel(QProcess::StandardOutput);
process.start(program, args);
bool success = process.waitForStarted();
QString output, error;
if (success)
{
if (!input.isEmpty()) {
process.write(input.toStdString().c_str());
}
if (process.waitForFinished()) {
output = process.readAllStandardOutput().trimmed();
error = process.readAllStandardError().trimmed();
}
}
int code = process.exitCode();
if (!error.isEmpty() || !success || code != 0)
{
throw std::runtime_error(
QString("Code: %1\nError: %2")
.arg(process.exitCode())
.arg(error.isEmpty() ? "Unknown" : error)
.toStdString());
}
return output;
}

View File

@@ -1,6 +1,6 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013 Synergy Si Ltd.
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -17,16 +17,15 @@
#pragma once
#include "io/CryptoStream.h"
#include "io/CryptoOptions.h"
#include <QString>
#include "test/global/gmock.h"
class MockCryptoStream : public CryptoStream
class CoreInterface
{
public:
MockCryptoStream(IEventQueue* eventQueue, IStream* stream) :
CryptoStream(eventQueue, stream, CryptoOptions("gcm", "stub"), false) { }
MOCK_METHOD2(read, UInt32(void*, UInt32));
MOCK_METHOD2(write, void(const void*, UInt32));
CoreInterface();
QString getPluginDir();
QString getProfileDir();
QString getArch();
QString run(const QStringList& args, const QString& input = "");
};

View File

@@ -17,37 +17,41 @@
#include "DataDownloader.h"
DataDownloader::DataDownloader(QUrl url, QObject* parent) :
QObject(parent)
DataDownloader::DataDownloader(QObject* parent) :
QObject(parent),
m_IsFinished(false)
{
connect(&m_WebCtrl, SIGNAL(finished(QNetworkReply*)),
SLOT(fileDownloaded(QNetworkReply*)));
QNetworkRequest request(url);
m_pReply = m_WebCtrl.get(request);
connect(&m_NetworkManager, SIGNAL(finished(QNetworkReply*)),
SLOT(complete(QNetworkReply*)));
}
DataDownloader::~DataDownloader()
{
}
void DataDownloader::fileDownloaded(QNetworkReply* reply)
void DataDownloader::complete(QNetworkReply* reply)
{
m_DownloadedData = reply->readAll();
m_Data = reply->readAll();
reply->deleteLater();
if (!m_DownloadedData.isEmpty()) {
emit downloaded();
if (!m_Data.isEmpty()) {
m_IsFinished = true;
emit isComplete();
}
}
QByteArray DataDownloader::downloadedData() const
QByteArray DataDownloader::data() const
{
return m_DownloadedData;
return m_Data;
}
void DataDownloader::cancelDownload()
void DataDownloader::cancel()
{
m_pReply->abort();
}
void DataDownloader::download(QUrl url)
{
QNetworkRequest request(url);
m_pReply = m_NetworkManager.get(request);
}

View File

@@ -27,24 +27,27 @@
class DataDownloader : public QObject
{
Q_OBJECT
public:
explicit DataDownloader(QUrl url, QObject* parent = 0);
explicit DataDownloader(QObject* parent = 0);
virtual ~DataDownloader();
QByteArray downloadedData() const;
void cancelDownload();
QByteArray data() const;
void cancel();
void download(QUrl url);
bool isFinished() const { return m_IsFinished; }
signals:
void downloaded();
void isComplete();
private slots:
void fileDownloaded(QNetworkReply* reply);
void complete(QNetworkReply* reply);
private:
QNetworkAccessManager m_WebCtrl;
QByteArray m_DownloadedData;
QNetworkAccessManager m_NetworkManager;
QByteArray m_Data;
QNetworkReply* m_pReply;
bool m_IsFinished;
};
#endif // DATADOWNLOADER_H

View File

@@ -1,7 +1,6 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Synergy Si Ltd.
* Copyright (C) 2011 Nick Bolton
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -16,22 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef EDITIONTYPE_H
#define EDITIONTYPE_H
#define TEST_ENV
#include "client/Client.h"
#include "test/global/gmock.h"
class IEventQueue;
class MockClient : public Client
{
public:
MockClient() : Client() { }
MOCK_METHOD2(mouseMove, void(SInt32, SInt32));
MOCK_METHOD1(setOptions, void(const OptionsList&));
MOCK_METHOD0(handshakeComplete, void());
MOCK_METHOD1(setDecryptIv, void(const UInt8*));
enum qEditionType {
Basic,
Pro,
Unknown
};
#endif // EDITIONTYPE_H

149
src/gui/src/Fingerprint.cpp Normal file
View File

@@ -0,0 +1,149 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Fingerprint.h"
#include "CoreInterface.h"
#include <QDir>
#include <QTextStream>
static const char kDirName[] = "SSL/Fingerprints";
static const char kLocalFilename[] = "Local.txt";
static const char kTrustedServersFilename[] = "TrustedServers.txt";
static const char kTrustedClientsFilename[] = "TrustedClients.txt";
Fingerprint::Fingerprint(const QString& filename)
{
m_Filename = filename;
}
void Fingerprint::trust(const QString& fingerprintText, bool append)
{
Fingerprint::persistDirectory();
QIODevice::OpenMode openMode;
if (append) {
openMode = QIODevice::Append;
}
else {
openMode = QIODevice::WriteOnly;
}
QFile file(filePath());
if (file.open(openMode))
{
QTextStream out(&file);
out << fingerprintText << "\n";
file.close();
}
}
bool Fingerprint::fileExists() const
{
QString dirName = Fingerprint::directoryPath();
if (!QDir(dirName).exists()) {
return false;
}
QFile file(filePath());
return file.exists();
}
bool Fingerprint::isTrusted(const QString& fingerprintText)
{
QStringList list = readList();
foreach (QString trusted, list)
{
if (trusted == fingerprintText) {
return true;
}
}
return false;
}
QStringList Fingerprint::readList(const int readTo)
{
QStringList list;
QString dirName = Fingerprint::directoryPath();
if (!QDir(dirName).exists()) {
return list;
}
QFile file(filePath());
if (file.open(QIODevice::ReadOnly))
{
QTextStream in(&file);
while (!in.atEnd())
{
list.append(in.readLine());
if (list.size() == readTo) {
break;
}
}
file.close();
}
return list;
}
QString Fingerprint::readFirst()
{
QStringList list = readList(1);
return list.at(0);
}
QString Fingerprint::filePath() const
{
QString dir = Fingerprint::directoryPath();
return QString("%1/%2").arg(dir).arg(m_Filename);
}
void Fingerprint::persistDirectory()
{
QDir dir(Fingerprint::directoryPath());
if (!dir.exists()) {
dir.mkpath(".");
}
}
QString Fingerprint::directoryPath()
{
CoreInterface coreInterface;
QString profileDir = coreInterface.getProfileDir();
return QString("%1/%2")
.arg(profileDir)
.arg(kDirName);
}
Fingerprint Fingerprint::local()
{
return Fingerprint(kLocalFilename);
}
Fingerprint Fingerprint::trustedServers()
{
return Fingerprint(kTrustedServersFilename);
}
Fingerprint Fingerprint::trustedClients()
{
return Fingerprint(kTrustedClientsFilename);
}

46
src/gui/src/Fingerprint.h Normal file
View File

@@ -0,0 +1,46 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QString>
class Fingerprint
{
private:
Fingerprint(const QString& filename);
public:
void trust(const QString& fingerprintText, bool append = true);
bool isTrusted(const QString& fingerprintText);
QStringList readList(const int readTo = -1);
QString readFirst();
QString filePath() const;
bool fileExists() const;
public:
static Fingerprint local();
static Fingerprint trustedServers();
static Fingerprint trustedClients();
static QString directoryPath();
static QString localFingerprint();
static bool localFingerprintExists();
static void persistDirectory();
private:
QString m_Filename;
};

View File

@@ -21,6 +21,9 @@
#include <iostream>
#include "MainWindow.h"
#include "Fingerprint.h"
#include "PluginManager.h"
#include "AboutDialog.h"
#include "ServerConfigDialog.h"
#include "SettingsDialog.h"
@@ -28,6 +31,9 @@
#include "ZeroconfService.h"
#include "DataDownloader.h"
#include "CommandProcess.h"
#include "EditionType.h"
#include "QUtility.h"
#include "ProcessorArch.h"
#include <QtCore>
#include <QtGui>
@@ -52,10 +58,10 @@
#if defined(Q_OS_WIN)
static const char synergyConfigName[] = "synergy.sgc";
static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.sgc);;All files (*.*)"));
static const char bonjourUrl[] = "http://synergy-project.org/bonjour/";
static const char bonjour32Url[] = "http://synergy-project.org/bonjour/Bonjour.msi";
static const char bonjour64Url[] = "http://synergy-project.org/bonjour/Bonjour64.msi";
static const char bonjourInstaller[] = "BonjourSetup.msi";
static QString bonjourBaseUrl = "http://synergy-project.org/bonjour/";
static const char bonjourFilename32[] = "Bonjour.msi";
static const char bonjourFilename64[] = "Bonjour64.msi";
static const char bonjourTargetFilename[] = "Bonjour.msi";
#else
static const char synergyConfigName[] = "synergy.conf";
static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.conf);;All files (*.*)"));
@@ -124,6 +130,12 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_SuppressAutoConfigWarning = false;
m_pComboServerList->hide();
updateEdition();
m_pLabelPadlock->hide();
updateLocalFingerprint();
}
MainWindow::~MainWindow()
@@ -388,6 +400,50 @@ void MainWindow::updateStateFromLogLine(const QString &line)
{
setSynergyState(synergyConnected);
}
checkFingerprint(line);
}
void MainWindow::checkFingerprint(const QString& line)
{
QRegExp fingerprintRegex(".*server fingerprint: ([A-F0-9:]+)");
if (!fingerprintRegex.exactMatch(line)) {
return;
}
QString fingerprint = fingerprintRegex.cap(1);
if (Fingerprint::trustedServers().isTrusted(fingerprint)) {
return;
}
QMessageBox::StandardButton fingerprintReply =
QMessageBox::information(
this, tr("Security question"),
tr("Do you trust this fingerprint?\n\n"
"%1\n\n"
"This is a server fingerprint. You should compare this "
"fingerprint to the one on your server's screen. If the "
"two don't match exactly, then it's probably not the server "
"you're expecting (it could be a malicious user).\n\n"
"To automatically trust this fingerprint for future "
"connections, click Yes. To reject this fingerprint and "
"disconnect from the server, click No.")
.arg(fingerprint),
QMessageBox::Yes | QMessageBox::No);
if (fingerprintReply == QMessageBox::Yes) {
// restart core process after trusting fingerprint.
Fingerprint::trustedServers().trust(fingerprint);
startSynergy();
}
else {
// on all platforms, the core process will stop if the
// fingerprint is not trusted, so technically the stop
// isn't really needed. however on windows, the core
// process will keep trying (and failing) unless we
// tell it to stop.
stopSynergy();
}
}
void MainWindow::clearLog()
@@ -415,11 +471,6 @@ void MainWindow::startSynergy()
args << "--name" << getScreenName();
if (appConfig().cryptoEnabled())
{
args << "--crypto-pass" << appConfig().cryptoPass();
}
if (desktopMode)
{
setSynergyProcess(new QProcess(this));
@@ -442,6 +493,18 @@ void MainWindow::startSynergy()
args << "--enable-drag-drop";
#endif
if (m_AppConfig.getCryptoEnabled()) {
args << "--enable-crypto";
}
#if defined(Q_OS_WIN)
// on windows, the profile directory changes depending on the user that
// launched the process (e.g. when launched with elevation). setting the
// profile dir on launch ensures it uses the same profile dir is used
// no matter how its relaunched.
args << "--profile-dir" << getProfileRootForArg();
#endif
if ((synergyType() == synergyClient && !clientArgs(args, app))
@@ -467,6 +530,8 @@ void MainWindow::startSynergy()
appendLogNote("starting " + QString(synergyType() == synergyServer ? "server" : "client"));
qDebug() << args;
// show command if debug log level...
if (appConfig().logLevel() >= 4) {
appendLogNote(QString("command: %1 %2").arg(app, args.join(" ")));
@@ -480,14 +545,6 @@ void MainWindow::startSynergy()
if (desktopMode)
{
if (!appConfig().startedBefore()) {
QMessageBox::information(
this, "Synergy",
tr("Synergy will be minimized to the notification "
"area. This will happen automatically when Synergy "
"starts."));
}
synergyProcess()->start(app, args);
if (!synergyProcess()->waitForStarted())
{
@@ -722,13 +779,22 @@ void MainWindow::setSynergyState(qSynergyState state)
switch (state)
{
case synergyConnected: {
if (m_AppConfig.getCryptoEnabled()) {
m_pLabelPadlock->show();
}
else {
m_pLabelPadlock->hide();
}
setStatus(tr("Synergy is running."));
break;
}
case synergyConnecting:
m_pLabelPadlock->hide();
setStatus(tr("Synergy is starting."));
break;
case synergyDisconnected:
m_pLabelPadlock->hide();
setStatus(tr("Synergy is not running."));
break;
}
@@ -736,12 +802,6 @@ void MainWindow::setSynergyState(qSynergyState state)
setIcon(state);
m_SynergyState = state;
// if in desktop mode, hide synergy. in service mode the gui can
// just be closed.
if ((appConfig().processMode() == Desktop) && (state == synergyConnected)) {
hide();
}
}
void MainWindow::setVisible(bool visible)
@@ -812,10 +872,14 @@ void MainWindow::changeEvent(QEvent* event)
switch (event->type())
{
case QEvent::LanguageChange:
{
retranslateUi(this);
retranslateMenuBar();
break;
updateEdition();
break;
}
default:
QMainWindow::changeEvent(event);
}
@@ -852,24 +916,33 @@ void MainWindow::serverDetected(const QString name)
}
}
int MainWindow::checkWinArch()
void MainWindow::setEdition(int type)
{
#if defined(Q_OS_WIN)
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
switch (systemInfo.wProcessorArchitecture) {
case PROCESSOR_ARCHITECTURE_INTEL:
return x86;
case PROCESSOR_ARCHITECTURE_IA64:
return x64;
case PROCESSOR_ARCHITECTURE_AMD64:
return x64;
default:
appendLogNote("failed to detect system architecture");
QString title;
if (type == Basic) {
title = "Synergy Basic";
}
else if (type == Pro) {
title = "Synergy Pro";
}
else {
title = "Synergy (UNREGISTERED)";
}
setWindowTitle(title);
}
void MainWindow::updateLocalFingerprint()
{
if (Fingerprint::local().fileExists()) {
m_pLabelFingerprint->setVisible(true);
m_pLabelLocalFingerprint->setVisible(true);
m_pLabelLocalFingerprint->setText(Fingerprint::local().readFirst());
}
else {
m_pLabelFingerprint->setVisible(false);
m_pLabelLocalFingerprint->setVisible(false);
}
#endif
return unknown;
}
void MainWindow::on_m_pGroupClient_toggled(bool on)
@@ -982,9 +1055,9 @@ void MainWindow::on_m_pButtonApply_clicked()
startSynergy();
}
#if defined(Q_OS_WIN)
bool MainWindow::isServiceRunning(QString name)
{
#if defined(Q_OS_WIN)
SC_HANDLE hSCManager;
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
if (hSCManager == NULL) {
@@ -1014,6 +1087,9 @@ bool MainWindow::isServiceRunning(QString name)
return true;
}
}
#else
bool MainWindow::isServiceRunning()
{
#endif
return false;
}
@@ -1034,33 +1110,29 @@ bool MainWindow::isBonjourRunning()
void MainWindow::downloadBonjour()
{
#if defined(Q_OS_WIN)
QUrl url;
int arch = checkWinArch();
if (arch == x86) {
url.setUrl(bonjour32Url);
int arch = checkProcessorArch();
if (arch == Win_x86) {
url.setUrl(bonjourBaseUrl + bonjourFilename32);
appendLogNote("downloading 32-bit Bonjour");
}
else if (arch == x64) {
url.setUrl(bonjour64Url);
else if (arch == Win_x64) {
url.setUrl(bonjourBaseUrl + bonjourFilename64);
appendLogNote("downloading 64-bit Bonjour");
}
else {
QString msg("Failed to detect system architecture.\n"
"Please download the installer manually from this link:\n");
QMessageBox::warning(
QMessageBox::critical(
this, tr("Synergy"),
msg + bonjourUrl);
tr("Failed to detect system architecture."));
return;
}
if (m_pDataDownloader != NULL) {
delete m_pDataDownloader;
m_pDataDownloader = NULL;
if (m_pDataDownloader == NULL) {
m_pDataDownloader = new DataDownloader(this);
connect(m_pDataDownloader, SIGNAL(isComplete()), SLOT(installBonjour()));
}
m_pDataDownloader = new DataDownloader(url, this);
connect(m_pDataDownloader, SIGNAL(downloaded()), SLOT(installBonjour()));
m_pDataDownloader->download(url);
if (m_DownloadMessageBox == NULL) {
m_DownloadMessageBox = new QMessageBox(this);
@@ -1075,7 +1147,7 @@ void MainWindow::downloadBonjour()
m_DownloadMessageBox->exec();
if (m_DownloadMessageBox->clickedButton() == m_pCancelButton) {
m_pDataDownloader->cancelDownload();
m_pDataDownloader->cancel();
}
#endif
}
@@ -1086,21 +1158,19 @@ void MainWindow::installBonjour()
QString tempLocation = QDesktopServices::storageLocation(
QDesktopServices::TempLocation);
QString filename = tempLocation;
filename.append("\\").append(bonjourInstaller);
filename.append("\\").append(bonjourTargetFilename);
QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) {
m_DownloadMessageBox->hide();
QMessageBox::warning(
this, "Synergy",
"Failed to download Bonjour installer to location: " +
tempLocation + "\n"
"Please download the installer manually from this link: \n" +
bonjourUrl);
tr("Failed to download Bonjour installer to location: %1")
.arg(tempLocation));
return;
}
file.write(m_pDataDownloader->downloadedData());
file.write(m_pDataDownloader->data());
file.close();
QStringList arguments;
@@ -1149,6 +1219,20 @@ void MainWindow::promptAutoConfig()
m_AppConfig.setAutoConfigPrompted(true);
}
void MainWindow::updateEdition()
{
QString mac = getFirstMacAddress();
QString hashSrc = m_AppConfig.activateEmail() + mac;
QString hashResult = hash(hashSrc);
if (hashResult == m_AppConfig.userToken()) {
setEdition(m_AppConfig.edition());
}
else {
setEdition(Unknown);
}
}
void MainWindow::on_m_pComboServerList_currentIndexChanged(QString )
{
if (m_pComboServerList->count() != 0) {
@@ -1191,3 +1275,18 @@ void MainWindow::bonjourInstallFinished()
m_pCheckBoxAutoConfig->setChecked(true);
}
QString MainWindow::getProfileRootForArg()
{
CoreInterface coreInterface;
QString dir = coreInterface.getProfileDir();
// HACK: strip our app name since we're returning the root dir.
#if defined(Q_OS_WIN)
dir.replace("\\Synergy", "");
#else
dir.replace("/.synergy", "");
#endif
return QString("\"%1\"").arg(dir);
}

View File

@@ -83,12 +83,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
Info
};
enum qProcessorArch {
x86,
x64,
unknown
};
public:
MainWindow(QSettings& settings, AppConfig& appConfig);
~MainWindow();
@@ -111,7 +105,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void autoAddScreen(const QString name);
void updateZeroconfService();
void serverDetected(const QString name);
int checkWinArch();
void setEdition(int type);
void updateLocalFingerprint();
public slots:
void appendLogRaw(const QString& text);
@@ -162,10 +157,17 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void stopDesktop();
void changeEvent(QEvent* event);
void retranslateMenuBar();
#if defined(Q_OS_WIN)
bool isServiceRunning(QString name);
#else
bool isServiceRunning();
#endif
bool isBonjourRunning();
void downloadBonjour();
void promptAutoConfig();
void updateEdition();
QString getProfileRootForArg();
void checkFingerprint(const QString& line);
private:
QSettings& m_Settings;

View File

@@ -0,0 +1,218 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PluginManager.h"
#include "CoreInterface.h"
#include "CommandProcess.h"
#include "DataDownloader.h"
#include "QUtility.h"
#include "ProcessorArch.h"
#include "Fingerprint.h"
#include <QFile>
#include <QDir>
#include <QProcess>
#include <QCoreApplication>
static QString kBaseUrl = "http://synergy-project.org/files";
static const char kWinProcessorArch32[] = "Windows-x86";
static const char kWinProcessorArch64[] = "Windows-x64";
static const char kMacProcessorArch[] = "MacOSX-i386";
static const char kLinuxProcessorArchDeb32[] = "Linux-i686-deb";
static const char kLinuxProcessorArchDeb64[] = "Linux-x86_64-deb";
static const char kLinuxProcessorArchRpm32[] = "Linux-i686-rpm";
static const char kLinuxProcessorArchRpm64[] = "Linux-x86_64-rpm";
#if defined(Q_OS_WIN)
static const char kWinPluginExt[] = ".dll";
#elif defined(Q_OS_MAC)
static const char kMacPluginPrefix[] = "lib";
static const char kMacPluginExt[] = ".dylib";
#else
static const char kLinuxPluginPrefix[] = "lib";
static const char kLinuxPluginExt[] = ".so";
#endif
PluginManager::PluginManager(QStringList pluginList) :
m_PluginList(pluginList),
m_DownloadIndex(-1)
{
m_PluginDir = m_CoreInterface.getPluginDir();
if (m_PluginDir.isEmpty()) {
emit error(tr("Failed to get plugin directory."));
}
m_ProfileDir = m_CoreInterface.getProfileDir();
if (m_ProfileDir.isEmpty()) {
emit error(tr("Failed to get profile directory."));
}
}
PluginManager::~PluginManager()
{
}
bool PluginManager::exist(QString name)
{
CoreInterface coreInterface;
QString PluginDir = coreInterface.getPluginDir();
QString pluginName = getPluginOsSpecificName(name);
QString filename;
filename.append(PluginDir);
filename.append(QDir::separator()).append(pluginName);
QFile file(filename);
bool exist = false;
if (file.exists()) {
exist = true;
}
return exist;
}
void PluginManager::downloadPlugins()
{
if (m_DataDownloader.isFinished()) {
if (!savePlugin()) {
return;
}
if (m_DownloadIndex != m_PluginList.size() - 1) {
emit downloadNext();
}
else {
emit downloadFinished();
return;
}
}
m_DownloadIndex++;
if (m_DownloadIndex < m_PluginList.size()) {
QUrl url;
QString pluginUrl = getPluginUrl(m_PluginList.at(m_DownloadIndex));
if (pluginUrl.isEmpty()) {
return;
}
url.setUrl(pluginUrl);
connect(&m_DataDownloader, SIGNAL(isComplete()), this, SLOT(downloadPlugins()));
m_DataDownloader.download(url);
}
}
bool PluginManager::savePlugin()
{
// create the path if not exist
QDir dir(m_PluginDir);
if (!dir.exists()) {
dir.mkpath(".");
}
QString filename = m_PluginDir;
QString pluginName = m_PluginList.at(m_DownloadIndex);
pluginName = getPluginOsSpecificName(pluginName);
filename.append(QDir::separator()).append(pluginName);
QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) {
emit error(
tr("Failed to download plugin '%1' to: %2\n%3")
.arg(m_PluginList.at(m_DownloadIndex))
.arg(m_PluginDir)
.arg(file.errorString()));
file.close();
return false;
}
file.write(m_DataDownloader.data());
file.close();
return true;
}
QString PluginManager::getPluginUrl(const QString& pluginName)
{
QString archName;
#if defined(Q_OS_WIN)
try {
QString coreArch = m_CoreInterface.getArch();
if (coreArch.startsWith("x86")) {
archName = kWinProcessorArch32;
}
else if (coreArch.startsWith("x64")) {
archName = kWinProcessorArch64;
}
}
catch (...) {
emit error(tr("Could not get Windows architecture type."));
return "";
}
#elif defined(Q_OS_MAC)
archName = kMacProcessorArch;
#else
int arch = checkProcessorArch();
if (arch == Linux_rpm_i686) {
archName = kLinuxProcessorArchRpm32;
}
else if (arch == Linux_rpm_x86_64) {
archName = kLinuxProcessorArchRpm64;
}
else if (arch == Linux_deb_i686) {
archName = kLinuxProcessorArchDeb32;
}
else if (arch == Linux_deb_x86_64) {
archName = kLinuxProcessorArchDeb64;
}
else {
emit error(tr("Could not get Linux architecture type."));
return "";
}
#endif
QString result = kBaseUrl;
result.append("/plugins/");
result.append(pluginName).append("/1.0/");
result.append(archName);
result.append("/");
result.append(getPluginOsSpecificName(pluginName));
return result;
}
QString PluginManager::getPluginOsSpecificName(const QString& pluginName)
{
QString result = pluginName;
#if defined(Q_OS_WIN)
result.append(kWinPluginExt);
#elif defined(Q_OS_MAC)
result = kMacPluginPrefix + pluginName + kMacPluginExt;
#else
result = kLinuxPluginPrefix + pluginName + kLinuxPluginExt;
#endif
return result;
}

View File

@@ -0,0 +1,70 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLUGINMANAGER_H
#define PLUGINMANAGER_H
#include <QString>
#include <QStringList>
#include <QObject>
#include "SslCertificate.h"
#include "CoreInterface.h"
#include "DataDownloader.h"
class PluginManager : public QObject
{
Q_OBJECT
public:
PluginManager(QStringList pluginList);
~PluginManager();
int downloadIndex() { return m_DownloadIndex; }
static bool exist(QString name);
public slots:
void downloadPlugins();
private:
bool savePlugin();
QString getPluginUrl(const QString& pluginName);
bool runProgram(
const QString& program,
const QStringList& args,
const QStringList& env);
static QString getPluginOsSpecificName(const QString& pluginName);
signals:
void error(QString e);
void info(QString i);
void downloadNext();
void downloadFinished();
private:
QStringList m_PluginList;
QString m_PluginDir;
QString m_ProfileDir;
int m_DownloadIndex;
DataDownloader m_DataDownloader;
CoreInterface m_CoreInterface;
SslCertificate m_SslCertificate;
};
#endif // PLUGINMANAGER_H

View File

@@ -0,0 +1,242 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PluginWizardPage.h"
#include "ui_PluginWizardPageBase.h"
#include "SslCertificate.h"
#include "WebClient.h"
#include "PluginManager.h"
#include <QMovie>
#include <QThread>
PluginWizardPage::PluginWizardPage(AppConfig& appConfig, QWidget *parent) :
QWizardPage(parent),
m_Finished(false),
m_pWebClient(NULL),
m_pPluginManager(NULL),
m_pSslCertificate(NULL),
m_AppConfig(appConfig)
{
setupUi(this);
QMovie *movie = new QMovie(":/res/image/spinning-wheel.gif");
m_pLabelSpinning->setMovie(movie);
movie->start();
m_pSslCertificate = new SslCertificate(this);
}
PluginWizardPage::~PluginWizardPage()
{
if (m_pWebClient != NULL) {
delete m_pWebClient;
}
if (m_pPluginManager != NULL) {
delete m_pPluginManager;
}
delete m_pSslCertificate;
}
void PluginWizardPage::changeEvent(QEvent *e)
{
QWizardPage::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
retranslateUi(this);
break;
default:
break;
}
}
void PluginWizardPage::showError(QString error)
{
updateStatus(tr("Error: %1").arg(error));
showFinished();
}
void PluginWizardPage::queryPluginDone()
{
QStringList pluginList = m_pWebClient->getPluginList();
if (pluginList.isEmpty()) {
updateStatus(tr("Setup complete."));
showFinished();
}
else {
downloadPlugins();
}
}
void PluginWizardPage::updateDownloadStatus()
{
QStringList pluginList = m_pWebClient->getPluginList();
int index = m_pPluginManager->downloadIndex();
updateStatus(
tr("Downloading '%1' plugin (%2/%3)...")
.arg(pluginList.at(index + 1))
.arg(index + 2)
.arg(pluginList.size()));
}
void PluginWizardPage::finished()
{
// TODO: we should check if ns plugin exists
m_AppConfig.setCryptoEnabled(true);
updateStatus(tr("Plugins installed successfully."));
showFinished();
}
void PluginWizardPage::generateCertificate()
{
connect(m_pSslCertificate,
SIGNAL(generateFinished()),
this,
SLOT(finished()));
connect(m_pSslCertificate,
SIGNAL(generateFinished()),
m_pThread,
SLOT(quit()));
updateStatus(tr("Generating SSL certificate..."));
QMetaObject::invokeMethod(
m_pSslCertificate,
"generateCertificate",
Qt::QueuedConnection);
}
void PluginWizardPage::updateStatus(QString info)
{
m_pLabelStatus->setText(info);
}
void PluginWizardPage::downloadPlugins()
{
QStringList pluginList = m_pWebClient->getPluginList();
m_pPluginManager = new PluginManager(pluginList);
m_pThread = new QThread;
connect(m_pPluginManager,
SIGNAL(error(QString)),
this,
SLOT(showError(QString)));
connect(m_pPluginManager,
SIGNAL(info(QString)),
this,
SLOT(updateStatus(QString)));
connect(m_pPluginManager,
SIGNAL(downloadNext()),
this,
SLOT(updateDownloadStatus()));
connect(m_pPluginManager,
SIGNAL(downloadFinished()),
this,
SLOT(generateCertificate()));
connect(m_pPluginManager,
SIGNAL(error(QString)),
m_pThread,
SLOT(quit()));
connect(m_pThread,
SIGNAL(finished()),
m_pThread,
SLOT(deleteLater()));
updateStatus(
tr("Downloading plugin: %1 (1/%2)")
.arg(pluginList.at(0))
.arg(pluginList.size()));
m_pPluginManager->moveToThread(m_pThread);
m_pThread->start();
QMetaObject::invokeMethod(
m_pPluginManager,
"downloadPlugins",
Qt::QueuedConnection);
}
void PluginWizardPage::showFinished()
{
m_pLabelSpinning->hide();
m_Finished = true;
emit completeChanged();
}
bool PluginWizardPage::isComplete() const
{
return m_Finished;
}
void PluginWizardPage::initializePage()
{
QWizardPage::initializePage();
if (m_pWebClient == NULL) {
if (m_Email.isEmpty() ||
m_Password.isEmpty()) {
updateStatus(tr("Setup complete."));
showFinished();
return;
}
m_pLabelSpinning->show();
m_pWebClient = new WebClient();
m_pWebClient->setEmail(m_Email);
m_pWebClient->setPassword(m_Password);
QThread* thread = new QThread;
connect(m_pWebClient,
SIGNAL(error(QString)),
this,
SLOT(showError(QString)));
connect(m_pWebClient,
SIGNAL(queryPluginDone()),
this,
SLOT(queryPluginDone()));
connect(m_pWebClient,
SIGNAL(queryPluginDone()),
thread,
SLOT(quit()));
connect(m_pWebClient,
SIGNAL(error(QString)),
thread,
SLOT(quit()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
m_pWebClient->moveToThread(thread);
thread->start();
updateStatus(tr("Getting plugin list..."));
QMetaObject::invokeMethod(m_pWebClient, "queryPluginList", Qt::QueuedConnection);
}
}

View File

@@ -0,0 +1,70 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLUGINWIZARDPAGE_H
#define PLUGINWIZARDPAGE_H
#include "AppConfig.h"
#include "ui_PluginWizardPageBase.h"
#include <QWizardPage>
class WebClient;
class PluginManager;
class SslCertificate;
class PluginWizardPage : public QWizardPage, public Ui::PluginWizardPage {
Q_OBJECT
public:
PluginWizardPage(AppConfig& appConfig, QWidget *parent = 0);
~PluginWizardPage();
void setFinished(bool b) { m_Finished = b; }
void setEmail(QString e) { m_Email = e; }
void setPassword(QString p) { m_Password = p; }
bool isComplete() const;
void initializePage();
protected:
void changeEvent(QEvent *e);
protected slots:
void showError(QString error);
void updateStatus(QString info);
void queryPluginDone();
void updateDownloadStatus();
void finished();
void generateCertificate();
private:
void downloadPlugins();
void showFinished();
private:
bool m_Finished;
QString m_Email;
QString m_Password;
WebClient* m_pWebClient;
PluginManager* m_pPluginManager;
SslCertificate* m_pSslCertificate;
QThread* m_pThread;
AppConfig& m_AppConfig;
};
#endif // PLUGINWIZARDPAGE_H

View File

@@ -1,11 +1,11 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014 Synergy Si Ltd.
*
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -15,16 +15,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef PROCESSORARCH_H
#define PROCESSORARCH_H
// HACK: gcc on osx106 doesn't give you an easy way to hide warnings
// from included headers, so use the system_header pragma. the downside
// is that everything in the header file following this also has warnings
// ignored, so we need to put it in a separate header file (this file).
#if __APPLE__
# pragma GCC system_header
#endif
enum qProcessorArch {
Win_x86,
Win_x64,
Mac_i386,
Linux_rpm_i686,
Linux_rpm_x86_64,
Linux_deb_i686,
Linux_deb_x86_64,
unknown
};
#include <cryptopp562/gcm.h>
#include <cryptopp562/modes.h>
#include <cryptopp562/aes.h>
#endif // PROCESSORARCH_H

View File

@@ -17,6 +17,24 @@
#include "QUtility.h"
#include "ProcessorArch.h"
#if defined(Q_OS_LINUX)
#include <QProcess>
#endif
#if defined(Q_OS_WIN)
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#endif
#if defined(Q_OS_LINUX)
static const char kLinuxI686[] = "i686";
static const char kLinuxX8664[] = "x86_64";
static const char kUbuntu[] = "Ubuntu";
#endif
void setIndexFromItemData(QComboBox* comboBox, const QVariant& itemData)
{
for (int i = 0; i < comboBox->count(); ++i)
@@ -49,3 +67,106 @@ QString getFirstMacAddress()
}
return mac;
}
int checkProcessorArch()
{
#if defined(Q_OS_WIN)
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
switch (systemInfo.wProcessorArchitecture) {
case PROCESSOR_ARCHITECTURE_INTEL:
return Win_x86;
case PROCESSOR_ARCHITECTURE_IA64:
return Win_x64;
case PROCESSOR_ARCHITECTURE_AMD64:
return Win_x64;
default:
return unknown;
}
#elif defined(Q_OS_MAC)
return Mac_i386;
#else
bool version32 = false;
bool debPackaging = false;
QString program1("uname");
QStringList args1("-m");
QProcess process1;
process1.setReadChannel(QProcess::StandardOutput);
process1.start(program1, args1);
bool success = process1.waitForStarted();
QString out, error;
if (success)
{
if (process1.waitForFinished()) {
out = process1.readAllStandardOutput();
error = process1.readAllStandardError();
}
}
out = out.trimmed();
error = error.trimmed();
if (out.isEmpty() ||
!error.isEmpty() ||
!success ||
process1.exitCode() != 0)
{
return unknown;
}
if (out == kLinuxI686) {
version32 = true;
}
QString program2("python");
QStringList args2("-mplatform");
QProcess process2;
process2.setReadChannel(QProcess::StandardOutput);
process2.start(program2, args2);
success = process2.waitForStarted();
if (success)
{
if (process2.waitForFinished()) {
out = process2.readAllStandardOutput();
error = process2.readAllStandardError();
}
}
out = out.trimmed();
error = error.trimmed();
if (out.isEmpty() ||
!error.isEmpty() ||
!success ||
process2.exitCode() != 0)
{
return unknown;
}
if (out.contains(kUbuntu)) {
debPackaging = true;
}
if (version32) {
if (debPackaging) {
return Linux_deb_i686;
}
else {
return Linux_rpm_i686;
}
}
else {
if (debPackaging) {
return Linux_deb_x86_64;
}
else {
return Linux_rpm_x86_64;
}
}
#endif
return unknown;
}

View File

@@ -25,3 +25,4 @@
void setIndexFromItemData(QComboBox* comboBox, const QVariant& itemData);
QString hash(const QString& string);
QString getFirstMacAddress();
int checkProcessorArch();

View File

@@ -374,13 +374,16 @@ int ServerConfig::showAddClientDialog(const QString& clientName)
{
int result = kAddClientIgnore;
if (m_pMainWindow->isActiveWindow()) {
AddClientDialog addClientDialog(clientName, m_pMainWindow);
addClientDialog.exec();
result = addClientDialog.addResult();
m_IgnoreAutoConfigClient = addClientDialog.ignoreAutoConfigClient();
if (!m_pMainWindow->isActiveWindow()) {
m_pMainWindow->showNormal();
m_pMainWindow->activateWindow();
}
AddClientDialog addClientDialog(clientName, m_pMainWindow);
addClientDialog.exec();
result = addClientDialog.addResult();
m_IgnoreAutoConfigClient = addClientDialog.ignoreAutoConfigClient();
return result;
}

View File

@@ -17,6 +17,9 @@
*/
#include "SettingsDialog.h"
#include "PluginManager.h"
#include "CoreInterface.h"
#include "SynergyLocale.h"
#include "QSynergyApplication.h"
#include "QUtility.h"
@@ -26,6 +29,9 @@
#include <QtGui>
#include <QMessageBox>
#include <QFileDialog>
#include <QDir>
static const char networkSecurity[] = "ns";
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
@@ -43,12 +49,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
m_pCheckBoxLogToFile->setChecked(appConfig().logToFile());
m_pLineEditLogFilename->setText(appConfig().logFilename());
m_pCheckBoxEnableCrypto->setChecked(appConfig().cryptoEnabled());
setIndexFromItemData(m_pComboLanguage, appConfig().language());
if (appConfig().cryptoEnabled())
{
m_pLineEditCryptoPass->setText(appConfig().cryptoPass());
}
#if defined(Q_OS_WIN)
m_SuppressElevateWarning = true;
@@ -58,30 +59,24 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
// elevate checkbox is only useful on ms windows.
m_pCheckBoxElevateMode->hide();
#endif
if (!PluginManager::exist(networkSecurity)) {
m_pGroupNetworkSecurity->setEnabled(false);
m_pCheckBoxEnableCrypto->setChecked(false);
}
else {
m_pCheckBoxEnableCrypto->setChecked(m_AppConfig.getCryptoEnabled());
}
}
void SettingsDialog::accept()
{
const QString& cryptoPass = m_pLineEditCryptoPass->text();
bool cryptoEnabled = m_pCheckBoxEnableCrypto->isChecked();
if (cryptoEnabled && cryptoPass.isEmpty())
{
QMessageBox message;
message.setWindowTitle("Settings");
message.setIcon(QMessageBox::Information);
message.setText(tr("Encryption password must not be empty."));
message.exec();
return;
}
appConfig().setScreenName(m_pLineEditScreenName->text());
appConfig().setPort(m_pSpinBoxPort->value());
appConfig().setInterface(m_pLineEditInterface->text());
appConfig().setLogLevel(m_pComboLogLevel->currentIndex());
appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked());
appConfig().setLogFilename(m_pLineEditLogFilename->text());
appConfig().setCryptoEnabled(cryptoEnabled);
appConfig().setCryptoPass(cryptoPass);
appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
appConfig().setElevateMode(m_pCheckBoxElevateMode->isChecked());
appConfig().saveSettings();
@@ -139,17 +134,6 @@ void SettingsDialog::on_m_pButtonBrowseLog_clicked()
}
}
void SettingsDialog::on_m_pCheckBoxEnableCrypto_stateChanged(int )
{
bool cryptoEnabled = m_pCheckBoxEnableCrypto->isChecked();
m_pLineEditCryptoPass->setEnabled(cryptoEnabled);
if (!cryptoEnabled)
{
m_pLineEditCryptoPass->clear();
}
}
void SettingsDialog::on_m_pComboLanguage_currentIndexChanged(int index)
{
QString ietfCode = m_pComboLanguage->itemData(index).toString();
@@ -173,3 +157,8 @@ void SettingsDialog::on_m_pCheckBoxElevateMode_toggled(bool checked)
}
}
}
void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked)
{
m_AppConfig.setCryptoEnabled(checked);
}

View File

@@ -23,6 +23,7 @@
#include <QDialog>
#include "ui_SettingsDialogBase.h"
#include "SynergyLocale.h"
#include "CoreInterface.h"
class AppConfig;
@@ -44,11 +45,12 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
private:
AppConfig& m_AppConfig;
SynergyLocale m_Locale;
CoreInterface m_CoreInterface;
bool m_SuppressElevateWarning;
private slots:
void on_m_pCheckBoxEnableCrypto_toggled(bool checked);
void on_m_pCheckBoxElevateMode_toggled(bool checked);
void on_m_pCheckBoxEnableCrypto_stateChanged(int );
void on_m_pComboLanguage_currentIndexChanged(int index);
void on_m_pCheckBoxLogToFile_stateChanged(int );
void on_m_pButtonBrowseLog_clicked();

View File

@@ -17,6 +17,8 @@
#include "SetupWizard.h"
#include "MainWindow.h"
#include "WebClient.h"
#include "EditionType.h"
#include "QSynergyApplication.h"
#include "QUtility.h"
@@ -24,9 +26,12 @@
SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
m_MainWindow(mainWindow),
m_StartMain(startMain)
m_StartMain(startMain),
m_Edition(Unknown)
{
setupUi(this);
m_pPluginPage = new PluginWizardPage(mainWindow.appConfig());
addPage(m_pPluginPage);
#if defined(Q_OS_MAC)
@@ -51,6 +56,9 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
m_Locale.fillLanguageComboBox(m_pComboLanguage);
setIndexFromItemData(m_pComboLanguage, m_MainWindow.appConfig().language());
AppConfig& appConfig = m_MainWindow.appConfig();
m_pLineEditEmail->setText(appConfig.activateEmail());
}
@@ -64,7 +72,38 @@ bool SetupWizard::validateCurrentPage()
message.setWindowTitle(tr("Setup Synergy"));
message.setIcon(QMessageBox::Information);
if (currentPage() == m_pNodePage)
if (currentPage() == m_pActivatePage)
{
if (m_pRadioButtonActivate->isChecked()) {
if (m_pLineEditEmail->text().isEmpty() ||
m_pLineEditPassword->text().isEmpty()) {
message.setText(tr("Please enter your email address and password."));
message.exec();
return false;
}
else {
WebClient webClient;
m_Edition = webClient .getEdition(
m_pLineEditEmail->text(),
m_pLineEditPassword->text(),
message,
this);
if (m_Edition == Unknown) {
return false;
}
else {
m_pPluginPage->setEmail(m_pLineEditEmail->text());
m_pPluginPage->setPassword(m_pLineEditPassword->text());
return true;
}
}
}
else {
return true;
}
}
else if (currentPage() == m_pNodePage)
{
bool result = m_pClientRadioButton->isChecked() ||
m_pServerRadioButton->isChecked();
@@ -121,6 +160,17 @@ void SetupWizard::accept()
settings.setValue("groupServerChecked", false);
}
if (m_pRadioButtonActivate->isChecked()) {
appConfig.setActivateEmail(m_pLineEditEmail->text());
QString mac = getFirstMacAddress();
QString hashSrc = m_pLineEditEmail->text() + mac;
QString hashResult = hash(hashSrc);
appConfig.setUserToken(hashResult);
appConfig.setEdition(m_Edition);
}
m_MainWindow.setEdition(m_Edition);
m_MainWindow.updateLocalFingerprint();
settings.sync();
QWizard::accept();
@@ -138,6 +188,7 @@ void SetupWizard::reject()
if (m_StartMain)
{
m_MainWindow.setEdition(m_Edition);
m_MainWindow.open();
}
@@ -149,3 +200,19 @@ void SetupWizard::on_m_pComboLanguage_currentIndexChanged(int index)
QString ietfCode = m_pComboLanguage->itemData(index).toString();
QSynergyApplication::getInstance()->switchTranslator(ietfCode);
}
void SetupWizard::on_m_pRadioButtonSkip_toggled(bool checked)
{
if (checked) {
m_pLineEditEmail->setEnabled(false);
m_pLineEditPassword->setEnabled(false);
}
}
void SetupWizard::on_m_pRadioButtonActivate_toggled(bool checked)
{
if (checked) {
m_pLineEditEmail->setEnabled(true);
m_pLineEditPassword->setEnabled(true);
}
}

View File

@@ -19,12 +19,12 @@
#include "ui_SetupWizardBase.h"
#include "SynergyLocale.h"
#include "PluginWizardPage.h"
#include <QWizard>
#include <QNetworkAccessManager>
class MainWindow;
class QMessageBox;
class SetupWizard : public QWizard, public Ui::SetupWizardBase
{
@@ -43,7 +43,11 @@ private:
MainWindow& m_MainWindow;
bool m_StartMain;
SynergyLocale m_Locale;
int m_Edition;
PluginWizardPage* m_pPluginPage;
private slots:
void on_m_pRadioButtonActivate_toggled(bool checked);
void on_m_pRadioButtonSkip_toggled(bool checked);
void on_m_pComboLanguage_currentIndexChanged(int index);
};

View File

@@ -0,0 +1,175 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SslCertificate.h"
#include "Fingerprint.h"
#include <QProcess>
#include <QDir>
#include <QCoreApplication>
static const char kCertificateLifetime[] = "365";
static const char kCertificateSubjectInfo[] = "/CN=Synergy";
static const char kCertificateFilename[] = "Synergy.pem";
static const char kSslDir[] = "SSL";
static const char kUnixOpenSslCommand[] = "openssl";
#if defined(Q_OS_WIN)
static const char kWinOpenSslBinary[] = "OpenSSL\\openssl.exe";
static const char kConfigFile[] = "OpenSSL\\synergy.conf";
#endif
SslCertificate::SslCertificate(QObject *parent) :
QObject(parent)
{
m_ProfileDir = m_CoreInterface.getProfileDir();
if (m_ProfileDir.isEmpty()) {
emit error(tr("Failed to get profile directory."));
}
}
bool SslCertificate::runTool(const QStringList& args)
{
QString program;
#if defined(Q_OS_WIN)
program = QCoreApplication::applicationDirPath();
program.append("\\").append(kWinOpenSslBinary);
#else
program = kUnixOpenSslCommand;
#endif
QStringList environment;
#if defined(Q_OS_WIN)
environment << QString("OPENSSL_CONF=%1\\%2")
.arg(QCoreApplication::applicationDirPath())
.arg(kConfigFile);
#endif
QProcess process;
process.setEnvironment(environment);
process.start(program, args);
bool success = process.waitForStarted();
QString standardError;
if (success && process.waitForFinished())
{
m_ToolOutput = process.readAllStandardOutput().trimmed();
standardError = process.readAllStandardError().trimmed();
}
int code = process.exitCode();
if (!success || code != 0)
{
emit error(
QString("SSL tool failed: %1\n\nCode: %2\nError: %3")
.arg(program)
.arg(process.exitCode())
.arg(standardError.isEmpty() ? "Unknown" : standardError));
return false;
}
return true;
}
void SslCertificate::generateCertificate()
{
QStringList arguments;
// self signed certificate
arguments.append("req");
arguments.append("-x509");
arguments.append("-nodes");
// valide duration
arguments.append("-days");
arguments.append(kCertificateLifetime);
// subject information
arguments.append("-subj");
QString subInfo(kCertificateSubjectInfo);
arguments.append(subInfo);
// private key
arguments.append("-newkey");
arguments.append("rsa:1024");
QString sslDirPath = QString("%1%2%3")
.arg(m_ProfileDir)
.arg(QDir::separator())
.arg(kSslDir);
QDir sslDir(sslDirPath);
if (!sslDir.exists()) {
sslDir.mkpath(".");
}
QString filename = QString("%1%2%3")
.arg(sslDirPath)
.arg(QDir::separator())
.arg(kCertificateFilename);
// key output filename
arguments.append("-keyout");
arguments.append(filename);
// certificate output filename
arguments.append("-out");
arguments.append(filename);
if (!runTool(arguments)) {
return;
}
emit info(tr("SSL certificate generated."));
generateFingerprint(filename);
emit generateFinished();
}
void SslCertificate::generateFingerprint(const QString& certificateFilename)
{
QStringList arguments;
arguments.append("x509");
arguments.append("-fingerprint");
arguments.append("-sha1");
arguments.append("-noout");
arguments.append("-in");
arguments.append(certificateFilename);
if (!runTool(arguments)) {
return;
}
// find the fingerprint from the tool output
int i = m_ToolOutput.indexOf("=");
if (i != -1) {
i++;
QString fingerprint = m_ToolOutput.mid(
i, m_ToolOutput.size() - i);
Fingerprint::local().trust(fingerprint, false);
emit info(tr("SSL fingerprint generated."));
}
else {
emit error(tr("Failed to find SSL fingerprint."));
}
}

View File

@@ -1,6 +1,6 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014 Synergy Si Ltd.
* Copyright (C) 2015 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -17,26 +17,31 @@
#pragma once
#include <AvailabilityInternal.h>
#include "CoreInterface.h"
// HACK: ideally this file should not be included in project,
// if it is below marvericks, but it seems that .pro can't
// specify mac version
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
#include <QObject>
class SslCertificate : public QObject
{
Q_OBJECT
class AXDatabaseCleaner {
public:
AXDatabaseCleaner();
~AXDatabaseCleaner();
explicit SslCertificate(QObject *parent = 0);
bool loadPrivilegeHelper();
bool xpcConnect();
bool privilegeCommand(const char* command);
public slots:
void generateCertificate();
signals:
void error(QString e);
void info(QString i);
void generateFinished();
private:
class Private;
Private* m_private;
bool m_waitForResponse;
};
bool runTool(const QStringList& args);
void generateFingerprint(const QString& certificateFilename);
#endif
private:
QString m_ProfileDir;
QString m_ToolOutput;
CoreInterface m_CoreInterface;
};

150
src/gui/src/WebClient.cpp Normal file
View File

@@ -0,0 +1,150 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si, Std.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "WebClient.h"
#include "EditionType.h"
#include "QUtility.h"
#include <QProcess>
#include <QMessageBox>
#include <QCoreApplication>
#include <stdexcept>
int WebClient::getEdition(
const QString& email,
const QString& password,
QMessageBox& message,
QWidget* w)
{
QString responseJson;
int edition = Unknown;
try {
QStringList args("--login-auth");
responseJson = request(email, password, args);
}
catch (std::exception& e)
{
message.critical(
w, "Error",
tr("An error occured while trying to sign in. "
"Please contact the helpdesk, and provide the "
"following details.\n\n%1").arg(e.what()));
return edition;
}
QRegExp resultRegex(".*\"result\".*:.*(true|false).*");
if (resultRegex.exactMatch(responseJson)) {
QString boolString = resultRegex.cap(1);
if (boolString == "true") {
QRegExp editionRegex(".*\"edition\".*:.*\"([^\"]+)\".*");
if (editionRegex.exactMatch(responseJson)) {
QString e = editionRegex.cap(1);
edition = e.toInt();
}
return edition;
}
else if (boolString == "false") {
message.critical(
w, "Error",
tr("Login failed, invalid email or password."));
return edition;
}
}
else {
QRegExp errorRegex(".*\"error\".*:.*\"([^\"]+)\".*");
if (errorRegex.exactMatch(responseJson)) {
// replace "\n" with real new lines.
QString error = errorRegex.cap(1).replace("\\n", "\n");
message.critical(
w, "Error",
tr("Login failed, an error occurred.\n\n%1").arg(error));
return edition;
}
}
message.critical(
w, "Error",
tr("Login failed, an error occurred.\n\nServer response:\n\n%1")
.arg(responseJson));
return edition;
}
void WebClient::queryPluginList()
{
QString responseJson;
try {
QStringList args("--get-plugin-list");
responseJson = request(m_Email, m_Password, args);
}
catch (std::exception& e)
{
emit error(tr("An error occured while trying to query the "
"plugin list. Please contact the help desk, and "
"provide the following details.\n\n%1").arg(e.what()));
return;
}
QRegExp resultRegex(".*\"result\".*:.*(true|false).*");
if (resultRegex.exactMatch(responseJson)) {
QString boolString = resultRegex.cap(1);
if (boolString == "true") {
QRegExp editionRegex(".*\"plugins\".*:.*\"([^\"]+)\".*");
if (editionRegex.exactMatch(responseJson)) {
QString e = editionRegex.cap(1);
m_PluginList = e.split(",");
}
emit queryPluginDone();
return;
}
else if (boolString == "false") {
emit error(tr("Get plugin list failed, invalid user email "
"or password."));
return;
}
}
else {
QRegExp errorRegex(".*\"error\".*:.*\"([^\"]+)\".*");
if (errorRegex.exactMatch(responseJson)) {
// replace "\n" with real new lines.
QString e = errorRegex.cap(1).replace("\\n", "\n");
emit error(tr("Get plugin list failed, an error occurred."
"\n\n%1").arg(e));
return;
}
}
emit error(tr("Get plugin list failed, an error occurred.\n\n"
"Server response:\n\n%1").arg(responseJson));
return;
}
QString WebClient::request(
const QString& email,
const QString& password,
QStringList& args)
{
// hash password in case it contains interesting chars.
QString credentials(email + ":" + hash(password) + "\n");
return m_CoreInterface.run(args, credentials);
}

63
src/gui/src/WebClient.h Normal file
View File

@@ -0,0 +1,63 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Si, Std.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WEBCLIENT_H
#define WEBCLIENT_H
#include <QString>
#include <QStringList>
#include <QObject>
#include "CoreInterface.h"
class QMessageBox;
class QWidget;
class QStringList;
class WebClient : public QObject
{
Q_OBJECT
public:
int getEdition(const QString& email,
const QString& password,
QMessageBox& message,
QWidget* w);
void setEmail(QString& e) { m_Email = e; }
void setPassword(QString& p) { m_Password = p; }
QStringList& getPluginList() { return m_PluginList; }
public slots:
void queryPluginList();
signals:
void error(QString e);
void queryPluginDone();
private:
QString request(const QString& email,
const QString& password,
QStringList& args);
private:
QString m_Email;
QString m_Password;
QStringList m_PluginList;
CoreInterface m_CoreInterface;
};
#endif // WEBCLIENT_H

View File

@@ -32,10 +32,6 @@
#if defined(Q_OS_MAC)
#include <Carbon/Carbon.h>
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
#include "AXDatabaseCleaner.h"
#endif
#endif
class QThreadImpl : public QThread

View File

@@ -23,9 +23,11 @@ add_subdirectory(ipc)
add_subdirectory(mt)
add_subdirectory(net)
add_subdirectory(platform)
add_subdirectory(plugin)
add_subdirectory(server)
add_subdirectory(synergy)
if (WIN32)
add_subdirectory(synwinhk)
endif()

View File

@@ -30,6 +30,11 @@ Arch::Arch()
s_instance = this;
}
Arch::Arch(Arch* arch)
{
s_instance = arch;
}
Arch::~Arch()
{
#if SYSAPI_WIN32

View File

@@ -99,6 +99,7 @@ class Arch : public ARCH_CONSOLE,
public ARCH_TIME {
public:
Arch();
Arch(Arch* arch);
virtual ~Arch();
//! Call init on other arch classes.
@@ -119,6 +120,8 @@ public:
*/
static Arch* getInstance();
static void setInstance(Arch* s) { s_instance = s; }
ARCH_PLUGIN& plugin() const { return (ARCH_PLUGIN&)m_plugin; }
ARCH_INTERNET& internet() const { return (ARCH_INTERNET&)m_internet; }

View File

@@ -50,5 +50,5 @@ endif()
add_library(arch STATIC ${sources})
if (UNIX)
target_link_libraries(arch ${libs})
target_link_libraries(arch dl ${libs})
endif()

View File

@@ -20,6 +20,7 @@
#include "common/IInterface.h"
#include "common/stdstring.h"
#include "base/String.h"
//! Interface for architecture dependent file system operations
/*!
@@ -62,6 +63,21 @@ public:
*/
virtual std::string getLogDirectory() = 0;
//! Get plugins directory
/*!
Returns the plugin files directory. If no plugin directory is set,
this will return the plugin folder within the user's profile.
*/
virtual std::string getPluginDirectory() = 0;
//! Get user's profile directory
/*!
Returns the user's profile directory. If no profile directory is set,
this will return the user's profile according to the operating system,
which will depend on which user launched the program.
*/
virtual std::string getProfileDirectory() = 0;
//! Concatenate path components
/*!
Concatenate pathname components with a directory separator
@@ -72,6 +88,18 @@ public:
virtual std::string concatPath(
const std::string& prefix,
const std::string& suffix) = 0;
//@}
//! Set the user's profile directory
/*
Returns the user's profile directory.
*/
virtual void setProfileDirectory(const String& s) = 0;
//@}
//! Set the user's plugin directory
/*
Returns the user's plugin directory.
*/
virtual void setPluginDirectory(const String& s) = 0;
};

View File

@@ -18,9 +18,9 @@
#pragma once
#define PLUGINS_DIR "plugins"
#include "common/IInterface.h"
#include "common/stdmap.h"
#include "base/String.h"
class IEventQueue;
@@ -34,11 +34,46 @@ public:
//! @name manipulators
//@{
//! Load plugins
//!Load plugins
/*!
Scan the plugins dir and load plugins.
*/
virtual void init(void* eventTarget, IEventQueue* events) = 0;
virtual void load() = 0;
//!Unload plugins
/*!
Look through the loaded plugins and unload them.
*/
virtual void unload() = 0;
//! Init the common parts
/*!
Initializes common parts like log and arch.
*/
virtual void init(void* log, void* arch) = 0;
//! Init the event part
/*!
Initializes event parts.
*/
virtual void initEvent(void* eventTarget, IEventQueue* events) = 0;
//! Check if exists
/*!
Returns true if the plugin exists and is loaded.
*/
virtual bool exists(const char* name) = 0;
//! Invoke function
/*!
Invokes a function from the plugin.
*/
virtual void* invoke(const char* plugin,
const char* command,
void** args) = 0;
//@}
protected:
typedef std::map<String, void*> PluginTable;
};

View File

@@ -104,6 +104,38 @@ ArchFileUnix::getLogDirectory()
return "/var/log";
}
std::string
ArchFileUnix::getPluginDirectory()
{
if (!m_pluginDirectory.empty()) {
return m_pluginDirectory;
}
#if WINAPI_XWINDOWS
return getProfileDirectory().append("/plugins");
#else
return getProfileDirectory().append("/Plugins");
#endif
}
std::string
ArchFileUnix::getProfileDirectory()
{
String dir;
if (!m_profileDirectory.empty()) {
dir = m_profileDirectory;
}
else {
#if WINAPI_XWINDOWS
dir = getUserDirectory().append("/.synergy");
#else
dir = getUserDirectory().append("/Library/Synergy");
#endif
}
return dir;
}
std::string
ArchFileUnix::concatPath(const std::string& prefix,
const std::string& suffix)
@@ -117,3 +149,15 @@ ArchFileUnix::concatPath(const std::string& prefix,
path += suffix;
return path;
}
void
ArchFileUnix::setProfileDirectory(const String& s)
{
m_profileDirectory = s;
}
void
ArchFileUnix::setPluginDirectory(const String& s)
{
m_pluginDirectory = s;
}

View File

@@ -34,6 +34,14 @@ public:
virtual std::string getSystemDirectory();
virtual std::string getInstalledDirectory();
virtual std::string getLogDirectory();
virtual std::string getPluginDirectory();
virtual std::string getProfileDirectory();
virtual std::string concatPath(const std::string& prefix,
const std::string& suffix);
virtual void setProfileDirectory(const String& s);
virtual void setPluginDirectory(const String& s);
private:
String m_profileDirectory;
String m_pluginDirectory;
};

View File

@@ -18,6 +18,24 @@
#include "arch/unix/ArchPluginUnix.h"
#include "arch/unix/XArchUnix.h"
#include "base/IEventQueue.h"
#include "base/Event.h"
#include "base/Log.h"
#include <vector>
#include <sys/types.h>
#include <dirent.h>
#include <dlfcn.h>
typedef void (*initFunc)(void*, void*);
typedef int (*initEventFunc)(void (*sendEvent)(const char*, void*));
typedef void* (*invokeFunc)(const char*, void*);
typedef void (*cleanupFunc)();
void* g_eventTarget = NULL;
IEventQueue* g_events = NULL;
ArchPluginUnix::ArchPluginUnix()
{
}
@@ -27,6 +45,149 @@ ArchPluginUnix::~ArchPluginUnix()
}
void
ArchPluginUnix::init(void* eventTarget, IEventQueue* events)
ArchPluginUnix::load()
{
String pluginsDir = getPluginsDir();
LOG((CLOG_DEBUG "plugins dir: %s", pluginsDir.c_str()));
struct dirent* de = NULL;
DIR* dir = NULL;
dir = opendir(pluginsDir.c_str());
if (dir == NULL) {
LOG((CLOG_DEBUG "can't open plugins dir: %s",
pluginsDir.c_str()));
return;
}
std::vector<String> plugins;
while ((de = readdir(dir)) != NULL) {
// ignore hidden files and diretories like .. and .
if (de->d_name[0] != '.') {
plugins.push_back(de->d_name);
}
}
closedir(dir);
std::vector<String>::iterator it;
for (it = plugins.begin(); it != plugins.end(); ++it) {
LOG((CLOG_DEBUG "loading plugin: %s", (*it).c_str()));
String path = String(getPluginsDir()).append("/").append(*it);
void* library = dlopen(path.c_str(), RTLD_LAZY);
if (library == NULL) {
LOG((CLOG_ERR "failed to load plugin: %s", (*it).c_str()));
throw XArch(dlerror());
}
String filename = synergy::string::removeFileExt(*it);
m_pluginTable.insert(std::make_pair(filename, library));
LOG((CLOG_DEBUG "loaded plugin: %s", (*it).c_str()));
}
}
void
ArchPluginUnix::unload()
{
PluginTable::iterator it;
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
cleanupFunc cleanup = (cleanupFunc)dlsym(it->second, "cleanup");
if (cleanup != NULL) {
cleanup();
}
else {
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
}
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
dlclose(it->second);
}
}
void
ArchPluginUnix::init(void* log, void* arch)
{
PluginTable::iterator it;
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
initFunc initPlugin = (initFunc)dlsym(it->second, "init");
if (initPlugin != NULL) {
initPlugin(log, arch);
}
else {
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
}
}
}
void
ArchPluginUnix::initEvent(void* eventTarget, IEventQueue* events)
{
g_eventTarget = eventTarget;
g_events = events;
PluginTable::iterator it;
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
initEventFunc initEventPlugin = (initEventFunc)dlsym(it->second, "initEvent");
if (initEventPlugin != NULL) {
initEventPlugin(&sendEvent);
}
else {
LOG((CLOG_DEBUG "no init event function in %s", it->first.c_str()));
}
}
}
bool
ArchPluginUnix::exists(const char* name)
{
PluginTable::iterator it;
it = m_pluginTable.find(name);
return it != m_pluginTable.end() ? true : false;
}
void*
ArchPluginUnix::invoke(
const char* plugin,
const char* command,
void** args)
{
PluginTable::iterator it;
it = m_pluginTable.find(plugin);
if (it != m_pluginTable.end()) {
invokeFunc invokePlugin = (invokeFunc)dlsym(it->second, "invoke");
void* result = NULL;
if (invokePlugin != NULL) {
result = invokePlugin(command, args);
}
else {
LOG((CLOG_DEBUG "no invoke function in %s", it->first.c_str()));
}
return result;
}
else {
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
plugin, command));
return NULL;
}
}
String
ArchPluginUnix::getPluginsDir()
{
return ARCH->getPluginDirectory();
}
void
sendEvent(const char* eventName, void* data)
{
LOG((CLOG_DEBUG5 "plugin sending event"));
Event::Type type = g_events->getRegisteredType(eventName);
g_events->addEvent(Event(type, g_eventTarget, data));
}
void
log(const char* text)
{
LOG((CLOG_DEBUG "plugin: %s", text));
}

View File

@@ -31,5 +31,21 @@ public:
virtual ~ArchPluginUnix();
// IArchPlugin overrides
void init(void* eventTarget, IEventQueue* events);
void load();
void unload();
void init(void* log, void* arch);
void initEvent(void* eventTarget, IEventQueue* events);
bool exists(const char* name);
virtual void* invoke(const char* pluginName,
const char* functionName,
void** args);
private:
String getPluginsDir();
private:
PluginTable m_pluginTable;
};
void sendEvent(const char* text, void* data);
void log(const char* text);

View File

@@ -139,6 +139,41 @@ ArchFileWindows::getLogDirectory()
return getInstalledDirectory();
}
std::string
ArchFileWindows::getPluginDirectory()
{
if (!m_pluginDirectory.empty()) {
return m_pluginDirectory;
}
std::string dir = getProfileDirectory();
dir.append("\\Plugins");
return dir;
}
std::string
ArchFileWindows::getProfileDirectory()
{
String dir;
if (!m_profileDirectory.empty()) {
dir = m_profileDirectory;
}
else {
TCHAR result[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, result))) {
dir = result;
}
else {
dir = getUserDirectory();
}
}
// HACK: append program name, this seems wrong.
dir.append("\\Synergy");
return dir;
}
std::string
ArchFileWindows::concatPath(const std::string& prefix,
const std::string& suffix)
@@ -154,3 +189,15 @@ ArchFileWindows::concatPath(const std::string& prefix,
path += suffix;
return path;
}
void
ArchFileWindows::setProfileDirectory(const String& s)
{
m_profileDirectory = s;
}
void
ArchFileWindows::setPluginDirectory(const String& s)
{
m_pluginDirectory = s;
}

View File

@@ -34,6 +34,14 @@ public:
virtual std::string getSystemDirectory();
virtual std::string getInstalledDirectory();
virtual std::string getLogDirectory();
virtual std::string getPluginDirectory();
virtual std::string getProfileDirectory();
virtual std::string concatPath(const std::string& prefix,
const std::string& suffix);
virtual void setProfileDirectory(const String& s);
virtual void setPluginDirectory(const String& s);
private:
String m_profileDirectory;
String m_pluginDirectory;
};

View File

@@ -27,7 +27,10 @@
#include <Windows.h>
#include <iostream>
typedef int (*initFunc)(void (*sendEvent)(const char*, void*), void (*log)(const char*));
typedef void (*initFunc)(void*, void*);
typedef int (*initEventFunc)(void (*sendEvent)(const char*, void*));
typedef void* (*invokeFunc)(const char*, void**);
typedef void (*cleanupFunc)();
void* g_eventTarget = NULL;
IEventQueue* g_events = NULL;
@@ -41,11 +44,8 @@ ArchPluginWindows::~ArchPluginWindows()
}
void
ArchPluginWindows::init(void* eventTarget, IEventQueue* events)
ArchPluginWindows::load()
{
g_eventTarget = eventTarget;
g_events = events;
String dir = getPluginsDir();
LOG((CLOG_DEBUG "plugins dir: %s", dir.c_str()));
@@ -54,39 +54,116 @@ ArchPluginWindows::init(void* eventTarget, IEventQueue* events)
getFilenames(pattern, plugins);
std::vector<String>::iterator it;
for (it = plugins.begin(); it != plugins.end(); ++it)
load(*it);
for (it = plugins.begin(); it != plugins.end(); ++it) {
LOG((CLOG_DEBUG "loading plugin: %s", (*it).c_str()));
String path = String(dir).append("\\").append(*it);
HINSTANCE library = LoadLibrary(path.c_str());
if (library == NULL) {
LOG((CLOG_ERR "failed to load plugin: %s %d", (*it).c_str(), GetLastError()));
throw XArch(new XArchEvalWindows);
}
void* lib = reinterpret_cast<void*>(library);
String filename = synergy::string::removeFileExt(*it);
m_pluginTable.insert(std::make_pair(filename, lib));
LOG((CLOG_DEBUG "loaded plugin: %s", (*it).c_str()));
}
}
void
ArchPluginWindows::load(const String& dllFilename)
ArchPluginWindows::unload()
{
LOG((CLOG_DEBUG "loading plugin: %s", dllFilename.c_str()));
String path = String(getPluginsDir()).append("\\").append(dllFilename);
HINSTANCE library = LoadLibrary(path.c_str());
if (library == NULL)
throw XArch(new XArchEvalWindows);
PluginTable::iterator it;
HINSTANCE lib;
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
lib = reinterpret_cast<HINSTANCE>(it->second);
cleanupFunc cleanup = (cleanupFunc)GetProcAddress(lib, "cleanup");
if (cleanup != NULL) {
cleanup();
}
else {
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
}
initFunc initPlugin = (initFunc)GetProcAddress(library, "init");
initPlugin(&sendEvent, &log);
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
FreeLibrary(lib);
}
}
String
ArchPluginWindows::getModuleDir()
void
ArchPluginWindows::init(void* log, void* arch)
{
TCHAR c_modulePath[MAX_PATH];
if (GetModuleFileName(NULL, c_modulePath, MAX_PATH) == 0) {
throw XArch(new XArchEvalWindows);
PluginTable::iterator it;
HINSTANCE lib;
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
lib = reinterpret_cast<HINSTANCE>(it->second);
initFunc initPlugin = (initFunc)GetProcAddress(lib, "init");
if (initPlugin != NULL) {
initPlugin(log, arch);
}
else {
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
}
}
}
String modulePath(c_modulePath);
size_t lastSlash = modulePath.find_last_of("\\");
void
ArchPluginWindows::initEvent(void* eventTarget, IEventQueue* events)
{
g_eventTarget = eventTarget;
g_events = events;
if (lastSlash != String::npos) {
return modulePath.substr(0, lastSlash);
PluginTable::iterator it;
HINSTANCE lib;
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
lib = reinterpret_cast<HINSTANCE>(it->second);
initEventFunc initEventPlugin = (initEventFunc)GetProcAddress(lib, "initEvent");
if (initEventPlugin != NULL) {
initEventPlugin(&sendEvent);
}
else {
LOG((CLOG_DEBUG "no init event function in %s", it->first.c_str()));
}
}
}
throw XArch("could not get module path.");
bool
ArchPluginWindows::exists(const char* name)
{
PluginTable::iterator it;
it = m_pluginTable.find(name);
return it != m_pluginTable.end() ? true : false;
}
void*
ArchPluginWindows::invoke(
const char* plugin,
const char* command,
void** args)
{
PluginTable::iterator it;
it = m_pluginTable.find(plugin);
if (it != m_pluginTable.end()) {
HINSTANCE lib = reinterpret_cast<HINSTANCE>(it->second);
invokeFunc invokePlugin = (invokeFunc)GetProcAddress(lib, "invoke");
void* result = NULL;
if (invokePlugin != NULL) {
result = invokePlugin(command, args);
}
else {
LOG((CLOG_DEBUG "no invoke function in %s", it->first.c_str()));
}
return result;
}
else {
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
plugin, command));
return NULL;
}
}
void
@@ -109,7 +186,7 @@ ArchPluginWindows::getFilenames(const String& pattern, std::vector<String>& file
String ArchPluginWindows::getPluginsDir()
{
return getModuleDir().append("\\").append(PLUGINS_DIR);
return ARCH->getPluginDirectory();
}
void

View File

@@ -19,7 +19,6 @@
#pragma once
#include "arch/IArchPlugin.h"
#include "base/String.h"
#include <vector>
@@ -35,13 +34,21 @@ public:
virtual ~ArchPluginWindows();
// IArchPlugin overrides
void init(void* eventTarget, IEventQueue* events);
void load();
void unload();
void init(void* log, void* arch);
void initEvent(void* eventTarget, IEventQueue* events);
bool exists(const char* name);
void* invoke(const char* pluginName,
const char* functionName,
void** args);
private:
String getModuleDir();
void getFilenames(const String& pattern, std::vector<String>& filenames);
void load(const String& dllPath);
String getPluginsDir();
private:
PluginTable m_pluginTable;
};
void sendEvent(const char* text, void* data);

View File

@@ -95,6 +95,7 @@ REGISTER_EVENT(IListenSocket, connecting)
//
REGISTER_EVENT(ISocket, disconnected)
REGISTER_EVENT(ISocket, stopRetry)
//
// OSXScreen

View File

@@ -281,7 +281,8 @@ private:
class ISocketEvents : public EventTypes {
public:
ISocketEvents() :
m_disconnected(Event::kUnknown) { }
m_disconnected(Event::kUnknown),
m_stopRetry(Event::kUnknown) { }
//! @name accessors
//@{
@@ -294,10 +295,18 @@ public:
*/
Event::Type disconnected();
//! Get stop retry event type
/*!
Returns the stop retry event type. This is sent when the client
doesn't want to reconnect after it disconnects from the server.
*/
Event::Type stopRetry();
//@}
private:
Event::Type m_disconnected;
Event::Type m_stopRetry;
};
class OSXScreenEvents : public EventTypes {

View File

@@ -74,6 +74,11 @@ Log::Log()
s_log = this;
}
Log::Log(Log* src)
{
s_log = src;
}
Log::~Log()
{
// clean up

View File

@@ -41,6 +41,7 @@ LOGC() provide convenient access.
class Log {
public:
Log();
Log(Log* src);
~Log();
//! @name manipulators

View File

@@ -27,6 +27,9 @@
#include <algorithm>
#include <stdio.h>
#include <cstdarg>
#include <sstream>
#include <iomanip>
#include <algorithm>
namespace synergy {
namespace string {
@@ -168,6 +171,41 @@ findReplaceAll(
}
}
String
removeFileExt(String filename)
{
size_t dot = filename.find_last_of('.');
if (dot == String::npos) {
return filename;
}
return filename.substr(0, dot);
}
void
toHex(String& subject, int width, const char fill)
{
std::stringstream ss;
ss << std::hex;
for (unsigned int i = 0; i < subject.length(); i++) {
ss << std::setw(width) << std::setfill(fill) << (int)(unsigned char)subject[i];
}
subject = ss.str();
}
void
uppercase(String& subject)
{
std::transform(subject.begin(), subject.end(), subject.begin(), ::toupper);
}
void
removeChar(String& subject, const char c)
{
subject.erase(std::remove(subject.begin(), subject.end(), c), subject.end());
}
//
// CaselessCmp

View File

@@ -64,6 +64,31 @@ Finds \c find inside \c subject and replaces it with \c replace
*/
void findReplaceAll(String& subject, const String& find, const String& replace);
//! Remove file extension
/*!
Finds the last dot and remove all characters from the dot to the end
*/
String removeFileExt(String filename);
//! Convert into hexdecimal
/*!
Convert each character in \c subject into hexdecimal form with \c width
*/
void toHex(String& subject, int width, const char fill = '0');
//! Convert to all uppercase
/*!
Convert each character in \c subject to uppercase
*/
void uppercase(String& subject);
//! Remove all specific char in suject
/*!
Remove all specific \c char in \c suject
*/
void removeChar(String& subject, const char c);
//! Case-insensitive comparisons
/*!
This class provides case-insensitve comparison functions.

View File

@@ -18,6 +18,7 @@
#include "client/Client.h"
#include "../plugin/ns/SecureSocket.h"
#include "client/ServerProxy.h"
#include "synergy/Screen.h"
#include "synergy/Clipboard.h"
@@ -29,8 +30,7 @@
#include "synergy/FileChunker.h"
#include "synergy/IPlatformScreen.h"
#include "mt/Thread.h"
#include "io/IStreamFilterFactory.h"
#include "io/CryptoStream.h"
#include "net/TCPSocket.h"
#include "net/IDataSocket.h"
#include "net/ISocketFactory.h"
#include "arch/Arch.h"
@@ -45,6 +45,12 @@
#include <sstream>
#include <fstream>
#if defined _WIN32
static const char s_networkSecurity[] = { "ns" };
#else
static const char s_networkSecurity[] = { "libns" };
#endif
//
// Client
//
@@ -53,15 +59,12 @@ Client::Client(
IEventQueue* events,
const String& name, const NetworkAddress& address,
ISocketFactory* socketFactory,
IStreamFilterFactory* streamFilterFactory,
synergy::Screen* screen,
const CryptoOptions& crypto,
bool enableDragDrop) :
ClientArgs& args) :
m_mock(false),
m_name(name),
m_serverAddress(address),
m_socketFactory(socketFactory),
m_streamFilterFactory(streamFilterFactory),
m_screen(screen),
m_stream(NULL),
m_timer(NULL),
@@ -71,11 +74,11 @@ Client::Client(
m_suspended(false),
m_connectOnResume(false),
m_events(events),
m_cryptoStream(NULL),
m_crypto(crypto),
m_sendFileThread(NULL),
m_writeToDropDirThread(NULL),
m_enableDragDrop(enableDragDrop)
m_socket(NULL),
m_useSecureNetwork(false),
m_args(args)
{
assert(m_socketFactory != NULL);
assert(m_screen != NULL);
@@ -90,7 +93,7 @@ Client::Client(
new TMethodEventJob<Client>(this,
&Client::handleResume));
if (m_enableDragDrop) {
if (m_args.m_enableDragDrop) {
m_events->adoptHandler(m_events->forIScreen().fileChunkSending(),
this,
new TMethodEventJob<Client>(this,
@@ -100,6 +103,13 @@ Client::Client(
new TMethodEventJob<Client>(this,
&Client::handleFileRecieveCompleted));
}
if (m_args.m_enableCrypto) {
m_useSecureNetwork = ARCH->plugin().exists(s_networkSecurity);
if (m_useSecureNetwork == false) {
LOG((CLOG_NOTE "crypto disabled because of ns plugin not available"));
}
}
}
Client::~Client()
@@ -118,7 +128,6 @@ Client::~Client()
cleanupConnecting();
cleanupConnection();
delete m_socketFactory;
delete m_streamFilterFactory;
}
void
@@ -150,20 +159,13 @@ Client::connect()
}
// create the socket
IDataSocket* socket = m_socketFactory->create();
IDataSocket* socket = m_socketFactory->create(m_useSecureNetwork);
m_socket = dynamic_cast<TCPSocket*>(socket);
// filter socket messages, including a packetizing filter
m_stream = socket;
if (m_streamFilterFactory != NULL) {
m_stream = m_streamFilterFactory->create(m_stream, true);
}
m_stream = new PacketStreamFilter(m_events, m_stream, true);
if (m_crypto.m_mode != kDisabled) {
m_cryptoStream = new CryptoStream(
m_events, m_stream, m_crypto, true);
m_stream = m_cryptoStream;
}
bool adopt = !m_useSecureNetwork;
m_stream = new PacketStreamFilter(m_events, m_stream, adopt);
// connect
LOG((CLOG_DEBUG1 "connecting to server"));
@@ -174,8 +176,7 @@ Client::connect()
catch (XBase& e) {
cleanupTimer();
cleanupConnecting();
delete m_stream;
m_stream = NULL;
cleanupStream();
LOG((CLOG_DEBUG1 "connection failed"));
sendConnectionFailedEvent(e.what());
return;
@@ -206,14 +207,6 @@ Client::handshakeComplete()
sendEvent(m_events->forClient().connected(), NULL);
}
void
Client::setDecryptIv(const UInt8* iv)
{
if (m_cryptoStream != NULL) {
m_cryptoStream->setDecryptIv(iv);
}
}
bool
Client::isConnected() const
{
@@ -477,6 +470,10 @@ Client::setupConnection()
m_stream->getEventTarget(),
new TMethodEventJob<Client>(this,
&Client::handleDisconnected));
m_events->adoptHandler(m_events->forISocket().stopRetry(),
m_stream->getEventTarget(),
new TMethodEventJob<Client>(this, &Client::handleStopRetry));
}
void
@@ -532,8 +529,9 @@ Client::cleanupConnection()
m_stream->getEventTarget());
m_events->removeHandler(m_events->forISocket().disconnected(),
m_stream->getEventTarget());
delete m_stream;
m_stream = NULL;
m_events->removeHandler(m_events->forISocket().stopRetry(),
m_stream->getEventTarget());
cleanupStream();
}
}
@@ -564,6 +562,20 @@ Client::cleanupTimer()
}
}
void
Client::cleanupStream()
{
delete m_stream;
m_stream = NULL;
// PacketStreamFilter doen't adopt secure socket, because
// we need to tell the dynamic lib that allocated this object
// to do the deletion.
if (m_useSecureNetwork) {
ARCH->plugin().invoke(s_networkSecurity, "deleteSocket", NULL);
}
}
void
Client::handleConnected(const Event&, void*)
{
@@ -577,6 +589,8 @@ Client::handleConnected(const Event&, void*)
m_sentClipboard[id] = false;
m_timeClipboard[id] = 0;
}
m_socket->secureConnect();
}
void
@@ -587,8 +601,7 @@ Client::handleConnectionFailed(const Event& event, void*)
cleanupTimer();
cleanupConnecting();
delete m_stream;
m_stream = NULL;
cleanupStream();
LOG((CLOG_DEBUG1 "connection failed"));
sendConnectionFailedEvent(info->m_what.c_str());
delete info;
@@ -600,8 +613,7 @@ Client::handleConnectTimeout(const Event&, void*)
cleanupTimer();
cleanupConnecting();
cleanupConnection();
delete m_stream;
m_stream = NULL;
cleanupStream();
LOG((CLOG_DEBUG1 "connection timed out"));
sendConnectionFailedEvent("Timed out");
}
@@ -659,7 +671,7 @@ Client::handleHello(const Event&, void*)
{
SInt16 major, minor;
if (!ProtocolUtil::readf(m_stream, kMsgHello, &major, &minor)) {
sendConnectionFailedEvent("Protocol error from server");
sendConnectionFailedEvent("Protocol error from server, check encryption settings");
cleanupTimer();
cleanupConnection();
return;
@@ -737,6 +749,11 @@ Client::onFileRecieveCompleted()
}
}
void
Client::handleStopRetry(const Event&, void*)
{
m_args.m_restartable = false;
}
void
Client::writeToDropDirThread(void*)
@@ -773,7 +790,8 @@ Client::fileChunkReceived(String data)
void
Client::dragInfoReceived(UInt32 fileNum, String data)
{
if (!m_enableDragDrop) {
// TODO: fix duplicate function from CServer
if (!m_args.m_enableDragDrop) {
LOG((CLOG_DEBUG "drag drop not enabled, ignoring drag info."));
return;
}

View File

@@ -23,8 +23,8 @@
#include "synergy/IClipboard.h"
#include "synergy/DragInformation.h"
#include "synergy/INode.h"
#include "synergy/ClientArgs.h"
#include "net/NetworkAddress.h"
#include "io/CryptoOptions.h"
#include "base/EventTypes.h"
class EventQueueTimer;
@@ -33,10 +33,9 @@ class ServerProxy;
class IDataSocket;
class ISocketFactory;
namespace synergy { class IStream; }
class IStreamFilterFactory;
class IEventQueue;
class CryptoStream;
class Thread;
class TCPSocket;
//! Synergy client
/*!
@@ -60,15 +59,9 @@ public:
Client(IEventQueue* events,
const String& name, const NetworkAddress& address,
ISocketFactory* socketFactory,
IStreamFilterFactory* streamFilterFactory,
synergy::Screen* screen,
const CryptoOptions& crypto,
bool enableDragDrop);
ClientArgs& args);
~Client();
#ifdef TEST_ENV
Client() : m_mock(true) { }
#endif
//! @name manipulators
//@{
@@ -92,9 +85,6 @@ public:
*/
virtual void handshakeComplete();
//! Set crypto IV for decryption
virtual void setDecryptIv(const UInt8* iv);
//! Clears the file buffer
void clearReceivedFileData();
@@ -189,6 +179,7 @@ private:
void cleanupConnection();
void cleanupScreen();
void cleanupTimer();
void cleanupStream();
void handleConnected(const Event&, void*);
void handleConnectionFailed(const Event&, void*);
void handleConnectTimeout(const Event&, void*);
@@ -201,36 +192,36 @@ private:
void handleResume(const Event& event, void*);
void handleFileChunkSending(const Event&, void*);
void handleFileRecieveCompleted(const Event&, void*);
void handleStopRetry(const Event&, void*);
void onFileRecieveCompleted();
public:
bool m_mock;
bool m_mock;
private:
String m_name;
NetworkAddress m_serverAddress;
ISocketFactory* m_socketFactory;
IStreamFilterFactory* m_streamFilterFactory;
synergy::Screen* m_screen;
synergy::IStream* m_stream;
EventQueueTimer* m_timer;
ServerProxy* m_server;
bool m_ready;
bool m_active;
bool m_suspended;
bool m_connectOnResume;
bool m_ownClipboard[kClipboardEnd];
bool m_sentClipboard[kClipboardEnd];
IClipboard::Time m_timeClipboard[kClipboardEnd];
String m_dataClipboard[kClipboardEnd];
IEventQueue* m_events;
CryptoStream* m_cryptoStream;
CryptoOptions m_crypto;
std::size_t m_expectedFileSize;
String m_receivedFileData;
DragFileList m_dragFileList;
String m_dragFileExt;
String m_name;
NetworkAddress m_serverAddress;
ISocketFactory* m_socketFactory;
synergy::Screen* m_screen;
synergy::IStream* m_stream;
EventQueueTimer* m_timer;
ServerProxy* m_server;
bool m_ready;
bool m_active;
bool m_suspended;
bool m_connectOnResume;
bool m_ownClipboard[kClipboardEnd];
bool m_sentClipboard[kClipboardEnd];
IClipboard::Time m_timeClipboard[kClipboardEnd];
String m_dataClipboard[kClipboardEnd];
IEventQueue* m_events;
std::size_t m_expectedFileSize;
String m_receivedFileData;
DragFileList m_dragFileList;
String m_dragFileExt;
Thread* m_sendFileThread;
Thread* m_writeToDropDirThread;
bool m_enableDragDrop;
TCPSocket* m_socket;
bool m_useSecureNetwork;
ClientArgs& m_args;
};

View File

@@ -24,7 +24,6 @@
#include "synergy/option_types.h"
#include "synergy/protocol_types.h"
#include "io/IStream.h"
#include "io/CryptoStream.h"
#include "base/Log.h"
#include "base/IEventQueue.h"
#include "base/TMethodEventJob.h"
@@ -295,10 +294,6 @@ ServerProxy::parseMessage(const UInt8* code)
setOptions();
}
else if (memcmp(code, kMsgDCryptoIv, 4) == 0) {
cryptoIv();
}
else if (memcmp(code, kMsgDFileTransfer, 4) == 0) {
fileChunkReceived();
}
@@ -763,18 +758,6 @@ ServerProxy::mouseWheel()
m_client->mouseWheel(xDelta, yDelta);
}
void
ServerProxy::cryptoIv()
{
// parse
String s;
ProtocolUtil::readf(m_stream, kMsgDCryptoIv + 4, &s);
LOG((CLOG_DEBUG2 "recv crypto iv size=%i", s.size()));
// forward
m_client->setDecryptIv(reinterpret_cast<const UInt8*>(s.c_str()));
}
void
ServerProxy::screensaver()
{

View File

@@ -99,7 +99,6 @@ private:
void mouseMove();
void mouseRelativeMove();
void mouseWheel();
void cryptoIv();
void screensaver();
void resetOptions();
void setOptions();

View File

@@ -23,7 +23,6 @@ endif()
include_directories(
../
../../../ext
)
if (UNIX)
@@ -33,7 +32,3 @@ if (UNIX)
endif()
add_library(io STATIC ${sources})
if (UNIX)
target_link_libraries(io cryptopp)
endif()

View File

@@ -1,100 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "io/CryptoMode.h"
#include "io/XIO.h"
using namespace CryptoPP;
CryptoMode::CryptoMode(ECryptoMode mode, bool encryption) :
m_mode(mode),
m_crypto(NULL),
m_encryption(encryption)
{
if (m_encryption) {
switch (m_mode) {
case kCfb:
m_crypto = new CfbModeEnc;
break;
case kDisabled:
break;
default:
throw XIOBadCryptoMode();
}
}
else {
switch (m_mode) {
case kCfb:
m_crypto = new CfbModeDec;
break;
case kDisabled:
break;
default:
throw XIOBadCryptoMode();
}
}
}
CryptoMode::~CryptoMode()
{
if (m_crypto == NULL) {
return;
}
if (m_encryption) {
delete reinterpret_cast<CfbModeEnc*>(m_crypto);
}
else {
delete reinterpret_cast<CfbModeDec*>(m_crypto);
}
}
void
CryptoMode::processData(byte* out, const byte* in, size_t length)
{
if (m_crypto == NULL) {
return;
}
if (m_encryption) {
reinterpret_cast<CfbModeEnc*>(m_crypto)->ProcessData(out, in, length);
}
else {
reinterpret_cast<CfbModeDec*>(m_crypto)->ProcessData(out, in, length);
}
}
void
CryptoMode::setKeyWithIv(const byte* key, size_t length, const byte* iv)
{
if (m_crypto == NULL) {
return;
}
if (m_encryption) {
reinterpret_cast<CfbModeEnc*>(m_crypto)->SetKeyWithIV(key, length, iv);
}
else {
reinterpret_cast<CfbModeDec*>(m_crypto)->SetKeyWithIV(key, length, iv);
}
}

View File

@@ -1,57 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "io/ECryptoMode.h"
#include "io/CryptoMode_cryptopp.h"
#include "base/String.h"
//! Encapsulation of modes
/*!
Polymorphism is tricky in Crypto++, so we encapsulate all crypto modes
and switch based on an enum for ctor, dtor and all functions.
*/
class CryptoMode {
public:
CryptoMode(ECryptoMode mode, bool encryption = true);
~CryptoMode();
//! Encrypt or decrypt data
void processData(byte* out, const byte* in, size_t length);
//! Variable length key and initialization vector
void setKeyWithIv(const byte* key, size_t length, const byte* iv);
private:
typedef CryptoPP::OFB_Mode<CryptoPP::AES>::Encryption OfbModeEnc;
typedef CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption CfbModeEnc;
typedef CryptoPP::CTR_Mode<CryptoPP::AES>::Encryption CtrModeEnc;
typedef CryptoPP::GCM<CryptoPP::AES>::Encryption GcmModeEnc;
typedef CryptoPP::OFB_Mode<CryptoPP::AES>::Decryption OfbModeDec;
typedef CryptoPP::CFB_Mode<CryptoPP::AES>::Decryption CfbModeDec;
typedef CryptoPP::CTR_Mode<CryptoPP::AES>::Decryption CtrModeDec;
typedef CryptoPP::GCM<CryptoPP::AES>::Decryption GcmModeDec;
static ECryptoMode parseMode(String& mode);
ECryptoMode m_mode;
void* m_crypto;
bool m_encryption;
};

View File

@@ -1,45 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "io/CryptoOptions.h"
#include "io/XIO.h"
CryptoOptions::CryptoOptions(
const String& modeString,
const String& pass) :
m_pass(pass),
m_mode(parseMode(modeString))
{
}
void
CryptoOptions::setMode(String modeString)
{
m_modeString = modeString;
m_mode = parseMode(modeString);
}
ECryptoMode
CryptoOptions::parseMode(String modeString)
{
if (modeString == "cfb") {
return kCfb;
}
else {
throw XIOBadCryptoMode();
}
}

View File

@@ -1,155 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "io/CryptoStream.h"
#include "io/CryptoOptions.h"
#include "base/Log.h"
#include <sstream>
#include <string>
#include <stdio.h>
using namespace CryptoPP;
using namespace synergy::crypto;
CryptoStream::CryptoStream(
IEventQueue* events,
synergy::IStream* stream,
const CryptoOptions& options,
bool adoptStream) :
StreamFilter(events, stream, adoptStream),
m_key(NULL),
m_encryption(options.m_mode, true),
m_decryption(options.m_mode, false)
{
LOG((CLOG_INFO "crypto mode: %s", options.m_modeString.c_str()));
m_key = new byte[kKeyLength];
if (!options.m_pass.empty()) {
createKey(m_key, options.m_pass, kKeyLength, static_cast<UInt8>(options.m_pass.length()));
byte iv[CRYPTO_IV_SIZE];
createKey(iv, options.m_pass, CRYPTO_IV_SIZE, static_cast<UInt8>(options.m_pass.length()) * 2);
setEncryptIv(iv);
setDecryptIv(iv);
}
}
CryptoStream::~CryptoStream()
{
delete[] m_key;
}
UInt32
CryptoStream::read(void* out, UInt32 n)
{
assert(m_key != NULL);
LOG((CLOG_DEBUG4 "crypto: read %i (decrypt)", n));
byte* cypher = new byte[n];
size_t result = getStream()->read(cypher, n);
if (result == 0) {
// nothing to read.
return 0;
}
if (result != n) {
LOG((CLOG_ERR "crypto: decrypt failed, only %i of %i bytes", result, n));
return 0;
}
logBuffer("cypher", cypher, n);
m_decryption.processData(static_cast<byte*>(out), cypher, n);
logBuffer("plaintext", static_cast<byte*>(out), n);
delete[] cypher;
return static_cast<UInt32>(result);
}
void
CryptoStream::write(const void* in, UInt32 n)
{
assert(m_key != NULL);
LOG((CLOG_DEBUG4 "crypto: write %i (encrypt)", n));
logBuffer("plaintext", static_cast<byte*>(const_cast<void*>(in)), n);
byte* cypher = new byte[n];
m_encryption.processData(cypher, static_cast<const byte*>(in), n);
logBuffer("cypher", cypher, n);
getStream()->write(cypher, n);
delete[] cypher;
}
void
CryptoStream::createKey(byte* out, const String& password, UInt8 keyLength, UInt8 hashCount)
{
assert(keyLength <= SHA256::DIGESTSIZE);
byte temp[SHA256::DIGESTSIZE];
byte* in = reinterpret_cast<byte*>(const_cast<char*>(password.c_str()));
SHA256().CalculateDigest(temp, in, password.length());
byte* tempKey = new byte[SHA256::DIGESTSIZE];
for (int i = 0; i < hashCount; ++i) {
memcpy(tempKey, temp, SHA256::DIGESTSIZE);
SHA256().CalculateDigest(temp, tempKey, SHA256::DIGESTSIZE);
}
delete[] tempKey;
memcpy(out, temp, keyLength);
}
void
CryptoStream::setEncryptIv(const byte* iv)
{
assert(m_key != NULL);
logBuffer("encrypt iv", iv, CRYPTO_IV_SIZE);
m_encryption.setKeyWithIv(m_key, kKeyLength, iv);
}
void
CryptoStream::setDecryptIv(const byte* iv)
{
assert(m_key != NULL);
logBuffer("decrypt iv", iv, CRYPTO_IV_SIZE);
m_decryption.setKeyWithIv(m_key, kKeyLength, iv);
}
void
CryptoStream::newIv(byte* out)
{
m_autoSeedRandomPool.GenerateBlock(out, CRYPTO_IV_SIZE);
}
void
CryptoStream::logBuffer(const char* name, const byte* buf, int length)
{
if (CLOG->getFilter() < kDEBUG4) {
return;
}
std::stringstream ss;
ss << "crypto: " << name << ":";
char buffer[4];
for (int i = 0; i < length; i++) {
sprintf(buffer, " %02X", buf[i]);
ss << buffer;
}
LOG((CLOG_DEBUG4 "%s", ss.str().c_str()));
}

View File

@@ -1,85 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "io/StreamFilter.h"
#include "io/CryptoMode.h"
#include "io/CryptoStream_cryptopp.h"
#include "base/EventTypes.h"
class CryptoOptions;
#define CRYPTO_IV_SIZE CryptoPP::AES::BLOCKSIZE
//! Bidirectional encrypted stream
/*!
Encrypts (on write) and decrypts (on read) to and from an underlying stream.
*/
class CryptoStream : public StreamFilter {
public:
CryptoStream(IEventQueue* events, synergy::IStream* stream, const CryptoOptions& options, bool adoptStream = true);
virtual ~CryptoStream();
//! @name manipulators
//@{
//! Read from stream
/*!
Read up to \p n bytes into \p buffer to the stream using encryption.
Returns the number of bytes read by the underlying stream.
*/
virtual UInt32 read(void* out, UInt32 n);
//! Write to stream
/*!
Write \c n bytes from \c buffer to the stream using encryption.
*/
virtual void write(const void* in, UInt32 n);
//! Set the IV for encryption
void setEncryptIv(const byte* iv);
//! Set the IV for decryption
void setDecryptIv(const byte* iv);
//! Get a new IV
/*!
Writes a new IV to the \c out buffer, and also uses the IV for further
crypto.
*/
void newIv(byte* out);
//! Creates a key from a password
static void createKey(byte* out, const String& password, UInt8 keyLength, UInt8 hashCount);
private:
void logBuffer(const char* name, const byte* buf, int length);
byte* m_key;
CryptoMode m_encryption;
CryptoMode m_decryption;
CryptoPP::AutoSeededRandomPool m_autoSeedRandomPool;
};
namespace synergy {
namespace crypto {
const UInt32 kKeyLength = 32;
}
}

View File

@@ -1,24 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2013 Synergy Si Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
enum ECryptoMode {
kDisabled,
kCfb,
kNumOfModes
};

View File

@@ -1,38 +0,0 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Synergy Si Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common/IInterface.h"
namespace synergy { class IStream; }
//! Stream filter factory interface
/*!
This interface provides factory methods to create stream filters.
*/
class IStreamFilterFactory : public IInterface {
public:
//! Create filter
/*!
Create and return a stream filter on \p stream. The caller must
delete the returned object.
*/
virtual synergy::IStream*
create(synergy::IStream* stream, bool adoptStream) = 0;
};

View File

@@ -49,13 +49,13 @@ public:
virtual bool isReady() const;
virtual UInt32 getSize() const;
protected:
//! Get the stream
/*!
Returns the stream passed to the c'tor.
*/
synergy::IStream* getStream() const;
protected:
//! Handle events from source stream
/*!
Does the event filtering. The default simply dispatches an event

View File

@@ -49,13 +49,3 @@ XIOWouldBlock::getWhat() const throw()
{
return format("XIOWouldBlock", "stream operation would block");
}
//
// XBadCryptoMode
//
String
XIOBadCryptoMode::getWhat() const throw()
{
return "XBadCryptoMode";
}

View File

@@ -47,9 +47,3 @@ XBASE_SUBCLASS_WHAT(XIOEndOfStream, XIO);
Thrown if an operation on a stream would block.
*/
XBASE_SUBCLASS_WHAT(XIOWouldBlock, XIO);
//! I/O bad crypto mode exception
/*!
Thrown when the user enters an invalid crypto mode.
*/
XBASE_SUBCLASS_WHAT(XIOBadCryptoMode, XIO);

View File

@@ -58,7 +58,7 @@ private:
private:
NetworkAddress m_serverAddress;
CTCPSocket m_socket;
TCPSocket m_socket;
IpcServerProxy* m_server;
IEventQueue* m_events;
};

View File

@@ -157,7 +157,6 @@ Thread::threadFunc(void* vjob)
job->run();
LOG((CLOG_DEBUG1 "thread 0x%08x exit", id));
}
catch (XThreadCancel&) {
// client called cancel()
LOG((CLOG_DEBUG1 "caught cancel on thread 0x%08x", id));

View File

@@ -39,7 +39,15 @@ public:
data stream. Returns NULL if no socket is waiting to be accepted.
This is only valid after a call to \c bind().
*/
virtual IDataSocket* accept() = 0;
virtual IDataSocket*
accept() = 0;
//! Delete connection socket
/*!
This is used when the socket was created but not adopted by a client
proxy.
*/
virtual void deleteSocket(void*) = 0;
//@}

View File

@@ -34,10 +34,10 @@ public:
//@{
//! Create data socket
virtual IDataSocket* create() const = 0;
virtual IDataSocket* create(bool secure) const = 0;
//! Create listen socket
virtual IListenSocket* createListen() const = 0;
virtual IListenSocket* createListen(bool secure) const = 0;
//@}
};

Some files were not shown because too many files have changed in this diff Show More