Commit 5b59150d authored by Mark Mentovai's avatar Mark Mentovai Committed by Commit Bot

mac: When interfacing with Keystone, try ksadmin at its new path first

ksadmin moved from MacOS to Helpers in Keystone 1.2.13.112, 2019-11-12.
A symbolic link from the old location was left in place, but may not
remain indefinitely. Try the new location first, falling back to the old
if needed.

Change-Id: I278746a44ab35795a2294d812fd26b676b96d7c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1950747Reviewed-by: default avatarLambros Lambrou <lambroslambrou@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722533}
parent 6fadd24a
......@@ -772,8 +772,15 @@ NSString* const kVersionKey = @"KSVersion";
}
- (BOOL)isSystemKeystone {
// ksadmin moved from MacOS to Helpers in Keystone 1.2.13.112, 2019-11-12. A
// symbolic link from the old location was left in place, but may not remain
// indefinitely. Try the new location first, falling back to the old if
// needed.
struct stat statbuf;
if (stat("/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/"
"Contents/Helpers/ksadmin",
&statbuf) != 0 &&
stat("/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/"
"Contents/MacOS/ksadmin",
&statbuf) != 0) {
return NO;
......
......@@ -21,11 +21,19 @@ NSString* const kChromeInstallPath = @"/Applications/Google Chrome.app";
NSString* const kBrandKey = @"KSBrandID";
NSString* const kUserBrandPath = @"~~/Library/Google/Google Chrome Brand.plist";
// ksadmin moved from MacOS to Helpers in Keystone 1.2.13.112, 2019-11-12. A
// symbolic link from the old location was left in place, but may not remain
// indefinitely. Try the new location first, falling back to the old if needed.
NSString* const kSystemKsadminPath =
@"/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/"
"Contents/Helpers/ksadmin";
NSString* const kSystemKsadminPathOld =
@"/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/"
"Contents/MacOS/ksadmin";
NSString* const kUserKsadminPath =
@"~~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/"
"Contents/Helpers/ksadmin";
NSString* const kUserKsadminPathOld =
@"~~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/"
"Contents/MacOS/ksadmin";
......@@ -104,11 +112,14 @@ BOOL FindChromeTicket(TicketKind kind, const passwd* user,
*chrome_path = nil;
// Don't use Objective-C 2 loop syntax, in case an installer runs on 10.4.
NSMutableArray* keystone_paths =
[NSMutableArray arrayWithObject:kSystemKsadminPath];
NSMutableArray* keystone_paths = [NSMutableArray
arrayWithObjects:kSystemKsadminPath, kSystemKsadminPathOld, nil];
if (kind == kUserTicket) {
[keystone_paths insertObject:AdjustHomedir(kUserKsadminPath, user->pw_dir)
atIndex:0];
[keystone_paths
insertObject:AdjustHomedir(kUserKsadminPathOld, user->pw_dir)
atIndex:1];
}
NSEnumerator* e = [keystone_paths objectEnumerator];
id ks_path;
......
......@@ -20,7 +20,14 @@ HOST_LEGACY_BUNDLE_NAME=@@HOST_LEGACY_BUNDLE_NAME@@
HOST_EXE="$HELPERTOOLS/$HOST_BUNDLE_NAME/Contents/MacOS/remoting_me2me_host"
USERS_TMP_FILE="$HOST_SERVICE_BINARY.users"
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
# ksadmin moved from MacOS to Helpers in Keystone 1.2.13.112, 2019-11-12. A
# symbolic link from the old location was left in place, but may not remain
# indefinitely. Try the new location first, falling back to the old if needed.
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksadmin
if [[ ! -x "${KSADMIN}" ]]; then
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
fi
KSUPDATE=https://tools.google.com/service/update2
KSPID=com.google.chrome_remote_desktop
KSPVERSION=@@VERSION@@
......
......@@ -7,7 +7,14 @@
NAME=org.chromium.chromoting
PLIST=/Library/LaunchAgents/$NAME.plist
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
# ksadmin moved from MacOS to Helpers in Keystone 1.2.13.112, 2019-11-12. A
# symbolic link from the old location was left in place, but may not remain
# indefinitely. Try the new location first, falling back to the old if needed.
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksadmin
if [[ ! -x "${KSADMIN}" ]]; then
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
fi
KSUPDATE=https://tools.google.com/service/update2
KSPID=com.google.chrome_remote_desktop
KSPVERSION=0.5
......
......@@ -4,7 +4,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
# ksadmin moved from MacOS to Helpers in Keystone 1.2.13.112, 2019-11-12. A
# symbolic link from the old location was left in place, but may not remain
# indefinitely. Try the new location first, falling back to the old if needed.
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Helpers/ksadmin
if [[ ! -x "${KSADMIN}" ]]; then
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
fi
KSPID=com.google.chrome_remote_desktop
# Unregister our ticket from Keystone.
......
......@@ -5,6 +5,7 @@
#include "remoting/host/installer/mac/uninstaller/remoting_uninstaller.h"
#import <Cocoa/Cocoa.h>
#include <sys/stat.h>
#include "base/mac/authorization_util.h"
#include "base/mac/scoped_authorizationref.h"
......@@ -34,12 +35,6 @@ NSArray* convertToNSArray(const char** array) {
@implementation RemotingUninstaller
// Keystone
const char kKeystoneAdmin[] = "/Library/Google/GoogleSoftwareUpdate/"
"GoogleSoftwareUpdate.bundle/Contents/MacOS/"
"ksadmin";
const char kKeystonePID[] = "com.google.chrome_remote_desktop";
- (void)runCommand:(const char*)cmd
withArguments:(const char**)args {
NSTask* task;
......@@ -122,8 +117,29 @@ const char kKeystonePID[] = "com.google.chrome_remote_desktop";
}
- (void)keystoneUnregisterUsingAuth:(AuthorizationRef)authRef {
const char* args[] = {"--delete", "--productid", kKeystonePID, "-S", nullptr};
[self sudoCommand:kKeystoneAdmin withArguments:args usingAuth:authRef];
// ksadmin moved from MacOS to Helpers in Keystone 1.2.13.112, 2019-11-12. A
// symbolic link from the old location was left in place, but may not remain
// indefinitely. Try the new location first, falling back to the old if
// needed.
static const char kKSAdminPath[] =
"/Library/Google/GoogleSoftwareUpdate/"
"GoogleSoftwareUpdate.bundle/Contents/Helpers/"
"ksadmin";
static const char kKSAdminOldPath[] =
"/Library/Google/GoogleSoftwareUpdate/"
"GoogleSoftwareUpdate.bundle/Contents/MacOS/"
"ksadmin";
struct stat statbuf;
const char* ksadminPath =
(stat(kKSAdminPath, &statbuf) == 0 && (statbuf.st_mode & S_IXUSR))
? kKSAdminPath
: kKSAdminOldPath;
static const char kKSProductID[] = "com.google.chrome_remote_desktop";
const char* args[] = {"--delete", "--productid", kKSProductID, "-S", nullptr};
[self sudoCommand:ksadminPath withArguments:args usingAuth:authRef];
}
- (void)remotingUninstallUsingAuth:(AuthorizationRef)authRef {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment