Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 2008 05:30:58 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 147209 for review
Message-ID:  <200808120530.m7C5UweI056318@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147209

Change 147209 by trasz@trasz_traszkan on 2008/08/12 05:30:09

	Preserve libc acl_space from being overwritten by the kernel.
	Remove now useless checks.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_branding.c#6 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_get.c#7 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_init.c#5 edit

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_branding.c#6 (text+ko) ====

@@ -54,13 +54,6 @@
 	return (aclp);
 }
 
-static void
-_acl_check_entry(const acl_entry_t entry)
-{
-	assert(entry);
-	assert(entry2acl(entry)->ats_acl.acl_magic == ACL_MAGIC);
-}
-
 /*
  * Return brand of an ACL.
  */
@@ -73,8 +66,6 @@
 int
 _entry_brand(const acl_entry_t entry)
 {
-	_acl_check_entry(entry);
-
 	return (_acl_brand(entry2acl(entry)));
 }
 
@@ -96,8 +87,6 @@
 int
 _entry_brand_may_be(const acl_entry_t entry, int brand)
 {
-	_acl_check_entry(entry);
-
 	return (_acl_brand_may_be(entry2acl(entry), brand));
 }
 
@@ -115,8 +104,6 @@
 void
 _entry_brand_as(const acl_entry_t entry, int brand)
 {
-	_acl_check_entry(entry);
-
 	_acl_brand_as(entry2acl(entry), brand);
 }
 

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_get.c#7 (text+ko) ====

@@ -57,13 +57,14 @@
 acl_get_file(const char *path_p, acl_type_t type)
 {
 	acl_t	aclp;
-	int	error;
+	int	error, acl_length;
 
 	aclp = acl_init(ACL_MAX_ENTRIES);
 	if (aclp == NULL)
 		return (NULL);
 
 	type = _acl_type_unold(type);
+	acl_length = aclp->ats_acl.acl_length;
 
 	error = __acl_get_file(path_p, type, &aclp->ats_acl);
 	if (error) {
@@ -71,6 +72,7 @@
 		return (NULL);
 	}
 
+	aclp->ats_acl.acl_length = acl_length;
 	_acl_brand_from_type(aclp, type);
 
 	return (aclp);
@@ -80,13 +82,14 @@
 acl_get_link_np(const char *path_p, acl_type_t type)
 {
 	acl_t	aclp;
-	int	error;
+	int	error, acl_length;
 
 	aclp = acl_init(ACL_MAX_ENTRIES);
 	if (aclp == NULL)
 		return (NULL);
 
 	type = _acl_type_unold(type);
+	acl_length = aclp->ats_acl.acl_length;
 
 	error = __acl_get_link(path_p, type, &aclp->ats_acl);
 	if (error) {
@@ -94,6 +97,7 @@
 		return (NULL);
 	}
 
+	aclp->ats_acl.acl_length = acl_length;
 	_acl_brand_from_type(aclp, type);
 
 	return (aclp);
@@ -112,13 +116,14 @@
 acl_get_fd_np(int fd, acl_type_t type)
 {
 	acl_t	aclp;
-	int	error;
+	int	error, acl_length;
 
 	aclp = acl_init(ACL_MAX_ENTRIES);
 	if (aclp == NULL)
 		return (NULL);
 
 	type = _acl_type_unold(type);
+	acl_length = aclp->ats_acl.acl_length;
 
 	error = ___acl_get_fd(fd, type, &aclp->ats_acl);
 	if (error) {
@@ -126,6 +131,7 @@
 		return (NULL);
 	}
 
+	aclp->ats_acl.acl_length = acl_length;
 	_acl_brand_from_type(aclp, type);
 
 	return (aclp);

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_init.c#5 (text+ko) ====

@@ -58,7 +58,8 @@
 	}
 
 	assert(1 << _ACL_T_ALIGNMENT_BITS > sizeof(struct acl_t_struct));
-	error = posix_memalign((void *)&acl, 1 << _ACL_T_ALIGNMENT_BITS, sizeof(struct acl_t_struct));
+	error = posix_memalign((void *)&acl, 1 << _ACL_T_ALIGNMENT_BITS,
+	    sizeof(struct acl_t_struct));
 	if (error)
 		return (NULL);
 
@@ -66,6 +67,7 @@
 
 	acl->ats_acl.acl_brand = ACL_BRAND_UNKNOWN;
 	acl->ats_acl.acl_magic = ACL_MAGIC;
+	acl->ats_acl.acl_length = ACL_MAX_ENTRIES;
 
 	return (acl);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808120530.m7C5UweI056318>