summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-13 21:11:57 +0000
committerJeremy Allison <jra@samba.org>2001-04-13 21:11:57 +0000
commit9444e9d9f350961b594a1acbe7a7652d97faec0a (patch)
tree3bd668ddb5992f8ee15da0e830883d87f21daeb8 /source3
parent819482c07137937ee0c063437d2b2eade2895b99 (diff)
downloadsamba-9444e9d9f350961b594a1acbe7a7652d97faec0a.tar.gz
samba-9444e9d9f350961b594a1acbe7a7652d97faec0a.tar.bz2
samba-9444e9d9f350961b594a1acbe7a7652d97faec0a.zip
Michael Davidson <md@sco.COM> pointed out that acl_get_qualifier can potentially
return a malloced area so added sys_acl_free_qualifier() calls to all supported ACL interfaces to code with this (only Linux needs actual free call). Jeremy. (This used to be commit 5870e6019b82d2088b99acdc0f84e9e4847a1fa5)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/lib/sysacls.c28
-rw-r--r--source3/smbd/posix_acls.c2
3 files changed, 35 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index d5cc56eeb4..890c2dcf60 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -255,6 +255,7 @@ int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T the_acl) ;
+int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
@@ -275,6 +276,7 @@ int sys_acl_set_file(char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
int sys_acl_set_fd(int fd, SMB_ACL_T acl_d);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T acl_d) ;
+int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
@@ -295,6 +297,7 @@ int sys_acl_set_file(char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
int sys_acl_set_fd(int fd, SMB_ACL_T acl_d);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T acl_d) ;
+int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type);
SMB_ACL_T sys_acl_get_fd(int fd);
@@ -315,6 +318,7 @@ int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry_d, void *qual_p);
int sys_acl_set_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
int sys_acl_free_text(char *text);
int sys_acl_free_acl(SMB_ACL_T the_acl) ;
+int sys_acl_free_qualifier(void *qual) ;
int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
@@ -335,6 +339,7 @@ int sys_acl_valid( SMB_ACL_T theacl );
int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
int sys_acl_set_fd( int fd, SMB_ACL_T theacl);
int sys_acl_free_acl(SMB_ACL_T the_acl) ;
+int sys_acl_free_qualifier(void *qual) ;
/*The following definitions come from lib/system.c */
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index 2963049572..02018a52b3 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -63,6 +63,7 @@ extern int DEBUGLEVEL;
int sys_acl_free_text(char *text) - free acl_to_text
int sys_acl_free_acl(SMB_ACL_T posix_acl)
+ int sys_acl_free_qualifier(SMB_ACL_T posix_acl)
*/
@@ -170,6 +171,11 @@ int sys_acl_free_acl(SMB_ACL_T the_acl)
return acl_free(the_acl);
}
+int sys_acl_free_qualifier(void *qual)
+{
+ return acl_free(qual);
+}
+
#elif defined(HAVE_UNIXWARE_ACLS) || defined(HAVE_SOLARIS_ACLS)
/*
@@ -762,6 +768,11 @@ int sys_acl_free_acl(SMB_ACL_T acl_d)
return 0;
}
+int sys_acl_free_qualifier(void *qual)
+{
+ return 0;
+}
+
#elif defined(HAVE_IRIX_ACLS)
int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p)
@@ -1007,6 +1018,11 @@ int sys_acl_free_acl(SMB_ACL_T acl_d)
return 0;
}
+int sys_acl_free_qualifier(void *qual)
+{
+ return 0;
+}
+
#elif defined(HAVE_XFS_ACLS)
/* For Linux SGI/XFS Filesystems
* contributed by J Trostel, Connex
@@ -1221,6 +1237,11 @@ int sys_acl_free_acl(SMB_ACL_T the_acl)
return acl_free(the_acl);
}
+int sys_acl_free_qualifier(void *qual)
+{
+ return 0;
+}
+
#else /* No ACLs. */
int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
@@ -1342,4 +1363,11 @@ int sys_acl_free_acl(SMB_ACL_T the_acl)
errno = ENOSYS;
return -1;
}
+
+int sys_acl_free_qualifier(void *qual)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
#endif /* No ACLs. */
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index ae8493220f..a9c8821238 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -1319,6 +1319,7 @@ static canon_ace *canonicalise_acl( files_struct *fsp, SMB_ACL_T posix_acl, SMB_
uid_to_sid( &sid, *puid);
unix_ug.uid = *puid;
owner_type = UID_ACE;
+ sys_acl_free_qualifier((void *)puid);
break;
}
case SMB_ACL_GROUP_OBJ:
@@ -1337,6 +1338,7 @@ static canon_ace *canonicalise_acl( files_struct *fsp, SMB_ACL_T posix_acl, SMB_
gid_to_sid( &sid, *pgid);
unix_ug.gid = *pgid;
owner_type = GID_ACE;
+ sys_acl_free_qualifier((void *)pgid);
break;
}
case SMB_ACL_MASK: