The branch, master has been updated
       via  e6a100e s3:modules:nfs4_acls remove unused mem_ctx parameter to 
smbacl4_fill_ace4
       via  c9d7074 s3:modules:nfs4_acls fix memory hierarchy in 
smb_create_smb4acl
       via  775d0a7 s3:vfs_gpfs fix a memory leak in gpfsacl_get_posix_acl
       via  1a71f07 s3:vfs_gpfs fix memory corruption in gpfs2smb_acl
       via  3dab1ef s3:vfs_gpfs fix memory leak in gpfs_get_nfs4_acl
       via  3925a71 s3:vfs_gpfs fix memory leaks in gpfs_getacl_alloc
      from  10b6cce samba-tool dns: Don't use "localhost" to connect to local 
host

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e6a100e86b7adf1c06a7c06b24fa50717ddcdb67
Author: Christian Ambach <a...@samba.org>
Date:   Mon Nov 5 18:49:54 2012 +0100

    s3:modules:nfs4_acls remove unused mem_ctx parameter to smbacl4_fill_ace4
    
    Signed-off-by: Christian Ambach <a...@samba.org>
    
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abart...@samba.org>
    Autobuild-Date(master): Sat Nov 17 01:11:07 CET 2012 on sn-devel-104

commit c9d70740e39722a2f98ccd932b053723a4f3de62
Author: Christian Ambach <a...@samba.org>
Date:   Mon Nov 5 18:47:01 2012 +0100

    s3:modules:nfs4_acls fix memory hierarchy in smb_create_smb4acl
    
    the ACEs should be talloc children of the ACL itself and not be placed on 
talloc_tos()
    
    Signed-off-by: Christian Ambach <a...@samba.org>
    
    Reviewed-by: Andrew Bartlett <abart...@samba.org>

commit 775d0a78c496af8ddbde9eb0f8c2f6d5dc5bcc81
Author: Christian Ambach <a...@samba.org>
Date:   Fri Nov 2 08:41:40 2012 +0100

    s3:vfs_gpfs fix a memory leak in gpfsacl_get_posix_acl
    
    Signed-off-by: Christian Ambach <a...@samba.org>
    
    Reviewed-by: Andrew Bartlett <abart...@samba.org>

commit 1a71f07cee0bfe50ea6821a195a950d2206aab55
Author: Christian Ambach <a...@samba.org>
Date:   Fri Nov 2 08:41:10 2012 +0100

    s3:vfs_gpfs fix memory corruption in gpfs2smb_acl
    
    sys_acl_init returns a SMB_ACL_T with zero entries in the acl array
    reallocate the array to proper size before filling it, otherwise we 
overwrite memory
    
    This one is a result of a improper fixing in 7a6182962966e5edb42728c8
    
    Signed-off-by: Christian Ambach <a...@samba.org>
    
    Reviewed-by: Andrew Bartlett <abart...@samba.org>

commit 3dab1ef8a57670a36a81e706895bbe225892f3ff
Author: Christian Ambach <a...@samba.org>
Date:   Fri Nov 2 08:39:45 2012 +0100

    s3:vfs_gpfs fix memory leak in gpfs_get_nfs4_acl
    
    Signed-off-by: Christian Ambach <a...@samba.org>
    
    Reviewed-by: Andrew Bartlett <abart...@samba.org>

commit 3925a7114caaac56e79849ebf3aa13784918282b
Author: Christian Ambach <a...@samba.org>
Date:   Fri Nov 2 08:39:17 2012 +0100

    s3:vfs_gpfs fix memory leaks in gpfs_getacl_alloc
    
    Signed-off-by: Christian Ambach <a...@samba.org>
    
    Reviewed-by: Andrew Bartlett <abart...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/nfs4_acls.c |    7 ++-----
 source3/modules/vfs_gpfs.c  |   12 ++++++++++--
 2 files changed, 12 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 48b045f..67db6b0 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -161,11 +161,10 @@ SMB4ACL_T *smb_create_smb4acl(void)
 SMB4ACE_T *smb_add_ace4(SMB4ACL_T *theacl, SMB_ACE4PROP_T *prop)
 {
        SMB_ACL4_INT_T *aclint = get_validated_aclint(theacl);
-       TALLOC_CTX *mem_ctx = talloc_tos();
        SMB_ACE4_INT_T *ace;
 
        ace = (SMB_ACE4_INT_T *)TALLOC_ZERO_SIZE(
-               mem_ctx, sizeof(SMB_ACE4_INT_T));
+               theacl, sizeof(SMB_ACE4_INT_T));
        if (ace==NULL)
        {
                DEBUG(0, ("TALLOC_SIZE failed\n"));
@@ -581,7 +580,6 @@ static SMB_ACE4PROP_T *smbacl4_find_equal_special(
 
 
 static bool smbacl4_fill_ace4(
-       TALLOC_CTX *mem_ctx,
        const struct smb_filename *filename,
        smbacl4_vfs_params *params,
        uid_t ownerUID,
@@ -702,7 +700,6 @@ static SMB4ACL_T *smbacl4_win2nfs4(
 {
        SMB4ACL_T *theacl;
        uint32  i;
-       TALLOC_CTX *mem_ctx = talloc_tos();
        const char *filename = fsp->fsp_name->base_name;
 
        DEBUG(10, ("smbacl4_win2nfs4 invoked\n"));
@@ -715,7 +712,7 @@ static SMB4ACL_T *smbacl4_win2nfs4(
                SMB_ACE4PROP_T  ace_v4;
                bool    addNewACE = True;
 
-               if (!smbacl4_fill_ace4(mem_ctx, fsp->fsp_name, pparams,
+               if (!smbacl4_fill_ace4(fsp->fsp_name, pparams,
                                       ownerUID, ownerGID,
                                       dacl->aces + i, &ace_v4)) {
                        DEBUG(3, ("Could not fill ace for file %s, SID %s\n",
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 8e8c694..8f5a19c 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -242,6 +242,7 @@ static struct gpfs_acl *gpfs_getacl_alloc(const char 
*fname, gpfs_aclType_t type
                struct gpfs_acl *new_acl = (struct gpfs_acl *)TALLOC_SIZE(
                        mem_ctx, acl->acl_len + sizeof(struct gpfs_acl));
                if (new_acl == NULL) {
+                       talloc_free(acl);
                        errno = ENOMEM;
                        return NULL;
                }
@@ -250,13 +251,14 @@ static struct gpfs_acl *gpfs_getacl_alloc(const char 
*fname, gpfs_aclType_t type
                new_acl->acl_level = acl->acl_level;
                new_acl->acl_version = acl->acl_version;
                new_acl->acl_type = acl->acl_type;
+               talloc_free(acl);
                acl = new_acl;
 
                ret = smbd_gpfs_getacl((char *)fname, GPFS_GETACL_STRUCT, acl);
        }
-       if (ret != 0)
-       {
+       if (ret != 0) {
                DEBUG(8, ("smbd_gpfs_getacl failed with %s\n",strerror(errno)));
+               talloc_free(acl);
                return NULL;
        }
 
@@ -286,6 +288,7 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T 
**ppacl)
        if (gacl->acl_type != GPFS_ACL_TYPE_NFS4) {
                DEBUG(10, ("Got non-nfsv4 acl\n"));
                /* Retry with POSIX ACLs check */
+               talloc_free(gacl);
                return 1;
        }
 
@@ -570,6 +573,8 @@ static SMB_ACL_T gpfs2smb_acl(const struct gpfs_acl *pacl, 
TALLOC_CTX *mem_ctx)
        }
 
        result->count = pacl->acl_nace;
+       result->acl = talloc_realloc(result, result->acl, struct smb_acl_entry,
+                                    result->count);
 
        for (i=0; i<pacl->acl_nace; i++) {
                struct smb_acl_entry *ace = &result->acl[i];
@@ -658,6 +663,9 @@ static SMB_ACL_T gpfsacl_get_posix_acl(const char *path, 
gpfs_aclType_t type,
 
  done:
 
+       if (pacl != NULL) {
+               talloc_free(pacl);
+       }
        if (errno != 0) {
                TALLOC_FREE(result);
        }


-- 
Samba Shared Repository

Reply via email to