bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ACLs: unit test and status


From: Bruno Haible
Subject: ACLs: unit test and status
Date: Thu, 22 May 2008 19:31:34 +0200
User-agent: KMail/1.5.4

The copy_file function is supposed to copy ACLs of the file being copied,
otherwise it is a security problem. (copy_file is used to create backup files.
If the original file has "read" permission denied for user Schäuble, and the
backup copy has this ACL lost, so that Schäuble can now read the file, this
is clearly undesired by the user who owns the file.)

I added a unit test for this.

2008-05-22  Bruno Haible  <address@hidden>

        * modules/copy-file-tests: New file.
        * tests/test-copy-file.sh: New file.
        * tests/test-copy-file.c: New file.
        * tests/test-copy-file-sameacls.c: New file.

The status is the following:

Linux    OK
Solaris  FAIL
FreeBSD  OK
HP-UX    FAIL
Tru64    FAIL
AIX      FAIL
MacOS X  FAIL
Cygwin   FAIL
IRIX     OK
Platforms without ACLs (OpenBSD, mingw)  OK


The failures are of different categories:
  - On MacOS X, copy_file fails.
  - On the other systems, copy_file succeeds but sometimes fails to copy the 
ACL.

Here are details about the failures:


Broken on Solaris 10:

files tmpfile0 and tmpfile2 have different number of ACLs: 5 and 4
FAIL: test-copy-file.sh
$ getfacl tmpfile0 

# file: tmpfile0
# owner: haible
# group: talk
user::rw-
user:daemon:--x         #effective:---
group::---              #effective:---
mask:---
other:---
$ getfacl tmpfile2 

# file: tmpfile2
# owner: haible
# group: talk
user::rw-
group::---              #effective:---
mask:---
other:---


Broken on HP-UX 11:

files tmpfile0 and tmpfile2 have different number of ACLs: 4 and 3
FAIL: test-copy-file.sh

$ lsacl tmpfile0
(daemon.%,--x)(haible.%,rw-)(%.talk,---)(%.%,---) tmpfile0
$ lsacl tmpfile2
(haible.%,rw-)(%.talk,---)(%.%,---) tmpfile2


Broken on OSF/1 5.1:

Fails comparing tmpfile2:
$ getacl tmpfile0 
# file: tmpfile0
# owner: haible
# group: system
#
# Warning: ACL processing is disabled for this file
#
user::rw-
user:daemon:--x
group::---
other::---
$ getacl tmpfile2 
# file: tmpfile2
# owner: haible
# group: system
#
# Warning: ACL processing is disabled for this file
#
user::rw-
group::---
other::---

Need to link with -lpacl not -lacl

With LIBS=-lpacl, compilation errors occur:

$ make -k
No suffix list.
make  all-recursive
No suffix list.
Making all in gllib
make  all-am
source='acl.c' object='acl.o' libtool=no  DEPDIR=.deps depmode=tru64 /bin/ksh 
../build-aux/depcomp  cc -O -DHAVE_CONFIG_H -I. -I..  -I../intl     -c acl.c
cc: Warning: acl.c, line 60: Too few actual parameters in macro call. 
(toofewactuals)
    acl = acl_get_fd (source_desc);
---------------------------------^
cc: Error: acl.c, line 60: Invalid expression. (badexpr)
    acl = acl_get_fd (source_desc);
----------^
cc: Error: acl.c, line 61: Invalid statement. (badstmt)
  else
--^
cc: Warning: acl.c, line 75: Too few actual parameters in macro call. 
(toofewactuals)
    ret = acl_set_fd (dest_desc, acl);
------------------------------------^
cc: Error: acl.c, line 75: Invalid expression. (badexpr)
    ret = acl_set_fd (dest_desc, acl);
----------^
cc: Error: acl.c, line 76: Invalid statement. (badstmt)
  else
--^
cc: Warning: acl.c, line 237: Too few actual parameters in macro call. 
(toofewactuals)
    ret = acl_set_fd (desc, acl);
-------------------------------^
cc: Error: acl.c, line 237: Invalid expression. (badexpr)
    ret = acl_set_fd (desc, acl);
----------^
cc: Error: acl.c, line 238: Invalid statement. (badstmt)
  else
--^
cc: Warning: acl.c, line 129: In this statement, the referenced type of the 
pointer value "src_name" is const, but the referenced type of the target of 
this assignment is not. (notconstqual)
      acl = acl_get_file (src_name, ACL_TYPE_DEFAULT);
------------^
cc: Warning: acl.c, line 136: In this statement, the referenced type of the 
pointer value "dst_name" is const, but the referenced type of the target of 
this assignment is not. (notconstqual)
      if (acl_set_file (dst_name, ACL_TYPE_DEFAULT, acl))
----------^
cc: Warning: acl.c, line 258: In this statement, the referenced type of the 
pointer value "name" is const, but the referenced type of the target of this 
assignment is not. (notconstqual)
  if (S_ISDIR (mode) && acl_delete_def_file (name))
------------------------^
*** Exit 1
source='acl_entries.c' object='acl_entries.o' libtool=no  DEPDIR=.deps 
depmode=tru64 /bin/ksh ../build-aux/depcomp  cc -O -DHAVE_CONFIG_H -I. -I..  
-I../intl     -c acl_entries.c
cc: Warning: acl_entries.c, line 36: In this statement, the referenced type of 
the pointer value "text" is "char", which is not compatible with "struct acl". 
(ptrmismatch)
  acl_free (text);
------------^


Broken on AIX 5.1:

files tmpfile0 and tmpfile2 have different access modes: 200500600 and 500600
$ aclget tmpfile0 
attributes: 
base permissions
    owner(haible):  rw-
    group(talk):  ---
    others:  ---
extended permissions
    enabled
    permit   --x     u:daemon
$ aclget tmpfile2 
attributes: 
base permissions
    owner(haible):  rw-
    group(talk):  ---
    others:  ---
extended permissions
    disabled


Broken on MacOS X 10.5:

/Users/bruno/data/work/testdir1/gltests/test-copy-file tmpfile0 tmpfile1
/Users/bruno/data/work/testdir1/gltests/test-copy-file: `tmpfile0': No such 
file or directory
FAIL: test-copy-file.sh


Broken on Cygwin:

files tmpfile0 and tmpfile4: different ACL entry #1: different permissions 000 
and 004
FAIL: test-copy-file.sh

$ ls -l tmpfile0 tmpfile4
-rw-r--r-- 1 haible None 16 May 22 16:57 tmpfile0
-rw-r--r-- 1 haible None 16 May 22 16:57 tmpfile4

$ getfacl tmpfile0
# file: tmpfile0
# owner: haible
# group: None
user::rw-
group::---
mask:rwx
other:r--

$ getfacl tmpfile4
# file: tmpfile4
# owner: haible
# group: None
user::rw-
group::r--
mask:rwx
other:r--






reply via email to

[Prev in Thread] Current Thread [Next in Thread]