ACLs are supported (in the sense that a non-trivial ACL on a file gets
preserved when the file is written) on UFS on Solaris, as well as on AIX,
or systems which support POSIX ACLs, but this code doesn't work on either
ZFS or NFSv4 on Solaris, which use a different ACL API.
The attached patch fixes this. When built on a Solaris system prior to
ZFS, it uses the old interface, but on a newer system sets the ACLs
properly on ZFS, UFS, and NFS.
I don't know what the ZFS or NFSv4 ACL APIs are like on other operating
systems with those filesystems, so the names I used are Solaris specific,
but it may not take much massaging to get it to work there, too. Perhaps
it just works there with the POSIX ACL API?
Danek
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
--- src/configure.in Tue Jan 10 16:13:35 2012
+++ src/configure.in Fri Jan 13 14:10:21 2012
@@ -3106,6 +3106,7 @@
dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
dnl when -lacl works, also try to use -lattr (required for Debian).
+dnl On Solaris, use the acl_get/set functions in libsec, if present.
AC_MSG_CHECKING(--disable-acl argument)
AC_ARG_ENABLE(acl,
[ --disable-acl Don't check for ACL support.],
@@ -3128,7 +3129,8 @@
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
AC_MSG_RESULT(no))
-AC_MSG_CHECKING(for Solaris ACL support)
+AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec";
AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
+AC_MSG_CHECKING(for Solaris ACL support)
AC_TRY_LINK([
#ifdef HAVE_SYS_ACL_H
# include <sys/acl.h>
@@ -3135,7 +3137,7 @@
#endif], [acl("foo", GETACLCNT, 0, NULL);
],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
- AC_MSG_RESULT(no))
+ AC_MSG_RESULT(no)))
AC_MSG_CHECKING(for AIX ACL support)
AC_TRY_LINK([
--- src/config.h.in Fri Jan 13 13:29:05 2012
+++ src/config.h.in Fri Jan 13 13:29:13 2012
@@ -363,6 +363,7 @@
/* Define if you want to add support for ACL */
#undef HAVE_POSIX_ACL
+#undef HAVE_SOLARIS_ZFS_ACL
#undef HAVE_SOLARIS_ACL
#undef HAVE_AIX_ACL
--- src/os_unix.c Tue Jan 10 16:13:35 2012
+++ src/os_unix.c Fri Jan 13 15:57:08 2012
@@ -2746,6 +2746,13 @@
#ifdef HAVE_POSIX_ACL
ret = (vim_acl_T)acl_get_file((char *)fname, ACL_TYPE_ACCESS);
#else
+#ifdef HAVE_SOLARIS_ZFS_ACL
+ acl_t *aclent;
+
+ if (acl_get((char *)fname, 0, &aclent) < 0)
+ return NULL;
+ ret = (vim_acl_T)aclent;
+#else
#ifdef HAVE_SOLARIS_ACL
vim_acl_solaris_T *aclent;
@@ -2791,6 +2798,7 @@
ret = (vim_acl_T)aclent;
#endif /* HAVE_AIX_ACL */
#endif /* HAVE_SOLARIS_ACL */
+#endif /* HAVE_SOLARIS_ZFS_ACL */
#endif /* HAVE_POSIX_ACL */
return ret;
}
@@ -2808,6 +2816,9 @@
#ifdef HAVE_POSIX_ACL
acl_set_file((char *)fname, ACL_TYPE_ACCESS, (acl_t)aclent);
#else
+#ifdef HAVE_SOLARIS_ZFS_ACL
+ acl_set((char *)fname, (acl_t *)aclent);
+#else
#ifdef HAVE_SOLARIS_ACL
acl((char *)fname, SETACL, ((vim_acl_solaris_T *)aclent)->acl_cnt,
((vim_acl_solaris_T *)aclent)->acl_entry);
@@ -2816,6 +2827,7 @@
chacl((char *)fname, aclent, ((struct acl *)aclent)->acl_len);
#endif /* HAVE_AIX_ACL */
#endif /* HAVE_SOLARIS_ACL */
+#endif /* HAVE_SOLARIS_ZFS_ACL */
#endif /* HAVE_POSIX_ACL */
}
@@ -2828,6 +2840,9 @@
#ifdef HAVE_POSIX_ACL
acl_free((acl_t)aclent);
#else
+#ifdef HAVE_SOLARIS_ZFS_ACL
+ acl_free((acl_t *)aclent);
+#else
#ifdef HAVE_SOLARIS_ACL
free(((vim_acl_solaris_T *)aclent)->acl_entry);
free(aclent);
@@ -2836,6 +2851,7 @@
free(aclent);
#endif /* HAVE_AIX_ACL */
#endif /* HAVE_SOLARIS_ACL */
+#endif /* HAVE_SOLARIS_ZFS_ACL */
#endif /* HAVE_POSIX_ACL */
}
#endif