Group Permissions on root folders problem (Windows 10 TP build 10061)
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Sep 11 11:10:00 GMT 2015
Hi Takashi,
On Sep 11 19:04, Takashi Yano wrote:
> Hi Corinna,
>
> Regarding the first problem:
> > > a) Group permissions on root folders
>
> On Sun, 6 Sep 2015 13:44:44 +0200
> Corinna Vinschen wrote:
> > The group permission problem is easy (and I'm wondering if it really was
> > such a bright idea to let user SID == group SID slip through in Cygwin,
> > rather tnan sticking to the former idea to change the group SID to
> > "Users" in this case). csih needs a patch to not check for the group
> > x bit if user SID == group SID.
>
> Do you intend a patch like this? I have confirmed that sshd
> is successfully installed and works nicely with this patch
> under a Microsoft Account.
>
> --- cygwin-service-installation-helper.sh.orig 2015-02-24 04:57:56.000000000 +0900
> +++ cygwin-service-installation-helper.sh 2015-09-11 18:41:56.870882800 +0900
> @@ -2442,6 +2442,8 @@
> # ======================================================================
> _csih_setup()
> {
> + local perms="d..x..x..[xt]"
> +
> csih_stacktrace "${@}"
> $_csih_trace
> if [ "$_csih_setup_already_called" -eq 0 ]
> @@ -2462,7 +2464,13 @@
> csih_error "Problem with LocalSystem or Adminstrator IDs"
> fi
>
> - if ! csih_check_dir_perms "${LOCALSTATEDIR}" "d..x..x..[xt]"
> + if [ `/usr/bin/stat -c '%g' ${LOCALSTATEDIR}` -eq \
> + `/usr/bin/stat -c '%u' ${LOCALSTATEDIR}` ]
> + then
> + perms="d..x.....[xt]"
> + fi
> +
> + if ! csih_check_dir_perms "${LOCALSTATEDIR}" "${perms}"
> then
> csih_error "Problem with ${LOCALSTATEDIR} directory. Exiting."
> fi
In theory, yes. The problem is just that checking the uid/gid equality
is not safe, given that you can easily create that via passwd/group
files. What I was thinking of is to convert the uid/gid values into
SIDs using the `getent' tool and to compare those, along the lines of
uid=$(/usr/bin/stat -c '%u')
user_sid=$(getent passwd -w $uid | awk -F: '{print $4}')
gid=$(/usr/bin/stat -c '%g')
grp_sid=$(getent group -w $gid | awk -F: '{print $4}')
if [ "${user_sid}" = "${grp_sid}" ]
...
Can you check if that works in your env and perhaps create a new patch
using the SIDs?
Thanks a lot,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150911/ec15824e/attachment.sig>
More information about the Cygwin
mailing list