]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_fruit: fix fruit_ftruncate with metadata=stream
authorRalph Boehme <slow@samba.org>
Tue, 15 Nov 2016 19:32:05 +0000 (20:32 +0100)
committerUri Simchoni <uri@samba.org>
Wed, 1 Mar 2017 23:32:20 +0000 (00:32 +0100)
With this the test "setinfo eof AFP_AfpInfo" passed with
fruit:metadata=stream.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12427

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/modules/vfs_fruit.c

index d9ccd6c4026e15aa81fd196c553ea4bb3f8074e2..a383e3890a58c825d005f0a836d7bada5e9d8df9 100644 (file)
@@ -3323,30 +3323,6 @@ static int fruit_fallocate(struct vfs_handle_struct *handle,
        return -1;
 }
 
-static int fruit_ftruncate_meta(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp,
-                               off_t offset,
-                               struct adouble *ad)
-{
-       struct fruit_config_data *config;
-
-       SMB_VFS_HANDLE_GET_DATA(handle, config,
-                               struct fruit_config_data, return -1);
-
-       if (offset > 60) {
-               DBG_WARNING("ftruncate %s to %jd",
-                           fsp_str_dbg(fsp), (intmax_t)offset);
-               /* OS X returns NT_STATUS_ALLOTTED_SPACE_EXCEEDED  */
-               errno = EOVERFLOW;
-               return -1;
-       }
-
-       DBG_WARNING("ignoring ftruncate %s to %jd",
-                   fsp_str_dbg(fsp), (intmax_t)offset);
-       /* OS X returns success but does nothing  */
-       return 0;
-}
-
 static int fruit_ftruncate_rsrc(struct vfs_handle_struct *handle,
                                struct files_struct *fsp,
                                off_t offset,
@@ -3394,6 +3370,21 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle,
        DBG_DEBUG("fruit_ftruncate called for file %s offset %.0f\n",
                   fsp_str_dbg(fsp), (double)offset);
 
+       if (is_afpinfo_stream(fsp->fsp_name)) {
+               if (offset > 60) {
+                       DBG_WARNING("ftruncate %s to %jd",
+                                   fsp_str_dbg(fsp), (intmax_t)offset);
+                       /* OS X returns NT_STATUS_ALLOTTED_SPACE_EXCEEDED  */
+                       errno = EOVERFLOW;
+                       return -1;
+               }
+
+               DBG_WARNING("ignoring ftruncate %s to %jd",
+                           fsp_str_dbg(fsp), (intmax_t)offset);
+               /* OS X returns success but does nothing  */
+               return 0;
+       }
+
        if (ad == NULL) {
                return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
        }
@@ -3403,15 +3394,12 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle,
        }
 
        switch (ad->ad_type) {
-       case ADOUBLE_META:
-               rc = fruit_ftruncate_meta(handle, fsp, offset, ad);
-               break;
-
        case ADOUBLE_RSRC:
                rc = fruit_ftruncate_rsrc(handle, fsp, offset, ad);
                break;
 
        default:
+               DBG_ERR("unexpected ad_type [%d]\n", ad->ad_type);
                return -1;
        }