public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Group Permissions on root folders problem (Windows 10 TP build 10061)
Date: Fri, 11 Sep 2015 15:18:00 -0000	[thread overview]
Message-ID: <20150911151820.GH26699@calimero.vinschen.de> (raw)
In-Reply-To: <20150911213346.669fe6bed769b79a4afea225@nifty.ne.jp>

[-- Attachment #1: Type: text/plain, Size: 2299 bytes --]

On Sep 11 21:33, Takashi Yano wrote:
> Hi Corinna,
> 
> On Fri, 11 Sep 2015 13:10:12 +0200
> Corinna Vinschen wrote:
> > 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?
> 
> I have made a new patch and confirmed that it also works.
> 
> 
> --- cygwin-service-installation-helper.sh.orig	2015-02-24 04:57:56.000000000 +0900
> +++ cygwin-service-installation-helper.sh	2015-09-11 21:30:08.539361900 +0900
> @@ -2442,6 +2442,12 @@
>  # ======================================================================
>  _csih_setup()
>  {
> +  local uid
> +  local gid
> +  local user_sid
> +  local grp_sid
> +  local perms="d..x..x..[xt]"
> +
>    csih_stacktrace "${@}"
>    $_csih_trace
>    if [ "$_csih_setup_already_called" -eq 0 ]
> @@ -2462,7 +2468,17 @@
>        csih_error "Problem with LocalSystem or Adminstrator IDs"
>      fi
>  
> -    if ! csih_check_dir_perms "${LOCALSTATEDIR}" "d..x..x..[xt]"
> +    uid=$(/usr/bin/stat -c '%u' ${LOCALSTATEDIR})
> +    gid=$(/usr/bin/stat -c '%g' ${LOCALSTATEDIR})
> +    user_sid=$(/usr/bin/getent -w passwd $uid | awk -F: '{print $4}')
> +    grp_sid=$(/usr/bin/getent -w group $gid | awk -F: '{print $4}')
> +
> +    if [ "${user_sid}" = "${grp_sid}" ]
> +    then
> +      perms="d..x.....[xt]"
> +    fi
> +
> +    if ! csih_check_dir_perms "${LOCALSTATEDIR}" "${perms}"
>      then
>        csih_error "Problem with ${LOCALSTATEDIR} directory. Exiting."
>      fi

Thank you, patch applied.


Heading into vacation now.


Have fun,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-11 15:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAMH9mcFEL3mao+m-DEYM84kC1HOPeSBpZXD+mDf0USobF9oY7g@mail.gmail.com>
2015-06-16 13:23 ` Brian Buchanan
2015-06-16 15:58   ` Corinna Vinschen
2015-09-05  6:59     ` Takashi Yano
2015-09-06 11:44       ` Corinna Vinschen
2015-09-10 11:05         ` Takashi Yano
2015-09-10 17:23           ` Corinna Vinschen
2015-09-10 17:27             ` Eric Blake
2015-09-10 17:31               ` Corinna Vinschen
2015-09-10 17:36                 ` Eric Blake
2015-09-10 17:49                   ` Corinna Vinschen
2015-09-11  0:50                   ` Andrey Repin
2015-09-11  1:24                     ` Eric Blake
2015-09-11  2:05                       ` Andrey Repin
2015-09-11 10:04         ` Takashi Yano
2015-09-11 11:10           ` Corinna Vinschen
2015-09-11 12:33             ` Takashi Yano
2015-09-11 15:18               ` Corinna Vinschen [this message]
     [not found]     ` <DJzl1r0012qVqVd01Jzm3c>
2015-09-10 15:49       ` David A Cobb
2015-09-10 16:07         ` Ken Brown
2015-09-10 17:29           ` Corinna Vinschen
     [not found]         ` <FU891r01R2qVqVd01U8Bkq>
2015-09-10 20:41           ` David A Cobb
2015-04-29 14:45 Brian Buchanan
2015-04-30  8:24 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150911151820.GH26699@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).