From 672beac438c3792dc23965ea62e64fb4fadc3f69 Mon Sep 17 00:00:00 2001 From: Takashi Yano Date: Sat, 16 Jun 2018 19:13:52 +0900 Subject: [PATCH] Fix the test of whether the computer is on a domain. * cygwin-service-installation-helper.sh (csih_select_rivileged_username): In the case logged in as a local user, csih failed to judge to be on a domain even if the computer is on a domain. This is because ${LOGSERVER,,*} has the same value as \\\\${COMPUTERNAME,,*}. The fix is done to use cygwin username returned by mkpasswd command to check it instead. Also, testing has been changed so that USERDOMAIN is used instead of LOGONSERVER because LOGONSERVER may not be set if "Run as administrator" is used. See the post below for more detail. https://cygwin.com/ml/cygwin/2018-06/msg00166.html --- cygwin-service-installation-helper.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cygwin-service-installation-helper.sh b/cygwin-service-installation-helper.sh index abdb0ef..fbdff0d 100755 --- a/cygwin-service-installation-helper.sh +++ b/cygwin-service-installation-helper.sh @@ -2882,9 +2882,8 @@ csih_select_privileged_username() if ! csih_use_file_etc "passwd" then # This test succeeds on domain member machines only, not on DCs. - if [ "\\\\${COMPUTERNAME,,*}" != "${LOGONSERVER,,*}" \ - -a "${LOGONSERVER}" != "" \ - -a "${LOGONSERVER}" != "\\\\MicrosoftAccount" ] + if [ "${USERDOMAIN,,*}" != "${COMPUTERNAME,,*}" \ + -o "$(/usr/bin/mkpasswd -c | /usr/bin/awk -F: '{print $1}')" = "${USERDOMAIN}+${USERNAME}" ] then # Lowercase of USERDOMAIN csih_PRIVILEGED_USERNAME="${COMPUTERNAME,,*}+${username}" -- 2.17.0