1
0
mirror of https://github.com/git/git.git synced 2024-09-29 12:01:30 +02:00
Commit Graph

8 Commits

Author SHA1 Message Date
Brandon Casey
80700fde91 t/t1304: make a second colon optional in the mask ACL check
Solaris only uses one colon in the listing of the ACL mask, Linux uses two,
so substitute egrep for grep and make the second colon optional.

The -q option for Solaris 7's /usr/xpg4/bin/egrep does not appear to be
implemented, so redirect output to /dev/null.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-16 19:06:01 -07:00
Brandon Casey
2e85575a02 t/t1304: set the ACL effective rights mask
Some implementations of setfacl do not recalculate the effective rights
mask when the ACL is modified.  So, set the effective rights mask
explicitly to ensure that the ACL's that are set on the directories will
have effect.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-16 19:05:59 -07:00
Brandon Casey
71c4d6c635 t/t1304: use 'test -r' to test readability rather than looking at mode bits
This test was using the group read permission bit as an indicator of the
default ACL mask.  This behavior is valid on Linux but not on other
platforms like Solaris.  So, rather than looking at mode bits, just test
readability for the user.  This, along with the checks for the existence
of the ACL's that were set on the parent directories, should be enough.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-16 19:05:58 -07:00
Brandon Casey
ab04a90567 t/t1304: set the Default ACL base entries
According to the Linux setfacl man page, in order for an ACL to be valid,
the following rules must be satisfied:

   * Whenever an ACL contains any Default ACL entries, the three Default
     ACL base entries (default owner, default group, and default others)
     must also exist.

   * Whenever a Default ACL contains named user entries or named group
     objects, it must also contain a default effective rights mask.

Some implementations of setfacl (Linux) do this automatically when
necessary, some (Solaris) do not.  Solaris's setfacl croaks when trying to
create a default user ACL if the above rules are not satisfied.  So, create
them before modifying the default user ACL's.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-16 19:05:57 -07:00
Brandon Casey
db826571e4 t/t1304: avoid -d option to setfacl
Some platforms (Solaris) have a setfacl whose -d switch works differently
than the one on Linux.  On Linux, it causes all operations to be applied
to the Default ACL.  There is a notation for operating on the Default ACL:

   [d[efault]:] [u[ser]:]uid [:perms]

so use it instead of the -d switch.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-16 19:05:54 -07:00
Matthieu Moy
5256b00631 Use git_mkstemp_mode instead of plain mkstemp to create object files
We used to unnecessarily give the read permission to group and others,
regardless of the umask, which isn't serious because the objects are
still protected by their containing directory, but isn't necessary
either.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-22 15:24:46 -08:00
Matthieu Moy
f80c7ae8fe Use git_mkstemp_mode and xmkstemp_mode in odb_mkstemp, not chmod later.
We used to create 0600 files, and then use chmod to set the group and
other permission bits to the umask. This usually has the same effect
as a normal file creation with a umask.

But in the presence of ACLs, the group permission plays the role of
the ACL mask: the "g" bits of newly created files are chosen according
to default ACL mask of the directory, not according to the umask, and
doing a chmod() on these "g" bits affect the ACL's mask instead of
actual group permission.

In other words, creating files with 0600 and then doing a chmod to the
umask creates files which are unreadable by users allowed in the
default ACL. To create the files without breaking ACLs, we let the
umask do it's job at the file's creation time, and get rid of the
later chmod.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-22 15:24:46 -08:00
Matthieu Moy
7aba6185d5 Add a testcase for ACL with restrictive umask.
Right now, Git creates unreadable pack files on non-shared
repositories when the user has a umask of 077, even when the default
ACLs for the directory would give read/write access to a specific
user.

Loose object files are created world-readable, which doesn't break ACLs,
but isn't necessarily desirable.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-22 15:24:45 -08:00