delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/23/14:40:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Wed, 23 Jul 2003 14:40:01 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: msg <michael DOT grigoni AT cybertheque DOT org>
cc: cygwin AT cygwin DOT com
Subject: Re: ACL or file locking issue?
In-Reply-To: <3F15FE1D.18067547@cybertheque.org>
Message-ID: <Pine.GSO.4.44.0307231422570.26427-100000@slinky.cs.nyu.edu>
Importance: Normal
MIME-Version: 1.0

On Wed, 16 Jul 2003, msg wrote:

> Greetings:
>
> Is this an ACL or file locking issue?
>
> Trying to copy a registry file in a 'bash' shell
> as a privileged user (whoami /priv appears below) yields:
>
> (root's prompt is '#')
> # cd /cygdrive/c/winnt/system32/config
> # cp SAM /var/tmp
> cp:'SAM.exe' and '/var/tmp/SAM' are the same file
>
> I can reproduce this behavior on a plain file, eg:
>
> # cd /var/tmp
> # echo "testing" > foo
> # chmod 770 foo
> # chown Administrator foo
> # chgrp SYSTEM foo
> # cp foo bar
> cp: 'foo.exe' and 'bar' are the same file
>
> File must be mode=(at least)440,uid=Administrator,gid=SYSTEM to see
> this.
>
> Changing file modes, user and/or group ownership on SAM however doesn't
> allow access.
>
> All replies much appreciated.
>
> Michael Grigoni

It looks like the "foo = foo.exe" hack in cp is misfiring here.
Basically, cp tries to open the file, fails, and assumes that the name
it's been given should have a ".exe" appended to it.  Since the file
"foo.exe" really doesn't exist, cp produces the wrong error message ("are
the same file" instead of "cannot open foo for reading").  The main
problem with the hack is that it doesn't check *why* it failed to open the
file, and simply assumes that if "open()" returns a negative value, the
file doesn't exist.  Checking to make sure "errno == ENOENT" before
attempting to access the ".exe" would probably fix it, but I'm not in a
position right now to submit a patch.

FWIW, CGF planned to redo this "properly" for coreutils (whenever that
comes out as a package).

> Output of 'whoami /priv':
> (O) SeTcbPrivilege     = Act as part of the operating system
> [snip]

Hmm, which "whoami" is that?  Not the one that comes with Cygwin,
obviously...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019