--- /dev/null	2005-10-19 09:34:03.912420500 +0100
+++ libgnomevfs/gnome-vfs-file-acl.h	2005-10-17 19:19:27.000000000 +0100
@@ -0,0 +1,88 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* gnome-vfs-file-acl.h - Handling of ACL file information for the GNOME
+   Virtual File System.
+
+   Copyright (C) 2005 Sun Microsystems
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Alvaro Lopez Ortega <alvaro@sun.com>
+*/
+
+#ifndef GNOME_VFS_FILE_ACL_H
+#define GNOME_VFS_FILE_ACL_H
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <libgnomevfs/gnome-vfs-result.h>
+#include <libgnomevfs/gnome-vfs-uri.h>
+
+
+G_BEGIN_DECLS
+
+typedef enum {
+	GNOME_VFS_ACL_PERM_UNDEFINED = 0,
+	GNOME_VFS_ACL_PERM_USER_OBJ  = 1,
+	GNOME_VFS_ACL_PERM_USER      = 1 << 1,	
+	GNOME_VFS_ACL_PERM_GROUP_OBJ = 1 << 2,
+	GNOME_VFS_ACL_PERM_GROUP     = 1 << 3,
+	GNOME_VFS_ACL_PERM_MASK      = 1 << 4,
+	GNOME_VFS_ACL_PERM_OTHER     = 1 << 5
+} GnomeVFSFileACLTag;
+
+typedef enum {
+	GNOME_VFS_ACL_EXECUTE = 1,
+	GNOME_VFS_ACL_WRITE   = 1 << 1,
+	GNOME_VFS_ACL_READ    = 1 << 2,
+	GNOME_VFS_ACL_ALL     = 1 | 1 << 1 | 1 << 2
+} GnomeVFSFileACLPermissions;
+
+typedef enum {
+	GNOME_VFS_ACL_ACCESS  = 0x8000,
+	GNOME_VFS_ACL_DEFAULT = 0x4000
+} GnomeVFSFileACLType;
+
+
+
+/**
+ * GnomeVFSFileACL:
+ * 
+ * The GnomeVFSFileACL structure contains information about a file ACL.
+ **/
+typedef struct _GnomeVFSFileACL GnomeVFSFileACL;
+
+
+GnomeVFSFileACL * gnome_vfs_file_acl_new           (void);
+void              gnome_vfs_file_acl_free          (GnomeVFSFileACL *acl);
+GnomeVFSFileACL * gnome_vfs_file_acl_dup           (GnomeVFSFileACL *acl);
+
+GnomeVFSResult    gnome_vfs_file_acl_read_default  (GnomeVFSFileACL *acl, const gchar *path);
+GnomeVFSResult    gnome_vfs_file_acl_read_access   (GnomeVFSFileACL *acl, const gchar *path);
+
+GnomeVFSResult    gnome_vfs_file_acl_commit        (GnomeVFSFileACL *acl, const gchar *path);
+gchar           * gnome_vfs_file_acl_get_text      (GnomeVFSFileACL *acl, GnomeVFSFileACLType type);
+
+GnomeVFSResult    gnome_vfs_file_acl_add_entry     (GnomeVFSFileACL *acl, uid_t id, GnomeVFSFileACLTag tag,
+						    GnomeVFSFileACLPermissions perms, GnomeVFSFileACLType type);
+GnomeVFSResult    gnome_vfs_file_acl_modify_entry  (GnomeVFSFileACL *acl, guint id, GnomeVFSFileACLTag tag, 
+						    GnomeVFSFileACLPermissions perms, GnomeVFSFileACLType type);
+GnomeVFSResult    gnome_vfs_file_acl_remove_entry  (GnomeVFSFileACL *acl, guint id, GnomeVFSFileACLTag tag, 
+						    GnomeVFSFileACLType type);
+
+G_END_DECLS
+
+#endif /* GNOME_VFS_FILE_ACL_H */
--- /dev/null	2005-10-19 09:34:03.912420500 +0100
+++ libgnomevfs/gnome-vfs-file-acl.c	2005-10-17 19:51:50.000000000 +0100
@@ -0,0 +1,379 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* gnome-vfs-file-acl.h - Handling of ACL file information for the GNOME
+   Virtual File System.
+
+   Copyright (C) 2005 Sun Microsystems
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Alvaro Lopez Ortega <alvaro@sun.com>
+*/
+
+#include <config.h>
+#include "gnome-vfs-file-acl.h"
+
+#include <errno.h>
+#include <string.h>
+#include <acl/libacl.h>
+
+struct _GnomeVFSFileACL {
+	acl_t acl_info;
+	acl_t acl_default_info;
+};
+
+
+GnomeVFSFileACL * 
+gnome_vfs_file_acl_new (void)
+{
+	GnomeVFSFileACL *new;
+
+	new = g_new0 (GnomeVFSFileACL, 1);
+	return new;
+}
+
+
+void
+gnome_vfs_file_acl_free (GnomeVFSFileACL *acl)
+{
+	if (acl->acl_info != NULL)
+		acl_free (acl->acl_info);
+
+	if (acl->acl_default_info != NULL)
+		acl_free (acl->acl_default_info);
+
+	g_free (acl);
+}
+
+
+GnomeVFSFileACL * 
+gnome_vfs_file_acl_dup (GnomeVFSFileACL *acl)
+{
+	GnomeVFSFileACL *target;
+
+	target = g_new0 (GnomeVFSFileACL, 1);
+	memcpy (target, acl, sizeof(GnomeVFSFileACL));
+
+	return target;
+}
+
+
+GnomeVFSResult
+gnome_vfs_file_acl_read_default (GnomeVFSFileACL *acl, const gchar *path)
+{
+	acl->acl_default_info = acl_get_file (path, ACL_TYPE_DEFAULT);
+
+	if (acl->acl_default_info == NULL)
+		return GNOME_VFS_ERROR_NOT_FOUND;
+
+	if (!acl_valid(acl->acl_default_info))
+		return GNOME_VFS_ERROR_GENERIC;
+	   
+	return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult
+gnome_vfs_file_acl_read_access (GnomeVFSFileACL *acl, const gchar *path)
+{
+	acl->acl_info = acl_get_file (path, ACL_TYPE_ACCESS);
+
+	if (acl->acl_info == NULL)
+		return GNOME_VFS_ERROR_NOT_FOUND;
+
+	if (!acl_valid(acl->acl_info))
+		return GNOME_VFS_ERROR_GENERIC;
+
+	return GNOME_VFS_OK;
+}
+
+
+static GnomeVFSResult
+aclerrno_to_vfserror (int acl_errno)
+{
+	switch (acl_errno) {
+	case ENOENT:			 
+	case EINVAL:       
+		return GNOME_VFS_ERROR_BAD_FILE;
+	case EACCES:     
+		return GNOME_VFS_ERROR_ACCESS_DENIED;
+	case ENAMETOOLONG: 
+		return GNOME_VFS_ERROR_NAME_TOO_LONG;
+	case EPERM:
+		return GNOME_VFS_ERROR_NOT_PERMITTED;
+	case ENOSPC:
+		return GNOME_VFS_ERROR_NO_SPACE;
+	case EROFS:
+		return GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM;
+	default:
+		break;
+	}
+	
+	return GNOME_VFS_ERROR_GENERIC;
+}
+
+
+GnomeVFSResult    
+gnome_vfs_file_acl_commit (GnomeVFSFileACL *acl, const gchar *path)
+{
+	int   ret;
+
+	if ((acl->acl_info == NULL) &&
+	    (acl->acl_default_info == NULL))
+		return GNOME_VFS_OK;
+
+#if 0
+	{
+		int which_entry;
+
+		ret = acl_check (acl->acl_default_info, &which_entry);
+		if (ret < 0) {
+			g_print ("Check: ERROR\n");
+		} else if (ret > 0) {
+			char * txt = acl_to_any_text (acl->acl_default_info, NULL, ',', 0);
+			g_print ("Check: MALFORMED: %s: \"%s\" entry %d\n", acl_error(ret), txt, which_entry+1);
+			g_free (txt);
+		}
+	}
+#endif
+
+	if (acl->acl_info != NULL) {
+		ret = acl_set_file (path, GNOME_VFS_ACL_ACCESS, acl->acl_info);
+		if (ret < 0) return aclerrno_to_vfserror (errno);
+	}
+
+	if (acl->acl_default_info != NULL) {
+		ret = acl_set_file (path, GNOME_VFS_ACL_DEFAULT, acl->acl_default_info);
+		if (ret < 0) return aclerrno_to_vfserror (errno);
+	}
+
+	return GNOME_VFS_OK;
+}
+
+
+gchar * 
+gnome_vfs_file_acl_get_text (GnomeVFSFileACL *acl, GnomeVFSFileACLType type)
+{
+	acl_t acl_obj;
+
+	acl_obj = (type == GNOME_VFS_ACL_ACCESS) ? 
+		acl->acl_info : acl->acl_default_info;
+	
+	if (acl_obj == NULL)
+		return NULL;
+	   
+	return acl_to_any_text (acl_obj, NULL, ',', 0);
+}
+
+
+static void
+set_permset (acl_permset_t permset, GnomeVFSFileACLPermissions perms)
+{
+	if (perms & GNOME_VFS_ACL_READ)
+		acl_add_perm (permset, ACL_READ);
+	else 
+		acl_delete_perm (permset, ACL_READ);
+
+	if (perms & GNOME_VFS_ACL_WRITE)
+		acl_add_perm (permset, ACL_WRITE);
+	else 
+		acl_delete_perm (permset, ACL_WRITE);
+	
+	if (perms & GNOME_VFS_ACL_EXECUTE)
+		acl_add_perm (permset, ACL_EXECUTE);
+	else 
+		acl_delete_perm (permset, ACL_EXECUTE);
+}
+
+
+static acl_entry_t
+find_entry (acl_t acl, acl_tag_t type, id_t id)
+{
+        acl_entry_t  ent;
+        acl_tag_t    e_type;
+        id_t        *e_id_p;
+	
+        if (acl_get_entry(acl, ACL_FIRST_ENTRY, &ent) != 1)
+                return NULL;
+	
+        for(;;) {
+                acl_get_tag_type(ent, &e_type);
+                if (type == e_type) {
+                        if (id == ACL_UNDEFINED_ID) 
+                                return ent;
+
+			e_id_p = acl_get_qualifier(ent);
+
+			if (e_id_p == NULL)
+				return NULL;
+
+			if (*e_id_p == id) {
+				acl_free(e_id_p);
+				return ent;
+			}
+
+			acl_free(e_id_p);
+                }
+
+                if (acl_get_entry(acl, ACL_NEXT_ENTRY, &ent) != 1)
+                        return NULL;
+        }
+}
+
+
+GnomeVFSResult
+gnome_vfs_file_acl_remove_entry (GnomeVFSFileACL *acl, guint id, 
+				 GnomeVFSFileACLTag tag, 
+				 GnomeVFSFileACLType type)
+{	
+	acl_t       acl_obj;
+	acl_entry_t entry;
+
+	acl_obj = (type == GNOME_VFS_ACL_ACCESS) ? 
+		acl->acl_info : acl->acl_default_info;
+
+	if (acl_obj == NULL)
+		return GNOME_VFS_ERROR_BAD_FILE;
+
+	entry = find_entry (acl_obj, tag, id);
+	if (entry == NULL) return GNOME_VFS_ERROR_NOT_FOUND;
+
+	acl_delete_entry (acl_obj, entry);
+
+	return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult
+gnome_vfs_file_acl_modify_entry (GnomeVFSFileACL *acl, guint id, 
+				 GnomeVFSFileACLTag tag, 
+				 GnomeVFSFileACLPermissions perms,
+				 GnomeVFSFileACLType type)
+{
+	acl_t         acl_obj;
+	acl_entry_t   entry;
+	acl_permset_t permset;
+
+	acl_obj = (type == GNOME_VFS_ACL_ACCESS) ? 
+		acl->acl_info : acl->acl_default_info;
+
+	entry = find_entry (acl_obj, tag, id);
+	if (entry == NULL) 
+		return GNOME_VFS_ERROR_NOT_FOUND;
+
+	acl_get_permset (entry, &permset); 
+	set_permset (permset, perms);	
+
+	return GNOME_VFS_OK;
+}
+
+
+static int
+clone_entry (acl_t  from_acl, acl_tag_t from_type,
+	     acl_t *to_acl,   acl_tag_t to_type)
+{
+        acl_entry_t from_entry;
+	acl_entry_t to_entry;
+
+        from_entry = find_entry(from_acl, from_type, ACL_UNDEFINED_ID);
+        if (from_entry == NULL) return 1;
+
+	if (acl_create_entry(to_acl, &to_entry) != 0)
+		return -1;
+
+	acl_copy_entry(to_entry, from_entry);
+	acl_set_tag_type(to_entry, to_type);
+
+	return 0;
+}
+
+
+
+GnomeVFSResult    
+gnome_vfs_file_acl_add_entry (GnomeVFSFileACL *acl, uid_t id, 
+			      GnomeVFSFileACLTag tag,
+			      GnomeVFSFileACLPermissions perms,
+			      GnomeVFSFileACLType type)
+{
+	int           re;
+	acl_t         acl_obj   = NULL;
+	acl_entry_t   new_entry = NULL;
+	acl_permset_t permset   = NULL;
+
+	acl_obj = (type == GNOME_VFS_ACL_ACCESS) ? 
+		acl->acl_info : acl->acl_default_info;
+
+	if (acl_obj == NULL)
+		return GNOME_VFS_ERROR_NOT_FOUND;
+	
+	new_entry = find_entry (acl_obj, type, id);
+	if (new_entry == NULL) {
+		/* new */
+		if (type == GNOME_VFS_ACL_ACCESS)
+			re = acl_create_entry (&acl->acl_info, &new_entry);
+		else 
+			re = acl_create_entry (&acl->acl_default_info, &new_entry);
+		if (re != 0) return aclerrno_to_vfserror (errno);
+
+		/* it might be new */
+		acl_obj = (type == GNOME_VFS_ACL_ACCESS) ? 
+			acl->acl_info : acl->acl_default_info;
+
+		/* e_tag */
+		re = acl_set_tag_type (new_entry, tag);
+		if (re != 0) return aclerrno_to_vfserror (errno);
+		
+		/* e_id */
+		re = acl_set_qualifier (new_entry, &id);
+		if (re != 0) return aclerrno_to_vfserror (errno);
+	}
+
+	/* e_perm */
+	re = acl_get_permset (new_entry, &permset);
+	if (re != 0) return aclerrno_to_vfserror (errno);
+	set_permset (permset, perms);
+
+	/* fix it up: default */
+	if (type == GNOME_VFS_ACL_DEFAULT) {
+		if (! find_entry (acl->acl_default_info, ACL_USER_OBJ, ACL_UNDEFINED_ID)) {
+			clone_entry (acl->acl_info, ACL_USER_OBJ, &acl->acl_default_info, ACL_USER_OBJ);
+		}
+
+		if (! find_entry (acl->acl_default_info, ACL_GROUP_OBJ, ACL_UNDEFINED_ID)) {
+			clone_entry (acl->acl_info, ACL_GROUP_OBJ, &acl->acl_default_info, ACL_GROUP_OBJ);
+		}
+
+		if (! find_entry (acl->acl_default_info, ACL_OTHER, ACL_UNDEFINED_ID)) {
+			clone_entry (acl->acl_info, ACL_OTHER, &acl->acl_default_info, ACL_OTHER);
+		}
+	}
+
+	/* fix it up: access + default */
+	if (acl_equiv_mode (acl_obj, NULL) != 0) {
+		if (! find_entry (acl_obj, ACL_MASK, ACL_UNDEFINED_ID)) {			
+			clone_entry (acl_obj, ACL_GROUP_OBJ, &acl_obj, ACL_MASK);
+		}
+
+		acl_obj = (type == GNOME_VFS_ACL_ACCESS) ? 
+			acl->acl_info : acl->acl_default_info;
+
+		re = acl_calc_mask (&acl_obj);
+		if (re != 0) return aclerrno_to_vfserror (errno);
+	}
+
+	return GNOME_VFS_OK;	
+}
+
+
--- /dev/null	2005-10-19 09:34:03.912420500 +0100
+++ test/test-acl.c	2005-10-17 19:22:49.000000000 +0100
@@ -0,0 +1,115 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* test-xfer.c - Test program for the xfer functions in the GNOME Virtual File
+   System.
+
+   Copyright (C) 2005 Sun Microsystems
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Alvaro Lopez Ortega <alvaro@sun.com> 
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <libgen.h>
+
+#include <glib/gmessages.h>
+#include <libgnomevfs/gnome-vfs-init.h>
+#include <libgnomevfs/gnome-vfs-ops.h>
+
+char *progname;
+
+
+static void
+print_acl (const char *url, GnomeVFSFileInfo *info, GnomeVFSFileACLType type)
+{
+	char *acl_str;
+	
+	acl_str = gnome_vfs_file_acl_get_text (info->acl, type);
+	printf ("ACL for %s: \"%s\"\n", url, acl_str);
+	g_free (acl_str);
+}
+
+
+int
+main (int argc, char **argv)
+{
+	gint i;
+
+	progname = basename(argv[0]);
+
+	if (argc < 2) {
+		fprintf (stderr, "Usage: %s <file> [<file>...]\n", progname);
+		return 1;
+	}
+
+	if (!gnome_vfs_init ()) {
+		fprintf (stderr, "%s: Cannot initialize the GNOME Virtual File System.\n", progname);
+		return 1;
+	}
+
+	for (i = 1;i < argc; i++) {
+		GnomeVFSFileInfo   *info;
+		GnomeVFSResult      result;
+		gchar              *uri = argv[i];
+		struct stat         stat_buf;
+		GnomeVFSFileACLType type;
+		
+		/* If it is a directory, set the default ACL
+		 */
+		stat (uri, &stat_buf);		
+		type = (S_ISDIR(stat_buf.st_mode)) ? GNOME_VFS_ACL_DEFAULT: GNOME_VFS_ACL_ACCESS;
+
+		/* Get file info
+		 */
+		info = gnome_vfs_file_info_new ();
+
+		result = gnome_vfs_get_file_info (uri, info, GNOME_VFS_FILE_INFO_GET_ACL);
+		if (result != GNOME_VFS_OK) {
+			fprintf (stderr, "[1] %s: %s: %s\n", progname, uri, gnome_vfs_result_to_string (result));
+			return result;
+		}
+
+		print_acl (uri, info, type);
+
+		/* Modify it	
+		 */
+		result = gnome_vfs_file_acl_add_entry (info->acl, getuid(), GNOME_VFS_ACL_PERM_USER, 
+						       GNOME_VFS_ACL_ALL, type);
+		if (result != GNOME_VFS_OK) {
+			fprintf (stderr, "[2] %s: %s: %s\n", progname, uri, gnome_vfs_result_to_string (result));
+			return result;
+		}
+
+		/* Commit it
+		 */
+		result = gnome_vfs_set_file_info (uri, info, GNOME_VFS_SET_FILE_INFO_ACL);
+
+		if (result != GNOME_VFS_OK) {
+			fprintf (stderr, "[3] %s: %s: %s\n", progname, uri, gnome_vfs_result_to_string (result));
+			return result;
+		}
+
+		print_acl (uri, info, type);			 
+		gnome_vfs_file_info_unref (info);
+	}
+
+	return 0;
+}
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-vfs/configure.in,v
retrieving revision 1.389
diff -u -r1.389 configure.in
--- configure.in	5 Sep 2005 08:42:56 -0000	1.389
+++ configure.in	19 Oct 2005 14:09:36 -0000
@@ -991,6 +991,20 @@
 	AC_DEFINE(HAVE_SOCKETPAIR,1,[Define if you have the socketpair function.])
 fi
 
+dnl *****************
+dnl *** ACL stuff ***
+dnl *****************
+AC_CHECK_HEADERS(acl/libacl.h, have_acl_header=yes, have_acl_header=no)
+AC_CHECK_FUNCS(acl_get_file, have_acl_func=yes, 
+			[AC_SEARCH_LIBS(acl_get_file, [acl], have_acl_func=yes)])
+
+if test "$have_acl_func$have_acl_header" = "yesyes"; then
+  have_acl_support=yes
+fi
+
+AM_CONDITIONAL(HAVE_ACL, test $have_acl_support = yes)
+
+
 dnl =====================
 dnl File system monitors
 dnl =====================
@@ -1135,6 +1149,7 @@
 	IPv6 support:                $have_ipv6
       	Howl support:		     $msg_howl
 	HAL  support:                $msg_hal
+	ACL  support:                $have_acl_support
 	Gtk Doc:                     $enable_gtk_doc
 	FS monitor backends:         $fs_monitor_backends
 	Samba method:		     $msg_samba
Index: imported/.cvsignore
===================================================================
RCS file: /cvs/gnome/gnome-vfs/imported/.cvsignore,v
retrieving revision 1.1
diff -u -r1.1 .cvsignore
--- imported/.cvsignore	22 Nov 2004 22:09:04 -0000	1.1
+++ imported/.cvsignore	19 Oct 2005 14:09:36 -0000
@@ -1,2 +1,3 @@
 Makefile
 Makefile.in
+fnmatch
Index: libgnomevfs/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/Makefile.am,v
retrieving revision 1.139
diff -u -r1.139 Makefile.am
--- libgnomevfs/Makefile.am	8 May 2005 13:04:05 -0000	1.139
+++ libgnomevfs/Makefile.am	19 Oct 2005 14:09:36 -0000
@@ -38,6 +38,7 @@
 	gnome-vfs-drive.h			\
 	gnome-vfs-file-info.h			\
 	gnome-vfs-file-size.h			\
+	gnome-vfs-file-acl.h			\
 	gnome-vfs-find-directory.h		\
 	gnome-vfs-handle.h			\
 	gnome-vfs-init.h			\
@@ -223,6 +224,7 @@
 	gnome-vfs-enum-types.h			\
 	gnome-vfs-file-info.h			\
 	gnome-vfs-file-size.h			\
+	gnome-vfs-file-acl.h			\
 	gnome-vfs-find-directory.h		\
 	gnome-vfs-handle.h			\
 	gnome-vfs-init.h			\
@@ -257,7 +259,13 @@
 	gnome-vfs-dllmain.c			\
 	$(NULL)
 
+
+if HAVE_ACL
+libgnomevfs_acl_sources = gnome-vfs-file-acl.c
+endif
+
 libgnomevfs_unix_sources =			\
+	$(libgnomevfs_acl_sources)    \
 	gnome-vfs-cdrom.c			\
 	gnome-vfs-dns-sd.c			\
 	gnome-vfs-parse-ls.c			\
Index: libgnomevfs/gnome-vfs-file-info.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-file-info.c,v
retrieving revision 1.25
diff -u -r1.25 gnome-vfs-file-info.c
--- libgnomevfs/gnome-vfs-file-info.c	6 May 2005 11:52:40 -0000	1.25
+++ libgnomevfs/gnome-vfs-file-info.c	19 Oct 2005 14:09:36 -0000
@@ -91,6 +91,7 @@
 	
 }
 
+
 /**
  * gnome_vfs_file_info_unref
  * @info: Pointer to a file information struct
@@ -133,6 +134,8 @@
 	g_free (info->symlink_name);
 	g_free (info->mime_type);
 
+        gnome_vfs_file_acl_free (info->acl);
+
 	/* Ensure the ref count is maintained correctly */
 	g_static_mutex_lock (&file_info_ref_lock);
 
@@ -196,6 +199,7 @@
 	dest->name = g_strdup (src->name);
 	dest->symlink_name = g_strdup (src->symlink_name);
 	dest->mime_type = g_strdup (src->mime_type);
+	dest->acl = gnome_vfs_file_acl_dup (src->acl);
 
 	dest->refcount = old_refcount;
 
Index: libgnomevfs/gnome-vfs-file-info.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-file-info.h,v
retrieving revision 1.31
diff -u -r1.31 gnome-vfs-file-info.h
--- libgnomevfs/gnome-vfs-file-info.h	6 May 2005 11:52:40 -0000	1.31
+++ libgnomevfs/gnome-vfs-file-info.h	19 Oct 2005 14:09:36 -0000
@@ -28,6 +28,7 @@
 #define GNOME_VFS_FILE_INFO_H
 
 #include <libgnomevfs/gnome-vfs-file-size.h>
+#include <libgnomevfs/gnome-vfs-file-acl.h>
 #include <libgnomevfs/gnome-vfs-result.h>
 #include <libgnomevfs/gnome-vfs-uri.h>
 #include <sys/stat.h>
@@ -124,6 +125,7 @@
  * @GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME: Symlink name field is valid
  * @GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE: Mime type field is valid
  * @GNOME_VFS_FILE_INFO_FIELDS_ACCESS: Access bits of the permissions
+ * @GNOME_VFS_FILE_INFO_FIELDS_ACL: ACLs field is valid
  * bitfield are valid
  *
  * Flags indicating what fields in a GnomeVFSFileInfo struct are valid. 
@@ -147,7 +149,8 @@
 	GNOME_VFS_FILE_INFO_FIELDS_CTIME = 1 << 11,
 	GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME = 1 << 12,
 	GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE = 1 << 13,
-	GNOME_VFS_FILE_INFO_FIELDS_ACCESS = 1 << 14
+	GNOME_VFS_FILE_INFO_FIELDS_ACCESS = 1 << 14,
+	GNOME_VFS_FILE_INFO_FIELDS_ACL = 1 << 15
 } GnomeVFSFileInfoFields;
 
 /* FIXME: It's silly to use the symbolic constants for POSIX here.
@@ -262,13 +265,15 @@
 
 	guint refcount;
 
+	/* File ACLs */
+	GnomeVFSFileACL *acl;
+
 	/* Reserved for future expansions to GnomeVFSFileInfo without having
 	   to break ABI compatibility */
 	void *reserved1;
 	void *reserved2;
 	void *reserved3;
 	void *reserved4;
-	void *reserved5;
 } GnomeVFSFileInfo;
 
 /**
@@ -285,6 +290,7 @@
  * to what would return access(2) on a local file system (ie is the 
  * file readable, writable and/or executable). Can be really slow on 
  * remote file systems
+ * @GNOME_VFS_FILE_INFO_GET_ACL: get ACLs for the file
  *
  * Packed boolean bitfield representing options that can
  * be passed into a gnome_vfs_get_file_info() call (or other
@@ -298,7 +304,8 @@
 	GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE = 1 << 1,
 	GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE = 1 << 2,
 	GNOME_VFS_FILE_INFO_FOLLOW_LINKS = 1 << 3,
-	GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS = 1 << 4
+	GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS = 1 << 4,
+	GNOME_VFS_FILE_INFO_GET_ACL = 1 << 5
 } GnomeVFSFileInfoOptions;
 
 /**
@@ -308,6 +315,7 @@
  * @GNOME_VFS_SET_FILE_INFO_PERMISSIONS: change the permissions
  * @GNOME_VFS_SET_FILE_INFO_OWNER: change the file's owner
  * @GNOME_VFS_SET_FILE_INFO_TIME: change the file's time stamp(s)
+ * @GNOME_VFS_SET_FILE_INFO_ACL: change the file's ACLs
  *
  * Packed boolean bitfield representing the aspects of the file
  * to be changed in a gnome_vfs_set_file_info() call.
@@ -318,7 +326,8 @@
 	GNOME_VFS_SET_FILE_INFO_NAME = 1 << 0,
 	GNOME_VFS_SET_FILE_INFO_PERMISSIONS = 1 << 1,
 	GNOME_VFS_SET_FILE_INFO_OWNER = 1 << 2,
-	GNOME_VFS_SET_FILE_INFO_TIME = 1 << 3
+	GNOME_VFS_SET_FILE_INFO_TIME = 1 << 3,
+	GNOME_VFS_SET_FILE_INFO_ACL = 1 << 4	
 } GnomeVFSSetFileInfoMask;
 
 
Index: modules/file-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/file-method.c,v
retrieving revision 1.144
diff -u -r1.144 file-method.c
--- modules/file-method.c	15 Jul 2005 13:46:53 -0000	1.144
+++ modules/file-method.c	19 Oct 2005 14:09:37 -0000
@@ -711,6 +711,38 @@
 	g_free (directory_handle);
 }
 
+/* ACL */
+static GnomeVFSResult
+get_acl (GnomeVFSFileInfo *info,
+	 const char *full_name,
+	 GnomeVFSFileInfoOptions options,
+	 struct stat *stat_buffer)
+{
+	GnomeVFSResult ret;
+
+	if (info->acl != NULL) {
+		gnome_vfs_file_acl_free (info->acl);
+		info->acl = NULL;
+	}
+
+	info->acl = gnome_vfs_file_acl_new ();
+	if (info->acl == NULL) 
+		return GNOME_VFS_ERROR_NO_MEMORY;
+
+	ret = gnome_vfs_file_acl_read_access (info->acl, full_name);
+	if ((ret != GNOME_VFS_OK) && !S_ISDIR(stat_buffer->st_mode)) 
+		return ret;
+
+	if (S_ISDIR(stat_buffer->st_mode)) {
+		ret = gnome_vfs_file_acl_read_default (info->acl, full_name);
+		if (ret != GNOME_VFS_OK) return ret;
+	}
+
+	info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_ACL;
+	return GNOME_VFS_OK;
+}
+
+
 /* MIME detection code.  */
 static void
 get_mime_type (GnomeVFSFileInfo *info,
@@ -1103,6 +1135,10 @@
 		get_mime_type (file_info, full_name, options, &statbuf);
 	}
 
+	if (options & GNOME_VFS_FILE_INFO_GET_ACL) {
+		get_acl (file_info, full_name, options, &statbuf);
+	}
+
 	g_free (full_name);
 
 	return GNOME_VFS_OK;
@@ -2274,6 +2310,18 @@
 			g_free (full_name);
 			return gnome_vfs_result_from_errno ();
 		}
+	}
+
+	if (gnome_vfs_context_check_cancellation (context)) {
+		g_free (full_name);
+		return GNOME_VFS_ERROR_CANCELLED;
+	}
+
+	if (mask & GNOME_VFS_SET_FILE_INFO_ACL) {
+		GnomeVFSResult ret;
+
+		ret = gnome_vfs_file_acl_commit (info->acl, full_name);
+		if (ret != GNOME_VFS_OK) return ret;
 	}
 
 	g_free (full_name);
Index: test/.cvsignore
===================================================================
RCS file: /cvs/gnome/gnome-vfs/test/.cvsignore,v
retrieving revision 1.24
diff -u -r1.24 .cvsignore
--- test/.cvsignore	22 Nov 2004 22:09:04 -0000	1.24
+++ test/.cvsignore	19 Oct 2005 14:09:37 -0000
@@ -37,3 +37,4 @@
 test-mime-info-cache
 vfs-run
 test-queue
+test-acl
Index: test/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-vfs/test/Makefile.am,v
retrieving revision 1.62
diff -u -r1.62 Makefile.am
--- test/Makefile.am	14 Apr 2005 18:48:31 -0000	1.62
+++ test/Makefile.am	19 Oct 2005 14:09:37 -0000
@@ -15,6 +15,10 @@
 platform_only_programs = test-dns-sd test-symlinks
 endif
 
+if HAVE_ACL
+acl_programs = test-acl
+endif
+
 noinst_PROGRAMS =				\
 	test-async				\
 	test-async-cancel                       \
@@ -46,6 +50,7 @@
 	test-module-selftest			\
 	test-queue				\
 	$(platform_only_programs)		\
+	$(acl_programs)				\
 	$(NULL)
 
 test_files=		\
@@ -167,6 +172,10 @@
 
 test_queue_SOURCES = test-queue.c
 test_queue_LDADD = $(libraries)
+
+test_acl_SOURCES = test-acl.c
+test_acl_LDADD = $(libraries)
+
 
 EXTRA_DIST =					\
 	$(test_files)				\
