Convert all uint8/16/32 to _t in all modules.
[kamenim/samba-autobuild/.git] / source3 / modules / vfs_afsacl.c
index 9dd5df87ec88ff27423e4e0b65663f227fa9d1f6..aa8de9aad9066eaddb81cece8a4f82e8228cc4af 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Convert AFS acls to NT acls and vice versa.
  *
  * Copyright (C) Volker Lendecke, 2003
@@ -7,28 +7,34 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
- *  
+ *
  * This program 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 General Public License for more details.
- *  
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "includes.h"
+#include "system/filesys.h"
+#include "smbd/smbd.h"
+#include "../librpc/gen_ndr/lsa.h"
+#include "../libcli/security/security.h"
+#include "../libcli/security/dom_sid.h"
+#include "passdb.h"
+#include "lib/afs/afs_settoken.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
 
 #include <afs/stds.h>
-#include <afs/afs.h>
-#include <afs/auth.h>
+#include <afs/afs_args.h>
 #include <afs/venus.h>
 #include <afs/prs_fs.h>
 
-#define MAXSIZE 2048
+#define MAXSIZE 2049
 
 extern const struct dom_sid global_sid_World;
 extern const struct dom_sid global_sid_Builtin_Administrators;
@@ -41,14 +47,12 @@ static char space_replacement = '%';
 /* Do we expect SIDs as pts names? */
 static bool sidpts;
 
-extern int afs_syscall(int, char *, int, char *, int);
-
 struct afs_ace {
        bool positive;
        char *name;
        struct dom_sid sid;
        enum lsa_SidType type;
-       uint32 rights;
+       uint32_t rights;
        struct afs_ace *next;
 };
 
@@ -61,7 +65,7 @@ struct afs_acl {
 
 struct afs_iob {
        char *in, *out;
-       uint16 in_size, out_size;
+       uint16_t in_size, out_size;
 };
 
 
@@ -71,9 +75,9 @@ static bool init_afs_acl(struct afs_acl *acl)
        acl->ctx = talloc_init("afs_acl");
        if (acl->ctx == NULL) {
                DEBUG(10, ("Could not init afs_acl"));
-               return False;
+               return false;
        }
-       return True;
+       return true;
 }
 
 static void free_afs_acl(struct afs_acl *acl)
@@ -87,7 +91,7 @@ static void free_afs_acl(struct afs_acl *acl)
 
 static struct afs_ace *clone_afs_ace(TALLOC_CTX *mem_ctx, struct afs_ace *ace)
 {
-       struct afs_ace *result = TALLOC_P(mem_ctx, struct afs_ace);
+       struct afs_ace *result = talloc(mem_ctx, struct afs_ace);
 
        if (result == NULL)
                return NULL;
@@ -106,7 +110,7 @@ static struct afs_ace *clone_afs_ace(TALLOC_CTX *mem_ctx, struct afs_ace *ace)
        
 static struct afs_ace *new_afs_ace(TALLOC_CTX *mem_ctx,
                                   bool positive,
-                                  const char *name, uint32 rights)
+                                  const char *name, uint32_t rights)
 {
        struct dom_sid sid;
        enum lsa_SidType type;
@@ -165,7 +169,7 @@ static struct afs_ace *new_afs_ace(TALLOC_CTX *mem_ctx,
                }
        }
 
-       result = TALLOC_P(mem_ctx, struct afs_ace);
+       result = talloc(mem_ctx, struct afs_ace);
 
        if (result == NULL) {
                DEBUG(0, ("Could not talloc AFS ace\n"));
@@ -189,7 +193,7 @@ static struct afs_ace *new_afs_ace(TALLOC_CTX *mem_ctx,
 
 static void add_afs_ace(struct afs_acl *acl,
                        bool positive,
-                       const char *name, uint32 rights)
+                       const char *name, uint32_t rights)
 {
        struct afs_ace *ace;
 
@@ -211,8 +215,6 @@ static void add_afs_ace(struct afs_acl *acl,
        DEBUG(10, ("add_afs_ace: Added %s entry for %s with rights %d\n",
                   ace->positive?"positive":"negative",
                   ace->name, ace->rights));
-
-       return;
 }
 
 /* AFS ACLs in string form are a long string of fields delimited with \n.
@@ -232,27 +234,27 @@ static bool parse_afs_acl(struct afs_acl *acl, const char *acl_str)
        int nplus, nminus;
        int aces;
 
-       char str[MAXSIZE+1];
+       char str[MAXSIZE];
        char *p = str;
 
-       strncpy(str, acl_str, MAXSIZE);
+       strlcpy(str, acl_str, MAXSIZE);
 
        if (sscanf(p, "%d", &nplus) != 1)
-               return False;
+               return false;
 
        DEBUG(10, ("Found %d positive entries\n", nplus));
 
        if ((p = strchr(p, '\n')) == NULL)
-               return False;
+               return false;
        p += 1;
 
        if (sscanf(p, "%d", &nminus) != 1)
-               return False;
+               return false;
        
        DEBUG(10, ("Found %d negative entries\n", nminus));
 
        if ((p = strchr(p, '\n')) == NULL)
-               return False;
+               return false;
        p += 1;
 
        for (aces = nplus+nminus; aces > 0; aces--)
@@ -260,21 +262,21 @@ static bool parse_afs_acl(struct afs_acl *acl, const char *acl_str)
 
                const char *namep;
                fstring name;
-               uint32 rights;
+               uint32_t rights;
                char *space;
 
                namep = p;
 
                if ((p = strchr(p, '\t')) == NULL)
-                       return False;
+                       return false;
                *p = '\0';
                p += 1;
 
                if (sscanf(p, "%d", &rights) != 1)
-                       return False;
+                       return false;
 
                if ((p = strchr(p, '\n')) == NULL)
-                       return False;
+                       return false;
                p += 1;
 
                fstrcpy(name, namep);
@@ -287,7 +289,7 @@ static bool parse_afs_acl(struct afs_acl *acl, const char *acl_str)
                nplus -= 1;
        }
 
-       return True;
+       return true;
 }
 
 static bool unparse_afs_acl(struct afs_acl *acl, char *acl_str)
@@ -297,11 +299,10 @@ static bool unparse_afs_acl(struct afs_acl *acl, char *acl_str)
        int positives = 0;
        int negatives = 0;
        fstring line;
+       struct afs_ace *ace = acl->acelist;
 
        *acl_str = 0;
 
-       struct afs_ace *ace = acl->acelist;
-
        while (ace != NULL) {
                if (ace->positive)
                        positives++;
@@ -311,24 +312,30 @@ static bool unparse_afs_acl(struct afs_acl *acl, char *acl_str)
        }
 
        fstr_sprintf(line, "%d\n", positives);
-       safe_strcat(acl_str, line, MAXSIZE);
+       if (strlcat(acl_str, line, MAXSIZE) >= MAXSIZE) {
+               return false;
+       }
 
        fstr_sprintf(line, "%d\n", negatives);
-       safe_strcat(acl_str, line, MAXSIZE);
+       if (strlcat(acl_str, line, MAXSIZE) >= MAXSIZE) {
+               return false;
+       }
 
        ace = acl->acelist;
 
        while (ace != NULL) {
                fstr_sprintf(line, "%s\t%d\n", ace->name, ace->rights);
-               safe_strcat(acl_str, line, MAXSIZE);
+               if (strlcat(acl_str, line, MAXSIZE) >= MAXSIZE) {
+                       return false;
+               }
                ace = ace->next;
        }
-       return True;
+       return true;
 }
 
-static uint32 afs_to_nt_file_rights(uint32 rights)
+static uint32_t afs_to_nt_file_rights(uint32_t rights)
 {
-       uint32 result = 0;
+       uint32_t result = 0;
 
        if (rights & PRSFS_READ)
                result |= FILE_READ_DATA | FILE_READ_EA | 
@@ -348,8 +355,8 @@ static uint32 afs_to_nt_file_rights(uint32 rights)
        return result;
 }
 
-static void afs_to_nt_dir_rights(uint32 afs_rights, uint32 *nt_rights,
-                                uint8 *flag)
+static void afs_to_nt_dir_rights(uint32_t afs_rights, uint32_t *nt_rights,
+                                uint8_t *flag)
 {
        *nt_rights = 0;
        *flag = SEC_ACE_FLAG_OBJECT_INHERIT |
@@ -384,8 +391,6 @@ static void afs_to_nt_dir_rights(uint32 afs_rights, uint32 *nt_rights,
                /* Only lookup right */
                *flag = SEC_ACE_FLAG_CONTAINER_INHERIT;
        }
-
-       return;
 }
 
 #define AFS_FILE_RIGHTS (PRSFS_READ|PRSFS_WRITE|PRSFS_LOCK)
@@ -411,13 +416,12 @@ static void split_afs_acl(struct afs_acl *acl,
                                    ace->rights & AFS_DIR_RIGHTS);
                }
        }
-       return;
 }
 
 static bool same_principal(struct afs_ace *x, struct afs_ace *y)
 {
        return ( (x->positive == y->positive) &&
-                (sid_compare(&x->sid, &y->sid) == 0) );
+                (dom_sid_compare(&x->sid, &y->sid) == 0) );
 }
 
 static void merge_afs_acls(struct afs_acl *dir_acl,
@@ -430,7 +434,7 @@ static void merge_afs_acls(struct afs_acl *dir_acl,
 
        for (ace = dir_acl->acelist; ace != NULL; ace = ace->next) {
                struct afs_ace *file_ace;
-               bool found = False;
+               bool found = false;
 
                for (file_ace = file_acl->acelist;
                     file_ace != NULL;
@@ -440,7 +444,7 @@ static void merge_afs_acls(struct afs_acl *dir_acl,
 
                        add_afs_ace(target, ace->positive, ace->name,
                                    ace->rights | file_ace->rights);
-                       found = True;
+                       found = true;
                        break;
                }
                if (!found)
@@ -450,14 +454,14 @@ static void merge_afs_acls(struct afs_acl *dir_acl,
 
        for (ace = file_acl->acelist; ace != NULL; ace = ace->next) {
                struct afs_ace *dir_ace;
-               bool already_seen = False;
+               bool already_seen = false;
 
                for (dir_ace = dir_acl->acelist;
                     dir_ace != NULL;
                     dir_ace = dir_ace->next) {
                        if (!same_principal(ace, dir_ace))
                                continue;
-                       already_seen = True;
+                       already_seen = true;
                        break;
                }
                if (!already_seen)
@@ -471,10 +475,10 @@ static void merge_afs_acls(struct afs_acl *dir_acl,
 #define PERMS_FULL   0x001f01ff
 
 static struct static_dir_ace_mapping {
-       uint8 type;
-       uint8 flags;
-       uint32 mask;
-       uint32 afs_rights;
+       uint8_t type;
+       uint8_t flags;
+       uint32_t mask;
+       uint32_t afs_rights;
 } ace_mappings[] = {
 
        /* Full control */
@@ -528,11 +532,11 @@ static struct static_dir_ace_mapping {
        { 0, 0, 0, 9999 }
 };
 
-static uint32 nt_to_afs_dir_rights(const char *filename, const struct security_ace *ace)
+static uint32_t nt_to_afs_dir_rights(const char *filename, const struct security_ace *ace)
 {
-       uint32 result = 0;
-       uint32 rights = ace->access_mask;
-       uint8 flags = ace->flags;
+       uint32_t result = 0;
+       uint32_t rights = ace->access_mask;
+       uint8_t flags = ace->flags;
 
        struct static_dir_ace_mapping *m;
 
@@ -569,10 +573,10 @@ static uint32 nt_to_afs_dir_rights(const char *filename, const struct security_a
        return result;
 }
 
-static uint32 nt_to_afs_file_rights(const char *filename, const struct security_ace *ace)
+static uint32_t nt_to_afs_file_rights(const char *filename, const struct security_ace *ace)
 {
-       uint32 result = 0;
-       uint32 rights = ace->access_mask;
+       uint32_t result = 0;
+       uint32_t rights = ace->access_mask;
 
        if (rights & (GENERIC_READ_ACCESS|FILE_READ_DATA)) {
                result |= PRSFS_READ;
@@ -587,7 +591,8 @@ static uint32 nt_to_afs_file_rights(const char *filename, const struct security_
 
 static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
                                   SMB_STRUCT_STAT *psbuf,
-                                  uint32 security_info,
+                                  uint32_t security_info,
+                                  TALLOC_CTX *mem_ctx,
                                   struct security_descriptor **ppdesc)
 {
        struct security_ace *nt_ace_list;
@@ -595,7 +600,6 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
        struct security_acl *psa = NULL;
        int good_aces;
        size_t sd_size;
-       TALLOC_CTX *mem_ctx = talloc_tos();
 
        struct afs_ace *afs_ace;
 
@@ -603,7 +607,7 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
        gid_to_sid(&group_sid, psbuf->st_ex_gid);
 
        if (afs_acl->num_aces) {
-               nt_ace_list = TALLOC_ARRAY(mem_ctx, struct security_ace, afs_acl->num_aces);
+               nt_ace_list = talloc_array(mem_ctx, struct security_ace, afs_acl->num_aces);
 
                if (nt_ace_list == NULL)
                        return 0;
@@ -616,7 +620,7 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
 
        while (afs_ace != NULL) {
                uint32_t nt_rights;
-               uint8 flag = SEC_ACE_FLAG_OBJECT_INHERIT |
+               uint8_t flag = SEC_ACE_FLAG_OBJECT_INHERIT |
                        SEC_ACE_FLAG_CONTAINER_INHERIT;
 
                if (afs_ace->type == SID_NAME_UNKNOWN) {
@@ -656,7 +660,8 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
 static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
                            struct connection_struct *conn,
                            struct smb_filename *smb_fname,
-                           uint32 security_info,
+                           uint32_t security_info,
+                            TALLOC_CTX *mem_ctx,
                            struct security_descriptor **ppdesc)
 {
        int ret;
@@ -672,57 +677,59 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
        }
 
        return afs_to_nt_acl_common(afs_acl, &smb_fname->st, security_info,
-                                   ppdesc);
+                                   mem_ctx, ppdesc);
 }
 
 static size_t afs_fto_nt_acl(struct afs_acl *afs_acl,
                             struct files_struct *fsp,
-                            uint32 security_info,
+                            uint32_t security_info,
+                            TALLOC_CTX *mem_ctx,
                             struct security_descriptor **ppdesc)
 {
        SMB_STRUCT_STAT sbuf;
 
-       if (fsp->is_directory || fsp->fh->fd == -1) {
+       if (fsp->fh->fd == -1) {
                /* Get the stat struct for the owner info. */
                return afs_to_nt_acl(afs_acl, fsp->conn, fsp->fsp_name,
-                                    security_info, ppdesc);
+                                    security_info, mem_ctx, ppdesc);
        }
 
        if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) {
                return 0;
        }
 
-       return afs_to_nt_acl_common(afs_acl, &sbuf, security_info, ppdesc);
+       return afs_to_nt_acl_common(afs_acl, &sbuf, security_info,
+                               mem_ctx, ppdesc);
 }
 
 static bool mappable_sid(const struct dom_sid *sid)
 {
        struct dom_sid domain_sid;
        
-       if (sid_compare(sid, &global_sid_Builtin_Administrators) == 0)
-               return True;
+       if (dom_sid_compare(sid, &global_sid_Builtin_Administrators) == 0)
+               return true;
 
-       if (sid_compare(sid, &global_sid_World) == 0)
-               return True;
+       if (dom_sid_compare(sid, &global_sid_World) == 0)
+               return true;
 
-       if (sid_compare(sid, &global_sid_Authenticated_Users) == 0)
-               return True;
+       if (dom_sid_compare(sid, &global_sid_Authenticated_Users) == 0)
+               return true;
 
-       if (sid_compare(sid, &global_sid_Builtin_Backup_Operators) == 0)
-               return True;
+       if (dom_sid_compare(sid, &global_sid_Builtin_Backup_Operators) == 0)
+               return true;
 
        string_to_sid(&domain_sid, "S-1-5-21");
 
        if (sid_compare_domain(sid, &domain_sid) == 0)
-               return True;
+               return true;
 
-       return False;
+       return false;
 }
 
 static bool nt_to_afs_acl(const char *filename,
-                         uint32 security_info_sent,
+                         uint32_t security_info_sent,
                          const struct security_descriptor *psd,
-                         uint32 (*nt_to_afs_rights)(const char *filename,
+                         uint32_t (*nt_to_afs_rights)(const char *filename,
                                                     const struct security_ace *ace),
                          struct afs_acl *afs_acl)
 {
@@ -733,10 +740,10 @@ static bool nt_to_afs_acl(const char *filename,
 
        if (((security_info_sent & SECINFO_DACL) == 0) ||
            (psd->dacl == NULL))
-               return True;
+               return true;
 
        if (!init_afs_acl(afs_acl))
-               return False;
+               return false;
 
        dacl = psd->dacl;
 
@@ -748,7 +755,7 @@ static bool nt_to_afs_acl(const char *filename,
 
                if (ace->type != SEC_ACE_TYPE_ACCESS_ALLOWED) {
                        /* First cut: Only positive ACEs */
-                       return False;
+                       return false;
                }
 
                if (!mappable_sid(&ace->trustee)) {
@@ -757,22 +764,22 @@ static bool nt_to_afs_acl(const char *filename,
                        continue;
                }
 
-               if (sid_compare(&ace->trustee,
+               if (dom_sid_compare(&ace->trustee,
                                &global_sid_Builtin_Administrators) == 0) {
 
                        name = "system:administrators";
 
-               } else if (sid_compare(&ace->trustee,
+               } else if (dom_sid_compare(&ace->trustee,
                                       &global_sid_World) == 0) {
 
                        name = "system:anyuser";
 
-               } else if (sid_compare(&ace->trustee,
+               } else if (dom_sid_compare(&ace->trustee,
                                       &global_sid_Authenticated_Users) == 0) {
 
                        name = "system:authuser";
 
-               } else if (sid_compare(&ace->trustee,
+               } else if (dom_sid_compare(&ace->trustee,
                                       &global_sid_Builtin_Backup_Operators)
                           == 0) {
 
@@ -796,9 +803,11 @@ static bool nt_to_afs_acl(const char *filename,
                                                       dom_name, lp_winbind_separator(),
                                                       name);
                                if (tmp == NULL) {
-                                       return False;
+                                       return false;
+                               }
+                               if (!strlower_m(tmp)) {
+                                       return false;
                                }
-                               strlower_m(tmp);
                                name = tmp;
                        }
 
@@ -808,7 +817,7 @@ static bool nt_to_afs_acl(const char *filename,
                                        talloc_tos(),
                                        sid_string_tos(&ace->trustee));
                                if (name == NULL) {
-                                       return False;
+                                       return false;
                                }
                        }
                }
@@ -816,14 +825,14 @@ static bool nt_to_afs_acl(const char *filename,
                while ((p = strchr_m(name, ' ')) != NULL)
                        *p = space_replacement;
 
-               add_afs_ace(afs_acl, True, name,
+               add_afs_ace(afs_acl, true, name,
                            nt_to_afs_rights(filename, ace));
        }
 
-       return True;
+       return true;
 }
 
-static bool afs_get_afs_acl(char *filename, struct afs_acl *acl)
+static bool afs_get_afs_acl(const char *filename, struct afs_acl *acl)
 {
        struct afs_iob iob;
 
@@ -842,19 +851,19 @@ static bool afs_get_afs_acl(char *filename, struct afs_acl *acl)
 
        if (ret) {
                DEBUG(1, ("got error from PIOCTL: %d\n", ret));
-               return False;
+               return false;
        }
 
        if (!init_afs_acl(acl))
-               return False;
+               return false;
 
        if (!parse_afs_acl(acl, space)) {
                DEBUG(1, ("Could not parse AFS acl\n"));
                free_afs_acl(acl);
-               return False;
+               return false;
        }
 
-       return True;
+       return true;
 }
 
 /* For setting an AFS ACL we have to take care of the ACEs we could
@@ -890,12 +899,12 @@ static void merge_unknown_aces(struct afs_acl *src, struct afs_acl *dst)
 }
 
 static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                          uint32 security_info_sent,
+                          uint32_t security_info_sent,
                           const struct security_descriptor *psd)
 {
        struct afs_acl old_afs_acl, new_afs_acl;
        struct afs_acl dir_acl, file_acl;
-       char acl_string[2049];
+       char acl_string[MAXSIZE];
        struct afs_iob iob;
        int ret = -1;
        char *name = NULL;
@@ -904,7 +913,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
        fileacls = lp_parm_const_string(SNUM(handle->conn), "afsacl", "fileacls",
                                        "yes");
 
-       sidpts = lp_parm_bool(SNUM(handle->conn), "afsacl", "sidpts", False);
+       sidpts = lp_parm_bool(SNUM(handle->conn), "afsacl", "sidpts", false);
 
        ZERO_STRUCT(old_afs_acl);
        ZERO_STRUCT(new_afs_acl);
@@ -999,7 +1008,8 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 
 static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle,
                                   struct files_struct *fsp,
-                                  uint32 security_info,
+                                  uint32_t security_info,
+                                  TALLOC_CTX *mem_ctx,
                                   struct security_descriptor **ppdesc)
 {
        struct afs_acl acl;
@@ -1007,13 +1017,13 @@ static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle,
 
        DEBUG(5, ("afsacl_fget_nt_acl: %s\n", fsp_str_dbg(fsp)));
 
-       sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False);
+       sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", false);
 
        if (!afs_get_afs_acl(fsp->fsp_name->base_name, &acl)) {
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       sd_size = afs_fto_nt_acl(&acl, fsp, security_info, ppdesc);
+       sd_size = afs_fto_nt_acl(&acl, fsp, security_info, mem_ctx, ppdesc);
 
        free_afs_acl(&acl);
 
@@ -1021,31 +1031,30 @@ static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle,
 }
 
 static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
-                                 const char *name,  uint32 security_info,
+                                 const char *name, uint32_t security_info,
+                                 TALLOC_CTX *mem_ctx,
                                  struct security_descriptor **ppdesc)
 {
        struct afs_acl acl;
        size_t sd_size;
        struct smb_filename *smb_fname = NULL;
-       NTSTATUS status;
 
        DEBUG(5, ("afsacl_get_nt_acl: %s\n", name));
 
-       sidpts = lp_parm_bool(SNUM(handle->conn), "afsacl", "sidpts", False);
+       sidpts = lp_parm_bool(SNUM(handle->conn), "afsacl", "sidpts", false);
 
        if (!afs_get_afs_acl(name, &acl)) {
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       status = create_synthetic_smb_fname(talloc_tos(), name, NULL, NULL,
-                                           &smb_fname);
-       if (!NT_STATUS_IS_OK(status)) {
+       smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL);
+       if (smb_fname == NULL) {
                free_afs_acl(&acl);
-               return status;
+               return NT_STATUS_NO_MEMORY;
        }
 
        sd_size = afs_to_nt_acl(&acl, handle->conn, smb_fname, security_info,
-                               ppdesc);
+                               mem_ctx, ppdesc);
        TALLOC_FREE(smb_fname);
 
        free_afs_acl(&acl);
@@ -1053,9 +1062,9 @@ static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
        return (sd_size != 0) ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED;
 }
 
-NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle,
+static NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle,
                         files_struct *fsp,
-                        uint32 security_info_sent,
+                        uint32_t security_info_sent,
                         const struct security_descriptor *psd)
 {
        return afs_set_nt_acl(handle, fsp, security_info_sent, psd);
@@ -1080,11 +1089,27 @@ static int afsacl_connect(vfs_handle_struct *handle,
        return 0;
 }
 
+/* We don't have a linear form of the AFS ACL yet */
+static int afsacl_sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob)
+{
+       errno = ENOSYS;
+       return -1;
+}
+
+/* We don't have a linear form of the AFS ACL yet */
+static int afsacl_sys_acl_blob_get_fd(vfs_handle_struct *handle, files_struct *fsp, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob)
+{
+       errno = ENOSYS;
+       return -1;
+}
+
 static struct vfs_fn_pointers vfs_afsacl_fns = {
        .connect_fn = afsacl_connect,
-       .fget_nt_acl = afsacl_fget_nt_acl,
-       .get_nt_acl = afsacl_get_nt_acl,
-       .fset_nt_acl = afsacl_fset_nt_acl
+       .fget_nt_acl_fn = afsacl_fget_nt_acl,
+       .get_nt_acl_fn = afsacl_get_nt_acl,
+       .fset_nt_acl_fn = afsacl_fset_nt_acl,
+       .sys_acl_blob_get_file_fn = afsacl_sys_acl_blob_get_file,
+       .sys_acl_blob_get_fd_fn = afsacl_sys_acl_blob_get_fd
 };
 
 NTSTATUS vfs_afsacl_init(void);