1 --- gnome-vfs-2.17.2-orig/configure.in 2007-04-10 01:50:02.575026000 +0200
2 +++ gnome-vfs-2.17.2-alo/configure.in 2007-04-03 12:35:51.151289000 +0200
5 dnl ==============================================================================
7 -PKG_CHECK_MODULES(LIBGNOMEVFS, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libxml-2.0 >= $XML_REQUIRED gnome-mime-data-2.0 $dbus_requirement)
8 +PKG_CHECK_MODULES(LIBGNOMEVFS, glib-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED gconf-2.0 >= $GCONF_REQUIRED libxml-2.0 >= $XML_REQUIRED gnome-mime-data-2.0 dbus-glib-1 >= 0.60)
9 LIBGNOMEVFS_CFLAGS="$LIBGNOMEVFS_CFLAGS $OPENSSL_CFLAGS $LIBGNUTLS_CFLAGS $HOWL_CFLAGS $AVAHI_CFLAGS"
10 LIBGNOMEVFS_LIBS="$LIBGNOMEVFS_LIBS $OPENSSL_LIBS $LIBGNUTLS_LIBS $HOWL_LIBS $AVAHI_LIBS $RESOLVER_LIBS"
11 AC_SUBST(LIBGNOMEVFS_CFLAGS)
12 @@ -1122,52 +1092,10 @@
13 AC_CHECK_FUNCS(acl_extended_file)
15 AC_CHECK_HEADERS([pwd.h])
16 - if test "$ac_cv_header_pwd_h" = "yes"; then
17 - AC_CACHE_CHECK([for posix getpwuid_r],
18 - ac_cv_func_posix_getpwuid_r,
24 - struct passwd pwd, *pwptr = &pwd;
27 - error = getpwuid_r (0, &pwd, buffer,
28 - sizeof (buffer), &pwptr);
29 - return (error < 0 && errno == ENOSYS)
32 - [ac_cv_func_posix_getpwuid_r=yes],
33 - [ac_cv_func_posix_getpwuid_r=no])])
34 - dnl GLIB_ASSERT_SET(ac_cv_func_posix_getpwuid_r)
35 - if test "$ac_cv_func_posix_getpwuid_r" = yes; then
36 - AC_DEFINE(HAVE_POSIX_GETPWUID_R,1,
37 - [Have POSIX function getpwuid_r])
39 - AC_CACHE_CHECK([for nonposix getpwuid_r],
40 - ac_cv_func_nonposix_getpwuid_r,
41 - [AC_TRY_LINK([#include <pwd.h>],
42 - [char buffer[10000];
44 - getpwuid_r (0, &pwd, buffer,
46 - [ac_cv_func_nonposix_getpwuid_r=yes],
47 - [ac_cv_func_nonposix_getpwuid_r=no])])
48 - dnl GLIB_ASSERT_SET(ac_cv_func_nonposix_getpwuid_r)
49 - if test "$ac_cv_func_nonposix_getpwuid_r" = yes; then
50 - AC_DEFINE(HAVE_NONPOSIX_GETPWUID_R,1,
51 - [Have non-POSIX function getpwuid_r])
56 - AC_CHECK_HEADERS([grp.h])
59 - AC_CHECK_FUNCS(getgrgid_r)
60 - AC_CHECK_FUNCS(getgrnam_r)
61 - AC_CHECK_FUNCS(getpwnam_r)
63 + AC_CHECK_HEADERS([grp.h])
68 --- gnome-vfs-2.17.2-orig/acinclude.m4 2007-04-10 01:50:02.574820000 +0200
69 +++ gnome-vfs-2.17.2-alo/acinclude.m4 2007-04-03 12:35:48.071873000 +0200
75 dnl end of neon macros
79 +dnl checks for password entry functions and header files
81 +AC_DEFUN([FW_CHECK_PWD],
86 +AC_MSG_CHECKING(for getpwnam_r with 5 parameters)
87 +AC_TRY_COMPILE([#include <pwd.h>
88 +#include <stdlib.h>],
89 +getpwnam_r(NULL,NULL,NULL,0,NULL);,AC_DEFINE(HAVE_GETPWNAM_R_5,1,Some systems have getpwnam_r) AC_DEFINE(HAVE_GETPWNAM_R,1,Some systems have getpwnam_r) AC_MSG_RESULT(yes); HAVE_GETPWNAM_R="yes", AC_MSG_RESULT(no))
91 +if ( test -z "$HAVE_GETPWNAM_R" )
93 + AC_MSG_CHECKING(for getpwnam_r with 4 parameters)
94 + AC_TRY_COMPILE([#include <pwd.h>
95 +#include <stdlib.h>],
96 +getpwnam_r(NULL,NULL,NULL,0);,AC_DEFINE(HAVE_GETPWNAM_R_4,1,Some systems have getpwnam_r) AC_DEFINE(HAVE_GETPWNAM_R,1,Some systems have getpwnam_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
101 +AC_MSG_CHECKING(for getpwuid_r with 5 parameters)
102 +AC_TRY_COMPILE([#include <pwd.h>
103 +#include <stdlib.h>],
104 +getpwuid_r(0,NULL,NULL,0,NULL);,AC_DEFINE(HAVE_GETPWUID_R_5,1,Some systems have getpwuid_r) AC_DEFINE(HAVE_GETPWUID_R,1,Some systems have getpwuid_r) AC_MSG_RESULT(yes); HAVE_GETPWUID_R="yes", AC_MSG_RESULT(no))
106 +if ( test -z "$HAVE_GETPWUID_R" )
108 + AC_MSG_CHECKING(for getpwuid_r with 4 parameters)
109 + AC_TRY_COMPILE([#include <pwd.h>
110 +#include <stdlib.h>],
111 +getpwuid_r(0,NULL,NULL,0);,AC_DEFINE(HAVE_GETPWUID_R_4,1,Some systems have getpwuid_r) AC_DEFINE(HAVE_GETPWUID_R,1,Some systems have getpwuid_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
118 +dnl checks for group entry functions and header files
120 +AC_DEFUN([FW_CHECK_GRP],
125 +AC_MSG_CHECKING(for getgrnam_r with 5 parameters)
126 +AC_TRY_COMPILE([#include <grp.h>
127 +#include <stdlib.h>],
128 +getgrnam_r(NULL,NULL,NULL,0,NULL);,AC_DEFINE(HAVE_GETGRNAM_R_5,1,Some systems have getgrnam_r) AC_DEFINE(HAVE_GETGRNAM_R,1,Some systems have getgrnam_r) AC_MSG_RESULT(yes); HAVE_GETGRNAM_R="yes", AC_MSG_RESULT(no))
130 +if ( test -z "$HAVE_GETGRNAM_R" )
132 + AC_MSG_CHECKING(for getgrnam_r with 4 parameters)
133 + AC_TRY_COMPILE([#include <grp.h>
134 +#include <stdlib.h>],
135 +getgrnam_r(NULL,NULL,NULL,0);,AC_DEFINE(HAVE_GETGRNAM_R_4,1,Some systems have getgrnam_r) AC_DEFINE(HAVE_GETGRNAM_R,1,Some systems have getgrnam_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
140 +AC_MSG_CHECKING(for getgrgid_r with 5 parameters)
141 +AC_TRY_COMPILE([#include <grp.h>
142 +#include <stdlib.h>],
143 +getgrgid_r(0,NULL,NULL,0,NULL);,AC_DEFINE(HAVE_GETGRGID_R_5,1,Some systems have getgrgid_r) AC_DEFINE(HAVE_GETGRGID_R,1,Some systems have getgrgid_r) AC_MSG_RESULT(yes); HAVE_GETGRGID_R="yes", AC_MSG_RESULT(no))
145 +if ( test -z "$HAVE_GETGRGID_R" )
147 + AC_MSG_CHECKING(for getgrgid_r with 4 parameters)
148 + AC_TRY_COMPILE([#include <grp.h>
149 +#include <stdlib.h>],
150 +getgrgid_r(0,NULL,NULL,0);,AC_DEFINE(HAVE_GETGRGID_R_4,1,Some systems have getgrgid_r) AC_DEFINE(HAVE_GETGRGID_R,1,Some systems have getgrgid_r) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
157 --- gnome-vfs-2.17.2-orig/libgnomevfs/gnome-vfs-ace.c 2007-04-10 01:50:02.414610000 +0200
158 +++ gnome-vfs-2.17.2-alo/libgnomevfs/gnome-vfs-ace.c 2007-04-03 12:35:45.753157000 +0200
161 struct _GnomeVFSACEPrivate {
163 - GnomeVFSACLKind kind;
165 + GnomeVFSACLKind kind;
166 + GnomeVFSACLType type;
167 + GnomeVFSACLInherance inherance;
176 +// gboolean negative;
177 +// gboolean inherit;
180 #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GNOME_VFS_TYPE_ACE, GnomeVFSACEPrivate))
192 @@ -161,26 +162,31 @@
197 - pspec = g_param_spec_boolean ("negative",
201 - G_PARAM_READWRITE);
202 + pspec = g_param_spec_uint ("type",
205 + GNOME_VFS_ACL_TYPE_NULL,
207 + GNOME_VFS_ACL_TYPE_NULL,
208 + G_PARAM_READWRITE |
209 + G_PARAM_CONSTRUCT);
211 g_object_class_install_property (gobject_class,
217 - pspec = g_param_spec_boolean ("inherit",
221 - G_PARAM_READWRITE);
222 + pspec = g_param_spec_uint ("inherance",
225 + GNOME_VFS_ACL_INHERANCE_NULL,
227 + GNOME_VFS_ACL_INHERANCE_NULL,
228 + G_PARAM_READWRITE |
229 + G_PARAM_CONSTRUCT);
231 g_object_class_install_property (gobject_class,
237 @@ -226,14 +232,14 @@
238 permset_set (&priv->perm_set, pset);
242 - priv->inherit = g_value_get_boolean (value);
244 + priv->type = g_value_get_uint (value);
247 - case PROP_NEGATIVE:
248 - priv->negative = g_value_get_boolean (value);
250 + case PROP_INHERANCE:
251 + priv->inherance = g_value_get_uint (value);
256 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
258 @@ -263,12 +269,12 @@
259 g_value_set_pointer (value, priv->perm_set.perms);
263 - g_value_set_boolean (value, priv->inherit);
265 + g_value_set_uint (value, priv->type);
268 - case PROP_NEGATIVE:
269 - g_value_set_boolean (value, priv->negative);
271 + case PROP_INHERANCE:
272 + g_value_set_uint (value, priv->inherance);
277 /* Public Interface */
280 -gnome_vfs_ace_new (GnomeVFSACLKind kind,
282 - GnomeVFSACLPerm *perms)
283 +gnome_vfs_ace_new (GnomeVFSACLKind kind,
285 + GnomeVFSACLPerm *perms,
286 + GnomeVFSACLType type,
287 + GnomeVFSACLInherance inherance)
294 "permissions", perms,
296 + "inherance", inherance,
300 @@ -426,40 +436,38 @@
301 priv->id = g_strdup (id);
305 -gnome_vfs_ace_set_inherit (GnomeVFSACE *entry,
308 +gnome_vfs_ace_get_ace_type (GnomeVFSACE *entry)
310 - g_object_set (G_OBJECT(entry), "inherit", inherit, NULL);
311 + return entry->priv->type;
315 -gnome_vfs_ace_get_inherit (GnomeVFSACE *entry)
319 - g_object_get (G_OBJECT(entry), "inherit", &inherit, NULL);
322 +gnome_vfs_ace_set_ace_type (GnomeVFSACE *entry,
323 + GnomeVFSACLType type)
325 + entry->priv->type = type;
330 -gnome_vfs_ace_set_negative (GnomeVFSACE *entry,
332 +GnomeVFSACLInherance
333 +gnome_vfs_ace_get_inherance (GnomeVFSACE *entry)
335 - g_object_set (G_OBJECT(entry), "negative", negative, NULL);
336 + return entry->priv->inherance;
340 -gnome_vfs_ace_get_negative (GnomeVFSACE *entry)
344 - g_object_get (G_OBJECT(entry), "negative", &negative, NULL);
347 +gnome_vfs_ace_set_inherance (GnomeVFSACE *entry,
348 + GnomeVFSACLInherance inherance)
350 + entry->priv->inherance = inherance;
356 const GnomeVFSACLPerm *
357 gnome_vfs_ace_get_perms (GnomeVFSACE *entry)
360 priv_a = entry_a->priv;
361 priv_b = entry_b->priv;
364 return (priv_a->kind == priv_b->kind &&
365 g_str_equal_safe (priv_a->id, priv_b->id) &&
366 - priv_a->inherit == priv_b->inherit &&
367 - priv_a->negative == priv_b->negative);
368 + priv_a->inherance == priv_b->inherance &&
369 + priv_a->type == priv_b->type);
372 --- gnome-vfs-2.17.2-orig/libgnomevfs/gnome-vfs-ace.h 2007-04-10 01:50:02.395768000 +0200
373 +++ gnome-vfs-2.17.2-alo/libgnomevfs/gnome-vfs-ace.h 2007-04-03 12:35:45.001762000 +0200
376 typedef guint32 GnomeVFSACLKind;
377 typedef guint32 GnomeVFSACLPerm;
378 +typedef guint32 GnomeVFSACLType;
379 +typedef guint32 GnomeVFSACLInherance;
380 +typedef guint32 GnomeVFSACLScheme;
383 GType gnome_vfs_ace_get_type (void) G_GNUC_CONST;
385 GnomeVFSACE * gnome_vfs_ace_new (GnomeVFSACLKind kind,
387 - GnomeVFSACLPerm *perms);
388 + GnomeVFSACLPerm *perms,
389 + GnomeVFSACLType type,
390 + GnomeVFSACLInherance inherance);
392 GnomeVFSACLKind gnome_vfs_ace_get_kind (GnomeVFSACE *entry);
393 void gnome_vfs_ace_set_kind (GnomeVFSACE *entry,
395 const char * gnome_vfs_ace_get_id (GnomeVFSACE *entry);
396 void gnome_vfs_ace_set_id (GnomeVFSACE *entry,
399 -gboolean gnome_vfs_ace_get_inherit (GnomeVFSACE *entry);
400 -void gnome_vfs_ace_set_inherit (GnomeVFSACE *entry,
403 -gboolean gnome_vfs_ace_get_negative (GnomeVFSACE *entry);
404 -void gnome_vfs_ace_set_negative (GnomeVFSACE *entry,
405 - gboolean negative);
407 const GnomeVFSACLPerm * gnome_vfs_ace_get_perms (GnomeVFSACE *entry);
408 void gnome_vfs_ace_set_perms (GnomeVFSACE *entry,
409 GnomeVFSACLPerm *perms);
411 +GnomeVFSACLType gnome_vfs_ace_get_ace_type (GnomeVFSACE *entry);
412 +void gnome_vfs_ace_set_ace_type (GnomeVFSACE *entry,
413 + GnomeVFSACLType type);
415 +GnomeVFSACLInherance gnome_vfs_ace_get_inherance (GnomeVFSACE *entry);
416 +void gnome_vfs_ace_set_inherance (GnomeVFSACE *entry,
417 + GnomeVFSACLInherance inherit);
419 +gboolean gnome_vfs_ace_equal (GnomeVFSACE *entry_a,
420 + GnomeVFSACE *entry_b);
422 +/* Permission related */
423 void gnome_vfs_ace_add_perm (GnomeVFSACE *entry,
424 GnomeVFSACLPerm perm);
425 void gnome_vfs_ace_del_perm (GnomeVFSACE *entry,
427 void gnome_vfs_ace_copy_perms (GnomeVFSACE *source,
430 -gboolean gnome_vfs_ace_equal (GnomeVFSACE *entry_a,
431 - GnomeVFSACE *entry_b);
432 +/* Deprecated functions */
433 +gboolean gnome_vfs_ace_get_negative (GnomeVFSACE *entry);
434 +void gnome_vfs_ace_set_negative (GnomeVFSACE *entry,
435 + gboolean negative);
439 --- gnome-vfs-2.17.2-orig/libgnomevfs/gnome-vfs-acl.c 2007-04-10 01:50:02.414684000 +0200
440 +++ gnome-vfs-2.17.2-alo/libgnomevfs/gnome-vfs-acl.c 2007-04-03 12:35:46.112022000 +0200
442 struct _GnomeVFSACLPrivate {
445 + GnomeVFSACLScheme scheme;
454 list = g_list_copy (priv->entries);
456 g_list_foreach (list, (GFunc) g_object_ref, NULL);
458 case GNOME_VFS_ACL_OTHER:
463 + case GNOME_VFS_ACL_MASK:
467 + case GNOME_VFS_ACL_EVERYONE:
468 + value = "everyone";
471 + case GNOME_VFS_ACL_OWNER_USER:
472 + value = "owner user";
475 + case GNOME_VFS_ACL_OWNER_GROUP:
476 + value = "owner group";
483 case GNOME_VFS_ACL_EXECUTE:
487 + /* NFSv4, ZFS extended permissions
489 + case GNOME_VFS_ACL_LIST_DIRECTORY:
490 + value = "list directory";
493 + GNOME_VFS_ACL_ADD_FILE:
494 + value = "add file";
497 + GNOME_VFS_ACL_APPEND_DATA:
498 + value = "append data";
501 + GNOME_VFS_ACL_ADD_SUBDIRECTORY:
502 + value = "add subdirectory";
505 + GNOME_VFS_ACL_READ_NAMED_ATTRS:
506 + value = "read named attributes";
509 + GNOME_VFS_ACL_WRITE_NAMED_ATTRS:
510 + value = "write named attributes";
513 + GNOME_VFS_ACL_DELETE_CHILD:
514 + value = "delete child";
517 + GNOME_VFS_ACL_READ_ATTRIBUTES:
518 + value = "read attributes";
521 + GNOME_VFS_ACL_WRITE_ATTRIBUTES:
522 + value = "write attributes";
525 + GNOME_VFS_ACL_DELETE:
529 + GNOME_VFS_ACL_READ_ACL:
530 + value = "read acl";
533 + GNOME_VFS_ACL_WRITE_ACL:
534 + value = "write acl";
537 + GNOME_VFS_ACL_WRITE_OWNER:
538 + value = "write owner";
541 + GNOME_VFS_ACL_SYNCHRONIZE:
542 + value = "synchronize";
553 +gnome_vfs_acl_type_to_string (GnomeVFSACLType type)
557 + if (type < GNOME_VFS_ACL_TYPE_SYS_LAST) {
560 + case GNOME_VFS_ACL_ALLOW:
564 + case GNOME_VFS_ACL_DENY:
568 + case GNOME_VFS_ACL_AUDIT:
572 + case GNOME_VFS_ACL_ALARM:
589 +gnome_vfs_acl_inherance_to_string (GnomeVFSACLInherance inheritance)
593 + if (inheritance < GNOME_VFS_ACL_TYPE_SYS_LAST) {
595 + switch (inheritance) {
596 + case GNOME_VFS_ACL_FILE_INHERIT:
597 + value = "File inherit";
600 + case GNOME_VFS_ACL_DIR_INHERIT:
601 + value = "Directory inherit";
604 + case GNOME_VFS_ACL_INHERIT_ONLY:
605 + value = "Inherit only";
608 + case GNOME_VFS_ACL_NO_PROPAGATE:
609 + value = "No propagate";
624 +gnome_vfs_acl_set_scheme (GnomeVFSACL *acl,
625 + GnomeVFSACLScheme scheme)
627 + acl->priv->scheme = scheme;
632 +gnome_vfs_acl_get_scheme (GnomeVFSACL *acl)
634 + return acl->priv->scheme;
636 --- gnome-vfs-2.17.2-orig/libgnomevfs/gnome-vfs-acl.h 2007-04-10 01:50:02.395830000 +0200
637 +++ gnome-vfs-2.17.2-alo/libgnomevfs/gnome-vfs-acl.h 2007-04-10 00:59:28.459819000 +0200
640 /* ************************************************************************** */
644 +const char * gnome_vfs_acl_inherance_to_string (GnomeVFSACLInherance inherance);
647 + GNOME_VFS_ACL_INHERANCE_NULL = 0,
648 + GNOME_VFS_ACL_FILE_INHERIT,
649 + GNOME_VFS_ACL_DIR_INHERIT,
650 + GNOME_VFS_ACL_INHERIT_ONLY,
651 + GNOME_VFS_ACL_NO_PROPAGATE,
652 + GNOME_VFS_ACL_INHERANCE_SYS_LAST
658 const char * gnome_vfs_acl_kind_to_string (GnomeVFSACLKind kind);
661 GNOME_VFS_ACL_KIND_NULL = 0,
670 + /* NFSv4, ZFS extended kinds */
671 + GNOME_VFS_ACL_EVERYONE,
672 + GNOME_VFS_ACL_OWNER_USER,
673 + GNOME_VFS_ACL_OWNER_GROUP,
675 GNOME_VFS_ACL_KIND_SYS_LAST
681 GNOME_VFS_ACL_PERM_NULL = 0,
683 + /* Basic permissions */
684 GNOME_VFS_ACL_READ = 1,
686 - GNOME_VFS_ACL_EXECUTE,
687 + GNOME_VFS_ACL_EXECUTE,
689 + /* NFSv4, ZFS extended permissions */
690 + GNOME_VFS_ACL_LIST_DIRECTORY,
691 + GNOME_VFS_ACL_ADD_FILE,
692 + GNOME_VFS_ACL_APPEND_DATA,
693 + GNOME_VFS_ACL_ADD_SUBDIRECTORY,
694 + GNOME_VFS_ACL_READ_NAMED_ATTRS,
695 + GNOME_VFS_ACL_WRITE_NAMED_ATTRS,
696 + GNOME_VFS_ACL_DELETE_CHILD,
697 + GNOME_VFS_ACL_READ_ATTRIBUTES,
698 + GNOME_VFS_ACL_WRITE_ATTRIBUTES,
699 + GNOME_VFS_ACL_DELETE,
700 + GNOME_VFS_ACL_READ_ACL,
701 + GNOME_VFS_ACL_WRITE_ACL,
702 + GNOME_VFS_ACL_WRITE_OWNER,
703 + GNOME_VFS_ACL_SYNCHRONIZE,
705 GNOME_VFS_ACL_PERM_SYS_LAST
711 +const char * gnome_vfs_acl_type_to_string (GnomeVFSACLType type);
714 + GNOME_VFS_ACL_TYPE_NULL = 0,
715 + GNOME_VFS_ACL_ALLOW,
716 + GNOME_VFS_ACL_DENY,
717 + GNOME_VFS_ACL_AUDIT,
718 + GNOME_VFS_ACL_ALARM,
719 + GNOME_VFS_ACL_TYPE_SYS_LAST
724 + GNOME_VFS_ACL_SCHEME_NULL,
725 + GNOME_VFS_ACL_SCHEME_CLASSIC,
726 + GNOME_VFS_ACL_SCHEME_NFS4
729 /* ************************************************************************** */
731 #define GNOME_VFS_TYPE_ACL (gnome_vfs_acl_get_type ())
733 GList * gnome_vfs_acl_get_ace_list (GnomeVFSACL *acl);
734 void gnome_vfs_acl_free_ace_list (GList *ace_list);
736 +void gnome_vfs_acl_set_scheme (GnomeVFSACL *acl,
737 + GnomeVFSACLScheme scheme);
739 + gnome_vfs_acl_get_scheme (GnomeVFSACL *acl);
744 --- gnome-vfs-2.17.2-orig/modules/file-method-acl.c 2007-04-10 01:50:02.776935000 +0200
745 +++ gnome-vfs-2.17.2-alo/modules/file-method-acl.c 2007-04-10 01:17:48.169875000 +0200
749 #include <sys/types.h>
750 -#ifdef HAVE_SYS_RESOURCE_H
751 #include <sys/resource.h>
757 struct passwd *pw = NULL;
758 gpointer buffer = NULL;
761 -#if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
762 +// #if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
769 #endif /* _SC_GETPW_R_SIZE_MAX */
777 #ifdef HAVE_POSIX_GETPWUID_R
778 - error = getpwuid_r (uid, &pwd, buffer, bufsize, &pw);
779 + error = getpwuid_r (uid, &pwd, buffer, bufsize, &pw);
780 error = error < 0 ? errno : error;
781 #else /* HAVE_NONPOSIX_GETPWUID_R */
782 /* HPUX 11 falls into the HAVE_POSIX_GETPWUID_R case */
784 error = getpwuid_r (uid, &pwd, buffer, bufsize);
785 pw = error == 0 ? &pwd : NULL;
787 - pw = getpwuid_r (uid, &pwd, buffer, bufsize);
788 + pw = getpwuid_r (uid, &pwd, buffer, bufsize, &pw);
789 error = pw ? 0 : errno;
791 #endif /* HAVE_NONPOSIX_GETPWUID_R */
794 if (error == 0 || error == ENOENT) {
799 } while (pw == NULL);
800 -#endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
801 +// #endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
808 #endif /* HAVE_PWD_H */
810 if (uid_string == NULL) {
811 uid_string = g_strdup_printf ("%d", uid);
816 permset_to_perms (e_ps, pset);
817 - ace = gnome_vfs_ace_new (kind, id, pset);
818 + ace = gnome_vfs_ace_new (kind, id, pset, GNOME_VFS_ACL_ALLOW);
825 #ifdef HAVE_SOLARIS_ACL
826 -#define SOLARIS_N_TAGS 3
827 +//#define SOLARIS_N_TAGS 3
828 +#define SOLARIS_N_TAGS GNOME_VFS_ACL_PERM_SYS_LAST
831 fixup_acl (GnomeVFSACL *acl, GSList *acls)
833 GnomeVFSACLKind kind;
834 GnomeVFSACE *ace = GNOME_VFS_ACE(i->data);
836 - if (!gnome_vfs_ace_get_inherit(ace))
837 +// if (!gnome_vfs_ace_get_inherit(ace))
839 + if (gnome_vfs_ace_get_inherance(ace) == GNOME_VFS_ACL_INHERANCE_NULL)
845 GNOME_VFS_ACL_EXECUTE, 0};
847 - ace = gnome_vfs_ace_new (GNOME_VFS_ACL_USER, NULL, perms);
848 - gnome_vfs_ace_set_inherit (ace, TRUE);
849 + ace = gnome_vfs_ace_new (GNOME_VFS_ACL_USER, NULL, perms, GNOME_VFS_ACL_ALLOW, GNOME_VFS_ACL_FILE_INHERIT);
850 +// gnome_vfs_ace_set_inherit (ace, TRUE);
851 gnome_vfs_acl_set (acl, ace);
852 g_slist_append(acls, ace);
856 GnomeVFSACLPerm perms[] = {0};
858 - ace = gnome_vfs_ace_new (GNOME_VFS_ACL_GROUP, NULL, perms);
859 - gnome_vfs_ace_set_inherit (ace, TRUE);
860 + ace = gnome_vfs_ace_new (GNOME_VFS_ACL_GROUP, NULL, perms, GNOME_VFS_ACL_ALLOW, GNOME_VFS_ACL_FILE_INHERIT);
861 +// gnome_vfs_ace_set_inherit (ace, TRUE);
862 gnome_vfs_acl_set (acl, ace);
867 GnomeVFSACLPerm perms[] = {0};
869 - ace = gnome_vfs_ace_new (GNOME_VFS_ACL_OTHER, NULL, perms);
870 - gnome_vfs_ace_set_inherit (ace, TRUE);
871 + ace = gnome_vfs_ace_new (GNOME_VFS_ACL_OTHER, NULL, perms, GNOME_VFS_ACL_ALLOW, GNOME_VFS_ACL_FILE_INHERIT);
872 +// gnome_vfs_ace_set_inherit (ace, TRUE);
873 gnome_vfs_acl_set (acl, ace);
878 GNOME_VFS_ACL_EXECUTE, 0};
880 - ace = gnome_vfs_ace_new (GNOME_VFS_ACL_MASK, NULL, perms);
881 - gnome_vfs_ace_set_inherit (ace, TRUE);
882 + ace = gnome_vfs_ace_new (GNOME_VFS_ACL_MASK, NULL, perms, GNOME_VFS_ACL_ALLOW, GNOME_VFS_ACL_FILE_INHERIT);
883 +// gnome_vfs_ace_set_inherit (ace, TRUE);
884 gnome_vfs_acl_set (acl, ace);
893 +nfs4_access_mask_to_perms (int access_mask, GnomeVFSACLPerm *tags)
897 + memset (tags, 0, sizeof (GnomeVFSACLPerm) * (SOLARIS_N_TAGS + 1));
900 + /* Basic permissions
902 + if (access_mask & ACE_READ_DATA)
903 + tags[i++] = GNOME_VFS_ACL_READ;
905 + if (access_mask & ACE_WRITE_DATA)
906 + tags[i++] = GNOME_VFS_ACL_WRITE;
908 + if (access_mask & ACE_EXECUTE)
909 + tags[i++] = GNOME_VFS_ACL_EXECUTE;
911 + /* NFS4 permissions
913 + if (access_mask & ACE_LIST_DIRECTORY)
914 + tags[i++] = GNOME_VFS_ACL_LIST_DIRECTORY;
916 + if (access_mask & ACE_ADD_FILE)
917 + tags[i++] = GNOME_VFS_ACL_ADD_FILE;
919 + if (access_mask & ACE_APPEND_DATA)
920 + tags[i++] = GNOME_VFS_ACL_APPEND_DATA;
922 + if (access_mask & ACE_ADD_SUBDIRECTORY)
923 + tags[i++] = GNOME_VFS_ACL_ADD_SUBDIRECTORY;
925 + if (access_mask & ACE_READ_NAMED_ATTRS)
926 + tags[i++] = GNOME_VFS_ACL_READ_NAMED_ATTRS;
928 + if (access_mask & ACE_WRITE_NAMED_ATTRS)
929 + tags[i++] = GNOME_VFS_ACL_WRITE_NAMED_ATTRS;
931 + if (access_mask & ACE_DELETE_CHILD)
932 + tags[i++] = GNOME_VFS_ACL_DELETE_CHILD;
934 + if (access_mask & ACE_READ_ATTRIBUTES)
935 + tags[i++] = GNOME_VFS_ACL_READ_ATTRIBUTES;
937 + if (access_mask & ACE_WRITE_ATTRIBUTES)
938 + tags[i++] = GNOME_VFS_ACL_WRITE_ATTRIBUTES;
940 + if (access_mask & ACE_DELETE)
941 + tags[i++] = GNOME_VFS_ACL_DELETE;
943 + if (access_mask & ACE_READ_ACL)
944 + tags[i++] = GNOME_VFS_ACL_READ_ACL;
946 + if (access_mask & ACE_WRITE_ACL)
947 + tags[i++] = GNOME_VFS_ACL_WRITE_ACL;
949 + if (access_mask & ACE_WRITE_OWNER)
950 + tags[i++] = GNOME_VFS_ACL_WRITE_OWNER;
952 + if (access_mask & ACE_SYNCHRONIZE)
953 + tags[i++] = GNOME_VFS_ACL_SYNCHRONIZE;
962 solaris_acl_read (GnomeVFSACL *acl,
964 @@ -574,10 +641,11 @@
967 for (tp = aclp, i=0; i < aclcnt; tp++, i++) {
969 - GnomeVFSACLKind kind;
970 - GnomeVFSACLPerm pset[SOLARIS_N_TAGS+1];
973 + GnomeVFSACLKind kind;
974 + GnomeVFSACLInherance inherance;
975 + GnomeVFSACLPerm pset[SOLARIS_N_TAGS+1];
979 kind = GNOME_VFS_ACL_KIND_NULL;
980 @@ -613,11 +681,13 @@
981 g_warning ("Unhandled Solaris ACE: %d\n", tp->a_type);
984 - permset_to_perms (tp->a_perm, pset);
985 - ace = gnome_vfs_ace_new (kind, id, pset);
986 +// if (tp->a_type & ACL_DEFAULT)
987 +// gnome_vfs_ace_set_inherit (ace, TRUE);
989 + inherance = (tp->a_type & ACL_DEFAULT) ? GNOME_VFS_ACL_FILE_INHERIT : GNOME_VFS_ACL_INHERANCE_NULL;
991 - if (tp->a_type & ACL_DEFAULT)
992 - gnome_vfs_ace_set_inherit (ace, TRUE);
993 + permset_to_perms (tp->a_perm, pset);
994 + ace = gnome_vfs_ace_new (kind, id, pset, GNOME_VFS_ACL_ALLOW, inherance);
996 gnome_vfs_acl_set (acl, ace);
997 g_object_unref (ace);
1003 +solaris_acl_nfs4_read (GnomeVFSACL *acl,
1011 + for (tp = aclp, i=0; i < aclcnt; tp++, i++) {
1013 + GnomeVFSACLKind kind;
1014 + GnomeVFSACLInherance inherance;
1015 + GnomeVFSACLPerm pset[SOLARIS_N_TAGS+1];
1021 + type = GNOME_VFS_ACL_TYPE_NULL;
1022 + kind = GNOME_VFS_ACL_KIND_NULL;
1023 + inherance = GNOME_VFS_ACL_INHERANCE_NULL;
1024 + owner_type = tp->a_flags & ACE_TYPE_FLAGS;
1026 + /* Type: allow, deny, ..
1028 + switch (tp->a_type) {
1029 + case ACE_ACCESS_ALLOWED_ACE_TYPE:
1030 + type = GNOME_VFS_ACL_ALLOW;
1032 + case ACE_ACCESS_DENIED_ACE_TYPE:
1033 + type = GNOME_VFS_ACL_DENY;
1036 + type = GNOME_VFS_ACL_TYPE_NULL;
1039 + /* Kind: user, group, everyone, ..
1041 + if (owner_type == ACE_OWNER) {
1042 + kind = GNOME_VFS_ACL_OWNER_USER;
1044 + } else if (owner_type == (ACE_GROUP|ACE_IDENTIFIER_GROUP)) {
1045 + kind = GNOME_VFS_ACL_OWNER_GROUP;
1047 + } else if (owner_type == ACE_GROUP) {
1048 + if (tp->a_who >= 0)
1049 + id = gid_to_string (tp->a_who);
1050 + kind = GNOME_VFS_ACL_GROUP;
1052 + } else if (owner_type == ACE_EVERYONE) {
1053 + kind = GNOME_VFS_ACL_EVERYONE;
1056 + if (tp->a_who >= 0)
1057 + id = uid_to_string (tp->a_who);
1058 + kind = GNOME_VFS_ACL_USER;
1063 + if (tp->a_flags & ACE_FILE_INHERIT_ACE) {
1064 + inherance = GNOME_VFS_ACL_FILE_INHERIT;
1065 + } else if (tp->a_flags & ACE_DIRECTORY_INHERIT_ACE) {
1066 + inherance = GNOME_VFS_ACL_DIR_INHERIT;
1067 + } else if (tp->a_flags & ACE_NO_PROPAGATE_INHERIT_ACE) {
1068 + inherance = GNOME_VFS_ACL_NO_PROPAGATE;
1069 + } else if (tp->a_flags & ACE_INHERIT_ONLY_ACE) {
1070 + inherance = GNOME_VFS_ACL_INHERIT_ONLY;
1075 + nfs4_access_mask_to_perms (tp->a_access_mask, pset);
1077 + ace = gnome_vfs_ace_new (kind, id, pset, type, inherance);
1078 + gnome_vfs_acl_set (acl, ace);
1080 + g_object_unref (ace);
1084 static GnomeVFSResult
1085 translate_ace_into_aclent (GnomeVFSACE *ace, aclent_t *aclp)
1089 id_str = gnome_vfs_ace_get_id (ace);
1090 kind = gnome_vfs_ace_get_kind (ace);
1091 - is_default = gnome_vfs_ace_get_inherit (ace);
1092 + is_default = (gnome_vfs_ace_get_inherance(ace) != GNOME_VFS_ACL_INHERANCE_NULL);
1096 @@ -725,22 +877,18 @@
1098 #endif /* HAVE_ACL */
1100 -GnomeVFSResult file_get_acl (const char *path,
1101 - GnomeVFSFileInfo *info,
1102 - struct stat *statbuf,
1103 - GnomeVFSContext *context)
1106 #ifdef HAVE_SOLARIS_ACL
1108 +file_get_acl_classic (const char *path,
1109 + GnomeVFSFileInfo *info,
1110 + struct stat *statbuf,
1111 + GnomeVFSContext *context)
1117 - if (info->acl != NULL) {
1118 - gnome_vfs_acl_clear (info->acl);
1120 - info->acl = gnome_vfs_acl_new ();
1123 aclcnt = acl (path, GETACLCNT, 0, NULL);
1125 return aclerrno_to_vfserror (errno);
1126 @@ -768,9 +916,84 @@
1128 info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_ACL;
1133 return GNOME_VFS_OK;
1138 +file_get_acl_nfs4 (const char *path,
1139 + GnomeVFSFileInfo *info,
1140 + struct stat *statbuf,
1141 + GnomeVFSContext *context)
1147 + aclcnt = acl (path, ACE_GETACLCNT, 0, NULL);
1149 + return aclerrno_to_vfserror (errno);
1152 + if (aclcnt < MIN_ACL_ENTRIES) {
1153 + return GNOME_VFS_ERROR_INTERNAL;
1156 + aclp = (ace_t *)malloc(sizeof (ace_t) * aclcnt);
1157 + if (aclp == NULL) {
1158 + return GNOME_VFS_ERROR_NO_MEMORY;
1162 + re = acl (path, ACE_GETACL, aclcnt, aclp);
1164 + return aclerrno_to_vfserror (errno);
1167 + re = solaris_acl_nfs4_read (info->acl, aclp, aclcnt, FALSE);
1169 + return GNOME_VFS_ERROR_INTERNAL;
1172 + info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_ACL;
1175 + return GNOME_VFS_OK;
1180 +GnomeVFSResult file_get_acl (const char *path,
1181 + GnomeVFSFileInfo *info,
1182 + struct stat *statbuf,
1183 + GnomeVFSContext *context)
1185 +#ifdef HAVE_SOLARIS_ACL
1188 + if (info->acl != NULL) {
1189 + gnome_vfs_acl_clear (info->acl);
1191 + info->acl = gnome_vfs_acl_new ();
1194 + /* Check the ACL type
1196 + acl_type = pathconf (path, _PC_ACL_ENABLED);
1198 + /* Call the sub-handler
1200 + if (acl_type == _ACL_ACLENT_ENABLED) {
1201 + gnome_vfs_acl_set_scheme (info->acl, GNOME_VFS_ACL_SCHEME_CLASSIC);
1202 + return file_get_acl_classic (path, info, statbuf, context);
1204 + else if (acl_type == _ACL_ACE_ENABLED) {
1205 + gnome_vfs_acl_set_scheme (info->acl, GNOME_VFS_ACL_SCHEME_NFS4);
1206 + return file_get_acl_nfs4 (path, info, statbuf, context);
1209 + return GNOME_VFS_ERROR_GENERIC;
1211 #elif defined(HAVE_POSIX_ACL)
1213 @@ -813,10 +1036,11 @@
1219 -file_set_acl (const char *path,
1220 - const GnomeVFSFileInfo *info,
1221 - GnomeVFSContext *context)
1222 +file_set_acl_classic (const char *path,
1223 + const GnomeVFSFileInfo *info,
1224 + GnomeVFSContext *context)
1226 #ifdef HAVE_SOLARIS_ACL
1228 @@ -828,8 +1052,6 @@
1232 - if (info->acl == NULL)
1233 - return GNOME_VFS_ERROR_BAD_PARAMETERS;
1235 acls = gnome_vfs_acl_get_ace_list (info->acl);
1236 if (acls == NULL) return GNOME_VFS_OK;
1237 @@ -880,6 +1102,8 @@
1241 + gnome_vfs_acl_free_ace_list (acls);
1243 return GNOME_VFS_OK;
1245 #elif defined(HAVE_POSIX_ACL)
1246 @@ -1014,4 +1238,414 @@
1250 +static GnomeVFSResult
1251 +translate_ace_into_nfs4_ace (GnomeVFSACE *ace,
1252 + ace_t *system_ace)
1255 + GnomeVFSACLKind kind;
1256 + GnomeVFSACLType type;
1257 + GnomeVFSACLInherance inherance;
1259 + g_assert (GNOME_VFS_IS_ACE(ace));
1261 + id = gnome_vfs_ace_get_id (ace);
1262 + kind = gnome_vfs_ace_get_kind (ace);
1263 + type = gnome_vfs_ace_get_ace_type (ace);
1264 + inherance = gnome_vfs_ace_get_inherance (ace);
1268 + system_ace->a_who = -1;
1271 + num = string_to_uid(id);
1273 + system_ace->a_who = num;
1279 + if (type == GNOME_VFS_ACL_DENY)
1280 + system_ace->a_type = ACE_ACCESS_DENIED_ACE_TYPE;
1282 + system_ace->a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
1287 + case GNOME_VFS_ACL_USER:
1288 + system_ace->a_flags = 0;
1290 + case GNOME_VFS_ACL_GROUP:
1291 + system_ace->a_flags |= ACE_IDENTIFIER_GROUP;
1294 + case GNOME_VFS_ACL_OWNER_USER:
1295 + system_ace->a_flags |= ACE_OWNER;
1297 + case GNOME_VFS_ACL_OWNER_GROUP:
1298 + system_ace->a_flags |= (ACE_GROUP | ACE_IDENTIFIER_GROUP);
1301 + case GNOME_VFS_ACL_EVERYONE:
1302 + system_ace->a_flags |= ACE_EVERYONE;
1308 +#define set_perm(gnome,system) \
1310 + if (gnome_vfs_ace_check_perm (ace, gnome)) \
1311 + system_ace->a_access_mask |= system; \
1313 + system_ace->a_access_mask &= ~system; \
1316 + set_perm (GNOME_VFS_ACL_READ, ACE_READ_DATA);
1317 + set_perm (GNOME_VFS_ACL_WRITE, ACE_WRITE_DATA);
1318 + set_perm (GNOME_VFS_ACL_EXECUTE, ACE_EXECUTE);
1320 + set_perm (GNOME_VFS_ACL_LIST_DIRECTORY, ACE_LIST_DIRECTORY);
1321 + set_perm (GNOME_VFS_ACL_ADD_FILE, ACE_ADD_FILE);
1322 + set_perm (GNOME_VFS_ACL_APPEND_DATA, ACE_APPEND_DATA);
1323 + set_perm (GNOME_VFS_ACL_ADD_SUBDIRECTORY, ACE_ADD_SUBDIRECTORY);
1324 + set_perm (GNOME_VFS_ACL_READ_NAMED_ATTRS, ACE_READ_NAMED_ATTRS);
1325 + set_perm (GNOME_VFS_ACL_WRITE_NAMED_ATTRS, ACE_WRITE_NAMED_ATTRS);
1326 + set_perm (GNOME_VFS_ACL_DELETE_CHILD, ACE_DELETE_CHILD);
1327 + set_perm (GNOME_VFS_ACL_READ_ATTRIBUTES, ACE_READ_ATTRIBUTES);
1328 + set_perm (GNOME_VFS_ACL_WRITE_ATTRIBUTES, ACE_WRITE_ATTRIBUTES);
1329 + set_perm (GNOME_VFS_ACL_DELETE, ACE_DELETE);
1330 + set_perm (GNOME_VFS_ACL_READ_ACL, ACE_READ_ACL);
1331 + set_perm (GNOME_VFS_ACL_WRITE_ACL, ACE_WRITE_ACL);
1332 + set_perm (GNOME_VFS_ACL_WRITE_OWNER, ACE_WRITE_OWNER);
1333 + set_perm (GNOME_VFS_ACL_SYNCHRONIZE, ACE_SYNCHRONIZE);
1338 + switch (inherance) {
1339 + case GNOME_VFS_ACL_FILE_INHERIT:
1340 + system_ace->a_flags &= ACE_FILE_INHERIT_ACE;
1342 + case GNOME_VFS_ACL_DIR_INHERIT:
1343 + system_ace->a_flags &= ACE_DIRECTORY_INHERIT_ACE;
1345 + case GNOME_VFS_ACL_NO_PROPAGATE:
1346 + system_ace->a_flags &= ACE_NO_PROPAGATE_INHERIT_ACE;
1348 + case GNOME_VFS_ACL_INHERIT_ONLY:
1349 + system_ace->a_flags &= ACE_INHERIT_ONLY_ACE;
1353 + return GNOME_VFS_OK;
1358 +file_set_acl_nfs4 (const char *path,
1359 + const GnomeVFSFileInfo *info,
1360 + GnomeVFSContext *context)
1370 + acls = gnome_vfs_acl_get_ace_list (info->acl);
1371 + if (acls == NULL) return GNOME_VFS_OK;
1375 + len = g_list_length (acls);
1376 + if (len <= 0) return GNOME_VFS_OK;
1378 + acls = g_list_reverse (acls);
1380 + new_aclp = (ace_t *) malloc (len * sizeof(ace_t));
1381 + if (new_aclp == NULL) return GNOME_VFS_ERROR_NO_MEMORY;
1382 + memset (new_aclp, 0, len * sizeof(ace_t));
1384 + /* Convert GNOME-VFS aces to system ace_t's
1388 + for (entry=acls; entry != NULL; entry = entry->next) {
1389 + GnomeVFSACE *ace = GNOME_VFS_ACE(entry->data);
1391 + re = translate_ace_into_nfs4_ace (ace, taclp);
1392 + if (re != GNOME_VFS_OK) continue;
1398 + /* Commit it to the file system
1400 + re = acl (path, ACE_SETACL, aclp_i, (ace_t *)new_aclp);
1404 + g_free (new_aclp);
1405 + return aclerrno_to_vfserror(err);
1408 + g_free (new_aclp);
1409 + gnome_vfs_acl_free_ace_list (acls);
1411 + return GNOME_VFS_OK;
1415 +file_set_acl (const char *path,
1416 + const GnomeVFSFileInfo *info,
1417 + GnomeVFSContext *context)
1419 + GnomeVFSACLScheme scheme;
1421 + if (info->acl == NULL)
1422 + return GNOME_VFS_ERROR_BAD_PARAMETERS;
1424 + scheme = gnome_vfs_acl_get_scheme(info->acl);
1425 + if (scheme == GNOME_VFS_ACL_SCHEME_CLASSIC)
1426 + return file_set_acl_classic (path, info, context);
1428 + return file_set_acl_nfs4 (path, info, context);
1435 +#ifndef HAVE_GETPWNAM_R
1436 +G_LOCK_DEFINE (getpwnam_lock);
1440 +secure_getpwnam (const char *name, struct passwd *pwbuf, char *buf, size_t buflen)
1442 +#ifndef HAVE_GETPWNAM_R
1443 + size_t pw_name_len = 0;
1444 + size_t pw_passwd_len = 0;
1445 + size_t pw_gecos_len = 0;
1446 + size_t pw_dir_len = 0;
1447 + size_t pw_shell_len = 0;
1449 + struct passwd *tmp;
1451 + G_LOCK(getpwnam_lock);
1453 + tmp = getpwnam (name);
1457 + if (tmp->pw_name) pw_name_len = strlen(tmp->pw_name);
1458 + if (tmp->pw_passwd) pw_passwd_len = strlen(tmp->pw_passwd);
1459 + if (tmp->pw_gecos) pw_gecos_len = strlen(tmp->pw_gecos);
1460 + if (tmp->pw_dir) pw_dir_len = strlen(tmp->pw_dir);
1461 + if (tmp->pw_shell) pw_shell_len = strlen(tmp->pw_shell);
1463 + if ((pw_name_len + pw_passwd_len +
1464 + pw_gecos_len + pw_dir_len + pw_shell_len) > buflen)
1467 + memset (buf, 0, buflen);
1472 + if (tmp->pw_name) {
1473 + memcpy (ptr, tmp->pw_name, pw_name_len);
1474 + pwbuf->pw_name = ptr;
1475 + ptr += pw_name_len + 1;
1478 + if (tmp->pw_passwd) {
1479 + memcpy (ptr, tmp->pw_passwd, pw_passwd_len);
1480 + pwbuf->pw_passwd = ptr;
1481 + ptr += pw_passwd_len + 1;
1484 + if (tmp->pw_gecos) {
1485 + memcpy (ptr, tmp->pw_gecos, pw_gecos_len);
1486 + pwbuf->pw_gecos = ptr;
1487 + ptr += pw_gecos_len + 1;
1490 + if (tmp->pw_dir) {
1491 + memcpy (ptr, tmp->pw_dir, pw_dir_len);
1492 + pwbuf->pw_dir = ptr;
1493 + ptr += pw_dir_len + 1;
1496 + if (tmp->pw_shell) {
1497 + memcpy (ptr, tmp->pw_shell, pw_shell_len);
1498 + pwbuf->pw_shell = ptr;
1499 + ptr += pw_shell_len + 1;
1502 + G_UNLOCK(getpwnam_lock);
1505 +#elif HAVE_GETPWNAM_R_5
1506 + struct passwd *tmp;
1508 + return getpwnam_r (name, pwbuf, buf, buflen, &tmp);
1510 +#elif HAVE_GETPWNAM_R_4
1512 + return getpwnam_r (name, pwbuf, buf, buflen);
1521 +#ifndef HAVE_GETGRNAM_R
1522 +G_LOCK_DEFINE (getgrnam_lock);
1526 +secure_getgrnam (const char *name, struct group *grbuf, char *buf, size_t buflen)
1528 +#ifndef HAVE_GETGRNAM_R
1529 + size_t gr_name_len = 0;
1530 + size_t gr_passwd_len = 0;
1532 + struct group *tmp;
1534 + G_LOCK(getgrnam_lock);
1536 + tmp = getgrnam (name);
1540 + if (tmp->gr_name) gr_name_len = strlen(tmp->gr_name);
1541 + if (tmp->gr_passwd) gr_passwd_len = strlen(tmp->gr_passwd);
1543 + if ((gr_name_len + gr_passwd_len) > buflen)
1546 + memset (buf, 0, buflen);
1549 + grbuf->gr_gid = tmp->gr_gid;
1551 + if (tmp->gr_name) {
1552 + memcpy (ptr, tmp->gr_name, gr_name_len);
1553 + grbuf->gr_name = ptr;
1554 + ptr += gr_name_len + 1;
1557 + if (tmp->gr_passwd) {
1558 + memcpy (ptr, tmp->gr_passwd, gr_passwd_len);
1559 + grbuf->gr_passwd = ptr;
1560 + ptr += gr_passwd_len + 1;
1563 + // TODO: Duplicate char **tmp->gr_mem
1565 + G_UNLOCK(getgrnam_lock);
1568 +#elif HAVE_GETGRNAM_R_5
1569 + struct group *tmp;
1571 + return getgrnam_r (name, grbuf, buf, buflen, &tmp);
1573 +#elif HAVE_GETGRNAM_R_4
1575 + return getgrnam_r (name, grbuf, buf, buflen);
1582 +get_access_info_acl (GnomeVFSFileInfo *file_info,
1583 + const gchar *full_name)
1585 + GList *acls, *iter;
1588 + acls = gnome_vfs_acl_get_ace_list (file_info->acl);
1590 + for (iter = acls; iter; iter = iter->next) {
1595 + struct group *group;
1597 + int sup_groups_num;
1598 + gid_t sup_groups[NGROUPS_MAX];
1599 + struct passwd *passwd;
1600 + struct passwd pwd;
1606 + id = gnome_vfs_ace_get_id (ace);
1607 + if (id == NULL) continue;
1610 + re = secure_getpwnam (id, &pwd, buf, 1024);
1612 + uid = passwd->pw_uid;
1621 + group = secure_getgrnam (id, &grp, buf, 1024);
1622 + if (group != NULL) {
1623 + gid = group->gr_gid;
1631 + /* Suplementary groups */
1632 + sup_groups_num = getgroups(NGROUPS_MAX, sup_groups);
1634 + if ((file_info->uid == uid) ||
1635 + (file_info->gid == gid))
1637 + if (gnome_vfs_ace_check_perm (ace,GNOME_VFS_ACL_READ))
1638 + file_info->permissions |= GNOME_VFS_PERM_ACCESS_READABLE;
1639 + if (gnome_vfs_ace_check_perm (ace,GNOME_VFS_ACL_WRITE))
1640 + file_info->permissions |= GNOME_VFS_PERM_ACCESS_WRITABLE;
1641 + if (gnome_vfs_ace_check_perm (ace,GNOME_VFS_ACL_EXECUTE))
1642 + file_info->permissions |= GNOME_VFS_PERM_ACCESS_EXECUTABLE;
1646 + for (i = 0; i < sup_groups_num; i++) {
1647 + if (gid == sup_groups[i]) {
1648 + if (gnome_vfs_ace_check_perm (ace,GNOME_VFS_ACL_READ))
1649 + file_info->permissions |= GNOME_VFS_PERM_ACCESS_READABLE;
1650 + if (gnome_vfs_ace_check_perm (ace,GNOME_VFS_ACL_WRITE))
1651 + file_info->permissions |= GNOME_VFS_PERM_ACCESS_WRITABLE;
1652 + if (gnome_vfs_ace_check_perm (ace,GNOME_VFS_ACL_EXECUTE))
1653 + file_info->permissions |= GNOME_VFS_PERM_ACCESS_EXECUTABLE;
1658 + gnome_vfs_acl_free_ace_list (acls);
1661 --- gnome-vfs-2.17.2-orig/modules/file-method-acl.h 2007-04-10 01:50:02.776836000 +0200
1662 +++ gnome-vfs-2.17.2-alo/modules/file-method-acl.h 2007-04-03 12:35:34.720317000 +0200
1664 const GnomeVFSFileInfo *info,
1665 GnomeVFSContext *context);
1667 +void get_access_info_acl (GnomeVFSFileInfo *info,
1668 + const gchar *path);
1670 +GnomeVFSACLScheme get_acl_scheme (GnomeVFSFileInfo *info);
1675 --- gnome-vfs-2.17.2-orig/modules/file-method.c 2007-04-10 01:50:02.776629000 +0200
1676 +++ gnome-vfs-2.17.2-alo/modules/file-method.c 2007-04-03 12:35:34.605073000 +0200
1677 @@ -863,6 +860,10 @@
1681 + if (file_info->acl) {
1682 + get_access_info_acl (file_info, full_name);
1685 file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_ACCESS;
1688 --- gnome-vfs-2.17.2-orig/test/test-acl.c 2007-04-10 01:50:02.503796000 +0200
1689 +++ gnome-vfs-2.17.2-alo/test/test-acl.c 2007-04-03 12:35:22.152136000 +0200
1692 g_print ("Testing ACE Object\n");
1694 - a = gnome_vfs_ace_new (GNOME_VFS_ACL_USER, "a", pset_a);
1695 - b = gnome_vfs_ace_new (GNOME_VFS_ACL_USER, "a", NULL);
1696 + a = gnome_vfs_ace_new (GNOME_VFS_ACL_USER, "a", pset_a, GNOME_VFS_ACL_TYPE_NULL, GNOME_VFS_ACL_SCHEME_CLASSIC);
1697 + b = gnome_vfs_ace_new (GNOME_VFS_ACL_USER, "a", NULL, GNOME_VFS_ACL_TYPE_NULL, GNOME_VFS_ACL_SCHEME_CLASSIC);
1699 TEST_ASSERT (a != NULL);
1700 TEST_ASSERT (b != NULL);