s3-talloc Change TALLOC_ARRAY() to talloc_array()
[samba.git] / source3 / modules / vfs_cap.c
index 7edbb8783c74fd4ee04290ae6a6e0dfe87c73cab..15bebf6fea020f147fc49ff2494a828be235b4d0 100644 (file)
@@ -23,6 +23,7 @@
 
 
 #include "includes.h"
+#include "smbd/smbd.h"
 
 /* cap functions */
 static char *capencode(TALLOC_CTX *ctx, const char *from);
@@ -74,7 +75,7 @@ static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle,
        }
        DEBUG(3,("cap: cap_readdir: %s\n", newname));
        newnamelen = strlen(newname)+1;
-       newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY(talloc_tos(),
+       newdirent = (SMB_STRUCT_DIRENT *)talloc_array(talloc_tos(),
                        char,
                        sizeof(SMB_STRUCT_DIRENT)+
                                newnamelen);
@@ -384,7 +385,7 @@ static int cap_mknod(vfs_handle_struct *handle, const char *path, mode_t mode, S
        return SMB_VFS_NEXT_MKNOD(handle, cappath, mode, dev);
 }
 
-static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *resolved_path)
+static char *cap_realpath(vfs_handle_struct *handle, const char *path)
 {
         /* monyo need capencode'ed and capdecode'ed? */
        char *cappath = capencode(talloc_tos(), path);
@@ -393,7 +394,7 @@ static char *cap_realpath(vfs_handle_struct *handle, const char *path, char *res
                errno = ENOMEM;
                return NULL;
        }
-       return SMB_VFS_NEXT_REALPATH(handle, path, resolved_path);
+       return SMB_VFS_NEXT_REALPATH(handle, cappath);
 }
 
 static int cap_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode)
@@ -575,7 +576,7 @@ static struct vfs_fn_pointers vfs_cap_fns = {
        .readdir = cap_readdir,
        .mkdir = cap_mkdir,
        .rmdir = cap_rmdir,
-       .open = cap_open,
+       .open_fn = cap_open,
        .rename = cap_rename,
        .stat = cap_stat,
        .lstat = cap_lstat,
@@ -662,7 +663,7 @@ static char *capencode(TALLOC_CTX *ctx, const char *from)
        }
        len++;
 
-       to = TALLOC_ARRAY(ctx, char, len);
+       to = talloc_array(ctx, char, len);
        if (!to) {
                return NULL;
        }
@@ -695,14 +696,15 @@ static char *capdecode(TALLOC_CTX *ctx, const char *from)
        size_t len = 0;
 
        for (p1 = from; *p1; len++) {
-               if (is_hex(from)) {
+               if (is_hex(p1)) {
                        p1 += 3;
                } else {
                        p1++;
                }
        }
+       len++;
 
-       to = TALLOC_ARRAY(ctx, char, len);
+       to = talloc_array(ctx, char, len);
        if (!to) {
                return NULL;
        }