vfs: Require that VFS_CONNECT be called before using xattr_tdb hooks vfs-connect
authorAndrew Bartlett <abartlet@samba.org>
Wed, 10 Oct 2012 03:10:56 +0000 (14:10 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 10 Oct 2012 10:04:29 +0000 (21:04 +1100)
This will help find bugs in our VFS callers, that otherwise would only
show up in failures with less-often-used modules.

Andrew Bartlett

source3/modules/vfs_xattr_tdb.c

index 108b99de1de8fb5af622f5023c6d763147ca4239..94685c769e89a920d184bd05aa30bf5743410500 100644 (file)
@@ -67,11 +67,7 @@ static ssize_t xattr_tdb_getxattr(struct vfs_handle_struct *handle,
        DATA_BLOB blob;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        ret = xattr_tdb_get_file_id(handle, path, &id);
        if (ret == -1) {
@@ -106,11 +102,7 @@ static ssize_t xattr_tdb_fgetxattr(struct vfs_handle_struct *handle,
        DATA_BLOB blob;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        if (SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf) == -1) {
                TALLOC_FREE(frame);
@@ -144,11 +136,7 @@ static int xattr_tdb_setxattr(struct vfs_handle_struct *handle,
        int ret;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        ret = xattr_tdb_get_file_id(handle, path, &id);
        if (ret == -1) {
@@ -172,11 +160,7 @@ static int xattr_tdb_fsetxattr(struct vfs_handle_struct *handle,
        int ret;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        if (SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf) == -1) {
                TALLOC_FREE(frame);
@@ -199,11 +183,7 @@ static ssize_t xattr_tdb_listxattr(struct vfs_handle_struct *handle,
        int ret;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        ret = xattr_tdb_get_file_id(handle, path, &id);
        if (ret == -1) {
@@ -227,11 +207,7 @@ static ssize_t xattr_tdb_flistxattr(struct vfs_handle_struct *handle,
        int ret;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        if (SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf) == -1) {
                TALLOC_FREE(frame);
@@ -253,11 +229,7 @@ static int xattr_tdb_removexattr(struct vfs_handle_struct *handle,
        int ret;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        ret = xattr_tdb_get_file_id(handle, path, &id);
        if (ret == -1) {
@@ -280,11 +252,7 @@ static int xattr_tdb_fremovexattr(struct vfs_handle_struct *handle,
        int ret;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        if (SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf) == -1) {
                TALLOC_FREE(frame);
@@ -352,11 +320,7 @@ static int xattr_tdb_unlink(vfs_handle_struct *handle,
        bool remove_record = false;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        status = copy_smb_filename(frame, smb_fname, &smb_fname_tmp);
        if (!NT_STATUS_IS_OK(status)) {
@@ -409,11 +373,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
        int ret;
        TALLOC_CTX *frame = talloc_stackframe();
 
-       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
-                               if (!xattr_tdb_init(-1, frame, &db))
-                               {
-                                       TALLOC_FREE(frame); return -1;
-                               });
+       SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,return -1);
 
        if (vfs_stat_smb_fname(handle->conn, path, &sbuf) == -1) {
                TALLOC_FREE(frame);