mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-28 05:35:52 +03:00
Removed remnants of synmacph tool #4398
This commit is contained in:
parent
3f3d452821
commit
5767790e1e
@ -788,12 +788,6 @@ class InternalCommands:
|
||||
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:
|
||||
|
||||
self.loadConfig()
|
||||
|
@ -100,9 +100,7 @@ HEADERS += src/MainWindow.h \
|
||||
src/CoreInterface.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
macx {
|
||||
HEADERS += src/AXDatabaseCleaner.h
|
||||
OBJECTIVE_SOURCES += src/AXDatabaseCleaner.mm
|
||||
macx {
|
||||
QMAKE_INFO_PLIST = res/mac/Info.plist
|
||||
TARGET = Synergy
|
||||
QSYNERGY_ICON.files = res/mac/Synergy.icns
|
||||
|
@ -17,9 +17,5 @@
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>synergy</string>
|
||||
<key>SMPrivilegedExecutables</key>
|
||||
<dict>
|
||||
<key>synmacph</key>
|
||||
<string>anchor apple generic and identifier "synmacph" 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>
|
||||
|
@ -1,42 +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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AvailabilityInternal.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
|
||||
|
||||
class AXDatabaseCleaner {
|
||||
public:
|
||||
AXDatabaseCleaner();
|
||||
~AXDatabaseCleaner();
|
||||
|
||||
bool loadPrivilegeHelper();
|
||||
bool xpcConnect();
|
||||
bool privilegeCommand(const char* command);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private* m_private;
|
||||
bool m_waitForResponse;
|
||||
};
|
||||
|
||||
#endif
|
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user